public function IndexAction() { Site::$keywords = $this->company->tags; Site::$title = $this->company->name . ' на PromSpace'; $group_tags_array = GroupModel::GetList(); $region_tags_array = RegionModel::GetList(); $region_tags_array[0] = 'Вся Россия'; $group_tags_array[0] = 'Не определено'; $products = ProductModel::GetAll()->where('company_id = ?', [0 => $this->company->id]); $contacts = array(); if (!User::isLogged()) { if ($this->company->open == 2) { $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]); } $this->render('nologged', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]); } elseif ($this->company->id == User::company() or User::admin()) { if ($this->company->logo == '') { Site::Message('Мы рекомендуем Вам установить логтип для профиля, это сделает его более привлекательным для клиентов'); } $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]); $this->render('edit', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]); } else { if ($this->company->open == 0 and FavoriteModel::i_friend($this->company->id) or $this->company->open > 0) { $contacts = ContactsModel::GetAll()->where('company_id = ?', [0 => $this->company->id]); } $this->render('index', ['company' => $this->company, 'group_tags' => $group_tags_array, 'region_tags' => $region_tags_array, 'favorite' => FavoriteModel::my_friend($this->company->id) ? 'favorite.png' : 'star.png', 'contacts' => $contacts, 'products' => $products, 'simmilar' => $this->GetSimmilar()]); } }
public function start() { $this->region_id = intval(Request::Cookie('region_id', 0)); $this->group_id = intval(Request::GetPart(1, 0)); $this->groups_array = GroupModel::GetList(); $this->groups_array[0] = 'Все направления'; $this->regions_array = RegionModel::GetList(); $this->regions_array[0] = 'Вся Россия'; if (!isset($this->groups_array[$this->group_id])) { $this->group_id = 0; } if (!isset($this->regions_array[$this->region_id])) { $this->region_id = 0; } $this->page_link_prefix = $this->group_id . '/'; $this->page = intval(Request::GetPart(2, 1)); if ($this->page == 0) { $this->page = 1; } $this->search = trim(Request::Get('q', '')); if ($this->search != '') { $this->SearchCommand(); } Site::$search_link = Site::Link('list/' . $this->group_id . '/'); }
public function IndexAction() { $group_tags_array = GroupModel::GetList(); $region_tags_array = RegionModel::GetList(); $region_tags_array[0] = 'Вся Россия'; $group_tags_array[0] = 'Не определено'; if (!Request::isPosted('name')) { $this->Render('index', ['company' => $this->company, 'group' => $group_tags_array[$this->company->group_id], 'region' => $region_tags_array[$this->company->region_id]]); } else { $this->company->name = Request::post('name'); $this->company->about = Request::post('about', '', 'text'); $this->company->tags = Request::post('tags'); if ($this->company->name == '') { Site::Message('Поле название компании не может оставаться пустым'); $this->render('index', ['company' => $this->company, 'group' => $group_tags_array[$this->company->group_id], 'region' => $region_tags_array[$this->company->region_id]]); } elseif ($this->company->about == '') { Site::Message('Ну напишите о компании хоть что-нибудь'); $this->render('index', ['company' => $this->company, 'group' => $group_tags_array[$this->company->group_id], 'region' => $region_tags_array[$this->company->region_id]]); } else { $this->company->save(); Site::Message('Профиль компании успешно обновлён'); $this->Route('profile'); } } }
private function ShowList($list) { $groups_array = GroupModel::GetList(); $groups_array[0] = 'Не определено'; $regions_array = RegionModel::GetList(); $regions_array[0] = 'Вся Россия'; $companys = SQL::Query('SELECT * FROM `companys` WHERE `id` IN (' . $list . ') ORDER BY `rate` DESC')->fetchAll(PDO::FETCH_OBJ); $this->Render('index', ['company' => $this->company, 'companys' => $companys, 'group_tags' => $groups_array, 'region_tags' => $regions_array]); }