Пример #1
0
 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;
 }
Пример #2
0
 function getCompany($cmpId = null)
 {
     $companiesTable = $this->getTable("Company");
     $companyId = JRequest::getVar('companyId');
     if (isset($cmpId)) {
         $companyId = $cmpId;
     }
     if (empty($companyId)) {
         return;
     }
     $company = $companiesTable->getCompany($companyId);
     if (!empty($company->business_hours)) {
         $company->business_hours = explode(",", $company->business_hours);
     }
     $categoryTable = $this->getTable("Category", "JBusinessTable");
     $category = null;
     if (!empty($company->mainSubcategory)) {
         $category = $categoryTable->getCategoryById($company->mainSubcategory);
     } else {
         $categoryIds = explode(",", $company->categoryIds);
         $category = $categoryTable->getCategoryById($categoryIds[0]);
     }
     $path = array();
     $path[] = $category;
     while ($category->parent_id != 1) {
         if (!$category->parent_id) {
             break;
         }
         $category = $categoryTable->getCategoryById($category->parent_id);
         $path[] = $category;
     }
     $path = array_reverse($path);
     $company->path = $path;
     $companyLocationsTable = $this->getTable('CompanyLocations');
     $company->locations = $companyLocationsTable->getCompanyLocations($companyId);
     if ($this->appSettings->enable_multilingual) {
         JBusinessDirectoryTranslations::updateEntityTranslation($company, BUSSINESS_DESCRIPTION_TRANSLATION);
     }
     $userId = JFactory::getUser()->id;
     $company->isBookmarked = false;
     if (!empty($userId)) {
         $bookmarkTable = $this->getTable('Bookmark');
         $company->bookmark = $bookmarkTable->getBookmark($companyId, $userId);
     }
     $company->attachments = JBusinessDirectoryAttachments::getAttachemnts(BUSSINESS_ATTACHMENTS, $companyId);
     return $company;
 }