55 $query =
"SELECT * FROM usr_starting_point WHERE id = " .
$ilDB->quote($a_id,
'integer');
58 while ($point =
$ilDB->fetchAssoc(
$res)) {
77 $this->starting_point = $a_starting_point;
99 $this->starting_object = $a_starting_object;
121 $this->starting_position = $a_starting_position;
143 $this->rule_type = $a_rule_type;
165 $this->rule_options = $a_rule_options;
229 $query =
"SELECT * FROM usr_starting_point";
232 while ($point =
$ilDB->fetchAssoc(
$res)) {
234 "id" => $point[
"id"],
235 "position" => $point[
"position"],
236 "starting_point" => $point[
'starting_point'],
237 "starting_object" => $point[
'starting_object'],
238 "calendar_view" => $point[
'calendar_view'],
239 "calendar_period" => $point[
'calendar_period'],
240 "rule_type" => $point[
'rule_type'],
241 "rule_options" => $point[
'rule_options']
254 foreach (self::getRolesWithStartingPoint() as $roleId =>
$data) {
255 if ((
int) $roleId === (
int) $role->
getId()) {
256 $sp =
new self((int)
$data[
'id']);
260 !($maybeDeletedRole instanceof
ilObjRole)
262 $sp =
new self((int)
$data[
'id']);
278 $query =
"SELECT * FROM usr_starting_point WHERE rule_options LIKE %s";
283 $options = unserialize($sp[
'rule_options']);
285 $roles[$options[
'role_id']] = array(
287 "starting_point" => $sp[
'starting_point'],
288 "starting_object" => $sp[
'starting_object'],
289 "calendar_view" => $sp[
'calendar_view'],
290 "calendar_period" => $sp[
'calendar_period'],
291 "position" => $sp[
'position'],
292 "role_id" => $options[
'role_id'],
307 $rbacreview =
$DIC[
'rbacreview'];
309 require_once
"./Services/AccessControl/classes/class.ilObjRole.php";
311 $global_roles = $rbacreview->getGlobalRoles();
315 $ids_roles_with_sp = array();
316 foreach ($roles_with_starting_point as $role) {
317 array_push($ids_roles_with_sp, $role[
'role_id']);
320 $ids_roles_without_sp = array_diff($global_roles, $ids_roles_with_sp);
323 foreach ($ids_roles_without_sp as $roleid) {
329 "id" => $role_obj->getId(),
330 "title" => $role_obj->getTitle(),
348 $position = $max_position + 10;
350 $next_id =
$ilDB->nextId(
'usr_starting_point');
363 "INSERT INTO usr_starting_point (id, starting_point, starting_object, position, rule_type, rule_options, calendar_view, calendar_period) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
379 'UPDATE usr_starting_point
380 SET starting_point = %s,
381 starting_object = %s,
397 public function delete()
403 $query =
"DELETE FROM usr_starting_point WHERE id = " .
$ilDB->quote($this->
id,
"integer");
419 $result =
$ilDB->query(
"SELECT max(position) as max_order FROM usr_starting_point");
422 $order_val = (int) $row[
'max_order'];
435 foreach ($a_items as $k => $v) {
436 $v[
'starting_position'] = $ord_const;
437 $rearranged[$ord_const] = $v;
438 $ord_const = $ord_const + 10;
455 foreach ($a_items as
$id => $position) {
456 if ($position > self::ORDER_POSITION_MIN && $position < self::ORDER_POSITION_MAX) {
458 "UPDATE usr_starting_point SET" .
459 " position = " .
$ilDB->quote($nr,
'integer') .
460 " WHERE id = " .
$ilDB->quote(
$id,
'integer')
An exception for terminatinating execution or to throw for unit testing.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getId()
get object id @access public
getCalendarView()
Gets calendar view.
save()
insert starting point into database
getPosition()
Gets the starting point position.
getStartingObject()
Gets the starting object.
static getRolesWithStartingPoint()
get array with all roles which have starting point defined.
setStartingObject($a_starting_object)
Sets the starting object.
update()
update starting point
setData($a_id)
Set data for the starting point.
static getStartingPoints()
Get all the starting points in database.
getRuleType()
Gets the rule type.
setPosition($a_starting_position)
Sets the starting position.
setRuleOptions($a_rule_options)
Sets rule type options.
getCalendarPeriod()
Gets calendar Period.
getRuleOptions()
Gets the rule options.
setRuleType($a_rule_type)
Sets rule type.
saveOrder($a_items)
Save all starting point positions.
setCalendarPeriod(int $calendar_period)
Sets calendar Period.
const USER_SELECTION_RULE
static onRoleDeleted(ilObjRole $role)
getStartingPoint()
Gets the starting point.
setCalendarView(int $calendar_view)
Sets calendar view.
setStartingPoint($a_starting_point)
Sets the starting point.
static reArrangePositions($a_items)
static getGlobalRolesWithoutStartingPoint()
Get id and title of the roles without starting points.
__construct($a_id=0)
Constructor.
foreach($_POST as $key=> $value) $res