Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * save an answer of a ask
9  *
10  * @author Anakeen 2000
11  * @version $Id: fdl_card.php,v 1.42 2008/12/02 15:20:52 eric Exp $
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 where use the ask
24  * @global waskid Http var : document identificator of the ask
25  * @global answer Http var : the answer for the question
26  */
27 function setwask(&$action)
28 {
29  $docid = GetHttpVars("docid");
30  $answers = GetHttpVars("answer");
31  $dbaccess = $action->GetParam("FREEDOM_DB");
32  if ($docid == "") $action->exitError(_("no document reference"));
34  if (!$doc->isAlive()) $action->exitError(sprintf(_("unknow document reference '%s'") , GetHttpVars("docid")));
35  $err = $doc->control("view");
36  if ($err) $action->exitError($err);
37  $task = array();
38  foreach ($answers as $waskid => $answer) {
39  $wask = new_doc($dbaccess, $waskid);
40  $wask->set($doc);
41  if ($wask->isAlive() && $wask->control('answer') == "") {
42  $err = $doc->setWaskAnswer($waskid, $answer);
43  if ($err) $action->addWarningMsg($err);
44  else $task[] = array(
45  "ask" => $wask->getValue("was_ask") ,
46  "answer" => implode(", ", $wask->getAskLabels($answer))
47  );
48  }
49  }
50 
51  $action->lay->setBlockData("WASK", $task);
52  $action->lay->set("docid", $doc->id);
53 }
54 ?>
← centre documentaire © anakeen - published under CC License - Dynacase