ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjContentObjectAccess Class Reference

Class ilObjContentObjectAccess. More...

+ Inheritance diagram for ilObjContentObjectAccess:
+ Collaboration diagram for ilObjContentObjectAccess:

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)
 _lookupOnline ($a_id)
 check wether learning module is online
 _getLastAccessedPage ($a_ref_id, $a_user_id="")
 get last accessed page
 _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=0)
 check condition
 _getCommands ()
 get commands

Static Public Member Functions

static _isOffline ($a_obj_id)
 Type-specific implementation of general status.

Static Public Attributes

static $online
static $lo_access

Detailed Description

Class ilObjContentObjectAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilObjContentObjectAccess.php 33501 2012-03-03 11:11:05Z akill

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

Member Function Documentation

ilObjContentObjectAccess::_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 34 of file class.ilObjContentObjectAccess.php.

References $ilUser, $lng, _getLastAccessedPage(), _lookupOnline(), and IL_NO_OBJECT_ACCESS.

{
global $ilUser, $lng, $rbacsystem, $ilAccess;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
switch ($a_cmd)
{
case "view":
&& !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
break;
case "continue":
// no continue command for anonymous user
if ($ilUser->getId() == ANONYMOUS_USER_ID)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("lm_no_continue_for_anonym"));
return false;
}
&& !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
if (ilObjContentObjectAccess::_getLastAccessedPage($a_ref_id,$a_user_id) <= 0)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("not_accessed_yet"));
return false;
}
break;
// for permission query feature
case "info":
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
}
else
{
$ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
}
break;
}
switch ($a_permission)
{
case "read":
case "visible":
(!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjContentObjectAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 182 of file class.ilObjContentObjectAccess.php.

References $ref_id, ilObject\_getAllReferences(), and ilLMObject\_lookupContObjID().

{
global $ilAccess;
$t_arr = explode("_", $a_target);
if (($t_arr[0] != "lm" && $t_arr[0] != "dbk" && $t_arr[0] != "st"
&& $t_arr[0] != "pg")
|| ((int) $t_arr[1]) <= 0)
{
return false;
}
if ($t_arr[0] == "lm" || $t_arr[0] == "dbk")
{
if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
$ilAccess->checkAccess("visible", "", $t_arr[1]))
{
return true;
}
}
else
{
if ($t_arr[2] > 0)
{
$ref_ids = array($t_arr[2]);
}
else
{
// determine learning object
include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
$lm_id = ilLMObject::_lookupContObjID($t_arr[1]);
$ref_ids = ilObject::_getAllReferences($lm_id);
}
// check read permissions
foreach ($ref_ids as $ref_id)
{
// Permission check
if ($ilAccess->checkAccess("read", "", $ref_id))
{
return true;
}
}
}
return false;
}

+ Here is the call graph for this function:

ilObjContentObjectAccess::_getLastAccessedPage (   $a_ref_id,
  $a_user_id = "" 
)

get last accessed page

Parameters
int$a_obj_idcontent object id
int$a_user_iduser object id

Definition at line 141 of file class.ilObjContentObjectAccess.php.

References $ilUser, and ilObject\_lookupObjId().

Referenced by _checkAccess(), ilObjLearningModuleListGUI\initItem(), and ilObjDlBookListGUI\initItem().

{
global $ilDB, $ilUser;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
if (isset(self::$lo_access[$a_ref_id]))
{
$acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
}
else
{
$q = "SELECT * FROM lo_access WHERE ".
"usr_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
"lm_id = ".$ilDB->quote($a_ref_id, "integer");
$acc_set = $ilDB->query($q);
$acc_rec = $ilDB->fetchAssoc($acc_set);
}
if ($acc_rec["obj_id"] > 0)
{
$lm_id = ilObject::_lookupObjId($a_ref_id);
$mtree = new ilTree($lm_id);
$mtree->setTableNames('lm_tree','lm_data');
$mtree->setTreeTablePK("lm_id");
if ($mtree->isInTree($acc_rec["obj_id"]))
{
return $acc_rec["obj_id"];
}
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjContentObjectAccess::_isOffline (   $a_obj_id)
static

Type-specific implementation of general status.

Used in ListGUI and Learning Progress

Parameters
int$a_obj_id
Returns
bool

Reimplemented from ilObjectAccess.

Definition at line 238 of file class.ilObjContentObjectAccess.php.

References _lookupOnline().

Referenced by ilObjDlBookListGUI\getProperties(), and ilObjLearningModuleListGUI\getProperties().

{
return !self::_lookupOnline($a_obj_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjContentObjectAccess::_lookupOnline (   $a_id)

check wether learning module is online

Parameters
int$a_idlearning object id

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

References ilUtil\yn2tf().

Referenced by _checkAccess(), and _isOffline().

{
global $ilDB;
if (isset(self::$online[$a_id]))
{
return self::$online[$a_id];
}
$q = "SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id, "integer");
$lm_set = $ilDB->query($q);
$lm_rec = $ilDB->fetchAssoc($lm_set);
self::$online[$a_id] = ilUtil::yn2tf($lm_rec["is_online"]);
return ilUtil::yn2tf($lm_rec["is_online"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjContentObjectAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 248 of file class.ilObjContentObjectAccess.php.

References $ilUser, and ilUtil\yn2tf().

{
global $ilDB, $ilUser;
$q = "SELECT id, is_online FROM content_object WHERE ".
$ilDB->in("id", $a_obj_ids, false, "integer");
$lm_set = $ilDB->query($q);
while ($rec = $ilDB->fetchAssoc($lm_set))
{
self::$online[$rec["id"]] = ilUtil::yn2tf($rec["is_online"]);
}
$q = "SELECT obj_id, lm_id FROM lo_access WHERE ".
"usr_id = ".$ilDB->quote($ilUser->getId(), "integer")." AND ".
$ilDB->in("lm_id", $a_ref_ids, false, "integer");;
$set = $ilDB->query($q);
foreach ($a_ref_ids as $r)
{
self::$lo_access[$r] = 0;
}
while ($rec = $ilDB->fetchAssoc($set))
{
self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
}
}

+ Here is the call graph for this function:

Field Documentation

ilObjContentObjectAccess::$lo_access
static

Definition at line 20 of file class.ilObjContentObjectAccess.php.

ilObjContentObjectAccess::$online
static

Definition at line 19 of file class.ilObjContentObjectAccess.php.


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