/**
  * Show content overview
  */
 protected function showContent()
 {
     // preparation
     $content = $this->plugin->getTemplate("tpl.leitner_overview.html");
     // instructions
     if ($instructions = $this->object->getInstructions()) {
         $content->setVariable("INSTRUCTIONS", nl2br(ilUtil::makeClickable($instructions, true)));
     }
     // table with boxes and commands
     $this->plugin->includeClass("Leitner/class.ilLeitnerTableGUI.php");
     $table = new ilLeitnerTableGUI($this, "showContent");
     $table->setData($this->training->getOverviewData());
     $unused_cards = $this->training->countUnusedCards();
     if ($unused_cards > 0 and !$this->training->isStartMaxReached()) {
         $table->addCommandButton("fillTraining", $this->txt("leitner_fill_training"));
     }
     if ($used_cards = $this->training->countUsedCards()) {
         $table->addCommandButton("confirmResetTraining", $this->txt("reset_training"));
     }
     $content->setVariable("TABLE", $table->getHTML());
     // message for untrained cards
     if ($unused_cards > 0) {
         $content->setVariable("UNTRAINED", sprintf($this->txt($unused_cards == 1 ? "untrained_1" : "untrained_x"), $unused_cards));
         $content->setVariable("UNTRAINED_HINT", $this->txt($this->training->isStartMaxReached() ? "leitner_hint_train_startbox" : "leitner_hint_fill_startbox"));
     }
     // explanation
     $content->setVariable("EXPLANATION", $this->txt("leitner_explanation"));
     // set the output
     $this->tpl->setContent($content->get());
 }
 /**
  * Make clickable
  *
  * @param
  * @return
  */
 function makeClickable($a_str)
 {
     // this fixes bug 8744. We assume that strings that contain < and >
     // already contain html, we do not handle these
     if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
         return $a_str;
     }
     return ilUtil::makeClickable($a_str);
 }
 /**
  * Get Mail HTML for Personal Desktop Mail Display
  */
 public function getPDMailHTML($a_mail_id, $a_mobj_id)
 {
     global $lng, $rbacsystem, $ilias;
     $lng->loadLanguageModule('mail');
     //get the mail from user
     $umail = new ilMail($_SESSION['AccountId']);
     // catch hack attempts
     if (!$rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
         $ilias->raiseError($lng->txt('permission_denied'), $ilias->error_obj->WARNING);
     }
     $umail->markRead(array($a_mail_id));
     $mail_data = $umail->getMail($a_mail_id);
     $tpl = new ilTemplate('tpl.pd_mail.html', true, true, 'Services/Mail');
     // attachments
     if ($mail_data['attachments']) {
         foreach ($mail_data['attachments'] as $file) {
             $tpl->setCurrentBlock('a_row');
             $tpl->setVariable('HREF_DOWNLOAD', 'ilias.php?baseClass=ilMailGUI&amp;type=deliverFile&amp;mail_id=' . $_GET['mail_id'] . '&amp;filename=' . md5($file));
             $tpl->setVariable('FILE_NAME', $file);
             $tpl->setVariable('TXT_DOWNLOAD', $lng->txt('download'));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('attachment');
         $tpl->setVariable('TXT_ATTACHMENT', $lng->txt('attachments'));
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable('TXT_FROM', $lng->txt('from'));
     /**
      * @var $sender ilObjUser
      */
     $sender = ilObjectFactory::getInstanceByObjId($mail_data['sender_id'], false);
     if ($sender && $sender->getId() != ANONYMOUS_USER_ID) {
         $tpl->setCurrentBlock('pers_image');
         $tpl->setVariable('IMG_SENDER', $sender->getPersonalPicturePath('xsmall'));
         $tpl->setVariable('ALT_SENDER', $sender->getPublicName());
         $tpl->parseCurrentBlock();
         $tpl->setVariable('PUBLIC_NAME', $sender->getPublicName());
     } else {
         if (!$sender) {
             $tpl->setVariable('PUBLIC_NAME', $mail_data['import_name'] . ' (' . $lng->txt('user_deleted') . ')');
         } else {
             $tpl->setCurrentBlock('pers_image');
             $tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.png'));
             $tpl->setVariable('ALT_SENDER', ilMail::_getIliasMailerName());
             $tpl->parseCurrentBlock();
             $tpl->setVariable('PUBLIC_NAME', ilMail::_getIliasMailerName());
         }
     }
     $tpl->setVariable('TXT_TO', $lng->txt('mail_to'));
     $tpl->setVariable('TO', $umail->formatNamesForOutput($mail_data['rcp_to']));
     if ($mail_data['rcp_cc']) {
         $tpl->setCurrentBlock('cc');
         $tpl->setVariable('TXT_CC', $lng->txt('cc'));
         $tpl->setVariable('CC', $umail->formatNamesForOutput($mail_data['rcp_cc']));
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable('TXT_SUBJECT', $lng->txt('subject'));
     $tpl->setVariable('SUBJECT', htmlspecialchars($mail_data['m_subject']));
     $tpl->setVariable('TXT_DATE', $lng->txt('date'));
     $tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($mail_data['send_time'], IL_CAL_DATETIME)));
     $tpl->setVariable('TXT_MESSAGE', $lng->txt('message'));
     // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
     $tpl->setVariable('MAIL_MESSAGE', nl2br(ilUtil::makeClickable(htmlspecialchars(ilUtil::securePlainString($mail_data['m_message'])))));
     return $tpl->get();
 }
 /**
  * Encodes a plain text string into HTML for display in a browser.
  * This function encodes HTML special characters: < > & with &lt; &gt; &amp;
  * and converts newlines into <br>
  *
  * If $a_make_links_clickable is set to true, URLs in the plain string which
  * are considered to be safe, are made clickable.
  *
  *
  * @param string the plain text string
  * @param boolean set this to true, to make links in the plain string
  * clickable.
  * @param boolean set this to true, to detect goto links
  * @static
  * 
  */
 public static function htmlencodePlainString($a_str, $a_make_links_clickable, $a_detect_goto_links = false)
 {
     $encoded = "";
     if ($a_make_links_clickable) {
         // Find text sequences in the plain text string which match
         // the URI syntax rules, and pass them to ilUtil::makeClickable.
         // Encode all other text sequences in the plain text string using
         // htmlspecialchars and nl2br.
         // The following expressions matches URI's as specified in RFC 2396.
         //
         // The expression matches URI's, which start with some well known
         // schemes, like "http:", or with "www.". This must be followed
         // by at least one of the following RFC 2396 expressions:
         // - alphanum:           [a-zA-Z0-9]
         // - reserved:           [;\/?:|&=+$,]
         // - mark:               [\\-_.!~*\'()]
         // - escaped:            %[0-9a-fA-F]{2}
         // - fragment delimiter: #
         // - uric_no_slash:      [;?:@&=+$,]
         $matches = array();
         $numberOfMatches = preg_match_all('/(?:(?:http|https|ftp|ftps|mailto):|www\\.)(?:[a-zA-Z0-9]|[;\\/?:|&=+$,]|[\\-_.!~*\'()]|%[0-9a-fA-F]{2}|#|[;?:@&=+$,])+/', $a_str, $matches, PREG_OFFSET_CAPTURE);
         $pos1 = 0;
         $encoded = "";
         foreach ($matches as $match) {
         }
         foreach ($matches[0] as $match) {
             $matched_text = $match[0];
             $pos2 = $match[1];
             if ($matched_offset != previous_offset) {
                 // encode plain text
                 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
             }
             // encode URI
             $encoded .= ilUtil::makeClickable($matched_text, $a_detect_goto_links);
             $pos1 = $pos2 + strlen($matched_text);
         }
         if ($pos1 < strlen($a_str)) {
             $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
         }
     } else {
         $encoded = nl2br(htmlspecialchars($a_str));
     }
     return $encoded;
 }
 /**
  * get HTML
  *
  * @access public
  * @param 
  * @return
  */
 public function getHTML($a_app)
 {
     global $tree, $lng, $ilUser;
     self::$counter++;
     $this->tpl = new ilTemplate('tpl.appointment_panel.html', true, true, 'Services/Calendar');
     // Panel variables
     $this->tpl->setVariable('PANEL_NUM', self::$counter);
     $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false)));
     if ($a_app["event"]->isMilestone()) {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_ms_details'));
     } else {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details'));
     }
     $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date'));
     if ($a_app['fullday']) {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDate($a_app['dstart'], IL_CAL_UNIX), new ilDate($a_app['dend'], IL_CAL_UNIX)));
     } else {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)));
     }
     if ($a_app['event']->getLocation()) {
         $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
         $this->tpl->setVariable('PANEL_WHERE', ilUtil::makeClickable($a_app['event']->getLocation()), true);
     }
     if ($a_app['event']->getDescription()) {
         $this->tpl->setVariable('PANEL_TXT_DESC', $this->lng->txt('description'));
         $this->tpl->setVariable('PANEL_DESC', ilUtil::makeClickable(nl2br($a_app['event']->getDescription())));
     }
     if ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0) {
         $this->tpl->setVariable('PANEL_TXT_COMPL', $this->lng->txt('cal_task_completion'));
         $this->tpl->setVariable('PANEL_COMPL', $a_app['event']->getCompletion() . " %");
     }
     if ($a_app['event']->isMilestone()) {
         // users responsible
         $users = $a_app['event']->readResponsibleUsers();
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
             $this->tpl->setVariable('PANEL_RESP', $value);
         }
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId());
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
     $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ? $cat_info['subitem_obj_ids'][$cat_id] : $cat_info['obj_id'];
     $this->tpl->setVariable('PANEL_TXT_CAL_TYPE', $this->lng->txt('cal_cal_type'));
     switch ($cat_info['type']) {
         case ilCalendarCategory::TYPE_GLOBAL:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_system'));
             break;
         case ilCalendarCategory::TYPE_USR:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal'));
             break;
         case ilCalendarCategory::TYPE_OBJ:
             $type = ilObject::_lookupType($cat_info['obj_id']);
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_' . $type));
             // Course group appointment registration
             if ($this->settings->isCGRegistrationEnabled() and $type == 'crs' or type == 'grp') {
                 if (!$a_app['event']->isAutoGenerated()) {
                     include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
                     $reg = new ilCalendarRegistration($a_app['event']->getEntryId());
                     if ($reg->isRegistered($ilUser->getId(), new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_reg_unregister'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister'));
                         $this->tpl->parseCurrentBlock();
                     } else {
                         $this->tpl->setCurrentBlock('panel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_reg_register'));
                         $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister'));
                         $this->tpl->parseCurrentBlock();
                     }
                     include_once './Services/Link/classes/class.ilLink.php';
                     $registrations = array();
                     foreach ($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)) as $usr_data) {
                         $usr_id = $usr_data['usr_id'];
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $usr_id);
                         $registrations[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($usr_id);
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     }
                     if (count($registrations)) {
                         $this->tpl->setCurrentBlock('panel_current_booking');
                         $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users'));
                         $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
             break;
         case ilCalendarCategory::TYPE_CH:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilBookingEntry($a_app['event']->getContextId());
             $is_owner = $entry->isOwner();
             $user_entry = $cat_info['obj_id'] == $ilUser->getId();
             if ($user_entry && !$is_owner) {
                 // find source calendar entry in owner calendar
                 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
                 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
                 $ref_event = $apps[0];
             } else {
                 $ref_event = $a_app['event']->getEntryId();
             }
             $this->tpl->setCurrentBlock('panel_booking_owner');
             $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
             $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock('panel_max_booking');
             $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings'));
             $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
             $this->tpl->parseCurrentBlock();
             if (!$is_owner) {
                 if ($entry->hasBooked($ref_event)) {
                     if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
                         $this->tpl->parseCurrentBlock();
                     }
                 } elseif ($entry->isAppointmentBookableForUser($ref_event, $GLOBALS['ilUser']->getId())) {
                     $this->tpl->setCurrentBlock('panel_book_link');
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                     $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
                     $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $obj_ids = $entry->getTargetObjIds();
                 foreach ($obj_ids as $obj_id) {
                     $title = ilObject::_lookupTitle($obj_id);
                     $refs = ilObject::_getAllReferences($obj_id);
                     include_once './Services/Link/classes/class.ilLink.php';
                     $this->tpl->setCurrentBlock('panel_booking_target_row');
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title);
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET', ilLink::_getLink(end($refs)));
                     $this->tpl->parseCurrentBlock();
                 }
                 if ($obj_ids) {
                     $this->tpl->setCurrentBlock('panel_booking_target');
                     $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $link_users = true;
                 if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) {
                     $link_users = false;
                 }
                 include_once './Services/Link/classes/class.ilLink.php';
                 $bookings = array();
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1);
                 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
                     if ($link_users) {
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id);
                         $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($user_id) . '</a>';
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     } else {
                         $bookings[] = ilObjUser::_lookupFullname($user_id);
                     }
                 }
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', '');
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings));
                 $this->tpl->parseCurrentBlock();
             }
             break;
         case ilCalendarCategory::TYPE_BOOK:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking'));
             $this->tpl->setCurrentBlock('panel_cancel_book_link');
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
             $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
             $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
             $this->tpl->parseCurrentBlock();
             break;
     }
     $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name'));
     $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
     if ($cat_info['editable'] and !$a_app['event']->isAutoGenerated()) {
         $this->tpl->setCurrentBlock('panel_edit_link');
         $this->tpl->setVariable('TXT_PANEL_EDIT', $this->lng->txt('edit'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askEdit'));
         $this->tpl->setCurrentBlock('panel_delete_link');
         $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askdelete'));
         $this->tpl->parseCurrentBlock();
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     if ($cat_info['type'] == ilCalendarCategory::TYPE_OBJ) {
         $refs = ilObject::_getAllReferences($entry_obj_id);
         $type = ilObject::_lookupType($entry_obj_id);
         $title = ilObject::_lookupTitle($entry_obj_id) ? ilObject::_lookupTitle($entry_obj_id) : $lng->txt('obj_' . $type);
         include_once './Services/Link/classes/class.ilLink.php';
         $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($entry_obj_id));
         $parent = $tree->getParentId(current($refs));
         $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
         $this->tpl->setVariable('PANEL_TXT_LINK', $this->lng->txt('ext_link'));
         $this->tpl->setVariable('PANEL_LINK_HREF', $href);
         $this->tpl->setVariable('PANEL_LINK_NAME', $title);
         $this->tpl->setVariable('PANEL_PARENT', $parent_title);
     }
     return $this->tpl->get();
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
     if (IS_PAYMENT_ENABLED) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
     }
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("exc_instruction"));
         $is_html = strlen($a_data["instruction"]) != strlen(strip_tags($a_data["instruction"]));
         if (!$is_html) {
             $a_data["instruction"] = nl2br(ilUtil::makeClickable($a_data["instruction"], true));
         }
         $info->addProperty("", $a_data["instruction"]);
     }
     // schedule
     $info->addSection($lng->txt("exc_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     if ($a_data["deadline"] > 0) {
         $info->addProperty($lng->txt("exc_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     }
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("exc_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->exc->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $button = ilLinkButton::getInstance();
             $button->setCaption("exc_list_submission");
             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions"));
             $info->addProperty($lng->txt("exc_public_submission"), $button->render());
         } else {
             $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("exc_files"));
             foreach ($files as $file) {
                 // if download must be purchased first show a "buy"-button
                 if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) {
                     $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
                 } else {
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"]));
                     $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile"));
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                 }
             }
         }
         // submission
         // if submission must be purchased first
         if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) {
             $info->addSection($lng->txt("exc_your_submission"));
             $ilCtrl->clearParameters($this);
             $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']);
             $ilCtrl->setParameter($this, 'subtype', 'upload');
             $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
         } else {
             $info->addSection($lng->txt("exc_your_submission"));
             $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId());
             $times_up = false;
             if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) {
                 $times_up = true;
             }
             $team_members = null;
             switch ($a_data["type"]) {
                 case ilExAssignment::TYPE_UPLOAD_TEAM:
                     $no_team_yet = false;
                     $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId());
                     if (sizeof($team_members)) {
                         $team = array();
                         foreach ($team_members as $member_id) {
                             $team[] = ilObjUser::_lookupFullname($member_id);
                         }
                         $team = implode(", ", $team);
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_manage_team");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreenTeam"));
                         $team .= " " . $button->render();
                         $info->addProperty($lng->txt("exc_team_members"), $team);
                     } else {
                         $no_team_yet = true;
                         if (!$times_up) {
                             if (!sizeof($delivered_files)) {
                                 $team_info = $lng->txt("exc_no_team_yet_notice");
                             } else {
                                 $team_info = '<span class="warning">' . $lng->txt("exc_no_team_yet_notice") . '</span>';
                             }
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption("exc_create_team");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createTeam"));
                             $team_info .= " " . $button->render();
                             $team_info .= '<div class="ilFormInfo">' . $lng->txt("exc_no_team_yet_info") . '</div>';
                         } else {
                             $team_info = '<span class="warning">' . $lng->txt("exc_create_team_times_up_warning") . '</span>';
                         }
                         $info->addProperty($lng->txt("exc_team_members"), $team_info);
                     }
                     // fallthrough
                 // fallthrough
                 case ilExAssignment::TYPE_UPLOAD:
                     $titles = array();
                     foreach ($delivered_files as $file) {
                         $titles[] = $file["filetitle"];
                     }
                     $files_str = implode($titles, ", ");
                     if ($files_str == "") {
                         $files_str = $lng->txt("message_no_delivered_files");
                     }
                     // no team == no submission
                     if (!$no_team_yet) {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                         if (!$times_up) {
                             $title = count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission");
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption($title, false);
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                             $files_str .= " " . $button->render();
                         } else {
                             if (count($titles) > 0) {
                                 $button = ilLinkButton::getInstance();
                                 $button->setCaption("already_delivered_files");
                                 $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                                 $files_str .= " " . $button->render();
                             }
                         }
                     }
                     $info->addProperty($lng->txt("exc_files_returned"), $files_str);
                     break;
                 case ilExAssignment::TYPE_BLOG:
                     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                     $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                     // #12939
                     if (!$wsp_tree->getRootId()) {
                         $wsp_tree->createTreeForUser($ilUser->getId());
                     }
                     $files_str = "";
                     $valid_blog = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $blog_id = (int) $delivered_files["filetitle"];
                         $node = $wsp_tree->getNodeData($blog_id);
                         if ($node["title"]) {
                             // #10116
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
                             $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
                             $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>';
                             $valid_blog = true;
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_blog) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_blog");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog"));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
                         if (!$valid_blog && $blogs || $valid_blog && $blogs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_blog_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_PORTFOLIO:
                     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
                     $files_str = "";
                     $valid_prtf = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $portfolio_id = (int) $delivered_files["filetitle"];
                         // #11746
                         if (ilObject::_exists($portfolio_id, false, "prtf")) {
                             $portfolio = new ilObjPortfolio($portfolio_id, false);
                             if ($portfolio->getTitle()) {
                                 // #10116 / #12791
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
                                 $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
                                 $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>';
                                 $valid_prtf = true;
                             }
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_prtf) {
                             // if there are portfolio templates available show form first
                             include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
                             $has_prtt = sizeof(ilObjPortfolioTemplate::getAvailablePortfolioTemplates()) ? "Template" : "";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_portfolio");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio" . $has_prtt));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($ilUser->getId()));
                         if (!$valid_prtf && $prtfs || $valid_prtf && $prtfs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_TEXT:
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                     if (!$times_up) {
                         $button = ilLinkButton::getInstance();
                         $button->setPrimary(true);
                         $button->setCaption("exc_text_assignment_edit");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editAssignmentText"));
                         $files_str = $button->render();
                     } else {
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_text_assignment_show");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showAssignmentText"));
                         $files_str = $button->render();
                     }
                     $info->addProperty($lng->txt("exc_files_returned_text"), $files_str);
                     break;
             }
             $last_sub = ilExAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
             if ($last_sub) {
                 $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
             } else {
                 $last_sub = "---";
             }
             if ($last_sub != "---") {
                 $info->addProperty($lng->txt("exc_last_submission"), $last_sub);
             }
             // peer feedback
             if ($times_up && $a_data["peer"]) {
                 $nr_missing_fb = ilExAssignment::getNumberOfMissingFeedbacks($a_data["id"], $a_data["peer_min"]);
                 if (!$a_data["peer_dl"] || $a_data["peer_dl"] > time()) {
                     $dl_info = "";
                     if ($a_data["peer_dl"]) {
                         $dl_info = " (" . sprintf($lng->txt("exc_peer_review_deadline_info_button"), ilDatePresentation::formatDate(new ilDateTime($a_data["peer_dl"], IL_CAL_UNIX))) . ")";
                     }
                     $button = ilLinkButton::getInstance();
                     $button->setPrimary($nr_missing_fb);
                     $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editPeerReview"));
                     $edit_pc = $button->render();
                 } else {
                     if ($a_data["peer_dl"]) {
                         $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
                     }
                 }
                 if ((!$a_data["peer_dl"] || $a_data["peer_dl"] < time()) && !$nr_missing_fb) {
                     $button = ilLinkButton::getInstance();
                     $button->setCaption("exc_peer_review_show");
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showPersonalPeerReview"));
                     $view_pc = $button->render();
                 }
                 /*
                 else 
                 {
                 	$view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
                 }
                 */
                 $info->addProperty($lng->txt("exc_peer_review"), $edit_pc . " " . $view_pc);
             }
             // feedback from tutor
             if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId());
             } else {
                 $feedback_id = $ilUser->getId();
             }
             // global feedback / sample solution
             if ($a_data["fb_date"] == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
                 $show_global_feedback = $times_up && $a_data["fb_file"];
             } else {
                 $show_global_feedback = $last_sub != "---" && $a_data["fb_file"];
             }
             $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]);
             $cnt_files = $storage->countFeedbackFiles($feedback_id);
             $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
             $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
             $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
             if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0 || $show_global_feedback) {
                 $info->addSection($lng->txt("exc_feedback_from_tutor"));
                 if ($lpcomment != "") {
                     $info->addProperty($lng->txt("exc_comment"), $lpcomment);
                 }
                 if ($mark != "") {
                     $info->addProperty($lng->txt("exc_mark"), $mark);
                 }
                 if ($status == "") {
                     //				  $info->addProperty($lng->txt("status"),
                     //						$lng->txt("message_no_delivered_files"));
                 } else {
                     if ($status != "notgraded") {
                         $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" />';
                         $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status));
                     }
                 }
                 if ($cnt_files > 0) {
                     $info->addSection($lng->txt("exc_fb_files") . '<a name="fb' . $a_data["id"] . '"></a>');
                     if ($cnt_files > 0) {
                         $files = $storage->getFeedbackFiles($feedback_id);
                         foreach ($files as $file) {
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file));
                             $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile"));
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                         }
                     }
                 }
                 // #15002 - global feedback
                 if ($show_global_feedback) {
                     $info->addSection($lng->txt("exc_global_feedback_file"));
                     $info->addProperty($a_data["fb_file"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadGlobalFeedbackFile"));
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilErr, $ilAccess, $ilUser, $ilSetting;
     $this->checkPermission('visible');
     // Fill meta header tags
     include_once 'Services/MetaData/classes/class.ilMDUtils.php';
     ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
     $this->tabs_gui->setTabActive('info_short');
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once 'Modules/Course/classes/class.ilCourseFile.php';
     $files =& ilCourseFile::_readFilesByCourse($this->object->getId());
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     $info->enableFeedback();
     $info->enableNews();
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $info->enableNewsEditing();
     }
     if (strlen($this->object->getImportantInformation()) or strlen($this->object->getSyllabus()) or count($files)) {
         $info->addSection($this->lng->txt('crs_general_informations'));
     }
     if (strlen($this->object->getImportantInformation())) {
         $info->addProperty($this->lng->txt('crs_important_info'), "<strong>" . nl2br(ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"));
     }
     if (strlen($this->object->getSyllabus())) {
         $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(ilUtil::makeClickable($this->object->getSyllabus(), true)));
     }
     // files
     if (count($files)) {
         $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course');
         foreach ($files as $file) {
             $tpl->setCurrentBlock("files");
             $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
             $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
             $tpl->setVariable("DOWN_NAME", $file->getFileName());
             $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
             $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
             $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
             $tpl->parseCurrentBlock();
         }
         $info->addProperty($this->lng->txt('crs_file_download'), $tpl->get());
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
     $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
     $record_gui->setInfoObject($info);
     $record_gui->parse();
     // meta data
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     // contact
     if ($this->object->hasContactData()) {
         $info->addSection($this->lng->txt("crs_contact"));
     }
     if (strlen($this->object->getContactName())) {
         $info->addProperty($this->lng->txt("crs_contact_name"), $this->object->getContactName());
     }
     if (strlen($this->object->getContactResponsibility())) {
         $info->addProperty($this->lng->txt("crs_contact_responsibility"), $this->object->getContactResponsibility());
     }
     if (strlen($this->object->getContactPhone())) {
         $info->addProperty($this->lng->txt("crs_contact_phone"), $this->object->getContactPhone());
     }
     if ($this->object->getContactEmail()) {
         require_once 'Services/Mail/classes/class.ilMailFormCall.php';
         $emails = split(",", $this->object->getContactEmail());
         foreach ($emails as $email) {
             $email = trim($email);
             $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course');
             $etpl->setVariable("EMAIL_LINK", ilMailFormCall::getLinkTarget($info, 'showSummary', array(), array('type' => 'new', 'rcp_to' => $email, 'sig' => $this->createMailSignature())));
             $etpl->setVariable("CONTACT_EMAIL", $email);
             $mailString .= $etpl->get() . "<br />";
         }
         $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
     }
     if (strlen($this->object->getContactConsultation())) {
         $info->addProperty($this->lng->txt("crs_contact_consultation"), nl2br($this->object->getContactConsultation()));
     }
     //
     // access
     //
     // #10360
     $this->lng->loadLanguageModule("rep");
     $info->addSection($this->lng->txt("rep_activation_availability"));
     $info->showLDAPRoleGroupMappingInfo();
     // activation
     if ($this->object->getActivationUnlimitedStatus()) {
         $info->addProperty($this->lng->txt("rep_activation_access"), $this->lng->txt('crs_visibility_limitless'));
     } else {
         $info->addProperty($this->lng->txt('rep_activation_access'), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX), new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX)));
     }
     switch ($this->object->getSubscriptionLimitationType()) {
         case IL_CRS_SUBSCRIPTION_DEACTIVATED:
             $txt = $this->lng->txt("crs_info_reg_deactivated");
             break;
         default:
             switch ($this->object->getSubscriptionType()) {
                 case IL_CRS_SUBSCRIPTION_CONFIRMATION:
                     $txt = $this->lng->txt("crs_info_reg_confirmation");
                     break;
                 case IL_CRS_SUBSCRIPTION_DIRECT:
                     $txt = $this->lng->txt("crs_info_reg_direct");
                     break;
                 case IL_CRS_SUBSCRIPTION_PASSWORD:
                     $txt = $this->lng->txt("crs_info_reg_password");
                     break;
             }
     }
     // subscription
     $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
     if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         if ($this->object->getSubscriptionUnlimitedStatus()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_unlimited'));
         } elseif ($this->object->getSubscriptionStart() < time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_to') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX)));
         } elseif ($this->object->getSubscriptionStart() > time()) {
             $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_from') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX)));
         }
         if ($this->object->isSubscriptionMembershipLimited()) {
             include_once './Services/Membership/classes/class.ilParticipants.php';
             $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getSubscriptionMaxMembers() - ilParticipants::lookupNumberOfMembers($this->object->getRefId())));
         }
     }
     // archive
     if ($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE) {
         if ($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE) {
             $info->addProperty($this->lng->txt("crs_archive"), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX), new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX)));
         }
     }
     // Confirmation
     include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) {
         include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
         $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
         $this->lng->loadLanguageModule('ps');
         $info->addSection($this->lng->txt('crs_user_agreement_info'));
         $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
         if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
             $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
         }
     }
     $info->enableLearningProgress(true);
     // forward the command
     $this->ctrl->forwardCommand($info);
 }
 /**
  * fill informations
  *
  * @access protected
  * @param
  * @return
  */
 protected function fillInformations()
 {
     if ($this->container->getImportantInformation()) {
         $imp = new ilNonEditableValueGUI($this->lng->txt('crs_important_info'), "", true);
         $value = nl2br(ilUtil::makeClickable($this->container->getImportantInformation(), true));
         $imp->setValue($value);
         $this->form->addItem($imp);
     }
     if ($this->container->getSyllabus()) {
         $syl = new ilNonEditableValueGUI($this->lng->txt('crs_syllabus'), "", true);
         $value = nl2br(ilUtil::makeClickable($this->container->getSyllabus(), true));
         $syl->setValue($value);
         $this->form->addItem($syl);
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // context
     $obj_id = ilObject::_lookupObjId($a_set["ref_id"]);
     $obj_type = ilObject::_lookupType($obj_id);
     $obj_title = ilObject::_lookupTitle($obj_id);
     // user
     if ($a_set["user_id"] > 0) {
         $this->tpl->setCurrentBlock("user_info");
         if ($obj_type == "frm") {
             include_once "./Modules/Forum/classes/class.ilForumProperties.php";
             if (ilForumProperties::_isAnonymized($a_set["context_obj_id"])) {
                 if ($a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
                     include_once "./Modules/Forum/classes/class.ilForumPost.php";
                     $post = new ilForumPost($a_set["context_sub_obj_id"]);
                     if ($post->getUserAlias() != "") {
                         $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias()));
                     } else {
                         $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                     }
                 } else {
                     $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                 }
             } else {
                 if (ilObject::_exists($a_set["user_id"])) {
                     $user_obj = new ilObjUser($a_set["user_id"]);
                     $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
                 }
             }
         } else {
             if (ilObject::_exists($a_set["user_id"])) {
                 $user_obj = new ilObjUser($a_set["user_id"]);
                 $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
             }
         }
         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
         $this->tpl->parseCurrentBlock();
     }
     // media player
     if ($a_set["content_type"] == NEWS_AUDIO && $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
         $mob = new ilObjMediaObject($a_set["mob_id"]);
         $med = $mob->getMediaItem("Standard");
         $mpl = new ilMediaPlayerGUI();
         $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"]) . "/" . $med->getLocation());
         $this->tpl->setCurrentBlock("player");
         $this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
         $this->tpl->parseCurrentBlock();
     }
     // access
     if ($enable_internal_rss) {
         $this->tpl->setCurrentBlock("access");
         include_once "./Services/Block/classes/class.ilBlockSetting.php";
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     // content
     if ($a_set["content"] != "") {
         $this->tpl->setCurrentBlock("content");
         $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["content_long"] != "") {
         $this->tpl->setCurrentBlock("long");
         $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["update_date"] != $a_set["creation_date"]) {
         $this->tpl->setCurrentBlock("ni_update");
         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
         $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     // forum hack, not nice
     $add = "";
     if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
         include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
         $pos = $a_set["context_sub_obj_id"];
         $thread = ilObjForumAccess::_getThreadForPosting($pos);
         if ($thread > 0) {
             $add = "_" . $thread . "_" . $pos;
         }
     }
     $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $a_set["ref_id"] . $add;
     $this->tpl->setCurrentBlock("context");
     $cont_loc = new ilLocatorGUI();
     $cont_loc->addContextItems($a_set["ref_id"], true);
     $this->tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
     $this->tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
     $this->tpl->setVariable("CONTEXT_TITLE", $obj_title);
     $this->tpl->setVariable("ALT_CONTEXT_TITLE", $lng->txt("icon") . " " . $lng->txt("obj_" . $obj_type));
     $this->tpl->setVariable("IMG_CONTEXT_TITLE", ilUtil::getImagePath("icon_" . $obj_type . "_b.png"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("HREF_TITLE", $url_target);
     // title
     if ($a_set["content_is_lang_var"]) {
         $this->tpl->setVariable("VAL_TITLE", $lng->txt($a_set["title"]));
     } else {
         $this->tpl->setVariable("VAL_TITLE", ilUtil::stripSlashes($a_set["title"]));
         // title
     }
     // creation date
     $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
     $this->tpl->parseCurrentBlock();
 }
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $rbacsystem, $ilUser, $ilSetting;
     $this->tabs_gui->setTabActive('info_short');
     if (!$rbacsystem->checkAccess("visible", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
     }
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     if (strlen($this->object->getInformation())) {
         $info->addSection($this->lng->txt('grp_general_informations'));
         $info->addProperty($this->lng->txt('grp_information'), nl2br(ilUtil::makeClickable($this->object->getInformation(), true)));
     }
     $info->enablePrivateNotes();
     $info->enableLearningProgress(true);
     $info->addSection($this->lng->txt('group_registration'));
     $info->showLDAPRoleGroupMappingInfo();
     if (!$this->object->isRegistrationEnabled()) {
         $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_deac_info_screen'));
     } else {
         switch ($this->object->getRegistrationType()) {
             case GRP_REGISTRATION_DIRECT:
                 $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_direct_info_screen'));
                 break;
             case GRP_REGISTRATION_REQUEST:
                 $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_req_info_screen'));
                 break;
             case GRP_REGISTRATION_PASSWORD:
                 $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_passwd_info_screen'));
                 break;
         }
         /*			
         $info->addProperty($this->lng->txt('group_registration_time'),
         	ilDatePresentation::formatPeriod(
         		$this->object->getRegistrationStart(),
         		$this->object->getRegistrationEnd()));
         */
         if ($this->object->isRegistrationUnlimited()) {
             $info->addProperty($this->lng->txt('group_registration_time'), $this->lng->txt('grp_registration_unlimited'));
         } elseif ($this->object->getRegistrationStart()->getUnixTime() < time()) {
             $info->addProperty($this->lng->txt("group_registration_time"), $this->lng->txt('cal_until') . ' ' . ilDatePresentation::formatDate($this->object->getRegistrationEnd()));
         } elseif ($this->object->getRegistrationStart()->getUnixTime() >= time()) {
             $info->addProperty($this->lng->txt("group_registration_time"), $this->lng->txt('cal_from') . ' ' . ilDatePresentation::formatDate($this->object->getRegistrationStart()));
         }
         if ($this->object->isMembershipLimited()) {
             $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getMaxMembers() - $this->object->members_obj->getCountMembers()));
         }
     }
     // Confirmation
     include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php';
     if ($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledGroupExport()) {
         include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php';
         $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
         $this->lng->loadLanguageModule('ps');
         $info->addSection($this->lng->txt('grp_user_agreement_info'));
         $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
         if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
             $info->addProperty($this->lng->txt('ps_grp_user_fields'), $fields);
         }
     }
     // forward the command
     $this->ctrl->forwardCommand($info);
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     if (IS_PAYMENT_ENABLED) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
     }
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("exc_instruction"));
         $info->addProperty("", nl2br(ilUtil::makeClickable($a_data["instruction"], true)));
     }
     // schedule
     $info->addSection($lng->txt("exc_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     if ($a_data["deadline"] > 0) {
         $info->addProperty($lng->txt("exc_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     }
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("exc_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->exc->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $link = '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions") . '">' . $lng->txt("exc_list_submission") . '</a>';
             $info->addProperty($lng->txt("exc_public_submission"), $link);
         } else {
             $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("exc_files"));
             foreach ($files as $file) {
                 // if download must be purchased first show a "buy"-button
                 if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) {
                     $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
                 } else {
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"]));
                     $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile"));
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                 }
             }
         }
         // submission
         // if submission must be purchased first
         if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) {
             $info->addSection($lng->txt("exc_your_submission"));
             $ilCtrl->clearParameters($this);
             $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']);
             $ilCtrl->setParameter($this, 'subtype', 'upload');
             $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
         } else {
             $info->addSection($lng->txt("exc_your_submission"));
             $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId());
             $times_up = false;
             if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) {
                 $times_up = true;
             }
             $team_members = null;
             switch ($a_data["type"]) {
                 case ilExAssignment::TYPE_UPLOAD_TEAM:
                     $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId());
                     if (sizeof($team_members) > 1) {
                         $team = array();
                         foreach ($team_members as $member_id) {
                             $team[] = ilObjUser::_lookupFullname($member_id);
                         }
                         $info->addProperty($lng->txt("exc_team_members"), implode(", ", $team));
                     }
                     // fallthrough
                 // fallthrough
                 case ilExAssignment::TYPE_UPLOAD:
                     $titles = array();
                     foreach ($delivered_files as $file) {
                         $titles[] = $file["filetitle"];
                     }
                     $files_str = implode($titles, ", ");
                     if ($files_str == "") {
                         $files_str = $lng->txt("message_no_delivered_files");
                     }
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                     if (!$times_up) {
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . (count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission")) . '</a>';
                     } else {
                         if (count($titles) > 0) {
                             $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . $lng->txt("already_delivered_files") . '</a>';
                         }
                     }
                     $info->addProperty($lng->txt("exc_files_returned"), $files_str);
                     break;
                 case ilExAssignment::TYPE_BLOG:
                     $files_str = "";
                     $valid_blog = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $blog_id = (int) $delivered_files["filetitle"];
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
                         $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                         $node = $wsp_tree->getNodeData($blog_id);
                         if ($node["title"]) {
                             // #10116
                             // $blog_link = ilWorkspaceAccessHandler::getGotoLink($blog_id, $node["obj_id"]);
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
                             $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
                             $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>';
                             $valid_blog = true;
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_blog) {
                             $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog") . '">' . $lng->txt("exc_create_blog") . '</a>';
                         }
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog") . '">' . $lng->txt("exc_select_blog" . ($valid_blog ? "_change" : "")) . '</a>';
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_blog_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>");
                     }
                     break;
                 case ilExAssignment::TYPE_PORTFOLIO:
                     $files_str = "";
                     $valid_prtf = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $portfolio_id = (int) $delivered_files["filetitle"];
                         include_once "Services/Portfolio/classes/class.ilObjPortfolio.php";
                         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
                         $portfolio = new ilObjPortfolio($portfolio_id, false);
                         if ($portfolio->getTitle()) {
                             // #10116
                             // $prtf_link = ilWorkspaceAccessHandler::getGotoLink($portfolio_id, $portfolio_id)
                             $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
                             $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilobjportfoliogui"), "pages");
                             $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
                             $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>';
                             $valid_prtf = true;
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_prtf) {
                             $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio") . '">' . $lng->txt("exc_create_portfolio") . '</a>';
                         }
                         $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio") . '">' . $lng->txt("exc_select_portfolio" . ($valid_prtf ? "_change" : "")) . '</a>';
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>");
                     }
                     break;
             }
             $last_sub = ilExAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
             if ($last_sub) {
                 $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
             } else {
                 $last_sub = "---";
             }
             if ($last_sub != "---") {
                 $info->addProperty($lng->txt("exc_last_submission"), $last_sub);
             }
             // feedback from tutor
             if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId());
             } else {
                 $feedback_id = $ilUser->getId();
             }
             $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]);
             $cnt_files = $storage->countFeedbackFiles($feedback_id);
             $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
             $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
             $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
             if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0) {
                 $info->addSection($lng->txt("exc_feedback_from_tutor"));
                 if ($lpcomment != "") {
                     $info->addProperty($lng->txt("exc_comment"), $lpcomment);
                 }
                 if ($mark != "") {
                     $info->addProperty($lng->txt("exc_mark"), $mark);
                 }
                 if ($status == "") {
                     //				  $info->addProperty($lng->txt("status"),
                     //						$lng->txt("message_no_delivered_files"));
                 } else {
                     if ($status != "notgraded") {
                         $img = '<img border="0" src="' . ilUtil::getImagePath("scorm/" . $status . ".png") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" style="vertical-align:middle;"/>';
                         $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status));
                     }
                 }
                 if ($cnt_files > 0) {
                     $info->addSection($lng->txt("exc_fb_files"));
                     $files = $storage->getFeedbackFiles($feedback_id);
                     foreach ($files as $file) {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file));
                         $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile"));
                         $ilCtrl->setParameter($this, "file", "");
                     }
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("rep_robj_xeph_instruction"));
         $info->addProperty("", nl2br(ilUtil::makeClickable($a_data["instruction"], true)));
     }
     // schedule
     $info->addSection($lng->txt("rep_robj_xeph_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("rep_robj_xeph_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     $info->addProperty($lng->txt("rep_robj_xeph_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("rep_robj_xeph_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->eph->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $link = '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "listPublicSubmissions") . '">' . $lng->txt("rep_robj_xeph_list_submission") . '</a>';
             $info->addProperty($lng->txt("rep_robj_xeph_public_submission"), $link);
         } else {
             $info->addProperty($lng->txt("rep_robj_xeph_public_submission"), $lng->txt("rep_robj_xeph_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilEphAssignment::getFiles($a_data["eph_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("rep_robj_xeph_files"));
             foreach ($files as $file) {
                 $ilCtrl->setParameterByClass("ilobjephorusgui", "file", urlencode($file["name"]));
                 $info->addProperty($file["name"], $lng->txt("rep_robj_xeph_download"), $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "downloadFile"));
                 $ilCtrl->setParameterByClass("ilobjephorusgui", "file", "");
             }
         }
         // submission
         $info->addSection($lng->txt("rep_robj_xeph_your_submission"));
         $delivered_files = ilEphAssignment::getDeliveredFiles($a_data["eph_id"], $a_data["id"], $ilUser->getId());
         $times_up = false;
         if ($a_data["deadline"] - time() < 0) {
             $times_up = true;
         }
         $titles = array();
         foreach ($delivered_files as $file) {
             $titles[] = $file["filetitle"];
         }
         $files_str = implode($titles, ", ");
         if ($files_str == "") {
             $files_str = $lng->txt("rep_robj_xeph_message_no_delivered_files");
         }
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
         if (!$times_up) {
             $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "submissionScreen") . '">' . (count($titles) == 0 ? $lng->txt("rep_robj_xeph_hand_in") : $lng->txt("rep_robj_xeph_edit_submission")) . '</a>';
         } else {
             if (count($titles) > 0) {
                 $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "submissionScreen") . '">' . $lng->txt("rep_robj_xeph_already_delivered_files") . '</a>';
             }
         }
         $info->addProperty($lng->txt("rep_robj_xeph_files_returned"), $files_str);
         $last_sub = ilEphAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
         if ($last_sub) {
             $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
         } else {
             $last_sub = "---";
         }
         if ($last_sub != "---") {
             $info->addProperty($lng->txt("rep_robj_xeph_last_submission"), $last_sub);
         }
         // feedback from tutor
         $storage = new ilFSStorageEphorus($a_data["eph_id"], $a_data["id"]);
         $cnt_files = $storage->countFeedbackFiles($ilUser->getId());
         $lpcomment = ilEphAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
         $mark = ilEphAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
         $status = ilEphAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
         if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0) {
             $info->addSection($lng->txt("rep_robj_xeph_feedback_from_tutor"));
             if ($lpcomment != "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_comment"), $lpcomment);
             }
             if ($mark != "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_mark"), $mark);
             }
             if ($status == "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_status"), $lng->txt("rep_robj_xeph_message_no_delivered_files"));
             } else {
                 if ($status != "notgraded") {
                     $img = '<img border="0" src="' . ilUtil::getImagePath("scorm/" . $status . ".png") . '" ' . ' alt="' . $lng->txt("rep_robj_xeph_" . $status) . '" title="' . $lng->txt("rep_robj_xeph_" . $status) . '" style="vertical-align:middle;"/>';
                     $info->addProperty($lng->txt("rep_robj_xeph_status"), $img . " " . $lng->txt("rep_robj_xeph_" . $status));
                 }
             }
             if ($cnt_files > 0) {
                 $info->addSection($lng->txt("fb_files"));
                 $files = $storage->getFeedbackFiles($ilUser->getId());
                 foreach ($files as $file) {
                     $ilCtrl->setParameterByClass("ilobjephorusgui", "file", urlencode($file));
                     $info->addProperty($file, $lng->txt("rep_robj_xeph_download"), $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "downloadFeedbackFile"));
                     $ilCtrl->setParameter($this, "file", "");
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }