/** * @param array $data */ public function fillRow(array $data) { $this->tpl->setVariable("LOGIN", $data['login']); $this->tpl->setVariable("NAME", $data['name']); $this->tpl->setVariable("STARTED", $data['started']); $this->tpl->setVariable("EXTRATIME", ilFormat::_secondsToString($data['extratime'] * 60)); }
public function send() { switch ($this->getType()) { case self::TYPE_NOTIFICATION_ACTIVATION: $additional_information = $this->getAdditionalInformation(); /** * @var $user ilObjUser */ $user = $additional_information['usr']; foreach ($this->getRecipients() as $rcp) { try { $this->handleCurrentRecipient($rcp); } catch (ilMailException $e) { continue; } $this->initMimeMail(); $this->setSubject($this->getLanguage()->txt('reg_mail_subject_confirmation')); $this->setBody($this->getLanguage()->txt('reg_mail_body_salutation') . ' ' . $user->getFullname() . ','); $this->appendBody("\n\n"); $this->appendBody($this->getLanguage()->txt('reg_mail_body_confirmation')); $this->appendBody("\n"); $this->appendBody(ILIAS_HTTP_PATH . '/confirmReg.php?client_id=' . CLIENT_ID . '&rh=' . ilObjUser::_generateRegistrationHash($user->getId())); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguage()->txt('reg_mail_body_2_confirmation'), ilFormat::_secondsToString($additional_information['hash_lifetime']))); $this->appendBody("\n\n"); $this->appendBody($this->getLanguage()->txt('reg_mail_body_3_confirmation')); $this->appendBody(ilMail::_getInstallationSignature()); $this->sendMimeMail($this->getCurrentRecipient()); } break; } }
protected function fillRowExcel($a_worksheet, &$a_row, $a_set) { $a_worksheet->write($a_row, 0, $a_set["login"]); $a_worksheet->write($a_row, 1, $a_set["firstname"]); $a_worksheet->write($a_row, 2, $a_set["lastname"]); $a_worksheet->write($a_row, 3, ilFormat::_secondsToShortString($a_set["online_time"])); $a_worksheet->write($a_row, 4, ilDatePresentation::formatDate(new ilDateTime($a_set["last_login"], IL_CAL_DATETIME))); }
/** * Fill row * * @access public * @param * */ public function fillRow($a_set) { $this->tpl->setVariable('VAL_ID', $a_set['id']); $this->tpl->setVariable('VAL_TITLE', $a_set['title']); $this->tpl->setVariable('VAL_DATE', ilFormat::formatDate(date('Y-m-d H:i:s', $a_set['date']), 'datetime', true)); $this->tpl->setVariable('VAL_SORTING_TEXTINPUT', ilUtil::formInput('sorting[' . $a_set['id'] . ']', $a_set['sorting'])); $this->ctrl->setParameter($this->parent_obj, 'topic_id', $a_set['id']); $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj, 'showTopicForm')); $this->tpl->setVariable('TXT_EDIT_RECORD', $this->lng->txt('edit')); }
/** * @param string $column * @param string $value * @return string */ protected function formatValue($column, $value) { switch ($column) { case 'filecreatedate': return ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX)); case 'filesize': return ilFormat::formatSize($value); default: return $value; } }
/** * * Send notifications * * @access public * */ public function send() { global $ilDB; // parent::send(); if (count($this->getRecipients())) { $res = $ilDB->queryf("SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active," . "u.time_limit_unlimited, " . $ilDB->fromUnixtime("u.time_limit_from") . ", " . $ilDB->fromUnixtime("u.time_limit_until") . "," . "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE " . $ilDB->fromUnixtime("u.time_limit_until") . " END END access_until," . " CASE WHEN " . $ilDB->unixTimestamp() . " BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired," . "rq.role_disk_quota, system_role.rol_id role_id, " . "p1.value+0 user_disk_quota," . "p2.value+0 disk_usage, " . "p3.value last_update, " . "p5.value language, " . "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota\t" . "FROM usr_data u " . "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota " . "FROM usr_data u " . "JOIN rbac_ua ua ON ua.usr_id=u.usr_id " . "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s " . "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id " . "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s " . "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota' " . "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage' " . "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update' " . "LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language' " . 'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR ((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) ' . 'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR ' . $ilDB->unixTimestamp() . ' BETWEEN u.time_limit_from AND u.time_limit_until)) ', array('integer', 'integer'), array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID)); $users = array(); $counter = 0; while ($row = $ilDB->fetchAssoc($res)) { $details = ilDiskQuotaChecker::_lookupDiskUsage($row['usr_id']); $users[$counter]['disk_quota'] = $row['disk_quota']; $users[$counter]['disk_usage'] = $details['disk_usage']; $users[$counter]['email'] = $row['email']; $users[$counter]['firstname'] = $row['firstname']; $users[$counter]['lastname'] = $row['lastname']; ++$counter; } if (count($users)) { foreach ($this->getRecipients() as $rcp) { $usrId = ilObjUser::_lookupId($rcp); $this->initLanguage($usrId); $this->initMail(); $this->setSubject($this->getLanguage()->txt('disk_quota_summary_subject')); $this->setBody(ilMail::getSalutation($usrId, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody($this->getLanguage()->txt('disk_quota_exceeded_headline')); $this->appendBody("\n\n"); $first = true; $counter = 0; $numUsers = count($users); foreach ($users as $user) { if (!$first) { $this->appendBody("\n---------------------------------------------------\n\n"); } $this->appendBody($this->getLanguage()->txt('fullname') . ': ' . $user['lastname'] . ', ' . $user['firstname'] . "\n"); $this->appendBody($this->getLanguage()->txt('email') . ': ' . $user['email'] . "\n"); $this->appendBody($this->getLanguage()->txt('disk_quota') . ': ' . ilFormat::formatSize($user['disk_quota'], 'short', $this->getLanguage()) . "\n"); $this->appendBody($this->getLanguage()->txt('currently_used_disk_space') . ': ' . ilFormat::formatSize($user['disk_usage'], 'short', $this->getLanguage()) . "\n"); $this->appendBody($this->getLanguage()->txt('usrf_profile_link') . ': ' . ilUtil::_getHttpPath() . '/goto.php?target=usrf&client_id=' . CLIENT_ID); if ($counter < $numUsers - 1) { $this->appendBody("\n"); } ++$counter; $first = false; } $this->getMail()->appendInstallationSignature(true); $this->sendMail(array($rcp), array('system'), false); } } } }
function getFiles() { $files = array(); $dp = opendir($this->exercise_path); while ($file = readdir($dp)) { if (is_dir($file)) { continue; } list($obj_id, $rest) = split('_', $file, 2); if ($obj_id == $this->obj_id) { if (!is_dir($this->exercise_path . '/' . $file)) { $files[] = array('name' => $rest, 'size' => filesize($this->exercise_path . '/' . $file), 'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s', filectime($this->exercise_path . '/' . $file))), 'fullpath' => $this->exercise_path . '/' . $file); } } } closedir($dp); return $files; }
/** * Exports the evaluation data to the CSV file format * * Exports the evaluation data to the CSV file format * * @param string $filtertext Filter text for the user data * @param boolean $passedonly TRUE if only passed user datasets should be exported, FALSE otherwise * @access public */ function exportToCSV($deliver = TRUE, $filterby = "", $filtertext = "", $passedonly = FALSE) { global $ilLog; if (strcmp($this->mode, "aggregated") == 0) { return $this->aggregatedResultsToCSV($deliver); } $rows = array(); $datarow = array(); $col = 1; if ($this->test_obj->getAnonymity()) { array_push($datarow, $this->lng->txt("counter")); $col++; } else { array_push($datarow, $this->lng->txt("name")); $col++; array_push($datarow, $this->lng->txt("login")); $col++; } $additionalFields = $this->test_obj->getEvaluationAdditionalFields(); if (count($additionalFields)) { foreach ($additionalFields as $fieldname) { array_push($datarow, $this->lng->txt($fieldname)); $col++; } } array_push($datarow, $this->lng->txt("tst_stat_result_resultspoints")); $col++; array_push($datarow, $this->lng->txt("maximum_points")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_resultsmarks")); $col++; if ($this->test_obj->getECTSOutput()) { array_push($datarow, $this->lng->txt("ects_grade")); $col++; } array_push($datarow, $this->lng->txt("tst_stat_result_qworkedthrough")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_qmax")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_pworkedthrough")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_timeofwork")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_atimeofwork")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_firstvisit")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_lastvisit")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_mark_median")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_rank_participant")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_rank_median")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_total_participants")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_median")); $col++; array_push($datarow, $this->lng->txt("scored_pass")); $col++; array_push($datarow, $this->lng->txt("pass")); $col++; $data =& $this->test_obj->getCompleteEvaluationData(TRUE, $filterby, $filtertext); $headerrow = $datarow; $counter = 1; foreach ($data->getParticipants() as $active_id => $userdata) { $datarow = $headerrow; $remove = FALSE; if ($passedonly) { if ($data->getParticipant($active_id)->getPassed() == FALSE) { $remove = TRUE; } } if (!$remove) { $datarow2 = array(); if ($this->test_obj->getAnonymity()) { array_push($datarow2, $counter); } else { array_push($datarow2, $data->getParticipant($active_id)->getName()); array_push($datarow2, $data->getParticipant($active_id)->getLogin()); } if (count($additionalFields)) { $userfields = ilObjUser::_lookupFields($userdata->getUserID()); 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; } }
/** * Checks if the test is executable by the given user * * @param ilTestSession|ilTestSessionDynamicQuestionSet * @param integer $user_id The user id * @return array Result array * @access public */ function isExecutable($testSession, $user_id, $allowPassIncrease = FALSE) { $result = array("executable" => true, "errormessage" => ""); if (!$this->startingTimeReached()) { $result["executable"] = false; $result["errormessage"] = sprintf($this->lng->txt("detail_starting_time_not_reached"), ilFormat::ftimestamp2datetimeDB($this->getStartingTime())); return $result; } if ($this->endingTimeReached()) { $result["executable"] = false; $result["errormessage"] = sprintf($this->lng->txt("detail_ending_time_reached"), ilFormat::ftimestamp2datetimeDB($this->getEndingTime())); return $result; } $active_id = $this->getActiveIdOfUser($user_id); if ($this->getEnableProcessingTime()) { if ($active_id > 0) { $starting_time = $this->getStartingTimeOfUser($active_id); if ($starting_time !== FALSE) { if ($this->isMaxProcessingTimeReached($starting_time, $active_id)) { if ($allowPassIncrease && $this->getResetProcessingTime() && ($this->getNrOfTries() == 0 || $this->getNrOfTries() > $this->_getPass($active_id) + 1)) { // a test pass was quitted because the maximum processing time was reached, but the time // will be resetted for future passes, so if there are more passes allowed, the participant may // start the test again. // This code block is only called when $allowPassIncrease is TRUE which only happens when // the test info page is opened. Otherwise this will lead to unexpected results! $testSession->increasePass(); $testSession->setLastSequence(0); $testSession->saveToDb(); } else { $result["executable"] = false; $result["errormessage"] = $this->lng->txt("detail_max_processing_time_reached"); } return $result; } } } } if ($this->hasNrOfTriesRestriction() && $active_id > 0) { require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this); $testPassesSelector->setActiveId($active_id); $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass()); $closedPasses = $testPassesSelector->getReportablePasses(); if (count($closedPasses) >= $this->getNrOfTries()) { $result["executable"] = false; $result["errormessage"] = $this->lng->txt("maximum_nr_of_tries_reached"); return $result; } } return $result; }
/** * The disk quota report list shows user accounts, their disk quota and their * disk usage, as well as the last time a reminder was sent. */ public function viewDiskQuotaReport() { global $rbacsystem, $ilErr, $ilSetting, $lng; if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) { $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING); } $this->tabs_gui->setTabActive('disk_quota'); $this->addDiskQuotaSubtabs('disk_quota_report'); // nothing to do if disk quota is not active require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (!ilDiskQuotaActivationChecker::_isActive()) { return; } // get the form $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.disk_quota_report.html', "Services/WebDAV"); // get the date of the last update require_once "./Services/WebDAV/classes/class.ilDiskQuotaChecker.php"; $last_update = ilDiskQuotaChecker::_lookupDiskUsageReportLastUpdate(); if ($last_update == null) { // nothing to do if disk usage report has not been run $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('disk_quota_report_not_run_yet')); return; } else { $this->tpl->setVariable('LAST_UPDATE_TEXT', $lng->txt('last_update') . ': ' . ilFormat::formatDate($last_update, 'datetime', true)); } // Filter $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter']; if ($_SESSION['quota_usage_filter'] == 0) { $_SESSION['quota_usage_filter'] = 4; } $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter']; if ($_SESSION['quota_access_filter'] == 0) { $_SESSION['quota_access_filter'] = 1; } $usage_action[1] = $lng->txt('all_users'); $usage_action[2] = $lng->txt('filter_users_without_disk_usage'); $usage_action[3] = $lng->txt('filter_users_with_disk_usage'); $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota'); $access_action[1] = $lng->txt('all_users'); $access_action[2] = $lng->txt('filter_users_with_access'); $access_action[3] = $lng->txt('filter_users_without_access'); $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'], "usage_filter", $usage_action, false, true); $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'], "access_filter", $access_action, false, true); $this->tpl->setCurrentBlock("filter"); $this->tpl->setVariable("FILTER_TXT_FILTER", $lng->txt('filter')); $this->tpl->setVariable("SELECT_USAGE_FILTER", $select_usage_filter); $this->tpl->setVariable("SELECT_ACCESS_FILTER", $select_access_filter); $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport')); $this->tpl->setVariable("FILTER_NAME", 'view'); $this->tpl->setVariable("FILTER_VALUE", $lng->txt('apply_filter')); $this->tpl->parseCurrentBlock(); // load templates for table $a_tpl = new ilTemplate('tpl.table.html', true, true); $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); // create table require_once './Services/Table/classes/class.ilTableGUI.php'; $tbl = new ilTableGUI(0, false); // title & header columns $header_vars = array('login', 'firstname', 'lastname', 'email', 'access_until', 'last_login', 'disk_quota', 'disk_usage', 'last_reminder'); $tbl->setHeaderNames(array($lng->txt('login'), $lng->txt('firstname'), $lng->txt('lastname'), $lng->txt('email'), $lng->txt('access_until'), $lng->txt('last_login'), $lng->txt('disk_quota'), $lng->txt('disk_usage'), $lng->txt('last_reminder'))); $tbl->setHeaderVars($header_vars, $this->ctrl->getParameterArray($this, 'viewDiskQuotaReport', false)); $tbl->enable("numinfo_header"); $tbl->setFormName("cmd"); $tbl->setSelectAllCheckbox("id"); // sorting $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); // fetch the data $data = ilDiskQuotaChecker::_fetchDiskQuotaReport($_SESSION['quota_usage_filter'], $_SESSION['quota_access_filter'], $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection()); // paging $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount(count($data)); // footer $tbl->setFooter("tblfooter", $lng->txt("previous"), $lng->txt("next")); // render table $tbl->setTemplate($a_tpl); // render rows $count = 0; for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++) { $row = $data[$i]; // build columns foreach ($header_vars as $key) { switch ($key) { case 'login': //build link $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7"); $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]); $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view"); $tbl_content_cell = '<a href="' . $link . '">' . htmlspecialchars($row[$key]) . '</a>'; break; case 'disk_quota': if ($row['role_id'] == SYSTEM_ROLE_ID) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } break; case 'disk_usage': if ($row['last_update'] == null) { $tbl_content_cell = $lng->txt('unknown'); } else { if ($row['disk_usage'] > $row['disk_quota']) { $tbl_content_cell = "<span class=\"smallred\">" . ilFormat::formatSize($row[$key], 'short') . '</span>'; } else { $tbl_content_cell = ilFormat::formatSize($row[$key], 'short'); } } break; case 'access_until': if (!$row['active']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('inactive') . '</span>'; } else { if ($row['time_limit_unlimited']) { $tbl_content_cell = "<span class=\"smallgreen\">" . $lng->txt('access_unlimited') . '</span>'; } else { if ($row['expired']) { $tbl_content_cell = "<span class=\"smallred\">" . $lng->txt('access_expired') . '</span>'; } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } } } break; case 'last_login': case 'last_reminder': if ($row[$key] == null) { $tbl_content_cell = $lng->txt('no_date'); } else { $tbl_content_cell = ilFormat::formatDate($row[$key]); } break; default: $tbl_content_cell = htmlspecialchars($row[$key]); } /* if (is_array($tbl_content_cell)) { $tbl->tpl->setCurrentBlock("tbl_cell_subtitle"); $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]); $tbl->tpl->parseCurrentBlock(); $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>"; }*/ $tbl->tpl->setCurrentBlock("tbl_content_cell"); $tbl->tpl->setVariable("TBL_CONTENT_CELL", $tbl_content_cell); $tbl->tpl->parseCurrentBlock(); } $tbl->tpl->setCurrentBlock("tbl_content_row"); $rowcolor = ilUtil::switchColor($count, "tblrow1", "tblrow2"); $tbl->tpl->setVariable("ROWCOLOR", $rowcolor); $tbl->tpl->parseCurrentBlock(); $count++; } $tbl->render(); // Add table to page $this->tpl->setVariable("USER_TABLE", $a_tpl->get()); }
/** * Fill table row */ protected function fillRow($data) { global $ilCtrl, $lng; if (!$this->isPercentageAvailable($data["obj_id"])) { $data["percentage"] = NULL; } foreach ($this->getSelectedColumns() as $c) { $val = trim($data[$c]) == "" ? " " : $data[$c]; if ($data[$c] != "" || $c == "status") { switch ($c) { case "first_access": $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_DATETIME)); break; case "last_access": $val = ilDatePresentation::formatDate(new ilDateTime($data[$c], IL_CAL_UNIX)); break; case "status": include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php"; $path = ilLearningProgressBaseGUI::_getImagePathForStatus($data[$c]); $text = ilLearningProgressBaseGUI::_getStatusText($data[$c]); $val = ilUtil::img($path, $text); if ($data["type"] != "lobj" && $data["type"] != "sco") { $timing = $this->showTimingsWarning($data["ref_id"], $this->user_id); if ($timing) { if ($timing !== true) { $timing = ": " . ilDatePresentation::formatDate(new ilDate($timing, IL_CAL_UNIX)); } else { $timing = ""; } $this->tpl->setCurrentBlock('warning_img'); $this->tpl->setVariable('WARNING_IMG', ilUtil::getImagePath('time_warn.png')); $this->tpl->setVariable('WARNING_ALT', $this->lng->txt('trac_time_passed') . $timing); $this->tpl->parseCurrentBlock(); } } break; case "spent_seconds": include_once "./Services/Utilities/classes/class.ilFormat.php"; $val = ilFormat::_secondsToString($data[$c]); break; case "percentage": $val = $data[$c] . "%"; break; } } if ($c == "mark" && in_array($this->type, array("lm", "dbk"))) { $val = "-"; } if ($c == "spent_seconds" && in_array($this->type, array("exc"))) { $val = "-"; } if ($c == "percentage" && (in_array(strtolower($this->status_class), array("illpstatusmanual", "illpstatusscormpackage", "illpstatustestfinished")) || $this->type == "exc")) { $val = "-"; } $this->tpl->setCurrentBlock("user_field"); $this->tpl->setVariable("VAL_UF", $val); $this->tpl->parseCurrentBlock(); } if ($data["title"] == "") { $data["title"] = "--" . $lng->txt("none") . "--"; } $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $data["type"])); $this->tpl->setVariable("ICON_ALT", $lng->txt($data["type"])); if (in_array($data['type'], array('fold', 'grp')) && $data['obj_id'] != $this->obj_id) { if ($data['type'] == 'fold') { $object_gui = 'ilobjfoldergui'; } else { $object_gui = 'ilobjgroupgui'; } $this->tpl->setCurrentBlock('title_linked'); // link structure gets too complicated if ($_GET["baseClass"] != "ilPersonalDesktopGUI" && $_GET["baseClass"] != "ilAdministrationGUI") { $old = $ilCtrl->getParameterArrayByClass('illplistofobjectsgui'); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $data["ref_id"]); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $data["ref_id"]); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $this->user_id); $url = $ilCtrl->getLinkTargetByClass(array('ilrepositorygui', $object_gui, 'illearningprogressgui', 'illplistofobjectsgui'), 'userdetails'); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'ref_id', $old["ref_id"]); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'details_id', $old["details_id"]); $ilCtrl->setParameterByClass('illplistofobjectsgui', 'user_id', $old["user_id"]); } else { $url = "#"; } $this->tpl->setVariable("URL_TITLE", $url); $this->tpl->setVariable("VAL_TITLE", $data["title"]); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('title_plain'); $this->tpl->setVariable("VAL_TITLE", $data["title"]); $this->tpl->parseCurrentBlock(); } if (!in_array($data["type"], array("sco", "lobj")) && !$this->getPrintMode()) { $this->tpl->setCurrentBlock("item_command"); $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", $data["ref_id"]); $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTargetByClass("illplistofobjectsgui", 'edituser')); $this->tpl->setVariable("TXT_COMMAND", $lng->txt('edit')); $ilCtrl->setParameterByClass("illplistofobjectsgui", "userdetails_id", ""); $this->tpl->parseCurrentBlock(); } }
function outMobImageParams() { global $arr_tinyMCE_image_files; global $tpl; for ($k = 0; $k < count($arr_tinyMCE_image_files); $k++) { $tpl->setCurrentBlock('imageparams'); $entry = $arr_tinyMCE_image_files[$k]['file_name']; $size = getimagesize($arr_tinyMCE_image_files[$k]['file_dir'] . $entry); $fsize = filesize($arr_tinyMCE_image_files[$k]['file_dir'] . $entry); $tpl->setVariable('IMG_WIDTH', $size[0]); $tpl->setVariable('IMG_HEIGHT', $size[1]); $tpl->setVariable('IMG_PATH', $arr_tinyMCE_image_files[$k]['http_dir']); $tpl->setVariable('F_SIZE', ilFormat::formatSize($fsize)); $tpl->parseCurrentBlock(); } }
public function showForm() { global $rbacsystem, $ilUser, $ilCtrl, $lng, $ilTabs; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_new.html", "Services/Mail"); $this->tpl->setTitle($this->lng->txt("mail")); $this->lng->loadLanguageModule("crs"); if (ilMailFormCall::isRefererStored()) { $ilTabs->setBackTarget($lng->txt('back'), $ilCtrl->getLinkTarget($this, 'cancelMail')); } switch ($_GET["type"]) { case 'reply': if ($_SESSION['mail_id']) { $_GET['mail_id'] = $_SESSION['mail_id']; } $mailData = $this->umail->getMail($_GET["mail_id"]); $mailData["m_subject"] = $this->umail->formatReplySubject(); $mailData["m_message"] = $this->umail->formatReplyMessage(); $mailData["m_message"] = $this->umail->prependSignature(); // NO ATTACHMENTS FOR REPLIES $mailData["attachments"] = array(); //$mailData["rcp_cc"] = $this->umail->formatReplyRecipientsForCC(); $mailData["rcp_cc"] = ''; $mailData["rcp_to"] = $this->umail->formatReplyRecipient(); $_SESSION["mail_id"] = ""; break; case 'search_res': $mailData = $this->umail->getSavedData(); /*if($_SESSION["mail_search_results"]) { $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results"],$_SESSION["mail_search"]); } unset($_SESSION["mail_search"]); unset($_SESSION["mail_search_results"]);*/ if ($_SESSION["mail_search_results_to"]) { $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_to"], 'to'); } if ($_SESSION["mail_search_results_cc"]) { $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_cc"], 'cc'); } if ($_SESSION["mail_search_results_bcc"]) { $mailData = $this->umail->appendSearchResult($_SESSION["mail_search_results_bcc"], 'bc'); } unset($_SESSION["mail_search_results_to"]); unset($_SESSION["mail_search_results_cc"]); unset($_SESSION["mail_search_results_bcc"]); break; case 'attach': $mailData = $this->umail->getSavedData(); break; case 'draft': $_SESSION["draft"] = $_GET["mail_id"]; $mailData = $this->umail->getMail($_GET["mail_id"]); break; case 'forward': $mailData = $this->umail->getMail($_GET["mail_id"]); $mailData["rcp_to"] = $mailData["rcp_cc"] = $mailData["rcp_bcc"] = ''; $mailData["m_subject"] = $this->umail->formatForwardSubject(); $mailData["m_message"] = $this->umail->prependSignature(); if (count($mailData["attachments"])) { if ($error = $this->mfile->adoptAttachments($mailData["attachments"], $_GET["mail_id"])) { ilUtil::sendInfo($error); } } break; case 'new': if ($_GET['rcp_to']) { // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $mailData["rcp_to"] = ilUtil::securePlainString($_GET['rcp_to']); } else { if ($_SESSION['rcp_to']) { $mailData["rcp_to"] = $_SESSION['rcp_to']; } } if ($_GET['rcp_cc']) { // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $mailData["rcp_cc"] = ilUtil::securePlainString($_GET['rcp_cc']); } else { if ($_SESSION['rcp_cc']) { $mailData["rcp_cc"] = $_SESSION['rcp_cc']; } } if ($_GET['rcp_bcc']) { // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $mailData["rcp_bcc"] = ilUtil::securePlainString($_GET['rcp_bcc']); } else { if ($_SESSION['rcp_bcc']) { $mailData["rcp_bcc"] = $_SESSION['rcp_bcc']; } } $mailData['m_message'] = ''; if (strlen($sig = ilMailFormCall::getSignature())) { $mailData['m_message'] = $sig; $mailData['m_message'] .= chr(13) . chr(10) . chr(13) . chr(10); } $mailData['m_message'] .= $this->umail->appendSignature(); $_SESSION['rcp_to'] = ''; $_SESSION['rcp_cc'] = ''; $_SESSION['rcp_bcc'] = ''; break; case 'role': if (is_array($_POST['roles'])) { // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_POST['roles'])); } elseif (is_array($_SESSION['mail_roles'])) { $mailData['rcp_to'] = ilUtil::securePlainString(implode(',', $_SESSION['mail_roles'])); } $mailData['m_message'] = ''; if (strlen($sig = ilMailFormCall::getSignature())) { $mailData['m_message'] = $sig; $mailData['m_message'] .= chr(13) . chr(10) . chr(13) . chr(10); } $mailData['m_message'] .= $_POST["additional_message_text"] . chr(13) . chr(10) . $this->umail->appendSignature(); $_POST["additional_message_text"] = ""; $_SESSION['mail_roles'] = ""; break; case 'address': $mailData["rcp_to"] = urldecode($_GET["rcp"]); break; default: // GET DATA FROM POST $mailData = $_POST; // strip slashes foreach ($mailData as $key => $value) { if (is_string($value)) { // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $mailData[$key] = ilUtil::securePlainString($value); } } break; } include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form_gui = new ilPropertyFormGUI(); $form_gui->setTitle($this->lng->txt('compose')); $form_gui->setOpenTag(false); $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage')); $this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients")); $this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses")); $this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups")); $this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists")); $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true); // RECIPIENT $inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to'); $inp->setRequired(true); $inp->setSize(50); $inp->setValue($mailData["rcp_to"]); $inp->setDataSource($dsDataLink, ","); $inp->setMaxLength(null); $form_gui->addItem($inp); // CC $inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc'); $inp->setSize(50); $inp->setValue($mailData["rcp_cc"]); $inp->setDataSource($dsDataLink, ","); $inp->setMaxLength(null); $form_gui->addItem($inp); // BCC $inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc'); $inp->setSize(50); $inp->setValue($mailData["rcp_bcc"]); $inp->setDataSource($dsDataLink, ","); $inp->setMaxLength(null); $form_gui->addItem($inp); // SUBJECT $inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject'); $inp->setSize(50); $inp->setRequired(true); $inp->setValue($mailData["m_subject"]); $form_gui->addItem($inp); // Attachments include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php'; $att = new ilMailFormAttachmentPropertyGUI($this->lng->txt($mailData["attachments"] ? 'edit' : 'add')); if (is_array($mailData["attachments"]) && count($mailData["attachments"])) { foreach ($mailData["attachments"] as $data) { if (is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data)) { $hidden = new ilHiddenInputGUI('attachments[]'); $form_gui->addItem($hidden); $size = filesize($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data); $label = $data . " [" . ilFormat::formatSize($size) . "]"; $att->addItem($label); $hidden->setValue(urlencode($data)); } } } $form_gui->addItem($att); // ONLY IF SYSTEM MAILS ARE ALLOWED if ($rbacsystem->checkAccess("system_message", $this->umail->getMailObjectReferenceId())) { $chb = new ilCheckboxInputGUI($this->lng->txt('type'), 'm_type[]'); $chb->setOptionTitle($this->lng->txt('system_message')); $chb->setValue('system'); $chb->setChecked(false); if (is_array($mailData["m_type"]) and in_array('system', $mailData["m_type"])) { $chb->setChecked(true); } $form_gui->addItem($chb); } // MESSAGE $inp = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message'); //$inp->setValue(htmlspecialchars($mailData["m_message"], false)); $inp->setValue($mailData["m_message"]); $inp->setRequired(false); $inp->setCols(60); $inp->setRows(10); // PLACEHOLDERS $chb = new ilCheckboxInputGUI($this->lng->txt('activate_serial_letter_placeholders'), 'use_placeholders'); $chb->setOptionTitle($this->lng->txt('activate_serial_letter_placeholders')); $chb->setValue(1); $chb->setChecked(false); $form_gui->addItem($inp); include_once 'Services/Mail/classes/class.ilMailFormPlaceholdersPropertyGUI.php'; $prop = new ilMailFormPlaceholdersPropertyGUI(); $chb->addSubItem($prop); if ($mailData['use_placeholders']) { $chb->setChecked(true); } $form_gui->addItem($chb); $form_gui->addCommandButton('sendMessage', $this->lng->txt('send_mail')); $form_gui->addCommandButton('saveDraft', $this->lng->txt('save_message')); if (ilMailFormCall::isRefererStored()) { $form_gui->addCommandButton('cancelMail', $this->lng->txt('cancel')); } $this->tpl->parseCurrentBlock(); $this->tpl->setVariable('FORM', $form_gui->getHTML()); $this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js'); $this->tpl->show(); }
/** * handle endingTimeReached * @private */ function endingTimeReached() { ilUtil::sendInfo(sprintf($this->lng->txt("detail_ending_time_reached"), ilFormat::ftimestamp2datetimeDB($this->object->getEndingTime()))); $this->testSession->increasePass(); $this->testSession->setLastSequence(0); $this->testSession->saveToDb(); if (!$this->object->canViewResults()) { $this->outIntroductionPage(); } else { $this->ctrl->redirectByClass("ilTestEvaluationGUI", "outUserResultsOverview"); } }
function getTrackingDataAgg($a_user_id, $raw = false) { global $ilDB; $scos = array(); $data = array(); //get all SCO's of this object $val_set = $ilDB->queryF('SELECT cp_node_id FROM cp_node WHERE nodename = %s AND cp_node.slm_id = %s', array('text', 'integer'), array('item', $this->getId())); while ($val_rec = $ilDB->fetchAssoc($val_set)) { array_push($scos, $val_rec['cp_node_id']); } foreach ($scos as $sco) { $data_set = $ilDB->queryF(' SELECT c_timestamp last_access, total_time, success_status, completion_status, c_raw, scaled, cp_node_id FROM cmi_node WHERE cp_node_id = %s AND user_id = %s', array('integer', 'integer'), array($sco, $a_user_id)); while ($data_rec = $ilDB->fetchAssoc($data_set)) { if ($data_rec["success_status"] != "" && $data_rec["success_status"] != "unknown") { $status = $data_rec["success_status"]; } else { if ($data_rec["completion_status"] == "") { $status = "unknown"; } else { $status = $data_rec["completion_status"]; } } if (!$raw) { $time = ilFormat::_secondsToString(self::_ISODurationToCentisec($data_rec["total_time"]) / 100); $score = ""; if ($data_rec["c_raw"] != null) { $score = $data_rec["c_raw"]; if ($data_rec["scaled"] != null) { $score .= " = "; } } if ($data_rec["scaled"] != null) { $score .= $data_rec["scaled"] * 100 . "%"; } $title = self::_lookupItemTitle($data_rec["cp_node_id"]); $last_access = ilDatePresentation::formatDate(new ilDateTime($data_rec['last_access'], IL_CAL_UNIX)); $data[] = array("user_id" => $data_rec["user_id"], "sco_id" => $data_rec["cp_node_id"], "score" => $score, "time" => $time, "status" => $status, "last_access" => $last_access, "title" => $title); } else { $data_rec["session_time"] = self::_ISODurationToCentisec($data_rec["session_time"]) / 100; $data[$data_rec["cp_node_id"]] = $data_rec; } } } return $data; }
/** * build xml export file */ function buildExportFileXLS() { global $ilBench; $ilBench->start("QuestionpoolExport", "buildExportFile"); include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $adapter = new ilExcelWriterAdapter($this->export_dir . "/" . $this->filename, FALSE); $workbook = $adapter->getWorkbook(); $workbook->setVersion(8); // Use Excel97/2000 Format $format_bold =& $workbook->addFormat(); $format_bold->setBold(); $format_percent =& $workbook->addFormat(); $format_percent->setNumFormat("0.00%"); $format_datetime =& $workbook->addFormat(); $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss"); $format_title =& $workbook->addFormat(); $format_title->setBold(); $format_title->setColor('black'); $format_title->setPattern(1); $format_title->setFgColor('silver'); $worksheet =& $workbook->addWorksheet(); $row = 0; $col = 0; // title row include_once "./Services/Excel/classes/class.ilExcelUtils.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("title"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("description"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("question_type"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("author"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("create_date"), "latin1"), $format_title); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("last_update"), "latin1"), $format_title); $col = 0; $row++; $questions = $this->qpl_obj->getQuestionList(); foreach ($questions as $question) { $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["title"], "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["description"], "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($question["type_tag"]), "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text($question["author"], "latin1")); $col++; // ilDatePresentation::formatDate(new ilDateTime($question["created"],IL_CAL_UNIX)) $worksheet->write($row, $col, ilExcelUtils::_convert_text(ilFormat::formatDate(ilFormat::ftimestamp2dateDB($question["created"]), "date"), "latin1")); $col++; $worksheet->write($row, $col, ilExcelUtils::_convert_text(ilFormat::formatDate(ilFormat::ftimestamp2dateDB($question["tstamp"]), "date"), "latin1")); $col = 0; $row++; } $workbook->close(); ilUtil::zip($this->export_dir . "/" . $this->filename, $this->export_dir . "/" . $this->zipfilename); if (@file_exists($this->export_dir . "/" . $this->filename)) { @unlink($this->export_dir . "/" . $this->filename); } }
function showLearningProgress($a_tpl) { global $ilUser, $rbacsystem; if (!$rbacsystem->checkAccess('read', $this->gui_object->object->getRefId())) { return false; } if ($ilUser->getId() == ANONYMOUS_USER_ID) { return false; } include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (!ilObjUserTracking::_enabledLearningProgress() and $ilUser->getId() != ANONYMOUS_USER_ID) { return false; } include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->gui_object->object->getId()); if ($olp->getCurrentMode() != ilLPObjSettings::LP_MODE_MANUAL) { return false; } include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $this->lng->loadLanguageModule('trac'); // section header // $a_tpl->setCurrentBlock("header_row"); $a_tpl->setVariable("TXT_SECTION", $this->lng->txt('learning_progress')); $a_tpl->parseCurrentBlock(); // $a_tpl->touchBlock("row"); // status $i_tpl = new ilTemplate("tpl.lp_edit_manual_info_page.html", true, true, "Services/Tracking"); $i_tpl->setVariable("INFO_EDITED", $this->lng->txt("trac_info_edited")); $i_tpl->setVariable("SELECT_STATUS", ilUtil::formSelect((int) ilLPMarks::_hasCompleted($ilUser->getId(), $this->gui_object->object->getId()), 'lp_edit', array(0 => $this->lng->txt('trac_not_completed'), 1 => $this->lng->txt('trac_completed')), false, true)); $i_tpl->setVariable("TXT_SAVE", $this->lng->txt("save")); $a_tpl->setCurrentBlock("pv"); $a_tpl->setVariable("TXT_PROPERTY_VALUE", $i_tpl->get()); $a_tpl->parseCurrentBlock(); $a_tpl->setCurrentBlock("property_row"); $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_status')); $a_tpl->parseCurrentBlock(); // $a_tpl->touchBlock("row"); // More infos for lm's if ($this->gui_object->object->getType() == 'lm' || $this->gui_object->object->getType() == 'htlm') { $a_tpl->setCurrentBlock("pv"); include_once 'Services/Tracking/classes/class.ilLearningProgress.php'; $progress = ilLearningProgress::_getProgress($ilUser->getId(), $this->gui_object->object->getId()); if ($progress['access_time']) { $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilDatePresentation::formatDate(new ilDateTime($progress['access_time'], IL_CAL_DATETIME))); } else { $a_tpl->setVariable("TXT_PROPERTY_VALUE", $this->lng->txt('trac_not_accessed')); } $a_tpl->parseCurrentBlock(); $a_tpl->setCurrentBlock("property_row"); $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_last_access')); $a_tpl->parseCurrentBlock(); // $a_tpl->touchBlock("row"); // tags of all users $a_tpl->setCurrentBlock("pv"); $a_tpl->setVariable("TXT_PROPERTY_VALUE", (int) $progress['visits']); $a_tpl->parseCurrentBlock(); $a_tpl->setCurrentBlock("property_row"); $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_visits')); $a_tpl->parseCurrentBlock(); // $a_tpl->touchBlock("row"); if ($this->gui_object->object->getType() == 'lm') { // tags of all users $a_tpl->setCurrentBlock("pv"); $a_tpl->setVariable("TXT_PROPERTY_VALUE", ilFormat::_secondsToString($progress['spent_seconds'])); $a_tpl->parseCurrentBlock(); $a_tpl->setCurrentBlock("property_row"); $a_tpl->setVariable("TXT_PROPERTY", $this->lng->txt('trac_spent_time')); $a_tpl->parseCurrentBlock(); // $a_tpl->touchBlock("row"); } } // #10493 $a_tpl->touchBlock("row"); }
/** * Get assignment files */ function getFiles() { $files = array(); if (!is_dir($this->path)) { return $files; } $dp = opendir($this->path); while ($file = readdir($dp)) { if (!is_dir($this->path . '/' . $file)) { $files[] = array('name' => $file, 'size' => filesize($this->path . '/' . $file), 'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s', filectime($this->path . '/' . $file))), 'fullpath' => $this->path . '/' . $file); } } closedir($dp); $files = ilUtil::sortArray($files, "name", "asc"); return $files; }
private function performSaveForm(ilPropertyFormGUI $form) { include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj =& new ilMD($this->testOBJ->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); // title $md_section->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue())); $md_section->update(); // Description $md_desc_ids = $md_section->getDescriptionIds(); if ($md_desc_ids) { $md_desc = $md_section->getDescription(array_pop($md_desc_ids)); $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $md_desc->update(); } else { $md_desc = $md_section->addDescription(); $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $md_desc->save(); } $this->testOBJ->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue())); $this->testOBJ->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue())); $this->testOBJ->update(); // pool usage setting if ($form->getItemByPostVar('use_pool') instanceof ilFormPropertyGUI) { $this->testOBJ->setPoolUsage($form->getItemByPostVar('use_pool')->getChecked()); } // Archiving $this->testOBJ->setEnableArchiving($form->getItemByPostVar('enable_archiving')->getChecked()); // Examview $this->testOBJ->setEnableExamview($form->getItemByPostVar('enable_examview')->getChecked()); $this->testOBJ->setShowExamviewHtml($form->getItemByPostVar('show_examview_html')->getChecked()); $this->testOBJ->setShowExamviewPdf($form->getItemByPostVar('show_examview_pdf')->getChecked()); // online status $this->testOBJ->setOnline($form->getItemByPostVar('online')->getChecked()); // activation if ($form->getItemByPostVar('activation_type')->getValue() == ilObjectActivation::TIMINGS_ACTIVATION) { $this->testOBJ->setActivationLimited(true); $this->testOBJ->setActivationVisibility($form->getItemByPostVar('activation_visibility')->getChecked()); $period = $form->getItemByPostVar("access_period"); $this->testOBJ->setActivationStartingTime($period->getStart()->get(IL_CAL_UNIX)); $this->testOBJ->setActivationEndingTime($period->getEnd()->get(IL_CAL_UNIX)); } else { $this->testOBJ->setActivationLimited(false); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $this->testOBJ->setIntroduction($form->getItemByPostVar('introduction')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->testOBJ->setShowInfo($form->getItemByPostVar('showinfo')->getChecked()); $this->testOBJ->setFinalStatement($form->getItemByPostVar('finalstatement')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment")); $this->testOBJ->setShowFinalStatement($form->getItemByPostVar('showfinalstatement')->getChecked()); if ($form->getItemByPostVar('chb_postpone') instanceof ilFormPropertyGUI) { $this->testOBJ->setSequenceSettings($form->getItemByPostVar('chb_postpone')->getChecked()); } $this->testOBJ->setShuffleQuestions($form->getItemByPostVar('chb_shuffle_questions')->getChecked()); $this->testOBJ->setListOfQuestions($form->getItemByPostVar('list_of_questions')->getChecked()); $listOfQuestionsOptions = $form->getItemByPostVar('list_of_questions_options')->getValue(); if (is_array($listOfQuestionsOptions)) { $this->testOBJ->setListOfQuestionsStart(in_array('chb_list_of_questions_start', $listOfQuestionsOptions)); $this->testOBJ->setListOfQuestionsEnd(in_array('chb_list_of_questions_end', $listOfQuestionsOptions)); $this->testOBJ->setListOfQuestionsDescription(in_array('chb_list_of_questions_with_description', $listOfQuestionsOptions)); } else { $this->testOBJ->setListOfQuestionsStart(0); $this->testOBJ->setListOfQuestionsEnd(0); $this->testOBJ->setListOfQuestionsDescription(0); } if ($form->getItemByPostVar('mailnotification') instanceof ilFormPropertyGUI) { $this->testOBJ->setMailNotification($form->getItemByPostVar('mailnotification')->getValue()); } if ($form->getItemByPostVar('mailnottype') instanceof ilFormPropertyGUI) { $this->testOBJ->setMailNotificationType($form->getItemByPostVar('mailnottype')->getChecked()); } if ($form->getItemByPostVar('chb_show_marker') instanceof ilFormPropertyGUI) { $this->testOBJ->setShowMarker($form->getItemByPostVar('chb_show_marker')->getChecked()); } if ($form->getItemByPostVar('chb_show_cancel') instanceof ilFormPropertyGUI) { $this->testOBJ->setShowCancel($form->getItemByPostVar('chb_show_cancel')->getChecked()); } if ($form->getItemByPostVar('kiosk') instanceof ilFormPropertyGUI) { $this->testOBJ->setKioskMode($form->getItemByPostVar('kiosk')->getChecked()); $kioskOptions = $form->getItemByPostVar('kiosk_options')->getValue(); if (is_array($kioskOptions)) { $this->testOBJ->setShowKioskModeTitle(in_array('kiosk_title', $kioskOptions)); $this->testOBJ->setShowKioskModeParticipant(in_array('kiosk_participant', $kioskOptions)); $this->testOBJ->setExamidInKiosk(in_array('examid_in_kiosk', $_POST["kiosk_options"])); } } // redirect after test if ($form->getItemByPostVar('redirection_enabled')->getChecked()) { $this->testOBJ->setRedirectionMode($form->getItemByPostVar('redirection_mode')->getValue()); } else { $this->testOBJ->setRedirectionMode(REDIRECT_NONE); } if (strlen($form->getItemByPostVar('redirection_url')->getValue())) { $this->testOBJ->setRedirectionUrl($form->getItemByPostVar('redirection_url')->getValue()); } else { $this->testOBJ->setRedirectionUrl(null); } if ($form->getItemByPostVar('sign_submission')->getChecked()) { $this->testOBJ->setSignSubmission(true); } else { $this->testOBJ->setSignSubmission(false); } $this->testOBJ->setEnableProcessingTime($form->getItemByPostVar('chb_processing_time')->getChecked()); if ($this->testOBJ->getEnableProcessingTime()) { $processingTime = $form->getItemByPostVar('processing_time'); $this->testOBJ->setProcessingTime(sprintf("%02d:%02d:%02d", $processingTime->getHours(), $processingTime->getMinutes(), $processingTime->getSeconds())); } else { $this->testOBJ->setProcessingTime(''); } $this->testOBJ->setResetProcessingTime($form->getItemByPostVar('chb_reset_processing_time')->getChecked()); if ($form->getItemByPostVar('chb_starting_time')->getChecked()) { $startingTimeSetting = $form->getItemByPostVar('starting_time'); $this->testOBJ->setStartingTime(ilFormat::dateDB2timestamp($startingTimeSetting->getDate()->get(IL_CAL_DATETIME))); } else { $this->testOBJ->setStartingTime(''); } if ($form->getItemByPostVar('chb_ending_time')->getChecked()) { $endingTimeSetting = $form->getItemByPostVar('ending_time'); $this->testOBJ->setEndingTime(ilFormat::dateDB2timestamp($endingTimeSetting->getDate()->get(IL_CAL_DATETIME))); } else { $this->testOBJ->setEndingTime(''); } if ($form->getItemByPostVar('forcejs') instanceof ilFormPropertyGUI) { $this->testOBJ->setForceJS($form->getItemByPostVar('forcejs')->getChecked()); } if ($form->getItemByPostVar('title_output') instanceof ilFormPropertyGUI) { $this->testOBJ->setTitleOutput($form->getItemByPostVar('title_output')->getValue()); } if ($form->getItemByPostVar('password') instanceof ilFormPropertyGUI) { $this->testOBJ->setPassword($form->getItemByPostVar('password')->getValue()); } if ($form->getItemByPostVar('allowedUsers') instanceof ilFormPropertyGUI) { $this->testOBJ->setAllowedUsers($form->getItemByPostVar('allowedUsers')->getValue()); } if ($form->getItemByPostVar('allowedUsersTimeGap') instanceof ilFormPropertyGUI) { $this->testOBJ->setAllowedUsersTimeGap($form->getItemByPostVar('allowedUsersTimeGap')->getValue()); } // Selector for uicode characters global $ilSetting; if ($ilSetting->get('char_selector_availability') > 0) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->addFormProperties($form); $char_selector->getFormValues($form); $this->testOBJ->setCharSelectorAvailability($char_selector->getConfig()->getAvailability()); $this->testOBJ->setCharSelectorDefinition($char_selector->getConfig()->getDefinition()); } $this->testOBJ->setAutosave($form->getItemByPostVar('autosave')->getChecked()); $this->testOBJ->setAutosaveIval($form->getItemByPostVar('autosave_ival')->getValue() * 1000); $this->testOBJ->setUsePreviousAnswers($form->getItemByPostVar('chb_use_previous_answers')->getChecked()); // highscore settings $this->testOBJ->setHighscoreEnabled((bool) $form->getItemByPostVar('highscore_enabled')->getChecked()); $this->testOBJ->setHighscoreAnon((bool) $form->getItemByPostVar('highscore_anon')->getChecked()); $this->testOBJ->setHighscoreAchievedTS((bool) $form->getItemByPostVar('highscore_achieved_ts')->getChecked()); $this->testOBJ->setHighscoreScore((bool) $form->getItemByPostVar('highscore_score')->getChecked()); $this->testOBJ->setHighscorePercentage((bool) $form->getItemByPostVar('highscore_percentage')->getChecked()); $this->testOBJ->setHighscoreHints((bool) $form->getItemByPostVar('highscore_hints')->getChecked()); $this->testOBJ->setHighscoreWTime((bool) $form->getItemByPostVar('highscore_wtime')->getChecked()); $this->testOBJ->setHighscoreOwnTable((bool) $form->getItemByPostVar('highscore_own_table')->getChecked()); $this->testOBJ->setHighscoreTopTable((bool) $form->getItemByPostVar('highscore_top_table')->getChecked()); $this->testOBJ->setHighscoreTopNum((int) $form->getItemByPostVar('highscore_top_num')->getValue()); if (!$this->testOBJ->participantDataExist()) { // question set type if ($form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI) { $this->testOBJ->setQuestionSetType($form->getItemByPostVar('question_set_type')->getValue()); } // anonymity setting $this->testOBJ->setAnonymity($form->getItemByPostVar('anonymity')->getValue()); // nr of tries (max passes) $this->testOBJ->setNrOfTries($form->getItemByPostVar('nr_of_tries')->getValue()); // fixed participants setting if ($form->getItemByPostVar('fixedparticipants') instanceof ilFormPropertyGUI) { $this->testOBJ->setFixedParticipants($form->getItemByPostVar('fixedparticipants')->getChecked()); } } // store settings to db $this->testOBJ->saveToDb(true); // Update ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->testOBJ); $ecs->handleSettingsUpdate(); }
/** * Generates a ZIP file containing all file uploads for a given test and the original id of the question * * @param int $test_id */ public function getFileUploadZIPFile($test_id) { /** @var ilDB $ilDB */ global $ilDB; $query = "\n\t\tSELECT \n\t\t\ttst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi, \n\t\t\ttst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp \n\t\tFROM tst_solutions, tst_active, qpl_questions \n\t\tWHERE tst_solutions.active_fi = tst_active.active_id \n\t\tAND tst_solutions.question_fi = qpl_questions.question_id \n\t\tAND tst_solutions.question_fi = %s \n\t\tAND tst_active.test_fi = %s \n\t\tORDER BY tst_solutions.active_fi, tst_solutions.tstamp"; $result = $ilDB->queryF($query, array("integer", "integer"), array($this->getId(), $test_id)); $zipfile = ilUtil::ilTempnam() . ".zip"; $tempdir = ilUtil::ilTempnam(); if ($result->numRows()) { $userdata = array(); $data .= "<html><head>"; $data .= '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />'; $data .= '<style> table { border: 1px #333 solid; border-collapse:collapse;} td, th { border: 1px #333 solid; padding: 0.25em;} th { color: #fff; background-color: #666;} </style> '; $data .= "<title>" . $this->getTitle() . "</title></head><body>\n"; $data .= "<h1>" . $this->getTitle() . "</h1>\n"; $data .= "<table><thead>\n"; $data .= "<tr><th>" . $this->lng->txt("name") . "</th><th>" . $this->lng->txt("filename") . "</th><th>" . $this->lng->txt("pass") . "</th><th>" . $this->lng->txt("location") . "</th><th>" . $this->lng->txt("date") . "</th></tr></thead><tbody>\n"; while ($row = $ilDB->fetchAssoc($result)) { ilUtil::makeDirParents($tempdir . "/" . $row["active_fi"] . "/" . $row["question_fi"]); @copy($this->getFileUploadPath($test_id, $row["active_fi"], $row["question_fi"]) . $row["value1"], $tempdir . "/" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"]); if (!array_key_exists($row["active_fi"], $userdata)) { include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; $userdata[$row["active_fi"]] = ilObjTestAccess::_getParticipantData($row["active_fi"]); } $data .= "<tr><td>" . $userdata[$row["active_fi"]] . "</td><td><a href=\"" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"] . "\" target=\"_blank\">" . $row["value2"] . "</a></td><td>" . $row["pass"] . "</td><td>" . $row["active_fi"] . "/" . $row["question_fi"] . "/" . $row["value1"] . "</td>"; $data .= "<td>" . ilFormat::fmtDateTime(ilFormat::unixtimestamp2datetime($row["tstamp"]), $this->lng->txt("lang_dateformat"), $this->lng->txt("lang_timeformat"), "datetime", FALSE) . "</td>"; $data .= "</tr>\n"; } $data .= "</tbody></table>\n"; $data .= "</body></html>\n"; $indexfile = $tempdir . "/index.html"; $fh = fopen($indexfile, 'w'); fwrite($fh, $data); fclose($fh); } ilUtil::zip($tempdir, $zipfile); ilUtil::delDir($tempdir); ilUtil::deliverFile($zipfile, ilUtil::getASCIIFilename($this->getTitle() . ".zip"), "application/zip", false, true); }
/** * render attendance list * * @return string */ public function getHTML() { $tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership'); // title $time = ilFormat::formatUnixTime(time(), true); $tpl->setVariable('TXT_TITLE', $this->title); if ($this->description) { $tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")"); } else { $tpl->setVariable('TXT_DESCRIPTION', $time); } // header $tpl->setCurrentBlock('head_item'); foreach ($this->presets as $id => $item) { if ($item[1]) { $tpl->setVariable('TXT_HEAD', $item[0]); $tpl->parseCurrentBlock(); } } if ($this->blank_columns) { foreach ($this->blank_columns as $blank) { $tpl->setVariable('TXT_HEAD', $blank); $tpl->parseCurrentBlock(); } } // handle members $member_ids = array(); if ($this->show_admins) { $member_ids = array_merge((array) $member_ids, $this->participants->getAdmins()); } if ($this->show_tutors) { $member_ids = array_merge((array) $member_ids, $this->participants->getTutors()); } if ($this->show_members) { $member_ids = array_merge((array) $member_ids, $this->participants->getMembers()); } $member_ids = ilUtil::_sortIds((array) $member_ids, 'usr_data', 'lastname', 'usr_id'); // rows foreach ($member_ids as $user_id) { if ($this->callback) { $user_data = call_user_func_array($this->callback, array($user_id)); $tpl->setCurrentBlock("row_preset"); foreach ($this->presets as $id => $item) { if ($item[1]) { switch ($id) { case "name": if (!$user_data[$id]) { $name = ilObjUser::_lookupName($user_id); $value = $name["lastname"] . ", " . $name["firstname"]; break; } case "email": if (!$user_data[$id]) { $value = ilObjUser::_lookupEmail($user_id); break; } case "login": if (!$user_data[$id]) { $value = ilObjUser::_lookupLogin($user_id); break; } default: $value = (string) $user_data[$id]; break; } $tpl->setVariable("TXT_PRESET", $value); $tpl->parseCurrentBlock(); } } } if ($this->blank_columns) { for ($loop = 0; $loop < sizeof($this->blank_columns); $loop++) { $tpl->touchBlock('row_blank'); } } $tpl->touchBlock("member_row"); } return $tpl->get(); }
/** * format a date according to the user language * shortcut for Format::fmtDateTime * @access public * @param string sql date * @param string format mode * @param boolean Relative date output * @return string formatted date * @see Format::fmtDateTime * @deprecated since 3.10 - 05.03.2009 */ function formatDate($a_date, $a_mode = "datetime", $a_omit_seconds = false, $a_relative = TRUE) { global $lng; // return when no datetime is given if ($a_date == "0000-00-00 00:00:00") { return $lng->txt("no_date"); } $dateformat = $lng->txt("lang_dateformat"); if ($a_omit_seconds && $lng->txt("lang_timeformat_no_sec") != "-lang_timeformat_no_sec-") { $timeformat = $lng->txt("lang_timeformat_no_sec"); } else { $timeformat = $lng->txt("lang_timeformat"); } if ($dateformat == "-lang_dateformat-") { $dateformat = ""; } if ($timeformat == "-lang_timeformat-") { $timeformat = ""; } return ilFormat::fmtDateTime($a_date, $dateformat, $timeformat, $a_mode, $a_relative); }
/** * export released * * @access protected * @return */ protected function exportReleased() { global $ilObjDataCache; include_once './Services/WebServices/ECS/classes/class.ilECSExport.php'; $exported = ilECSExport::getExportedIds(); $ilObjDataCache->preloadObjectCache($exported); include_once 'Services/Utilities/classes/class.ilCSVWriter.php'; $writer = new ilCSVWriter(); $writer->addColumn($this->lng->txt('title')); $writer->addColumn($this->lng->txt('description')); $writer->addColumn($this->lng->txt('ecs_field_courseID')); $writer->addColumn($this->lng->txt('ecs_field_term')); $writer->addColumn($this->lng->txt('ecs_field_lecturer')); $writer->addColumn($this->lng->txt('ecs_field_courseType')); $writer->addColumn($this->lng->txt('ecs_field_semester_hours')); $writer->addColumn($this->lng->txt('ecs_field_credits')); $writer->addColumn($this->lng->txt('ecs_field_room')); $writer->addColumn($this->lng->txt('ecs_field_cycle')); $writer->addColumn($this->lng->txt('ecs_field_begin')); $writer->addColumn($this->lng->txt('ecs_field_end')); $writer->addColumn($this->lng->txt('last_update')); include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php'; $settings = ilECSDataMappingSettings::_getInstance(); foreach ($exported as $obj_id) { include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php'; $values = ilAdvancedMDValues::_getValuesByObjId($obj_id); $writer->addRow(); $writer->addColumn(ilObject::_lookupTitle($obj_id)); $writer->addColumn(ilObject::_lookupDescription($obj_id)); $field = $settings->getMappingByECSName('courseID'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('term'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('lecturer'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('courseType'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('semester_hours'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('credits'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('room'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('cycle'); $writer->addColumn(isset($values[$field]) ? $values[$field] : ''); $field = $settings->getMappingByECSName('begin'); $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : ''); $field = $settings->getMappingByECSName('end'); $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : ''); $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id)); } ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv"); }
/** * show information screen */ function infoScreenForward() { global $ilTabs, $ilErr, $ilToolbar; $ilTabs->activateTab("id_info"); if (!$this->checkPermissionBool("visible")) { $ilErr->raiseError($this->lng->txt("msg_no_perm_read")); } include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); if ($this->checkPermissionBool("read", "sendfile")) { // #9876 $this->lng->loadLanguageModule("file"); // #14378 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setCaption("file_download"); $button->setPrimary(true); // get permanent download link for repository if ($this->id_type == self::REPOSITORY_NODE_ID) { $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id)); } else { $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile")); } $ilToolbar->addButtonInstance($button); } $info->enablePrivateNotes(); if ($this->checkPermissionBool("read")) { $info->enableNews(); } // no news editing for files, just notifications $info->enableNewsEditing(false); if ($this->checkPermissionBool("write")) { $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); if ($enable_internal_rss) { $info->setBlockProperty("news", "settings", true); $info->setBlockProperty("news", "public_notifications_option", true); } } // standard meta data $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); $info->addSection($this->lng->txt("file_info")); $info->addProperty($this->lng->txt("filename"), $this->object->getFileName()); // BEGIN WebDAV Guess file type. $info->addProperty($this->lng->txt("type"), $this->object->guessFileType()); // END WebDAV Guess file type. $info->addProperty($this->lng->txt("size"), ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()), 'long')); $info->addProperty($this->lng->txt("version"), $this->object->getVersion()); // using getVersions function instead of ilHistory direct $uploader = $this->object->getVersions(); $uploader = array_shift($uploader); $uploader = $uploader["user_id"]; $this->lng->loadLanguageModule("file"); include_once "Services/User/classes/class.ilUserUtil.php"; $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader)); // download link added in repository if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) { $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File"); $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id)); $info->addProperty($this->lng->txt("download_link"), $tpl->get()); } if ($this->id_type == self::WORKSPACE_NODE_ID) { $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget()); } // display previews include_once "./Services/Preview/classes/class.ilPreview.php"; if (!$this->ctrl->isAsynch() && ilPreview::hasPreview($this->object->getId(), $this->object->getType()) && $this->checkPermissionBool("read")) { include_once "./Services/Preview/classes/class.ilPreviewGUI.php"; // get context for access checks later on $context; switch ($this->id_type) { case self::WORKSPACE_NODE_ID: case self::WORKSPACE_OBJECT_ID: $context = ilPreviewGUI::CONTEXT_WORKSPACE; break; default: $context = ilPreviewGUI::CONTEXT_REPOSITORY; break; } $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler); $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML()); } // forward the command // $this->ctrl->setCmd("showSummary"); // $this->ctrl->setCmdClass("ilinfoscreengui"); $this->ctrl->forwardCommand($info); }
/** * init general settings form * @return */ protected function initFormGeneralSettings() { global $ilSetting; $this->setSubTabs('settings'); $this->tabs_gui->setTabActive('settings'); $this->tabs_gui->setSubTabActive('general_settings'); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings')); $this->form->setTitle($this->lng->txt('general_settings')); $lua = new ilCheckboxInputGUI($this->lng->txt('enable_local_user_administration'), 'lua'); $lua->setInfo($this->lng->txt('enable_local_user_administration_info')); $lua->setValue(1); $this->form->addItem($lua); $lrua = new ilCheckboxInputGUI($this->lng->txt('restrict_user_access'), 'lrua'); $lrua->setInfo($this->lng->txt('restrict_user_access_info')); $lrua->setValue(1); $this->form->addItem($lrua); // enable alphabetical navigation in user administration $alph = new ilCheckboxInputGUI($this->lng->txt('user_adm_enable_alpha_nav'), 'user_adm_alpha_nav'); //$alph->setInfo($this->lng->txt('restrict_user_access_info')); $alph->setValue(1); $this->form->addItem($alph); // account codes $code = new ilCheckboxInputGUI($this->lng->txt("user_account_code_setting"), "user_reactivate_code"); $code->setInfo($this->lng->txt('user_account_code_setting_info')); $this->form->addItem($code); // delete own account $own = new ilCheckboxInputGUI($this->lng->txt("user_allow_delete_own_account"), "user_own_account"); $this->form->addItem($own); $own_email = new ilEMailInputGUI($this->lng->txt("user_delete_own_account_notification_email"), "user_own_account_email"); $own->addSubItem($own_email); // BEGIN SESSION SETTINGS // create session handling radio group $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type'); // first option, fixed session duration $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED); // create session reminder subform $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled"); $expires = ilSession::getSessionExpireValue(); $time = ilFormat::_secondsToString($expires, true); $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time)); $fixed->addSubItem($cb); // add session handling to radio group $ssettings->addOption($fixed); // second option, session control $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT); // add session control subform require_once 'Services/Authentication/classes/class.ilSessionControl.php'; // this is the max count of active sessions // that are getting started simlutanously $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_count_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (min) idle time the session can be deleted, // if there are further requests for new sessions, // but max session count is reached yet $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_min_idle_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (max) idle timeout the session expires // and become invalid, so it is not considered anymore // when calculating current count of active sessions $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // this is the max duration that can elapse between the first and the secnd // request to the system before the session is immidietly deleted $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info')); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // add session control to radio group $ssettings->addOption($ldsh); // add radio group to form if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { // just shows the status wether the session //setting maintenance is allowed by setup $this->form->addItem($ssettings); } else { // just shows the status wether the session //setting maintenance is allowed by setup $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config"); $ti->setValue($this->lng->txt('session_config_maintenance_disabled')); $ssettings->setDisabled(true); $ti->addSubItem($ssettings); $this->form->addItem($ti); } // END SESSION SETTINGS $this->lng->loadLanguageModule('ps'); $pass = new ilFormSectionHeaderGUI(); $pass->setTitle($this->lng->txt('ps_password_settings')); $this->form->addItem($pass); // password generation $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate"); $cb->setChecked($ilSetting->get("passwd_auto_generate")); $cb->setInfo($this->lng->txt("passwd_generation_info")); $this->form->addItem($cb); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_change_on_first_login_enabled'), 'password_change_on_first_login_enabled'); $check->setInfo($this->lng->txt('ps_password_change_on_first_login_enabled_info')); $this->form->addItem($check); include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php'; $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_must_not_contain_loginame'), 'password_must_not_contain_loginame'); $check->setInfo($this->lng->txt('ps_password_must_not_contain_loginame_info')); $this->form->addItem($check); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_chars_and_numbers_enabled'), 'password_chars_and_numbers_enabled'); //$check->setOptionTitle($this->lng->txt('ps_password_chars_and_numbers_enabled')); $check->setInfo($this->lng->txt('ps_password_chars_and_numbers_enabled_info')); $this->form->addItem($check); $check = new ilCheckboxInputGUI($this->lng->txt('ps_password_special_chars_enabled'), 'password_special_chars_enabled'); //$check->setOptionTitle($this->lng->txt('ps_password_special_chars_enabled')); $check->setInfo($this->lng->txt('ps_password_special_chars_enabled_info')); $this->form->addItem($check); $text = new ilNumberInputGUI($this->lng->txt('ps_password_min_length'), 'password_min_length'); $text->setInfo($this->lng->txt('ps_password_min_length_info')); $text->setSize(1); $text->setMaxLength(2); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_length'), 'password_max_length'); $text->setInfo($this->lng->txt('ps_password_max_length_info')); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_uppercase_chars_num'), 'password_ucase_chars_num'); $text->setInfo($this->lng->txt('ps_password_uppercase_chars_num_info')); $text->setMinValue(0); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_lowercase_chars_num'), 'password_lowercase_chars_num'); $text->setInfo($this->lng->txt('ps_password_lowercase_chars_num_info')); $text->setMinValue(0); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); $text = new ilNumberInputGUI($this->lng->txt('ps_password_max_age'), 'password_max_age'); $text->setInfo($this->lng->txt('ps_password_max_age_info')); $text->setSize(2); $text->setMaxLength(3); $this->form->addItem($text); // password assistance $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance"); $cb->setInfo($this->lng->txt("password_assistance_info")); $this->form->addItem($cb); $pass = new ilFormSectionHeaderGUI(); $pass->setTitle($this->lng->txt('ps_security_protection')); $this->form->addItem($pass); $text = new ilNumberInputGUI($this->lng->txt('ps_login_max_attempts'), 'login_max_attempts'); $text->setInfo($this->lng->txt('ps_login_max_attempts_info')); $text->setSize(1); $text->setMaxLength(2); $this->form->addItem($text); // prevent login from multiple pcs at the same time $objCb = new ilCheckboxInputGUI($this->lng->txt('ps_prevent_simultaneous_logins'), 'ps_prevent_simultaneous_logins'); $objCb->setValue(1); $objCb->setInfo($this->lng->txt('ps_prevent_simultaneous_logins_info')); $this->form->addItem($objCb); $log = new ilFormSectionHeaderGUI(); $log->setTitle($this->lng->txt('loginname_settings')); $this->form->addItem($log); $chbChangeLogin = new ilCheckboxInputGUI($this->lng->txt('allow_change_loginname'), 'allow_change_loginname'); $chbChangeLogin->setValue(1); $this->form->addItem($chbChangeLogin); $chbCreateHistory = new ilCheckboxInputGUI($this->lng->txt('history_loginname'), 'create_history_loginname'); $chbCreateHistory->setInfo($this->lng->txt('loginname_history_info')); $chbCreateHistory->setValue(1); $chbChangeLogin->addSubItem($chbCreateHistory); $chbReuseLoginnames = new ilCheckboxInputGUI($this->lng->txt('reuse_of_loginnames_contained_in_history'), 'reuse_of_loginnames'); $chbReuseLoginnames->setValue(1); $chbReuseLoginnames->setInfo($this->lng->txt('reuse_of_loginnames_contained_in_history_info')); $chbChangeLogin->addSubItem($chbReuseLoginnames); $chbChangeBlockingTime = new ilNumberInputGUI($this->lng->txt('loginname_change_blocking_time'), 'loginname_change_blocking_time'); $chbChangeBlockingTime->allowDecimals(true); $chbChangeBlockingTime->setSuffix($this->lng->txt('days')); $chbChangeBlockingTime->setInfo($this->lng->txt('loginname_change_blocking_time_info')); $chbChangeBlockingTime->setSize(10); $chbChangeBlockingTime->setMaxLength(10); $chbChangeLogin->addSubItem($chbChangeBlockingTime); $this->form->addCommandButton('saveGeneralSettings', $this->lng->txt('save')); }
public function showStatistics() { global $rbacsystem, $ilToolbar, $ilObjDataCache; // MINIMUM ACCESS LEVEL = 'read' /* if(!$rbacsystem->checkAccess('read', $this->getRefId())) { $this->ilias->raiseError($this->lng->txt('msg_no_perm_read'),$this->ilias->error_obj->MESSAGE); } */ $ilToolbar->addButton($this->lng->txt('paya_add_customer'), $this->ctrl->getLinkTarget($this, 'showObjectSelector')); if (!$_POST['show_filter'] && $_POST['updateView'] == '1') { $this->resetFilter(); } else { if ($_POST['updateView'] == 1) { $_SESSION['pay_statistics']['show_filter'] = $_POST['show_filter']; $_SESSION['pay_statistics']['updateView'] = true; $_SESSION['pay_statistics']['until_check'] = $_POST['until_check']; $_SESSION['pay_statistics']['from_check'] = $_POST['from_check']; $_SESSION['pay_statistics']['transaction_type'] = isset($_POST['transaction_type']) ? $_POST['transaction_type'] : ''; $_SESSION['pay_statistics']['transaction_value'] = isset($_POST['transaction_value']) ? $_POST['transaction_value'] : ''; $_SESSION['pay_statistics']['filter_title_id'] = (int) $_POST['filter_title_id']; if ($_SESSION['pay_statistics']['from_check'] == '1') { $_SESSION['pay_statistics']['from']['date']['d'] = $_POST['from']['date']['d']; $_SESSION['pay_statistics']['from']['date']['m'] = $_POST['from']['date']['m']; $_SESSION['pay_statistics']['from']['date']['y'] = $_POST['from']['date']['y']; } else { $_SESSION['pay_statistics']['from']['date']['d'] = ''; $_SESSION['pay_statistics']['from']['date']['m'] = ''; $_SESSION['pay_statistics']['from']['date']['y'] = ''; } if ($_SESSION['pay_statistics']['until_check'] == '1') { $_SESSION['pay_statistics']['til']['date']['d'] = $_POST['til']['date']['d']; $_SESSION['pay_statistics']['til']['date']['m'] = $_POST['til']['date']['m']; $_SESSION['pay_statistics']['til']['date']['y'] = $_POST['til']['date']['y']; } else { $_SESSION['pay_statistics']['til']['date']['d'] = ''; $_SESSION['pay_statistics']['til']['date']['m'] = ''; $_SESSION['pay_statistics']['til']['date']['y'] = ''; } $_SESSION['pay_statistics']['payed'] = $_POST['payed']; $_SESSION['pay_statistics']['access'] = $_POST['access']; $_SESSION['pay_statistics']['pay_method'] = $_POST['pay_method']; $_SESSION['pay_statistics']['customer'] = isset($_POST['customer']) ? $_POST['customer'] : ''; $_SESSION['pay_statistics']['vendor'] = isset($_POST['vendor']) ? $_POST['vendor'] : ''; } } $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; // FILTER FORM $filter_form = new ilPropertyFormGUI(); $filter_form->setFormAction($this->ctrl->getFormAction($this)); $filter_form->setTitle($this->lng->txt('pay_filter')); $filter_form->setId('formular'); $filter_form->setTableWidth('100 %'); $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter'); $o_hide_check->setValue(1); $o_hide_check->setChecked($_SESSION['pay_statistics']['show_filter'] ? 1 : 0); $o_hidden = new ilHiddenInputGUI('updateView'); $o_hidden->setValue(1); $o_hidden->setPostVar('updateView'); $o_hide_check->addSubItem($o_hidden); $o_transaction_type = new ilSelectInputGUI(); $trans_option = array($this->lng->txt('pay_starting'), $this->lng->txt('pay_ending')); $trans_value = array('0', '1'); $o_transaction_type->setTitle($this->lng->txt('paya_transaction')); $o_transaction_type->setOptions($trans_option); $o_transaction_type->setValue($_SESSION['pay_statistics']['transaction_type']); $o_transaction_type->setPostVar('transaction_type'); $o_hide_check->addSubItem($o_transaction_type); $o_transaction_val = new ilTextInputGUI(); $o_transaction_val->setValue($_SESSION['pay_statistics']['transaction_value']); $o_transaction_val->setPostVar('transaction_value'); $o_hide_check->addSubItem($o_transaction_val); $o_customer = new ilTextInputGUI(); $o_customer->setTitle($this->lng->txt('paya_customer')); $o_customer->setValue($_SESSION['pay_statistics']['customer']); $o_customer->setPostVar('customer'); $o_hide_check->addSubItem($o_customer); $o_vendor = new ilTextInputGUI(); $o_vendor->setTitle($this->lng->txt('paya_vendor')); $o_vendor->setValue($_SESSION['pay_statistics']['vendor']); $o_vendor->setPostVar('vendor'); $o_hide_check->addSubItem($o_vendor); $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_from'), 'from_check'); $o_from_check->setValue(1); $o_from_check->setChecked($_SESSION['pay_statistics']['from_check'] ? 1 : 0); $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setPostVar('from'); $_POST['from'] = $_SESSION['pay_statistics']['from']; if ($_SESSION['pay_statistics']['from_check'] == '1') { $o_date_from->checkInput(); } $o_from_check->addSubItem($o_date_from); $o_hide_check->addSubItem($o_from_check); $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_til'), 'until_check'); $o_until_check->setValue(1); $o_until_check->setChecked($_SESSION['pay_statistics']['until_check'] ? 1 : 0); $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setPostVar('til'); $_POST['til'] = $_SESSION['pay_statistics']['til']; if ($_SESSION['pay_statistics']['until_check'] == '1') { $o_date_until->checkInput(); } $o_until_check->addSubItem($o_date_until); $o_hide_check->addSubItem($o_until_check); // title filter $this->__initBookingObject(); $title_options['all'] = $this->lng->txt('pay_all'); $unique_titles = $this->booking_obj->getUniqueTitles(); if (is_array($unique_titles) && count($unique_titles)) { foreach ($unique_titles as $ref_id) { $title_options[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id)); } } $o_object_title = new ilSelectInputGUI(); $o_object_title->setTitle($this->lng->txt('title')); $o_object_title->setOptions($title_options); $o_object_title->setValue($_SESSION["pay_statistics"]["filter_title_id"]); $o_object_title->setPostVar('filter_title_id'); $o_hide_check->addSubItem($o_object_title); $o_payed = new ilSelectInputGUI(); $payed_option = array('all' => $this->lng->txt('pay_all'), '1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no')); $o_payed->setTitle($this->lng->txt('paya_payed')); $o_payed->setOptions($payed_option); $o_payed->setValue($_SESSION['pay_statistics']['payed']); $o_payed->setPostVar('payed'); $o_hide_check->addSubItem($o_payed); $o_access = new ilSelectInputGUI(); $access_option = array('all' => $this->lng->txt('pay_all'), '1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no')); $o_access->setTitle($this->lng->txt('paya_access')); $o_access->setOptions($access_option); $o_access->setValue($_SESSION['pay_statistics']['access']); $o_access->setPostVar('access'); $o_hide_check->addSubItem($o_access); $o_paymethod = new ilSelectInputGUI(); $o_paymethod->setTitle($this->lng->txt('payment_system')); $o_paymethod->setOptions(ilPayMethods::getPayMethodsOptions('all')); $o_paymethod->setValue($_SESSION['pay_statistics']['pay_method']); $o_paymethod->setPostVar('pay_method'); $o_hide_check->addSubItem($o_paymethod); $filter_form->addCommandButton('showStatistics', $this->lng->txt('pay_update_view')); $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter')); $filter_form->addItem($o_hide_check); $this->tpl->setVariable('FORM', $filter_form->getHTML()); // STATISTICS TABLE $this->__initBookingObject(); if (!count($bookings = $this->booking_obj->getBookings())) { ilUtil::sendInfo($this->lng->txt('paya_no_bookings')); return true; } # $this->__showButton('excelExport',$this->lng->txt('excel_export')); include_once 'Services/User/classes/class.ilObjUser.php'; $object_title_cache = array(); $user_title_cache = array(); $counter = 0; foreach ($bookings as $booking) { if (array_key_exists($booking['ref_id'], $object_title_cache)) { $tmp_obj = $object_title_cache[$booking['ref_id']]; } else { $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id'])); $object_title_cache[$booking['ref_id']] = $tmp_obj; } if (array_key_exists($booking['b_vendor_id'], $user_title_cache)) { $tmp_vendor = $user_title_cache[$booking['b_vendor_id']]; } else { $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']); $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor; } if (array_key_exists($booking['customer_id'], $user_title_cache)) { $tmp_purchaser = $user_title_cache[$booking['customer_id']]; } else { $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']); $user_title_cache[$booking['customer_id']] = $tmp_purchaser; } $transaction = $booking['transaction_extern']; $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']); $transaction .= " (" . $str_paymethod . ")"; $f_result[$counter]['transaction'] = $transaction; $f_result[$counter]['object_title'] = $tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted'); $f_result[$counter]['vendor'] = $tmp_vendor != '' ? '[' . $tmp_vendor . ']' : $this->lng->txt('user_deleted'); $f_result[$counter]['customer'] = $tmp_purchaser != '' ? '[' . $tmp_purchaser . ']' : $this->lng->txt('user_deleted'); $f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX)); if ($booking['duration'] == 0) { $booking['duration'] = $this->lng->txt('unlimited_duration'); } $f_result[$counter]['duration'] = $booking['duration']; $f_result[$counter]['price'] = ilFormat::_getLocalMoneyFormat($booking['price']) . ' ' . $booking['currency_unit']; $f_result[$counter]['discount'] = $booking['discount'] . ' ' . $booking['currency_unit']; $payed_access = $booking['payed'] ? $this->lng->txt('yes') : $this->lng->txt('no'); $payed_access .= '/'; $payed_access .= $booking['access_granted'] ? $this->lng->txt('yes') : $this->lng->txt('no'); $f_result[$counter]['payed_access'] = $payed_access; $this->ctrl->setParameter($this, "booking_id", $booking['booking_id']); $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editStatistic") . "\">" . $this->lng->txt("edit") . "</a></div>"; $f_result[$counter]['edit'] = $link_change; unset($tmp_obj); unset($tmp_vendor); unset($tmp_purchaser); ++$counter; } return $this->__showStatisticTable($f_result); }
public function editPricesObject($a_show_delete = false) { /** * @var $ilToolbar ilToolbarGUI * */ global $ilToolbar; if ($a_show_delete == false) { unset($_SESSION['price_ids']); } $_SESSION['price_ids'] = $_SESSION['price_ids'] ? $_SESSION['price_ids'] : array(); if (!$_GET['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); $this->objectsObject(); return true; } $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'objects')); $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails')); $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices')); $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit')); $this->__initPaymentObject((int) $_GET['pobject_id']); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_obj = new ilPaymentPrices((int) $_GET['pobject_id']); $standard_prices = array(); $extension_prices = array(); $standard_prices = $price_obj->getPrices(); $extension_prices = $price_obj->getExtensionPrices(); $prices = array_merge($standard_prices, $extension_prices); // No prices created if (!count($prices)) { ilUtil::sendInfo($this->lng->txt('paya_no_price_available')); $ilToolbar->addButton($this->lng->txt('paya_add_price'), $this->ctrl->getLinkTarget($this, 'addPrice')); return true; } // Show confirm delete if ($a_show_delete) { $oConfirmationGUI = new ilConfirmationGUI(); // set confirm/cancel commands $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performDeletePrice")); $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_selected_prices")); $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editPrices"); $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeletePrice"); foreach ($prices as $price) { $delete_row = ''; $tmp_price = ''; if (in_array($price['price_id'], $_SESSION['price_ids'])) { switch ($price['price_type']) { case ilPaymentPrices::TYPE_DURATION_DATE: include_once './Services/Calendar/classes/class.ilDatePresentation.php'; $tmp_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)); break; case ilPaymentPrices::TYPE_DURATION_MONTH: $tmp_price = $price['duration'] . ' ' . $this->lng->txt('paya_months'); break; case ilPaymentPrices::TYPE_UNLIMITED_DURATION: $tmp_price = $this->lng->txt('unlimited_duration'); break; } $delete_row .= '' . $tmp_price . ' -> ' . ilFormat::_getLocalMoneyFormat($price['price']) . ' ' . $this->genSetData->get('currency_unit'); $oConfirmationGUI->addItem('', $delete_row, $delete_row); } } $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML()); return true; } // Fill table cells /** * @var object $tpl ilTemplate */ $tpl = new ilTemplate('tpl.table.html', true, true); // set table header $tpl->setCurrentBlock('tbl_form_header'); $tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this)); $tpl->parseCurrentBlock(); $counter = 0; $data = array(); foreach ($prices as $price) { $data[$counter]['price_id'] = ilUtil::formCheckBox(in_array($price['price_id'], $_SESSION['price_ids']) ? 1 : 0, 'price_ids[]', $price['price_id']); switch ($price['price_type']) { case ilPaymentPrices::TYPE_DURATION_MONTH: $data[$counter]['duration'] = $price['duration'] . ' ' . $this->lng->txt('paya_months'); break; case ilPaymentPrices::TYPE_DURATION_DATE: $data[$counter]['duration'] = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)); break; case ilPaymentPrices::TYPE_UNLIMITED_DURATION: $data[$counter]['duration'] = $this->lng->txt('unlimited_duration'); break; } $data[$counter]['price'] = ilFormat::_getLocalMoneyFormat($price['price']); $data[$counter]['currency_unit'] = $this->genSetData->get('currency_unit'); $data[$counter]['extension'] = ilUtil::formCheckBox($price['extension'] ? 1 : 0, 'extension_ids[]', (int) $price['price_id'], true); $this->ctrl->setParameter($this, "price_id", $price['price_id']); $data[$counter]['edit'] = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editPrice") . "\">" . $this->lng->txt("edit") . "</a></div>"; ++$counter; } $this->__editPricesTable($data); return true; }
function __formatBody($a_ass_id) { global $lng; $lng->loadLanguageModule("exc"); include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $ass = new ilExAssignment($a_ass_id); $body = $ass->getInstruction(); $body .= "\n\n"; if ($ass->getDeadline() == 0) { $body .= $lng->txt("exc_edit_until") . ": " . $lng->txt("exc_no_deadline_specified"); } else { $body .= $lng->txt("exc_edit_until") . ": " . ilFormat::formatDate(date("Y-m-d H:i:s", $ass->getDeadline()), "datetime", true); } $body .= "\n\n"; $body .= ILIAS_HTTP_PATH . "/goto.php?target=" . $this->getType() . "_" . $this->getRefId() . "&client_id=" . CLIENT_ID; return $body; }
function __renderItem($item, $level) { global $ilUser, $ilAccess; include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php'; include_once './Services/Link/classes/class.ilLink.php'; include_once './Services/MetaData/classes/class.ilMDEducational.php'; if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) { return false; } $this->lng->loadLanguageModule('meta'); $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId()); for ($i = 0; $i < $level; $i++) { $this->tpl->touchBlock('start_indent'); $this->tpl->touchBlock('end_indent'); } if (strlen($item['description'])) { $this->tpl->setCurrentBlock("item_description"); $this->tpl->setVariable("DESC", $item['description']); $this->tpl->parseCurrentBlock(); } if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) { $this->tpl->setCurrentBlock("tlt"); $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time')); $this->tpl->setVariable("TLT_VAL", ilFormat::_secondsToString($tlt)); $this->tpl->parseCurrentBlock(); } if ($ilAccess->checkAccess('read', '', $item['ref_id'])) { $this->tpl->setCurrentBlock("title_as_link"); $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type'])); $this->tpl->setVariable("TITLE_NAME", $item['title']); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("title_plain"); $this->tpl->setVariable("TITLE", $item['title']); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("container_standard_row"); if (isset($this->invalid["{$item['ref_id']}"])) { $this->tpl->setVariable("ROWCLASS", 'tblrowmarked'); } else { $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2')); } #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.png')); $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small')); $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type'])); if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) { $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX))); $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX))); } if ($item['changeable']) { $item_prefix = "item[" . $item['ref_id'] . ']'; if (is_array($_POST['item']["{$item['ref_id']}"]['own_start'])) { #echo "Start post<br>"; $start = $this->__toUnix($_POST['item']["{$item['ref_id']}"]['own_start']); } elseif ($usr_planed->getPlanedStartingTime()) { #echo "Own start<br>"; $start = $usr_planed->getPlanedStartingTime(); } else { #echo "Empfehlung start<br>"; $start = $item['suggestion_start']; } $date = $this->__prepareDateSelect($start); $this->tpl->setVariable("OWN_START", ilUtil::makeDateSelect($item_prefix . "[own_start]", $date['y'], $date['m'], $date['d'], date('Y', time()), false)); if ($usr_planed->getPlanedEndingTime()) { #echo "Own End<br>"; $end = $usr_planed->getPlanedEndingTime(); } else { #echo "Empfehlung end<br>"; $end = $item['suggestion_end']; } $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX))); $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]"); // Duration if (isset($_POST['item']["{$item['ref_id']}"]['duration'])) { $this->tpl->setVariable("VAL_DURATION", $_POST['item']["{$item['ref_id']}"]['duration']); } else { $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24))); } $this->tpl->setVariable('LIM_START', ilDatePresentation::formatDate(new ilDate($item['earliest_start'], IL_CAL_UNIX))); $this->tpl->setVariable('LIM_END', ilDatePresentation::formatDate(new ilDate($item['latest_end'], IL_CAL_UNIX))); } $this->tpl->parseCurrentBlock(); if (!$_SESSION['crs_timings_user_hidden']) { return true; } foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) { $this->__renderItem($item_data, $level + 1); } }
function listUsersGroup() { global $rbacsystem, $rbacreview, $tree; $_SESSION["grp_group"] = $_POST["group"] = $_POST["group"] ? $_POST["group"] : $_SESSION["grp_group"]; // MINIMUM ACCESS LEVEL = 'administrate' if (!$rbacsystem->checkAccess("write", $this->ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilias->error_obj->MESSAGE); } if (!is_array($_POST["group"])) { ilUtil::sendFailure($this->lng->txt("grp_no_groups_selected")); $this->searchObject(); return false; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.grp_usr_selection.html", "Modules/Group"); $this->__showButton("searchUserForm", $this->lng->txt("grp_new_search")); // GET ALL MEMBERS $members = array(); foreach ($_POST["group"] as $group_id) { if (!$tree->isInTree($group_id)) { continue; } if (!($tmp_obj = ilObjectFactory::getInstanceByRefId($group_id))) { continue; } $members = array_merge($tmp_obj->getGroupMemberIds(), $members); unset($tmp_obj); } $members = array_unique($members); // FORMAT USER DATA $counter = 0; $f_result = array(); foreach ($members as $user) { if (!($tmp_obj = ilObjectFactory::getInstanceByObjId($user, false))) { continue; } $user_ids[$counter] = $user; $f_result[$counter][] = ilUtil::formCheckbox(0, "user[]", $user); $f_result[$counter][] = $tmp_obj->getLogin(); $f_result[$counter][] = $tmp_obj->getLastname(); $f_result[$counter][] = $tmp_obj->getFirstname(); $f_result[$counter][] = ilFormat::formatDate($tmp_obj->getLastLogin()); unset($tmp_obj); ++$counter; } $this->__showSearchUserTable($f_result, $user_ids, "listUsersGroup"); return true; }