Esempio n. 1
0
 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));
 }
Esempio n. 3
0
 /**
  * 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));
 }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CRM <?php 
echo $_SERVER["HTTP_HOST"];
?>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php 
echo Orchestra\Asset::styles();
echo Orchestra\Asset::scripts();
?>
</head>
<body>
	<div id="wrap">

		<div class="navbar">
			<div class="container">
				<a class="navbar-brand" href="/">Звездный</a>

				<ul class="nav navbar-nav">
					<li<?if($active_menu_id == 1):?> class="active"<?endif;?>><a href="/" class="menu-item"><span class="fa fa-home"></span></a></li>
					<li class="dropdown<?if($active_menu_id == 2):?> active<?endif;?>">
						<a href="javascript:;;" class="dropdown-toggle" data-toggle="dropdown">Справочники <b class="caret"></b></a>
						<ul class="dropdown-menu">
							<li role="presentation" class="dropdown-header">Структура компании</li>
							<li><a href="/structure/departments">Подразделения</a></li>
							<li><a href="/structure/workshifts">Варианты смен</a></li>
							<li><a href="/structure/positions">Должности</a></li>
							<li role="presentation" class="divider"></li>
Esempio n. 6
0
 /**
  * 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));
 }