예제 #1
0
 public static function list_of_members($label)
 {
     $group = new GroupObject();
     $view = array();
     if ($group->load_by_label($label)) {
         $group->load_members();
         $members = $group->members();
         $rows = array();
         $theme = new Theme();
         foreach ($members as $k => $v) {
             $rows[] = array($k, $v->firstname, $v->lastname, $theme->linking(Page::url("/admin/groups/{$label}/delete/{$k}"), t("retirer du groupe")));
         }
         $form = new Form("POST", Page::url("/admin/groups/{$label}/add"));
         $selector = new FormElement("select", "userid", t("selectionnez un utilisateur"));
         $users = UserObject::loadAll();
         foreach ($users as $u) {
             $selector->addElement(new FormElement("option", "", $u->lastname . " " . $u->firstname, $u->uid));
         }
         $form->addElement($selector);
         $form->addElement(new InputElement("add-element", null, t("ajouter un membre"), "submit"));
         $f = $theme->forming($form);
         $theme->set_title(t("Groupe %s", array("%s" => $label)));
         $theme->add_to_body($theme->linking(Page::url("/admin/groups"), t("retourner à la liste des groupes")));
         $theme->add_to_body($f, t("Ajouter un membre au groupe"));
         $theme->add_to_body($theme->tabling($rows, array(t("id"), t("firstname"), t("lastname"), t("actions"))), t("Liste des membres"));
         $theme->process_theme(Theme::STRUCT_ADMIN);
     } else {
     }
     return;
 }