Core  3.2
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  * @package FDL
5 */
6 /**
7  * add item and return html input of an attribute
8  *
9  * @author Anakeen
10  * @version $Id: addenumitem.php,v 1.2 2008/12/11 10:06:52 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/editutil.php");
18 /**
19  * Display editor to fix a document version
20  * @param Action &$action current action
21  * @global docid int Http var : document id
22  * @global aid int Http var : attribute id
23  */
25 {
26  $docid = $action->getArgument("docid");
27  $attrid = $action->getArgument("aid");
28  $key = $action->getArgument("key");
29  $index = $action->getArgument("index");
30 
31  $key = trim(str_replace('"', '', $key));
32  $dbaccess = $action->dbaccess;
33 
34  $action->lay->noparse = true;
35  $action->lay->template = htmlspecialchars("addenumitem '$docid' '$attrid' '$key'", ENT_QUOTES);
36  $doc = new_doc($dbaccess, $docid);
37  if ($doc->isAlive()) {
38  $action->lay->noparse = true;
39  $action->lay->template = htmlspecialchars("addenumitem/2 '$docid' '$attrid' '$key'", ENT_QUOTES);
40  /*
41  * @var NormalAttribute $oa
42  */
43  $oa = $doc->getAttribute($attrid);
44  if ($oa) {
45  $err = $oa->addEnum($dbaccess, str_replace('.', '\.', $key) , $key);
46  if ($oa->repeat && (!$oa->inArray())) {
47  $v = $doc->getRawValue($oa->id);
48  if ($v != "") $v.= "\n$key";
49  else $v = $key;
50  } else {
51  $v = $key;
52  }
53 
54  $i = getHtmlInput($doc, $oa, $v, $index);
55  $action->lay->noparse = true;
56  $action->lay->template = $i;
57  }
58  }
59 }
global $action
addenumitem(Action &$action)
Definition: addenumitem.php:24
$docid
Definition: cleanFamily.php:13
getHtmlInput(&$doc, &$oattr, $value, $index="", $jsevent="", $notd=false)
Definition: editutil.php:30
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen