Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Improve] Manual query improve ajax detil and view data
#1
Hello, previously menual query does not give any effect on the function ajax request detail data/drilldown, it will be very troublesome when we want to create complex queries. Now it has been made improvement, please copy and paste the following functions. You have to do is:
1. open the file on root_folder/application/models/services/Request_model.php
2. find this function drillDownData() or you can directly overwrite the code below.
3. done! enjoy  Angel

PHP Code:
/**
 * load drilldown/detail data
 * @param array $post
 * @param int $perpage
 * @return array
 */
public function drillDownData($post$perpage 0) {
 
   $this->___ci->load->model('manage/Module_model''module');
 
   $module     $this->___ci->module;
 
   //initialize variabel
 
   $moduleName $post['moduleName'];
 
   $moduleFK   $post['moduleFk'];
 
   $moduleFKID $post['moduleFkId'];

 
   //find module object
 
   $objModule  $module->find(array('moduleName' => $moduleName));
 
   $tblName    $objModule->moduleDb;
 
   //loda model by module name
 
   $this->___ci->load->model(MODULE_DEFAULT_PATH $moduleName PREFIX_MODEL_NAME$moduleName);

 
   //current model instant
 
   $currentModel $this->___ci->{$moduleName};
 
   //setting limit and offset
 
   if (!empty($perpage)) $currentModel->limit $perpage;
 
   if (isset($post['offset'])) $currentModel->offset $post['offset'];

 
   //disable query cache
 
   $currentModel->setQueryCache(false);
 
   //if manual query are provided
 
   $arrayRawQuery $this->cfggenerator->loadQueryFields($moduleName);
 
   //if manual query then 
 
   if (is_object($arrayRawQuery) && !empty($arrayRawQuery->select)) {
 
       $condition  "{$tblName}.{$moduleFK} = '{$moduleFKID}'";
 
       $arrData $currentModel->searchByRaw($arrayRawQuery$condition);
 
   //otherwise
 
   } else {
 
       $condition  = array($tblName.".".$moduleFK => $moduleFKID);
 
       $arrData $currentModel->get($condition);
 
   }

 
   return $arrData;


or if you do not understand anything about coding, please update your application by downloading the zip file update. Goto this thread: Application Update
Reply
#2
we also make improvements and increase in view of data , which in previous versions of the manual query does not affect anything in the view data. follow the steps below to update your application:

1. open the file on root_folder/application/core/MY_Controller.php

2. find this function view() or you can directly overwrite the code below.
3. done! enjoy  [Image: angel.png] 

PHP Code:
/**
 * show view information detail data from row
 * @param int $id(record)
 */
public function view($id 0) {
 
   $this->load->model('table_model''table');

 
   $currentClass       $this->_currentClass;
 
   $arrayRawQuery      $this->cfggenerator->loadQueryFields($currentClass);
 
   if (is_object($arrayRawQuery) && !empty($arrayRawQuery->select)) {
 
       $tblName        $this->{$currentClass}->getTblName();
 
       $tblPk          $this->{$currentClass}->getPrimaryKey();
 
       $condition      "{$tblName}.{$tblPk} = '{$id}'";
 
       $dataResult     $this->{$currentClass}->searchByRaw($arrayRawQuery$condition);
 
       $data['obj'   = isset($dataResult[0]) ? $dataResult[0] : null;
 
   } else {
 
       $data['obj'   $this->{$currentClass}->find($id);
 
   }

 
   $data['settings'  getSession(SESSION_NAME.'_settingsInfo');
 
   $data['formFields'] = $this->cfggenerator->loadStructureFields($currentClassROOTKEY_FORM);
 
   $data['gridFields'] = $this->cfggenerator->loadStructureFields($currentClassROOTKEY_GRID);
 
   $data['viewFields'] = $this->cfggenerator->loadGridViewFields($currentClass);

 
   $this->load->view("{$this->baseViewDir}/{$this->viewPage}"$data);


or if you do not understand anything about coding, please update your application by downloading the zip file update. Goto this thread: Application Update
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)