本文整理汇总了PHP中ilObjTest::_getUserIdFromActiveId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::_getUserIdFromActiveId方法的具体用法?PHP ilObjTest::_getUserIdFromActiveId怎么用?PHP ilObjTest::_getUserIdFromActiveId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::_getUserIdFromActiveId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteSingleUserResultsObject
/**
* Asks for a confirmation to delete selected user data of the test object
*
* Asks for a confirmation to delete selected user data of the test object
*
* @access public
*/
function deleteSingleUserResultsObject()
{
if (count($_POST["chbUser"]) == 0) {
ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
$this->ctrl->redirect($this, "participants");
}
include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
$cgui = new ilConfirmationGUI();
$cgui->setHeaderText($this->lng->txt("confirm_delete_single_user_data"));
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteSelectedUserData");
$cgui->setConfirm($this->lng->txt("confirm"), "confirmDeleteSelectedUserData");
include_once './Services/User/classes/class.ilObjUser.php';
foreach ($_POST["chbUser"] as $key => $active_id) {
if ($this->object->getFixedParticipants()) {
$user_id = $active_id;
} else {
$user_id = $this->object->_getUserIdFromActiveId($active_id);
}
$user = ilObjUser::_lookupName($user_id);
if ($this->object->getAnonymity()) {
$name = $this->lng->txt("anonymous");
} else {
if ($user["lastname"]) {
$name = $user["lastname"] . ", " . $user["firstname"] . " (" . $user["login"] . ")";
} else {
$name = $this->lng->txt("deleted_user");
}
}
$cgui->addItem("chbUser[]", $active_id, $name, ilUtil::getImagePath("icon_usr.svg"), $this->lng->txt("usr"));
}
$this->tpl->setContent($cgui->getHTML());
}
示例2: getResultsHeadUserAndPass
/**
* Returns the user and pass data for a test results output
*
* @param integer $active_id The active ID of the user
* @return string HTML code of the user data for the test results
* @access public
*/
function getResultsHeadUserAndPass($active_id, $pass)
{
$template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE, "Modules/Test");
include_once './Services/User/classes/class.ilObjUser.php';
$user_id = $this->object->_getUserIdFromActiveId($active_id);
if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
$user = new ilObjUser($user_id);
} else {
$user = new ilObjUser();
$user->setLastname($this->lng->txt("deleted_user"));
}
$title_matric = "";
if (strlen($user->getMatriculation()) && $this->object->getAnonymity() == FALSE) {
$template->setCurrentBlock("user_matric");
$template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_matric_value");
$template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
$template->parseCurrentBlock();
$template->touchBlock("user_matric_separator");
$title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
}
$invited_user = array_pop($this->object->getInvitedUsers($user_id));
if (strlen($invited_user["clientip"])) {
$template->setCurrentBlock("user_clientip");
$template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_clientip_value");
$template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
$template->parseCurrentBlock();
$template->touchBlock("user_clientip_separator");
$title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
}
$template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
$uname = $this->object->userLookupFullName($user_id, FALSE);
$template->setVariable("VALUE_USR_NAME", $uname);
$template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
$template->setVariable("VALUE_PASS", $pass);
return $template->get();
}
示例3: sendAdvancedNotification
public function sendAdvancedNotification($active_id)
{
include_once "./Modules/Test/classes/class.ilTestMailNotification.php";
$mail = new ilTestMailNotification();
$owner_id = $this->getOwner();
$usr_data = $this->userLookupFullName(ilObjTest::_getUserIdFromActiveId($active_id));
include_once "./Modules/Test/classes/class.ilTestExport.php";
$exportObj = new ilTestExport($this, "results");
$file = $exportObj->exportToExcel($deliver = FALSE, 'active_id', $active_id, $passedonly = FALSE);
include_once "./Services/Mail/classes/class.ilFileDataMail.php";
$fd = new ilFileDataMail(ANONYMOUS_USER_ID);
$fd->copyAttachmentFile($file, "result_" . $active_id . ".xls");
$file_names[] = "result_" . $active_id . ".xls";
$mail->sendAdvancedNotification($owner_id, $this->getTitle(), $usr_data, $file_names);
if (count($file_names)) {
$fd->unlinkFiles($file_names);
unset($fd);
@unlink($file);
}
}
示例4: sendAdvancedNotification
public function sendAdvancedNotification($active_id)
{
include_once "./Services/Mail/classes/class.ilMail.php";
$mail = new ilMail(ANONYMOUS_USER_ID);
$usr_data = $this->userLookupFullName(ilObjTest::_getUserIdFromActiveId($active_id));
$message = new ilTemplate("tpl.il_as_tst_finish_notification_simple.html", TRUE, TRUE, "Modules/Test");
$message->setVariable('TEXT_TEST_TITLE', $this->lng->txt('title'));
$message->setVariable('VALUE_TEST_TITLE', $this->getTitle());
$message->setVariable('TEXT_USER_NAME', $this->lng->txt('username'));
$message->setVariable('VALUE_USER_NAME', $usr_data);
$message->setVariable('TEXT_FINISH_TIME', $this->lng->txt('tst_finished'));
ilDatePresentation::setUseRelativeDates(false);
$message->setVariable('VALUE_FINISH_TIME', ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
include_once "./Modules/Test/classes/class.ilTestExport.php";
$exportObj = new ilTestExport($this, "results");
$file = $exportObj->exportToExcel($deliver = FALSE, 'active_id', $active_id, $passedonly = FALSE);
include_once "./Services/Mail/classes/class.ilFileDataMail.php";
$fd = new ilFileDataMail(ANONYMOUS_USER_ID);
$fd->copyAttachmentFile($file, "result_" . $active_id . ".xls");
$file_names[] = "result_" . $active_id . ".xls";
$result = $mail->sendMail(ilObjUser::_lookupLogin($this->getOwner()), "", "", sprintf($this->lng->txt('tst_user_finished_test'), $this->getTitle()), $message->get(), count($file_names) ? $file_names : array(), array('normal'));
if (count($file_names)) {
$fd->unlinkFiles($file_names);
unset($fd);
@unlink($file);
}
}
示例5: _setReachedPoints
/**
* Sets the points, a learner has reached answering the question
* Additionally objective results are updated
*
* @param integer $user_id The database ID of the learner
* @param integer $test_id The database Id of the test containing the question
* @param integer $points The points the user has reached answering the question
* @return boolean true on success, otherwise false
* @access public
*/
function _setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
{
global $ilDB;
if ($points <= $maxpoints) {
if (is_null($pass)) {
$pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
}
// retrieve the already given points
$old_points = 0;
$result = $ilDB->queryF("SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $question_id, $pass));
$manual = $manualscoring ? 1 : 0;
$rowsnum = $result->numRows();
if ($rowsnum) {
$row = $ilDB->fetchAssoc($result);
$old_points = $row["points"];
if ($old_points != $points) {
$affectedRows = $ilDB->manipulateF("UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('float', 'integer', 'integer', 'integer', 'integer', 'integer'), array($points, $manual, time(), $active_id, $question_id, $pass));
}
} else {
$next_id = $ilDB->nextId('tst_test_result');
$affectedRows = $ilDB->manipulateF("INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'float', 'integer', 'integer', 'integer'), array($next_id, $active_id, $question_id, $points, $pass, $manual, time()));
}
if ($old_points != $points || !$rowsnum) {
assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
// finally update objective result
include_once "./Modules/Test/classes/class.ilObjTest.php";
include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
ilCourseObjectiveResult::_updateObjectiveResult(ilObjTest::_getUserIdFromActiveId($active_id), $question_id, $points);
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
global $lng, $ilUser;
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$username = ilObjTestAccess::_getParticipantData($active_id);
assQuestion::_logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
}
}
return TRUE;
} else {
return FALSE;
}
}