ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilShopExplorer.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
5 #include_once ("./Services/Repository/classes/class.ilRepositoryExplorer.php");
6 include_once './Services/Payment/classes/class.ilPaymentObject.php';
7 
19 // UNUSED ?!
21 {
27  public $root_id;
28 
29  public $target = null;
30 
31 
36  public $payment_objects = array();
37 
38 
44  public function ilShopExplorer($tpl, $a_target, $a_ref_id)
45  {
46  global $tree;
47 
48  $this->tree = $tree;
49  $this->tpl = $tpl;
50  $this->target = $a_target;
51 
52  $this->payment_objects = ilPaymentObject::getAllBuyableObjects();
53 
54  $this->tpl->addCss('./Services/Payment/css/shop_tree.css');
55 
56  $this->addFilter("root");
57  $this->addFilter("cat");
58  $this->addFilter('catr');
59  $this->addFilter("grp");
60  $this->addFilter("icrs");
61  $this->addFilter("crs");
62  $this->addFilter('crsr');
63  $this->addFilter('rcrs');
64  $this->addFilter('file');
65  $this->addFilter('tst');
66  $this->addFilter('exc');
67  $this->setFiltered(true);
69 
70  }
71 
72  public function renderTree()
73  {
74  $this->setOutput(0);
75  }
76 
85  public function setOutput($a_parent, $a_depth = 1)
86  {
87  global $ilCtrl, $tree;
88 
89  $this->root_id = $tree->getRootId();
90 
91  if($a_parent < $a_depth)
92  {
93  foreach($this->payment_objects as $ref_id)
94  {
95  $objects = $tree->getPathFull($ref_id);
96 
97  foreach($objects as $object)
98  {
99  if($object['child'] == $this->root_id)
100  {
101  $href = $ilCtrl->getLinkTargetByClass('ilshopgui','');
102 
103  $title ="<span style='white-space:wrap;' class='frmTitle'><a class='small' href='".$href."'>"
104  .stripslashes($object['title'])."</a></span>"
105  ."<div style='white-space:nowrap; margin-bottom:5px;' class='small'></div>";
106 
107  $this->tpl->setVariable('TREE_ROOT_NODE_VARIABLE', 'Node'.$object['child']);
108  $this->tpl->setVariable('TREE_ROOT_NODE_LINK', $title);
109 
110  // Recursive
111  $this->setOutput($object['child'], $a_depth);
112  }
113  else
114  {
115  if($this->checkFilter($object['type']) && ilPaymentObject::_isBuyable($object['ref_id']))
116  {
117 
118  }
119  else
120  if($this->checkFilter($object['type']) && !ilPaymentObject::_isBuyable($object['ref_id']))
121  {
122  $href = $ilCtrl->getLinkTargetByClass('ilshopgui','');
123  $title ="<span style='white-space:wrap;' class='frmTitle'><a class='small' href='".$href."&tree_ref_id=".$object['child']."'>"
124  .stripslashes($object['title'])."</a></span>"
125  ."<div style='white-space:nowrap; margin-bottom:5px;' class='small'></div>";
126 
127  $this->tpl->setCurrentBlock('nodes');
128  $this->tpl->setVariable('NODES_VARNAME', 'Node'.$object['child']);
129  $this->tpl->setVariable('NODES_PARENT_VARNAME', 'Node'.$object['parent']);
130  $this->tpl->setVariable('NODES_LINK', $title);
131  $this->tpl->parseCurrentBlock();
132 
133  // Recursive
134  $this->setOutput($object['child'], $a_depth);
135  }
136  }
137  } //foreach
138  }
139  }
140  } //function
141 
142 
143  public function getOutput()
144  {
145  return true;
146 
147  }
148 
149 } // END class.ilExplorer
150 ?>