public function render($view, $endpage = true) { $this->data['elist'] = CModel::getErrorList(); extract($this->data); if (!$this->hprint) { include $this->viewFolder . 'hcommon.php'; $this->hprint = true; } $viewfile = strtolower($this->viewFolder . $this->classname . "/{$view}.php"); if (file_exists($viewfile)) { include $viewfile; } if ($endpage) { include $this->viewFolder . 'fcommon.php'; } }
public function ajaxComplete() { $role = get_param($this->authdata, 'role_id'); $me = get_param($this->authdata, 'id'); $depid = get_param($this->authdata, 'depid'); $ticket_id = filter_input(INPUT_POST, 'ticket', FILTER_VALIDATE_INT); $info = $this->model->getTicketInfo($ticket_id); if (!$info) { return $this->preparePopup('Запрошеная заявка не найдена'); } elseif (get_param($info, 'status') != STATUS_OPEN) { return $this->preparePopup('Нельзя прикрыть заявку, которая не открыта', 'alert-warning'); //} elseif ($role !== Configuration::$ROLE_USER || get_param($info, 'department_id') !== $depid) { } elseif (!$this->isGrantToMe('ACE_COMPLETE', get_param($info, 'department_id'))) { return $this->preparePopup("Прикрыть заявку может руководитель цеха,\n который создал ее."); } // Если ошибок нет, то переводим ее в статус закрытая, установив дату закрытия $ok = $this->model->completeTicket($ticket_id); if ($ok) { $this->model->setTicketStatus($ticket_id, STATUS_COMPLETE); } if (count($this->model->getErrors())) { echo CModel::getErrorList(); } else { $this->preparePopup('Заявка прикрыта', 'alert-info'); } }
public function actionChangeGroup() { $gname = filter_input(INPUT_POST, 'group-name', FILTER_SANITIZE_STRING); $group_id = filter_input(INPUT_POST, 'group-id', FILTER_VALIDATE_INT); if ($gname && $group_id) { $this->model->saveGroup($gname, $group_id); $elist = CModel::getErrorList(); if ($elist) { $this->preparePopup($elist); } else { $this->preparePopup('Название групы сохранено.', 'alert-success'); } } $this->redirect(['back' => 1]); }