Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editoption.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 of option sttribute for a document
9  *
10  * @author Anakeen 2004
11  * @version $Id: editoption.php,v 1.3 2005/10/17 14:02:37 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 
21 include_once ("Class.QueryDb.php");
22 include_once ("GENERIC/generic_util.php");
23 // -----------------------------------
24 function editoption(&$action)
25 {
26  // -----------------------------------
27  // Get All Parameters
28  $docid = GetHttpVars("id", 0); // document to edit
29  $aid = GetHttpVars("aid"); // linked attribute id
30 
31  $aid = GetHttpVars("aid"); // linked attribute id
32  // Set the globals elements
33  $dbaccess = $action->GetParam("FREEDOM_DB");
34 
36 
37  $action->lay->Set("iconsrc", $doc->geticon());
38 
39  if ($doc->fromid > 0) {
40  $fdoc = $doc->getFamDoc();
41  $action->lay->Set("FTITLE", $fdoc->title);
42  } else {
43  $action->lay->Set("FTITLE", _("no family"));
44  }
45 
46  $action->lay->Set("id", $docid);
47  // control view of special constraint button
48  $action->lay->Set("boverdisplay", "none");
49 
50  if (GetHttpVars("viewconstraint") == "Y") {
51  $action->lay->Set("bconsdisplay", "none");
52  if ($action->user->id == 1) $action->lay->Set("boverdisplay", ""); // only admin can do this
53 
54  } else {
55  // verify if at least on attribute constraint
56  $action->lay->Set("bconsdisplay", "none");
57  /*
58  $listattr = $doc->GetNormalAttributes();
59  foreach ($listattr as $k => $v) {
60  if ($v->phpconstraint != "") {
61  $action->lay->Set("bconsdisplay", "");
62  break;
63  }
64  }
65  */
66  }
67  $action->lay->set("tablefoot", "tableborder");
68  $action->lay->set("tablehead", "tableborder");
69  $action->lay->set("ddivfoot", "none");
70  if ($action->Read("navigator", "") == "NETSCAPE") {
71  if (preg_match("/rv:([0-9.]+).*/", $_SERVER['HTTP_USER_AGENT'], $reg)) {
72  if (floatval($reg[1] >= 1.6)) {
73  $action->lay->set("ddivfoot", "");
74  $action->lay->set("tablefoot", "tablefoot");
75  $action->lay->set("tablehead", "tablehead");
76  }
77  }
78  }
79  // information propagation
80  $action->lay->Set("classid", $classid);
81  $action->lay->Set("dirid", $dirid);
82  $action->lay->Set("id", $docid);
83  $action->lay->Set("aid", $aid);
84 }
85 
86 function viewoption(&$action)
87 {
88  // -----------------------------------
89  // Get All Parameters
90  $zonebodycard = GetHttpVars("zone", "FDL:VIEWOPTCARD:T"); // define view action
92  if ($doc) {
93  $zonedoc = $doc->viewDoc($zonebodycard);
94 
95  $action->lay->set("zonedoc", $zonedoc);
96  } else {
97  $action->lay->set("zonedoc", _("click to change option"));
98  }
99 }
101 {
102  // -----------------------------------
103  // Get All Parameters
104  $docid = GetHttpVars("id", 0); // document to edit
105  $valopt = GetHttpVars("opt"); // value of linked attribute id
106  // Set the globals elements
107  $dbaccess = $action->GetParam("FREEDOM_DB");
108 
110  if (!$doc->isAlive()) return false;
111  $fdoc = $doc->getFamDoc();
112  $fdoc->opt = $valopt;
113  $topt = $fdoc->getXValues("opt");
114 
115  $doc->setDefaultValues($topt);
116  $doc = $doc->copy(true, false);
117  setHttpVar("id", $doc->id);
118 
119  return $doc;
120 }
121 ?>
← centre documentaire © anakeen - published under CC License - Dynacase