public function __construct() { $this->userdata = $this->checkUserdata(); // apply authorization filter $this->beforeFilter(function () { if (!$this->userdata && Request::segment(1) !== 'login') { return Redirect::to('/login'); } }); // templates for app errors App::missing(function ($exception) { return Response::view('errors.404_cms', array(), 404); }); App::error(function (Exception $exception, $code) { Log::error($exception); if ($code == 403) { return Response::view('/errors/error_403', array(), 403); } }); // shared assets Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css"); Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css"); Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css"); Orchestra\Asset::add("cms-css", "assets/css/cms.css"); Orchestra\Asset::add("jquery", "assets/js/jquery.js"); Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js"); Orchestra\Asset::add("handlers-js", "assets/js/handlers.js"); // shared views View::share("active_menu_id", 1); View::share("userdata", $this->userdata); // configuration Config::set("view.pagination", "common/pagination"); }
/** * Departments tree * * @return \View */ public function getIndex() { Orchestra\Asset::add("pinotify", "assets/css/jquery.pnotify.default.css"); Orchestra\Asset::add("pinotify", "assets/js/jquery.pnotify.js"); Orchestra\Asset::add("jquery-ui", "assets/js/ui/js/jquery-ui-1.10.3.custom.min.js"); Orchestra\Asset::add("fancybox", "assets/js/fancybox.pack.js"); Orchestra\Asset::add("fancybox", "assets/css/fancybox.css"); Orchestra\Asset::add("nested-sortables", "assets/js/jquery.mjs.nestedSortable.js"); $root = Department::find($this->root_department_id); $tree = $root->getDescendants()->toHierarchy()->toArray(); $tpl = $this->makeTreeTemplate($tree); $content = View::make('departments/list', array('tpl' => $tpl)); return View::make('common/tpl', array('template' => $content)); }
/** * User edit form * * @param int $id * @return \View */ public function getEdit($id = false) { if (!$id) { return App::abort(404); } $item = User::find($id); if (!$item) { return App::abort(404); } Orchestra\Asset::add("jquery-ui", "assets/js/ui/js/jquery-ui-1.10.3.custom.min.js"); Orchestra\Asset::add("jquery-ui", "assets/js/ui/css/hot-sneaks/jquery-ui-1.10.3.custom.min.css"); Orchestra\Asset::add("mask", "assets/js/mask.js"); $positions = Position::select(["positions.id", "positions.name", "departments.name as department_name"])->leftjoin("departments", "departments.id", "=", "positions.department_id")->orderBy("departments.name")->orderBy("positions.name")->get(); $content = View::make("users/edit", ["positions" => $positions, "item" => $item]); return View::make("common/tpl", array("template" => $content)); }
public function getView($id = false) { if (!$id) { return App::abort(404); } $item = Task::find($id); if (!$item) { return App::abort(404); } Orchestra\Asset::add("fancybox", "assets/js/fancybox.pack.js"); Orchestra\Asset::add("fancybox", "assets/css/fancybox.css"); Orchestra\Asset::add("jquery-ui", "assets/js/ui/js/jquery-ui-1.10.3.custom.min.js"); Orchestra\Asset::add("jquery-ui", "assets/js/ui/css/hot-sneaks/jquery-ui-1.10.3.custom.min.css"); Orchestra\Asset::add("tasks-js", "assets/js/tasks.js"); $isReassignable = !($item->lastAssignment() && $item->lastAssignment()->logicstep); $taskStepsTemplate = !$isReassignable ? $this->taskStepsTemplate($item) : ""; $content = View::make("tasks/tasks/item", ["item" => $item, "contractor_id" => $item->getContractorId(), "isReassignable" => $isReassignable, "taskStepsTemplate" => $taskStepsTemplate]); return View::make("common/tpl", array("template" => $content)); }
/** * List of steps * * @param int $id * @return \View */ public function getSteps($id = false) { if (!$id) { return App::abort(404); } $blogic = Businesslogic::find($id); if (!$blogic) { return App::abort(404); } Orchestra\Asset::add("jquery-ui", "assets/js/ui/js/jquery-ui-1.10.3.custom.min.js"); $steps = $blogic->steps()->orderBy("sort")->get(); $content = View::make("tasks/blogic/steps", ["blogic" => $blogic, "steps" => $steps]); return View::make("common/tpl", array("template" => $content)); }