/** * @param ilTable2GUI $table_gui */ private function prepareTable(ilTable2GUI $table_gui) { global $lng; $table_gui->addColumn($lng->txt('toplist_col_rank')); $table_gui->addColumn($lng->txt('toplist_col_participant')); if ($this->object->getHighscoreAchievedTS()) { $table_gui->addColumn($lng->txt('toplist_col_achieved')); } if ($this->object->getHighscoreScore()) { $table_gui->addColumn($lng->txt('toplist_col_score')); } if ($this->object->getHighscorePercentage()) { $table_gui->addColumn($lng->txt('toplist_col_percentage')); } if ($this->object->getHighscoreHints()) { $table_gui->addColumn($lng->txt('toplist_col_hints')); } if ($this->object->getHighscoreWTime()) { $table_gui->addColumn($lng->txt('toplist_col_wtime')); } $table_gui->setEnableNumInfo(false); $table_gui->setLimit(10); }
/** * Print out statistics about the language */ function statisticsObject() { $modules = ilObjLanguageExt::_getModules($this->object->key); $data = array(); $total = array("module" => '', "all" => 0, "changed" => 0, "unchanged" => 0); foreach ($modules as $module) { $row = array(); $row['module'] = $module; $row['all'] = count($this->object->getAllValues(array($module))); $row['changed'] = count($this->object->getChangedValues(array($module))); $row['unchanged'] = $row['all'] - $row['changed']; $total['all'] += $row['all']; $total['changed'] += $row['changed']; $total['unchanged'] += $row['unchanged']; $data[] = $row; } $total['module'] = "<b>" . $this->lng->txt("language_all_modules") . "</b>"; $total['all'] = "<b>" . $total['all'] . "</b>"; $total['changed'] = "<b>" . $total['changed'] . "</b>"; $total['unchanged'] = "<b>" . $total['unchanged'] . "</b>"; $data[] = $total; // create and configure the table object include_once 'Services/Table/classes/class.ilTable2GUI.php'; $table_gui = new ilTable2GUI($this, "statistics"); $table_gui->setRowTemplate("tpl.lang_statistics_row.html", "Services/Language"); $table_gui->setEnableTitle(false); $table_gui->setEnableNumInfo(false); $table_gui->setLimit(count($data)); $table_gui->setExportFormats(array(ilTable2GUI::EXPORT_EXCEL)); $table_gui->addColumn(ucfirst($this->lng->txt("module")), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_global"), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_local"), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_unchanged"), "", "25%"); $table_gui->setData($data); $this->tpl->setContent($table_gui->getHTML()); }
/** * Shows $results in a table * * @param array $results * @access public */ public function showFileSearchResult($results = null) { global $tree; if (!$results && isset($_SESSION['contents']['search_result'])) { // this is for table sorting $results = $_SESSION['contents']['search_result']; } if (!$results) { return $this->showAddContent(); } include_once 'Services/Table/classes/class.ilTable2GUI.php'; $this->tabs->activateTab('contents'); $table = new ilTable2GUI($this, 'showFileSearchResult'); $table->setLimit(2147483647); $table->setTitle($this->txt('files')); $table->setDefaultOrderField('path'); $table->addColumn('', '', '1%', true); $table->addColumn($this->txt('title'), 'title', '30%'); $table->addColumn($this->lng->txt('path'), 'path', '70%'); $table->setFormAction($this->ctrl->getFormAction($this, 'addContentFromILIAS')); $table->setRowTemplate('tpl.content_file_row.html', $this->pluginObj->getDirectory()); $table->setId('xavc_cs_' . $this->object->getId()); $table->setPrefix('xavc_cs_' . $this->object->getId()); $table->addCommandButton('addContentFromILIAS', $this->txt('add')); $table->addCommandButton('cancelSearchContentFile', $this->txt('cancel')); $data = array(); $i = 0; foreach ($results as $file_id) { $title = ilObject::_lookupTitle($file_id); $file_ref = array_shift(ilObject::_getAllReferences($file_id)); $path_arr = $tree->getPathFull($file_ref); $counter = 0; $path = ''; foreach ($path_arr as $element) { if ($counter++) { $path .= " > "; $path .= $element['title']; } else { $path .= $this->lng->txt('repository'); } } $data[$i]['check_box'] = ilUtil::formRadioButton(0, 'file_id', $file_id); $data[$i]['title'] = $title; $data[$i]['path'] = $path; ++$i; } $table->setData($data); $this->tpl->setContent($table->getHTML()); }
public function moveThreadsObject() { /** * @var $lng ilLanguage * @var $ilToolbar ilToolbarGUI * @var $tree ilTree */ global $lng, $ilToolbar, $tree; if (!$this->is_moderator) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } $threads2move = $_SESSION['threads2move']; if (empty($threads2move)) { ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true); $this->ctrl->redirect($this, 'showThreads'); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_move.html', 'Modules/Forum'); if (!$this->hideToolbar()) { $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this)); } $tblThr = new ilTable2GUI($this); $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId()); $tblThr->setTitle($this->lng->txt('move_chosen_topics')); $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%'); $tblThr->disable('header'); $tblThr->disable('footer'); $tblThr->disable('linkbar'); $tblThr->disable('sort'); $tblThr->disable('linkbar'); $tblThr->setLimit(0); $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum'); $tblThr->setDefaultOrderField('is_sticky'); $counter = 0; $result = array(); foreach ($threads2move as $thr_pk) { $objCurrentTopic = new ilForumTopic($thr_pk, $this->is_moderator); $result[$counter]['num'] = $counter + 1; $result[$counter]['thr_subject'] = $objCurrentTopic->getSubject(); unset($objCurrentTopic); ++$counter; } $tblThr->setData($result); $this->tpl->setVariable('THREADS_TABLE', $tblThr->getHTML()); // selection tree require_once 'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php'; $exp = new ilForumMoveTopicsExplorer($this->ctrl->getLinkTarget($this, 'moveThreads'), 'frm_topic_paste_expand'); $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'moveThreads')); $exp->setTargetGet('ref_id'); $exp->setPostVar('frm_ref_id'); $exp->excludeObjIdFromSelection($this->object->getId()); $exp->setCheckedItem(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0); // open current position in tree if (!is_array($_SESSION['frm_topic_paste_expand'])) { $_SESSION['frm_topic_paste_expand'] = array(); $path = $tree->getPathId($this->object->getRefId()); foreach ((array) $path as $node_id) { if (!in_array($node_id, $_SESSION['frm_topic_paste_expand'])) { $_SESSION['frm_topic_paste_expand'][] = $node_id; } } } if (!isset($_GET['frm_topic_paste_expand']) || $_GET['frm_topic_paste_expand'] == '') { $expanded = $tree->readRootId(); } else { $expanded = $_GET['frm_topic_paste_expand']; } $exp->setExpand($expanded); // build html-output $exp->setOutput(0); $output = $exp->getOutput(); $this->tpl->setVariable('FRM_SELECTION_TREE', $output); $this->tpl->setVariable('CMD_SUBMIT', 'performMoveThreads'); $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('move')); $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads')); return true; }
public function moveThreadsObject() { /** * @var $lng ilLanguage * @var $ilToolbar ilToolbarGUI * @var $tree ilTree */ global $lng, $ilToolbar, $tree; if (!$this->is_moderator) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } $threads2move = $_SESSION['threads2move']; if (!count($threads2move)) { ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'), true); $this->ctrl->redirect($this, 'showThreads'); } require_once 'Modules/Forum/classes/class.ilForumMoveTopicsExplorer.php'; $exp = new ilForumMoveTopicsExplorer($this, 'moveThreads'); $exp->setPathOpen($this->object->getRefId()); $exp->setNodeSelected(isset($_POST['frm_ref_id']) && (int) $_POST['frm_ref_id'] ? (int) $_POST['frm_ref_id'] : 0); $exp->setCurrentFrmRefId($this->object->getRefId()); $exp->setHighlightedNode($this->object->getRefId()); if (!$exp->handleCommand()) { $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_move.html', 'Modules/Forum'); if (!$this->hideToolbar()) { $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this)); } $tblThr = new ilTable2GUI($this); $tblThr->setId('il_frm_thread_move_table_' . $this->object->getRefId()); $tblThr->setTitle($this->lng->txt('move_chosen_topics')); $tblThr->addColumn($this->lng->txt('subject'), 'top_name', '100%'); $tblThr->disable('header'); $tblThr->disable('footer'); $tblThr->disable('linkbar'); $tblThr->disable('sort'); $tblThr->disable('linkbar'); $tblThr->setLimit(PHP_INT_MAX); $tblThr->setRowTemplate('tpl.forums_threads_move_thr_row.html', 'Modules/Forum'); $tblThr->setDefaultOrderField('is_sticky'); $counter = 0; $result = array(); foreach ($threads2move as $thr_pk) { $objCurrentTopic = new ilForumTopic($thr_pk, $this->is_moderator); $result[$counter]['num'] = $counter + 1; $result[$counter]['thr_subject'] = $objCurrentTopic->getSubject(); unset($objCurrentTopic); ++$counter; } $tblThr->setData($result); $this->tpl->setVariable('THREADS_TABLE', $tblThr->getHTML()); $this->tpl->setVariable('FRM_SELECTION_TREE', $exp->getHTML()); $this->tpl->setVariable('CMD_SUBMIT', 'performMoveThreads'); $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('move')); $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this, 'performMoveThreads')); } return true; }