"; var_dump($status); echo "";*/ 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 "
";
            var_dump($status);
            echo "
";*/ 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 "
";
        var_dump($histiry);
        echo "
";*/ 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 "
";
                    var_dump($print);
                    echo "
"; echo "kek"; echo "
";
                    var_dump($_POST);
                    echo "
";*/ $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 "
";
                    var_dump($_SESSION);
                    echo "
----------------------
"; var_dump($_POST); echo "
"; }*/ $print = Printer::getPrintByIDFullData($id); }else{ $access = "Ошибка доступа"; } require_once (ROOT. TMPL. 'edit_print.php'); unset($_SESSION['message']); return true; } }