Example #1
0
 protected function getData($p)
 {
     $rez = array();
     if (empty($p)) {
         return $rez;
     }
     // form columns
     L\initTranslations();
     $defaultColumns = Config::getDefaultGridColumnConfigs();
     $columns = $defaultColumns;
     // retreive data
     $p['start'] = 0;
     $p['rows'] = 500;
     $sr = new \CB\BrowserView();
     $results = $sr->getChildren($p);
     if (!empty($results['DC'])) {
         $columns = array();
         foreach ($results['DC'] as $colName => $col) {
             if (@$col['hidden'] !== true) {
                 $columns[$colName] = $col;
             }
         }
     }
     $colTitles = array();
     foreach ($columns as $name => &$col) {
         $colTitles[] = empty($defaultColumns[$name]) ? @Util\coalesce($col['title'], $name) : $defaultColumns[$name]['title'];
     }
     //insert header
     $rez[] = $colTitles;
     while (!empty($results['data'])) {
         foreach ($results['data'] as $r) {
             $record = array();
             foreach ($columns as $colName => $col) {
                 if (@$col['xtype'] == 'datecolumn') {
                     $value = Util\dateISOToMysql(@$r[$colName]);
                     if (!empty($col['format'])) {
                         $value = Util\formatMysqlTime($value, $col['format']);
                     } else {
                         $value = Util\formatMysqlTime($value);
                         $tmp = explode(' ', $value);
                         if (!empty($tmp[1]) && $tmp[1] == '00:00') {
                             $value = $tmp[0];
                         }
                     }
                     $record[] = $value;
                 } elseif (strpos($colName, 'date') === false) {
                     if (in_array($colName, array('oid', 'cid', 'uid')) && !empty($r[$colName])) {
                         $record[] = User::getDisplayName($r[$colName]);
                     } else {
                         $record[] = @$r[$colName];
                     }
                 }
             }
             $rez[] = $record;
         }
         if ($p['start'] + $p['rows'] < $results['total']) {
             $p['start'] += $p['rows'];
             $results = $sr->getChildren($p);
         } else {
             $results['data'] = array();
         }
     }
     return $rez;
 }
Example #2
0
 /**
  * get display columns for last node in active path
  * @return array
  */
 public function getDC()
 {
     $rez = array();
     $p =& $this->params;
     $ip =& $p['inputParams'];
     if (!empty($ip['query'])) {
         $dc = Config::get('search_DC');
         //its a config reference, get it from config
         if (!empty($dc) && is_scalar($dc)) {
             $dc = Config::getDCConfig($dc);
         }
         $rez['data'] = $dc;
     }
     if (empty($rez['data'])) {
         $path = Cache::get('current_path');
         if (!empty($path)) {
             $node = $path[sizeof($path) - 1];
             $rez = $node->getDC();
         }
     }
     if (!empty($ip['query'])) {
         $rez['from'] = 'search';
     }
     //apply properties for default casebox columns
     if (!empty($rez['data'])) {
         $defaults = Config::getDefaultGridColumnConfigs();
         foreach ($rez['data'] as $k => $v) {
             if (!empty($defaults[$k])) {
                 $rez['data'][$k] = array_merge($defaults[$k], $v);
             }
         }
     }
     return $rez;
 }
Example #3
0
 /**
  * get display columns for last node in active path
  * @return array
  */
 public function getDC()
 {
     $rez = array();
     $path = Cache::get('current_path');
     if (!empty($path)) {
         $node = $path[sizeof($path) - 1];
         $rez = $node->getNodeParam('DC');
     }
     //apply properties for default casebox columns
     if (!empty($rez['data'])) {
         $defaults = Config::getDefaultGridColumnConfigs();
         foreach ($rez['data'] as $k => $v) {
             if (!empty($defaults[$k])) {
                 $rez['data'][$k] = array_merge($defaults[$k], $v);
             }
         }
     }
     return $rez;
 }