Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * View special interface to set value in document form
9  *
10  * @author Anakeen 2010
11  * @version $Id: $
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 docid Http var : document identificator to see
24  * @global attrid Http var : the attribute comes from search
25  */
27 {
28  // -----------------------------------
29  $docid = $action->getArgument("docid");
30  $attrid = $action->getArgument("attrid");
31  $dbaccess = $action->GetParam("FREEDOM_DB");
32 
33  if ($docid == "") $action->exitError(_("no document reference"));
34  if (!is_numeric($docid)) $docid = getIdFromName($dbaccess, $docid);
35  if (intval($docid) == 0) $action->exitError(sprintf(_("unknow logical reference '%s'") , $action->getArgument("id")));
37  if (!$doc->isAffected()) $action->exitError(sprintf(_("cannot see unknow reference %s") , $docid));
38 
39  $oa = $doc->getAttribute($attrid);
40  if (!$oa) $action->exitError(sprintf(_("unknow attribute '%s'") , $attrid));
41 
42  $phpfunc = $oa->phpfunc;
43  if (preg_match('/([^:]+):([^(]+)\(([^)]*)\):(.*)/i', $phpfunc, $reg)) {
44  $appname = $reg[1];
45  $zone = $reg[2];
46  $funarg = explode(",", $reg[3]);
47  if ($reg[4]) $funres = explode(",", $reg[4]);
48  else $funres = array();
49 
50  $action->lay = new Layout(getLayoutFile($appname, $zone . ".xml") , $action);
51 
52  $incfile = sprintf("EXTERNALS/%s", $oa->phpfile);
53  if (file_exists($incfile)) {
54  try {
55  include_once ($incfile);
56  if (function_exists(strtolower($zone))) {
57  include_once ("FDL/enum_choice.php");
58  $oa->phpfunc = substr($phpfunc, strpos($phpfunc, ':') + 1);
59  $res = getResPhpFunc($doc, $oa, $rargids, $tselect, $tval, true, $index, $zone);
60  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/geometry.js");
61  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/autoclose.js");
62  $action->parent->AddJsRef("FDL:specialhelp.js", true);
63 
64  $action->parent->AddJsCode("Ih.resultArguments=" . json_encode($funres)) . ";";
65  } else {
66  $action->exitError(sprintf(_("Cannot find help function %s") , strtolower($zone)));
67  }
68  }
69  catch(Exception $e) {
70  $action->exitError(sprintf(_("Cannot include '%s'") , sprintf("%s/%s.php", $appname, strtolower($zone))));
71  }
72  }
73  } else {
74  $action->exitError(sprintf(_("declaration syntax does not match special help input '%s'") , $phpfunc));
75  }
76 
77  if (GetHttpVars('extjs', '') != '') {
78  $action->parent->AddCssRef("STYLE/DEFAULT/Layout/EXT-ADAPTER-SYSTEM.css");
79  if (file_exists($action->parent->rootdir . "/STYLE/$style/Layout/EXT-ADAPTER-USER.css")) {
80  $action->parent->AddCssRef("STYLE/$style/Layout/EXT-ADAPTER-USER.css");
81  } else {
82  $action->parent->AddCssRef("STYLE/DEFAULT/Layout/EXT-ADAPTER-USER.css");
83  }
84  }
85 }
86 ?>
← centre documentaire © anakeen - published under CC License - Dynacase