Ejemplo n.º 1
0
 /**
  * get pmtables list
  *
  * @param string $httpData->start
  * @param string $httpData->limit
  * @param string $httpData->textFilter
  */
 public function getList($httpData)
 {
     G::LoadClass('configuration');
     G::LoadClass('processMap');
     G::LoadClass('pmTable');
     $configurations = new Configurations();
     $processMap = new processMap();
     // setting parameters
     $config = $configurations->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $env = $configurations->getConfiguration('ENVIRONMENT_SETTINGS', '');
     $limit_size = isset($config->pageSize) ? $config['pageSize'] : 20;
     $start = isset($httpData->start) ? $httpData->start : 0;
     $limit = isset($httpData->limit) ? $httpData->limit : $limit_size;
     $filter = isset($httpData->textFilter) ? $httpData->textFilter : '';
     $pro_uid = isset($httpData->pro_uid) ? $httpData->pro_uid : null;
     if ($pro_uid !== null) {
         $process = $pro_uid == '' ? array('not_equal' => $pro_uid) : array('equal' => $pro_uid);
         $addTables = AdditionalTables::getAll($start, $limit, $filter, $process);
         $c = $processMap->getReportTablesCriteria($pro_uid);
         $oDataset = RoutePeer::doSelectRS($c);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $reportTablesOldList = array();
         while ($oDataset->next()) {
             $reportTablesOldList[] = $oDataset->getRow();
         }
         $addTables['count'] += count($reportTablesOldList);
         foreach ($reportTablesOldList as $i => $oldRepTab) {
             $addTables['rows'][] = array('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'], 'PRO_UID' => $oldRepTab['PRO_UID'], 'DBS_UID' => $oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp', 'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'], 'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'], 'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'], 'TYPE' => 'CLASSIC');
         }
     } else {
         $addTables = AdditionalTables::getAll($start, $limit, $filter);
     }
     foreach ($addTables['rows'] as $i => $table) {
         try {
             $con = Propel::getConnection(pmTable::resolveDbSource($table['DBS_UID']));
             $stmt = $con->createStatement();
             $rs = $stmt->executeQuery('SELECT COUNT(*) AS NUM_ROWS from ' . $table['ADD_TAB_NAME']);
             if ($rs->next()) {
                 $r = $rs->getRow();
                 $addTables['rows'][$i]['NUM_ROWS'] = $r['NUM_ROWS'];
             } else {
                 $addTables['rows'][$i]['NUM_ROWS'] = 0;
             }
             //removing the prefix "PMT" to allow alphabetical order (just in view)
             if (substr($addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4) == 'PMT_') {
                 $addTables['rows'][$i]['ADD_TAB_NAME'] = substr($addTables['rows'][$i]['ADD_TAB_NAME'], 4);
             }
         } catch (Exception $e) {
             $addTables['rows'][$i]['NUM_ROWS'] = G::LoadTranslation('ID_TABLE_NOT_FOUND');
         }
     }
     return $addTables;
 }
Ejemplo n.º 2
0
     break;
 case 'list':
     require_once 'classes/model/AdditionalTables.php';
     G::LoadClass('configuration');
     G::LoadClass('processMap');
     $configigurations = new Configurations();
     $oProcessMap = new processMap();
     $config = $configigurations->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $env = $configigurations->getConfiguration('ENVIRONMENT_SETTINGS', '');
     $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
     $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
     $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
     $pro_uid = isset($_REQUEST['pro_uid']) ? $_REQUEST['pro_uid'] : '';
     $process = $pro_uid == '' ? array('not_equal' => $pro_uid) : array('equal' => $pro_uid);
     $addTab = AdditionalTables::getAll($start, $limit, $filter, $process);
     if ($pro_uid != '') {
         $c = $oProcessMap->getReportTablesCriteria($pro_uid);
         $oDataset = RoutePeer::doSelectRS($c);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $reportTablesOldList = array();
         while ($oDataset->next()) {
             $reportTablesOldList[] = $oDataset->getRow();
         }
         $addTab['count'] += count($reportTablesOldList);
         foreach ($reportTablesOldList as $i => $oldRepTab) {
             $addTab['rows'][] = array('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'], 'PRO_UID' => $oldRepTab['PRO_UID'], 'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'], 'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'], 'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'], 'TYPE' => 'CLASSIC');
         }
     }
     echo G::json_encode($addTab);
     break;