/**
  * @param array $a_set
  */
 public function fillRow($a_set)
 {
     $ilUDFCheck = ilUDFCheck::find($a_set['id']);
     $ilUDFCheckGUI = new ilUDFCheckGUI($this->parent_obj);
     foreach ($this->getSelectableColumns() as $k => $v) {
         if ($k == 'actions') {
             $this->ctrl->setParameter($this->parent_obj, ilUDFCheckGUI::IDENTIFIER, $ilUDFCheck->getId());
             $this->ctrl->setParameter($ilUDFCheckGUI, ilUDFCheckGUI::IDENTIFIER, $ilUDFCheck->getId());
             $current_selection_list = new ilAdvancedSelectionListGUI();
             $current_selection_list->setListTitle($this->pl->txt('check_actions'));
             $current_selection_list->setId('check_actions' . $ilUDFCheck->getId());
             $current_selection_list->setUseImages(false);
             $current_selection_list->addItem($this->pl->txt('check_edit'), 'check_edit', $this->ctrl->getLinkTarget($this->parent_obj, ilUserSettingsGUI::CMD_EDIT));
             $current_selection_list->addItem($this->pl->txt('check_delete'), 'check_delete', $this->ctrl->getLinkTarget($this->parent_obj, ilUserSettingsGUI::CMD_CONFIRM_DELETE));
             $this->tpl->setCurrentBlock('td');
             $this->tpl->setVariable('VALUE', $current_selection_list->getHTML());
             $this->tpl->parseCurrentBlock();
             continue;
         }
         if ($this->isColumnSelected($k)) {
             if ($a_set[$k]) {
                 $this->tpl->setCurrentBlock('td');
                 $this->tpl->setVariable('VALUE', is_array($a_set[$k]) ? implode(", ", $a_set[$k]) : $a_set[$k]);
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->setCurrentBlock('td');
                 $this->tpl->setVariable('VALUE', ' ');
                 $this->tpl->parseCurrentBlock();
             }
         }
     }
 }
 /**
  * @param $afterRebuildQuestionStageCmd
  * @return string
  */
 private function buildQuestionStageRebuildLink($afterRebuildQuestionStageCmd)
 {
     $this->ctrl->setParameter($this, self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD, $afterRebuildQuestionStageCmd);
     $href = $this->ctrl->getLinkTarget($this, self::CMD_BUILD_QUESTION_STAGE);
     $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
     return "<a href=\"{$href}\">{$label}</a>";
 }
 protected function getPassDetailsOverview($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList = null)
 {
     $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
     $this->ctrl->setParameter($targetGUI, 'pass', $pass);
     $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
     $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
     $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
     $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
     if ($objectivesList !== null) {
         $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
         $tableGUI->setObjectiveOrientedPresentationEnabled(true);
     }
     $tableGUI->setActiveId($active_id);
     $tableGUI->setPass($pass);
     $tableGUI->setShowSuggestedSolution(false);
     $usersQuestionSolutions = array();
     foreach ($result_array as $key => $val) {
         if ($key === 'test' || $key === 'pass') {
             continue;
         }
         if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
             $tableGUI->setShowSuggestedSolution(true);
         }
         if (isset($val['pass'])) {
             $tableGUI->setPassColumnEnabled(true);
         }
         $usersQuestionSolutions[$key] = $val;
     }
     $tableGUI->initColumns()->initFilter();
     $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
     $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
     $tableGUI->setData($usersQuestionSolutions);
     return $this->ctrl->getHTML($tableGUI);
 }
 function __showRolesTable($a_result_set, $a_from = "")
 {
     if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this, "");
     }
     $tbl =& $this->parent_gui->__initTableGUI();
     $tpl =& $tbl->getTemplateObject();
     // SET FORMAACTION
     $tpl->setCurrentBlock("tbl_form_header");
     $this->ctrl->setParameter($this, 'obj_id', $_GET['obj_id']);
     $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $tpl->parseCurrentBlock();
     // SET FOOTER BUTTONS
     $tpl->setVariable("COLUMN_COUNTS", 4);
     $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
     $tpl->setCurrentBlock("tbl_action_button");
     $tpl->setVariable("BTN_NAME", "assignSave");
     $tpl->setVariable("BTN_VALUE", $this->lng->txt("change_assignment"));
     $tpl->parseCurrentBlock();
     $tpl->setCurrentBlock("tbl_action_row");
     $tpl->setVariable("TPLPATH", $this->tpl->tplPath);
     $tpl->parseCurrentBlock();
     $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
     $title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')';
     $tbl->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment"));
     $tbl->setHeaderNames(array('', $this->lng->txt("title"), $this->lng->txt('description'), $this->lng->txt("type")));
     $tbl->setHeaderVars(array("", "title", "description", "type"), array("ref_id" => $this->object->getRefId(), "cmd" => "assignRoles", "obj_id" => $_GET['obj_id'], "cmdClass" => "ilobjcategorygui", "cmdNode" => $_GET["cmdNode"]));
     $tbl->setColumnWidth(array("4%", "35%", "45%", "16%"));
     $this->set_unlimited = true;
     $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from, true);
     $tbl->render();
     $this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get());
     return true;
 }
 public function showStaffRec()
 {
     if (!ilObjOrgUnitAccess::_checkAccessStaffRec($this->parent_object->getRefId())) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this->parent_gui, "");
     }
     $this->ctrl->setParameter($this, "recursive", true);
     $this->tpl->setContent($this->getStaffTableHTML(true, "showStaffRec"));
 }
 /**
  * @param array $a_set
  */
 public function fillRow($a_set)
 {
     $il_obj_entry = ilBibliographicEntry::getInstance($this->parent_obj->object->getFiletype(), $a_set['entry_id']);
     $this->tpl->setVariable('SINGLE_ENTRY', $il_obj_entry->getOverwiew());
     //Detail-Link
     $this->ctrl->setParameter($this->parent_obj, ilObjBibliographicGUI::P_ENTRY_ID, $a_set['entry_id']);
     $this->tpl->setVariable('DETAIL_LINK', $this->ctrl->getLinkTarget($this->parent_obj, 'showDetails'));
     // generate/render links to libraries
     $settings = ilBibliographicSetting::getAll();
     $arr_library_link = array();
     foreach ($settings as $set) {
         if ($set->getShowInList()) {
             $arr_library_link[] = $set->getButton($this->parent_obj->object, $il_obj_entry);
         }
     }
     if (count($arr_library_link)) {
         $this->tpl->setVariable('LIBRARY_LINK', implode('<br/>', $arr_library_link));
     }
 }
 /**
  * Edit Role Assignment
  *
  * @return
  */
 protected function editRoleAssignment()
 {
     $this->ctrl->setParameter($this, 'rule_id', (int) $_GET['rule_id']);
     $this->tabs_gui->setSubTabActive('shib_role_assignment');
     $this->initFormRoleAssignment('update');
     $this->getRuleValues();
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shib_role_assignment.html', 'Services/AuthShibboleth');
     $this->tpl->setVariable('NEW_RULE_TABLE', $this->form->getHTML());
     return true;
 }
 /**
  * execute command
  */
 public function executeCommand()
 {
     global $ilLocator, $lng;
     $next_class = $this->ctrl->getNextClass($this);
     $viewdef = $this->getPageObject();
     if ($viewdef) {
         $this->ctrl->setParameter($this, "dclv", $viewdef->getId());
         $title = $lng->txt("dcl_view_viewdefinition");
     }
     switch ($next_class) {
         case "ilpageobjectgui":
             throw new ilCOPageException("Deprecated. ilDataCollectionRecordViewViewdefinitionGUI gui forwarding to ilpageobject");
         default:
             if ($viewdef) {
                 $this->setPresentationTitle($title);
                 $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "preview"));
             }
             return parent::executeCommand();
     }
 }
 /**
  * Create or update a type
  */
 public function saveType()
 {
     $type = $this->type === NULL ? new srCertificateType() : $this->type;
     $form = new srCertificateTypeFormGUI($this, $type);
     if ($form->saveObject()) {
         ilUtil::sendSuccess($this->pl->txt('msg_type_saved'), true);
         $this->ctrl->setParameter($this, 'type_id', $type->getId());
         $this->ctrl->redirect($this, 'editType');
     } else {
         $this->tpl->setContent($form->getHTML());
     }
 }
 protected function questionsObject()
 {
     /** @var $ilAccess ilAccessHandler */
     global $ilAccess;
     if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
         // allow only write access
         ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirect($this, "infoScreen");
     }
     if ($_GET['browse']) {
         exit('Browse??');
         return $this->object->questionbrowser();
     }
     if ($_GET["eqid"] && $_GET["eqpl"]) {
         $this->ctrl->setParameter($this, 'q_id', $_GET["eqid"]);
         $this->ctrl->setParameter($this, 'qpl_id', $_GET["eqpl"]);
         $this->ctrl->redirect($this, 'adjustscoringfortest');
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
     $this->tpl->setCurrentBlock("adm_content");
     include_once "./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php";
     $checked_move = is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()]) && count($_SESSION['tst_qst_move_' . $this->object->getTestId()]);
     $table_gui = new ilTestQuestionsTableGUI($this, 'showquestionlist', $ilAccess->checkAccess("write", "", $this->ref_id) ? true : false, $checked_move, 0);
     $data = $this->object->getTestQuestions();
     // @TODO Ask object for random test.
     if (!$data) {
         $this->object->getPotentialRandomTestQuestions();
     }
     $filtered_data = array();
     foreach ($data as $question) {
         $question_object = assQuestion::instantiateQuestionGUI($question['question_id']);
         if ($this->supportsAdjustment($question_object) && $this->allowedInAdjustment($question_object)) {
             $filtered_data[] = $question;
         }
     }
     $table_gui->setData($filtered_data);
     $table_gui->clearActionButtons();
     $table_gui->clearCommandButtons();
     $table_gui->multi = array();
     $table_gui->setRowTemplate('tpl.il_as_tst_adjust_questions_row.html', 'Modules/Test');
     $table_gui->header_commands = array();
     $table_gui->setSelectAllCheckbox(null);
     $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML());
     $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this, 'showquestionlist'));
     $this->tpl->parseCurrentBlock();
 }
 /**
  * Execute Command
  * 
  * @access public
  */
 public function executeCommand()
 {
     $cmd = $this->ctrl->getCmd(self::CMD_SHOW);
     $nextClass = $this->ctrl->getNextClass($this);
     $this->ctrl->setParameter($this, 'q_id', (int) $_GET['q_id']);
     switch ($nextClass) {
         case 'ilassspecfeedbackpagegui':
         case 'ilassgenfeedbackpagegui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
             $forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->questionOBJ, $this->ctrl, $this->tabs, $this->lng);
             $forwarder->forward();
             break;
         default:
             $cmd .= 'Cmd';
             $this->{$cmd}();
             break;
     }
 }
 /**
  * Build action menu for a record asynchronous
  *
  */
 protected function buildActions()
 {
     $alist = new ilAdvancedSelectionListGUI();
     $alist->setId((int) $_GET['cert_id']);
     $alist->setListTitle($this->pl->txt('actions'));
     $this->ctrl->setParameter($this, 'cert_id', (int) $_GET['cert_id']);
     switch ($_GET['status']) {
         case srCertificate::STATUS_CALLED_BACK:
             $alist->addItem($this->pl->txt('undo_callback'), 'undoCallback', $this->ctrl->getLinkTarget($this, 'undoCallBack'));
             break;
         case srCertificate::STATUS_FAILED:
             $alist->addItem($this->pl->txt('retry'), 'retry', $this->ctrl->getLinkTarget($this, 'retryGeneration'));
             break;
         case srCertificate::STATUS_PROCESSED:
             $alist->addItem($this->pl->txt('download'), 'download', $this->ctrl->getLinkTarget($this, 'downloadCertificate'));
             $alist->addItem($this->pl->txt('call_back'), 'call_back', $this->ctrl->getLinkTarget($this, 'callBack'));
             break;
     }
     echo $alist->getHTML(true);
     exit;
 }
 /**
  * @param assFormulaQuestionUnitCategory $cat
  * @return ilPropertyFormGUI
  */
 protected function initUnitCategoryForm(assFormulaQuestionUnitCategory $cat = null)
 {
     if ($this->unit_cat_form instanceof ilPropertyFormGUI) {
         return $this->unit_cat_form;
     }
     $this->unit_cat_form = new ilPropertyFormGUI();
     $title = new ilTextInputGUI($this->lng->txt('title'), 'category_name');
     $title->setRequired(true);
     $this->unit_cat_form->addItem($title);
     if (null === $cat) {
         $this->unit_cat_form->setTitle($this->lng->txt('new_category'));
         $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'addCategory'));
         $this->unit_cat_form->addCommandButton('addCategory', $this->lng->txt('save'));
     } else {
         $this->ctrl->setParameter($this, 'category_id', $cat->getId());
         $this->unit_cat_form->addCommandButton('saveCategory', $this->lng->txt('save'));
         $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'saveCategory'));
         $this->unit_cat_form->setTitle(sprintf($this->lng->txt('selected_category'), $cat->getDisplayString()));
     }
     $this->unit_cat_form->addCommandButton($this->getUnitCategoryOverviewCommand(), $this->lng->txt('cancel'));
     return $this->unit_cat_form;
 }
 /**
  * Returns the list of answers of a users test pass and offers a scoring option
  *
  * @param array $result_array An array containing the results of the users test pass (generated by ilObjTest::getTestResult)
  * @param integer $active_id Active ID of the active user
  * @param integer $pass Test pass
  * @param boolean $show_solutions TRUE, if the solution output should be shown in the answers, FALSE otherwise
  * @return string HTML code of the list of answers
  * @access public
  * 
  * @deprecated
  */
 function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = FALSE)
 {
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
     include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
     $scoring = ilObjAssessmentFolder::_getManualScoring();
     $counter = 1;
     // output of questions with solutions
     foreach ($result_array as $question_data) {
         $question = $question_data["qid"];
         if (is_numeric($question)) {
             $question_gui = $this->object->createQuestionGUI("", $question);
             if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
                 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, "Modules/Test");
                 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
                 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
                 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
                 $points = $question_gui->object->getMaximumPoints();
                 if ($points == 1) {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
                 } else {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
                 }
                 $show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE;
                 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
                 $solout = $question_gui->object->getSuggestedSolutionOutput();
                 if (strlen($solout)) {
                     $scoretemplate->setCurrentBlock("suggested_solution");
                     $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
                     $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
                     $scoretemplate->parseCurrentBlock();
                 }
                 $scoretemplate->setCurrentBlock("feedback");
                 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
                 $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
                 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
                 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
                 $scoretemplate->parseCurrentBlock();
                 $scoretemplate->setVariable("NAME_INPUT", $question);
                 $this->ctrl->setParameter($this, "active_id", $active_id);
                 $this->ctrl->setParameter($this, "pass", $pass);
                 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
                 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
                 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
                 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
                 $template->setVariable("SOLUTION_OUTPUT", $result_output);
                 $maintemplate->setCurrentBlock("printview_question");
                 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
                 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
                 $maintemplate->parseCurrentBlock();
             }
             $counter++;
         }
     }
     if ($counter == 1) {
         // no scorable questions found
         $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
     }
     $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDomEvent();
     return $maintemplate->get();
 }
 /**
  * @param ilForumTopic $thread
  */
 public function fillRow(ilForumTopic $thread)
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', $thread->getId());
     if ('mergeThreads' == $this->parent_cmd) {
         $checked = $this->max_count == 1 || isset($_POST['thread_ids']) && in_array($thread->getId(), $_POST['thread_ids']);
         $this->tpl->setVariable('VAL_CHECK', ilUtil::formRadioButton($checked, 'thread_ids[]', $thread->getId()));
     } else {
         if ('showThreads' == $this->parent_cmd) {
             $this->tpl->setVariable('VAL_CHECK', ilUtil::formCheckbox(isset($_POST['thread_ids']) && in_array($thread->getId(), $_POST['thread_ids']) ? true : false, 'thread_ids[]', $thread->getId()));
         } else {
             if ($thread->isSticky()) {
                 $this->tpl->setVariable('VAL_SORTING_NAME', 'thread_sorting[' . $thread->getId() . ']');
                 $this->tpl->setVariable('VAL_SORTING', (int) $this->position * 10);
             } else {
                 $this->tpl->setVariable('VAL_CHECK', '');
             }
             $this->position++;
         }
     }
     $subject = '';
     if ($thread->isSticky()) {
         $subject .= '<span class="light">[' . $this->lng->txt('sticky') . ']</span> ';
     }
     if ($thread->isClosed()) {
         $subject .= '<span class="light">[' . $this->lng->txt('topic_close') . ']</span> ';
     }
     if (!$ilUser->isAnonymous() && $this->ilias->getSetting('forum_notification') != 0 && $thread->getUserNotificationEnabled()) {
         $subject .= '<span class="light">[' . $this->lng->txt('forums_notification_enabled') . ']</span> ';
     }
     $num_posts = $thread->getNumPosts();
     $num_unread = $thread->getNumUnreadPosts();
     $num_new = $thread->getNumNewPosts();
     if ($num_posts > 0) {
         $subject = '<div><a href="' . $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '">' . $thread->getSubject() . '</a></div>' . $subject;
     } else {
         $subject = $thread->getSubject() . $subject;
     }
     $this->tpl->setVariable('VAL_SUBJECT', $subject);
     // Author
     $this->ctrl->setParameter($this->getParentObject(), 'backurl', urlencode($this->ctrl->getLinkTargetByClass("ilrepositorygui", "")));
     $this->ctrl->setParameter($this->getParentObject(), 'user', $thread->getUserId());
     $authorinfo = new ilForumAuthorInformation($thread->getUserId(), $thread->getUserAlias(), $thread->getImportName(), array('class' => 'il_ItemProperty', 'href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'showUser')));
     $this->tpl->setVariable('VAL_AUTHOR', $authorinfo->getLinkedAuthorName());
     $topicStats = $num_posts;
     if (!$ilUser->isAnonymous()) {
         if ($num_unread > 0) {
             $topicStats .= '<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt('unread') . ': ' . $num_unread . '</span>';
         }
         if ($num_new > 0 && $this->getOverviewSetting() == 0) {
             $topicStats .= '<br /><span class="alert ilWhiteSpaceNowrap">' . $this->lng->txt('new') . ': ' . $num_new . '</span>';
         }
     }
     $this->tpl->setVariable('VAL_ARTICLE_STATS', $topicStats);
     $this->tpl->setVariable('VAL_NUM_VISIT', $thread->getVisits());
     // Last posting
     if ($num_posts > 0) {
         if ($this->getIsModerator()) {
             $objLastPost = $thread->getLastPost();
         } else {
             $objLastPost = $thread->getLastActivePost();
         }
         if (is_object($objLastPost)) {
             $authorinfo = new ilForumAuthorInformation($objLastPost->getUserId(), $objLastPost->getUserAlias(), $objLastPost->getImportName(), array('href' => $this->ctrl->getLinkTarget($this->getParentObject(), 'viewThread') . '#' . $objLastPost->getId()));
             $this->tpl->setVariable('VAL_LP_DATE', '<div class="ilWhiteSpaceNowrap">' . ilDatePresentation::formatDate(new ilDateTime($objLastPost->getCreateDate(), IL_CAL_DATETIME)) . '</div>' . '<div class="ilWhiteSpaceNowrap">' . $this->lng->txt('from') . ' ' . $authorinfo->getLinkedAuthorName() . '</div>');
         }
     }
     // Row style
     $css_row = $this->css_row;
     if ($thread->isSticky()) {
         $css_row = $css_row == 'tblrow1' ? 'tblstickyrow1' : 'tblstickyrow2';
     }
     $this->tpl->setVariable('CSS_ROW', $css_row);
     $this->ctrl->setParameter($this->getParentObject(), 'thr_pk', '');
     $this->ctrl->setParameter($this->getParentObject(), 'user', '');
     $this->ctrl->setParameter($this->getParentObject(), 'backurl', '');
 }
 public function cancelSaveAttachments()
 {
     $this->ctrl->setParameter($this, 'type', 'attach');
     $this->ctrl->returnToParent($this);
 }
 public function cancel()
 {
     $this->ctrl->setParameter($this, self::IDENTIFIER, NULL);
     $this->ctrl->redirect($this, self::CMD_INDEX);
 }
 /**
  * Save record
  */
 public function save()
 {
     $this->initForm();
     if ($this->form->checkInput()) {
         $record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
         $date_obj = new ilDateTime(time(), IL_CAL_UNIX);
         $record_obj->setTableId($this->table_id);
         $record_obj->setLastUpdate($date_obj->get(IL_CAL_DATETIME));
         $record_obj->setLastEditBy($this->user->getId());
         $create_mode = false;
         if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) {
             $all_fields = $this->table->getRecordFields();
         } else {
             $all_fields = $this->table->getEditableFields();
         }
         $fail = "";
         //Check if we can create this record.
         foreach ($all_fields as $field) {
             try {
                 $value = $this->form->getInput("field_" . $field->getId());
                 $field->checkValidity($value, $this->record_id);
             } catch (ilDataCollectionInputException $e) {
                 $fail .= $field->getTitle() . ": " . $e . "<br>";
             }
         }
         if ($fail) {
             $this->sendFailure($fail);
             return;
         }
         if (!isset($this->record_id)) {
             if (!$this->table->hasPermissionToAddRecord($this->parent_obj->ref_id)) {
                 $this->accessDenied();
                 return;
             }
             $record_obj->setOwner($this->user->getId());
             $record_obj->setCreateDate($date_obj->get(IL_CAL_DATETIME));
             $record_obj->setTableId($this->table_id);
             $record_obj->doCreate();
             $this->record_id = $record_obj->getId();
             $create_mode = true;
         } else {
             if (!$record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) {
                 $this->accessDenied();
                 return;
             }
         }
         //edit values, they are valid we already checked them above
         foreach ($all_fields as $field) {
             $value = $this->form->getInput("field_" . $field->getId());
             //deletion flag on MOB inputs.
             if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB && $this->form->getItemByPostVar("field_" . $field->getId())->getDeletionFlag()) {
                 $value = -1;
             }
             $record_obj->setRecordFieldValue($field->getId(), $value);
         }
         // Do we need to set a new owner for this record?
         if (!$create_mode) {
             $owner_id = ilObjUser::_lookupId($_POST['field_owner']);
             if (!$owner_id) {
                 $this->sendFailure($this->lng->txt('user_not_known'));
                 return;
             }
             $record_obj->setOwner($owner_id);
         }
         if ($create_mode) {
             ilObjDataCollection::sendNotification("new_record", $this->table_id, $record_obj->getId());
         }
         $record_obj->doUpdate();
         $this->ctrl->setParameter($this, "table_id", $this->table_id);
         $this->ctrl->setParameter($this, "record_id", $this->record_id);
         if (!$this->ctrl->isAsynch()) {
             ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         }
         $this->checkAndPerformRedirect();
         if ($this->ctrl->isAsynch()) {
             // If ajax request, return the form in edit mode again
             $this->record_id = $record_obj->getId();
             $this->initForm();
             $this->setFormValues();
             echo $this->tpl->getMessageHTML($this->lng->txt('msg_obj_modified'), 'success') . $this->form->getHTML();
             exit;
         } else {
             $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
         }
     } else {
         // Form not valid...
         $this->form->setValuesByPost();
         if ($this->ctrl->isAsynch()) {
             echo $this->form->getHTML();
             exit;
         } else {
             $this->tpl->setContent($this->form->getHTML());
         }
     }
 }