Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
addenumitem.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  * add item and return html input of an attribute
9  *
10  * @author Anakeen 2008
11  * @version $Id: addenumitem.php,v 1.2 2008/12/11 10:06:52 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/editutil.php");
20 /**
21  * Display editor to fix a document version
22  * @param Action &$action current action
23  * @global docid Http var : document id
24  * @global aid Http var : attribute id
25  */
27 {
28  $docid = GetHttpVars("docid");
29  $attrid = GetHttpVars("aid");
30  $key = GetHttpVars("key");
31  $index = GetHttpVars("index");
32 
33  $key = trim(str_replace('"', '', $key));
34  $dbaccess = $action->GetParam("FREEDOM_DB");
35 
36  $action->lay->template = "addenumitem $docid $attrid <b>$key</b>";
37  $doc = new_doc($dbaccess, $docid);
38  if ($doc->isAlive()) {
39  $action->lay->template = "addenumitem/2 $docid $attrid <b>$key</b>";
40  $oa = $doc->getAttribute($attrid);
41  if ($oa) {
42  $err = $oa->addEnum($dbaccess, str_replace('.', '\.', $key) , $key);
43  if ($oa->repeat && (!$oa->inArray())) {
44  $v = $doc->getValue($oa->id);
45  if ($v != "") $v.= "\n$key";
46  else $v = $key;
47  } else {
48  $v = $key;
49  }
50 
51  $i = getHtmlInput($doc, $oa, $v, $index);
52  $action->lay->noparse = true;
53  $action->lay->template = $i;
54  }
55  }
56 }
57 ?>
← centre documentaire © anakeen - published under CC License - Dynacase