public static function add_to_menu($element) { $m =& parent::get_menu(); if (sizeof($m) > 0) { $m[] = "<div class=\"page_lateral_widget_sep\"></div>"; } $m[] = "<div class=\"page_lateral_widget\">" . $element . "</div>"; }
public function page_permissions() { if (isset($_POST['save-permissions'])) { PermissionObject::removeAllPermissions(); if (isset($_POST['permission'])) { foreach ($_POST['permission'] as $perm => $groups) { foreach ($groups as $grp => $d) { PermissionObject::addPermission($grp, $perm); } } } Notification::statusNotify(t("configuration enregistrée"), Notification::STATUS_SUCCESS); } $defined_permissions = PermissionObject::loadAllPermissions(); $df = array(); foreach ($defined_permissions as $p) { if (!isset($df[$p->pid])) { $df[$p->pid] = array(); } $df[$p->pid][$p->gid] = 1; } $p = new PermissionsManager(); $permissions = $p->scanForPermission(); $groups = GroupObject::loadAll(); $table = array(); $hcol = array(""); $hrow = array(); foreach ($permissions as $u => $t) { $hrow[] = $t; $row = array(); foreach ($groups as $gd => $g) { if ($u == 0) { $hcol[] = $g->label; } $pm = new PermissionObject(); $pm->loadByName($t); $tlabel = "permission[" . $g->gid . "][" . $pm->pid . "]"; if (isset($df[$pm->pid][$g->gid])) { $row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' checked='checked'/>"; } else { $row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' />"; } } $table[] = $row; } $theme = new Theme(); $theme->set_title(t("Permissions déclarées")); $table = Themed::tabling($table, $hcol, $hrow); $theme->add_to_body("<form method='POST' action=''>{$table} <input type='submit' name='save-permissions' value='" . t("Enregistrer") . "'/></form>"); $theme->process_theme(Theme::STRUCT_ADMIN); }
<div id="page_lateral_profil"> <div id="page_lateral_profil_contenu"> <?php method_invoke("Widget", "runWidgets", array(0, function ($w) { Theme::add_to_menu($w); })); ?> <?php Themed::menu(); ?> <div class="clear"></div> </div> <div class="clear"></div> </div>
public static function set_title($title) { self::$title = $title; }