コード例 #1
0
ファイル: BrowseEngine.php プロジェクト: kai-iak/pawtucket2
 /**
  * Converts list of relationships type codes and/or numeric ids to an id-only list
  */
 private function _getRelationshipTypeIDs($pa_relationship_types, $pm_relationship_table_or_id)
 {
     $t_rel_type = new ca_relationship_types();
     $va_type_list = $pa_relationship_types;
     foreach ($va_type_list as $vn_i => $vm_type) {
         if (!trim($vm_type)) {
             unset($pa_relationship_types[$vn_i]);
             continue;
         }
         if (!is_numeric($vm_type)) {
             // try to translate item_value code into numeric id
             if (!($vn_type_id = $t_rel_type->getRelationshipTypeID($pm_relationship_table_or_id, $vm_type))) {
                 unset($pa_relationship_types[$vn_i]);
                 continue;
             }
             unset($pa_relationship_types[$vn_i]);
             $pa_relationship_types[] = $vn_type_id;
         } else {
             if (!$t_rel_type->load($vm_type)) {
                 unset($pa_relationship_types[$vn_i]);
                 continue;
             }
             $vn_type_id = $t_rel_type->getPrimaryKey();
         }
         $va_ids = $t_rel_type->getHierarchy($vn_type_id, array('idsOnly' => true));
         if (is_array($va_ids)) {
             foreach ($va_ids as $vn_id) {
                 $pa_relationship_types[] = $vn_id;
             }
         }
     }
     return $pa_relationship_types;
 }