public function info($pa_parameters) { parent::info($pa_parameters); $o_dm = Datamodel::load(); $t_item = $this->view->getVar('t_item'); $vn_item_id = $t_item->getPrimaryKey(); // get parent items $va_ancestors = array_reverse(caExtractValuesByUserLocaleFromHierarchyAncestorList($t_item->getHierarchyAncestors(null, array('additionalTableToJoin' => 'ca_relationship_type_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('typename', 'typename_reverse', 'description', 'description_reverse', 'locale_id'), 'includeSelf' => false)), 'type_id', 'typename', 'type_code')); $vn_rel_table_num = $t_item->get('table_num'); array_shift($va_ancestors); // get rid of hierarchy root record, which should not be displayed $this->view->setVar('ancestors', $va_ancestors); return $this->render('widget_relationship_type_info_html.php', true); }
/** * Sets up view variables for upper-left-hand info panel (aka. "inspector"). Actual rendering is performed by calling sub-class. * * @param array $pa_parameters Array of parameters as specified in navigation.conf, including primary key value and type_id */ public function info($pa_parameters) { $o_dm = Datamodel::load(); $t_item = $o_dm->getInstanceByTableName($this->ops_table_name, true); $vs_pk = $t_item->primaryKey(); $vs_label_table = $t_item->getLabelTableName(); $t_label = $t_item->getLabelTableInstance(); $vs_display_field = $t_label->getDisplayField(); $vn_item_id = isset($pa_parameters[$vs_pk]) ? $pa_parameters[$vs_pk] : null; $vn_type_id = isset($pa_parameters['type_id']) ? $pa_parameters['type_id'] : null; $t_item->load($vn_item_id); if (!$this->_checkAccess($t_item, array('dontRedirectOnDelete' => true))) { $t_item->clear(); $t_item->clearErrors(); } if ($t_item->getPrimaryKey()) { if (method_exists($t_item, "getRepresentations")) { $this->view->setVar('representations', $t_item->getRepresentations(array('preview170', 'preview'))); } else { if ($t_item->tableName() === 'ca_object_representations') { $this->view->setVar('representations', array($t_item->getFieldValuesArray())); } } if ($t_item->isHierarchical()) { // get parent objects $va_ancestors = array_reverse(caExtractValuesByUserLocaleFromHierarchyAncestorList($t_item->getHierarchyAncestors(null, array('additionalTableToJoin' => $vs_label_table, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_field, 'locale_id'), 'additionalTableWheres' => $t_label->hasField('is_preferred') ? array("({$vs_label_table}.is_preferred = 1 OR {$vs_label_table}.is_preferred IS NULL)") : array(), 'includeSelf' => false)), $vs_pk, $vs_display_field, 'idno')); $this->view->setVar('object_collection_collection_ancestors', array()); // collections to display as object parents when ca_objects_x_collections_hierarchy_enabled is enabled if ($t_item->tableName() == 'ca_objects' && $t_item->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled')) { // Is object part of a collection? if (is_array($va_collections = $t_item->getRelatedItems('ca_collections'))) { $this->view->setVar('object_collection_collection_ancestors', $va_collections); } } $this->view->setVar('ancestors', $va_ancestors); $va_children = caExtractValuesByUserLocaleFromHierarchyChildList($t_item->getHierarchyChildren(null, array('additionalTableToJoin' => $vs_label_table, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_field, 'locale_id'), 'additionalTableWheres' => $t_label->hasField('is_preferred') ? array("({$vs_label_table}.is_preferred = 1 OR {$vs_label_table}.is_preferred IS NULL)") : array(), 'includeSelf' => false)), $vs_pk, $vs_display_field, 'idno'); $this->view->setVar('children', $va_children); } } else { $t_item->set('type_id', $vn_type_id); } $this->view->setVar('t_item', $t_item); $this->view->setVar('screen', $this->request->getActionExtra()); // name of screen $this->view->setVar('result_context', $this->getResultContext()); $this->view->setVar('t_ui', $t_ui = $this->_getUI($vn_type_id, $pa_options)); //$va_export_options = array(); //foreach($va_mappings as $vn_mapping_id => $va_mapping_info) { // $va_export_options[$va_mapping_info['name']] = $va_mapping_info['mapping_id']; //} //$this->view->setVar('available_mappings', $va_export_options); //$this->view->setVar('available_mappings_as_html_select', sizeof($va_export_options) ? caHTMLSelect('mapping_id', $va_export_options, array("style" => "width: 120px;")) : ''); }