Ejemplo n.º 1
0
 /**
  * Shows the certificate editor for ILIAS tests
  */
 public function certificateEditor()
 {
     global $ilAccess;
     $form_fields = array();
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $form_fields = $this->getFormFieldsFromPOST();
     } else {
         $form_fields = $this->getFormFieldsFromFO();
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("certificate_edit"));
     $form->setMultipart(TRUE);
     $form->setTableWidth("100%");
     $form->setId("certificate");
     $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
     $active->setChecked($form_fields["active"]);
     $form->addItem($active);
     $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import");
     $import->setRequired(FALSE);
     $import->setSuffixes(array("zip"));
     // handle the certificate import
     if (strlen($_FILES["certificate_import"]["tmp_name"])) {
         if ($import->checkInput()) {
             $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
             if ($result == FALSE) {
                 $import->setAlert($this->lng->txt("certificate_error_import"));
             } else {
                 $this->ctrl->redirect($this, "certificateEditor");
             }
         }
     }
     $form->addItem($import);
     $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
     $pageformats = $this->object->getPageFormats();
     $pageformat->setValue($form_fields["pageformat"]);
     foreach ($pageformats as $format) {
         $option = new ilRadioOption($format["name"], $format["value"]);
         if (strcmp($format["value"], "custom") == 0) {
             $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight");
             $pageheight->setValue($form_fields["pageheight"]);
             $pageheight->setSize(6);
             $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pageheight->setInfo($this->lng->txt("certificate_unit_description"));
             $pageheight->setRequired(true);
             $option->addSubitem($pageheight);
             $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth");
             $pagewidth->setValue($form_fields["pagewidth"]);
             $pagewidth->setSize(6);
             $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
             $pagewidth->setInfo($this->lng->txt("certificate_unit_description"));
             $pagewidth->setRequired(true);
             $option->addSubitem($pagewidth);
         }
         $pageformat->addOption($option);
     }
     $pageformat->setRequired(true);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $pageformat->checkInput();
     }
     $form->addItem($pageformat);
     $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
     $bgimage->setRequired(FALSE);
     $bgimage->setUseCache(false);
     if (count($_POST)) {
         // handle the background upload
         if (strlen($_FILES["background"]["tmp_name"])) {
             if ($bgimage->checkInput()) {
                 $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
                 if ($result == FALSE) {
                     $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
                 }
             }
         }
     }
     if (!$this->object->hasBackgroundImage()) {
         include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
         if (ilObjCertificateSettingsAccess::hasBackgroundImage()) {
             $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb());
         }
     } else {
         $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
     }
     $form->addItem($bgimage);
     $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top");
     $padding_top->setRequired(TRUE);
     $padding_top->setValue($form_fields["padding_top"]);
     $padding_top->setSize(6);
     $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
     $padding_top->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $padding_top->checkInput();
     }
     $form->addItem($padding_top);
     $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body");
     $rect->setRequired(TRUE);
     $rect->setUseUnits(TRUE);
     $rect->setTop($form_fields["margin_body_top"]);
     $rect->setBottom($form_fields["margin_body_bottom"]);
     $rect->setLeft($form_fields["margin_body_left"]);
     $rect->setRight($form_fields["margin_body_right"]);
     $rect->setInfo($this->lng->txt("certificate_unit_description"));
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $rect->checkInput();
     }
     $form->addItem($rect);
     $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text");
     $certificate->removePlugin('ilimgupload');
     $certificate->setValue($form_fields["certificate_text"]);
     $certificate->setRequired(TRUE);
     $certificate->setRows(20);
     $certificate->setCols(80);
     // fraunhpatch start
     $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate");
     foreach (ilCertificate::getCustomCertificateFields() as $f) {
         $common_desc_tpl->setCurrentBlock("cert_field");
         $common_desc_tpl->setVariable("PH", $f["ph"]);
         $common_desc_tpl->setVariable("PH_TXT", $f["name"]);
         $common_desc_tpl->parseCurrentBlock();
     }
     $common_desc = $common_desc_tpl->get();
     // fraunhpatch start
     $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc);
     $certificate->setUseRte(TRUE, '3.4.7');
     $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul");
     $certificate->setRteTags($tags);
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         $certificate->checkInput();
     }
     $form->addItem($certificate);
     $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         if ($this->object->isComplete() || $this->object->hasBackgroundImage()) {
             $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview"));
             $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export"));
             $form->addCommandButton("certificateDelete", $this->lng->txt("delete"));
         }
         $form->addCommandButton("certificateSave", $this->lng->txt("save"));
     }
     $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
         if ($_POST["background_delete"]) {
             $this->object->deleteBackgroundImage();
         }
         if ($form->checkInput()) {
             try {
                 $xslfo = $this->object->processXHTML2FO($form_fields);
                 $this->object->getAdapter()->saveFormFields($form_fields);
                 $this->object->saveCertificate($xslfo);
                 $this->object->writeActive($form_fields["active"]);
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE);
                 $this->ctrl->redirect($this, "certificateEditor");
             } catch (Exception $e) {
                 ilUtil::sendFailure($e->getMessage());
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Set the language settings
  */
 function settingsObject()
 {
     global $ilSetting;
     $translate_key = "lang_translate_" . $this->object->key;
     // save and get the page translation setting
     if (!empty($_POST)) {
         $ilSetting->set($translate_key, (bool) $_POST["translation"]);
         ilUtil::sendSuccess($this->lng->txt("settings_saved"));
     }
     $translate = $ilSetting->get($translate_key, false);
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("language_settings"));
     $form->setPreventDoubleSubmission(false);
     $form->addCommandButton('settings', $this->lng->txt("language_change_settings"));
     $ci = new ilCheckboxInputGUI($this->lng->txt("language_translation_enabled"), "translation");
     $ci->setChecked((bool) $translate);
     $ci->setInfo($this->lng->txt("language_note_translation"));
     $form->addItem($ci);
     $this->tpl->setContent($form->getHTML());
 }
Ejemplo n.º 3
0
 /**
  * Detail view of a mail
  */
 public function showMail()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilToolbar ilToolbarGUI
      * @var $ilTabs ilTabsGUI
      */
     global $ilUser, $ilToolbar, $ilTabs;
     if ($_SESSION['mail_id']) {
         $_GET['mail_id'] = $_SESSION['mail_id'];
         $_SESSION['mail_id'] = '';
     }
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder'));
     $this->umail->markRead(array((int) $_GET['mail_id']));
     $mailData = $this->umail->getMail((int) $_GET['mail_id']);
     $this->tpl->setTitle($this->lng->txt('mail_mails_of'));
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $form->setTableWidth('100%');
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $form->setFormAction($this->ctrl->getFormAction($this, 'showMail'));
     $this->ctrl->clearParameters($this);
     $form->setTitle($this->lng->txt('mail_mails_of'));
     if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
         $this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent'));
     }
     include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
     /**
      * @var $sender ilObjUser
      */
     $sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false);
     if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
         $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
         $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply');
         $this->ctrl->clearParametersByClass('iliasmailformgui');
         $ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY);
         $this->ctrl->clearParameters($this);
     }
     $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
     $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward');
     $this->ctrl->clearParametersByClass('iliasmailformgui');
     $ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL);
     $this->ctrl->clearParameters($this);
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank');
     $this->ctrl->clearParameters($this);
     $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
     $this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails');
     $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE);
     $this->ctrl->clearParameters($this);
     if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
         $linked_fullname = $sender->getPublicName();
         $picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName());
         $add_to_addb_button = '';
         if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) {
             $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
             $this->ctrl->setParameter($this, 'user', $sender->getId());
             $linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>';
             $this->ctrl->clearParameters($this);
         }
         if ($sender->getId() != $ilUser->getId()) {
             require_once 'Services/Contact/classes/class.ilAddressbook.php';
             $abook = new ilAddressbook($ilUser->getId());
             if ($abook->checkEntryByLogin($sender->getLogin()) == 0) {
                 $tplbtn = new ilTemplate('tpl.buttons.html', true, true);
                 $tplbtn->setCurrentBlock('btn_cell');
                 $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
                 $tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add'));
                 $this->ctrl->clearParameters($this);
                 $tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook'));
                 $tplbtn->parseCurrentBlock();
                 $add_to_addb_button = '<br />' . $tplbtn->get();
             }
         }
         $from = new ilCustomInputGUI($this->lng->txt('from'));
         $from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button);
         $form->addItem($from);
     } else {
         if (!$sender || !$sender->getId()) {
             $from = new ilCustomInputGUI($this->lng->txt('from'));
             $from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
             $form->addItem($from);
         } else {
             $from = new ilCustomInputGUI($this->lng->txt('from'));
             $from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName());
             $form->addItem($from);
         }
     }
     $to = new ilCustomInputGUI($this->lng->txt('mail_to'));
     $to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false));
     $form->addItem($to);
     if ($mailData['rcp_cc']) {
         $cc = new ilCustomInputGUI($this->lng->txt('cc'));
         $cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false));
         $form->addItem($cc);
     }
     if ($mailData['rcp_bcc']) {
         $bcc = new ilCustomInputGUI($this->lng->txt('bc'));
         $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false));
         $form->addItem($bcc);
     }
     $subject = new ilCustomInputGUI($this->lng->txt('subject'));
     $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true));
     $form->addItem($subject);
     $date = new ilCustomInputGUI($this->lng->txt('date'));
     $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME)));
     $form->addItem($date);
     $message = new ilCustomInputGUI($this->lng->txt('message'));
     $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true));
     $form->addItem($message);
     if ($mailData['attachments']) {
         $att = new ilCustomInputGUI($this->lng->txt('attachments'));
         $radiog = new ilRadioGroupInputGUI('', 'filename');
         foreach ($mailData['attachments'] as $file) {
             $radiog->addOption(new ilRadioOption($file, md5($file)));
         }
         $att->setHtml($radiog->render());
         $form->addCommandButton('deliverFile', $this->lng->txt('download'));
         $form->addItem($att);
     }
     $isTrashFolder = false;
     if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) {
         $isTrashFolder = true;
     }
     $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']);
     $selectOptions = array();
     $actions = $this->mbox->getActions((int) $_GET["mobj_id"]);
     foreach ($actions as $key => $action) {
         if ($key == 'moveMails') {
             $folders = $this->mbox->getSubFolders();
             foreach ($folders as $folder) {
                 if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) {
                     $optionText = '';
                     if ($folder['type'] != 'user_folder') {
                         $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : '');
                     } else {
                         $optionText = $action . ' ' . $folder['title'];
                     }
                     $selectOptions[$folder['obj_id']] = $optionText;
                 }
             }
         }
     }
     if ($current_folder_data['type'] == 'user_folder') {
         $txt_folder = $current_folder_data['title'];
     } else {
         $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']);
     }
     $ilToolbar->addSeparator();
     $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder));
     if (is_array($selectOptions) && count($selectOptions)) {
         include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
         $actions = new ilSelectInputGUI('', 'selected_cmd');
         $actions->setOptions($selectOptions);
         $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail'));
         $ilToolbar->addInputItem($actions);
         $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder');
     }
     // Navigation
     $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']);
     $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']);
     if (is_array($prevMail) || is_array($nextMail)) {
         $ilToolbar->addSeparator();
         if ($prevMail['mail_id']) {
             $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']);
             $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail'));
             $this->ctrl->clearParameters($this);
         }
         if ($nextMail['mail_id']) {
             $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']);
             $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail'));
             $this->ctrl->clearParameters($this);
         }
     }
     $this->tpl->setContent($form->getHTML());
     $this->tpl->show();
 }
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]);
     $file_info = ilExAssignment::getDownloadedFilesInfoForTableGUIS($this->parent_obj, $this->exc_id, $d["type"], $d["id"], $this->part_id, $this->parent_cmd);
     $has_no_team_yet = false;
     if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
         $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id);
         // #11957
         if (sizeof($members)) {
             $this->tpl->setCurrentBlock("ass_members");
             foreach ($members as $member_id) {
                 $this->tpl->setVariable("TXT_MEMBER_NAME", ilObjUser::_lookupFullname($member_id));
                 $this->tpl->parseCurrentBlock();
             }
             $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
             $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
             $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
             $ilCtrl->setParameter($this->parent_obj, "lpart", "");
         } else {
             // #11957
             $has_no_team_yet = true;
             $this->tpl->setCurrentBlock("team_info");
             $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet"));
             $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team"));
             $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
             $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
             $this->tpl->setVariable("URL_CREATE_TEAM", $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam"));
             $ilCtrl->setParameter($this->parent_obj, "lpart", "");
             $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
             if ($file_info["files"]["count"]) {
                 $this->tpl->setVariable("TEAM_FILES_INFO", "<br />" . $file_info["files"]["txt"] . ": " . $file_info["files"]["count"]);
             }
             $this->tpl->parseCurrentBlock();
         }
     }
     if (!$has_no_team_yet) {
         $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "assid[" . $d["id"] . "]", 1));
         $this->tpl->setVariable("VAL_ID", $d["id"]);
         $this->tpl->setVariable("VAL_LAST_SUBMISSION", $file_info["last_submission"]["value"]);
         $this->tpl->setVariable("TXT_LAST_SUBMISSION", $file_info["last_submission"]["txt"]);
         $this->tpl->setVariable("TXT_SUBMITTED_FILES", $file_info["files"]["txt"]);
         $this->tpl->setVariable("VAL_SUBMITTED_FILES", $file_info["files"]["count"]);
         if ($file_info["files"]["download_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_DOWNLOAD", $file_info["files"]["download_url"]);
             $this->tpl->setVariable("TXT_DOWNLOAD", $file_info["files"]["download_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         if ($file_info["files"]["download_new_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $file_info["files"]["download_new_url"]);
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $file_info["files"]["download_new_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         // note
         $this->tpl->setVariable("TXT_NOTE", $lng->txt("exc_note_for_tutor"));
         $this->tpl->setVariable("NAME_NOTE", "notice[" . $d["id"] . "]");
         $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($d["id"], $this->part_id)));
         // comment for learner
         $lcomment_value = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
         $overlay_id = "excasscomm_" . $d["id"] . "_" . $this->part_id;
         $overlay_trigger_id = $overlay_id . "_tr";
         $overlay = new ilOverlayGUI($overlay_id);
         $overlay->setAnchor($overlay_trigger_id);
         $overlay->setTrigger($overlay_trigger_id, "click", $overlay_trigger_id);
         $overlay->add();
         $this->tpl->setVariable("LCOMMENT_ID", $overlay_id . "_snip");
         $this->tpl->setVariable("LCOMMENT_SNIPPET", ilUtil::shortenText($lcomment_value, 25, true));
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_ID", $overlay_trigger_id);
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_TEXT", $lng->txt("exc_comment_for_learner_edit"));
         $lcomment_form = new ilPropertyFormGUI();
         $lcomment_form->setId($overlay_id);
         $lcomment_form->setPreventDoubleSubmission(false);
         $lcomment = new ilTextAreaInputGUI($lng->txt("exc_comment_for_learner"), "lcomment_" . $d["id"] . "_" . $this->part_id);
         $lcomment->setInfo($lng->txt("exc_comment_for_learner_info"));
         $lcomment->setValue($lcomment_value);
         $lcomment->setCols(45);
         $lcomment->setRows(5);
         $lcomment_form->addItem($lcomment);
         //$lcomment_form->addCommandButton("save", $lng->txt("save"));
         // $lcomment_form->addCommandButton("cancel", $lng->txt("cancel"));
         $this->overlay_tpl->setCurrentBlock("overlay_bl");
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_ID", $overlay_id);
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_FORM", $lcomment_form->getHTML());
         $this->overlay_tpl->parseCurrentBlock();
         /*			
         $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
         $this->tpl->setVariable("NAME_LCOMMENT",
         	"lcomment[".$d["id"]."]");
         $lpcomment = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
         $this->tpl->setVariable("VAL_LCOMMENT",
         	ilUtil::prepareFormOutput($lpcomment));
         */
         // solved
         //$this->tpl->setVariable("CHKBOX_SOLVED",
         //	ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
         $status = ilExAssignment::lookupStatusOfUser($d["id"], $this->part_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         if (($sd = ilExAssignment::lookupStatusTimeOfUser($d["id"], $this->part_id)) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[" . $d["id"] . "]");
         $mark = ilExAssignment::lookupMarkOfUser($d["id"], $this->part_id);
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
         // feedback
         $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
         if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0) {
             $this->tpl->setCurrentBlock("feedback_date");
             $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
             $this->tpl->parseCurrentBlock();
         }
         $ilCtrl->setParameter($this, "rcp_to", $this->user->getLogin());
         $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
         //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin());
         $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail"));
         $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
         if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
             $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($d["id"], $this->part_id);
         } else {
             $feedback_id = $this->part_id;
         }
         $storage = new ilFSStorageExercise($this->exc_id, $d["id"]);
         $cnt_files = $storage->countFeedbackFiles($feedback_id);
         $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedbackpart");
         $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
         if ($cnt_files == 0) {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_add_feedback_file"));
         } else {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")");
         }
         // peer review / rating
         if ($d["type"] != ilExAssignment::TYPE_UPLOAD_TEAM && $d["peer"]) {
             $this->tpl->setCurrentBlock("peer_review_bl");
             $this->tpl->setVariable("TXT_PEER_REVIEW", $lng->txt("exc_peer_review_show"));
             $ilCtrl->setParameter($this->parent_obj, "grd", 2);
             $this->tpl->setVariable("LINK_PEER_REVIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showPersonalPeerReview"));
             $ilCtrl->setParameter($this->parent_obj, "grd", "");
             $rating = new ilRatingGUI();
             $rating->setObject($d["id"], "ass", $this->part_id, "peer");
             $rating->setUserId(0);
             $this->tpl->setVariable("VAL_RATING", $rating->getHTML(true, false));
             $this->tpl->parseCurrentBlock();
         }
         $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
     } else {
         $this->tpl->touchBlock("member_has_no_team_bl");
     }
 }
Ejemplo n.º 5
0
 /**
  * Init form
  *
  * @param string $a_cmd
  * @return ilPropertyFormGUI
  */
 public function initForm($a_cmd = "")
 {
     global $ilCtrl, $lng;
     $lng->loadLanguageModule('crs');
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this->parent_obj, $a_cmd));
     $form->setTarget('_blank');
     $form->setPreventDoubleSubmission(false);
     $form->setTitle($lng->txt('sess_gen_attendance_list'));
     $title = new ilTextInputGUI($lng->txt('title'), 'title');
     $title->setValue($this->title);
     $form->addItem($title);
     $desc = new ilTextInputGUI($lng->txt('description'), 'desc');
     $desc->setValue($this->description);
     $form->addItem($desc);
     if (sizeof($this->presets)) {
         $preset = new ilCheckboxGroupInputGUI($lng->txt('user_detail'), 'preset');
         $preset_value = array();
         foreach ($this->presets as $id => $item) {
             $preset->addOption(new ilCheckboxOption($item[0], $id));
             if ($item[1]) {
                 $preset_value[] = $id;
             }
         }
         $preset->setValue($preset_value);
         $form->addItem($preset);
     }
     $blank = new ilTextInputGUI($lng->txt('event_blank_columns'), 'blank');
     $blank->setMulti(true);
     $form->addItem($blank);
     if ($this->pre_blanks) {
         $blank->setValue($this->pre_blanks);
     }
     $part = new ilFormSectionHeaderGUI();
     $part->setTitle($lng->txt('event_participant_selection'));
     $form->addItem($part);
     // participants by roles
     foreach ($this->role_data as $role_id => $role_data) {
         $chk = new ilCheckboxInputGUI($role_data[0], 'role_' . $role_id);
         $chk->setValue(1);
         $chk->setChecked(1);
         $form->addItem($chk);
     }
     // not in sessions
     if ($this->waiting_list) {
         $chk = new ilCheckboxInputGUI($lng->txt('group_new_registrations'), 'subscr');
         $chk->setValue(1);
         $form->addItem($chk);
         $chk = new ilCheckboxInputGUI($lng->txt('crs_waiting_list'), 'wlist');
         $chk->setValue(1);
         $form->addItem($chk);
     }
     if ($this->user_filters) {
         foreach ($this->user_filters as $sub_id => $sub_item) {
             $sub = new ilCheckboxInputGUI($sub_item[0], 'members_' . $sub_id);
             if ($sub_item[1]) {
                 $sub->setChecked(true);
             }
             $form->addItem($sub);
         }
     }
     $form->addCommandButton($a_cmd, $lng->txt('sess_print_attendance_list'));
     if ($this->id && $a_cmd) {
         include_once "Services/User/classes/class.ilUserFormSettings.php";
         $settings = new ilUserFormSettings($this->id);
         $settings->deleteValue('desc');
         // #11340
         $settings->exportToForm($form);
     }
     return $form;
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["usr_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         return;
     }
     $has_no_team_yet = substr($member["team_id"], 0, 3) == "nty";
     if (!$has_no_team_yet) {
         // mail sent
         if ($this->sent_col) {
             if (ilExAssignment::lookupStatusSentOfUser($this->ass_id, $member_id)) {
                 $this->tpl->setCurrentBlock("mail_sent");
                 if (($st = ilExAssignment::lookupSentTimeOfUser($this->ass_id, $member_id)) > 0) {
                     $this->tpl->setVariable("TXT_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($st, IL_CAL_DATETIME))));
                 } else {
                     $this->tpl->setVariable("TXT_MAIL_SENT", $lng->txt("sent"));
                 }
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->setCurrentBlock("mail_sent");
                 $this->tpl->setVariable("TXT_MAIL_SENT", "&nbsp;");
                 $this->tpl->parseCurrentBlock();
             }
         }
         // checkbox
         $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "member[{$member_id}]", 1));
         $this->tpl->setVariable("VAL_ID", $member_id);
     }
     $file_info = ilExAssignment::getDownloadedFilesInfoForTableGUIS($this->parent_obj, $this->exc_id, $this->type, $this->ass_id, $member_id, $this->parent_cmd);
     // name and login
     if (!isset($member["team"])) {
         $this->tpl->setVariable("TXT_NAME", $member["name"]);
         if (in_array("login", $this->selected)) {
             $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
         }
         if (in_array("image", $this->selected)) {
             // image
             $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
             $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
         }
     } else {
         $this->tpl->setCurrentBlock("team_member");
         asort($member["team"]);
         foreach ($member["team"] as $member_name) {
             $this->tpl->setVariable("TXT_MEMBER_NAME", $member_name);
             $this->tpl->parseCurrentBlock();
         }
         if (!$has_no_team_yet) {
             $this->tpl->setCurrentBlock("team_log");
             $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id);
             $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
             $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", "");
             $this->tpl->parseCurrentBlock();
         } else {
             // #11957
             $this->tpl->setCurrentBlock("team_info");
             $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet"));
             $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id);
             $this->tpl->setVariable("URL_CREATE_TEAM", $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam"));
             $ilCtrl->setParameter($this->parent_obj, "lmem", "");
             if ($file_info["files"]["count"]) {
                 $this->tpl->setVariable("TEAM_FILES_INFO", "<br />" . $file_info["files"]["txt"] . ": " . $file_info["files"]["count"]);
             }
             $this->tpl->parseCurrentBlock();
         }
     }
     if (!$has_no_team_yet) {
         $this->tpl->setVariable("VAL_LAST_SUBMISSION", $file_info["last_submission"]["value"]);
         $this->tpl->setVariable("TXT_LAST_SUBMISSION", $file_info["last_submission"]["txt"]);
         $this->tpl->setVariable("TXT_SUBMITTED_FILES", $file_info["files"]["txt"]);
         $this->tpl->setVariable("VAL_SUBMITTED_FILES", $file_info["files"]["count"]);
         if ($file_info["files"]["download_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_DOWNLOAD", $file_info["files"]["download_url"]);
             $this->tpl->setVariable("TXT_DOWNLOAD", $file_info["files"]["download_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         if ($file_info["files"]["download_new_url"]) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $file_info["files"]["download_new_url"]);
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $file_info["files"]["download_new_txt"]);
             $this->tpl->parseCurrentBlock();
         }
         // note
         $this->tpl->setVariable("TXT_NOTE", $lng->txt("exc_note_for_tutor"));
         $this->tpl->setVariable("NAME_NOTE", "notice[{$member_id}]");
         $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($this->ass_id, $member_id)));
         // comment for learner
         $lcomment_value = ilExAssignment::lookupCommentForUser($this->ass_id, $member_id);
         $overlay_id = "excasscomm_" . $this->ass_id . "_" . $member_id;
         $overlay_trigger_id = $overlay_id . "_tr";
         $overlay = new ilOverlayGUI($overlay_id);
         $overlay->setAnchor($overlay_trigger_id);
         $overlay->setTrigger($overlay_trigger_id, "click", $overlay_trigger_id);
         $overlay->add();
         $this->tpl->setVariable("LCOMMENT_ID", $overlay_id . "_snip");
         $this->tpl->setVariable("LCOMMENT_SNIPPET", ilUtil::shortenText($lcomment_value, 25, true));
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_ID", $overlay_trigger_id);
         $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_TEXT", $lng->txt("exc_comment_for_learner_edit"));
         $lcomment_form = new ilPropertyFormGUI();
         $lcomment_form->setId($overlay_id);
         $lcomment_form->setPreventDoubleSubmission(false);
         $lcomment = new ilTextAreaInputGUI($lng->txt("exc_comment_for_learner"), "lcomment_" . $this->ass_id . "_" . $member_id);
         $lcomment->setInfo($lng->txt("exc_comment_for_learner_info"));
         $lcomment->setValue($lcomment_value);
         $lcomment->setCols(45);
         $lcomment->setRows(10);
         $lcomment_form->addItem($lcomment);
         $lcomment_form->addCommandButton("save", $lng->txt("save"));
         // $lcomment_form->addCommandButton("cancel", $lng->txt("cancel"));
         $this->overlay_tpl->setCurrentBlock("overlay_bl");
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_ID", $overlay_id);
         $this->overlay_tpl->setVariable("COMMENT_OVERLAY_FORM", $lcomment_form->getHTML());
         $this->overlay_tpl->parseCurrentBlock();
         // solved
         //$this->tpl->setVariable("CHKBOX_SOLVED",
         //	ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
         $status = ilExAssignment::lookupStatusOfUser($this->ass_id, $member_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         if (($sd = ilExAssignment::lookupStatusTimeOfUser($this->ass_id, $member_id)) > 0) {
             $this->tpl->setCurrentBlock("status_date");
             $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
             $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
             $this->tpl->parseCurrentBlock();
         }
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
         $this->tpl->setVariable("NAME_MARK", "mark[{$member_id}]");
         $mark = ilExAssignment::lookupMarkOfUser($this->ass_id, $member_id);
         $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
         // feedback
         $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
         if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($this->ass_id, $member_id)) > 0) {
             $this->tpl->setCurrentBlock("feedback_date");
             $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
             $this->tpl->parseCurrentBlock();
         }
         // feedback mail
         $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
         $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail"));
         if ($this->type == ilExAssignment::TYPE_UPLOAD_TEAM) {
             $feedback_id = "t" . $member["team_id"];
         } else {
             $feedback_id = $member_id;
         }
         // file feedback
         $cnt_files = $this->storage->countFeedbackFiles($feedback_id);
         $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedback");
         $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
         if ($cnt_files == 0) {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_add_feedback_file"));
         } else {
             $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")");
         }
         // peer review / rating
         if (!isset($member["team"]) && $this->peer_review) {
             $this->tpl->setCurrentBlock("peer_review_bl");
             $this->tpl->setVariable("TXT_PEER_REVIEW", $lng->txt("exc_peer_review_show"));
             $ilCtrl->setParameter($this->parent_obj, "grd", 1);
             $this->tpl->setVariable("LINK_PEER_REVIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showPersonalPeerReview"));
             $ilCtrl->setParameter($this->parent_obj, "grd", "");
             $rating = new ilRatingGUI();
             $rating->setObject($this->ass_id, "ass", $member_id, "peer");
             $rating->setUserId(0);
             $this->tpl->setVariable("VAL_RATING", $rating->getHTML(true, false));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->touchBlock("member_has_no_team_bl");
     }
 }
 /**
  * Returns session form with period set by given $sessions.
  * @param array $sessions
  * @return ilPropertyFormGUI
  */
 public function getSessionForm(array $sessions)
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     $form = new ilPropertyFormGUI();
     $form->setPreventDoubleSubmission(false);
     $list = new ilSelectInputGUI($lng->txt('session'), 'session');
     $options = array();
     foreach ($sessions as $session) {
         $start = new ilDateTime($session['connected'], IL_CAL_UNIX);
         $end = new ilDateTime($session['disconnected'], IL_CAL_UNIX);
         $options[$session['connected'] . ',' . $session['disconnected']] = ilDatePresentation::formatPeriod($start, $end);
     }
     $list->setOptions($options);
     $list->setRequired(true);
     $form->addItem($list);
     return $form;
 }