Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Edit special template
9  *
10  * @author Anakeen 2000
11  * @version $Id: fdl_card.php,v 1.42 2008/12/02 15:20: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/Class.Dir.php");
20 /**
21  * Edit special template for an attribute
22  *
23  * @param Action &$action current action
24  * @global id Http var : document identificator to see
25  * @global famid Http var :
26  * @global zone Http var : zone
27  */
28 function edittpl(Action & $action)
29 {
30  $zone = $action->getArgument("zone");
31  $docid = $action->getArgument("id");
32  if (!$docid) $docid = $action->getArgument("famid");
33  if (!$zone) $action->addWarningMsg(_("no template defined"));
34  if (!$docid) $action->addWarningMsg(sprintf(_("template %s no document found") , $zone));
35  $dbaccess = $action->getParam("FREEDOM_DB");
36 
37  $reg = Doc::parseZone($zone);
38  if ($reg === false) {
39  return sprintf(_("error in pzone format %s") , $zone);
40  }
41 
42  if (array_key_exists('argv', $reg)) {
43  foreach ($reg['argv'] as $k => $v) {
44  setHttpVar($k, $v);
45  }
46  }
47 
48  $doc = new_doc($dbaccess, $docid);
49  if ($doc->isAlive()) {
50  $action->lay = new Layout($doc->getZoneFile($zone) , $action);
51  $doc->lay = & $action->lay;
52 
53  $method = strtok(strtolower($reg['layout']) , '.');
54  if (method_exists($doc, $method)) {
55  $doc->$method();
56  } else {
57  $doc->editattr($doc->getZoneOption($zone) == "U");
58  $doc->viewprop();
59  }
60  }
61 }
62 ?>
← centre documentaire © anakeen - published under CC License - Dynacase