ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLinkResourceAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("classes/class.ilObjectAccess.php");
6 
17 {
18  static $item = array();
19 
32  function _getCommands()
33  {
34  $commands = array
35  (
36  array("permission" => "read", "cmd" => "", "lang_var" => "show",
37  "default" => true),
38  array("permission" => "write", "cmd" => "editLinks", "lang_var" => "edit")
39  );
40 
41  return $commands;
42  }
43 
47  function _checkGoto($a_target)
48  {
49  global $ilAccess;
50 
51  $t_arr = explode("_", $a_target);
52 
53  if ($t_arr[0] != "webr" || ((int) $t_arr[1]) <= 0)
54  {
55  return false;
56  }
57 
58  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
59  $ilAccess->checkAccess("visible", "", $t_arr[1]))
60  {
61  return true;
62  }
63  return false;
64  }
65 
74  public static function _getFirstLink($a_webr_id)
75  {
76  global $ilDB;
77 
78  if (isset(self::$item[$a_webr_id]))
79  {
80  return self::$item[$a_webr_id];
81  }
82  $res = $ilDB->query("SELECT * FROM webr_items WHERE webr_id = ".
83  $ilDB->quote($a_webr_id ,'integer')." AND active = '1'");
84  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
85  {
86  $item['title'] = $row->title;
87  $item['description'] = $row->description;
88  $item['target'] = $row->target;
89  $item['active'] = (bool) $row->active;
90  $item['disable_check'] = $row->disable_check;
91  $item['create_date'] = $row->create_date;
92  $item['last_update'] = $row->last_update;
93  $item['last_check'] = $row->last_check;
94  $item['valid'] = $row->valid;
95  $item['link_id'] = $row->link_id;
96  self::$item[$row->webr_id] = $item;
97  }
98  return $item ? $item : array();
99  }
100 
106  function _preloadData($a_obj_ids, $a_ref_ids)
107  {
108  global $ilDB, $ilUser;
109 
110  $res = $ilDB->query("SELECT * FROM webr_items WHERE ".
111  $ilDB->in("webr_id", $a_obj_ids, false, "integer").
112  " AND active = '1'");
113  foreach ($a_obj_ids as $id)
114  {
115  self::$item[$id] = array();
116  }
117  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
118  {
119  $item['title'] = $row->title;
120  $item['description'] = $row->description;
121  $item['target'] = $row->target;
122  $item['active'] = (bool) $row->active;
123  $item['disable_check'] = $row->disable_check;
124  $item['create_date'] = $row->create_date;
125  $item['last_update'] = $row->last_update;
126  $item['last_check'] = $row->last_check;
127  $item['valid'] = $row->valid;
128  $item['link_id'] = $row->link_id;
129  self::$item[$row->webr_id] = $item;
130  }
131  }
132 
133 }
134 
135 ?>