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

Class ilObjSurveyAccess. More...

+ Inheritance diagram for ilObjSurveyAccess:
+ Collaboration diagram for ilObjSurveyAccess:

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
 _lookupCreationComplete ($a_obj_id)
 checks wether all necessary parts of the survey are given
 _lookupEvaluationAccess ($a_obj_id)
 get evaluation access
 _isSurveyParticipant ($user_id, $survey_id)
 _lookupAnonymize ($a_obj_id)
 _hasEvaluationAccess ($a_obj_id, $user_id)
 _lookupOnline ($a_obj_id)
 get status
 _lookupFinished ($a_obj_id, $a_user_id="")
 get finished status
 _lookup360Mode ($a_obj_id)
 _checkGoto ($a_target)
 check whether goto script will succeed
- Public Member Functions inherited from ilObjectAccess
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data.

Static Public Member Functions

static getConditionOperators ()
 Get possible conditions operators.
static checkCondition ($a_svy_id, $a_operator, $a_value, $a_usr_id)
 check condition
- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten.

Detailed Description

Member Function Documentation

ilObjSurveyAccess::_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)

Please do not check any preconditions handled by ilConditionHandler here.

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 98 of file class.ilObjSurveyAccess.php.

References $ilUser, $lng, _hasEvaluationAccess(), _lookupCreationComplete(), _lookupOnline(), and IL_NO_OBJECT_ACCESS.

{
global $ilUser, $lng, $rbacsystem, $ilAccess;
if ($a_user_id == "")
{
$a_user_id = $ilUser->getId();
}
$is_admin = $rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id);
// check "global" online switch
if(!self::_lookupOnline($a_obj_id) && !$is_admin)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
return false;
}
switch ($a_permission)
{
case "visible":
case "read":
!$is_admin)
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
return false;
}
break;
}
switch ($a_cmd)
{
case "run":
|| !(ilObjSurveyAccess::_lookupOnline($a_obj_id) == 1))
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
return false;
}
break;
case "evaluation":
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
return false;
}
if ($rbacsystem->checkAccess("write",$a_ref_id) || ilObjSurveyAccess::_hasEvaluationAccess($a_obj_id, $a_user_id))
{
return true;
}
else
{
$ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("status_no_permission"));
return false;
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjSurveyAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 409 of file class.ilObjSurveyAccess.php.

References $_GET, and ilObjSurvey\validateExternalRaterCode().

{
global $ilAccess;
$t_arr = explode("_", $a_target);
if ($t_arr[0] != "svy" || ((int) $t_arr[1]) <= 0)
{
return false;
}
// 360° external raters
if ($_GET["accesscode"])
{
include_once "Modules/Survey/classes/class.ilObjSurvey.php";
if(ilObjSurvey::validateExternalRaterCode($t_arr[1], $_GET["accesscode"]))
{
return true;
}
}
if ($ilAccess->checkAccess("read", "", $t_arr[1]))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilObjSurveyAccess::_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 174 of file class.ilObjSurveyAccess.php.

Referenced by ilObjSurveyListGUI\init().

{
$commands = array
(
array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "svy_run", "default" => true),
array("permission" => "write", "cmd" => "questionsrepo", "lang_var" => "edit_questions"),
array("permission" => "write", "cmd" => "properties", "lang_var" => "settings"),
array("permission" => "read", "cmd" => "evaluation", "lang_var" => "svy_results")
);
return $commands;
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_hasEvaluationAccess (   $a_obj_id,
  $user_id 
)

Definition at line 263 of file class.ilObjSurveyAccess.php.

References $ilDB, $result, $row, _isSurveyParticipant(), _lookupAnonymize(), _lookupEvaluationAccess(), ilObjSurvey\RESULTS_360_ALL, ilObjSurvey\RESULTS_360_NONE, and ilObjSurvey\RESULTS_360_OWN.

Referenced by _checkAccess(), ilSurveyEvaluationGUI\checkAnonymizedEvaluationAccess(), ilObjSurveyGUI\getTabs(), and ilObjSurveyGUI\infoScreen().

{
$evaluation_access = ilObjSurveyAccess::_lookupEvaluationAccess($a_obj_id);
switch ($evaluation_access)
{
case 0:
// no evaluation access
return false;
break;
case 1:
// evaluation access for all registered users
if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID))
{
return true;
}
else
{
return false;
}
break;
case 2:
if(!self::_lookup360Mode($a_obj_id))
{
// evaluation access for participants
// check if the user with the given id is a survey participant
// show the evaluation button for anonymized surveys for all users
// access is only granted with the survey access code
if (ilObjSurveyAccess::_lookupAnonymize($a_obj_id) == 1) return true;
global $ilDB;
$result = $ilDB->queryF("SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
if (ilObjSurveyAccess::_isSurveyParticipant($user_id, $row["survey_id"]))
{
return true;
}
}
return false;
}
// 360°
else
{
include_once "Modules/Survey/classes/class.ilObjSurvey.php";
$svy = new ilObjSurvey($a_obj_id, false);
$svy->read();
switch($svy->get360Results())
{
return false;
return $svy->isAppraiseeClosed($user_id);
return $svy->isAppraisee($user_id);
}
}
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurveyAccess::_isSurveyParticipant (   $user_id,
  $survey_id 
)

Definition at line 233 of file class.ilObjSurveyAccess.php.

References $ilDB, and $result.

Referenced by _hasEvaluationAccess().

{
global $ilDB;
$result = $ilDB->queryF("SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
array('integer','integer'),
array($user_id, $survey_id)
);
return ($result->numRows() == 1) ? true : false;
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookup360Mode (   $a_obj_id)

Definition at line 394 of file class.ilObjSurveyAccess.php.

References $ilDB, and $result.

Referenced by ilObjSurveyListGUI\getProperties().

{
global $ilDB;
$result = $ilDB->queryF("SELECT mode_360 FROM svy_svy".
" WHERE obj_fi = %s AND mode_360 = %s",
array('integer','integer'),
array($a_obj_id, 1)
);
return (bool)$ilDB->numRows($result);
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookupAnonymize (   $a_obj_id)

Definition at line 244 of file class.ilObjSurveyAccess.php.

References $ilDB, $result, and $row.

Referenced by _hasEvaluationAccess().

{
global $ilDB;
$result = $ilDB->queryF("SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
return $row["anonymize"];
}
else
{
return 0;
}
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookupCreationComplete (   $a_obj_id)

checks wether all necessary parts of the survey are given

Definition at line 194 of file class.ilObjSurveyAccess.php.

References $ilDB, $result, and $row.

Referenced by _checkAccess(), and ilObjSurveyListGUI\getProperties().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy WHERE obj_fi=%s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
}
if (!$row["complete"])
{
return false;
}
return true;
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookupEvaluationAccess (   $a_obj_id)

get evaluation access

Definition at line 217 of file class.ilObjSurveyAccess.php.

References $ilDB, $result, and $row.

Referenced by _hasEvaluationAccess().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy WHERE obj_fi=%s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchAssoc($result);
}
return $row["evaluation_access"];
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookupFinished (   $a_obj_id,
  $a_user_id = "" 
)

get finished status

Parameters
int$a_obj_idsurvey id

Definition at line 354 of file class.ilObjSurveyAccess.php.

References $ilDB, $ilUser, $result, and $row.

Referenced by checkCondition(), ilObjSurveyListGUI\getProperties(), ilContainerStartObjects\isFullfilled(), and ilCourseStart\isFullfilled().

{
global $ilDB, $ilUser;
$finished = "";
if (!strlen($a_user_id)) $a_user_id = $ilUser->getId();
$result = $ilDB->queryF("SELECT * FROM svy_svy WHERE obj_fi = %s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1)
{
$row = $ilDB->fetchObject($result);
if ($row->anonymize == 1)
{
$result = $ilDB->queryF("SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s ".
"AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s ".
"AND svy_anonymous.survey_key = svy_finished.anonymous_id",
array('integer','text'),
array($row->survey_id, md5($a_user_id))
);
}
else
{
$result = $ilDB->queryF("SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
array('integer','integer'),
array($row->survey_id, $a_user_id)
);
}
if ($result->numRows() == 1)
{
$foundrow = $ilDB->fetchAssoc($result);
$finished = (int)$foundrow["state"];
}
}
return $finished;
}

+ Here is the caller graph for this function:

ilObjSurveyAccess::_lookupOnline (   $a_obj_id)

get status

Definition at line 334 of file class.ilObjSurveyAccess.php.

References $ilDB, $result, and $row.

Referenced by _checkAccess(), and ilObjSurveyListGUI\getProperties().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM svy_svy WHERE obj_fi=%s",
array('integer'),
array($a_obj_id)
);
if ($result->numRows() == 1) {
$row = $ilDB->fetchAssoc($result);
}
return $row["status"];
}

+ Here is the caller graph for this function:

static ilObjSurveyAccess::checkCondition (   $a_svy_id,
  $a_operator,
  $a_value,
  $a_usr_id 
)
static

check condition

Parameters
type$a_svy_id
type$a_operator
type$a_value
type$a_usr_id
Returns
boolean

Implements ilConditionHandling.

Definition at line 60 of file class.ilObjSurveyAccess.php.

References _lookupFinished(), and ilConditionHandler\OPERATOR_FINISHED.

{
switch($a_operator)
{
//if (ilExerciseMembers::_lookupStatus($a_exc_id, $ilias->account->getId()) == "passed")
include_once("./Modules/Survey/classes/class.ilObjSurveyAccess.php");
if (ilObjSurveyAccess::_lookupFinished($a_svy_id, $a_usr_id))
{
return true;
}
else
{
return false;
}
break;
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

static ilObjSurveyAccess::getConditionOperators ( )
static

Get possible conditions operators.

Implements ilConditionHandling.

Definition at line 43 of file class.ilObjSurveyAccess.php.

References ilConditionHandler\OPERATOR_FINISHED.

{
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
return array(
);
}

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