public function info($pa_parameters) { parent::info($pa_parameters); $t_tour = $this->view->getVar('t_item'); if ($t_tour->getPrimaryKey()) { $va_labels = $t_tour->getDisplayLabels(); $this->view->setVar('labels', $t_tour->getPrimaryKey() ? $va_labels : array()); $this->view->setVar('idno', $t_tour->get('idno')); } $t_stop = new ca_tour_stops(); $t_stop->load(array('tour_id' => $t_tour->getPrimaryKey(), 'parent_id' => null)); $this->view->setVar('t_stop', $t_stop); if ($vn_stop_id = $t_stop->getPrimaryKey()) { $va_children = caExtractValuesByUserLocaleFromHierarchyChildList($t_stop->getHierarchyChildren(null, array('additionalTableToJoin' => 'ca_tour_stop_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name', 'locale_id'))), 'stop_id', 'name', 'idno'); $this->view->setVar('children', $va_children); } return $this->render('widget_tour_info_html.php', true); }
public function info($pa_parameters) { parent::info($pa_parameters); $t_list = $this->view->getVar('t_item'); if ($t_list->getPrimaryKey()) { $va_labels = $t_list->getDisplayLabels(); $this->view->setVar('labels', $t_list->getPrimaryKey() ? $va_labels : array()); $this->view->setVar('idno', $t_list->get('idno')); } $t_list_item = new ca_list_items(); $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null)); $this->view->setVar('t_list_item', $t_list_item); if ($vn_item_id = $t_list_item->getPrimaryKey()) { $va_children = caExtractValuesByUserLocaleFromHierarchyChildList($t_list_item->getHierarchyChildren(null, array('additionalTableToJoin' => 'ca_list_item_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name_plural', 'locale_id'), 'additionalTableWheres' => array('(ca_list_item_labels.is_preferred = 1 OR ca_list_item_labels.is_preferred IS NULL)'))), 'item_id', 'name_plural', 'item_value'); $this->view->setVar('children', $va_children); } return $this->render('widget_list_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;")) : ''); }