Example #1
0
 function get($ID)
 {
     $timer = new timer();
     $where = "ID = '{$ID}'";
     if (!is_numeric($ID)) {
         $where = "email = '{$ID}'";
     }
     $result = $this->f3->get("DB")->exec("\n\t\t\tSELECT *\n\t\t\tFROM dir_users\n\t\t\tWHERE {$where};\n\t\t");
     if (count($result)) {
         $return = $result[0];
     } else {
         $return = parent::dbStructure("dir_users");
     }
     //test_array($return);
     $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
     return self::format($return);
 }
Example #2
0
 static function format($data, $highlight = false)
 {
     $timer = new timer();
     $single = false;
     //	test_array($items);
     if (isset($data['ID'])) {
         $single = true;
         $data = array($data);
     }
     //test_array($items);
     $i = 1;
     $n = array();
     //test_array($items);
     foreach ($data as $item) {
         if ($highlight) {
             $item = parent::highlight($item, $highlight);
         }
         $item['url'] = toAscii($item['name']);
         $n[] = $item;
     }
     if ($single) {
         $n = $n[0];
     }
     $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
     return $n;
 }
Example #3
0
 static function format($data, $childrenGrouping = false, $highlight = false)
 {
     $timer = new timer();
     $single = false;
     //	test_array($items);
     if (isset($data['ID'])) {
         $single = true;
         $data = array($data);
     }
     //test_array($items);
     $i = 1;
     $n = array();
     //test_array($items);
     foreach ($data as $item) {
         if ($highlight) {
             $item = parent::highlight($item, $highlight);
         }
         $item['url'] = toAscii($item['category']);
         $n[] = $item;
     }
     if ($single) {
         $n = $n[0];
     }
     $records = $n;
     if (count($records) && !isset($n['ID']) && $childrenGrouping) {
         $rows = array();
         foreach ($records as $row) {
             $row['children'] = array();
             $rows[$row['ID']] = $row;
         }
         foreach ($rows as $k => &$v) {
             if ($v['parentID'] == $v['ID']) {
                 continue;
             }
             if (isset($rows[$v['parentID']])) {
                 $rows[$v['parentID']]['children'][] =& $v;
             }
         }
         foreach ($rows as $item) {
             if ($item['parentID']) {
                 unset($rows[$item['ID']]);
             }
         }
         //	array_splice($rows, 2);
         //test_array($rows);
         $n = $rows;
         $nn = array();
         foreach ($n as $key => $item) {
             $nn[] = $item;
         }
         $n = $nn;
     }
     //test_array($n);
     $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
     return $n;
 }