Core  3.2
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  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: viewframe.php,v 1.25 2008/08/14 09:59:14 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 // ---------------------------------------------------------------
17 // $Id: viewframe.php,v 1.25 2008/08/14 09:59:14 eric Exp $
18 // $Source: /home/cvsroot/anakeen/freedom/freedom/Zone/Fdl/viewframe.php,v $
19 // ---------------------------------------------------------------
20 include_once ("FDL/Class.Doc.php");
21 include_once ("FDL/Class.DocAttr.php");
22 
23 include_once ("FDL/freedom_util.php");
24 // Compute frame values to be inserted in a specific layout
25 // -----------------------------------
26 function viewframe(Action & $action)
27 {
28  // -----------------------------------
29  // GetAllParameters
30  $docid = GetHttpVars("id");
31  $frameid = strtolower(GetHttpVars("frameid"));
32  $abstract = (GetHttpVars("abstract", 'N') == "Y"); // view doc abstract attributes
33  $target = GetHttpVars("target", "_self");
34  $ulink = (GetHttpVars("ulink", '2')); // add url link
35  $vid = GetHttpVars("vid"); // special controlled view
36  if ($ulink == "N") $ulink = false;
37  // Set the globals elements
38  $dbaccess = $action->dbaccess;
39 
40  $action->lay->Set("cursor", $ulink ? "crosshair" : "inherit");
41 
43  if (($vid != "") && ($doc->cvid > 0)) {
44  /**
45  * special controled view
46  * @var CVDoc $cvdoc
47  */
48  $cvdoc = new_Doc($dbaccess, $doc->cvid);
49  $tview = $cvdoc->getView($vid);
50 
51  $doc->setMask($tview["CV_MSKID"]);
52  }
53 
54  $listattr = $doc->GetNormalAttributes(); // get frame attribute also
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  * @var NormalAttribute $v
64  */
65  if ($v->fieldSet->id != $frameid) continue;
66 
67  $value = chop($doc->getRawValue($v->id));
68 
69  $goodvalue = ((($value != "") || ($v->type == "array") || $v->getOption("showempty")) && ($v->mvisibility != "H") && ($v->mvisibility != "O") && (!$v->inArray()));
70  if ($goodvalue) {
71  if (($value == "") && ($v->type != "array")) $htmlvalue = $v->getOption("showempty");
72  else $htmlvalue = $doc->GetHtmlValue($v, $value, $target, $ulink);
73  } else $htmlvalue = "";
74  if ($htmlvalue == "") continue;
75  if ($v->mvisibility == "O") continue;
76  if ($v->inArray()) continue;
77  //------------------------------
78  // Set the table value elements
79  if (($v->mvisibility != "H") && ($v->mvisibility != "I")) {
80  // don't see non abstract if not
81  if ((!$abstract) || ($v->isInAbstract)) {
82  $tval[$k]["nonelabel"] = false;
83  $tval[$k]["normallabel"] = true;
84  $tval[$k]["uplabel"] = false;
85  $tval[$k]["wvalue"] = ($v->type == "array") ? "1%" : "30%"; // width
86  $tval[$k]["ndisplay"] = "inline"; // display alabel ?
87  if ($v->getOption("vlabel") == "none") {
88  $tval[$k]["nonelabel"] = true;
89  $tval[$k]["normallabel"] = false;
90  } else if ($v->getOption("vlabel") == "up") {
91  $tval[$k]["normallabel"] = false;
92  $tval[$k]["uplabel"] = true;
93  }
94  $tval[$k]["alabel"] = $v->getLabel();;
95  $tval[$k]["avalue"] = $htmlvalue;
96  }
97  }
98  }
99  //dont'see frame label is no one value
100  if (count($tval) > 0) {
101 
102  $action->lay->setBlockData("FIELDSET", array(
103  array(
104  "zou"
105  )
106  ));
107  $action->lay->setBlockData("FVALUES", $tval);
108  }
109 }
global $action
Set($name, &$parent)
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
mb_ucfirst($s)
Definition: Lib.Common.php:105
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
$value
← centre documentaire © anakeen