private function isDefaultUserIteractBlock($id)
 {
     Auth::isAdminOrDie(App::$instance);
     if (in_array($id, [1])) {
         App::$instance->MQ->setMessage('Нелья редактировать системныe записи');
         ST::redirect("back");
     }
 }
 public function unmark($caVksId)
 {
     Auth::isAdminOrDie(App::$instance);
     foreach (AdminCaNote::where('vks_id', $caVksId)->get() as $caVks) {
         $caVks->delete();
     }
     App::$instance->MQ->setMessage("У ВКС ЦА {$caVksId} удален флаг");
     ST::redirect('back');
 }
 public function delete($id)
 {
     Auth::isAdminOrDie(App::$instance);
     if ($id == 1) {
         App::$instance->MQ->setMessage("Это удалить нельзя, просто переименуйте как вам нужно");
         ST::redirect('back');
     }
     $department = Department::findorFail($id);
     $department->delete();
     App::$instance->MQ->setMessage("Успешно удалено");
     App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Подразделение удалено' . $department->name);
     ST::redirectToRoute('Departments/index');
 }
 public function show($rootId = 1)
 {
     Auth::isAdminOrDie(App::$instance);
     if (self::isContainer($rootId)) {
         $points = Attendance::where('parent_id', $rootId)->with('childs')->take($this->getQlimit(30))->skip($this->getQOffset())->orderBy('container', 'desc')->orderBy($this->getQOrder('name'), $this->getQVector('asc'))->get();
         $recordsCount = Attendance::where('parent_id', $rootId)->count();
         $breadCrumps = self::fullParentInfo($rootId);
         $pages = RenderEngine::makePagination($recordsCount, $this->getQlimit(30), 'route');
         $this->render('attendance/v2/show', compact('points', 'breadCrumps', 'pages'));
     } else {
         $this->error('404');
     }
 }
Esempio n. 5
0
 public function index($eventType = false)
 {
     Auth::isAdminOrDie(App::$instance);
     if (!$eventType) {
         $logList = LogRecord::take($this->getQlimit(50))->skip($this->getQOffset())->orderBy($this->getQOrder(), $this->getQVector())->with("user")->get();
     } else {
         $logList = LogRecord::where('event_type', $eventType)->take($this->getQlimit(50))->skip($this->getQOffset())->orderBy($this->getQOrder(), $this->getQVector())->with("user")->get();
     }
     //define event type
     foreach ($logList as $log) {
         $log->humanized = new stdClass();
         $log->humanized->event_type = $this->defineLogType($log->event_type);
     }
     $eventType = $this->defineLogType($eventType);
     $recordsCount = LogRecord::all()->count();
     //pages
     $pages = RenderEngine::makePagination($recordsCount, $this->getQlimit(50), 'route');
     $this->render("logs/index", compact('logList', 'pages', 'eventType'));
 }
 public function index()
 {
     //take only today
     Auth::isAdminOrDie(App::$instance);
     $start = date_create()->setTime(0, 0);
     $end = date_create()->setTime(23, 59);
     $now = date_create();
     $calFeeder = new CalendarFeed_controller();
     $events = $calFeeder->feedInPeriod($start, $end);
     $sortedEvents = [];
     foreach ($events as $event) {
         if ($now < $event->start_date_time) {
             $sortedEvents['future'][] = $event;
         } elseif ($now > $event->end_date_time) {
             //                dump($now, date_create($event->end_date_time));
             $sortedEvents['past'][] = $event;
         } elseif ($now > $event->start_date_time && $now < $event->end_date_time) {
             $sortedEvents['now'][] = $event;
         }
     }
     if (isset($sortedEvents['future'])) {
         $sortedEvents['future']['html'] = App::$instance->twig->render('dashboards/event.twig', array('sortedEvents' => $sortedEvents['future'], 'coreHttpAddress' => HTTP_PATH, 'nodeHttpAddress' => NODE_HTTP_PATH));
     } else {
         $sortedEvents['future']['html'] = '<i>список пуст</i>';
     }
     //        dump($sortedEvents['past']);
     if (isset($sortedEvents['past'])) {
         $sortedEvents['past']['html'] = App::$instance->twig->render('dashboards/event.twig', array('sortedEvents' => $sortedEvents['past'], 'coreHttpAddress' => HTTP_PATH, 'nodeHttpAddress' => NODE_HTTP_PATH));
     } else {
         $sortedEvents['past']['html'] = '<i>список пуст</i>';
     }
     if (isset($sortedEvents['now'])) {
         $sortedEvents['now']['html'] = App::$instance->twig->render('dashboards/event.twig', array('sortedEvents' => $sortedEvents['now'], 'coreHttpAddress' => HTTP_PATH, 'nodeHttpAddress' => NODE_HTTP_PATH));
     } else {
         $sortedEvents['now']['html'] = '<i>список пуст</i>';
     }
     //        dump($sortedEvents);
     $this->render('dashboards/index', compact('sortedEvents'));
 }
Esempio n. 7
0
<?php

Auth::isAdminOrDie(App::$instance);
ST::deployTemplate('heads/ui_timepicker.inc');
ST::setUserCss('attendance/style.css');
ST::setUserCss('attendance/manage-style.css');
RenderEngine::MenuChanger();
//dump($data['backPack']->parent_id);
//dump($data);
?>
<script>
    $(document).ready(function () {
        showOnly(".show10-1", 5);
        showOnly(".show10-2", 5);
    })
</script>
<div class="container">
    <div class="col-lg-1 col-sm-offset-2"><a class="btn btn-default"
                                             href="?route=AttendanceNew/show/<?php 
echo $data['backPack']->parent_id;
?>
">
            Назад</a></div>
    <div class="col-md-6 block-border-shadow-normal-padding left-border padding25">
        <h4>Редактировать точку/контейнер</h4>
        <hr>
        <div class="alert alert-danger">Свойтво "техническая поддержка" используется в экспериментальном режиме и пока нигде не используется</div>
        <form class="form-horizontal" method="post" action="?route=AttendanceNew/update/<?php 
echo $data['backPack']->id;
?>
">
 public function storeOther()
 {
     Auth::isAdminOrDie(App::$instance);
     Token::checkToken();
     $xml = new SimpleXMLElement('<root/>');
     if ($this->request->request->has('option')) {
         foreach ($this->request->request->get('option') as $option) {
             if ($option['name'] == 'help-phone') {
                 $this->validator->validate([$option['description'] => [$option['value'], 'max(15)']]);
             } elseif (in_array($option['name'], ['attendance_strict', 'attendance_check_enable', 'notify_admins'])) {
                 $this->validator->validate([$option['description'] => [$option['value'], 'between(0,1)']]);
             } else {
                 $this->validator->validate([$option['description'] => [$option['value'], 'required']]);
             }
             //if no passes
             if (!$this->validator->passes()) {
                 $this->putUserDataAtBackPack($this->request);
                 App::$instance->MQ->setMessage($this->validator->errors()->all());
                 ST::redirect("back");
             }
             $srvXml = $xml->addChild('option');
             $srvXml->addAttribute('description', $option['description']);
             $srvXml->addAttribute('name', $option['name']);
             $srvXml->addAttribute('value', $option['value']);
         }
         $xml->asXML("config/other-cfg.xml");
         App::$instance->MQ->setMessage('Список обновлен');
         App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'изменены общие настройки');
     }
     ST::redirect("back");
 }
 public static function isDefaultUserIteractBlock($id)
 {
     Auth::isAdminOrDie(App::$instance);
     if (in_array($id, [1])) {
         App::$instance->MQ->setMessage('Нелья редактировать системных пользователей');
         ST::redirect("back");
     }
 }
Esempio n. 10
0
 public function showLocalVks($caVksId)
 {
     Auth::isAdminOrDie(App::$instance);
     $vkses = Vks::with('participants')->where('link_ca_vks_id', $caVksId)->get();
     foreach ($vkses as $vks) {
         $this->humanize($vks);
     }
     $this->render('Vks/showLocalRelativeToCa', compact('vkses', 'caVksId'));
 }