Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
welcome.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 function welcome(&$action)
9 {
10 
11  $action->parent->AddCssRef("CORE:welcome.css", true);
12  $action->lay->set("thisyear", strftime("%Y", time()));
13  $action->lay->set("version", $action->GetParam("VERSION"));
14  $action->lay->set("userRealName", $action->user->firstname . " " . $action->user->lastname);
15  $action->lay->set("userDomain", getParam("CORE_CLIENT"));
16  // 3rd parties developpement
17  $fext = $action->getLayoutFile("externals-dev.xml");
18  $action->lay->set("HAVE_EXTERNALS", false);
19  $trd = array();
20  if (file_exists($fext)) {
21  $fdata = file($fext);
22  foreach ($fdata as $k => $v) {
23  $action->lay->set("HAVE_EXTERNALS", true);
24  $ds = explode("#", $v);
25  $trd[] = array(
26  "site" => $ds[0],
27  "name" => $ds[1],
28  "license" => $ds[2]
29  );
30  }
31  }
32  $action->lay->setBlockData("EXTERNALS", $trd);
33  // retrieve installed applications
34  $query = new QueryDb($action->dbaccess, "Application");
35  $query->basic_elem->sup_where = array(
36  "available='Y'",
37  "displayable='Y'",
38  "tag!='CORE' or tag is null"
39  );
40  $list = $query->Query(0, 0, "TABLE");
41  $ap = 0;
42  $tab = array();
43  if ($query->nb > 0) {
44  $i = 0;
45  $j = 0;
46  $lapps = array();
47  foreach ($list as $k => $appli) {
48  if ($appli["access_free"] == "N") {
49  $action->log->debug("Access not free for :" . $appli["name"]);
50  if (isset($action->user)) {
51  if ($action->user->id != 1) { // no control for user Admin
52  // search acl for root action
53  $queryact = new QueryDb($action->dbaccess, "Action");
54  $queryact->AddQuery("id_application=" . $appli["id"]);
55  $queryact->AddQuery("root='Y'");
56  $listact = $queryact->Query(0, 0, "TABLE");
57  $root_acl_name = $listact[0]["acl"];
58  if (!$action->HasPermission($root_acl_name, $appli["id"])) continue;
59  }
60  }
61  } else {
62  continue;
63  }
64  $lapps[$ap]["name"] = $appli["name"];
65  $lapps[$ap]["desc"] = $action->text($appli["description"]); // translate
66  $lapps[$ap]["sname"] = $action->text($appli["short_name"]); // translate
67  $lapps[$ap]["icon"] = $action->GetImageUrl($appli["icon"]);
68  if ($lapps[$ap]["icon"] == "CORE/Images/noimage.png") $lapps[$ap]["icon"] = $appli["name"] . "/Images/" . $appli["icon"];
69  $ap++;
70  }
71  }
72  $action->lay->set("appsdev", count($lapps) > 0);
73  $action->lay->setBlockData("apps", $lapps);
74 }
75 ?>
← centre documentaire © anakeen - published under CC License - Dynacase