Exemplo n.º 1
0
 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()]);
     }
 }
Exemplo n.º 2
0
 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;
         }
     }
 }
Exemplo n.º 3
0
 public function start()
 {
     if (!User::admin()) {
         Site::Message('Страница не найдена');
         $this->route();
     }
 }
Exemplo n.º 4
0
 public function store_feedback()
 {
     $admins = User::admin()->lists('email');
     $from = Auth::user();
     $feedback = Input::get('feedback');
     if (empty($feedback)) {
         return $this->statusResponse(['notice' => 'No feedback send']);
     }
     $notice = new Notification(['event' => Notification::NOTIFICATION_FEEDBACK]);
     $notice->user_id = Auth::id();
     $send_status = $notice->sendEmailToGroup($admins, null, array('from' => $from, 'feedback' => $feedback));
     return $this->statusResponse(['notice' => 'Thanks for the feedback', 'send_status' => $send_status]);
 }
Exemplo n.º 5
0
 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;
         }
     }
 }
Exemplo n.º 6
0
 public function IndexAction()
 {
     if (User::isLogged()) {
         Site::Message('Вы уже вошли в систему');
         $this->Route();
     } elseif (Request::isPosted('loguser')) {
         User::LoginByPass(Request::post('loguser', '', 'mail'), Request::post('logpass', '', 'safe'));
         if (!User::isLogged()) {
             Site::Error('Неверный логин или пароль');
             $this->Render();
         } else {
             Site::Message('Вы успешно вошли в систему');
             if (!User::admin()) {
                 $this->Route('profile');
             } else {
                 $this->Route();
             }
         }
     } else {
         $this->Render();
     }
 }
Exemplo n.º 7
0
<?php

require_once 'core/init.php';
$user = new User();
require_once 'core/checkLogin.php';
require_once 'core/checkAdmin.php';
$admin = $user->admin();
if (Input::exists('get')) {
    $id = Input::get('id');
    $mode = Input::get('mode');
    if ($mode == 'deactivate') {
        $admin->deactivateUser($id);
        Session::flash('admin', 'User has been deactivated!');
        Redirect::to('adminPanel.php');
    } else {
        if ($mode == 'activate') {
            $admin->activateUser($id);
            Session::flash('admin', 'User has been activated!');
            Redirect::to('adminPanel.php');
        }
    }
} else {
    Redirect::to('adminPanel.php');
}
Exemplo n.º 8
0
<div class="leftside">
	<?php 
HTML::widget('profilemenu', ['company' => $company, 'selected' => 'profile', 'simmilar' => $simmilar]);
if (User::admin()) {
    HTML::widget('admin', ['company' => $company]);
}
?>
</div>
<div class="content_r">
	<?php 
$tags = array();
$tags = explode(',', $company->tags);
$tag_line = '';
foreach ($tags as $tag) {
    if ($tag != '') {
        $tag_line .= '<a href="' . Site::Link('list/tag/') . trim($tag) . '">' . trim($tag) . '</a>' . "\n";
    }
}
$tags = '<div class="tagbar">' . "\n" . $tag_line . "\n" . '<a href="' . Site::Link('list/' . $company->group_id . '/') . '" id="group_link">' . $group_tags[$company->group_id] . '</a>' . "\n" . '<a href="' . Site::Link('list/setregion/?id=' . $company->region_id) . '" id="city_link">' . $region_tags[$company->region_id] . '</a>' . "\n" . '</div>';
Html::block($company->name . ' <a href="' . Site::link($company->id . '/edit/') . '" id="block_header_a"><img src="' . Site::link('images/edit.png') . '"></a>', $company->adress);
echo $company->about;
echo $tags;
Html::end_block();
?>
	

	<?php 
Html::block('Контакты компании' . ' <a href="' . Site::link($company->id . '/edit/adress') . '" id="block_header_a"><img src="' . Site::link('images/edit.png') . '"></a>');
?>
		<div class="adress">
			<?php