ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExcIndividualDeadline.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
16 protected $participant_id;
17
21 protected $is_team;
22
26 protected $ass_id;
27
31 protected $db;
32
36 protected $starting_timestamp = 0;
37
42
50 protected function __construct($a_ass_id, $a_participant_id, $a_is_team)
51 {
52 global $DIC;
53 $this->participant_id = $a_participant_id;
54 $this->is_team = $a_is_team;
55 $this->ass_id = $a_ass_id;
56 $this->db = $DIC->database();
57 $this->read();
58 }
59
68 public static function getInstance($a_ass_id, $a_participant_id, $a_is_team = false)
69 {
70 return new self($a_ass_id, $a_participant_id, $a_is_team);
71 }
72
78 public function setStartingTimestamp($a_val)
79 {
80 $this->starting_timestamp = $a_val;
81 }
82
88 public function getStartingTimestamp()
89 {
91 }
92
98 public function setIndividualDeadline($a_val)
99 {
100 $this->individual_deadline = $a_val;
101 }
102
108 public function getIndividualDeadline()
109 {
111 }
112
116 public function read()
117 {
119
120 $set = $ilDB->query(
121 "SELECT * FROM exc_idl " .
122 " WHERE ass_id = " . $this->db->quote($this->ass_id, "integer") .
123 " AND member_id = " . $this->db->quote($this->participant_id, "integer") .
124 " AND is_team = " . $this->db->quote($this->is_team, "integer")
125 );
126 $rec = $this->db->fetchAssoc($set);
127
128 $this->setIndividualDeadline((int) $rec["tstamp"]);
129 $this->setStartingTimestamp((int) $rec["starting_ts"]);
130 }
131
135 public function save()
136 {
138
139 $ilDB->replace(
140 "exc_idl",
141 array(
142 "ass_id" => array("integer", $this->ass_id),
143 "member_id" => array("integer", $this->participant_id),
144 "is_team" => array("integer", $this->is_team)
145 ),
146 array(
147 "tstamp" => array("integer", $this->getIndividualDeadline()),
148 "starting_ts" => array("integer", $this->getStartingTimestamp())
149 )
150 );
151 }
152
156 public function delete()
157 {
159
160 $ilDB->manipulate(
161 "DELETE FROM exc_idl " .
162 " WHERE ass_id = " . $this->db->quote($this->ass_id, "integer") .
163 " AND member_id = " . $this->db->quote($this->participant_id, "integer") .
164 " AND is_team = " . $this->db->quote($this->is_team, "integer")
165 );
166 }
167
168
177 public static function getStartingTimestamps($a_ass_id)
178 {
179 global $DIC;
180
181 $ilDB = $DIC->database();
182 $res = array();
183
184 $set = $ilDB->query("SELECT * FROM exc_idl" .
185 " WHERE ass_id = " . $ilDB->quote($a_ass_id, "integer"));
186 while ($row = $ilDB->fetchAssoc($set)) {
187 $res[] = array("member_id" => $row["member_id"],
188 "is_team" => $row["is_team"],
189 "starting_ts" => $row["starting_ts"]);
190 }
191
192 return $res;
193 }
194}
An exception for terminatinating execution or to throw for unit testing.
static getStartingTimestamps($a_ass_id)
Get starting timestamp data for an assignment.
getStartingTimestamp()
Get starting timestamp.
setIndividualDeadline($a_val)
Set Individual Deadline.
setStartingTimestamp($a_val)
Set starting timestamp.
__construct($a_ass_id, $a_participant_id, $a_is_team)
ilExcIndividualDeadline constructor.
getIndividualDeadline()
Get Individual Deadline.
static getInstance($a_ass_id, $a_participant_id, $a_is_team=false)
Get instance.
$row
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB