예제 #1
0
 public static function permissions_page()
 {
     page::title("Permissions");
     $out = page::link("admin/permissions/scan", "scan for more permissions");
     $out .= "<form method='post' action='" . page::url("admin/permissions/update") . "'>";
     $array = array();
     $header = array("permissions");
     $groups = user_access::get_all_roles();
     foreach ($groups as $g) {
         $header[] = $g->groupname;
     }
     $perms = permission::get_all_permissions();
     foreach ($perms as $p) {
         $t_array = array();
         $t_array[] = "<b>{$p->permission}</b> <i>{$p->description}</i>";
         foreach ($groups as $g) {
             $o = "<input type='checkbox' name='permissions[" . $p->permission . "][" . $g->gid . "]' ";
             if (user::has_permission($p->permission, $g->gid)) {
                 $o .= "checked";
             }
             $o .= "/>";
             $t_array[] = $o;
         }
         $array[] = $t_array;
     }
     $out .= theme::t_table($array, $header);
     $out .= "<input type='submit' value='update'/>";
     $out .= "</form>";
     return $out;
 }
예제 #2
0
 public static function page_control_panel()
 {
     $a = array();
     $a[] = page::link("admin/modules", "Modules");
     $a[] = page::link("admin/themes", "Themes");
     $a[] = page::link("admin/permissions", "Permissions");
     return theme::t_list($a);
 }
예제 #3
0
 public static function list_of_menus()
 {
     $array = array();
     foreach (self::get_all_menus() as $list) {
         $array[] = page::link($list->url, $list->name);
     }
     return "<h3>Links</h3>" . theme::t_list($array);
 }
예제 #4
0
파일: home.php 프로젝트: decima/M2-platine
function home()
{
    $out = "there is actually no content. enable content module to manage this page";
    if (module_manager::is_enabled("content")) {
        $out = "";
        $nodes = content_database::node_load_all();
        $b = false;
        if (count($nodes) > 0) {
            page::title("Home");
            foreach ($nodes as $node) {
                if (content::node_access_read($node->nid)) {
                    $b = true;
                    $out .= "<div class='post'>";
                    if ($node->title != null) {
                        $out .= "<div class='title'>";
                        $out .= page::link("node/" . $node->nid, $node->title);
                        $out .= "</div>";
                    }
                    if ($node->description != null) {
                        $out .= "<div class='content'>";
                        $node->description = utf8_decode($node->description);
                        if (strlen($node->description) > 200) {
                            $out .= substr($node->description, 0, 200) . "... " . page::link("node/" . $node->nid, t("+ read more"));
                        } else {
                            $out .= $node->description;
                        }
                        $out .= "</div>";
                    }
                    $out .= "<div class='author'>";
                    $out .= "<hr/>";
                    $out .= content_page::post_author_date($node->uid, $node->author, $node->date);
                    $out .= "<hr/>";
                    $out .= "</div>";
                    $out .= "</div>";
                }
            }
        } else {
            $out .= "there is no content, please add a content first.";
        }
    }
    return $b ? $out : "there is no content.";
}
예제 #5
0
 public static function post_author_date($uid, $author, $date)
 {
     $u = page::link("user/" . $uid, $author);
     $k = print_date($date);
     return t("posted by %user on %date", array("%user" => $u, "%date" => $k));
 }
예제 #6
0
파일: theme.php 프로젝트: decima/M2-platine
 public static function header_menu($args)
 {
     $out = '<ul class="nav navbar-nav">';
     foreach ($args as $menu) {
         if (isset($menu['submenu'])) {
             $out .= "<li class='dropdown'>";
             $out .= "<a href=\"" . page::url($menu['url']) . "\" \n                    class=\"dropdown-toggle\" \n                    data-toggle=\"dropdown\">";
             $out .= $menu['name'];
             $out .= '<b class="caret caret-inverse"></b></a>
                 <ul class="dropdown-menu">';
             foreach ($menu['submenu'] as $submenu) {
                 $out .= "<li>" . page::link($submenu['url'], $submenu['name']) . "</li>";
             }
             $out .= "</ul></li>";
         } else {
             $out .= "<li>" . page::link($menu['url'], $menu['name']) . "</li>";
         }
     }
     $out .= "</ul>";
     return $out;
 }
예제 #7
0
파일: theme.php 프로젝트: decima/M2-platine
 public static function theme_list()
 {
     page::title("Themes");
     $array = array();
     $header = array("theme", "path", "action");
     $themes = theme::list_of_declared_themes();
     foreach ($themes as $theme) {
         $res = "";
         if ($theme->theme_enabled && !$theme->theme_default) {
             $res = page::link("admin/themes/" . $theme->theme_name . "/setdefault", "Set default");
             $res .= " / ";
             $res .= page::link("admin/themes/" . $theme->theme_name . "/disable", "disable");
         }
         if ($theme->theme_enabled && $theme->theme_default) {
             $res = "<big>default theme</big>";
         }
         if (!$theme->theme_enabled) {
             $res = page::link("admin/themes/" . $theme->theme_name . "/enable", "enable");
         }
         $array[] = array($theme->theme_name, "<small>" . $theme->theme_path . "</small>", $res);
     }
     $str = '  <a href="' . page::url("admin/themes/scan") . '">Scan for more Themes</a><br/>';
     $str .= theme::t_table($array, $header);
     return $str;
 }
예제 #8
0
 public static function page_list_modules()
 {
     page::title("Modules");
     $res = array();
     $head = array("module", "action");
     $modules = module_manager::list_of_declared_modules();
     foreach ($modules as $module) {
         $b = array();
         $b[0] = $module->module_name;
         $b[1] = "";
         if ($module->module_installed && !$module->module_enabled) {
             $b[1] .= page::link("admin/modules/" . $module->module_name . "/enable", "Enable");
             $b[1] .= " / ";
             $b[1] .= page::link("admin/modules/" . $module->module_name . "/uninstall", "Uninstall");
         }
         if ($module->module_installed && $module->module_enabled) {
             $b[1] .= page::link("admin/modules/" . $module->module_name . "/disable", "disable");
         }
         if (!$module->module_installed) {
             $b[1] .= page::link("admin/modules/" . $module->module_name . "/install", "install");
         }
         $res[] = $b;
     }
     $str = '  <a href="' . page::url("admin/modules/scan") . '">Scan for more modules</a><br/>';
     $str .= theme::t_table($res, $head);
     return $str;
 }