Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
edittpl.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Edit special template
8  *
9  * @author Anakeen
10  * @version $Id: fdl_card.php,v 1.42 2008/12/02 15:20:52 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Dir.php");
18 /**
19  * Edit special template for an attribute
20  *
21  * @param Action &$action current action
22  * @global id int Http var : document identifier to see
23  * @global famid int Http var :
24  * @global zone string Http var : zone
25  */
26 function edittpl(Action & $action)
27 {
28  $zone = $action->getArgument("zone");
29  $docid = $action->getArgument("id");
30  $famid = $action->getArgument("famid");
31  if (!$zone) $action->addWarningMsg(_("no template defined"));
32  if ((!$docid) && (!$famid)) $action->addWarningMsg(sprintf(_("template %s no document found") , $zone));
33  $dbaccess = $action->dbaccess;
34 
35  $reg = Doc::parseZone($zone);
36  if ($reg === false) {
37  return sprintf(_("error in pzone format %s") , $zone);
38  }
39 
40  if (array_key_exists('argv', $reg)) {
41  foreach ($reg['argv'] as $k => $v) {
42  setHttpVar($k, $v);
43  }
44  }
45  if ($docid) {
46  $doc = new_doc($dbaccess, $docid);
47  } else {
50  }
51  if ($doc) {
52  $zonefile = $doc->getZoneFile($zone);
53  if (!$zonefile) {
54  addWarningMsg(sprintf(_("cannot access edit template file %s") , $zone));
55  } else {
56  $action->lay = new Layout($zonefile, $action);
57  $doc->lay = & $action->lay;
58 
59  $method = strtok(strtolower($reg['layout']) , '.');
60  if (method_exists($doc, $method)) {
61  $doc->$method();
62  } else {
63  $doc->editattr($doc->getZoneOption($zone) == "U");
64  $doc->viewprop();
65  }
66  }
67  }
68 }
Layout is a template generator.
addWarningMsg($msg)
global $action
fdl_setHttpVars(&$doc)
Definition: editcard.php:381
addWarningMsg($msg)
Definition: Lib.Common.php:95
$docid
Definition: cleanFamily.php:13
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
static parseZone($zone)
Definition: Class.Doc.php:9331
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
edittpl(Action &$action)
Definition: edittpl.php:26
← centre documentaire © anakeen