public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $this->notifications->defineTemplate('adminTodo', self::TEMPLATE, 'bg-yellow'); $view['todos'] = array_map(function ($todo) use($view) { if (isset($todo['action']['url'])) { $todo['action']['url'] = $view->getModuleUrl($todo['action']['url']); } return $todo; }, $this->readTodos()); if ($this->emitNotifications) { foreach ($view['todos'] as $todo) { $this->notifications->adminTodo($todo); } } }
public function showMessage($text, $type) { $this->getLog()->deprecated(); if ($type === \Nethgui\Module\Notification\AbstractNotification::NOTIFY_ERROR) { $this->userNotifications->error($text); } else { $this->userNotifications->info($text); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { if (!$this->getRequest()->isValidated()) { $this->getAdapter()->setLoader(NULL); } else { $view->getCommandList()->show(); } if ($this->getRequest()->hasParameter('installSuccess')) { $this->getAction('AdminTodo')->emitNotifications = TRUE; $this->notifications->yumSuccess(array('message' => $view->translate('YumSuccess_message'), 'description' => $view->translate('YumSuccess_description'), 'buttonLabel' => $view->translate('YumSuccess_button_label'), 'action' => $view->getModuleUrl('..'))); } elseif ($this->getRequest()->hasParameter('installFailure')) { $taskStatus = $this->systemTasks->getTaskStatus($this->getRequest()->getParameter('taskId')); if (isset($taskStatus['children'][0]['message'])) { $message = $taskStatus['children'][0]['message']; } else { $message = $view->translate('An unknown installation error has occurred'); } $this->notifications->yumError(array('message' => $message, 'description' => $view->translate('ClearYumCache_description'), 'buttonLabel' => $view->translate('ClearYumCache_label'), 'action' => $view->getModuleUrl('../ClearYumCache'))); } parent::prepareView($view); if (isset($this->yumError)) { $this->notifications->yumError(array('message' => $this->yumError, 'description' => $view->translate('ClearYumCache_description'), 'buttonLabel' => $view->translate('ClearYumCache_label'), 'action' => $view->getModuleUrl('../ClearYumCache'))); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $this->notifications->defineTemplate('trackerError', strtr(self::TRACKER_ERROR_TEMPLATE, array('{{genericLabel}}' => $view->translate('Tracker_task_error_message'), '{{codeLabel}}' => $view->translate('Tracker_code_label'))), 'bg-red'); // Define a notification template that opens the first running task details: $this->notifications->defineTemplate('trackerRunning', strtr(self::TRACKER_RUNNING_TEMPLATE, array('{{message}}' => $view->translate('Tracker_running_tasks_message'), '{{btnLink}}' => $view->getModuleUrl('/Tracker/{{taskId}}'), '{{btnLabel}}' => $view->translate('Tracker_button_label'))), 'bg-yellow'); if (!$this->getRequest()->getUser()->isAuthenticated()) { return; } if ($this->taskId === FALSE) { $this->prepareInitializationView($view); } else { $this->prepareRunningTaskView($view); } }
public function getTemplates() { return $this->notifications->getTemplates(); }
private function notifyEvent(\Symfony\Component\Process\Process $process) { if ($process->getExitCode() !== 0) { $this->notifications->trackerError(array('failedTasks' => \Nethgui\Module\Tracker::findFailures($this->systemTasks->getTaskStatus($process->taskId)))); } }