Exemplo n.º 1
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('groups');
     $this->group = new \Models\Group();
 }
Exemplo n.º 2
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('organization');
     $this->organization = new \Models\Organization();
 }
Exemplo n.º 3
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('user_types');
     $this->user_type = new \Models\UserType();
 }
Exemplo n.º 4
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('permissions');
     $this->permission = new \Models\Permission();
 }
Exemplo n.º 5
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('phonebook');
     $this->phonebook = new \Models\Phonebook();
 }
Exemplo n.º 6
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('offices');
     $this->office = new \Models\Office();
     $this->company = new \Models\Company();
 }
Exemplo n.º 7
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('teams');
     $this->team = new \Models\Team();
     $this->department = new \Models\Department();
 }
Exemplo n.º 8
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('navigation');
     $this->navigation = new \Models\Navigation();
     $this->role = new \Models\Role();
 }
Exemplo n.º 9
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     if (!Auth::hasPermission('manage-companies')) {
         Url::redirect('forbidden');
     }
     $this->language->load('companies');
     $this->company = new \Models\Company();
 }
Exemplo n.º 10
0
 /**
  * Call the parent construct
  */
 public function __construct()
 {
     parent::__construct();
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $this->language->load('users');
     $this->user = new \Models\User();
     $this->optima = new \Models\Optima();
     $this->group = new \Models\Group();
     $this->role = new \Models\Role();
     $this->permission = new \Models\Permission();
     $this->department = new \Models\Department();
     $this->team = new \Models\Team();
     $this->company = new \Models\Company();
     $this->office = new \Models\Office();
     $this->user_type = new \Models\UserType();
     $this->interface_language = new \Models\Language();
 }
Exemplo n.º 11
0
 public function index()
 {
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/settings.js');
     $settings = $this->setting->getSettings();
     if (isset($settings)) {
         foreach ($settings as $obj) {
             $data[$obj->name] = $obj->value;
         }
     }
     if (isset($_POST['update'])) {
         $site_name = $_POST['site_name'];
         $site_email = $_POST['site_email'];
         $domains = $_POST['domains'];
         if ($site_name == '') {
             $error[] = $this->language->get('site_name_required');
         }
         if ($site_email == '') {
             $error[] = $this->language->get('site_email_required');
         }
         if ($domains == '') {
             $error[] = $this->language->get('domains_required');
         }
         if (!$error) {
             foreach ($_POST as $key => $value) {
                 $data2 = array('value' => $value);
                 $where = array('name' => $key);
                 $log[$key] = $value;
                 if (!empty($value) && $data[$key] != $log[$key]) {
                     $this->setting->updateSettings($data2, $where);
                     Log::notice('log_settings_edit', json_encode(array($data2, $where)));
                 }
             }
             Session::set('success', $this->language->get('msg_settings_edit'));
             Url::redirect('settings');
         }
     }
     View::renderTemplate('header', $data);
     View::render('settings/index', $data, $error);
     View::renderTemplate('footer', $data);
 }
Exemplo n.º 12
0
 /**
  * Edit Post
  */
 public function edit($id)
 {
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     $data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/editors/summernote/summernote.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/forms/styling/uniform.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/blog_add.js');
     $data['categories'] = $this->blog->getCategories();
     $data['statuses'] = (object) array(0 => (object) array('id' => '0', 'name' => $this->language->get('draft')), 1 => (object) array('id' => '1', 'name' => $this->language->get('publish')));
     $data['post'] = $this->blog->getPost($id);
     if (isset($_POST['update'])) {
         $title = $_POST['title'];
         $status = $_POST['status'];
         $content = $_POST['content'];
         $category_id = $_POST['category'];
         $user_id = $_SESSION['id'];
         $schedule = isset($_POST['schedule']) ? '1' : '0';
         if ($status == '1' && $schedule == '1') {
             if (isset($_POST['published_at'])) {
                 $published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']);
             } else {
                 $published_at = '';
             }
         } elseif ($status == '1' && $schedule == '0') {
             $published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']);
         } else {
             $published_at = '';
             $schedule = '0';
         }
         if ($title == '') {
             $error[] = $this->language->get('title_required');
         }
         if ($status == '') {
             $error[] = $this->language->get('status_required');
         }
         if ($category_id == '') {
             $error[] = $this->language->get('category_required');
         }
         if (!$error) {
             $data = array('title' => $title, 'content' => $content, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL);
             $where = array('id' => $id);
             $data_log = array('id' => $id, 'title' => $title, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL);
             $this->blog->updatePost($data, $where);
             Session::set('success', $this->language->get('msg_blog_edit'));
             Log::notice('log_blog_edit', $data_log);
             Url::redirect('blog');
         }
     }
     if (isset($_POST['cancel'])) {
         Url::redirect('blog');
     }
     View::renderTemplate('header', $data);
     View::renderModule('Blog/views/edit', $data, $error);
     View::renderTemplate('footer', $data);
 }
Exemplo n.º 13
0
 public function noaccess()
 {
     if (!Auth::isLogged()) {
         Url::redirect('login');
     }
     header("HTTP/1.0 403 Not Found");
     $data['title'] = '403';
     View::renderTemplate('header', $data);
     View::render('error/403', $data, $error);
     View::renderTemplate('footer', $data);
 }