-
Notifications
You must be signed in to change notification settings - Fork 46
By Komal - Reporting - By default few columns are available. #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0cae3dd
dd5bc60
ac4948f
f3b20a3
8e82f04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,10 +166,24 @@ public function csvexport() | |
|
|
||
| foreach ($data['colToshow'] as $eachColumn) | ||
| { | ||
| $calHeading = strtoupper($eachColumn); | ||
| // Remove double Quotes from the data | ||
| $eachColumn = str_replace('"', '', $eachColumn); | ||
|
|
||
| // Remove single Quotes from the data | ||
| $eachColumn = str_replace("'", '', $eachColumn); | ||
|
|
||
| // Remove tabs and newlines from the data | ||
| $eachColumn2 = preg_replace('/(\r\n|\r|\n)+/', " ", $eachColumn); | ||
|
|
||
| // Remove extra spaces from the data | ||
| $final_eachColumn = preg_replace('/\s+/', " ", $eachColumn2); | ||
|
|
||
| // Add data in the Quotes and asign it in the csv array | ||
| // $csvData_arr1[] = '"' . $final_eachColumn . '"'; | ||
| $calHeading = strtoupper($final_eachColumn); | ||
| $plgReport = strtoupper($reportName); | ||
| $calHeading = 'PLG_TJREPORTS_' . $plgReport . '_' . $calHeading; | ||
| $csvData_arr[] = JText::_($calHeading); | ||
| $csvData_arr[] = '"' . JText::_($calHeading) . '"'; | ||
| } | ||
|
|
||
| $csvData .= implode(',', $csvData_arr); | ||
|
|
@@ -194,7 +208,20 @@ public function csvexport() | |
| { | ||
| if (in_array($index, $data['colToshow'])) | ||
| { | ||
| $csvData_arr1[] = $finalValue; | ||
| // Remove double Quotes from the data | ||
| $finalValue = str_replace('"', '', $finalValue); | ||
|
|
||
| // Remove single Quotes from the data | ||
| $finalValue = str_replace("'", '', $finalValue); | ||
|
|
||
| // Remove tabs and newlines from the data | ||
| $finalValue2 = preg_replace('/(\r\n|\r|\n)+/', " ", $finalValue); | ||
|
|
||
| // Remove extra spaces from the data | ||
| $final_text_value = preg_replace('/\s+/', " ", $finalValue2); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, use only single variable |
||
|
|
||
| // Add data in the Quotes and asign it in the csv array | ||
| $csvData_arr1[] = '"' . $final_text_value . '"'; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,7 +103,10 @@ public function getData($filters = array(), $colNames = array(), $rowsTofetch = | |
|
|
||
| if (empty($colNames)) | ||
| { | ||
| $colNames = $this->getColNames(); | ||
| // Get all column name for default report | ||
| $configcolNames = (array) $this->getconfigColNames(); | ||
|
|
||
| $colNames = (array) ($configcolNames['colToshow']); | ||
| } | ||
|
|
||
| $this->setAllUserPreference($reportName, $sortCol, $sortOrder, $colNames, $filters); | ||
|
|
@@ -199,9 +202,10 @@ public function getColNames() | |
|
|
||
| $colNames = array_intersect($plugcolNames[0], $confirgcols); | ||
|
|
||
| if (!empty($colNames)) | ||
| // Change By komal to show default field | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove your name, add issue id in comment |
||
| if (!empty($plugcolNames[0])) | ||
| { | ||
| return $colNames; | ||
| return $plugcolNames[0]; | ||
| } | ||
|
|
||
| return false; | ||
|
|
@@ -336,6 +340,39 @@ public function getQueryData($queryId) | |
| return $queryData; | ||
| } | ||
|
|
||
| /** | ||
| * By komal to show default field | ||
| * Get all Default fields names | ||
| * | ||
| * @return object | ||
| * | ||
| * @since 1.0 | ||
| */ | ||
| public function getDefaultReport() | ||
| { | ||
| $input = JFactory::getApplication()->input; | ||
| $reportName = $input->get('reportToBuild', '', 'STRING'); | ||
|
|
||
| if (empty($reportName)) | ||
| { | ||
| $mainframe = JFactory::getApplication(); | ||
| $reportName = $mainframe->getUserState('com_tjreports' . '.reportName', ''); | ||
| } | ||
|
|
||
| $db = JFactory::getDBO(); | ||
| $query = $db->getQuery(true); | ||
| $query->select('*'); | ||
| $query->from($db->quoteName('#__tj_reports', 'tjr')); | ||
| $query->where($db->quoteName('tjr.plugin') . ' = ' . $db->quote($reportName)); | ||
| $query->where($db->quoteName('tjr.default') . ' = ' . 1); | ||
| $query->where($db->quoteName('tjr.userid') . ' = ' . 0); | ||
| $query->where($db->quoteName('tjr.parent') . ' = ' . 0); | ||
| $db->setQuery($query); | ||
| $queryData = $db->loadObject(); | ||
|
|
||
| return $queryData; | ||
| } | ||
|
|
||
| /** | ||
| * Get all plugins names | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,15 @@ public function display($tpl = null) | |
| $param = json_decode($QueryData->param); | ||
| $this->colToshow = $param->colToshow; | ||
| } | ||
| // Added By komal to show default field | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove name, add issue id in comment if needed at all |
||
| else | ||
| { | ||
| $model = $this->getModel(); | ||
| $colToSelect = array('colToshow'); | ||
| $QueryData = $model->getDefaultReport(); | ||
| $param = json_decode($QueryData->param); | ||
| $this->colToshow = $param->colToshow; | ||
| } | ||
|
|
||
| $input = JFactory::getApplication()->input; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 3 different variables? eachColumn eachColumn2 final_eachColumn ?
only one should do.