Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
viewtpl.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  * View a document
22  * @param Action &$action current action
23  * @global id Http var : document identificator to see
24  * @global famid Http var :
25  * @global zone Http var : zone
26  */
27 function viewtpl(Action & $action)
28 {
29  $zone = $action->getArgument("zone");
30  $docid = $action->getArgument("id");
31  $target = $action->getArgument("target", "_self");
32  $ulink = $action->getArgument("ulink", true);
33  $abstract = $action->getArgument("abstract", true);
34  if (!$docid) $docid = $action->getArgument("famid");
35  if (!$zone) $action->addWarningMsg(_("no template defined"));
36  if (!$docid) $action->addWarningMsg(sprintf(_("template %s no document found") , $zone));
37  $dbaccess = $action->getParam("FREEDOM_DB");
38 
39  $reg = Doc::parseZone($zone);
40  if ($reg === false) {
41  return sprintf(_("error in pzone format %s") , $zone);
42  }
43 
44  if (array_key_exists('argv', $reg)) {
45  foreach ($reg['argv'] as $k => $v) {
46  setHttpVar($k, $v);
47  }
48  }
49 
50  $appname = $reg['app'];
51  $doc = new_doc($dbaccess, $docid);
52  if ($doc->isAlive()) {
53  $action->lay = new Layout($doc->getZoneFile($zone) , $action);
54  $doc->lay = & $action->lay;
55 
56  $method = strtok(strtolower($reg['layout']) , '.');
57  if (method_exists($doc, $method)) {
58  $doc->$method();
59  } else {
60  $doc->viewdefaultcard($target);
61  }
62  }
63 }
64 ?>
← centre documentaire © anakeen - published under CC License - Dynacase