Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
specialhelp.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * View special interface to set value in document form
8  *
9  * @author Anakeen
10  * @version $Id: $
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 string $docid Http var : document identifier to see
22  * @global string $attrid Http var : the attribute comes from search
23  */
25 {
26  // -----------------------------------
27  $docid = $action->getArgument("docid");
28  $attrid = $action->getArgument("attrid");
29  $dbaccess = $action->dbaccess;
30 
31  if ($docid == "") $action->exitError(_("no document reference"));
32  if (!is_numeric($docid)) $docid = getIdFromName($dbaccess, $docid);
33  if (intval($docid) == 0) $action->exitError(sprintf(_("unknow logical reference '%s'") , $action->getArgument("id")));
35  if (!$doc->isAffected()) $action->exitError(sprintf(_("cannot see unknow reference %s") , $docid));
36 
37  $oa = $doc->getAttribute($attrid);
38  if (!$oa) $action->exitError(sprintf(_("unknow attribute '%s'") , $attrid));
39 
40  $phpfunc = $oa->phpfunc;
41  if (preg_match('/([^:]+):([^(]+)\(([^)]*)\):(.*)/i', $phpfunc, $reg)) {
42  $appname = $reg[1];
43  $zone = $reg[2];
44  if ($reg[4]) $funres = explode(",", $reg[4]);
45  else $funres = array();
46  $action->lay = new Layout(getLayoutFile($appname, $zone . ".xml") , $action);
47 
48  $incfile = sprintf("EXTERNALS/%s", $oa->phpfile);
49  if (file_exists($incfile)) {
50  try {
51  include_once ($incfile);
52  if (function_exists(strtolower($zone))) {
53  include_once ("FDL/enum_choice.php");
54  $oa->phpfunc = substr($phpfunc, strpos($phpfunc, ':') + 1);
55  getResPhpFunc($doc, $oa, $rargids, $tselect, $tval, true, $index = "");
56  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/geometry.js");
57  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/autoclose.js");
58  $action->parent->AddJsRef("FDL:specialhelp.js", true);
59 
60  $action->parent->AddJsCode("Ih.resultArguments=" . json_encode($funres) . ";");
61  } else {
62  $action->exitError(sprintf(_("Cannot find help function %s") , strtolower($zone)));
63  }
64  }
65  catch(Exception $e) {
66  $action->exitError(sprintf(_("Cannot include '%s'") , sprintf("%s/%s.php", $appname, strtolower($zone))));
67  }
68  }
69  } else {
70  $action->exitError(sprintf(_("declaration syntax does not match special help input '%s'") , $phpfunc));
71  }
72 
73  if (GetHttpVars('extjs', '') != '') {
74  $action->parent->AddCssRef("STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css");
75  $style = $action->getParam("CORE_STYLE");
76  if (file_exists($action->parent->rootdir . "/STYLE/$style/Layout/EXT-ADAPTER-USER.css")) {
77  $action->parent->AddCssRef("STYLE/$style/Layout/EXT-ADAPTER-USER.css");
78  } else {
79  $action->parent->AddCssRef("STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css");
80  }
81  }
82 }
83 
getResPhpFunc(Doc &$doc, NormalAttribute &$oattr, &$rargids, &$tselect, &$tval, $whttpvars=true, $index="")
Definition: enum_choice.php:62
Layout is a template generator.
$appname
global $action
exitError($texterr, $exit=true, $code="")
specialhelp(Action &$action)
Definition: specialhelp.php:24
$docid
Definition: cleanFamily.php:13
getLayoutFile($app, $layfile)
Definition: Lib.Common.php:258
new_Doc($dbaccess, $id= '', $latest=false)
getParam($name, $def="")
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
getIdFromName($dbaccess, $name)
← centre documentaire © anakeen