/** * Return the value of a generic item * * Gets the value of a generic item. This implementation adds the field * feature to the TIP_Module::getItem() method. * * Getting an item performs some search operations with this priority: * * - Try to get the field in the current row throught getField(). * * - If the field is not found but the current view is not a TIP_Data_View * (that is, it is not a TIP_Data_View object), it scans the view stack * for the last view that was of TIP_Data_View type and checks if $id is * present as a field in the current row. * This because views others than TIP_Data_View are considered "weaks", * that is their values are not built from real data fields. * * - Summary value of the current view throught getSummary(). * * - Chain-up the parent method TIP_Module::getItem(). * * The first succesful search operation will stop the sequence. * * @param string $id The item id * @return mixed|null The value of the item or null if not found */ public function getItem($id) { if (!is_null($value = $this->getField($id))) { return $value; } if (isset($this->_view) && !$this->_view instanceof TIP_Data_View) { // Find the last TIP_Data_View $stack =& $this->_views; end($stack); do { prev($stack); $view_id = key($stack); } while (isset($view_id) && !$stack[$view_id] instanceof TIP_Data_View); if (isset($view_id) && !is_null($value = $stack[$view_id]->getField($id))) { return $value; } } $value = $this->getSummary($id); if (!is_null($value)) { return $value; } return parent::getItem($id); }
protected function postConstructor() { parent::postConstructor(); // This must be called here (not in checkOptions()) to avoid // buildActionUri() call before application instantiation isset($this->fatal_uri) || ($this->fatal_uri = TIP::buildActionUri($this->id, 'fatal')); $this->keys['TITLE'] =& $this->title; $this->keys['DESCRIPTION'] =& $this->description; $this->keys['KEYWORDS'] =& $this->keywords; $this->keys['ROOT'] = TIP::getRoot(); $this->keys['HOME'] = TIP::getHome(); $this->keys['REFERER'] = ''; // Set $_request $module = TIP::getGet('module', 'string'); $action = TIP::getGet('action', 'string'); if (!$action) { $module = TIP::getPost('module', 'string'); $action = TIP::getPost('action', 'string'); } $this->_request = array('uri' => @$_SERVER['REQUEST_URI'], 'module' => @strtolower($module), 'action' => @strtolower($action), 'id' => TIP::getGetOrPost('id', 'string')); $this->keys['REQUEST'] = $this->_request['uri']; $this->keys['MODULE'] = $this->_request['module']; $this->keys['ACTION'] = $this->_request['action']; // The ID global key will be assigned when the requested module // is loaded, so a type casting can be forced (because the id_type // of the module is known) $this->keys['ID'] = ''; // Start the session TIP_AHAH || $this->_startSession(); }
/** * Return the value of a generic item * * Gets the value of a generic item. This implementation adds form * specific features to the TIP_Module::getItem() method, such as * the ability to get information from the current element or from * the current section. * * @param string $id The item id * @return mixed|null The value of the item or null if not found */ public function getItem($id) { if (isset($this->_element_view) && !is_null($value = $this->_element_view->getField($id))) { return $value; } if (isset($this->_section_view) && !is_null($value = $this->_section_view->getField($id))) { return $value; } return parent::getItem($id); }