ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjExerciseAccess.php
Go to the documentation of this file.
1 <?php
2 
23 {
28  public static function getConditionOperators(): array
29  {
30  return array(
33  );
34  }
35 
36 
40  public static function checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id): bool
41  {
42  switch ($a_operator) {
44  return ilExerciseMembers::_lookupStatus($a_trigger_obj_id, $a_usr_id) == "passed";
45 
47  return ilExerciseMembers::_lookupStatus($a_trigger_obj_id, $a_usr_id) == 'failed';
48 
49  default:
50  return true;
51  }
52  }
53 
54 
67  public static function _getCommands(): array
68  {
69  return array(
70  array("permission" => "read", "cmd" => "showOverview", "lang_var" => "show",
71  "default" => true),
72  array("permission" => "write", "cmd" => "listAssignments", "lang_var" => "edit_assignments"),
73  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
74  );
75  }
76 
80  public static function _lookupRemainingWorkingTimeString(
81  int $a_obj_id
82  ): array {
83  global $DIC;
84 
85  $ilDB = $DIC->database();
86 
87  // #14077 - mind peer deadline, too
88 
89  $dl = null;
90  $cnt = array();
91 
92  $q = "SELECT id, time_stamp, deadline2, peer_dl" .
93  " FROM exc_assignment WHERE exc_id = " . $ilDB->quote($a_obj_id, "integer") .
94  " AND (time_stamp > " . $ilDB->quote(time(), "integer") .
95  " OR (peer_dl > " . $ilDB->quote(time(), "integer") .
96  " AND peer > " . $ilDB->quote(0, "integer") . "))";
97  $set = $ilDB->query($q);
98  while ($row = $ilDB->fetchAssoc($set)) {
99  if ($row["time_stamp"] > time() &&
100  ($row["time_stamp"] < $dl || !$dl)) {
101  $dl = $row["time_stamp"];
102  }
103  /* extended deadline should not be presented anywhere
104  if($row["deadline2"] > time() &&
105  ($row["deadline2"] < $dl || !$dl))
106  {
107  $dl = $row["deadline2"];
108  }
109  */
110  if ($row["peer_dl"] > time() &&
111  ($row["peer_dl"] < $dl || !$dl)) {
112  $dl = $row["peer_dl"];
113  }
114  $cnt[$row["id"]] = true;
115  }
116 
117  // :TODO: mind personal deadline?
118 
119  if ($dl) {
121  }
122 
123  return array(
124  "mtime" => $dl,
125  "cnt" => count($cnt)
126  );
127  }
128 
132  public static function _checkGoto($a_target): bool
133  {
134  global $DIC;
135 
136  $ilAccess = $DIC->access();
137 
138  $t_arr = explode("_", $a_target);
139 
140  if ($t_arr[0] != "exc" || ((int) $t_arr[1]) <= 0) {
141  return false;
142  }
143  return $ilAccess->checkAccess("read", "", $t_arr[1]) ||
144  $ilAccess->checkAccess("visible", "", $t_arr[1]);
145  }
146 
147  public function canBeDelivered(ilWACPath $ilWACPath): bool
148  {
149  return true;
150  }
151 }
static _checkGoto($a_target)
check whether goto script will succeed
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
static getConditionOperators()
Get possible conditions operators.
Interface for condition handling.
canBeDelivered(ilWACPath $ilWACPath)
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current status (notgraded|passed|failed)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getCommands()
get commands
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition
static _lookupRemainingWorkingTimeString(int $a_obj_id)