Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
param_list.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  * Display parameters
9  *
10  * @author Anakeen 2000
11  * @version $Id: param_list.php,v 1.10 2005/06/16 12:23:07 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage APPMNG
15  */
16 /**
17  */
18 
19 include_once ("Class.TableLayout.php");
20 include_once ("Class.QueryDb.php");
21 include_once ("Class.Param.php");
22 include_once ("Class.SubForm.php");
23 // -----------------------------------
24 function param_list(&$action)
25 {
26  // -----------------------------------
27  // Get Param
28  $userid = GetHttpVars("userid");
29  $styleid = GetHttpVars("styleid");
30  $pview = GetHttpVars("pview"); // set to "all" or "single" if user parameters
31  // Set the globals elements
32  $baseurl = $action->GetParam("CORE_BASEURL");
33  $standurl = $action->GetParam("CORE_STANDURL");
34 
35  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/subwindow.js");
36  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/AnchorPosition.js");
37  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/PopupWindow.js");
38  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/ColorPicker2.js");
39  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/OptionPicker.js");
40 
41  $tincparam = array();
42  $appinc = array();
43 
44  switch ($pview) {
45  case "allapp":
46  $tparam = $action->parent->param->GetApps();
47  break;
48 
49  case "alluser":
50  if ($userid == "") $tparam = array();
51  else $tparam = $action->parent->param->GetUser($userid);
52  uasort($tparam, "cmpappid");
53  break;
54 
55  case "singleuser":
56  if ($userid == "") $tparam = array();
57  else $tparam = $action->parent->param->GetUser($userid, $action->getParam("STYLE"));
58  uasort($tparam, "cmpappid");
59  break;
60 
61  case "allstyle":
62  if ($styleid == "") $tparam = array();
63  else $tparam = $action->parent->param->GetStyle($styleid);
64  break;
65  }
66 
67  $vsection = "appid";
68 
69  $precApp = 0;
70  $tincparam = array();
71  $applist = "";
72  foreach ($tparam as $k => $v) {
73  if (isset($v[$vsection])) {
74  if ($v[$vsection] != $precApp) {
75 
76  $action->lay->SetBlockData("PARAM$precApp", $tincparam);
77  $tincparam = array();
78  $precApp = $v[$vsection];
79 
80  $app1 = new Application($action->dbaccess, $precApp);
81 
82  $appinc[$precApp]["appname"] = $app1->name;
83  $appinc[$precApp]["appicon"] = $action->getImageUrl($app1->icon);
84  $applist.= ($applist == "" ? "" : ",");
85  $applist.= "'" . $app1->name . "'";
86  $appinc[$precApp]["appdesc"] = $action->text($app1->short_name);
87  $appinc[$precApp]["PARAM"] = "PARAM$precApp";
88  }
89  $tincparam[$k] = $v;
90  // to show difference between global, user and application parameters
91  if ($v["type"][0] == PARAM_APP) $tincparam[$k]["classtype"] = "aparam";
92  else if ($v["type"][0] == PARAM_USER) $tincparam[$k]["classtype"] = "uparam";
93  else if ($v["type"][0] == PARAM_STYLE) $tincparam[$k]["classtype"] = "sparam";
94  else $tincparam[$k]["classtype"] = "gparam";
95  if ($v["kind"] == "password") {
96  if ($v["val"] != "") $v["val"] = "*****";
97  $tincparam[$k]["val"] = $v["val"];
98  }
99  $tincparam[$k]["sval"] = str_replace(array(
100  '"'
101  ) , array(
102  "&quot;"
103  ) , $v["val"]);
104 
105  $tincparam[$k]["colorstatic"] = ($v["kind"] == "static" || $v["kind"] == "readonly") ? "#666666" : "";
106  // force type user if user mode
107  if ($userid > 0) $tincparam[$k]["type"] = PARAM_USER . $userid;
108  else if ($styleid != "") $tincparam[$k]["type"] = PARAM_STYLE . $styleid;
109 
110  if ($tincparam[$k]["descr"] == "") $tincparam[$k]["descr"] = $tincparam[$k]["name"];
111  else $tincparam[$k]["descr"] = _($tincparam[$k]["descr"]);
112  $tincparam[$k]["tooltip"] = $tincparam[$k]["name"] . " : " . $tincparam[$k]["descr"];
113  }
114  }
115 
116  $action->lay->SetBlockData("PARAM$precApp", $tincparam);
117  if ($pview == "singleuser") { // chg action because of acl USER/ADMIN
118  $action->lay->Set("ACTIONDEL", "PARAM_UDELETE");
119  $action->lay->Set("ACTIONMOD", "PARAM_UMOD");
120  } else {
121  $action->lay->Set("ACTIONDEL", "PARAM_DELETE");
122  $action->lay->Set("ACTIONMOD", "PARAM_MOD");
123  }
124 
125  uasort($appinc, "cmpappname");
126  $action->lay->set("AppList", $applist);
127  $action->lay->SetBlockData("APPLI", $appinc);
128  }
129  function cmpappid($a, $b)
130  {
131  if ($a["appid"] == $b["appid"]) return 0;
132  if ($a["appid"] > $b["appid"]) return 1;
133  return -1;
134  }
135 
136  function cmpappname($a, $b)
137  {
138  if ($a["appname"] == $b["appname"]) return 0;
139  if ($a["appname"] > $b["appname"]) return 1;
140  return -1;
141  }
142 ?>
← centre documentaire © anakeen - published under CC License - Dynacase