示例#1
0
 /**
  * Retrieve object category data.
  *
  * @param array   $obj                   The object we wish to retrieve metadata for.
  * @param string  $tablename             The object's tablename.
  * @param string  $idcolumn              The object's idcolumn (optional) (default='id').
  * @param string  $assocKey              The field to use for the associative array index (optional) (default='id').
  * @param boolean $enablePermissionCheck Whether or not to enable the permission filter (optional) (default=true).
  *
  * @return The object with the meta data filled in
  */
 public static function retrieveObjectCategoriesObjects($obj, $tablename, $idcolumn = 'id', $assocKey = '', $enablePermissionCheck = true)
 {
     $catlist = self::retrieveObjectCategoriesList($obj, $tablename, $idcolumn);
     if (!$catlist) {
         return array();
     }
     $cats = implode(',', array_values($catlist));
     $where = "c.id IN ({$cats})";
     $catsdata = CategoryUtil::getCategories($where, '', 'id', $enablePermissionCheck);
     $result = array();
     foreach ($catlist as $prop => $cat) {
         if (isset($catsdata[$cat])) {
             $result[$prop] = $catsdata[$cat];
         }
     }
     return $result;
 }