Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
generic_editcatg.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  * Edit enum attribute items
9  *
10  * @author Anakeen 2000
11  * @version $Id: generic_editcatg.php,v 1.9 2008/08/14 09:59:14 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 include_once ("FDL/Class.Dir.php");
20 include_once ("GENERIC/generic_util.php");
21 // -----------------------------------
23 {
24  // -----------------------------------
25  global $dbaccess;
26 
27  $dbaccess = $action->GetParam("FREEDOM_DB");
28 
29  $aid = GetHttpVars("aid"); // attribute id
30  $famid = GetHttpVars("fid"); // family id
31  $action->lay->set("aid", $aid);
32  $doc = new_Doc($dbaccess, $famid);
33 
34  $err = $doc->control("edit"); // need edit permission
35  if ($err != "") $action->exitError($err);
36 
37  $a = $doc->getAttribute($aid);
38  $action->lay->set("fid", $a->docid);
39 
40  $action->lay->set("TITLE", sprintf(_("definition of enumerate attribute %s of %s family") , $a->getLabel() , $doc->title));
41  $action->lay->set("icon", $doc->getIcon());
42  $tref = array();
43  $tlabel = array();
44  $tlevel = array();
45 
46  $enum = $a->getEnum();
47  foreach ($enum as $k => $v) {
48  $k = str_replace("\\.", "-dot-", $k);
49  $tk = explode(".", $k);
50  $tv = $v;
51  $sp = "";
52  $loff = "";
53  for ($i = 1; $i < count($tk); $i++) $loff.= ".....";
54 
55  $tlevel[] = array(
56  "alevel" => count($tk)
57  );
58  $tref[] = array(
59  "eref" => str_replace("-dot-", ".", array_pop($tk))
60  );
61  $vlabel = $tv;
62  $tlabel[] = array(
63  "elabel" => htmlspecialchars($vlabel) ,
64  "velabel" => htmlspecialchars($loff . $vlabel)
65  );
66  }
67 
68  $action->lay->setBlockData("ALEVEL", $tlevel);
69  $action->lay->setBlockData("AREF", $tref);
70  $action->lay->setBlockData("ALABEL", $tlabel);
71  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/GENERIC/Layout/generic_editcatg.js");
72 }
73 ?>
← centre documentaire © anakeen - published under CC License - Dynacase