Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
viewframe.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  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: viewframe.php,v 1.25 2008/08/14 09:59:14 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 // $Id: viewframe.php,v 1.25 2008/08/14 09:59:14 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Zone/Fdl/viewframe.php,v $
21 // ---------------------------------------------------------------
22 include_once ("FDL/Class.Doc.php");
23 include_once ("FDL/Class.DocAttr.php");
24 
25 include_once ("FDL/freedom_util.php");
26 // Compute frame values to be inserted in a specific layout
27 // -----------------------------------
28 function viewframe(&$action)
29 {
30  // -----------------------------------
31  // GetAllParameters
32  $docid = GetHttpVars("id");
33  $frameid = strtolower(GetHttpVars("frameid"));
34  $abstract = (GetHttpVars("abstract", 'N') == "Y"); // view doc abstract attributes
35  $target = GetHttpVars("target", "_self");
36  $ulink = (GetHttpVars("ulink", '2')); // add url link
37  $vid = GetHttpVars("vid"); // special controlled view
38  if ($ulink == "N") $ulink = false;
39  // Set the globals elements
40  $dbaccess = $action->GetParam("FREEDOM_DB");
41 
42  $action->lay->Set("cursor", $ulink ? "crosshair" : "inherit");
43 
45  if (($vid != "") && ($doc->cvid > 0)) {
46  // special controlled view
47  $cvdoc = new_Doc($dbaccess, $doc->cvid);
48  $tview = $cvdoc->getView($vid);
49 
50  $doc->setMask($tview["CV_MSKID"]);
51  }
52 
53  $listattr = $doc->GetNormalAttributes(); // get frame attribute also
54 
55  $foa = $doc->getAttribute($frameid);
56  if (!$foa) $action->exitError(sprintf("attribute %s not found") , $frameid);
57  if ($foa->getOption("vlabel") == "none") $action->lay->set("flabel", '');
58  else $action->lay->set("flabel", mb_ucfirst($foa->getLabel()));
59 
60  $tval = array();
61  foreach ($listattr as $k => $v) {
62 
63  if ($v->fieldSet->id != $frameid) continue;
64 
65  $value = chop($doc->GetValue($v->id));
66 
67  $goodvalue = ((($value != "") || ($v->type == "array") || $v->getOption("showempty")) && ($v->mvisibility != "H") && ($v->mvisibility != "O") && (!$v->inArray()));
68  if ($goodvalue) {
69  if (($value == "") && ($v->type != "array")) $htmlvalue = $v->getOption("showempty");
70  else $htmlvalue = $doc->GetHtmlValue($v, $value, $target, $ulink);
71  } else $htmlvalue = "";
72  if ($htmlvalue == "") continue;
73  if ($v->mvisibility == "O") continue;
74  if ($v->inArray()) continue;
75  //------------------------------
76  // Set the table value elements
77  if (($v->mvisibility != "H") && ($v->mvisibility != "I")) {
78  // don't see non abstract if not
79  if ((!$abstract) || ($v->isInAbstract)) {
80  $tval[$k]["nonelabel"] = false;
81  $tval[$k]["normallabel"] = true;
82  $tval[$k]["uplabel"] = false;
83  $tval[$k]["wvalue"] = ($v->type == "array") ? "1%" : "30%"; // width
84  $tval[$k]["ndisplay"] = "inline"; // display alabel ?
85  if ($v->getOption("vlabel") == "none") {
86  $tval[$k]["nonelabel"] = true;
87  $tval[$k]["normallabel"] = false;
88  } else if ($v->getOption("vlabel") == "up") {
89  $tval[$k]["normallabel"] = false;
90  $tval[$k]["uplabel"] = true;
91  }
92  $tval[$k]["alabel"] = $v->getLabel();;
93  $tval[$k]["avalue"] = $htmlvalue;
94  }
95  }
96  }
97  //dont'see frame label is no one value
98  if (count($tval) > 0) {
99 
100  $action->lay->setBlockData("FIELDSET", array(
101  array(
102  "zou"
103  )
104  ));
105  $action->lay->setBlockData("FVALUES", $tval);
106  }
107 }
108 ?>
← centre documentaire © anakeen - published under CC License - Dynacase