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;
186 $ilDB = $DIC[
'ilDB'];
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']);
233 $ilDB = $DIC[
'ilDB'];
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();
268 $roles_with_starting_point = self::getRolesWithStartingPoint();
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(),
296 $ilDB = $DIC[
'ilDB'];
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'),
326 $ilDB = $DIC[
'ilDB'];
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()
349 $ilDB = $DIC[
'ilDB'];
351 $query =
"DELETE FROM usr_starting_point WHERE id = " .
$ilDB->quote($this->
id,
"integer");
364 $ilDB = $DIC[
'ilDB'];
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;
399 $ilDB = $DIC[
'ilDB'];
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')
setRuleOptions($a_rule_options)
Sets rule type options.
setStartingObject($a_starting_object)
Sets the starting object.
static getStartingPoints()
Get all the starting points in database.
setData($a_id)
Set data for the starting point.
static onRoleDeleted(ilObjRole $role)
update()
update starting point
save()
insert starting point into database
getRuleOptions()
Gets the rule options.
static getRolesWithStartingPoint()
get array with all roles which have starting point defined.
static getGlobalRolesWithoutStartingPoint()
Get id and title of the roles without starting points.
getStartingObject()
Gets the starting object.
getPosition()
Gets the starting point position.
foreach($_POST as $key=> $value) $res
setPosition($a_starting_position)
Sets the starting position.
getId()
get object id public
const USER_SELECTION_RULE
setStartingPoint($a_starting_point)
Sets the starting point.
saveOrder($a_items)
Save all starting point positions.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getRuleType()
Gets the rule type.
__construct($a_id=0)
Constructor.
static reArrangePositions($a_items)
getStartingPoint()
Gets the starting point.
setRuleType($a_rule_type)
Sets rule type.