function index() { $contacts_model = new ContactsModel(); $contacts = $contacts_model->get_contacts(); // var_dump($contacts);die; $view = new View(); $view->set_file_name('contacts'); $params = array('contacts' => $contacts); $view->show($params); }
public function actionContacts() { $objInfoInd = new ContactsModel(); $varInfoInd = $objInfoInd->getIndInfo(); $view = new View(); $view->varInfoInd = $varInfoInd; $view->sqlNav = static::sqlNav(); $view->sqlFoot = static::sqlFoot(); $view->display('ViewContacts.php'); }
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 DeleteAction() { $id = intval(Request::GetPart(3)); $contact = ContactsModel::GetObj()->where('id = ? AND company_id = ?', [0 => $id, 1 => $this->company->id]); if ($contact->id > 0) { ContactsModel::delete()->id($contact->id); } Site::Message('Контакт успешно удалён'); $this->route('profile'); }
public function add() { if (isset($_SESSION['client'])) { $client = unserialize($_SESSION['client']); if (isset($_POST['add'])) { $contactsModel = new ContactsModel(); $contact = $contactsModel->create($_POST['name'], $_POST['mail']); } $this->helper->redirect('/contacts/getAll'); } else { $this->helper->redirect(); } }
public function contactsAction() { $fc = FrontController::getInstance(); $model = new ContactsModel(); $fc->setBody($model->render('contacts.php', TEMPLATE)); }