コード例 #1
0
 /**
  * Get all sub categories from cat_id
  *
  * @param integer $cat_id The category id to find
  * @return array All sub categories
  * @access private
  */
 function get_sub_cats($cat_id)
 {
     $sql = 'SELECT cat2.cat_id FROM phpgw_categories as cat ' . 'INNER JOIN phpgw_categories as cat2 ON cat.cat_id=cat2.cat_parent ' . 'WHERE ' . phpgwapi_sql::in('cat.cat_id', $cat_id);
     $this->db->query($sql, __LINE__, __FILE__);
     while ($this->db->next_record()) {
         $cats[] = $this->db->f('cat_id');
     }
     if (is_array($cats)) {
         return array_merge($cats, (array) $this->get_sub_cats($cats));
     }
 }