Exemple #1
0
 public function get_module_list()
 {
     $modules = _cms_module::get_all(['mid', 'title', 'primary_key', '_cms_group.title', 'table_name'], ['join' => ['_cms_group' => '_cms_group.gid = _cms_module.gid']]);
     if ($modules) {
         $html = node::create('div', [], node::create('table.module.table.table-striped', [], node::create('thead', [], node::create('th', [], 'Module ID') . node::create('th', [], 'Group') . node::create('th', [], 'Title') . node::create('th', [], 'Table Name') . node::create('th', [], 'Primary Key')) . $modules->iterate_return(function (_cms_module $module) {
             $attributes = ['href' => '/cms/admin_edit/' . $module->mid];
             return node::create('tr', [], node::create('td a', $attributes, $module->mid) . node::create('td a', $attributes, $module->_cms_group->title) . node::create('td a', $attributes, $module->title) . node::create('td a', $attributes, $module->table_name) . node::create('td a', $attributes, $module->primary_key));
         })));
         return $html;
     }
     return '';
 }
Exemple #2
0
 /**
  * @return string
  */
 function get_main_nav()
 {
     $groups = object\_cms_group::get_all([]);
     $html = node::create('nav#nav.navbar.navbar-default', ['role' => 'navigation'], node::create('div.container-fluid', [], node::create('ul.nav.navbar-nav', [], node::create('li a.navbar-brand', ['href' => '/cms'], 'CMS') . $groups->iterate_return(function (object\_cms_group $row) {
         $modules = object\_cms_module::get_all([], ['where_equals' => ['gid' => $row->gid, 'parent_mid' => 0]]);
         return node::create('li', [], node::create('a.dropdown-toggle', ['data-toggle' => 'dropdown'], $row->title . node::create('span.caret', [], '')) . node::create('ul.dropdown-menu', ['role' => 'menu'], $modules->iterate_return(function (object\_cms_module $srow) {
             return node::create('li a', ['href' => '/cms/module/' . $srow->mid], $srow->title);
         })));
     })) . node::create('ul.nav.navbar-nav.navbar-right', [], $this->get_right_nav())));
     return $html;
 }
Exemple #3
0
 public static function rebuild_modules()
 {
     $modules = _cms_module::get_all(_cms_module::$default_fields);
     $fields = _cms_field::get_all(_cms_field::$default_fields);
     $json = [];
     $modules->iterate(function (_cms_module $row) use(&$json) {
         $result = [];
         foreach (_cms_module::$default_fields as $field) {
             $result[$field] = $row->{$field};
         }
         $json[$row->mid] = $result;
     });
     $fields->iterate(function (_cms_field $row) use(&$json) {
         $result = [];
         foreach (_cms_field::$default_fields as $field) {
             $result[$field] = $row->{$field};
         }
         $json[$row->mid]['fields'][$row->field_name] = $result;
     });
     file_put_contents(root . '/.cache/.modules.json', json_encode($json));
 }