Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
head.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: head.php,v 1.24 2007/06/29 08:55:44 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage CORE
15  */
16 /**
17  */
18 
19 include_once ('Class.QueryDb.php');
20 include_once ('Class.Application.php');
21 
22 function head(&$action)
23 {
24  // This function is used to show all available applications
25  // in the main header
26  $query = new QueryDb($action->dbaccess, "Application");
27  $query->basic_elem->sup_where = array(
28  "available='Y'",
29  "displayable='Y'"
30  );
31  $list = $query->Query(0, 0, "TABLE");
32 
33  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/subwindow.js");
34  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/resizeimg.js");
35  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/AnchorPosition.js");
36 
37  $iz = $action->getParam("CORE_ICONSIZE");
38  if ($iz == "small") {
39  $izpx = 22;
40  $action->lay->set("wtitle", 180);
41  } else {
42  $izpx = 38;
43  $action->lay->set("wtitle", 150);
44  }
45  $action->lay->set("izpx", $izpx);
46  $action->lay->set("izbpx", $izpx + 10);
47  // remove applications that need access perm
48  $tab = array();
49  if ($query->nb > 0) {
50  $i = 0;
51  foreach ($list as $k => $appli) {
52  // if (! $action->AppInstalled($appli["name"])) continue;
53  if ($appli["access_free"] == "N") {
54  $action->log->debug("Access not free for :" . $appli["name"]);
55  if (isset($action->user)) {
56  if ($action->user->id != 1) { // no control for user Admin
57  //if ($p->id_acl == "") continue;
58  // test if acl of root action is granted
59  // search acl for root action
60  $queryact = new QueryDb($action->dbaccess, "Action");
61  $queryact->AddQuery("id_application=" . $appli["id"]);
62  $queryact->AddQuery("root='Y'");
63  $listact = $queryact->Query(0, 0, "TABLE");
64  $root_acl_name = $listact[0]["acl"];
65  if (!$action->HasPermission($root_acl_name, $appli["id"])) continue;
66  }
67  } else {
68  continue;
69  }
70  }
71  $appli["description"] = $action->text($appli["description"]); // translate
72  $appli["descriptionsla"] = addslashes($appli["description"]); // because its in between '' in layout
73  if ($appli["machine"] != "") $appli["pubdir"] = "http://" . $appli["machine"] . "/what";
74  else $appli["pubdir"] = $action->getParam("CORE_PUBURL");
75 
76  $appli["iconsrc"] = $action->GetImageUrl($appli["icon"]);
77  if ($appli["iconsrc"] == "CORE/Images/noimage.png") $appli["iconsrc"] = $appli["name"] . "/Images/" . $appli["icon"];
78 
79  $tab[$i++] = $appli;
80  }
81  }
82 
83  $action->lay->set("DATE", strftime("%a %d %B %Y %H:%M", time()));
84  // $action->lay->SetBlockCorresp("FUNCTION","NAME","name");
85  //$action->lay->SetBlockCorresp("FUNCTION","IMAGE","icon");
86  //$action->lay->SetBlockCorresp("FUNCTION","DESCR","description");
87  $action->lay->SetBlockData("FUNCTION", $tab);
88  // update application name
89  global $_GET;
90  $app = new Application();
91 
92  if (isset($_GET["capp"])) $app->Set($_GET["capp"], $action->parent);
93  else $app->Set($_GET["app"], $action->parent);
94 
95  $action->lay->set("APP_TITLE", _($app->description));
96  $action->lay->set("SESSION", $action->session->id);
97 
98  $action->lay->set("sid", session_id());
99 
100  $jslauch = $action->GetLayoutFile("lauch_action.js");
101  $lay = new Layout($jslauch, $action);
102  $action->parent->AddJsCode($lay->gen());
103 
104  if ($action->parent->exists("FREEGATE") && ($action->getParam("GATE_USEOLD") != "yes")) {
105  $action->lay->setblockdata("FREEGATE", array(
106  array(
107  "zou"
108  )
109  ));
110  } else {
111  $action->lay->setblockdata("NOFREEGATE", array(
112  array(
113  "zou"
114  )
115  ));
116  }
117  // update username
119 }
120 
121 function userlogin(&$action)
122 {
123  // This function is used to show curent user if set
124  // TODO
125  if ((!isset($action->user)) || ($action->user->id == 0) || ($action->user->id == ANONYMOUS_ID)) {
126  $action->lay->set("USER", "");
127  $action->lay->set("ONOUT", $action->parent->GetImageUrl("bblue.gif"));
128  $action->lay->set("ONOVER", $action->parent->GetImageUrl("bgreen.gif"));
129  $action->lay->set("ALTLOGINOUT", "login");
130  $action->lay->set("ACTION", "");
131  $action->lay->set("anim", "true");
132  } else {
133  $action->lay->set("USER", $action->user->firstname . " " . $action->user->lastname);
134  $action->lay->set("ONOUT", $action->parent->GetImageUrl("bgreen.gif"));
135  $action->lay->set("ONOVER", $action->parent->GetImageUrl("bred.gif"));
136  $action->lay->set("ALTLOGINOUT", "logout");
137  $action->lay->set("ACTION", "LOGOUT");
138  $action->lay->set("OUT", "");
139  $action->lay->set("anim", "false");
140  }
141 }
142 ?>
← centre documentaire © anakeen - published under CC License - Dynacase