Esempio n. 1
0
 function getData($show_subcategories = 1, $show_empty_categories = 0, $hide_categories = '')
 {
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery($show_subcategories, $show_empty_categories, $hide_categories);
         $this->_data = $this->_getList($query);
         $query_categories = $this->_buildQuerySubcategories();
         $this->_data_categories = $this->_getList($query_categories);
         $tree = array();
         $text = '';
         $tree = PhocaGalleryHelperFront::CategoryTree($this->_data_categories, $tree, 0, $text);
         $this->_data_categories = PhocaGalleryHelperFront::CategoryTreeCreating($this->_data_categories, $tree, 0);
         foreach ($this->_data_categories as $key => $value) {
             foreach ($this->_data as $key2 => $value2) {
                 if ($value->value == $value2->id) {
                     $this->_data_outcome = new JObject();
                     $this->_data_outcome->id = $value2->id;
                     $this->_data_outcome->parent_id = $value2->parent_id;
                     $this->_data_outcome->title = $value->text;
                     $this->_data_outcome->title_self = $value2->title;
                     $this->_data_outcome->name = $value2->name;
                     $this->_data_outcome->alias = $value2->alias;
                     $this->_data_outcome->image = $value2->image;
                     $this->_data_outcome->section = $value2->section;
                     $this->_data_outcome->image_position = $value2->image_position;
                     $this->_data_outcome->description = $value2->description;
                     $this->_data_outcome->published = $value2->published;
                     $this->_data_outcome->editor = $value2->editor;
                     $this->_data_outcome->ordering = $value2->ordering;
                     $this->_data_outcome->access = $value2->access;
                     $this->_data_outcome->count = $value2->count;
                     $this->_data_outcome->params = $value2->params;
                     $this->_data_outcome->catid = $value2->catid;
                     $this->_data_outcome->numlinks = $value2->numlinks;
                     $this->_data_outcome->slug = $value2->slug;
                     $this->_data_outcome->hits = $value2->hits;
                     $this->_data_outcome->username = $value2->username;
                     $this->_data_outcome->ratingaverage = $value2->ratingaverage;
                     $this->_data_outcome->ratingcount = $value2->ratingcount;
                     $this->_data_outcome->link = "";
                     $this->_data_outcome->filename = "";
                     $this->_data_outcome->linkthumbnailpath = "";
                     //	$query_filename 				= $this->_buildQueryFilename($value2->id);
                     //	$this->_data_filename 			= $this->_getList($query_filename);
                     $this->_data_filename = $this->_getRandomImageRecursive($value2->id);
                     if (!empty($this->_data_filename)) {
                         $this->_data_outcome->filename = $this->_data_filename->filename;
                     } else {
                         $this->_data_outcome->filename = '';
                     }
                     $this->_data_outcome_array[] = $this->_data_outcome;
                 }
             }
         }
         return $this->_data_outcome_array;
     }
 }
Esempio n. 2
0
 function CategoryTree($data, $tree, $id = 0, $text = '')
 {
     foreach ($data as $key) {
         $show_text = $text . $key->text;
         if ($key->parentid == $id) {
             $tree[$key->value] = $show_text;
             $tree = PhocaGalleryHelperFront::CategoryTree($data, $tree, $key->value, $show_text . " » ");
         }
     }
     return $tree;
 }