Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editwask.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  * Edit ask for a document
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  */
26 function editwask(&$action)
27 {
28  $docid = GetHttpVars("docid");
29  $dbaccess = $action->GetParam("FREEDOM_DB");
30  if ($docid == "") $action->exitError(_("no document reference"));
32  if (!$doc->isAlive()) $action->exitError(sprintf(_("unknow document reference '%s'") , GetHttpVars("docid")));
33 
34  $err = $doc->control("view");
35  if ($err) $action->exitError($err);
36 
37  $answers = $doc->getWasks();
38 
39  $title = "";
40  foreach ($answers as $ans) {
41  $wask = new_doc($dbaccess, $ans["waskid"]);
42  $t = $wask->getAvalues("was_t_answer");
43  foreach ($t as $k => $v) {
44  $t[$k]["waskid"] = $wask->id;
45  $t[$k]["checked"] = ($ans["key"] == $v["was_keys"]);
46  }
47  $action->lay->setBlockData("OPTIONS" . $wask->id, $t);
48  if ($title != "") $title.= ', ';
49  $title.= $wask->getTitle();
50 
51  $action->lay->set("asktitle", $title);
52  $tw[] = array(
53  "waskid" => $wask->id,
54  "ask" => $wask->getValue("was_ask")
55  );
56  }
57  $action->lay->setBlockData("WASK", $tw);
58  $action->parent->AddJsRef("FDL:viewdoc.js", true);
59  $action->lay->set("docid", $doc->id);
60 }
61 ?>
← centre documentaire © anakeen - published under CC License - Dynacase