ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjExerciseAccess.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("classes/class.ilObjectAccess.php");
25 
36 {
37 
50  function _getCommands()
51  {
52  $commands = array
53  (
54  array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "show",
55  "default" => true),
56  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
57  );
58 
59  return $commands;
60  }
61 
63  {
64  global $ilDB, $lng;
65 
66  $q = "SELECT time_stamp FROM exc_data WHERE obj_id = ".
67  $ilDB->quote($a_obj_id);
68  $set = $ilDB->query($q);
69  $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
70 
71  if ($rec["time_stamp"] - time() <= 0)
72  {
73  $time_str = $lng->txt("exc_time_over_short");
74  }
75  else
76  {
77  $time_diff = ilUtil::int2array($rec["time_stamp"] - time(), null);
78  $time_str = ilUtil::timearray2string($time_diff);
79  }
80  return $time_str;
81  }
82 
86  function _checkGoto($a_target)
87  {
88  global $ilAccess;
89 
90  $t_arr = explode("_", $a_target);
91 
92  if ($t_arr[0] != "exc" || ((int) $t_arr[1]) <= 0)
93  {
94  return false;
95  }
96 
97  if ($ilAccess->checkAccess("read", "", $t_arr[1]))
98  {
99  return true;
100  }
101  return false;
102  }
103 }
104 
105 ?>