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); }
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 getPackages() { $packageTable = JTable::getInstance("Package", "JTable"); $packages = $packageTable->getPackages(); foreach ($packages as $package) { $package->features = explode(",", $package->featuresS); } if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updatePackagesTranslation($packages); } return $packages; }
function getEvent() { $eventsTable = JTable::getInstance("Event", "JTable"); $event = $eventsTable->getEvent($this->eventId); $event->pictures = $eventsTable->getEventPictures($this->eventId); $eventsTable->increaseViewCount($this->eventId); $companiesTable = JTable::getInstance("Company", "JTable"); $company = $companiesTable->getCompany($event->company_id); $event->company = $company; if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateEntityTranslation($event, EVENT_DESCRIPTION_TRANSLATION); } return $event; }
function getCompaniesByLetter() { $companiesTable = $this->getTable("Company"); $categoryId = JRequest::getVar('categoryId'); $companies = $companiesTable->getCompaniesByLetter($this->letter, $this->enablePackages, $this->showPendingApproval, $this->getState('limitstart'), $this->getState('limit')); foreach ($companies as $company) { $company->packageFeatures = explode(",", $company->features); $attributesTable = $this->getTable('CompanyAttributes'); $company->customAttributes = $attributesTable->getCompanyAttributes($company->id); } if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateBusinessListingsTranslation($companies); JBusinessDirectoryTranslations::updateBusinessListingsSloganTranslation($companies); } return $companies; }
function getOffer() { $offersTable = JTable::getInstance("Offer", "JTable"); $offer = $offersTable->getOffer($this->offerId); $offer->pictures = $offersTable->getOfferPictures($this->offerId); $offersTable->increaseViewCount($this->offerId); $companiesTable = JTable::getInstance("Company", "JTable"); $company = $companiesTable->getCompany($offer->companyId); $offer->company = $company; $offersTable = JTable::getInstance("Offer", "JTable"); if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateEntityTranslation($offer, OFFER_DESCRIPTION_TRANSLATION); } $offer->attachments = JBusinessDirectoryAttachments::getAttachemnts(OFFER_ATTACHMENTS, $this->offerId); return $offer; }
function getCategory() { $categoryTable = $this->getTable("Category", "JBusinessTable"); $category = $categoryTable->getCategoryById($this->categoryId); if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateEntityTranslation($category, CATEGORY_TRANSLATION); } return $category; }
function getEvents() { $eventsTable = JTable::getInstance("Event", "JTable"); $searchDetails = $this->getSearchParameters(); $events = $eventsTable->getEventsByCategories($searchDetails, $this->getState('limitstart'), $this->getState('limit')); if ($this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateEventsTranslation($events); } return $events; }
function getCompanyEvents() { $table = $this->getTable("Event"); $events = $table->getCompanyEvents(JRequest::getVar('companyId')); if (!empty($events) && $this->appSettings->enable_multilingual) { JBusinessDirectoryTranslations::updateEventsTranslation($events); } return $events; }