module config et role webmaster
[mtweb] / mw / app / out / default / views / admin / users / index.php
diff --git a/mw/app/out/default/views/admin/users/index.php b/mw/app/out/default/views/admin/users/index.php
new file mode 100644 (file)
index 0000000..d7ceb35
--- /dev/null
@@ -0,0 +1,85 @@
+<h2>Les utilisateurs</h2>
+
+<ul class="buttons">
+  <li><a class="add" href="<?php echo $this->url("admin/users/add"); ?>">Nouvel utilisateur</a></li>
+</ul>
+
+<?php
+
+  $users_params = array();
+  if(isset($_GET[$this->param("role")])) $users_params["role"] = $_GET[$this->param("role")];
+
+?>
+<ul class="filters">
+  <li>Afficher les utilisateurs pour</li>  
+  <li>
+    <select onchange="document.location=this.options[this.selectedIndex].value;">
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("alpha")] ? "" : " selected=\"selected\""; ?>>Tous les logins</option>
+      <?php for($i = 65; $i <= 90; $i++) : $users_params["alpha"] = chr($i); ?>
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("alpha")] == chr($i) ? " selected=\"selected\"" : ""; ?>><?php echo chr($i); ?></option>
+      <?php endfor; ?>
+    </select>
+  </li>
+  <?php
+
+    if($this->out["roles"]) :
+      if(isset($_GET[$this->param("alpha")])) $users_params["alpha"] = $_GET[$this->param("alpha")];
+      else unset($users_params["alpha"]);
+      unset($users_params["role"]);
+
+?>
+  <li>
+    <select onchange="document.location=this.options[this.selectedIndex].value;">
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("role")] ? "" : " selected=\"selected\""; ?>>Tous les roles</option>
+      <?php foreach($this->out["roles"] as $role) : if($role["id"]) : $users_params["role"] = $role["id"]; ?>
+      <option value="<?php echo $this->url("admin/users", $users_params); ?>"<?php echo $_GET[$this->param("role")] == $role["id"] ? " selected=\"selected\"" : ""; ?>><?php echo $role["intitule"]; ?></option>
+      <?php endif; endforeach; ?>
+    </select>
+  </li>
+  <?php endif; ?>
+</ul>
+
+<?php $items = "users"; $legend = "utilisateurs"; require $this->out_file("views/navig.php"); ?>
+
+<?php if($this->out["users"]["list"]) : ?>
+
+<table class="admin">
+  <tr>
+    <th>login</th>
+    <th>email</th>
+    <th>r&ocirc;le</th>
+    <th align="center" colspan="2">actions</th>
+  </tr>
+  <?php foreach($this->out["users"]["list"] as $id_user => $user) : ?>
+  <tr class="hl">
+    <td><?php echo $user["login"]; ?></td>
+    <td><a href="mailto:<?php echo $user["email"]; ?>"><?php echo $user["email"]; ?></a></td>
+    <td>
+    <?php
+
+      $role = "";
+      foreach($user["roles"] as $id_role) $role .= ($role ? ", " : "").$this->out["roles"][$id_role]["intitule"];
+
+    ?>
+    <?php echo $role; ?>
+    </td>
+    <td class="action">
+    <a href="<?php echo $this->url("admin/users/edit", array("id" => $user["login"])); ?>"
+       class="admin_link"
+       title="modifier cet utilisateur"><img src="<?php echo $this->out_url("icons/edit.gif"); ?>" /></a>
+    </td>
+    <td class="action">
+    <a href="<?php echo $this->url("admin/users/del", array("id" => $user["login"])); ?>"
+       class="admin_link"
+       title="supprimer cet utilisateur"
+       onclick="return confirm('Supprimer cet utilisateur ?')"><img src="<?php echo $this->out_url("icons/del.gif"); ?>"/></a>
+    </td>
+  </tr>
+  <?php endforeach; ?>
+</table>
+
+<?php else : ?>
+
+<p>Aucun utilisateur pour le moment...</p>
+
+<?php endif; ?>