ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLMExplorer.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 /*
5 * Explorer View for Learning Modules
6 *
7 * @author Alex Killing <alex.killing@gmx.de>
8 * @version $Id: class.ilLMExplorer.php 25692 2010-09-15 09:44:16Z mwarkus $
9 *
10 * @ingroup ModulesIliasLearningModule
11 */
12 
13 require_once("./classes/class.ilExplorer.php");
14 
15 class ilLMExplorer extends ilExplorer
16 {
17 
23  var $root_id;
24  var $lm_obj;
25  var $output;
26 
33  function ilLMExplorer($a_target,&$a_lm_obj)
34  {
35  parent::ilExplorer($a_target);
36  $this->tree = new ilTree($a_lm_obj->getId());
37  $this->tree->setTableNames('lm_tree','lm_data');
38  $this->tree->setTreeTablePK("lm_id");
39  $this->root_id = $this->tree->readRootId();
40  $this->lm_obj =& $a_lm_obj;
41  $this->order_column = "";
42  $this->setSessionExpandVariable("lmexpand");
43  $this->checkPermissions(false);
44  $this->setPostSort(false);
45  $this->textwidth = 200;
46  }
47 
55  function formatHeader(&$tpl, $a_obj_id,$a_option)
56  {
57  global $lng, $ilias;
58 
59  $tpl->setCurrentBlock("icon");
60  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_lm_s.gif",false, "output", $this->offlineMode()));
61  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_".$this->lm_obj->getType()));
62  $tpl->parseCurrentBlock();
63 
64  $tpl->setCurrentBlock("link");
65  $tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true));
66  $tpl->setVariable("LINK_TARGET", $this->buildLinkTarget("",""));
67  $tpl->setVariable("TARGET", " target=\"".$this->frame_target."\"");
68  $tpl->parseCurrentBlock();
69 
70  $tpl->touchBlock("element");
71  }
72 
80  function isClickable($a_type, $a_obj_id = 0)
81  {
82  global $ilUser;
83  // in this standard implementation
84  // only the type determines, wether an object should be clickable or not
85  // but this method can be overwritten and make use of the ref id
86  // (this happens e.g. in class ilRepositoryExplorerGUI)
87  if ($this->is_clickable[$a_type] == "n")
88  {
89  return false;
90  }
91 
92  // check public access
93  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
94  if (($ilUser->getId() == ANONYMOUS_USER_ID ||
95  ilPaymentObject::_requiresPurchaseToAccess((int)$this->lm_obj->getRefId())) &&
96  !ilLMObject::_isPagePublic($a_obj_id, true))
97  {
98  return false;
99  }
100 
101  return true;
102  }
103 } // END class ilLMExplorer
104 ?>