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; }
public function widget_menu_system() { $theme = new Theme(); $list = array(); $list[] = Theme::linking(Page::url("/admin/modules/"), t("<i class=\"fa fa-puzzle-piece fa-fw\"></i> Modules")); $list[] = Theme::linking(Page::url("/admin/database/"), t("<i class=\"fa fa-database fa-fw\"></i> Base de données")); return t("<div class=\"widget_titre\"><i class=\"fa fa-wrench fa-fw\"></i> Système</div>") . $theme->listing($list); }
public static function docWidget2() { $t1 = t("<div class='widget_titre'><i class=\"fa fa-cubes\"></i> Modules</div>"); $theme = new Theme(); $list = array(); $list[] = Theme::linking(Page::url("/doc/modules/create"), t("<i class=\"fa fa-cube fa-fw\"></i> Créer un module")); $list[] = Theme::linking(Page::url("/doc/modules/declared-hooks"), t("<i class=\"fa fa-anchor fa-fw\"></i> Hooks de référence")); return $t1 . Theme::listing($list); }
public static function page_config() { if (isset($_GET['err'])) { switch ($_GET['err']) { case 'install': Notification::statusNotify(t("Echec de l'installation du widget"), Notification::STATUS_ERROR); break; case 'enable': Notification::statusNotify(t("Echec de l'activation du widget"), Notification::STATUS_ERROR); break; case 'disable': Notification::statusNotify(t("Echec de la desactivation du widget"), Notification::STATUS_ERROR); break; case 'uninstall': Notification::statusNotify(t("Echec de la désinstation du widget"), Notification::STATUS_ERROR); break; case 'up': case 'down': Notification::statusNotify(t("Echec du changement de priorité du widget"), Notification::STATUS_ERROR); break; default: Notification::statusNotify(t("Une erreur inconnue est survenue"), Notification::STATUS_ERROR); break; } } $widget = new Widget(); $widget->scanForWidget(); $widgets = WidgetObject::loadAll(true); $unistalled_widgets = WidgetObject::loadAll(false); $activates = WidgetObject::loadAllActivate(); $theme = new Theme(); $theme->set_title(t("Liste des widgets disponibles")); $c = count($widgets); $a = count($activates); $u = count($unistalled_widgets); $notification = ""; $notification .= $c + $u > 1 ? "%cnt widgets disponibles" : ($c + $u == 1 ? "%cnt widget disponible" : "Aucun widget disponible"); if ($c > 0) { $notification .= $a > 1 ? " · %ant widgets activés" : ($a == 1 ? " · %ant widget activé" : ""); $notification .= $c > 1 ? " · %int widgets installés" : ($c == 1 ? " · %int widget installé" : ""); $notification .= $u > 1 ? " · %unt widgets désinstallés" : ($u == 1 ? " · %unt widget désinstallé" : ""); } Notification::statusNotify(t("{$notification}", array("%cnt" => $c + $u, "%ant" => $a, "%int" => $c, "%unt" => $u)), Notification::STATUS_INFO); $r = array(t("Nom du widget"), t("Etat du widget"), t("Actions")); $array = array(); foreach ($widgets as $k => $w) { $uninstall = $theme->linking(Page::url("/admin/view/widget/uninstall/" . $w->widget_name), t("désinstaller")); $disable = $theme->linking(Page::url("/admin/view/widget/disable/" . $w->widget_name), t("désactiver")); $enable = $theme->linking(Page::url("/admin/view/widget/enable/" . $w->widget_name), t("activer")); $up = $theme->linking(Page::url("/admin/view/widget/up/" . $w->widget_name), "<i class='fa fa-arrow-up fa-fw'></i>", false, array("title" => "Monter")); $up_disabled = "<span class='link_disabled' title='Monter'><i class='fa fa-arrow-up fa-fw'></i></span>"; $down = $theme->linking(Page::url("/admin/view/widget/down/" . $w->widget_name), "<i class='fa fa-arrow-down fa-fw'></i>", false, array("title" => "Descendre")); $down_disabled = "<span class='link_disabled' title='Descendre'><i class='fa fa-arrow-down fa-fw'></i></span>"; // Si le widget est activé if ($w->activate) { $array[] = array($w->widget_name, t("Activé"), $disable, $k == 0 ? $up_disabled : $up, $k == $a - 1 ? $down_disabled : $down); } else { $array[] = array($w->widget_name, t("Désactivé"), $enable . " - " . $uninstall, $up_disabled, $down_disabled); } } foreach ($unistalled_widgets as $k => $w) { $install = $theme->linking(Page::url("/admin/view/widget/install/" . $w->widget_name), t("installer")); $up_disabled = "<span class='link_disabled' title='Monter'><i class='fa fa-arrow-up fa-fw'></i></span>"; $down_disabled = "<span class='link_disabled' title='Descendre'><i class='fa fa-arrow-down fa-fw'></i></span>"; $array[] = array($w->widget_name, t("Désinstallé"), $install, $up_disabled, $down_disabled); } $theme->add_to_body($theme->tabling($array, $r)); $theme->process_theme(Theme::STRUCT_ADMIN); return; }
public static function page_profile($id_user = null) { $theme = new Theme(); $isMyProfil = false; if ($id_user == null) { $id_user = self::get_user_logged_id(); $isMyProfil = true; } $u = new UserObject(); $u->load($id_user); $url_avatar = $u->get_avatar(); $output = ""; $output .= "<div id=\"profil_top\">"; $output .= "<div id=\"profil_top_avatar\" class=\"avatar\" style=\"background-image:url({$url_avatar});\">"; if ($isMyProfil) { $output .= Theme::linking(Page::url("/profile/settings/avatar"), "<span id=\"profil_top_avatar_changeBG\"></span><span id=\"profil_top_avatar_changeTxt\">" . t("Modifier") . "</span>"); } $output .= "</div>"; $output .= "<div id=\"profil_top_avatar_nom\">"; if ($isMyProfil) { $output .= "<i class=\"fa fa-user fa-fw\" title=\"Mon profil\"></i>"; } $output .= $u->firstname . " " . $u->lastname; $output .= "</div>"; $output .= "</div>"; $output .= "<div class=\"page_contenu_sep\"></div>"; $output .= "<div id=\"profil_buttons\">"; $result = method_invoke_all("hook_profile_view", array($id_user)); foreach ($result as $r) { $output .= $r; } $output .= "<div class=\"clear\"></div>"; $output .= "</div>"; $theme->add_to_body($output); $theme->process_theme(Theme::STRUCT_DEFAULT); }
public static function list_modules() { if (isset($_GET['err'])) { switch ($_GET['err']) { case 'install': Notification::statusNotify(t("Echec de l'installation du module"), Notification::STATUS_ERROR); break; case 'enable': Notification::statusNotify(t("Echec de l'activation du module"), Notification::STATUS_ERROR); break; case 'disable': Notification::statusNotify(t("Echec de la desactivation du module"), Notification::STATUS_ERROR); break; case 'uninstall': Notification::statusNotify(t("Echec de la désinstation du module"), Notification::STATUS_ERROR); break; default: Notification::statusNotify(t("Une erreur inconnue est survenue"), Notification::STATUS_ERROR); break; } } $modules = self::scan_all_modules(); $theme = new Theme(); $theme->set_title(t("Liste des modules disponibles")); Notification::statusNotify(t("%cnt modules disponibles", array("%cnt" => count($modules))), Notification::STATUS_INFO); $r = array(t("Nom du module"), t("Dépendances"), t("Etat du module"), t("Actions")); $array = array(); foreach ($modules as $m) { $install = $theme->linking(Page::url("/admin/modules/install/" . $m['name']), t("installer")); $uninstall = $theme->linking(Page::url("/admin/modules/uninstall/" . $m['name']), t("désinstaller")); $disable = $theme->linking(Page::url("/admin/modules/disable/" . $m['name']), t("désactiver")); $enable = $theme->linking(Page::url("/admin/modules/enable/" . $m['name']), t("activer")); $statement = t("activé"); $link_1 = $disable; $link_2 = null; if (!self::is_enabled($m['name'])) { $statement = t("installé"); $link_1 = $enable; $link_2 = $uninstall; } if (!self::is_installed($m['name'])) { $link_1 = $install; $link_2 = null; $statement = t("désinstallé"); } if ($m["system_module"] == 1) { $rtm = ""; //t("système"); $statement = t("système"); } else { $rtm = $link_1 . ($link_2 == null ? "" : " - ") . $link_2; } $dependencies = ""; if (isset($m['dependencies'])) { $dependencies = implode(", ", $m['dependencies']); } $array[] = array($m["readablename"], $dependencies, $statement, $rtm); } usort($array, function ($a, $b) { return strcmp($a[2], $b[2]) * 10 + strcmp($a[0], $b[0]); }); $theme->add_to_body($theme->tabling($array, $r)); $theme->process_theme(Theme::STRUCT_ADMIN); return; }
public static function hook_profile_view($id_user) { $u = User::get_user_logged_id(); $button = ""; $atr = array(); $atr["class"] = "btn"; $demande_envoyee = FriendshipObject::loadAllPendingRequests($u, $id_user); $demande_attente = FriendshipObject::loadAllPendingRequests($id_user, $u); // Si on est sur le profil de quelqu'un if ($u != $id_user) { if (FriendshipObject::isFriend($u, $id_user)) { $button = Theme::linking(Page::url("/friends/remove/{$id_user}"), t("<i class=\"fa fa-user-times fa-fw\"></i> Retirer"), false, $atr); } else { if (sizeof($demande_envoyee) > 0) { $button = Theme::linking(Page::url(""), t("<i class=\"fa fa-external-link-square fa-fw\"></i> Demande envoyée"), false, $atr); } else { if (sizeof($demande_attente) > 0) { $button = Theme::linking(Page::url("/friends/decline/{$id_user}"), t("<i class=\"fa fa-times fa-fw\"></i> Annuler"), false, $atr); $button .= " " . Theme::linking(Page::url("/friends/accept/{$id_user}"), t("<i class=\"fa fa-check fa-fw\"></i> Accepter"), false, $atr); } else { $button = Theme::linking(Page::url("/friends/request/{$id_user}"), t("<i class=\"fa fa-user-plus fa-fw\"></i> Ajouter"), false, $atr); } } } $button .= Theme::linking(Page::url("/messages/{$id_user}"), t("<i class=\"fa fa-envelope fa-fw\"></i> Messagerie"), false, $atr); } else { $button .= Theme::linking(Page::url("/messages"), t("<i class=\"fa fa-envelope fa-fw\"></i> Messagerie"), false, $atr); } return $button; }