55 $query =
"SELECT * FROM usr_starting_point WHERE id = " .
$ilDB->quote($a_id,
'integer');
58 while ($point =
$ilDB->fetchAssoc(
$res)) {
75 $this->starting_point = $a_starting_point;
97 $this->starting_object = $a_starting_object;
119 $this->starting_position = $a_starting_position;
141 $this->rule_type = $a_rule_type;
163 $this->rule_options = $a_rule_options;
188 $query =
"SELECT * FROM usr_starting_point";
191 while ($point =
$ilDB->fetchAssoc(
$res)) {
193 "id" => $point[
"id"],
194 "position" => $point[
"position"],
195 "starting_point" => $point[
'starting_point'],
196 "starting_object" => $point[
'starting_object'],
197 "rule_type" => $point[
'rule_type'],
198 "rule_options" => $point[
'rule_options']
211 foreach (self::getRolesWithStartingPoint() as $roleId =>
$data) {
212 if ((
int) $roleId === (
int) $role->
getId()) {
213 $sp =
new self((int)
$data[
'id']);
217 !($maybeDeletedRole instanceof
ilObjRole)
219 $sp =
new self((int)
$data[
'id']);
235 $query =
"SELECT * FROM usr_starting_point WHERE rule_options LIKE %s";
240 $options = unserialize($sp[
'rule_options']);
242 $roles[$options[
'role_id']] = array(
244 "starting_point" => $sp[
'starting_point'],
245 "starting_object" => $sp[
'starting_object'],
246 "position" => $sp[
'position'],
247 "role_id" => $options[
'role_id'],
262 $rbacreview =
$DIC[
'rbacreview'];
264 require_once
"./Services/AccessControl/classes/class.ilObjRole.php";
266 $global_roles = $rbacreview->getGlobalRoles();
270 $ids_roles_with_sp = array();
271 foreach ($roles_with_starting_point as $role) {
272 array_push($ids_roles_with_sp, $role[
'role_id']);
275 $ids_roles_without_sp = array_diff($global_roles, $ids_roles_with_sp);
278 foreach ($ids_roles_without_sp as $roleid) {
281 "id" => $role_obj->getId(),
282 "title" => $role_obj->getTitle(),
300 $position = $max_position + 10;
302 $next_id =
$ilDB->nextId(
'usr_starting_point');
313 "INSERT INTO usr_starting_point (id, starting_point, starting_object, position, rule_type, rule_options) VALUES (%s, %s, %s, %s, %s, %s)",
314 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'text'),
329 'UPDATE usr_starting_point
330 SET starting_point = %s,
331 starting_object = %s,
336 array(
'integer',
'integer',
'integer',
'integer',
'text',
'integer'),
345 public function delete()
351 $query =
"DELETE FROM usr_starting_point WHERE id = " .
$ilDB->quote($this->
id,
"integer");
367 $result =
$ilDB->query(
"SELECT max(position) as max_order FROM usr_starting_point");
370 $order_val = (int) $row[
'max_order'];
383 foreach ($a_items as $k => $v) {
384 $v[
'starting_position'] = $ord_const;
385 $rearranged[$ord_const] = $v;
386 $ord_const = $ord_const + 10;
403 foreach ($a_items as
$id => $position) {
404 if ($position > self::ORDER_POSITION_MIN && $position < self::ORDER_POSITION_MAX) {
406 "UPDATE usr_starting_point SET" .
407 " position = " .
$ilDB->quote($nr,
'integer') .
408 " 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
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.
getRuleOptions()
Gets the rule options.
setRuleType($a_rule_type)
Sets rule type.
saveOrder($a_items)
Save all starting point positions.
const USER_SELECTION_RULE
static onRoleDeleted(ilObjRole $role)
getStartingPoint()
Gets the starting point.
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