Documentation is available at breadcrumb.class.php
1 <?php
2 /**
3 * @author Jan H. Andersen <jha@ipwsystems.dk>
4 * @author Martin R. Larsen <mrl@ipwsystems.dk>
5 * @copyright {@link http://www.ipwsystems.dk/ IPW Systems a.s}
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
7 * @package METAjour
8 * @subpackage extension
9 * @subpackage breadcrumb
10 * $Id: breadcrumb.class.php,v 1.1.1.1 2004/09/15 15:34:01 Administrator Exp $
11 */
12
13 require_once($system_path . 'extension/basicextension.class.php');
14 require_once($system_path . 'core/structureclass.php');
15 require_once($system_path . 'core/structureelementclass.php');
16 require_once($system_path . 'core/documentclass.php');
17
18 class ext_breadcrumb extends basicextension {
19
20 function ext_breadcrumb() {
21 $this->basicextension();
22 $this->extname = 'breadcrumb';
23 $this->structureobj =& new structure;
24
25 $this->_adodb =& getdbconn();
26 $this->addextparam('document');
27 }
28
29 function containedin($objectid, $structureid) {
30 $parentid = $this->_adodb->getone("select parentid from object where objectid=$objectid");
31 if ($parentid == 0) return false;
32 if ($parentid == $structureid) return true;
33 return $this->containedin($parentid, $structureid);
34 }
35
36 function findposition() {
37
38 $structureid = $this->structureobj->locatebyname($this->extconfigset);
39
40 $result = array();
41 $query = "select se.objectid from structureelement se inner join object o on se.objectid=o.objectid and site=" .
42 $this->site . " and deleted = 0 and pageid=" . $this->extconfig['document'];
43 $res = $this->_adodb->query($query);
44 $objectid = 0;
45 while(($row = $res->fetchrow()) && !$objectid) {
46 if ($this->containedin($row['objectid'], $structureid)) {
47 $objectid = $row['objectid'];
48 }
49 }
50
51 $query = "select o.parentid, o.objectid, se.name from object o inner join structureelement se " .
52 "on o.objectid = se.objectid where o.objectid=$objectid";
53 $row = $this->_adodb->getrow($query);
54
55 while(count($row) && $row['parentid']) {
56
57 $se =& new structureelement();
58 $se->readobject($row['objectid']);
59
60 $result[] = array(
61 'objectid'=>$se->getobjectid(),
62 'name'=>$se->getname(),
63 'documentid'=>$se->elements[0]['pageid']);
64
65 $query = "select parentid from object where objectid=" . $row['parentid'];
66 $query = "select o.parentid, o.objectid, se.name from object o inner join structureelement se " .
67 "on o.objectid = se.objectid where o.objectid=" . $row['parentid'];
68
69 $row = $this->_adodb->getrow($query);
70 }
71 $this->extresult = array_reverse($result);
72 }
73
74 function _do() {
75
76 if (!$this->extconfig['document']) return;
77
78 switch ($this->extcmd) {
79
80 default:
81 $this->findposition();
82 }
83 }
84
85
86 }
Documentation generated on Thu, 9 Jun 2005 06:51:36 +0200 by phpDocumentor 1.2.3