function display($tpl = null) { $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->translations = JBusinessDirectoryTranslations::getAllTranslations(BUSSINESS_DESCRIPTION_TRANSLATION, $this->item->id); $this->translationsSlogan = JBusinessDirectoryTranslations::getAllTranslations(BUSSINESS_SLOGAN_TRANSLATION, $this->item->id); $this->languages = JBusinessUtil::getLanguages(); $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings(); $this->categoryOptions = JBusinessUtil::getCategoriesOptions(true); //get all upgrade packages - cannot downgrade $price = 0; if (!empty($this->item->lastActivePackage) && $this->item->lastActivePackage->expired == false) { $price = $this->item->lastActivePackage->price; } $this->packageOptions = JBusinessDirectoryHelper::getPackageOptions($price); $this->location = $this->get('Location'); $user = JFactory::getUser(); if ($this->item->userId != $user->id && $this->item->id != 0) { $msg = JText::_("LNG_ACCESS_RESTRICTED"); $app =& JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=managecompanies', $msg)); } $layout = JRequest::getVar("layout"); if (!empty($layout)) { $this->setLayout($layout); } parent::display($tpl); }
function display($tpl = null) { $this->companies = $this->get('UserCompanies'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->states = JBusinessDirectoryHelper::getStatuses(); $this->translations = JBusinessDirectoryTranslations::getAllTranslations(OFFER_DESCRIPTION_TRANSLATION, $this->item->id); $this->languages = JBusinessUtil::getLanguages(); //check if user has access to offer $user = JFactory::getUser(); $found = false; foreach ($this->companies as $company) { if ($company->userId == $user->id && $this->item->companyId == $company->id) { $found = true; } } $this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings(); $this->categoryOptions = JBusinessUtil::getCategoriesOptions(true); //redirect if the user has no access and the event is not new if (!$found && $this->item->id != 0) { $msg = JText::_("LNG_ACCESS_RESTRICTED"); $app =& JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_jbusinessdirectory&view=managecompanyoffers', $msg)); } parent::display($tpl); }