/** * Initializes any data for the page * @returns boolean. True on sucess. False on failture */ protected function initPage() { $factory = I2CE_FormFactory::instance(); $this->position = $factory->createContainer($this->get('id')); if (!$this->position instanceof iHRIS_Position) { return false; } $this->position->populate(); $this->template->setForm($this->position); if (($facilityField = $this->position->getField('facility')) instanceof I2CE_FormField_MAP) { if (($facility = $facilityField->getMappedFormObject()) instanceof I2CE_Form) { $this->template->setForm($facility); } } if (!$this->hasPermission('task(can_view_database_list_position)')) { $this->userMessage("You cannot view position information", 'notice', false); return; } return parent::initPage(); }
/** * Initializes any data for the page * @returns boolean. True on sucess. False on failture */ protected function initPage() { if ($this->loadObjects() === false) { return false; } if (!$this->checkActionPermission('view')) { $this->userMessage("You do not have permisison to view this information"); return false; } return parent::initPage(); }
/** * Initializes any data for the page * @returns boolean. True on sucess. False on failture */ protected function initPage() { if (!($primaryFormName = $this->getPrimaryFormName())) { I2CE::raiseError("No primary form set"); return false; } $ff = I2CE_FormFactory::instance(); if (!($primaryObjectClass = $ff->getClassName($primaryFormName))) { I2CE::raiseError("No object class associated to {$primaryFormName}"); return false; } if (!($this->primaryObject = $this->loadPrimaryObject()) instanceof $primaryObjectClass) { I2CE::raiseError("Invalid primary form"); return false; } if ($this->primaryObject->getID() == '0') { $this->setRedirect('home'); return true; } $this->template->setForm($this->primaryObject); return parent::initPage(); }
/** * Initializes any data for the page * @returns boolean. True on sucess. False on failture */ protected function initPage() { if (($this->parentForm = $this->getParentFormName()) === false) { return false; } if (($this->childForm = $this->getChildFormName()) === false) { return false; } if (!$this->loadParentObject()) { I2CE::raiseError("Failed to load parent object."); return false; } $parentID = $this->parent->getID(); if ($parentID == '0' || !I2CE_FormFactory::instance()->hasRecord($this->parentForm, $parentID)) { $message = "Unable to find that record for %s|%s."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/invalid_record"); $this->userMessage(vsprintf($message, array($this->parentForm, $parentID))); $this->setRedirect('home'); return true; } $this->template->setForm($this->parent); return parent::initPage(); }
/** * Initializes any data for the page. * @returns boolean. True on sucess. False on failture */ protected function initPage() { if (!$this->type) { return false; } $factory = I2CE_FormFactory::instance(); $this->list = $factory->createContainer($this->id); if (!$this->list instanceof I2CE_List) { I2CE::raiseError($this->id . " is not a list "); return false; } $permission = "task(can_view_database_list_{$this->type}|can_view_all_database_lists)"; if (!$this->permissionParser->hasPermission($permission)) { if ($this->list instanceof I2CE_List) { $list_name = $this->list->getDisplayName(); } else { $list_name = $this->type; } $this->userMessage("You don't have permission to view the list `" . $list_name . "`", 'notice'); $this->setRedirect("lists"); return false; } return parent::initPage(); }
/** * Initializes any data for the page * @returns boolean. True on sucess. False on failture */ protected function initPage() { if (!($primaryFormName = $this->getPrimaryFormName())) { I2CE::raiseError("No primary form set"); return false; } $ff = I2CE_FormFactory::instance(); if (!($primaryObjectClass = $ff->getClassName($primaryFormName))) { I2CE::raiseError("No object class associated to {$primaryFormName}"); return false; } if (!($this->primaryObject = $this->loadPrimaryObject()) instanceof $primaryObjectClass) { I2CE::raiseError("Invalid primary form"); return false; } $po_id = $this->primaryObject->getID(); if ($po_id == '0' || !I2CE_FormFactory::instance()->hasRecord($primaryFormName, $po_id)) { $message = "Unable to find that record for %s."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/invalid_record"); $this->userMessage(vsprintf($message, array($primaryFormName, $po_id))); $this->setRedirect('home'); return true; } $this->template->setForm($this->primaryObject); return parent::initPage(); }