ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjGroupAccess Class Reference

Class ilObjGroupAccess. More...

+ Inheritance diagram for ilObjGroupAccess:
+ Collaboration diagram for ilObjGroupAccess:

Public Member Functions

 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)
 _getCommands ()
 get commands
 _checkGoto ($a_target)
 check whether goto script will succeed
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data.
- Public Member Functions inherited from ilObjectAccess
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition

Static Public Member Functions

static _registrationEnabled ($a_obj_id)
static lookupRegistrationInfo ($a_obj_id)
 Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.
static _usingRegistrationCode ()
 Using Registration code.
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten.

Static Protected Attributes

static $using_code = false

Detailed Description

Class ilObjGroupAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilObjGroupAccess.php 57377 2015-01-22 16:21:31Z fwolf

Definition at line 15 of file class.ilObjGroupAccess.php.

Member Function Documentation

ilObjGroupAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

Definition at line 30 of file class.ilObjGroupAccess.php.

References $ilUser, $lng, ilWaitingList\_isOnList(), and ilGroupParticipants\_isParticipant().

{
global $ilUser, $lng, $rbacsystem, $ilAccess;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
switch ($a_cmd)
{
case "info":
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
if(ilGroupParticipants::_isParticipant($a_ref_id,$a_user_id))
{
$ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_member"));
}
else
{
$ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("info_is_not_member"));
}
break;
case "join":
if(!self::_registrationEnabled($a_obj_id))
{
return false;
}
include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
if(ilGroupWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
{
return false;
}
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
if(ilGroupParticipants::_isParticipant($a_ref_id,$a_user_id))
{
return false;
}
break;
case 'leave':
// Regular member
if($a_permission == 'leave')
{
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
if(!ilGroupParticipants::_isParticipant($a_ref_id, $a_user_id))
{
return false;
}
}
// Waiting list
if($a_permission == 'join')
{
include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
if(!ilGroupWaitingList::_isOnList($ilUser->getId(), $a_obj_id))
{
return false;
}
}
break;
}
switch ($a_permission)
{
}
return true;
}

+ Here is the call graph for this function:

ilObjGroupAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 165 of file class.ilObjGroupAccess.php.

References $ilUser.

{
global $ilAccess,$ilUser;
$t_arr = explode("_", $a_target);
// registration codes
if(substr($t_arr[2],0,5) == 'rcode' and $ilUser->getId() != ANONYMOUS_USER_ID)
{
self::$using_code = true;
return true;
}
if ($t_arr[0] != "grp" || ((int) $t_arr[1]) <= 0)
{
return false;
}
if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
$ilAccess->checkAccess("visible", "", $t_arr[1]))
{
return true;
}
return false;
}
ilObjGroupAccess::_getCommands ( )

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Reimplemented from ilObjectAccess.

Definition at line 118 of file class.ilObjGroupAccess.php.

References ilDAVActivationChecker\_isActive(), ilFMSettings\getInstance(), and ilDAVUtils\getInstance().

Referenced by ilObjGroupListGUI\init().

{
$commands = array();
$commands[] = array("permission" => "grp_linked", "cmd" => "", "lang_var" => "show", "default" => true);
include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
if(ilFMSettings::getInstance()->isEnabled())
{
$commands[] = array(
'permission' => 'read',
'cmd' => 'fileManagerLaunch',
'lang_var' => 'fm_start',
'enable_anonymous' => false
);
}
$commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
// on waiting list
$commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
// regualar users
$commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "grp_btn_unsubscribe");
include_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
{
include_once './Services/WebDAV/classes/class.ilDAVUtils.php';
if(ilDAVUtils::getInstance()->isLocalPasswordInstructionRequired())
{
$commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
}
else
{
$commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
}
}
$commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
$commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
return $commands;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjGroupAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 239 of file class.ilObjGroupAccess.php.

References $ilDB, $ilUser, and ilWaitingList\_preloadOnListInfo().

{
global $ilDB, $ilUser;
include_once("./Modules/Group/classes/class.ilGroupWaitingList.php");
ilGroupWaitingList::_preloadOnListInfo($ilUser->getId(), $a_obj_ids);
}

+ Here is the call graph for this function:

static ilObjGroupAccess::_registrationEnabled (   $a_obj_id)
static
Returns
Parameters
object$a_obj_id

Definition at line 195 of file class.ilObjGroupAccess.php.

References $ilDB, $query, $res, $row, ilDateTime\_after(), ilDateTime\_before(), DB_FETCHMODE_OBJECT, IL_CAL_DATETIME, and IL_CAL_UNIX.

{
global $ilDB;
$query = "SELECT * FROM grp_settings ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
$enabled = $unlimited = false;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$enabled = $row->registration_enabled;
$unlimited = $row->registration_unlimited;
$start = $row->registration_start;
$end = $row->registration_end;
}
if(!$enabled)
{
return false;
}
if($unlimited)
{
return true;
}
if(!$unlimited)
{
$start = new ilDateTime($start,IL_CAL_DATETIME);
$end = new ilDateTime($end,IL_CAL_DATETIME);
$time = new ilDateTime(time(),IL_CAL_UNIX);
return ilDateTime::_after($time, $start) and ilDateTime::_before($time,$end);
}
return false;
}

+ Here is the call graph for this function:

static ilObjGroupAccess::_usingRegistrationCode ( )
static

Using Registration code.

Returns
bool

Definition at line 349 of file class.ilObjGroupAccess.php.

References $using_code.

Referenced by ilObjGroup\register().

{
}

+ Here is the caller graph for this function:

static ilObjGroupAccess::lookupRegistrationInfo (   $a_obj_id)
static

Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.

Parameters
int$a_obj_id
Returns
array

Definition at line 255 of file class.ilObjGroupAccess.php.

References $ilDB, $ilUser, $lng, $query, $res, $row, ilDateTime\_before(), ilGroupParticipants\_getInstanceByObjId(), DB_FETCHMODE_OBJECT, ilDatePresentation\formatDate(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by ilObjGroupListGUI\getProperties().

{
global $ilDB, $ilUser, $lng;
$query = 'SELECT registration_type, registration_enabled, registration_unlimited, registration_start, '.
'registration_end, registration_mem_limit, registration_max_members FROM grp_settings '.
'WHERE obj_id = '.$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
$info = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$info['reg_info_start'] = new ilDateTime($row->registration_start, IL_CAL_DATETIME);
$info['reg_info_end'] = new ilDateTime($row->registration_end, IL_CAL_DATETIME);
$info['reg_info_type'] = $row->registration_type;
$info['reg_info_max_members'] = $row->registration_max_members;
$info['reg_info_mem_limit'] = $row->registration_mem_limit;
$info['reg_info_unlimited'] = $row->registration_unlimited;
$info['reg_info_max_members'] = 0;
if($info['reg_info_mem_limit'])
{
$info['reg_info_max_members'] = $row->registration_max_members;
}
$info['reg_info_enabled'] = $row->registration_enabled;
}
$registration_possible = $info['reg_info_enabled'];
// Limited registration (added $registration_possible, see bug 0010157)
if(!$info['reg_info_unlimited'] && $registration_possible)
{
$dt = new ilDateTime(time(),IL_CAL_UNIX);
if(ilDateTime::_before($dt, $info['reg_info_start']))
{
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_start');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
}
elseif(ilDateTime::_before($dt, $info['reg_info_end']))
{
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_end');
$info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
}
else
{
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('grp_list_reg_noreg');
}
}
else
{
// added !$registration_possible, see bug 0010157
if (!$registration_possible)
{
$registration_possible = false;
$info['reg_info_list_prop']['property'] = $lng->txt('grp_list_reg_period');
$info['reg_info_list_prop']['value'] = $lng->txt('grp_list_reg_noreg');
}
}
if($info['reg_info_mem_limit'] && $registration_possible)
{
// Check if users are on waiting list
// @todo
// Check for free places
include_once './Modules/Group/classes/class.ilGroupParticipants.php';
if($part->getCountMembers() <= $info['reg_info_max_members'])
{
$info['reg_info_list_prop_limit']['property'] = $lng->txt('grp_list_reg_limit_places');
$info['reg_info_list_prop_limit']['value'] = max(
0,
$info['reg_info_max_members'] - $part->getCountMembers()
);
}
else
{
$info['reg_info_list_prop_limit']['property'] = '';
$info['reg_info_list_prop_limit']['value'] = $lng->txt('grp_list_reg_limit_full');
}
}
return $info;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjGroupAccess::$using_code = false
staticprotected

Definition at line 17 of file class.ilObjGroupAccess.php.

Referenced by _usingRegistrationCode().


The documentation for this class was generated from the following file: