public function start() { $id = intval(Request::GetPart(0, User::company())); if ($id == 0) { $id = User::company(); } $this->company = CompanyModel::GetObj()->id($id); if ($this->company->id == 0) { Site::Message('Профиль не найден'); $this->Route(); } elseif ($this->company->id != User::company() and !User::admin()) { Site::Message('У Вас недостаточно прав для редактирования данного профиля'); $this->Route(); } else { switch (Request::GetPart(2, '')) { case 'edit': $this->EditAction(); break; case 'delete': $this->DeleteAction(); break; default: break; } } }
public function start() { if (User::company() <= 0) { Site::Message('Для просмотра избранного вы должны войти в систему'); $this->route(); } else { $this->company = CompanyModel::GetObj()->id(User::company()); } }
public function start() { if (!User::islogged()) { Site::Message('Вы должны войти в систему, для изменения своих настроек'); $this->Route(); } else { $this->company = CompanyModel::GetObj()->id(User::company()); } }
public function FavoriteSet($id) { if ($id > 0 and $id != User::company()) { $cnt = SQL::Query('SELECT count(*) as cnt FROM `favorites` WHERE host_id = ? AND fav_id = ?', [0 => User::company(), 1 => $id])->fetch(PDO::FETCH_OBJ)->cnt; if ($cnt > 0) { Site::Message('Компания удалена из избранного'); FavoriteModel::drop($id); } else { Site::Message('Компаниия добавлена в избранное'); FavoriteModel::add($id); } } }
public function start() { $id = intval(Request::GetPart(0, User::company())); if ($id == 0) { $id = User::company(); } $this->company = CompanyModel::GetObj()->id($id); if ($this->company->id == 0) { Site::Message('Профиль не найден'); $this->Route(); } elseif ($this->company->id != User::company() and !User::admin()) { Site::Message('У Вас недостаточно прав для редактирования данного профиля'); $this->Route(); } else { switch (Request::GetPart(2, '')) { case 'adress': $this->AdressAction(); break; case 'region': $this->RegionAction(); break; case 'setregion': $this->SetregionAction(); break; case 'group': $this->GroupAction(); break; case 'setgroup': $this->SetgroupAction(); break; case 'newgroup': $this->NewgroupAction(); break; case 'setlogo': $this->SetLogoAction(); break; default: break; } } }
public function ConfirmlogoAction() { $company = CompanyModel::GetObj()->id(User::company()); if ($company->id > 0) { $this->render('confirmlogo', ['logo' => $company->logo]); } else { Site::Error('Непредвиденная ошибка'); $this->route(); } }
public function IndexAction() { $company = CompanyModel::GetObj()->id(User::company()); $this->render('index', ['company' => $company->name, 'adress' => $company->email]); }
<?php $username = User::GetName(); $company = CompanyModel::GetObj()->id(User::company()); if ($company->name != '') { $username = $company->name; } ?> <?php if (User::isLogged()) { ?> <a href="<?php echo Site::link('profile'); ?> " class="username"><?php echo $username; ?> </a> <div class="button_bar"> <a href="<?php echo Site::link('logout'); ?> " class="green">Выход</a> <?php } else { ?> <a href="<?php echo Site::link('registration'); ?>
public static function drop($id) { SQL::Query('UPDATE `companys` SET rate = rate - 1 WHERE id = ?', [0 => $id]); SQL::Query('DELETE FROM `favorites` WHERE host_id = ? AND fav_id = ?', [0 => User::company(), 1 => $id]); }