Core  3.2
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  * @package FDL
5 */
6 /**
7  * Edit ask for a document
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  */
24 function editwask(&$action)
25 {
26  $docid = GetHttpVars("docid");
27  $dbaccess = $action->dbaccess;
28  if ($docid == "") $action->exitError(_("no document reference"));
30  if (!$doc->isAlive()) $action->exitError(sprintf(_("unknow document reference '%s'") , GetHttpVars("docid")));
31 
32  $err = $doc->control("view");
33  if ($err) $action->exitError($err);
34 
35  $answers = $doc->getWasks();
36 
37  $title = "";
38  $tw = array();
39  foreach ($answers as $ans) {
40  $wask = new_doc($dbaccess, $ans["waskid"]);
41  $t = $wask->getArrayRawValues("was_t_answer");
42  foreach ($t as $k => $v) {
43  $t[$k]["waskid"] = $wask->id;
44  $t[$k]["checked"] = ($ans["key"] == $v["was_keys"]);
45  }
46  $action->lay->setBlockData("OPTIONS" . $wask->id, $t);
47  if ($title != "") $title.= ', ';
48  $title.= $wask->getTitle();
49 
50  $action->lay->set("asktitle", $title);
51  $tw[] = array(
52  "waskid" => $wask->id,
53  "ask" => $wask->getRawValue("was_ask")
54  );
55  }
56  $action->lay->setBlockData("WASK", $tw);
57  $action->parent->AddJsRef("FDL:viewdoc.js", true);
58  $action->lay->set("docid", $doc->id);
59 }
global $action
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
editwask(&$action)
Definition: editwask.php:24
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen