public function index() { //tipo de busqueda para el form $searchtype = 'sales'; //check searchtype session, load data if not empty for form if (!empty($_SESSION[$searchtype])) { $data['project_id'] = $_SESSION[$searchtype]["project_id"]; } // SEO $data['title'] = Language::show('title', 'gestion', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'gestion', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'gestion', $_SESSION['site_lang']); $data['sitename_before'] = "N"; //form $data['projects_row'] = $this->_model_f->fetchProjects($_SESSION['site_lang']); $data['locations_rentals_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'rentals', $data['project_id']); $data['locations_sales_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'sales'); //type of search in form, default selected: sales $data['searchtype'] = 'rentals'; //title for de hover in navbar $data['title_page'] = "gestion"; // URL change lang $data['lang_var'] = "index"; // Testimonials $data['testimonials'] = $this->_model_t->fetchTestimonials('Y', $_SESSION['site_lang'], 3, 5); //render views View::rendertemplate('header', $data); View::render('gestion/gestion', $data); View::rendertemplate('footer', $data); //remove search type form unset($_SESSION[$searchtype]); }
/** * define page title and load template files */ public function index() { $data['title'] = 'Welcome'; View::rendertemplate('header', $data); View::render('welcome/welcome', $data); View::rendertemplate('footer', $data); }
/** * */ public function index() { $data["title"] = $this->archivo["raiz"]["componente_nombre"]; view::admintemplate("header", $data); view::render($this->archivo["raiz"]["componente_enlace"], $data); view::admintemplate("footer", $data); }
public function index() { $data['title'] = "Подобрать"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); $data['statuses'] = $this->_model->show_statuses(); if (isset($_GET['submit'])) { //?start-date=03.02.2015&end-date=17.02.2015&city=1&worker=2&status=1 $pick_data[':user_id'] = $this->user_id; if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['start-date'])) { $start_date = date("Y-m-d", strtotime($_GET['start-date'])); $pick_data[':start_date'] = $start_date . " 00:00:00"; } if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['end-date'])) { $end_date = date("Y-m-d", strtotime($_GET['end-date'])); $pick_data[':end_date'] = $end_date . " 23:59:59"; } if (preg_match('/^\\d+$/', $_GET['status'])) { $status = $_GET['status']; $pick_data[':status'] = $status; } if ($pick_data) { $data['orders'] = $this->_model->pick_orders($pick_data); \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('pick', $data, $error); view::rendertemplate('footer'); }
public function index() { //seo $data['title'] = Language::show('title', 'welcome', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'welcome', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'welcome', $_SESSION['site_lang']); $data['sitename_before'] = "Y"; //columns rentals and sales $data['rentals_row'] = $this->_model->fetchFeaturedRentals($_SESSION['site_lang']); $data['sales_row'] = $this->_model->fetchFeaturedSales($_SESSION['site_lang']); //form $data['projects_row'] = $this->_model_f->fetchProjects($_SESSION['site_lang']); $data['locations_rentals_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'rentals', $_SESSION['rentals']["project_id"]); $data['locations_sales_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'sales'); //type of search in form, default selected: rentals $data['searchtype'] = "rentals"; //title for hover in navbar $data['title_page'] = "welcome"; //testimonials $data['testimonials'] = $this->_model_t->fetchTestimonials('Y', $_SESSION['site_lang'], 0, 5); //render views View::rendertemplate('header', $data); View::render('welcome/welcome', $data); View::rendertemplate('footer', $data); }
public function index() { $data["title"] = $this->archivo["raiz"]["componente_nombre"]; $data["color"] = $this->model->getPropiedad("background-color"); $data["fondo"] = $this->model->getPropiedad("background-image"); view::admintemplate("header", $data); view::render($this->archivo["raiz"]["componente_enlace"], $data); view::admintemplate("footer", $data); }
/** * load a 404 page with the error message */ public function index() { header("HTTP/1.0 404 Not Found"); $data['title'] = '404'; $data['error'] = $this->_error; View::rendertemplate('header', $data); View::render('error/404', $data); View::rendertemplate('footer', $data); }
public function index() { $data["title"] = $this->archivo["raiz"]["componente_nombre"]; $data["usuarios"] = $this->componente->getEnlace("admin/usuario"); $data["articulos"] = $this->componente->getEnlace("admin/articulo"); view::admintemplate("header", $data); view::render($this->archivo["raiz"]["componente_enlace"], $data); view::admintemplate("footer", $data); }
public function index() { $data['title'] = 'ЧаВо'; $data['breadcrumbs'] = array(); $data['faq'] = $this->_model->get_faq(); view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('faq', $data, $error); view::rendertemplate('footer'); }
public function index($id) { $data["title"] = $this->archivo["raiz"]["componente_nombre"]; $data["inicio"] = $this->componente->getEnlace("admin/inicio"); $data["producto"] = $this->componente->getEnlace("admin/producto"); $data["elemento"] = $this->model->producto($id)[0]; $data["imagenes"] = $this->model->imagenes($id); view::admintemplate("header", $data); view::render($this->archivo["raiz"]["componente_enlace"], $data); view::admintemplate("footer", $data); }
public function index() { foreach ($this->_archivo as $componente) { $this->_componente->createComponente($componente["componente_nombre"], $componente["componente_enlace"], $componente["componente_url"], $componente); } $data["title"] = $this->_archivo["raiz"]["componente_nombre"]; $data["usuarios"] = $this->_componente->getEnlace("admin/usuario"); $data["articulos"] = $this->_componente->getEnlace("admin/articulo"); view::admintemplate("header", $data); view::render($this->_archivo["raiz"]["componente_enlace"], $data); view::admintemplate("footer", $data); }
public function index() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Архив'; $data['orders'] = $this->_model->get_archive(); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/archive', $data, $error); view::rendertemplate('footer'); }
public function controlAccesoArchivo() { if (!session::get("autenticado")) { url::redirect(ARCHIVOLOGIN); } if (!$this->verificarAcceso(session::get("usuario"), "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) { $data["error"] = "NO TIENE PERMISO PARA ACCEDER A ESTA PAGINA"; view::archivotemplate('header', $data); view::render('error/404', $data); view::archivotemplate('footer', $data); exit; } }
public function index() { //SEO $data['title'] = Language::show('title', 'contact', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'contact', $_SESSION['site_lang']); $data['meta_keywords'] = ''; $data['sitename_before'] = "Y"; //title for de hover in navbar $data['title_page'] = "contact"; //contacts $data['contacts'] = $this->_model->fetchContacts($_SESSION['site_lang']); // Envio de correo if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $email_contact = filter_input(INPUT_POST, 'email_contact'); $email_client = filter_input(INPUT_POST, 'email_client'); $phone = filter_input(INPUT_POST, 'phone'); $comment = filter_input(INPUT_POST, 'message'); if ($name == '' || !isset($name) || $email_client == '' || !isset($email_client) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect($_SESSION['site_lang'] . "/contact.php?error=1"); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email_client); $mail->addAddress($email_contact); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Contact"; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email_client . "<br>"; $message .= "Phone: " . $phone . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); if (!$mail->send()) { Url::redirect($_SESSION['site_lang'] . "/contact.php?error=2"); } else { Url::redirect($_SESSION['site_lang'] . "/contact.php?send=1"); } } } //tender views View::rendertemplate('header', $data); View::render('contact/contact', $data, $error); View::rendertemplate('footer', $data); }
public function index() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['acl'] = $this->_rights[0]->acl; $data['title'] = "Подобрать"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/admin/orders/'); //$data['orders'] = $this->_model->pick_orders($); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); if (isset($_GET['submit'])) { //?start-date=03.02.2015&end-date=17.02.2015&city=1&worker=2&status=1 $pick_data = array(); if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['start-date'])) { $start_date = date("Y-m-d", strtotime($_GET['start-date'])); $pick_data[':start_date'] = $start_date . " 00:00:00"; } if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['end-date'])) { $end_date = date("Y-m-d", strtotime($_GET['end-date'])); $pick_data[':end_date'] = $end_date . " 23:59:59"; } if (preg_match('/^\\d+$/', $_GET['city'])) { $city = $_GET['city']; $pick_data[':city'] = $city; } if (preg_match('/^\\d+$/', $_GET['worker'])) { $pick_data[':worker'] = $_GET['worker']; } if (preg_match('/^\\d+$/', $_GET['status'])) { $status = $_GET['status']; $pick_data[':status'] = $status; } $data['orders_stat'] = $this->_model->orders_stat($pick_data); $data['orders'] = $this->_model->pick_orders($pick_data); \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/pick', $data, $error); view::rendertemplate('footer'); }
public function login() { foreach ($this->_archivo as $componente) { $this->_componente->createComponente($componente["componente_nombre"], $componente["componente_enlace"], $componente["componente_url"], $componente); } $data['title'] = $this->_archivo["login"]["componente_nombre"]; if (session::get("autenticado")) { url::redirect(ADMIN); } if (null != filter_input(INPUT_POST, "submit")) { $usuario = filter_input(INPUT_POST, "usuario"); $clave = filter_input(INPUT_POST, "clave"); $userData = $this->_model->getClaveHash($usuario); if ($usuario === "") { $error[] = "El usuario no puede estar en blanco."; } if ($clave === "") { $error[] = "La clave no puede estar en blanco."; } if ($usuario == "" || $clave == "") { $error[] = "No pueden haber campos en blanco."; } else { if ($userData[0]->usuario_estado != "1") { $error[] = "Esa cuenta fue deshabilitada por el Administrador."; } else { if ($usuario != "" && $clave != "" && password::verify($clave, $userData[0]->usuario_clave)) { session::set("autenticado", true); session::set("usuario", $userData[0]->usuario_sid); session::set("grupo", $userData[0]->usuario_grupo); session::set("nombre", $userData[0]->usuario_nombre . " " . $userData[0]->usuario_apellido); session::set("email", $userData[0]->usuario_email); session::set("estado", $userData[0]->usuario_estado); url::redirect(ADMIN); } else { $error[] = "Credenciales de Acceso incorrectas."; } } } } view::admintemplate("header", $data); view::render(ADMINLOGIN, $data, $error); view::admintemplate("footer", $data); }
public function login() { $session = \helpers\session::id(); if ($this->_model->get_session($session)) { url::redirect(''); } $data['title'] = 'Вход'; if (!empty($_POST)) { //print_r($_POST); //exit; if (!isset($_POST['captcha']) || empty($_POST['captcha'])) { $error[] = 'Введите данные с каринки'; } else { $captcha = new \helpers\raincaptcha(); if (!$captcha->checkAnswer($_POST['captcha'])) { $error[] = 'Некорректные цифры с картинки'; } } if (!isset($_POST['login']) || empty($_POST['login'])) { $error[] = 'Введите логин'; } else { $username = $_POST['login']; } if (!isset($_POST['password']) || empty($_POST['password'])) { $error[] = 'Введите пароль'; } else { $password = $_POST['password']; } if (\helpers\password::verify($password, $this->_model->getLogin($username)) == 0) { $error[] = 'Неверные логин или пароль'; } if (!$error) { $data = array('session' => $session); $where = array('login' => $username); $this->_model->setSession($data, $where); url::redirect(''); } } view::rendertemplate('header', $data); view::render('login', $data, $error); view::rendertemplate('footer'); }
public function index() { $data['title'] = 'Поиск'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); if (isset($_GET['keyword'])) { //$keyword = preg_replace('/\D+/', '', trim(stripslashes(strip_tags(urldecode($_GET['keyword']))))); $keyword = str_replace('-', '', trim(stripslashes(strip_tags(urldecode($_GET['keyword']))))); $data['search'] = $this->_model->search($keyword, $this->user_id); if (!empty($_GET['keyword'])) { \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } else { \helpers\session::pull('url'); } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('search', $data, $error); view::rendertemplate('footer'); }
public function login() { $session = \helpers\session::id(); if ($this->_model->get_session($session)) { url::redirect('admin'); } $data['title'] = 'Админка'; if (!empty($_POST)) { $username = $_POST['login']; $password = $_POST['password']; if (\helpers\password::verify($password, $this->_model->getLogin($username)) == 0) { $error[] = 'Неверные логин или пароль'; } else { $data = array('session' => $session); $where = array('login' => $username); $this->_model->setSession($data, $where); url::redirect('admin'); } } view::rendertemplate('header', $data); view::render('admin/login', $data, $error); view::rendertemplate('footer'); }
public function index() { //SEO $data['title'] = Language::show('title', 'testimonials', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'testimonials', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'testimonials', $_SESSION['site_lang']); $data['sitename_before'] = "N"; //title for de hover in navbar $data['title_page'] = "testimonials"; //column result $data['testimonials'] = $this->_model->fetchTestimonials('Y', $_SESSION['site_lang']); $data['result'] = filter_input(INPUT_GET, 'result'); //envio de testimonios if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $message = filter_input(INPUT_POST, 'message'); $property = filter_input(INPUT_POST, 'property'); $residence = filter_input(INPUT_POST, 'residence'); $langSelect = filter_input(INPUT_POST, 'langSelect'); $typeSelect = filter_input(INPUT_POST, 'typeSelect'); $date = date("M Y"); if ($name == '' || !isset($name) || $message == '' || !isset($message) || $langSelect == '' || !isset($langSelect) || $typeSelect == '' || !isset($typeSelect) || $property == '' || !isset($property) || $residence == '' || !isset($residence)) { $error = ""; Url::redirect($_SESSION['site_lang'] . "/testimonials.php?error=1"); } if (!$error) { $dataTestimonial = array('type' => $typeSelect, 'lang' => $langSelect, 'comment' => $message, 'name' => $name, 'property' => $property, 'residence' => $residence, 'date' => $date, 'online' => 'N'); $this->_model->insert_testimonial($dataTestimonial); Url::redirect($_SESSION['site_lang'] . "/testimonials.php?send=1"); } } //render views View::rendertemplate('header', $data); View::render('testimonials/testimonials', $data); View::rendertemplate('footer', $data); }
public function add() { if (json_decode($this->_rights[0]->pages)->{'root'}->acl_level <= 1) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Добавить админа'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Админы', 'href' => '/admin/root/'); if (json_decode($this->_rights[0]->pages)->{'root'}->acl_level == 3) { $data['url'] = '/admin/root/add'; $data['url_title'] = 'Новый админ'; } $data['acl_list'] = $this->_sec_groups->get_permissions(); if (isset($_POST['submit'])) { print_r($_POST); $login = trim(stripslashes(strip_tags($_POST['login']))); if ($login == '') { $error[] = 'Логин обязателен'; } $password = trim(stripslashes(strip_tags($_POST['password']))); if ($password == '') { $password = $data['admin']->passwd; } else { $password = \helpers\password::make($password); } $acl = trim(stripslashes(strip_tags($_POST['acl']))); if ($acl == '') { $error[] = 'Необходимо выбрать группу доступа'; } if (!$error) { $data = array('login' => $login, 'passwd' => $password, 'acl' => $acl); $this->_model->insert_admin($data); url::redirect('admin/root'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/root_add_form', $data, $error); view::rendertemplate('footer'); }
public function add() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Добавить рабочего'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Рабочие', 'href' => '/admin/workers/'); if (json_decode($this->_rights[0]->pages)->{'workers'}->acl_level == 3) { $data['url'] = '/admin/workers/add'; $data['url_title'] = 'Новый рабочий'; } $data['worker'] = $this->_model->get_worker($id); $data['cities'] = $this->_model->show_cities(); $data['statuses'] = $this->_model->show_statuses(); $data['salaries'] = $this->_model->show_salaries(); if (isset($_POST['submit'])) { $name = trim(stripslashes(strip_tags($_POST['name']))); if ($name == '') { $error[] = 'Имя рабочего обязательно'; } $login = trim(stripslashes(strip_tags($_POST['login']))); if ($login == '') { $error[] = 'Логин обязателен'; } $email = trim(stripslashes(strip_tags($_POST['email']))); $phone1 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone1'])))); if ($phone1 == '') { $error[] = 'Необходимо указать как минимум один телефон'; } $phone2 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone2'])))); $phone3 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone3'])))); $phone4 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone4'])))); $icq = trim(stripslashes(strip_tags($_POST['icq']))); $skype = trim(stripslashes(strip_tags($_POST['skype']))); $privat_card1 = trim(stripslashes(strip_tags($_POST['privat_card1']))); $privat_card2 = trim(stripslashes(strip_tags($_POST['privat_card2']))); $card_owner1 = trim(stripcslashes(strip_tags($_POST['card_owner1']))); $card_owner2 = trim(stripcslashes(strip_tags($_POST['card_owner2']))); $passwd = \helpers\password::make(trim($_POST['pass'])); if ($passwd == '') { $error[] = 'Пароль является обязательным'; } $comment = trim(stripslashes(strip_tags($_POST['comment']))); $salary = trim(stripslashes(strip_tags($_POST['salary']))); if ($salary == '') { $error[] = 'Необходимо указать зарплату'; } $city = trim(stripslashes(strip_tags($_POST['city']))); if ($city == '') { $error[] = 'Укажите город в котором будет работать сотрудник'; } $status = trim(stripslashes(strip_tags($_POST['status']))); if ($status == '') { $error[] = 'Укажите статус работника'; } $date = date("Y-m-d H:i:s"); if (!$error) { $data = array('name' => $name, 'login' => $login, 'email' => $email, 'phone1' => $phone1, 'phone2' => $phone2, 'phone3' => $phone3, 'phone4' => $phone4, 'icq' => $icq, 'skype' => $skype, 'privat_card1' => $privat_card1, 'privat_card2' => $privat_card2, 'card_owner1' => $card_owner1, 'card_owner2' => $card_owner2, 'passwd' => $passwd, 'comment' => $comment, 'salary_id' => $salary, 'city_id' => $city, 'status_id' => $status, 'works_from' => $date); $this->_model->insert_worker($data); url::redirect('admin/workers'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/worker_add_form', $data, $error); view::rendertemplate('footer'); }
public function edit($id) { $data['title'] = 'Просмотр данных заказа'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); $data['order'] = $this->_model->get_order($id, $this->user_id); $data['comment'] = $this->_model->get_comment($id, $this->user_id, "1"); $data['statuses'] = $this->_model->show_statuses(); $data['formula'] = $this->_model->salary_formula($data['order'][0]->salary_id); if (!empty($_POST)) { if (!isset($_POST['status'])) { $error[] = 'Ошибка, данные формы не отправленны'; } $data['current_sort'] = $this->_model->show_status_order($data['order'][0]->status_id); $data['expected_sort'] = $this->_model->show_status_order(trim($_POST['status'])); if ($data['expected_sort'] < $data['current_sort']) { $error[] = 'Статус заказа не может быть ниже чем уже имеющийся'; } else { if ($data['expected_sort'] > $data['current_sort']) { $status = trim($_POST['status']); $update_status = true; if ($status == 2) { $problem_viewed = 1; } else { $problem_viewed = 0; } } else { $status = $data['order'][0]->status_id; } } if ($data['order'][0]->profit > 0) { $profit = $data['order'][0]->profit; } /* }else{ if(preg_match('/[0-9]+(?:\.[0-9]*)?/',trim($_POST['profit']))){ $profit = trim($_POST['profit']); }else{ $profit = $data['order'][0]->profit; } } */ if ($data['order'][0]->total > 0) { $total = $data['order'][0]->total; } else { if (preg_match('/[0-9]+(?:\\.[0-9]*)?/', trim($_POST['total']))) { $total = trim($_POST['total']); // if ($data['order'][0]->salary_id == 1) { if ($total > 0 && $total <= 199) { $profit = $total * 0.5; } elseif ($total >= 200 && $total <= 250) { $profit = $total - 100; } elseif ($total >= 251 && $total <= 399) { $profit = $total * 0.6; } else { $profit = $total * 0.5; } } elseif ($data['order'][0]->salary_id == 2) { $profit = $total * 0.5; } elseif ($data['order'][0]->salary_id == 3) { $profit = $total * 0.6; } elseif ($data['order'][0]->salary_id == 4) { $profit = $total * 0.7; } // } else { $total = $data['order'][0]->total; } } $comment = trim(stripslashes(strip_tags(trim($_POST['worker_comment'])))); $where = array('id' => $id, 'worker_id' => $this->user_id); if (!$error) { //update order $data = array('status_id' => $status, 'problem_viewed' => $problem_viewed, 'profit' => round($profit, 2), 'total' => $total); $this->_model->update_order($data, $where); //update status if ($update_status) { $status_log['creation_date'] = date("Y-m-d H:i:s"); $where = array('order_id' => $id, 'status_id' => $status); $this->_model->update_status_log($status_log, $where); } //insert comment if ($comment) { //$old_comment = $this->_model->get_comment($id, $this->user_id); //if($old_comment && $old_comment->status == 1){ //} $data = array('order_id' => $id, 'worker_id' => $this->user_id, 'comment' => $comment, 'status' => '1', 'creation_date' => date("Y-m-d H:i:s")); $this->_model->insert_order_comment($data); } else { if ($this->_model->get_comment($id, $this->user_id, "1")) { $where = array('order_id' => $id, 'worker_id' => $this->user_id); $data = array('status' => '0'); $this->_model->update_order_comment($data, $where); } } if (\helpers\session::get('url')) { url::redirect(\helpers\session::get('url')); } else { url::redirect(''); } } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('order_edit_form', $data, $error); view::rendertemplate('footer'); }
public function add() { if (json_decode($this->_rights[0]->pages)->{'orders'}->acl_level != 3) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['title'] = 'Новый заказ'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/admin/orders/'); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); $data['url'] = '/admin/orders/add'; $data['url_title'] = 'Новый заказ'; if (isset($_POST['submit'])) { //print_r($_POST); if ($data['rights']->contact_name == 1) { $output['client_name'] = trim(stripslashes(strip_tags($_POST['contact_name']))); } if ($data['rights']->order_description == 1) { if (!isset($_POST['order_description']) || empty($_POST['order_description'])) { $error[] = 'Описание заказа не может быть пустым'; } else { $output['description'] = trim(stripslashes(strip_tags($_POST['order_description']))); } } if ($data['rights']->order_description_hidden == 1) { $output['description_hidden'] = trim(stripslashes(strip_tags($_POST['order_description_hidden']))); } if ($data['rights']->status == 1) { if (!isset($_POST['status']) || empty($_POST['status'])) { $error[] = 'Статус заказа не может быть пустым'; } else { $output['status_id'] = trim(stripslashes(strip_tags($_POST['status']))); } } if ($data['rights']->phone1 == 1) { if (!isset($_POST['phone1']) || empty($_POST['phone1'])) { $error[] = 'Необходимо указать как минимум один телефон'; } else { $output['phone1'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone1'])))); } } if ($data['rights']->phone2 == 1) { $output['phone2'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone2'])))); } if ($data['rights']->phone3 == 1) { $output['phone3'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone3'])))); } if ($data['rights']->worker == 1) { if (!isset($_POST['worker']) || empty($_POST['worker'])) { $error[] = 'Назначьте рабочего'; } else { $output['worker_id'] = trim(stripslashes(strip_tags($_POST['worker']))); } } if ($data['rights']->city == 1) { if (!isset($_POST['city']) || empty($_POST['city'])) { $error[] = 'Выберите город'; } else { $output['city_id'] = trim(stripslashes(strip_tags($_POST['city']))); } } if ($data['rights']->profit == 1) { $output['profit'] = trim(stripslashes(strip_tags($_POST['profit']))); } if ($data['rights']->total == 1) { $output['total'] = trim(stripslashes(strip_tags($_POST['total']))); } if ($data['rights']->spare == 1) { $output['spare'] = trim(stripslashes(strip_tags($_POST['spare']))); } if ($data['rights']->advert == 1) { $output['advert'] = trim(stripslashes(strip_tags($_POST['advert']))); } if ($data['rights']->check == 1) { $output['check_order'] = trim(stripslashes(strip_tags($_POST['check']))); } if (!$error) { $order_id = $this->_model->insert_order($output); $this->_model->insert_status_log($order_id, $output['status_id']); if (\helpers\session::get('url')) { url::redirect(\helpers\session::get('url')); } else { url::redirect('admin/orders'); } } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/order_add_form', $data, $error); view::rendertemplate('footer'); }
public function edit($id) { $data["title"] = $this->_archivo["editar"]["componente_nombre"]; $data["raiz"] = $this->_archivo["raiz"]["componente_enlace"]; $data["clase"] = $this->clase; $data["articulo"] = $this->_model->getArticulo($id); $data["js"] = "<script type='text/javascript'>" . "bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });" . "</script>"; if (null != filter_input(INPUT_POST, "submit")) { $titulo = filter_input(INPUT_POST, "titulo"); $contenido = filter_input(INPUT_POST, "contenido"); $descripcion = filter_input(INPUT_POST, "descripcion"); $fecha = filter_input(INPUT_POST, "fecha"); $publicado = filter_input(INPUT_POST, "estado") ? 1 : 0; $favorito = filter_input(INPUT_POST, "especial") ? 1 : 0; $autor = session::get("usuario"); if ($titulo === "") { $error[] = "{$publicado}"; } $allowedExts = array("gif", "jpeg", "jpg", "png", "svg"); $temp = explode(".", $_FILES["image"]["name"]); $extension = strtolower(end($temp)); if ($_FILES["image"]["size"] > 0 && !in_array($extension, $allowedExts)) { $error[] = "Tipo de imagen no Soportado."; } if ($_FILES["image"]["size"] / 1024 > 500) { $error[] = "Archivo de imagen mayor a 500 KB."; } if (!$error) { $slug = url::generateSafeSlug($titulo); $articulo_datos = array('articulo_titulo' => $titulo, 'articulo_contenido' => $contenido, 'articulo_descripcion' => $descripcion, 'articulo_fecha' => $fecha, 'articulo_estado' => $publicado, 'articulo_especial' => $favorito, 'articulo_autor' => $autor, 'articulo_slug' => $slug); if ($_FILES["image"]["size"] > 0) { $file = ARTICULOIMG . $_FILES["image"]["name"]; move_uploaded_file($_FILES["image"]["tmp_name"], $file); $articulo_datos["articulo_image"] = $file; } $where = array("articulo_id" => $id); $this->_model->updateArticulo($articulo_datos, $where); session::set("estado", "Articulo Modificado"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); } } view::admintemplate("header", $data); view::render($this->_archivo["editar"]["componente_enlace"], $data, $error); view::admintemplate("footer", $data); }
public function grupo() { $data["title"] = $this->_archivo["grupo"]["componente_nombre"]; $data["raiz"] = $this->_archivo["raiz"]["componente_enlace"]; $data["url"] = $this->_archivo["grupo"]["componente_url"]; if (null != filter_input(INPUT_POST, "submit")) { $nombre = filter_input(INPUT_POST, "nombre"); $fecha = filter_input(INPUT_POST, "fecha"); if ($nombre === "") { $error[] = "Nombre de grupo requerido."; } if (!$error) { $grupo_datos = array('menu_grupo_nombre' => $nombre, 'menu_grupo_fecha' => $fecha); $this->_model->crearGrupo($grupo_datos); session::set("estado", "Clase Creada"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); } } view::admintemplate("header", $data); view::render($this->_archivo["grupo"]["componente_enlace"], $data, $error); view::admintemplate("footer", $data); }
public function detailRentals($url) { //send of mail if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $phone = filter_input(INPUT_POST, 'phone'); $sleeps = filter_input(INPUT_POST, 'sleeps'); $date_arrival = filter_input(INPUT_POST, 'date_arrival'); $date_departure = filter_input(INPUT_POST, 'date_departure'); $comment = filter_input(INPUT_POST, 'comment'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $date_arrival == '' || !isset($date_arrival) || $date_departure == '' || !isset($date_departure) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Contact Rentals "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Phone: " . $phone . "<br>"; $message .= "People: " . $sleeps . "<br>"; $message .= "Arrival date: " . $date_arrival . "<br>"; $message .= "Departure date: " . $date_departure . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } //URL $urlExplode = explode("/", $url); if ($urlExplode[0] == "print") { $item_id = $urlExplode[1]; } else { $item_id = $urlExplode[0]; } //detail $data['item_id'] = $item_id; $data['item_result'] = $this->_model->fetchRentalsDetails($item_id, "Y", $_SESSION['site_lang']); //title for de hover in navbar $data['title_page'] = "location"; //type of search in form, default selected: rentals $data['searchtype'] = 'rentals'; //URL change lang $data['lang_var'] = "detail"; //change tipe text to capital letter switch ($data['item_result'][0]->type) { case 'condo': $data['item_result'][0]->type = 'Condo'; break; case 'house': $data['item_result'][0]->type = 'House'; break; case 'hotel': $data['item_result'][0]->type = 'Hotel'; break; case 'lot': $data['item_result'][0]->type = 'Lot'; break; case 'commercial': $data['item_result'][0]->type = 'Commercial business'; break; case 'other': $data['item_result'][0]->type = 'Hotel'; break; } switch ($data['item_result'][0]->bathrooms_details) { case 'private': $data['item_result'][0]->bathrooms_details = 'Private'; break; case 'shared': $data['item_result'][0]->bathrooms_details = 'Shared'; break; case 'both': $data['item_result'][0]->bathrooms_details = 'Private and Shared'; break; } switch ($data['item_result'][0]->pool_type) { case 'private': $data['item_result'][0]->pool_type = 'Private'; break; case 'shared': $data['item_result'][0]->pool_type = 'Shared'; break; } //SEO $data['title'] = "Rentals - " . $data['item_result'][0]->name . " " . $data['item_result'][0]->location; $data['meta_description'] = strip_tags($data['item_result'][0]->highlights); $data['meta_keywords'] = $data['item_result'][0]->name . ", " . $data['item_result'][0]->location . ", " . $data['item_result'][0]->type; $data['sitename_before'] = "N"; //Comments $data['comments'] = $this->_model_c->fetchRentalsComments($item_id, 0, 0, 'Y'); $data['replys'] = $this->_model_c->fetchRentalsReply(0, 0, 'Y'); // send of comment if (!is_null(filter_input(INPUT_POST, 'submitComment'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Rental Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); // insert table $dataComments = array('rentals_id' => $item_id, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'N'); $this->_model_c->insert_comments('rental_comment', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } // send of reply if (!is_null(filter_input(INPUT_POST, 'submitReply'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); $id_reply = filter_input(INPUT_POST, 'id_reply'); $email_reply = filter_input(INPUT_POST, 'email_reply'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress($email_reply); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Rental Reply Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Reply: " . $comment; $mail->body($message); // insert table $dataComments = array('rental_comment_id' => $id_reply, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'Y'); $this->_model_c->insert_comments('rental_reply', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } //images if ($data['item_result']) { $data['images_result'] = $this->_model->fetchRentalsPhotos($item_id, 0, 0); // Images for a property $array = array(); $i = 0; foreach ($data['images_result'] as $images_row) { $array[$i] = $this->_model->fetchRentalsPhotoDetails($images_row->photo_id); $i++; } $data['images_details_result'] = $array; if ($urlExplode[0] == "print") { View::rendertemplate('header_print', $data); View::render('rentals/rentals_print', $data); View::rendertemplate('footer_print', $data); } else { View::rendertemplate('header', $data); View::render('rentals/rentals', $data); View::rendertemplate('footer', $data); } } else { // not found rental header("HTTP/1.0 404 Not Found"); $data['title'] = '404'; $data['error'] = 'No routes found.'; View::rendertemplate('header', $data); View::render('error/404', $data); View::rendertemplate('footer', $data); } }
public function acceso($grupo_nombre) { $data["title"] = $this->_archivo["acceso"]["componente_nombre"]; $data["raiz"] = $this->_archivo["raiz"]["componente_url"]; $data["url"] = $this->_archivo["acceso"]["componente_url"]; $data["grupo"] = $grupo_nombre; $data["componentes"] = $this->_componente->permisosComponentes($grupo_nombre); view::admintemplate("header", $data); view::render($this->_archivo["acceso"]["componente_enlace"], $data, $error); view::admintemplate("footer", $data); }
public function edit($id) { $data["title"] = $this->_archivo["editar"]["componente_nombre"]; $data["raiz"] = $this->_archivo["raiz"]["componente_enlace"]; $data["clase"] = $this->clase; $data["grupos"] = $this->_model->getGrupos(); $data["categoria"] = $this->_model->getCategoria($id); if (null != filter_input(INPUT_POST, "submit")) { $nombre = filter_input(INPUT_POST, "nombre"); $nombre == "" ? $error[] = "Nombre de categoria requerido." : NULL; if (!$error) { $datos_categoria = array("documento_tipo_nombre" => $nombre); $where = array("documento_tipo_id" => $id); $this->_model->updateCategoria($datos_categoria, $where); session::set("estado", "Se ha modificado la categoria"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); } } view::admintemplate("header", $data); view::render($this->_archivo["editar"]["componente_enlace"], $data, $error); view::admintemplate("footer", $data); }
public function add() { if (json_decode($this->_rights[0]->pages)->{'cities'}->acl_level <= 1) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['title'] = "Добавить город"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Города', 'href' => '/admin/cities/'); $data['statuses'] = $this->_model->show_statuses(); if (json_decode($this->_rights[0]->pages)->{'cities'}->acl_level == 3) { $data['url'] = '/admin/cities/add'; $data['url_title'] = 'Новый город'; } if (isset($_POST['submit'])) { $city = trim(stripslashes(strip_tags($_POST['city']))); if ($city == '') { $error[] = 'Укажите город'; } $status = trim(stripslashes(strip_tags($_POST['status']))); if ($status == '') { $error[] = 'Укажите статус города'; } $comment = trim(stripslashes(strip_tags($_POST['comment']))); if (!$error) { $data = array('city' => $city, 'status_id' => $status, 'comment' => $comment); $where = array('id' => $id); $this->_model->insert_city($data); url::redirect('admin/cities'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/city_add_form', $data, $error); view::rendertemplate('footer'); }