コード例 #1
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function monitorAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Монитор');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 400, 'align' => 'left', 'text' => 'Событие'), array('width' => 400, 'align' => 'left', 'text' => 'Действия')));
     $rows = array();
     // Связи событие->действия
     $actions = array();
     $links = $this->repMonitor->findBy(array(), array('event' => 'ASC', 'weight' => 'ASC'));
     foreach ($links as $link) {
         $action = $this->repAction->findOneBy(array('name' => $link->action, 'module' => $link->module));
         if (!empty($action)) {
             $actions[$link->event][] = $action->title . ' (' . $link->module . '::' . $link->action . ')';
         }
     }
     // События
     $events = $this->repEvent->findBy(array());
     foreach ($events as $event) {
         $events[$event->name] = array('title' => $event->title, 'actions' => array());
         if (count($actions[$event->name]) > 0) {
             $rows[] = array($event->title . ' (' . $event->name . ')', implode('<br/>', $actions[$event->name]));
         }
     }
     $form->addRows($rows);
     $output = $form->render();
     return $output;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function listAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Информационный модуль');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 100), array('width' => 300)));
     $rows = array();
     // версия CMS
     $rows[] = array('Aquarel CMS', $this->conf->ac_ver);
     // версия PHP
     $rows[] = array('PHP', phpversion());
     // версия GD-библиотеки
     $gd = gd_info();
     $rows[] = array('GD', $gd['GD Version']);
     // список установленных модулей
     $modules_installed = array();
     $modules = $this->em->getRepository('Modules\\Entities\\Module')->findBy(array('install' => 1, 'active' => 1, 'group' => 'custom'), array('name' => 'ASC'));
     foreach ($modules as $module) {
         $modules_installed[] = $module->name . ' (' . $module->title . ')';
     }
     $rows[] = array('Установленные модули', implode('<br/>', $modules_installed));
     $form->addRows($rows);
     $output = $form->render();
     return $output;
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function listAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Письма');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 1), array('width' => 400, 'align' => 'left', 'text' => 'Название'), array('width' => 1), array('width' => 1)));
     $rows = array();
     $mails = $this->repMail->findBy(array());
     foreach ($mails as $mail) {
         $edit = array('type' => 'link_img_edit', 'href' => '#Mail/edit/' . $mail->id);
         $title = array('type' => 'link', 'href' => '#Mail/edit/' . $mail->id, 'text' => $mail->title);
         $active = $mail->active == 1 ? array('type' => 'link_img_active', 'action' => "disable_item('mail','" . $mail->id . "');") : array('type' => 'link_img_disable', 'action' => "activate_item('mail','" . $mail->id . "');");
         $delete = array('type' => 'link_img_delete', 'action' => "javascript: if (MsgOkCancel('Действительно удалить?')) { delete_item('mail','" . $mail->id . "'); }");
         $rows[] = array($edit, $title, $active, $delete);
     }
     $form->addRows($rows);
     return $form->render();
 }
コード例 #4
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function listTemplatesAction()
 {
     $conf = \Control\Core::conf();
     $form = new \Control\Forms();
     $form->setTitle('Типы данных. Шаблоны');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 1), array('width' => 500, 'align' => 'left', 'text' => 'Имя'), array('width' => 300, 'align' => 'left', 'text' => 'Идентификатор'), array('width' => 1)));
     $rows = array();
     $templates = $this->repDataTemplate->findBy(array(), array('name' => 'ASC'));
     foreach ($templates as $template) {
         $edit = array('type' => 'link_img_edit', 'href' => '#Data/editTemplate/' . $template->id);
         $delete = array('type' => 'link_img_delete', 'action' => "javascript: if (MsgOkCancel('Действительно удалить?')) { data_template_delete('" . $template->id . "'); }");
         $title = array('type' => 'link', 'href' => '#Data/editTemplate/' . $template->id, 'text' => $template->title);
         $name = array('type' => 'link', 'href' => '#Data/editTemplate/' . $template->id, 'text' => $template->name);
         $rows[] = array($edit, $title, $name, $delete);
     }
     $form->addRows($rows);
     $output = $form->render();
     return $output;
 }
コード例 #5
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function listAction($group = 'system')
 {
     $img_active = "<img src='/system/themes/sky/images/active.png' title='выключить' alt='выключить' width='16' height='16' />";
     $img_disable = "<img src='/system/themes/sky/images/disable.png' title='включить' alt='включить' width='16' height='16' />";
     $img_install = "<img src='/system/themes/sky/images/install.png' title='Установить' alt='удалить' height='16' width='16' />";
     $img_uninstall = "<img src='/system/themes/sky/images/delete.png' title='удалить' alt='удалить' height='16' width='16' />";
     $form = new \Control\Forms();
     $form->setTitle('Модули системы');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 400, 'align' => 'left', 'text' => 'Идентификатор'), array('width' => 400, 'align' => 'left', 'text' => 'Имя'), array('width' => 50, 'align' => 'left', 'text' => ''), array('width' => 200, 'align' => 'left', 'text' => 'Статус')));
     $rows = array();
     $modules = $this->getList($group);
     if (empty($modules)) {
         return 'Модули не найдены';
     }
     foreach ($modules as $module_name => $module_info) {
         $module = new Module($module_name);
         $action = '';
         $action_title = '';
         $status = '';
         $status_title = '';
         if (empty($module->name)) {
             $module->name = ' - ';
         }
         if (empty($module->author)) {
             $module->author = ' - ';
         }
         if (empty($module->title)) {
             $module->title = ' - ';
         }
         if (empty($module->version)) {
             $module->version = ' - ';
         }
         if (!empty($module->info->dependencies)) {
             foreach ($module->info->dependencies as $module_dependence_name => $dependence_active) {
                 $module_dependence = new Module($module_dependence_name);
                 if ($module_dependence->getActive() == 1) {
                     $module_dependencies[$module_dependence_name] = 1;
                 } else {
                     $module_dependencies[$module_dependence_name] = 0;
                     $status = 'error_dependencies';
                 }
             }
         }
         switch ($module->getInstall()) {
             // Module is not installed
             case '0':
                 if ($status != 'error_dependencies') {
                     $status_title = 'не установлен';
                     $action = "modules_install(\"{$module_name}\")";
                     $action_title = $img_install;
                 } else {
                     $status_title = 'модуль имеет неразрешенные зависимости и не может быть установлен';
                 }
                 break;
                 // Module is installed
             // Module is installed
             case '1':
                 if ($module->getActive() == 1) {
                     $status = 'ok';
                     $status_title = 'установлен и активен';
                     $action = "modules_deactivate(\"{$module->name}\")";
                     $action_title = $img_active;
                 } else {
                     $status = '';
                     $status_title = 'установлен, но не активен';
                     $action = "modules_activate(\"{$module->name}\")";
                     $action_title = $img_disable;
                 }
                 // if it is not a system, add the link to remove
                 if ($group != 'system') {
                     $action = array($action, "javascript: if (MsgOkCancel(\"Будут потеряны все данные модуля. \\nВы действительно хотите удалить модуль {$module_name}?\")) { modules_uninstall(\"{$module_name}\", \"{$group}\"); }");
                     $action_title = array($action_title, $img_uninstall);
                 }
                 break;
         }
         if (!empty($module->info->dependencies) > 0) {
             $module_title .= '<br/>Для работы требуются модули: ';
             foreach ($module->info->dependencies as $module_dependence_name => $dependence_active) {
                 if ($dependence_active == 1) {
                     $module_title .= ' <font color="green">' . $module_dependence_name . '</font> ';
                 } else {
                     $module_title .= ' <font color="red">' . $module_dependence_name . '</font> ';
                 }
             }
         }
         if ($status == 'error_module_info') {
             $row_class = 'row-error';
         }
         $module_action = '';
         if (is_array($action)) {
             for ($i = 0; $i < count($action); $i++) {
                 $module_action .= "<a class='js-link' onclick='" . $action[$i] . "'>" . $action_title[$i] . "</a> ";
             }
         } elseif ($action_title != '' && $action != '') {
             $module_action = "<a class='js-link' onclick='" . $action . "'>" . $action_title . "</a>";
         }
         $row = array('cells' => array($module->name, $module->title, $module_action, $status_title));
         if (!empty($row_class)) {
             $row['class'] = $row_class;
         }
         $rows[] = $row;
     }
     $form->addRows($rows);
     $output = $form->render();
     return $output;
 }
コード例 #6
0
ファイル: Controller.php プロジェクト: jfkz/aquarel-cms
 public function listGroupsAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Группы пользователей');
     $form->setTemplate('list');
     $form->addHead(array(array('width' => 1), array('width' => 400, 'align' => 'left', 'text' => 'Название'), array('width' => 1)));
     $rows = array();
     $groups = $this->repUserGroup->findBy(array(), array('id' => 'ASC'));
     foreach ($groups as $group) {
         $edit = array('type' => 'link_img_edit', 'href' => '#Users/editGroup/' . $group->id);
         $title = array('type' => 'link', 'href' => '#Users/editGroup/' . $group->id, 'text' => $group->title);
         $delete = array('type' => 'link_img_delete', 'action' => "javascript: if (MsgOkCancel('Действительно удалить?')) { delete_item('UserGroup','" . $group->id . "'); }");
         $rows[] = array($edit, $title, $delete);
     }
     $form->addRows($rows);
     return $form->render();
 }