/**
  * Return array of object tags
  *
  * @param void
  * @return array
  */
 function getTags()
 {
     return Tags::toTags(parent::getTags());
 }
Пример #2
0
 /**
  * Return portal tags index for a given portal project ID
  * 
  * Index is an associative array of tags where key is the tag and value is
  * associative array of options:
  * 
  * - objects - IDs of all objects that have tags
  * - normal objects - IDs of objects marked as normal
  *
  * @param integer $project_id
  * @return array
  */
 function buildPortalIndex($project_id)
 {
     $result = array();
     $rows = db_execute_all('SELECT id, visibility, tags FROM ' . TABLE_PREFIX . 'project_objects WHERE project_id = ? AND tags != ? AND visibility >= ?', $project_id, '', VISIBILITY_NORMAL);
     if (is_foreachable($rows)) {
         foreach ($rows as $row) {
             $tags = Tags::toTags($row['tags']);
             if (is_foreachable($tags)) {
                 foreach ($tags as $tag) {
                     if (!isset($result[$tag])) {
                         $result[$tag] = array('objects' => array(), 'normal_objects' => array(), 'public_objects' => array());
                     }
                     // if
                     $result[$tag]['objects'][] = $row['id'];
                     switch ($row['visibility']) {
                         case VISIBILITY_NORMAL:
                             $result[$tag]['normal_objects'][] = $row['id'];
                             break;
                         case VISIBILITY_PUBLIC:
                             $result[$tag]['public_objects'][] = $row['id'];
                             break;
                     }
                     // switch
                 }
                 // foreach
             }
             // if
         }
         // foreach
     }
     // if
     return $result;
 }