本文整理汇总了PHP中ilObjTest::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjTest::getTitle方法的具体用法?PHP ilObjTest::getTitle怎么用?PHP ilObjTest::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjTest
的用法示例。
在下文中一共展示了ilObjTest::getTitle方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromTest
/**
* Import relevant properties from given test
*
* @param ilObjTest $a_test
* @return object
*/
public static function createFromTest(ilObjTest $a_test, $a_user_id)
{
global $lng;
$lng->loadLanguageModule("wsp");
$newObj = new self();
$newObj->setTitle($lng->txt("wsp_type_tstv") . " \"" . $a_test->getTitle() . "\"");
$newObj->setDescription($a_test->getDescription());
$active_id = $a_test->getActiveIdOfUser($a_user_id);
$pass = ilObjTest::_getResultPass($active_id);
$date = $a_test->getPassFinishDate($active_id, $pass);
$newObj->setProperty("issued_on", new ilDate($date, IL_CAL_UNIX));
// create certificate
include_once "Services/Certificate/classes/class.ilCertificate.php";
include_once "Modules/Test/classes/class.ilTestCertificateAdapter.php";
$certificate = new ilCertificate(new ilTestCertificateAdapter($a_test));
$certificate = $certificate->outCertificate(array("active_id" => $active_id, "pass" => $pass), false);
// save pdf file
if ($certificate) {
// we need the object id for storing the certificate file
$newObj->create();
$path = self::initStorage($newObj->getId(), "certificate");
$file_name = "tst_" . $a_test->getId() . "_" . $a_user_id . "_" . $active_id . ".pdf";
if (file_put_contents($path . $file_name, $certificate)) {
$newObj->setProperty("file", $file_name);
$newObj->update();
return $newObj;
}
// file creation failed, so remove to object, too
$newObj->delete();
}
}
示例2: getResultsUserdata
/**
* Returns the user data for a test results output
*
* @param ilTestSession|ilTestSessionDynamicQuestionSet
* @param integer $user_id The user ID of the user
* @param boolean $overwrite_anonymity TRUE if the anonymity status should be overwritten, FALSE otherwise
* @return string HTML code of the user data for the test results
* @access public
*/
function getResultsUserdata($testSession, $active_id, $overwrite_anonymity = FALSE)
{
if (!is_object($testSession)) {
throw new TestException();
}
$template = new ilTemplate("tpl.il_as_tst_results_userdata.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"));
}
$t = $testSession->getSubmittedTimestamp();
if (!$t) {
$t = $this->object->_getLastAccess($testSession->getActiveId());
}
$print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$title_matric = "";
if (strlen($user->getMatriculation()) && ($this->object->getAnonymity() == FALSE || $overwrite_anonymity)) {
$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_TEST_TITLE", $this->lng->txt("title"));
$template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
$template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
$uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
$template->setVariable("VALUE_USR_NAME", $uname);
$template->setVariable("TXT_TEST_DATE", $this->lng->txt("tst_tst_date"));
$template->setVariable("TXT_PRINT_DATE", $this->lng->txt("tst_print_date"));
$old_value = ilDatePresentation::useRelativeDates();
ilDatePresentation::setUseRelativeDates(false);
$template->setVariable("VALUE_TEST_DATE", ilDatePresentation::formatDate(new ilDateTime(ilUtil::date_mysql2time($t), IL_CAL_UNIX)));
$template->setVariable("VALUE_PRINT_DATE", ilDatePresentation::formatDate(new ilDateTime($print_date, IL_CAL_UNIX)));
ilDatePresentation::setUseRelativeDates($old_value);
// change the pagetitle
$pagetitle = ": " . $this->object->getTitle() . $title_matric . $title_client;
$this->tpl->setHeaderPageTitle($pagetitle);
return $template->get();
}
示例3: populateContent
/**
* @param string $content
*/
protected function populateContent($content)
{
if ($this->isPdfDeliveryRequest()) {
require_once 'class.ilTestPDFGenerator.php';
ilTestPDFGenerator::generatePDF($content, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle());
} else {
$this->tpl->setContent($content);
}
}
示例4: addLocatorItems
function addLocatorItems()
{
global $ilLocator;
switch ($this->ctrl->getCmd()) {
case "run":
case "infoScreen":
case "redirectToInfoScreen":
case "start":
case "resume":
case "previous":
case "next":
case "summary":
case "finishTest":
case "outCorrectSolution":
case "passDetails":
case "showAnswersOfUser":
case "outUserResultsOverview":
case "backFromSummary":
case "show_answers":
case "setsolved":
case "resetsolved":
case "outTestSummary":
case "outQuestionSummary":
case "gotoQuestion":
case "selectImagemapRegion":
case "confirmSubmitAnswers":
case "finalSubmission":
case "postpone":
case "redirectQuestion":
case "outUserPassDetails":
case "checkPassword":
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
break;
case "eval_stat":
case "evalAllUsers":
case "evalUserDetail":
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "eval_stat"), "", $_GET["ref_id"]);
break;
case "create":
case "save":
case "cancel":
case "importFile":
case "cloneAll":
case "importVerifiedFile":
case "cancelImport":
break;
default:
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
break;
}
}
示例5: getItems
/**
* Get all completed tests
*/
protected function getItems()
{
global $ilUser;
include_once "Modules/Test/classes/class.ilObjTest.php";
include_once "Modules/Test/classes/class.ilTestSessionFactory.php";
$data = array();
foreach (ilObjTest::getTestObjIdsWithActiveForUserId($ilUser->getId()) as $test_id) {
// #11210 - only available certificates!
$test = new ilObjTest($test_id, false);
$session = new ilTestSessionFactory($test);
$session = $session->getSession(null);
if ($test->canShowCertificate($session, $session->getUserId(), $session->getActiveId())) {
$data[] = array("id" => $test_id, "title" => $test->getTitle(), "passed" => $test->getPassed($session->getActiveId()));
}
}
$this->setData($data);
}
示例6: exportToCSV
//.........这里部分代码省略.........
foreach ($additionalFields as $fieldname) {
if (strcmp($fieldname, "gender") == 0) {
array_push($datarow2, $this->lng->txt("gender_" . $userfields[$fieldname]));
} else {
array_push($datarow2, $userfields[$fieldname]);
}
}
}
array_push($datarow2, $data->getParticipant($active_id)->getReached());
array_push($datarow2, $data->getParticipant($active_id)->getMaxpoints());
array_push($datarow2, $data->getParticipant($active_id)->getMark());
if ($this->test_obj->getECTSOutput()) {
array_push($datarow2, $data->getParticipant($active_id)->getECTSMark());
}
array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThrough());
array_push($datarow2, $data->getParticipant($active_id)->getNumberOfQuestions());
array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0);
$time = $data->getParticipant($active_id)->getTimeOfWork();
$time_seconds = $time;
$time_hours = floor($time_seconds / 3600);
$time_seconds -= $time_hours * 3600;
$time_minutes = floor($time_seconds / 60);
$time_seconds -= $time_minutes * 60;
array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
$time = $data->getParticipant($active_id)->getQuestionsWorkedThrough() ? $data->getParticipant($active_id)->getTimeOfWork() / $data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0;
$time_seconds = $time;
$time_hours = floor($time_seconds / 3600);
$time_seconds -= $time_hours * 3600;
$time_minutes = floor($time_seconds / 60);
$time_seconds -= $time_minutes * 60;
array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
$fv = $data->getParticipant($active_id)->getFirstVisit();
$lv = $data->getParticipant($active_id)->getLastVisit();
foreach (array($fv, $lv) as $ts) {
if ($ts) {
$visit = ilFormat::formatDate(date('Y-m-d H:i:s', $ts), "datetime", false, false);
array_push($datarow2, $visit);
} else {
array_push($datarow2, "");
}
}
$median = $data->getStatistics()->getStatistics()->median();
$pct = $data->getParticipant($active_id)->getMaxpoints() ? $median / $data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0;
$mark = $this->test_obj->mark_schema->getMatchingMark($pct);
$mark_short_name = "";
if (is_object($mark)) {
$mark_short_name = $mark->getShortName();
}
array_push($datarow2, $mark_short_name);
array_push($datarow2, $data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached()));
array_push($datarow2, $data->getStatistics()->getStatistics()->rank_median());
array_push($datarow2, $data->getStatistics()->getStatistics()->count());
array_push($datarow2, $median);
if ($this->test_obj->getPassScoring() == SCORE_BEST_PASS) {
array_push($datarow2, $data->getParticipant($active_id)->getBestPass() + 1);
} else {
array_push($datarow2, $data->getParticipant($active_id)->getLastPass() + 1);
}
for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++) {
$finishdate = $this->test_obj->getPassFinishDate($active_id, $pass);
if ($finishdate > 0) {
if ($pass > 0) {
for ($i = 1; $i < $col - 1; $i++) {
array_push($datarow2, "");
array_push($datarow, "");
}
array_push($datarow, "");
}
array_push($datarow2, $pass + 1);
if (is_object($data->getParticipant($active_id)) && is_array($data->getParticipant($active_id)->getQuestions($pass))) {
foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question) {
$question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]);
array_push($datarow2, $question_data["reached"]);
array_push($datarow, preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"])));
}
}
if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions() || $counter == 1 && $pass == 0) {
array_push($rows, $datarow);
}
$datarow = array();
array_push($rows, $datarow2);
$datarow2 = array();
}
}
$counter++;
}
}
$csv = "";
$separator = ";";
foreach ($rows as $evalrow) {
$csvrow =& $this->test_obj->processCSVRow($evalrow, TRUE, $separator);
$csv .= join($csvrow, $separator) . "\n";
}
if ($deliver) {
ilUtil::deliverData($csv, ilUtil::getASCIIFilename($this->test_obj->getTitle() . "_results.csv"));
exit;
} else {
return $csv;
}
}
示例7: array
/**
* Returns true, if a test is complete for use
*
* @return boolean True, if the test is complete for use, otherwise false
* @access public
*/
function _isComplete($a_obj_id)
{
global $ilDB;
$test_id = ilObjTestAccess::_getTestIDFromObjectID($a_obj_id);
$result = $ilDB->queryF("SELECT tst_mark.*, tst_tests.* FROM tst_tests, tst_mark WHERE tst_mark.test_fi = tst_tests.test_id AND tst_tests.test_id = %s", array('integer'), array($test_id));
$found = $result->numRows();
if ($found) {
$row = $ilDB->fetchAssoc($result);
// check for at least: title, author and minimum of 1 mark step
if (strlen($row["title"]) && strlen($row["author"]) && $found) {
// check also for minmum of 1 question
if (ilObjTestAccess::_getQuestionCount($test_id) > 0) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
$test = new ilObjTest($obj_id, false);
$test->loadFromDb();
if ($test->getTitle() and $test->author and count($test->mark_schema->mark_steps) and count($test->questions)) {
return true;
} else {
return false;
}
}