Core  3.2
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  * @package FDL
5 */
6 /**
7  * Edition to affect document
8  *
9  * @author Anakeen
10  * @version $Id: editaffect.php,v 1.6 2007/01/15 14:39:46 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("FDL/Lib.Dir.php");
19 include_once ("FDL/editutil.php");
20 // -----------------------------------
21 // -----------------------------------
22 
23 /**
24  * Edition to affect document
25  * @param Action &$action current action
26  * @global id int Http var : document id to affect
27  * @global viewdoc string Http var : with preview of affect document [Y|N]
28  */
29 function editaffect(&$action)
30 {
31  $docid = GetHttpVars("id");
32  $viewdoc = (GetHttpVars("viewdoc", "N") == "Y");
33  $dbaccess = $action->dbaccess;
34 
35  $doc = new_doc($dbaccess, $docid);
37 
38  $action->lay->Set("id", $doc->id);
39  $action->lay->Set("title", $doc->getHTMLTitle());
40  $action->lay->set("VIEWDOC", $viewdoc);
41  $action->lay->eset("affecttitle", sprintf(_("Affectation for %s") , $doc->getTitle()));
42  // search free states
43  $sqlfilters = array(
44  "(frst_famid='" . $doc->fromid . "') or (frst_famid is null) or (frst_famid='')"
45  );
46  $tfree = internalGetDocCollection($dbaccess, 0, "0", "ALL", $sqlfilters, $action->user->id, "TABLE", "FREESTATE");
47  $tstate = array();
48  if ($doc->wid == 0) {
49  foreach ($tfree as $k => $v) {
50  $tstate[] = array(
51  "fstate" => $v["initid"],
52  "lstate" => $v["title"],
53  "color" => getv($v, "frst_color") ,
54  "dstate" => nl2br(getv($v, "frst_desc"))
55  );
56  }
57  }
58  $action->lay->set("viewstate", ($doc->wid == 0));
59  $state = $doc->getState();
60  if ($state) {
61  $action->lay->eset("textstate", sprintf(_("From %s state to") , $state));
62  $action->lay->set("colorstate", $doc->getStateColor("transparent"));
63  } else {
64  $action->lay->eset("textstate", _("New state"));
65  $action->lay->set("colorstate", "transparent");
66  }
67 
68  $action->lay->eSetBlockData("freestate", $tstate);
69 }
editaffect(&$action)
Definition: editaffect.php:29
global $action
getv(&$t, $k, $d="")
$docid
Definition: cleanFamily.php:13
internalGetDocCollection($dbaccess, $dirid, $start="0", $slice="ALL", $sqlfilters=array(), $userid=1, $qtype="LIST", $fromid="", $distinct=false, $orderby="title", $latest=true, $trash="", &$debug=null, $folderRecursiveLevel=2, $join= '',\SearchDoc &$searchDoc=null)
Definition: Lib.Dir.php:428
editmode(Action &$action)
Definition: editutil.php:41
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen