Core  3.2
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  * @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  * View a document
20  * @param Action &$action current action
21  * @global id int Http var : document identifier to see
22  * @global famid int Http var :
23  * @global zone string Http var : zone
24  */
25 function viewtpl(Action & $action)
26 {
27  $zone = $action->getArgument("zone");
28  $docid = $action->getArgument("id");
29  $target = $action->getArgument("target", "_self");
30  $ulink = $action->getArgument("ulink", true);
31  $abstract = $action->getArgument("abstract", true);
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->dbaccess;
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  $appname = $reg['app'];
49  $doc = new_doc($dbaccess, $docid);
50  if ($doc->isAffected()) {
51  $action->lay = new Layout($doc->getZoneFile($zone) , $action);
52  $doc->lay = & $action->lay;
53 
54  $method = strtok(strtolower($reg['layout']) , '.');
55  if (method_exists($doc, $method)) {
56  $doc->$method();
57  } else {
58  $doc->viewdefaultcard($target);
59  }
60  }
61 }
Layout is a template generator.
$appname
addWarningMsg($msg)
global $action
viewtpl(Action &$action)
Definition: viewtpl.php:25
$docid
Definition: cleanFamily.php:13
static parseZone($zone)
Definition: Class.Doc.php:9331
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen