Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
user_table.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: user_table.php,v 1.9 2005/07/08 15:29:51 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage USERS
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: user_table.php,v 1.9 2005/07/08 15:29:51 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/core/Action/Users/user_table.php,v $
21 // ---------------------------------------------------------------
22 include_once ("Class.TableLayout.php");
23 include_once ("Class.QueryDb.php");
24 include_once ("Class.SubForm.php");
25 include_once ("Class.MailAccount.php");
26 include_once ("Class.Domain.php");
27 include_once ("Class.SubForm.php");
28 include_once ("Class.QueryGen.php");
29 // -----------------------------------
30 function user_table(&$action, $group = false)
31 {
32  // -----------------------------------
33  // Set the globals elements
34  $baseurl = $action->GetParam("CORE_BASEURL");
35  $standurl = $action->GetParam("CORE_STANDURL");
36 
37  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/subwindow.js");
38  // Set the search elements
39  $query = new QueryGen($action->GetParam("CORE_DB") , "User", $action);
40  $query->slice = 20;
41  $action->lay->set("slice9", $query->slice + 9);
42  if ($group) {
43  $query->AddQuery("isgroup = 'Y'");
44  $action->lay->set("title", $action->text("titlegroup"));
45  $action->lay->set("createuser", $action->text("titlecreateg"));
46  $action->lay->set("duser", "none");
47  $action->lay->set("yngroup", "Y");
48  } else {
49  $query->AddQuery("(isgroup != 'Y') OR (isgroup isnull)");
50  $action->lay->set("title", $action->text("titleuser"));
51  $action->lay->set("createuser", $action->text("titlecreateu"));
52  $action->lay->set("duser", "");
53  $action->lay->set("yngroup", "N");
54  }
55 
56  $action->lay->set("fhelp", ($action->Read("navigator", "") == "EXPLORER") ? "_blank" : "fhidden");
57  // The content depends on Access Permission
58  if (!isset($action->user)) {
59  $action->log->info("Attempt to use {$action->parent->name}/{$action->name} without permission");
60  Redirect($action, "CORE", "");
61  }
62  if (!$action->HasPermission("ADMIN")) {
63  if ($action->HasPermission("DOMAIN_MASTER")) {
64  $query->AddQuery("iddomain={$action->user->iddomain}");
65  } elseif ($action->HasPermission("USER")) {
66  $query->AddQuery("id={$action->user->id}");
67  }
68  }
69  // Give some global elements for the table layout
70  $query->table->fields = array(
71  "domain",
72  "id",
73  "edit",
74  "lastname",
75  "delete",
76  "fullname",
77  "login",
78  "group",
79  "expires"
80  );
81 
82  $query->table->headsortfields = array(
83  "head_lastname" => "lastname",
84  "head_login" => "login",
85  "head_expires" => "expires"
86  );
87  if ($group) {
88  $query->table->headcontent = array(
89  "head_lastname" => $action->text("groupdesc") ,
90  "head_domain" => $action->text("domain") ,
91  "head_login" => $action->text("group")
92  );
93  } else {
94  $query->table->headcontent = array(
95  "head_lastname" => $action->text("fullname") ,
96  "head_domain" => $action->text("domain") ,
97  "head_login" => $action->text("login") ,
98  "head_expires" => $action->text("expires")
99  );
100  }
101  // Perform the query
102  $query->Query();
103  // Affect the modif icons and the fullname field
104  // $jsscript=$form->GetLinkJsMainCall();
105  reset($query->table->array);
106  while (list($k, $v) = each($query->table->array)) {
107  $query->table->array[$k]["group"] = $isgroup;
108 
109  if (!$group) {
110  $query->table->array[$k]["fullname"] = ucfirst((isset($query->table->array[$k]["firstname"]) ? $query->table->array[$k]["firstname"] : "(?)")) . " " . ucfirst((isset($query->table->array[$k]["lastname"]) ? $query->table->array[$k]["lastname"] : "(?)"));
111 
112  $query->table->array[$k]["expires"] = intval($v["expires"]) == 0 ? "" : strftime("%d/%m/%Y %X", intval($v["expires"]));
113  } else {
114  $query->table->array[$k]["fullname"] = ucfirst(isset($query->table->array[$k]["lastname"]) ? $query->table->array[$k]["lastname"] : "(?)");
115  }
116  // $query->table->array[$k]["edit"] = str_replace("[id]",$v["id"],$jsscript);
117  if (($query->table->array[$k]["id"] != 1) && ($query->table->array[$k]["lastname"] != "Postmaster") && ($query->table->array[$k]["login"] != "all") && ($action->HasPermission("DOMAIN_MASTER"))) {
118  $query->table->array[$k]["delete"] = $action->GetIcon("delete.gif", "delete");
119  }
120  if ($v["iddomain"] == 1) {
121  $query->table->array[$k]["domain"] = $action->text("nomail");
122  } else {
123  $dom = new Domain($action->GetParam("CORE_DB") , $v["iddomain"]);
124  $query->table->array[$k]["domain"] = $dom->name;
125  }
126  }
127  // Out
128  $action->lay->Set("TABLE", $query->table->Set());
129 }
130 ?>
← centre documentaire © anakeen - published under CC License - Dynacase