/**
  * 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'));
 }
 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;
 }
Esempio n. 3
0
 /**
  * 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;
     }
 }
 /**
  * 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());
 }
 /**
  * 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 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;
 }
 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;
 }
 /**
  * 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;
 }
 function __readFiles($a_dir = '')
 {
     $a_dir = $a_dir ? $a_dir : $this->getPath();
     $this->files = array();
     $dp = opendir($a_dir);
     while ($file = readdir($dp)) {
         if ($file == "." or $file == "..") {
             continue;
         }
         $this->files[] = array('name' => $file, 'abs_path' => $a_dir . "/" . $file, 'size' => filesize($a_dir . "/" . $file), 'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s', filectime($a_dir . '/' . $file))));
     }
     closedir($dp);
     return true;
 }
 function getFilesOfPost()
 {
     $files = array();
     $dp = opendir($this->forum_path);
     while ($file = readdir($dp)) {
         if (is_dir($file)) {
             continue;
         }
         list($obj_id, $rest) = split('_', $file, 2);
         if ($obj_id == $this->obj_id) {
             list($pos_id, $rest) = split('_', $rest, 2);
             if ($pos_id == $this->getPosId()) {
                 if (!is_dir($this->forum_path . '/' . $file)) {
                     $files[] = array('path' => $this->forum_path . '/' . $file, 'md5' => md5($this->obj_id . '_' . $this->pos_id . '_' . $rest), 'name' => $rest, 'size' => filesize($this->forum_path . '/' . $file), 'ctime' => ilFormat::formatDate(date('Y-m-d H:i:s', filectime($this->forum_path . '/' . $file))));
                 }
             }
         }
     }
     closedir($dp);
     return $files;
 }
Esempio n. 11
0
 /**
  * Get values from user object and put them into form
  */
 function getValues()
 {
     global $ilUser, $ilSetting;
     $data = array();
     // login data
     $data["auth_mode"] = $this->object->getAuthMode();
     $data["login"] = $this->object->getLogin();
     //$data["passwd"] = "********";
     //$data["passwd2"] = "********";
     $data["ext_account"] = $this->object->getExternalAccount();
     // system information
     require_once './Services/Utilities/classes/class.ilFormat.php';
     $data["create_date"] = ilFormat::formatDate($this->object->getCreateDate(), 'datetime', true);
     $data["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
     $data["approve_date"] = $this->object->getApproveDate() != "" ? ilFormat::formatDate($this->object->getApproveDate(), 'datetime', true) : null;
     $data["agree_date"] = $this->object->getAgreeDate() != "" ? ilFormat::formatDate($this->object->getAgreeDate(), 'datetime', true) : null;
     $data["last_login"] = $this->object->getLastLogin() != "" ? ilFormat::formatDate($this->object->getLastLogin(), 'datetime', true) : null;
     $data["active"] = $this->object->getActive();
     $data["time_limit_unlimited"] = $this->object->getTimeLimitUnlimited();
     $from = new ilDateTime($this->object->getTimeLimitFrom() ? $this->object->getTimeLimitFrom() : time(), IL_CAL_UNIX);
     $data["time_limit_from"]["date"] = $from->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
     $data["time_limit_from"]["time"] = $from->get(IL_CAL_FKT_DATE, 'H:i:s', $ilUser->getTimeZone());
     $until = new ilDateTime($this->object->getTimeLimitUntil() ? $this->object->getTimeLimitUntil() : time(), IL_CAL_UNIX);
     $data['time_limit_until']['date'] = $until->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
     $data['time_limit_until']['time'] = $until->get(IL_CAL_FKT_DATE, 'H:i:s', $ilUser->getTimeZone());
     // BEGIN DiskQuota, Show disk space used
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $data["disk_quota"] = $this->object->getDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $data["wsp_disk_quota"] = $this->object->getPersonalWorkspaceDiskQuota() / ilFormat::_getSizeMagnitude() / ilFormat::_getSizeMagnitude();
     }
     // W. Randelshofer 2008-09-09: Deactivated display of disk space usage,
     // because determining the disk space usage may take several minutes.
     /*
     require_once "Modules/File/classes/class.ilObjFileAccess.php";
     require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
     require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
     require_once "Services/Mail/classes/class.ilObjMailAccess.php";
     require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
     require_once "Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
     $data["disk_space_used"] =
     	ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     	ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     	ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     	ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     	ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     	ilObjMediaCastAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>';
     */
     // END DiskQuota, Show disk space used
     // personal data
     $data["gender"] = $this->object->getGender();
     $data["firstname"] = $this->object->getFirstname();
     $data["lastname"] = $this->object->getLastname();
     $data["title"] = $this->object->getUTitle();
     $data['birthday'] = $this->object->getBirthday();
     $data["institution"] = $this->object->getInstitution();
     $data["department"] = $this->object->getDepartment();
     $data["street"] = $this->object->getStreet();
     $data["city"] = $this->object->getCity();
     $data["zipcode"] = $this->object->getZipcode();
     $data["country"] = $this->object->getCountry();
     $data["sel_country"] = $this->object->getSelectedCountry();
     $data["phone_office"] = $this->object->getPhoneOffice();
     $data["phone_home"] = $this->object->getPhoneHome();
     $data["phone_mobile"] = $this->object->getPhoneMobile();
     $data["fax"] = $this->object->getFax();
     $data["email"] = $this->object->getEmail();
     $data["hobby"] = $this->object->getHobby();
     $data["referral_comment"] = $this->object->getComment();
     // interests
     $data["interests_general"] = $this->object->getGeneralInterests();
     $data["interests_help_offered"] = $this->object->getOfferingHelp();
     $data["interests_help_looking"] = $this->object->getLookingForHelp();
     // instant messengers
     $data["im_icq"] = $this->object->getInstantMessengerId('icq');
     $data["im_yahoo"] = $this->object->getInstantMessengerId('yahoo');
     $data["im_msn"] = $this->object->getInstantMessengerId('msn');
     $data["im_aim"] = $this->object->getInstantMessengerId('aim');
     $data["im_skype"] = $this->object->getInstantMessengerId('skype');
     $data["im_jabber"] = $this->object->getInstantMessengerId('jabber');
     $data["im_voip"] = $this->object->getInstantMessengerId('voip');
     // other data
     $data["matriculation"] = $this->object->getMatriculation();
     $data["delicious"] = $this->object->getDelicious();
     $data["client_ip"] = $this->object->getClientIP();
     // user defined fields
     include_once './Services/User/classes/class.ilUserDefinedFields.php';
     $this->user_defined_fields = ilUserDefinedFields::_getInstance();
     $user_defined_data = $this->object->getUserDefinedData();
     foreach ($this->user_defined_fields->getDefinitions() as $field_id => $definition) {
         $data["udf_" . $field_id] = $user_defined_data["f_" . $field_id];
     }
     // settings
     $data["language"] = $this->object->getLanguage();
     $data["skin_style"] = $this->object->skin . ":" . $this->object->prefs["style"];
     $data["hits_per_page"] = $this->object->prefs["hits_per_page"];
     $data["show_users_online"] = $this->object->prefs["show_users_online"];
     $data["hide_own_online_status"] = $this->object->prefs["hide_own_online_status"] == 'y';
     $data["session_reminder_enabled"] = (int) $this->object->prefs["session_reminder_enabled"];
     $this->form_gui->setValuesByArray($data);
 }
 function __formatBody($a_ass_id)
 {
     global $lng;
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $ass = new ilEphAssignment($a_ass_id);
     $body = $ass->getInstruction();
     $body .= "\n\n";
     $body .= $lng->txt("eph_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;
 }