Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
freedom_ifld.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: freedom_ifld.php,v 1.7 2005/06/28 08:37:46 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 // ---------------------------------------------------------------
17 // $Id: freedom_ifld.php,v 1.7 2005/06/28 08:37:46 eric Exp $
18 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/freedom_ifld.php,v $
19 // ---------------------------------------------------------------
20 include_once ('FDL/Class.Doc.php');
21 include_once ('FDL/Class.Dir.php');
22 // -----------------------------------
23 // search all folder where is docid
24 // -----------------------------------
26 {
27  // -----------------------------------
28  $docid = GetHttpVars("id");
29  $dbaccess = $action->dbaccess;
31 
32  $lfather = array_reverse(fatherFld($dbaccess, $doc->initid));
33 
34  $lmax = 0;
35  $lprev = 0;
36  foreach ($lfather as $k => $v) {
37  // recompute level for indentation
38  if ($lprev == 0) $lmax = $lfather[$k]["level"];
39  $lfather[$k]["level"] = - ($v["level"] - $lmax) * 15; // by 15px
40  $lprev = $v["level"];
41  }
42 
43  $action->lay->Set("TITLE", $doc->getHTMLTitle());
44  $action->lay->SetBlockData("IFLD", $lfather);
45 }
46 
47 function fatherFld($dbaccess, $docid, $level = 0, $lfldid = array() , $lcdoc = array())
48 {
49  // compute all path to accessing document
50  $doc = new_doc($dbaccess, $docid);
51  $flds = $doc->getParentFolderIds();
52  $ldoc2 = array();
53  if (count($flds) > 0) {
54 
55  foreach ($flds as $pfldid) {
56 
57  if (!in_array($pfldid, $lfldid)) {
58  // avoid infinite recursion
59  $fld = new_Doc($dbaccess, $pfldid);
60  if ($fld->Control("view") == "") {
61  // permission view folder
62  $ldoc1 = array(
63  "level" => $level,
64  "ftitle" => $fld->getHTMLTitle() ,
65  "fid" => $fld->id
66  );
67 
68  $lcdoc1 = $lcdoc;
69  $lcdoc1[] = $ldoc1;
70 
71  $lfldid1 = $lfldid;
72  $lfldid1[] = $pfldid;
73 
74  $ldoc2 = array_merge(fatherFld($dbaccess, $pfldid, $level + 1, $lfldid1, $lcdoc1) , $ldoc2);
75  } else $ldoc2 = $lcdoc;
76  } else $ldoc2 = $lcdoc;
77  }
78  } else return $lcdoc;
79  return $ldoc2;
80 }
freedom_ifld(Action &$action)
global $action
fatherFld($dbaccess, $docid, $level=0, $lfldid=array(), $lcdoc=array())
Set($name, &$parent)
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen