Пример #1
0
 /**
  *
  * Get K2 category children
  * @param int $catid
  * @param boolean $clear if true return array which is removed value construction
  * @return array
  */
 function getK2CategoryChildren($catid, $clear = false)
 {
     static $array = array();
     if ($clear) {
         $array = array();
     }
     $user = JFactory::getUser();
     $aid = $user->get('aid') ? $user->get('aid') : 1;
     $catid = (int) $catid;
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__k2_categories WHERE parent={$catid} AND published=1 AND trash=0 AND access<={$aid} ORDER BY ordering ";
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         array_push($array, $row->id);
         if (ModJASlideshow3::hasK2Children($row->id)) {
             ModJASlideshow3::getK2CategoryChildren($row->id);
         }
     }
     return $array;
 }