Example #1
0
 public function listAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Настройки');
     $form->setTemplate('form');
     $theme = new \Control\Theme();
     $themes = $theme->getList();
     $settings_save = array();
     $settings = $this->repSettings->findBy(array(), array('id' => 'ASC'));
     foreach ($settings as $setting) {
         if ($setting->name == 'site_theme') {
             $options = array();
             foreach ($themes['custom'] as $theme) {
                 $options[] = $theme . '=' . $theme;
             }
             $setting->options = implode(',', $options);
         }
         $setting->id = 'Settings_' . $setting->name;
         $setting->caption = $setting->title;
         $form->addObject($setting);
         $settings_save[] = $setting->name;
     }
     $form->addFooter(array('type' => 'button', 'id' => 'save', 'value' => 'Сохранить', 'action' => "settings_save('" . implode($this->conf->ac_sep, $settings_save) . "');"));
     $output = $form->render();
     return $output;
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 public function listAction()
 {
     $live = \Control\Live::getInstance();
     $page = new \Pages\Page();
     $tree = $page->getTree();
     $form = new \Control\Forms();
     $form->setTitle('Страницы');
     $form->setTemplate('tree');
     $properties = array('animate' => 'true', 'autoclose' => 'false', 'docToFolderConvert' => 'true', 'afterMove' => "if (\$('span:first',destination).parent().attr('id') && \$('span:first',source).parent().attr('id')) {\n                                                        var parent = \$('span:first',destination).parent().attr('id').split('_')['1'];\n                                                        var id = \$('span:first',source).parent().attr('id').split('_')['1'];\n                                                        pages_reorder(parent,id,pos);\n                                                        }", 'afterDblClick' => "var id = \$('span:first',node).parent().attr('id').split('_')['1']; location.href = '#Pages/edit/'+id;", 'afterClick' => '');
     $form->addDraggebleTree($tree, $properties);
     $output = $form->render();
     return $output;
 }
Example #5
0
 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();
 }
Example #6
0
 public function settingsAction()
 {
     $conf = \Control\Core::conf();
     $form = new \Control\Forms();
     $form->setTitle('Wysiwygs');
     $form->setTemplate('form');
     $obj = new \stdClass();
     $obj->type = 'select';
     $obj->id = 'wysiwygs_name';
     $obj->status = 'db';
     $obj->value = !empty($conf->settings['wysiwyg']) ? $conf->settings['wysiwyg'] : '';
     $obj->options = 'a:4:{s:6:"module";s:8:"Wysiwygs";s:6:"entity";s:7:"Wysiwyg";s:5:"index";s:4:"name";s:5:"title";s:5:"title";}';
     $obj->caption = 'Визивиг';
     $form->addObject($obj);
     $form->addHTML('<div id="wysiwygs_info"><br/><br/><br/></div>');
     $form->addFooter(array('type' => 'button', 'id' => 'save', 'value' => 'Сохранить', 'action' => 'wysiwygs_save_settings()'));
     $output = $form->render();
     return $output;
 }
Example #7
0
 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;
 }
Example #8
0
 public function editForm($options, $id, $footer = '', $form_params = array())
 {
     $id = intval($id);
     if (is_array($options)) {
         if (empty($options['fields'])) {
             $fields = $this->fields;
         } else {
             $fields_ = explode($this->conf->ac_sep, $options['fields']);
             foreach ($fields_ as $field) {
                 $fields[] = $this->fields[$field];
             }
         }
         $params = !empty($options['params']) ? $options['params'] : array();
         $header = !empty($options['header']) ? $options['header'] : '';
         $footer = !empty($options['footer']) ? $options['footer'] : '';
         $title = !empty($options['title']) ? $options['title'] : '';
     }
     $form = new \Control\Forms();
     $form->setTitle($title);
     $form->setTemplate('form');
     if (!empty($header)) {
         $form->addHTML($header);
     }
     $entityName = '\\' . $this->module . '\\Entities\\' . $this->entity;
     $item = $this->em->find($entityName, $id);
     foreach ($fields as $field) {
         $field_name = $field->name;
         $field->id = $this->module . '_' . $field->name;
         $field->value = $field->type != 'password' ? $item->{$field_name} : '';
         $field->caption = $field->title;
         $form->addObject($field);
     }
     if ($footer == '') {
         $form->addFooter(array('type' => 'button', 'id' => 'ok', 'value' => 'Готово', 'action' => "save_item('{$this->name}', '{$this->fields_str}', '{$id}', 'list');"));
         $form->addFooter(array('type' => 'button', 'id' => 'save', 'value' => 'Сохранить', 'action' => "save_item('{$this->name}', '{$this->fields_str}', '{$id}');"));
         $form->addFooter(array('type' => 'button', 'id' => 'delete', 'value' => 'Удалить', 'action' => "javascript: if (MsgOkCancel('Действительно удалить?')) { delete_item('{$this->name}', '{$id}', '1', 'list'); }"));
         $form->addFooter(array('type' => 'button', 'id' => 'cancel', 'value' => 'Отмена', 'href' => '#' . $this->module . '/list'));
     } else {
         if (is_array($footer)) {
             foreach ($footer as $foot) {
                 $form->addFooter($foot);
             }
         } else {
             $form->addFooter($footer);
         }
     }
     return $form->render();
 }
Example #9
0
 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;
 }
Example #10
0
 public function listPermissionsAction()
 {
     $form = new \Control\Forms();
     $form->setTitle('Разрешения для пользователей');
     $modules = $this->em->getrepository('Modules\\Entities\\Module')->findBy(array());
     foreach ($modules as $module) {
         $permissions = $this->repUserPermission->findBy(array('module' => $module->name));
         if (!empty($permissions)) {
             $link = new \stdClass();
             $link->type = 'link';
             $link->action = "if(\$('#module_permissions_" . $module->name . "').css('display')=='block')\$('#module_permissions_" . $module->name . "').hide(); else \$('#module_permissions_" . $module->name . "').show();";
             $link->text = $module->title;
             $link->style = "border-bottom:1px dashed grey";
             $form->addObject($link);
             $form->addHTML('<br/><ul id="module_permissions_' . $module->name . '" style="display:block; list-style:none">');
             foreach ($permissions as $permission) {
                 $form->addHTML('<li>');
                 $edit = new \stdClass();
                 $edit->type = 'link_img_edit';
                 $edit->href = '#Users/editPermission/' . $permission->id;
                 $form->addObject($edit);
                 $delete = new \stdClass();
                 $delete->type = 'link_img_delete';
                 $delete->action = "javascript: if (MsgOkCancel('Действительно удалить?')) { delete_item('UserPermission','" . $permission->id . "'); }";
                 $form->addObject($delete);
                 $link = new \stdClass();
                 $link->type = 'link';
                 $link->href = '#Users/editPermission/' . $permission->id;
                 $link->text = $permission->title;
                 $form->addObject($link);
                 $form->addHTML('</li>');
             }
             $form->addHTML('</ul><br/>');
         }
     }
     return $form->render();
 }