Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editaffect.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  * Edition to affect document
9  *
10  * @author Anakeen 2000
11  * @version $Id: editaffect.php,v 1.6 2007/01/15 14:39:46 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.Doc.php");
20 include_once ("FDL/Lib.Dir.php");
21 include_once ("FDL/editutil.php");
22 // -----------------------------------
23 // -----------------------------------
24 
25 /**
26  * Edition to affect document
27  * @param Action &$action current action
28  * @global id Http var : document id to affect
29  * @global viewdoc Http var : with preview of affect document [Y|N]
30  */
31 function editaffect(&$action)
32 {
33  $docid = GetHttpVars("id");
34  $viewdoc = (GetHttpVars("viewdoc", "N") == "Y");
35  $dbaccess = $action->GetParam("FREEDOM_DB");
36 
37  $doc = new_doc($dbaccess, $docid);
39 
40  $action->lay->Set("id", $docid);
41  $action->lay->Set("title", $doc->title);
42  $action->lay->set("VIEWDOC", $viewdoc);
43  $action->lay->set("affecttitle", sprintf(_("Affectation for %s") , $doc->title));
44  // search free states
45  $sqlfilters = array(
46  "(frst_famid='" . $doc->fromid . "') or (frst_famid is null) or (frst_famid='')"
47  );
48  $tfree = getChildDoc($dbaccess, 0, "0", "ALL", $sqlfilters, $action->user->id, "TABLE", "FREESTATE");
49  $tstate = array();
50  if ($doc->wid == 0) {
51  foreach ($tfree as $k => $v) {
52  $tstate[] = array(
53  "fstate" => $v["initid"],
54  "lstate" => $v["title"],
55  "color" => getv($v, "frst_color") ,
56  "dstate" => nl2br(getv($v, "frst_desc"))
57  );
58  }
59  }
60  $action->lay->set("viewstate", ($doc->wid == 0));
61  $state = $doc->getState();
62  if ($state) {
63  $action->lay->set("textstate", sprintf(_("From %s state to") , $state));
64  $action->lay->set("colorstate", $doc->getStateColor("transparent"));
65  } else {
66  $action->lay->set("textstate", _("New state"));
67  $action->lay->set("colorstate", "transparent");
68  }
69 
70  $action->lay->setBlockData("freestate", $tstate);
71 }
72 ?>
← centre documentaire © anakeen - published under CC License - Dynacase