Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
setwask.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * save an answer of a ask
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 docid int Http var : document identifier where use the ask
22  * @global waskid int Http var : document identifier of the ask
23  * @global answer string Http var : the answer for the question
24  */
25 function setwask(Action & $action)
26 {
27  $docid = GetHttpVars("docid");
28  $answers = GetHttpVars("answer");
29  $dbaccess = $action->dbaccess;
30  if ($docid == "") $action->exitError(_("no document reference"));
32  if (!$doc->isAlive()) $action->exitError(sprintf(_("unknow document reference '%s'") , GetHttpVars("docid")));
33  $err = $doc->control("view");
34  if ($err) $action->exitError($err);
35  $task = array();
36  foreach ($answers as $waskid => $answer) {
37  $wask = new_doc($dbaccess, $waskid);
38  $wask->set($doc);
39  if ($wask->isAlive() && $wask->control('answer') == "") {
40  $err = $doc->setWaskAnswer($waskid, $answer);
41  if ($err) $action->addWarningMsg($err);
42  else $task[] = array(
43  "ask" => $wask->getRawValue("was_ask") ,
44  "answer" => implode(", ", $wask->getAskLabels($answer))
45  );
46  }
47  }
48 
49  $action->lay->setBlockData("WASK", $task);
50  $action->lay->set("docid", $doc->id);
51 }
addWarningMsg($msg)
global $action
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
setwask(Action &$action)
Definition: setwask.php:25
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen