Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.Wask.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Ask documents
8  *
9  */
10 namespace Dcp\Core;
12 {
13  /**
14  * @var \Dcp\Family\Wask
15  */
16  private $prdoc = null;
17  function postConstructor()
18  {
19  $this->dacls["answer"] = array(
20  "pos" => 31,
21  "description" => _("need answer")
22  );
23  $this->acls[] = "answer"; # _("answer")
24 
25  }
26  /**
27  * return sql query to search wanted document
28  */
29  function getAskLabels($keys)
30  {
31  $tk = array();
32  foreach ($keys as $k) {
33  $tk[$k] = $this->getAskLabel($k);
34  }
35  return $tk;
36  }
37 
38  function getAskLabel($keys)
39  {
40  $i = array_search($keys, $this->getMultipleRawValues("was_keys"));
41  if ($i !== false) {
42  return $this->getMultipleRawValues("was_labels", "", $i);
43  }
44  return "";
45  }
46 
47  function DocControl($aclname)
48  {
49  return \Doc::Control($aclname);
50  }
51  /**
52  * Special control in case of dynamic controlled profil
53  */
54  function Control($aclname, $strict = false)
55  {
56 
57  $err = $this->DocControl($aclname);
58  if ($err == "") return $err; // normal case
59  if ($this->getRawValue("DPDOC_FAMID") > 0) {
60  if ($this->doc) {
61  // special control for dynamic users
62  if (!isset($this->prdoc)) {
63  $pdoc = createTmpDoc($this->dbaccess, $this->fromid);
64  $err = $pdoc->Add();
65  if ($err != "") return "Wask::Control:" . $err; // can't create profil
66  $pdoc->setProfil($this->profid, $this->doc);
67  $this->prdoc = & $pdoc;
68  }
69  $err = $this->prdoc->DocControl($aclname);
70  }
71  }
72  return $err;
73  }
74 
75  function Set(&$doc)
76  {
77  if (!isset($this->doc)) {
78  $this->doc = & $doc;
79  }
80  }
81 }
getAskLabel($keys)
Definition: Class.Wask.php:38
getAskLabels($keys)
Definition: Class.Wask.php:29
getMultipleRawValues($idAttr, $def="", $index=-1)
Definition: Class.Doc.php:3240
Control($aclname, $strict=false)
Definition: Class.Wask.php:54
DocControl($aclname)
Definition: Class.Wask.php:47
createTmpDoc($dbaccess, $fromid, $defaultvalue=true)
if($file) if($subject==""&&$file) if($subject=="") $err
getRawValue($idAttr, $def="")
Definition: Class.Doc.php:3117
← centre documentaire © anakeen