+
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of cartriges
|
||||
*
|
||||
* @author adm_azashchepkin
|
||||
*/
|
||||
class CartrigesController {
|
||||
//put your code here
|
||||
public static $title = " Картриджи";
|
||||
|
||||
public function actionIndex(){ //главная страница раздела картриджей
|
||||
|
||||
$title = self::$title;
|
||||
|
||||
$summ_cart = Cartriges::getSumAllCarteiges();
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
$messages = Cartriges::ActionCartriges($_POST, $_SESSION);
|
||||
/*echo "<pre>";
|
||||
print_r ($_POST);
|
||||
print_r ($_SESSION['user_id']);
|
||||
echo "</pre>";*/
|
||||
|
||||
}
|
||||
|
||||
require_once (ROOT . TMPL . 'cartriges.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionActions(){ //действия с картриджами (доставка\замена)
|
||||
|
||||
if(!isset($_POST['submit'])) @$_SESSION['link'] = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
$act_error = 0;
|
||||
|
||||
$action = $_GET['act'];
|
||||
|
||||
if(empty($action)) $act_error = 1;
|
||||
|
||||
$title = self::$title."| Действия";
|
||||
|
||||
//echo "hello user ".$action."-action";
|
||||
|
||||
$cartriges = Cartriges::getActivCartriges();
|
||||
require_once (ROOT . TMPL . 'action_cartriges.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function actionAdd(){ //добавление картриджа
|
||||
|
||||
$title = self::$title."| Добавление";
|
||||
|
||||
|
||||
if(isset($_POST['addcartrige'])){
|
||||
|
||||
echo "get add new cartrige in base";
|
||||
(!Cartriges::addCartriges($_POST)) ? $messages = "Картридж добавлен" : $messages = "error";
|
||||
$cartriges = Cartriges::getAllCartriges();
|
||||
}
|
||||
else{
|
||||
$cartriges = Cartriges::getAllCartriges();
|
||||
}
|
||||
$cartrridges_history = Cartriges::getHistoryCartridges(9);
|
||||
require_once (ROOT . TMPL . 'addcartrige.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionPublic($id){
|
||||
|
||||
//self::checkAdmin();
|
||||
|
||||
$pub = Cartriges::changeIsPublic($id);
|
||||
//var_dump($_SESSION);
|
||||
//var_dump($_POST);
|
||||
//var_dump($_FILES);
|
||||
//var_dump($id);
|
||||
if($pub){
|
||||
header ('Location: '.DOMEN .'/cartriges/add');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function actionReaction($id){ //активация\деактивация картриджа
|
||||
|
||||
Cartriges::reactivCartriges($id);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static function actionOrders(){ //заказ картриджей
|
||||
|
||||
$title = self::$title."| Заказ";
|
||||
if(user::checkAdmin() == true){
|
||||
$summ_cart = Cartriges::getSumAllCarteiges();
|
||||
$cartriges = Cartriges::getActivCartriges();
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
//show and running code for order
|
||||
$list = Cartriges::orderCartriges($_POST);
|
||||
$data_ord = json_encode($_POST);
|
||||
/*$from = array(
|
||||
'name'=>''.$_SESSION["full_name"].'',
|
||||
'email'=>''.$_SESSION["mail"].'',
|
||||
);*/
|
||||
$a = Mail::getLinkOrd($list);
|
||||
//echo $a;
|
||||
/*echo "<pre>";
|
||||
var_dump($_SESSION);
|
||||
echo "</pre>";*/
|
||||
}
|
||||
$save = filter_input(INPUT_POST, 'save_order');
|
||||
if(isset($save)){
|
||||
$data = json_decode(filter_input(INPUT_POST, 'data'), true);
|
||||
|
||||
$saving = Unit::saveOrder($_SESSION["user_id"], $data);//добавить в базу заявок
|
||||
//var_dump($create_action);
|
||||
if(!$saving){
|
||||
$message = "error";
|
||||
}else {
|
||||
$message = "ok";
|
||||
//header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$access = "Ошибка доступа";
|
||||
}
|
||||
require_once (ROOT . TMPL . 'cartriges_order.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function actionZeroning(){
|
||||
Cartriges::resetToZero();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of ImagesController
|
||||
*
|
||||
* @author adm_azashchepkin
|
||||
*/
|
||||
class ImagesController {
|
||||
//put your code here
|
||||
public function actionUpload(){
|
||||
|
||||
$_SESSION['link'] = $_SERVER['HTTP_REFERER'];
|
||||
|
||||
if(isset($_POST['upload'])) {
|
||||
$id_prn = $_POST['print_id'];
|
||||
if(!Images::checkAndDeleteImg($id_prn)) echo "Ошибка загрузки изображения";// проверка наличия изображения у принтера и удаление из файловой системы
|
||||
else{
|
||||
$link_img = Images::uploadImg($_POST);
|
||||
|
||||
if($link_img == "Error upload image") echo "Ошибка загрузки изображения";
|
||||
else{
|
||||
if(!Images::updatePrintImg($id_prn, $link_img)) echo "Ошибка загрузки изображения";
|
||||
else header("Location: ".$_SESSION['link']);
|
||||
}
|
||||
}
|
||||
/*
|
||||
echo "<pre>";
|
||||
var_dump($_SESSION);
|
||||
echo "<br />----------------------<br />";
|
||||
var_dump($_POST);
|
||||
echo "<br />----------------------<br />";
|
||||
var_dump($_FILES);
|
||||
echo "</pre>";
|
||||
*
|
||||
*
|
||||
* array(13) {
|
||||
["link"]=>
|
||||
string(35) "http://prints.local/printer/edit/49"
|
||||
["user_id"]=>
|
||||
string(12) "azashchepkin"
|
||||
["name_en"]=>
|
||||
string(19) "Zashchepkin, Andrey"
|
||||
["name"]=>
|
||||
string(16) "Защепкин"
|
||||
["surname"]=>
|
||||
string(12) "Андрей"
|
||||
["middle_name"]=>
|
||||
string(26) "Александрович"
|
||||
["full_name"]=>
|
||||
string(56) "Защепкин Андрей Александрович"
|
||||
["city"]=>
|
||||
string(10) "Курск"
|
||||
["position"]=>
|
||||
string(62) "Специалист технической поддержки"
|
||||
["department"]=>
|
||||
string(60) "Отдел информационных технологий"
|
||||
["mail"]=>
|
||||
string(25) "azashchepkin@rencredit.ru"
|
||||
["phone"]=>
|
||||
string(5) "15000"
|
||||
["georol"]=>
|
||||
string(16) "GR.RC.Курск"
|
||||
}
|
||||
|
||||
----------------------
|
||||
array(2) {
|
||||
["print_id"]=>
|
||||
string(2) "49"
|
||||
["upload"]=>
|
||||
string(0) ""
|
||||
}
|
||||
|
||||
----------------------
|
||||
array(1) {
|
||||
["img"]=>
|
||||
array(5) {
|
||||
["name"]=>
|
||||
string(13) "error wfm.png"
|
||||
["type"]=>
|
||||
string(9) "image/png"
|
||||
["tmp_name"]=>
|
||||
string(39) "C:\OpenServer\userdata\temp\php5D63.tmp"
|
||||
["error"]=>
|
||||
int(0)
|
||||
["size"]=>
|
||||
int(50663)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class PhonebookController{
|
||||
|
||||
public static $title = " Телефонный справочник";
|
||||
|
||||
public function actionIndex(){
|
||||
|
||||
$title = self::$title;
|
||||
|
||||
$list = Phonebook::gelAllPhoneList();
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($list);
|
||||
echo "</pre>";*/
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionSearch(){
|
||||
|
||||
$title = self::$title . " | Поиск";
|
||||
|
||||
if(!empty($_POST)){
|
||||
$searching = $_POST['searching'];
|
||||
}
|
||||
if(!empty($searching)){
|
||||
$value = Phonebook::gerResultSearch($searching);
|
||||
}
|
||||
/*echo "<pre>";
|
||||
var_dump($list);
|
||||
echo "</pre>";*/
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_search.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionSave(){
|
||||
|
||||
Phonebook::getExcelList();
|
||||
|
||||
header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
|
||||
}
|
||||
|
||||
public function actionUpdate(){
|
||||
|
||||
$data = $_POST;
|
||||
|
||||
$upd = Phonebook::save($data);
|
||||
if(!empty($upd) || isset($upd['save'])){
|
||||
|
||||
if($upd){
|
||||
header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
}else return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionAdmsearch(){
|
||||
|
||||
$title = self::$title . " | Поиск adm";
|
||||
|
||||
$error = false;
|
||||
if(user::checkAdmin() == true){
|
||||
|
||||
if(isset($_POST['submit']) || !empty($_POST['searching'])){
|
||||
$searching = $_POST['searching'];
|
||||
$list = Phonebook::gerResultSearch($searching, 1);
|
||||
}else{
|
||||
$list = Phonebook::gelAllPhoneList(0);
|
||||
}
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
|
||||
$subardination = Phonebook::getSubordination();
|
||||
$parents = Phonebook::getParents();
|
||||
$departments = Phonebook::getDepatmnents();
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_admsearch.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionActiv($id){
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
$pub = Phonebook::changeIsActiv($id);
|
||||
//var_dump($_SESSION);
|
||||
//var_dump($_POST);
|
||||
//var_dump($_FILES);
|
||||
//var_dump($id);
|
||||
if($pub){
|
||||
header ('Location: http://'.DOMEN .'/phonebook/admsearch');
|
||||
}
|
||||
}else $error = "access denied";
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_admsearch.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionAdd(){
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_add.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionEdit($id){
|
||||
|
||||
$title = self::$title . " | Редактирование";
|
||||
$message = false;
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
if(isset($_POST['save'])){
|
||||
$update = Phonebook::save($_POST);
|
||||
(!$update) ? $message = "Error" : $message = "Good";
|
||||
}
|
||||
$info = Phonebook::getElementByID($id);
|
||||
$subardination = Phonebook::getSubordination();
|
||||
$parents = Phonebook::getParents();
|
||||
$departments = Phonebook::getDepatmnents();
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_edit.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionDelete($id){
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
|
||||
require_once (ROOT. TMPL. 'phonebook_del.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created on 03.10.2016
|
||||
* By NetBeans IDE 8.1
|
||||
* Author: Andrey Zashchepkin
|
||||
*
|
||||
*
|
||||
* ******** Contacts:*********
|
||||
* my e-mails - yaslonane@yandex.ru
|
||||
* - andrey@zashchepkin.ru
|
||||
* - info@zashchepkin.ru
|
||||
* my site zashchepkin.ru
|
||||
* ******** end contacts *********
|
||||
*
|
||||
*
|
||||
* Copyright zashchepkin.ru © 2016. All Rights Reserved.
|
||||
* License https://opensource.org/licenses/mit-license.php MIT License (MIT)
|
||||
*
|
||||
*
|
||||
* Description of PrintersController
|
||||
*
|
||||
* @author andrey
|
||||
* */
|
||||
class PrintersController {
|
||||
//put your code here
|
||||
|
||||
public static $title = " Принтеры";
|
||||
|
||||
public function actionIndex(){
|
||||
|
||||
$title = self::$title;
|
||||
|
||||
$printList = Printer::getListPrinters();
|
||||
|
||||
if($printList == 0) $error = 1;
|
||||
|
||||
$floor = Printer::getAllFloors();
|
||||
$department = Printer::getAllDepartments();
|
||||
$cartrige = Printer::getAllCartriges();
|
||||
$status = Printer::getAllStatuses();
|
||||
|
||||
require_once (ROOT. TMPL. 'printers.php');
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($status);
|
||||
echo "</pre>";*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function actionAdd(){
|
||||
|
||||
$title = self::$title;
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
//echo "save!!!";
|
||||
|
||||
//insert in base new printer and geting her id
|
||||
//forvard in page edit/[id]
|
||||
$id = Printer::insertPrint($_POST, true);
|
||||
//echo $id;
|
||||
header("Location: /printer/edit/".$id);
|
||||
/*$upbd = printer::updatePrint($print['id'], $_POST);
|
||||
|
||||
$save = Printer::setHistoryChange($up, $print['id'], $_SESSION['user_id']);
|
||||
if(!$upbd) $_SESSION['message'] = "Error";
|
||||
else $_SESSION['message'] = "good";*/
|
||||
}else{
|
||||
$title = self::$title." | Добавление";
|
||||
|
||||
//$printList = Printer::getListPrinters();
|
||||
|
||||
//if($printList == 0) $error = 1;
|
||||
|
||||
$floor = Printer::getAllFloors();
|
||||
$department = Printer::getAllDepartments();
|
||||
$cartrige = Printer::getAllCartriges();
|
||||
$status = Printer::getAllStatuses();
|
||||
$functions = Printer::getAllFunctions();
|
||||
|
||||
require_once (ROOT. TMPL. 'add_prn.php');
|
||||
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($status);
|
||||
echo "</pre>";*/
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function actionView($id){
|
||||
|
||||
$print = Printer::getPrintByID($id);
|
||||
|
||||
$title = self::$title." | ".$print['name'];
|
||||
|
||||
$history = Printer::getHistoryChangeByID($id);
|
||||
|
||||
require_once (ROOT. TMPL. 'info.php');
|
||||
/*echo "<pre>";
|
||||
var_dump($histiry);
|
||||
echo "</pre>";*/
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function actionEdit($id){
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
$floor = Printer::getAllFloors();
|
||||
$department = Printer::getAllDepartments();
|
||||
$cartrige = Printer::getAllCartriges();
|
||||
$status = Printer::getAllStatuses();
|
||||
$functions = Printer::getAllFunctions();
|
||||
$print = Printer::getPrintByIDFullData($id);
|
||||
|
||||
$title = self::$title." | Редактирование | ".$print['name'];
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($print);
|
||||
echo "</pre>";
|
||||
echo "kek";
|
||||
echo "<pre>";
|
||||
var_dump($_POST);
|
||||
echo "</pre>";*/
|
||||
|
||||
$up = printer::checkDataUpdatePrint($print, $_POST);
|
||||
|
||||
$upbd = printer::updatePrint($print['id'], $_POST);
|
||||
|
||||
$save = Printer::setHistoryChange($up, $print['id'], $_SESSION['user_id']);
|
||||
if(!$upbd) $_SESSION['message'] = "Error";
|
||||
else $_SESSION['message'] = "good";
|
||||
}
|
||||
|
||||
/*if(isset($_POST['submitimg'])){
|
||||
echo "<pre>";
|
||||
var_dump($_SESSION);
|
||||
echo "<br />----------------------<br />";
|
||||
var_dump($_POST);
|
||||
echo "</pre>";
|
||||
}*/
|
||||
$print = Printer::getPrintByIDFullData($id);
|
||||
}else{
|
||||
$access = "Ошибка доступа";
|
||||
}
|
||||
require_once (ROOT. TMPL. 'edit_print.php');
|
||||
|
||||
unset($_SESSION['message']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of RadioController
|
||||
*
|
||||
* @author adm_azashchepkin
|
||||
*/
|
||||
class RadioController {
|
||||
//put your code here
|
||||
public static $title = " Радио";
|
||||
|
||||
public function actionIndex(){ //главная страница раздела картриджей
|
||||
|
||||
$title = self::$title;
|
||||
|
||||
$radioList = Radio::radioList();
|
||||
$statistic = Radio::getStatistic();
|
||||
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($statistic);
|
||||
echo "</pre>";*/
|
||||
//echo $this->host_ice .":". $this->port_ice;
|
||||
|
||||
require_once (ROOT . TMPL . 'radio.php');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionStatistics(){
|
||||
|
||||
$statistic = Radio::getStatistic();
|
||||
$string = "<table class='table'>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th> Слушать </td>
|
||||
<th>Слушателей<br>сейчас</th>
|
||||
<th>Композиция</th>
|
||||
</tr>";
|
||||
for($i=0; count($statistic)>$i; $i++){
|
||||
$string .= "<tr>";
|
||||
$string .= "<td>".$statistic[$i]['stream']."</td>";
|
||||
$string .="<td><a target=_blanc href='http://dsk7681:8000".$statistic[$i]['stream'].".m3u'><img border='0' width='24' src='http://dsk7681/frame/images/radio1.gif'></a></td>";
|
||||
$string .="<td>".$statistic[$i]['quantity_listens']."</td>";
|
||||
$string .="<td>".$statistic[$i]['title']."</td>";
|
||||
$string .="</tr>";
|
||||
}
|
||||
|
||||
$string .="</table>";
|
||||
echo $string;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
class SiteController{
|
||||
/*
|
||||
*
|
||||
* вывод главной страницы
|
||||
*
|
||||
*/
|
||||
public static $title = " Главная";
|
||||
|
||||
public function actionIndex(){
|
||||
|
||||
//$categories = array(); //инициализируем переменную для вывода списка категорий
|
||||
//$categories = Category::getCategoriesList(); // вызываем метод получения массива категорий из модели категории
|
||||
/* выводим дерево категорий
|
||||
$x = new Category(); // вызываем класс
|
||||
$a = $x->treeCategory(); // выбираем из базы список категорий и подкатегорий
|
||||
$categories2 = category::create_tree($a, 0); // вызываем функцию и строим дерево
|
||||
*
|
||||
*/
|
||||
|
||||
//$latestProduct = array();
|
||||
//$latestProduct = Product::getLatestProducts();
|
||||
$title = self::$title;
|
||||
|
||||
$summ_cart = Cartriges::getSumAllCarteiges();
|
||||
|
||||
$printList = Printer::getRandPrint(3);
|
||||
|
||||
require_once(ROOT . TMPL .'index.php');
|
||||
/*echo "Home<br>";
|
||||
|
||||
if(user::checkAuth() == false){
|
||||
echo "Авторизуйтесь!!!";
|
||||
}else{
|
||||
echo "<img src='https://intranet.rencredit.ru/my/User%20Photos/Profile%20Pictures/".$_SESSION['user_id']."_LThumb.jpg' class='img-circle'/>";
|
||||
|
||||
|
||||
echo "<pre>";
|
||||
var_dump($_SESSION);
|
||||
echo "</pre>";
|
||||
echo "<a href='/user/logout'>Exit</a>";
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionContact(){
|
||||
|
||||
$userEmail = '';
|
||||
$userText = '';
|
||||
$result = false;
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
$userEmail = $_POST['userEmail'];
|
||||
$userText = $_POST['userText'];
|
||||
|
||||
$errors = false;
|
||||
|
||||
if(!user::checkEmail($userEmail)){
|
||||
$errors[] = 'Not valid E-mail';
|
||||
}
|
||||
|
||||
if($errors == false){
|
||||
$adminEmail = 'yaslonane@yandex.ru';
|
||||
$message = "Текст: {$userText}. От {$userEmail}";
|
||||
$subject = 'subject mail TEST';
|
||||
$result = mail($adminEmail, $subject, $message, "From: System message from zaa46.xyz <info@zaa46.xyz>"); /* {$userEmail} */
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
|
||||
require (ROOT . TMPL . 'contact.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* конец вывода главной страницы
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of UnitController
|
||||
*
|
||||
* @author adm_azashchepkin
|
||||
*/
|
||||
class UnitController {
|
||||
//put your code here
|
||||
public static $title = " Unit";
|
||||
|
||||
public function actionIndex($page = 1){
|
||||
|
||||
$title = self::$title . " | Список обращений";
|
||||
|
||||
$requests = Unit::getRequests($page);
|
||||
$total = Unit::getTotalRequests();
|
||||
|
||||
$pagination = new Pagination($total, $page, Product::SHOW_BY_DEFAULT, 'page-');
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($requests);
|
||||
echo "</pre>";*/
|
||||
|
||||
require_once (ROOT. TMPL. 'requests.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionCreaterequest(){
|
||||
|
||||
$title = self::$title . " | Создание запроса";
|
||||
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
if(user::checkAdmin() == true){
|
||||
|
||||
$printers = Printer::getListPrinters('all');
|
||||
$create = filter_input(INPUT_POST,'create');
|
||||
if(isset($create)){
|
||||
$user_id = filter_input(INPUT_POST,'username');
|
||||
$print_id = filter_input(INPUT_POST,'print_id');
|
||||
$description = filter_input(INPUT_POST,'text');
|
||||
|
||||
$lnk = Mail::getRequests($print_id, $description);
|
||||
|
||||
|
||||
}
|
||||
$save = filter_input(INPUT_POST, 'save_request');
|
||||
if(isset($save)){
|
||||
$user = filter_input(INPUT_POST,'user_id');
|
||||
$print = filter_input(INPUT_POST,'print_id');
|
||||
$desc = filter_input(INPUT_POST,'description');
|
||||
$saving = Unit::setRequest($user, $print, $desc);//добавить в базу заявок
|
||||
$create_action = Unit::createNewAction($saving, 0, $user);
|
||||
//var_dump($create_action);
|
||||
if(!$saving){
|
||||
$message = "error";
|
||||
}else {
|
||||
$message = "ok";
|
||||
//header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
require_once (ROOT. TMPL. 'create_request.php');
|
||||
|
||||
/*echo "<pre>";
|
||||
var_dump($status);
|
||||
echo "</pre>";*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionRequesttobase(){
|
||||
//$printers = Printer::getListPrinters('all');
|
||||
$save = filter_input(INPUT_POST, 'save_request');
|
||||
if(isset($save)){
|
||||
$user_id = filter_input(INPUT_POST,'user_id');
|
||||
$print_id = filter_input(INPUT_POST,'print_id');
|
||||
$description = filter_input(INPUT_POST,'description');
|
||||
$saving = Unit::setRequest($user_id, $print_id, $description);//добавить в базу заявок
|
||||
if(!$saving){
|
||||
$message = "error";
|
||||
}else {
|
||||
$message = "ok";
|
||||
header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
}
|
||||
}
|
||||
echo $message;
|
||||
return true;
|
||||
/*echo "<pre>";
|
||||
var_dump($status);
|
||||
echo "</pre>";*/
|
||||
|
||||
}
|
||||
|
||||
public function actionActionrequest($id = NULL){
|
||||
$title = self::$title . " | Действия по обращению";
|
||||
$error = "";
|
||||
if(user::checkAdmin() == true){
|
||||
//action if authorization is successful
|
||||
if($id === NULL){
|
||||
header("Location: http://".DOMEN."/unit/requests");
|
||||
}else{
|
||||
$list = Unit::getRequestByID($id);
|
||||
$act = Unit::getAllActionByIDRequest($id);
|
||||
}
|
||||
}else{
|
||||
$error = "access denied";
|
||||
}
|
||||
//require_once (ROOT. TMPL. 'create_request.php');
|
||||
require_once (ROOT. TMPL. 'action_request.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionNewactionrequest(){
|
||||
|
||||
$act = Unit::setNewActions();
|
||||
|
||||
$docs = filter_input(INPUT_POST, 'docs');
|
||||
$request_id = filter_input(INPUT_POST, 'request_id');
|
||||
|
||||
$indoc = Unit::setNewDocs($act, $request_id, $docs);
|
||||
|
||||
if($indoc == true) header("Location: http://".DOMEN."/unit/actionrequest/".$request_id."");
|
||||
|
||||
//return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Description of UserController
|
||||
*
|
||||
* @author andrey
|
||||
*/
|
||||
class UserController {
|
||||
//put your code here
|
||||
|
||||
//public static function actionIndex{
|
||||
|
||||
|
||||
// }
|
||||
|
||||
/* public function actionRegister(){
|
||||
|
||||
$name = '';
|
||||
$email = '';
|
||||
$password = '';
|
||||
$result = false;
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
$errors = false;
|
||||
|
||||
if(!user::checkName($name)){
|
||||
$errors[] = 'Warning!!! It\'s name short 2 elements';
|
||||
}
|
||||
|
||||
if(!User::checkPassword($password)){
|
||||
$errors[] = 'Warning!!! It\'s password short 6 elements';
|
||||
}
|
||||
|
||||
if(!User::checkEmail($email)){
|
||||
$errors[] = 'Warning!!! It\'s e-mail dont valid';
|
||||
}
|
||||
|
||||
if(user::checkEmailExists($email)){
|
||||
$errors[] = 'Sorry, this is e-mail is using';
|
||||
}
|
||||
|
||||
if($errors == false){
|
||||
$result = (user::register($name, $password, $email));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
require_once (ROOT. TMPL. 'register.php');
|
||||
|
||||
return true;
|
||||
}*/
|
||||
|
||||
public function actionLogin(){
|
||||
if(!isset($_POST['submit'])) $_SESSION['link'] = $_SERVER['HTTP_REFERER'];
|
||||
$username = '';
|
||||
$password = '';
|
||||
|
||||
$errors = false;
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
$username = $_POST['login'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
$errors = false;
|
||||
|
||||
$auth = Ldap::LdapAuth($username, $password);
|
||||
header("location: ".$_SESSION['link']."");
|
||||
}
|
||||
|
||||
require_once (ROOT . TMPL . 'login.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function actionLogout(){
|
||||
|
||||
@session_start();
|
||||
unset($_SESSION['user_id']);
|
||||
unset($_SESSION['name']);
|
||||
header("Location: ".$_SERVER['HTTP_REFERER']."");
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user