コード例 #1
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL)
 {
     parent::__construct($template, $partials);
     // Если был сабмит админ.формы - узнаем действие и вызываем нужный метод
     if (!empty($_POST['action'])) {
         switch ($_POST['action']) {
             case 'delete':
                 $this->message_data = $this->delete_exchange($_POST['work_id']);
                 break;
             case 'settings':
                 $this->message_data = $this->update_settings($_POST);
         }
     }
     unset($_POST);
     // Выбираем все сообщения
     $exchangesO = Sprig::factory('exchange')->load(DB::select('*')->order_by('time', 'DESC'), NULL);
     // Регистрируем количество
     $this->exchange_count = count($exchangesO);
     // Проходимся по всем сообщениям
     for ($i = 0; $i < $this->exchange_count; $i++) {
         $this->exchanges[$i] = $exchangesO[$i]->as_array();
         // Добавляем человеческую дату добавления
         $this->exchanges[$i]['human_date'] = date('d.m.Y H:i', $this->exchanges[$i]['time']);
         $this->exchanges[$i]['object_data_1'] = nl2br($this->exchanges[$i]['object_data_1']);
         $this->exchanges[$i]['object_data_2'] = nl2br($this->exchanges[$i]['object_data_2']);
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL, $alien_call = false)
 {
     parent::__construct($template, $partials, $alien_call);
     $this->domen = $_SERVER['HTTP_HOST'];
     // Находим корневые разделы
     $this->root_1 = Sprig::factory('catalog')->root(1);
     $this->root_2 = Sprig::factory('catalog')->root(2);
     $this->root_3 = Sprig::factory('catalog')->root(3);
     $this->root_4 = Sprig::factory('catalog')->root(4);
     // Если раздела нет - создаем
     if (!$this->root_1->loaded() or $this->root_2->loaded() or $this->root_3->loaded() or $this->root_4->loaded()) {
         $this->root_1->name = 'Загородная недвижимость';
         $this->root_2->name = 'Городская недвижимость';
         $this->root_3->name = 'Коммерческая недвижимость';
         $this->root_4->name = 'Готовый бизнес';
         try {
             $this->root_1->insert_as_new_root(1);
             $this->root_2->insert_as_new_root(2);
             $this->root_3->insert_as_new_root(3);
             $this->root_4->insert_as_new_root(4);
         } catch (Validate_Exception $e) {
             echo 'Не удалось создать корневые разделы';
         }
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL, $alien_call = false)
 {
     parent::__construct($template, $partials, $alien_call);
     // Если объект создается сторонним приложением для использования
     // определенных функций - конструктор надо освободить от выполнения
     // лишних операций
     if (!empty($alien_call)) {
         return;
     }
     // Подключаем библиотку WideImage
     require_once 'packages/wideimage/WideImage.php';
     // Если был сабмит админ.формы - узнаем действие и вызываем нужный метод
     if (!empty($_POST['action'])) {
         switch ($_POST['action']) {
             case 'status':
                 $this->message_data = $this->update_status($_POST['work_id'], $_POST['status'][$_POST['work_id']]);
                 break;
             case 'delete':
                 $this->message_data = $this->delete_benefit($_POST['work_id']);
                 break;
             case 'create':
                 $this->message_data = $this->create_benefit($_POST, $_FILES);
                 break;
             case 'update':
                 $this->message_data = $this->update_benefit($_POST, $_FILES);
         }
     }
     unset($_POST['action']);
     // Выбираем все преимущества
     $this->benefits = Sprig::factory('benefits')->load(DB::select('*')->order_by('id', 'DESC'), NULL)->as_array();
     // Регистрируем количество
     $this->benefits_count = count($this->benefits);
 }
コード例 #4
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL)
 {
     parent::__construct($template, $partials);
     $this->auth = Auth::instance();
     $this->auth->logout();
     $request = Request::factory(false);
     $request->redirect('/admin/login');
 }
コード例 #5
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL, $alien_call = FALSE)
 {
     parent::__construct($template, $partials);
     // Подключаем библиотку WideImage
     require_once 'packages/wideimage/WideImage.php';
     // Выбираем все баннеры
     $bannersO = Sprig::factory('banner')->load(DB::select('*'), NULL);
     // Регистрируем количество
     $this->banners_count = count($bannersO);
     // Если баннеров больше заданного значения - закрываем возможность добавления\
     if ($this->banners_count >= $this->banners_max_count) {
         $this->add_opport = FALSE;
     } else {
         $this->add_opport = TRUE;
     }
     // Если был сабмит админ.формы - узнаем действие и вызываем нужный метод
     if (!empty($_POST['action'])) {
         switch ($_POST['action']) {
             case 'delete':
                 $this->message_data = $this->delete_banner($_POST['work_id']);
                 break;
             case 'create':
                 $this->message_data = $this->create_banner($_POST, $_FILES);
                 break;
             case 'update':
                 $this->message_data = $this->update_banner($_POST, $_FILES);
         }
         unset($_POST['action']);
     }
     // Не грузим лишнее
     if (!empty($alien_call)) {
         return;
     }
     // Выбираем все баннеры
     $bannersO = Sprig::factory('banner')->load(DB::select('*'), NULL);
     // Регистрируем количество
     $this->banners_count = count($bannersO);
     // Проходимся по всем новостям
     for ($i = 0; $i < $this->banners_count; $i++) {
         $this->banners[$i] = $bannersO[$i]->as_array();
         // Добавляем человеческое описание
         // типа и содержимого баннера
         switch ($this->banners[$i]['type']) {
             case 'image':
                 $this->banners[$i]['type_word'] = 'Изображение';
                 $this->banners[$i]['source'] = '<img src="/' . $this->banner_dir . $this->banners[$i]['source'] . '" border="0" alt="Баннер">';
                 break;
             case 'flash':
                 $this->banners[$i]['type_word'] = 'Flash';
                 $this->banners[$i]['source'] = '<object type="application/x-shockwave-flash" data="/' . $this->banner_dir . $this->banners[$i]['source'] . '" height="' . $this->banners[$i]['height'] . '" width="' . $this->banners[$i]['width'] . '"><param name="movie" value="/' . $this->banner_dir . $this->banners[$i]['source'] . '"><param name="wmode" value="transparent"></object>';
                 break;
             case 'text':
                 $this->banners[$i]['type_word'] = 'Текст';
                 $this->banners[$i]['source'] = $this->banners[$i]['source'];
         }
     }
 }
コード例 #6
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL, $alien_call = false)
 {
     parent::__construct($template, $partials, $alien_call);
     // Находим корневой раздел
     $this->root = Sprig::factory('content')->root(1);
     // Если раздела нет - создаем
     if (!$this->root->loaded()) {
         $this->root->name = 'Основные разделы';
         try {
             $this->root->insert_as_new_root(1);
         } catch (Validate_Exception $e) {
             echo 'Не удалось создать корневой раздел';
         }
     }
 }
コード例 #7
0
ファイル: index.php プロジェクト: bosoy83/progtest
 public function __construct($template = NULL, array $partials = NULL)
 {
     parent::__construct($template, $partials);
 }