/**
  * Get all completed tests
  */
 protected function getItems()
 {
     $data = array();
     foreach (ilExAssignment::getTeamLog($this->team_id) as $item) {
         switch ($item["action"]) {
             case ilExAssignment::TEAM_LOG_CREATE_TEAM:
                 $mess = "create_team";
                 break;
             case ilExAssignment::TEAM_LOG_ADD_MEMBER:
                 $mess = "add_member";
                 break;
             case ilExAssignment::TEAM_LOG_REMOVE_MEMBER:
                 $mess = "remove_member";
                 break;
             case ilExAssignment::TEAM_LOG_ADD_FILE:
                 $mess = "add_file";
                 break;
             case ilExAssignment::TEAM_LOG_REMOVE_FILE:
                 $mess = "remove_file";
                 break;
         }
         $details = $this->lng->txt("exc_team_log_" . $mess);
         if ($item["details"]) {
             $details = sprintf($details, $item["details"]);
         }
         $data[] = array("tstamp" => $item["tstamp"], "user" => ilObjUser::_lookupFullname($item["user_id"]), "details" => $details);
     }
     $this->setData($data);
 }
Ejemplo n.º 2
0
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["created"], IL_CAL_UNIX)));
     $name = ilObjUser::_lookupName($a_set["user_id"]);
     $this->tpl->setVariable("LASTNAME", $name["lastname"]);
     $this->tpl->setVariable("FIRSTNAME", $name["firstname"]);
     $this->tpl->setVariable("LOGIN", $name["login"]);
     $this->tpl->setVariable("ACTION", $this->action_map[$a_set["action"]]);
     if ($a_set["action"] == ilRbacLog::CHANGE_OWNER) {
         $user = ilObjUser::_lookupFullname($a_set["data"][0]);
         $changes = array(array("action" => $this->lng->txt("rbac_log_changed_owner"), "operation" => $user));
     } else {
         if ($a_set["action"] == ilRbacLog::EDIT_TEMPLATE) {
             $changes = $this->parseChangesTemplate($a_set["data"]);
         } else {
             $changes = $this->parseChangesFaPa($a_set["data"]);
         }
     }
     $this->tpl->setCurrentBlock("changes");
     foreach ($changes as $change) {
         $this->tpl->setVariable("CHANGE_ACTION", $change["action"]);
         $this->tpl->setVariable("CHANGE_OPERATION", $change["operation"]);
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * Init table
  */
 protected function initTable()
 {
     global $ilCtrl;
     $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
     $this->setRowTemplate('tpl.scorm_track_item.html', 'Modules/ScormAicc');
     $this->setTitle(ilObjUser::_lookupFullname($this->getUserId()));
     $this->addColumn($this->lng->txt('title'), 'title', '35%');
     $this->addColumn($this->lng->txt('cont_status'), 'status', '25%');
     $this->addColumn($this->lng->txt('cont_time'), 'time', '20%');
     $this->addColumn($this->lng->txt('cont_score'), 'score', '20%');
 }
 /**
  * Parse table content
  */
 public function parse()
 {
     $this->initTable();
     $sco_data = $this->getParentObject()->object->getTrackingDataAggSco($this->getSco()->getId());
     $data = array();
     foreach ($sco_data as $row) {
         $tmp = array();
         $tmp['user_id'] = $row['user_id'];
         $tmp['score'] = $row['score'];
         $tmp['time'] = $row['time'];
         $tmp['status'] = $row['status'];
         $tmp['name'] = ilObjUser::_lookupFullname($row['user_id']);
         $data[] = $tmp;
     }
     $this->setData($data);
 }
Ejemplo n.º 5
0
 static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null)
 {
     global $ilUser, $ilAccess;
     // get blog object id (repository or workspace)
     if ($a_in_wsp) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $tree = new ilWorkspaceTree($ilUser->getId());
         // owner of tree is irrelevant
         $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
         $access_handler = new ilWorkspaceAccessHandler($tree);
         $link = ilWorkspaceAccessHandler::getGotoLink($a_blog_node_id, $blog_obj_id, "_" . $a_posting_id);
     } else {
         $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
         $access_handler = null;
         include_once "Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getStaticLink($a_blog_node_id, "blog", true, "_" . $a_posting_id);
     }
     if (!$blog_obj_id) {
         return;
     }
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     $posting = new ilBlogPosting($a_posting_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     // approval handling
     $admin_only = false;
     if (!$posting->isApproved()) {
         $blog = new self($blog_obj_id, false);
         if ($blog->hasApproval()) {
             switch ($a_action) {
                 case "update":
                     // un-approved posting was updated - no notifications
                     return;
                 case "new":
                     // un-approved posting was activated - admin-only notification
                     $admin_only = true;
                     $ignore_threshold = true;
                     break;
             }
         }
     }
     // recipients
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_BLOG, $blog_obj_id, $a_posting_id, $ignore_threshold);
     if (!sizeof($users)) {
         return;
     }
     // send mails
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $posting_title = $posting->getTitle();
     $blog_title = ilObject::_lookupTitle($blog_obj_id);
     $author = $posting->getAuthor();
     $notified = array();
     foreach (array_unique($users) as $idx => $user_id) {
         // the user responsible for the action should not be notified
         if ($user_id == $ilUser->getId()) {
             continue;
         }
         // workspace
         if ($access_handler) {
             if ($admin_only && !$access_handler->checkAccessOfUser($tree, $user_id, 'write', '', $a_blog_node_id)) {
                 continue;
             }
             if (!$access_handler->checkAccessOfUser($tree, $user_id, 'read', '', $a_blog_node_id)) {
                 continue;
             }
         } else {
             if ($admin_only && !$ilAccess->checkAccessOfUser($user_id, 'write', '', $a_blog_node_id)) {
                 continue;
             }
             if (!$ilAccess->checkAccessOfUser($user_id, 'read', '', $a_blog_node_id)) {
                 continue;
             }
         }
         // use language of recipient to compose message
         $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
         $ulng->loadLanguageModule('blog');
         $subject = sprintf($ulng->txt('blog_change_notification_subject'), $blog_title);
         $message = sprintf($ulng->txt('blog_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
         $message .= $ulng->txt('blog_change_notification_body_' . $a_action) . ":\n\n";
         $message .= $ulng->txt('obj_blog') . ": " . $blog_title . "\n";
         $message .= $ulng->txt('blog_posting') . ": " . $posting_title . "\n";
         $message .= $ulng->txt('blog_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
         if ($a_comment) {
             $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
         }
         $message .= "\n" . $ulng->txt('blog_change_notification_link') . ": " . $link;
         $mail_obj = new ilMail(ANONYMOUS_USER_ID);
         $mail_obj->appendInstallationSignature(true);
         $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         $notified[] = $user_id;
     }
     if (sizeof($notified)) {
         ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified);
     }
 }
 /**
  * Send notification about team status
  * 
  * @param int $a_exc_ref_id
  * @param int $a_user_id
  * @param string $a_action
  */
 public function sendNotification($a_exc_ref_id, $a_user_id, $a_action)
 {
     global $ilUser;
     // no need to notify current user
     if ($ilUser->getId() == $a_user_id) {
         return;
     }
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     include_once "./Services/Link/classes/class.ilLink.php";
     $link = ilLink::_getStaticLink($a_exc_ref_id);
     // use language of recipient to compose message
     $ulng = ilLanguageFactory::_getLanguageOfUser($a_user_id);
     $ulng->loadLanguageModule('exc');
     $subject = sprintf($ulng->txt('exc_team_notification_subject_' . $a_action), $this->getTitle());
     $message = sprintf($ulng->txt('exc_team_notification_salutation'), ilObjUser::_lookupFullname($a_user_id)) . "\n\n";
     $message .= $ulng->txt('exc_team_notification_body_' . $a_action) . "\n\n";
     $message .= $ulng->txt('obj_exc') . ": " . ilObject::_lookupTitle($this->getExerciseId()) . "\n";
     $message .= $ulng->txt('exc_assignment') . ": " . $this->getTitle() . "\n";
     $message .= $ulng->txt('exc_team_notification_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
     $message .= $ulng->txt('exc_team_notification_link') . ": " . $link;
     $mail_obj = new ilMail(ANONYMOUS_USER_ID);
     $mail_obj->appendInstallationSignature(true);
     $ret = $mail_obj->sendMail(ilObjUser::_lookupLogin($a_user_id), "", "", $subject, $message, array(), array("system"));
     // var_dump($ret);
 }
 /**
  * Confirmation screen to cancel consultation appointment or ressource booking
  * depends on calendar category
  */
 public function cancelBooking()
 {
     global $ilUser, $tpl;
     $entry = (int) $_GET['app_id'];
     include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
     $entry = new ilCalendarEntry($entry);
     $category = $this->calendarEntryToCategory($entry);
     if ($category->getType() == ilCalendarCategory::TYPE_CH) {
         include_once 'Services/Booking/classes/class.ilBookingEntry.php';
         $booking = new ilBookingEntry($entry->getContextId());
         if (!$booking->hasBooked($entry->getEntryId())) {
             $this->ctrl->returnToParent($this);
             return false;
         }
         $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
     } else {
         if ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
             $entry_title = ' ' . $entry->getTitle();
         } else {
             $this->ctrl->returnToParent($this);
             return false;
         }
     }
     $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
     include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
     $conf = new ilConfirmationGUI();
     $conf->setFormAction($this->ctrl->getFormAction($this));
     $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
     $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
     $conf->setCancel($this->lng->txt('cancel'), 'cancel');
     $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title);
     $tpl->setContent($conf->getHTML());
 }
 /**
  * 
  * @return 
  */
 public function send()
 {
     global $rbacreview, $lng;
     switch ($this->getType()) {
         case self::TYPE_USER:
             $rcp = array_pop($this->getRecipients());
             $this->initLanguage($rcp);
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_mail_notification_subject'), $this->getAppointment()->getTitle()));
             $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('cal_mail_notification_body'));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail($this->getRecipients(), array('system'), true);
             break;
         case self::TYPE_USER_ANONYMOUS:
             $rcp = array_pop($this->getRecipients());
             $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->getLanguage()->loadLanguageModule('mail');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_mail_notification_subject'), $this->getAppointment()->getTitle()));
             $this->setBody(ilMail::getSalutation(0, $this->getLanguage()));
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('cal_mail_notification_body'));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail($this->getRecipients(), array('email'), false);
             break;
         case self::TYPE_GRP_NEW_NOTIFICATION:
             $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
             $this->getLanguage()->loadLanguageModule('grp');
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_grp_new_notification_sub'), $this->getObjectTitle(true)));
             $this->setBody($this->getLanguageText('grp_notification_salutation'));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_grp_new_notification_body'), $this->getObjectTitle(true)));
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->appendBody($this->createPermanentLink());
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail(array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()), array('system'), false);
             break;
         case self::TYPE_GRP_NOTIFICATION:
             $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
             $this->getLanguage()->loadLanguageModule('grp');
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_grp_notification_sub'), $this->getObjectTitle(true)));
             $this->setBody($this->getLanguageText('grp_notification_salutation'));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_grp_notification_body'), $this->getObjectTitle(true)));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
             $this->appendBody("\n\n");
             $this->appendBody($this->createPermanentLink());
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail(array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()), array('system'), false);
             break;
         case self::TYPE_CRS_NEW_NOTIFICATION:
             $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
             $this->getLanguage()->loadLanguageModule('crs');
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_crs_new_notification_sub'), $this->getObjectTitle(true)));
             $this->setBody($this->getLanguageText('crs_notification_salutation'));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_crs_new_notification_body'), $this->getObjectTitle(true)));
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->appendBody($this->createPermanentLink());
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail(array('#il_crs_admin_' . $this->getRefId(), '#il_crs_tutor_' . $this->getRefId(), '#il_crs_member_' . $this->getRefId()), array('system'), false);
             break;
         case self::TYPE_CRS_NOTIFICATION:
             $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
             $this->getLanguage()->loadLanguageModule('crs');
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_crs_notification_sub'), $this->getObjectTitle(true)));
             $this->setBody($this->getLanguageText('crs_notification_salutation'));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_crs_notification_body'), $this->getObjectTitle(true)));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails();
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
             $this->appendBody("\n\n");
             $this->appendBody($this->createPermanentLink());
             $this->getMail()->appendInstallationSignature(true);
             $this->addAttachment();
             $this->sendMail(array('#il_crs_admin_' . $this->getRefId(), '#il_crs_tutor_' . $this->getRefId(), '#il_crs_member_' . $this->getRefId()), array('system'), false);
             break;
         case self::TYPE_BOOKING_CONFIRMATION:
             $user_id = array_pop($this->getRecipients());
             include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilCalendarEntry($this->getAppointmentId());
             $booking = new ilBookingEntry($entry->getContextId());
             $this->initLanguage($user_id);
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle()));
             $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_booking_confirmation_body'), ilObjUser::_lookupFullname($booking->getObjId())));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails($booking);
             /*
             				$this->appendBody("\n\n");
             				$this->appendBody($this->getLanguageText('cal_booking_confirmation_link'));
             				$this->appendBody("\n\n");
             				$this->appendBody($this->createPermanentLink());
             */
             $this->getMail()->appendInstallationSignature(true);
             $this->sendMail(array($user_id), array('system'), true);
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('cal_booking_confirmation_user') . "\n");
             $this->appendBody(ilObjUser::_lookupFullname($user_id));
             $this->sendMail(array($booking->getObjId()), array('system'), true);
             break;
         case self::TYPE_BOOKING_CANCELLATION:
             $user_id = array_pop($this->getRecipients());
             include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilCalendarEntry($this->getAppointmentId());
             $booking = new ilBookingEntry($entry->getContextId());
             $user_id = array_pop($this->getRecipients());
             $this->initLanguage($user_id);
             $this->getLanguage()->loadLanguageModule('dateplaner');
             $this->initMail();
             $this->setSubject(sprintf($this->getLanguageText('cal_booking_cancellation_subject'), $entry->getTitle()));
             $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
             $this->appendBody("\n\n");
             $this->appendBody(sprintf($this->getLanguageText('cal_booking_cancellation_body'), ilObjUser::_lookupFullname($booking->getObjId())));
             $this->appendBody("\n\n");
             $this->appendAppointmentDetails($booking);
             $this->getMail()->appendInstallationSignature(true);
             $this->sendMail(array($user_id), array('system'), true);
             $this->appendBody("\n\n");
             $this->appendBody($this->getLanguageText('cal_booking_cancellation_user') . "\n");
             $this->appendBody(ilObjUser::_lookupFullname($user_id));
             $this->sendMail(array($booking->getObjId()), array('system'), true);
             break;
     }
     $this->deleteAttachments();
 }
 /**
  * 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();
 }
 /**
  * Init table
  */
 protected function initTable()
 {
     global $ilCtrl;
     $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
     $this->setRowTemplate('tpl.scorm_track_item_per_user.html', 'Modules/ScormAicc');
     $this->setTitle($this->getSco()->getTitle() . ' - ' . ilObjUser::_lookupFullname($this->getUserId()));
     $this->addColumn($this->lng->txt('cont_lvalue'), 'lvalue', '50%');
     $this->addColumn($this->lng->txt('cont_rvalue'), 'rvalue', '50%');
 }
 /**
  * Parse appointments
  * @return 
  */
 public function parse()
 {
     global $ilDB, $ilObjDataCache;
     include_once 'Services/Booking/classes/class.ilBookingEntry.php';
     $data = array();
     $counter = 0;
     foreach (ilConsultationHourAppointments::getAppointments($this->getUserId()) as $app) {
         $data[$counter]['id'] = $app->getEntryId();
         $data[$counter]['title'] = $app->getTitle();
         $data[$counter]['description'] = $app->getDescription();
         $data[$counter]['start'] = $app->getStart()->get(IL_CAL_UNIX);
         $data[$counter]['start_p'] = ilDatePresentation::formatDate($app->getStart());
         $booking = new ilBookingEntry($app->getContextId());
         $users = array();
         foreach ($booking->getCurrentBookings($app->getEntryId()) as $user_id) {
             $users[$user_id] = ilObjUser::_lookupFullname($user_id);
         }
         $data[$counter]['num_bookings'] = sizeof($users);
         $data[$counter]['bookings'] = $users;
         $target = $booking->getTargetObjId();
         if ($target) {
             $data[$counter]['target'] = $ilObjDataCache->lookupTitle($target);
         }
         $counter++;
     }
     $this->setData($data);
 }
Ejemplo n.º 12
0
 /**
  * Get bloch HTML code.
  */
 function getHTML()
 {
     global $ilCtrl, $lng, $ilUser, $ilAccess;
     if ($this->getCurrentDetailLevel() == 0) {
         return "";
     }
     // add edit commands
     #if ($this->getEnableEdit())
     if ($this->mode == ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS or $this->mode == ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP) {
         include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
         $this->addBlockCommand($this->ctrl->getLinkTarget($this, 'showCalendarSubscription'), $lng->txt('ical_export'), "", "", true, false, ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_ICAL));
     }
     if ($this->mode == ilCalendarCategories::MODE_REPOSITORY) {
         if (!isset($_GET["bkid"])) {
             if ($ilAccess->checkAccess('edit_event', '', (int) $_GET['ref_id'])) {
                 $ilCtrl->setParameter($this, "add_mode", "block");
                 $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilCalendarAppointmentGUI", "add"), $lng->txt("add_appointment"));
                 $ilCtrl->setParameter($this, "add_mode", "");
             }
             global $ilObjDataCache;
             include_once "Modules/Course/classes/class.ilCourseParticipants.php";
             $obj_id = $ilObjDataCache->lookupObjId((int) $_GET['ref_id']);
             $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
             $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
             //$users = $participants->getParticipants();
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             //$users = ilBookingEntry::isBookable($users, $obj_id);
             $users = ilBookingEntry::lookupBookableUsersForObject($obj_id, $users);
             if ($users) {
                 foreach ($users as $user_id) {
                     if (!isset($_GET["bkid"])) {
                         $ilCtrl->setParameter($this, "bkid", $user_id);
                         $this->addBlockCommand($ilCtrl->getLinkTargetByClass("ilCalendarMonthGUI", ""), $lng->txt("cal_consultation_hours_for") . ' ' . ilObjUser::_lookupFullname($user_id));
                         $this->cal_footer[] = array('link' => $ilCtrl->getLinkTargetByClass('ilCalendarMonthGUI', ''), 'txt' => $lng->txt("cal_consultation_hours_for") . ' ' . ilObjUser::_lookupFullname($user_id));
                     }
                 }
                 $ilCtrl->setParameter($this, "bkid", "");
             }
         } else {
             $ilCtrl->setParameter($this, "bkid", "");
             $this->addBlockCommand($ilCtrl->getLinkTarget($this), $lng->txt("back"));
             $ilCtrl->setParameter($this, "bkid", (int) $_GET["bkid"]);
         }
     }
     if ($this->getProperty("settings") == true) {
         $this->addBlockCommand($ilCtrl->getLinkTarget($this, "editSettings"), $lng->txt("settings"));
     }
     $ilCtrl->setParameterByClass("ilcolumngui", "seed", isset($_GET["seed"]) ? $_GET["seed"] : "");
     $ret = parent::getHTML();
     $ilCtrl->setParameterByClass("ilcolumngui", "seed", "");
     return $ret;
 }
Ejemplo n.º 13
0
 /**
  * @param      $a_action
  * @param      $a_table_id
  * @param null $a_record_id
  */
 public static function sendNotification($a_action, $a_table_id, $a_record_id = NULL)
 {
     global $ilUser, $ilAccess;
     // If coming from trash, never send notifications and don't load dcl Object
     if ($_GET['ref_id'] == SYSTEM_FOLDER_ID) {
         return;
     }
     $dclObj = new ilObjDataCollection($_GET['ref_id']);
     if ($dclObj->getNotification() != 1) {
         return;
     }
     $obj_table = ilDataCollectionCache::getTableCache($a_table_id);
     $obj_dcl = $obj_table->getCollectionObject();
     // recipients
     require_once './Services/Notification/classes/class.ilNotification.php';
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), true);
     if (!sizeof($users)) {
         return;
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), $users);
     //FIXME  $_GET['ref_id]
     require_once './Services/Link/classes/class.ilLink.php';
     $link = ilLink::_getLink($_GET['ref_id']);
     // prepare mail content
     // use language of recipient to compose message
     require_once './Services/Language/classes/class.ilLanguageFactory.php';
     // send mails
     require_once './Services/Mail/classes/class.ilMail.php';
     require_once './Services/User/classes/class.ilObjUser.php';
     require_once './Services/Language/classes/class.ilLanguageFactory.php';
     require_once './Services/User/classes/class.ilUserUtil.php';
     require_once './Services/User/classes/class.ilUserUtil.php';
     require_once './Modules/DataCollection/classes/class.ilDataCollectionTable.php';
     foreach (array_unique($users) as $idx => $user_id) {
         // the user responsible for the action should not be notified
         // FIXME  $_GET['ref_id]
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $_GET['ref_id'])) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('dcl');
             $subject = sprintf($ulng->txt('dcl_change_notification_subject'), $obj_dcl->getTitle());
             // update/delete
             $message = $ulng->txt("dcl_hello") . " " . ilObjUser::_lookupFullname($user_id) . ",\n\n";
             $message .= $ulng->txt('dcl_change_notification_dcl_' . $a_action) . ":\n\n";
             $message .= $ulng->txt('obj_dcl') . ": " . $obj_dcl->getTitle() . "\n\n";
             $message .= $ulng->txt('dcl_table') . ": " . $obj_table->getTitle() . "\n\n";
             $message .= $ulng->txt('dcl_record') . ":\n";
             $message .= "------------------------------------\n";
             if ($a_record_id) {
                 $record = ilDataCollectionCache::getRecordCache($a_record_id);
                 if (!$record->getTableId()) {
                     $record->setTableId($a_table_id);
                 }
                 //					$message .= $ulng->txt('dcl_record_id').": ".$a_record_id.":\n";
                 $t = "";
                 foreach ($record->getTable()->getVisibleFields() as $field) {
                     if ($record->getRecordField($field->getId())) {
                         $t .= $field->getTitle() . ": " . $record->getRecordField($field->getId())->getPlainText() . "\n";
                     }
                 }
                 $message .= $t . "\n";
             }
             $message .= "------------------------------------\n";
             $message .= $ulng->txt('dcl_changed_by') . ": " . $ilUser->getFullname() . " " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
             $message .= $ulng->txt('dcl_change_notification_link') . ": " . $link . "\n\n";
             $message .= $ulng->txt('dcl_change_why_you_receive_this_email');
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * Remove member from team
  * 
  * @param int $a_team_id
  * @param int $a_user_id 
  * @param int $a_exc_ref_id 
  */
 function removeTeamMember($a_team_id, $a_user_id, $a_exc_ref_id)
 {
     global $ilDB;
     $sql = "DELETE FROM il_exc_team" . " WHERE ass_id = " . $ilDB->quote($this->getId(), "integer") . " AND id = " . $ilDB->quote($a_team_id, "integer") . " AND user_id = " . $ilDB->quote($a_user_id, "integer");
     $ilDB->manipulate($sql);
     $this->sendNotification($a_exc_ref_id, $a_user_id, "rmv");
     self::writeTeamLog($a_team_id, self::TEAM_LOG_REMOVE_MEMBER, ilObjUser::_lookupFullname($a_user_id));
 }
 /**
  * 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.º 16
0
 static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
 {
     global $ilUser, $ilObjDataCache, $ilAccess;
     include_once "./Services/Notification/classes/class.ilNotification.php";
     include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
     $wiki = new ilObjWiki($a_wiki_ref_id, true);
     $page = new ilWikiPage($a_page_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
         $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
         $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         $users = array_merge($users, $wiki_users);
         if (!sizeof($users)) {
             return;
         }
         include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
         $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
         ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
     } else {
         $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         if (!sizeof($users)) {
             return;
         }
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getLink($a_wiki_ref_id);
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     foreach (array_unique($users) as $idx => $user_id) {
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('wiki');
             $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle());
             $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
             if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
                 // update/delete
                 $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
                 // include comment/note text
                 if ($a_comment) {
                     $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
                 }
                 $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
             } else {
                 // new
                 $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
                 $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
             }
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
 /**
  * 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();
 }
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]);
     if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
         $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id);
         $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", "");
     }
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "assid[" . $d["id"] . "]", 1));
     $this->tpl->setVariable("VAL_ID", $d["id"]);
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilExAssignment::getLastSubmission($d["id"], $this->part_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     if (ilExAssignment::lookupUpdatedSubmission($d["id"], $this->part_id) == 1) {
         $last_sub = "<b>" . $last_sub . "</b>";
     }
     $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
     $this->tpl->setVariable("TXT_LAST_SUBMISSION", $lng->txt("exc_last_submission"));
     // nr of submitted files
     $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
     $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $d["id"], $this->part_id));
     $new = ilExAssignment::lookupNewFiles($d["id"], $this->part_id);
     if (count($new) > 0) {
         $sub_cnt .= " " . sprintf($lng->txt("cnt_new"), count($new));
     }
     $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
     // download command
     $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
     $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
     if ($sub_cnt > 0) {
         $this->tpl->setCurrentBlock("download_link");
         $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
         if (count($new) <= 0) {
             $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files"));
         } else {
             $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_all"));
         }
         $this->tpl->parseCurrentBlock();
         // download new files only
         if (count($new) > 0) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $lng->txt("exc_download_new"));
             $this->tpl->parseCurrentBlock();
         }
     }
     // note
     $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
     $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
     $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.png";
             break;
         case "failed":
             $pic = "scorm/failed.png";
             break;
         default:
             $pic = "scorm/not_attempted.png";
             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 . ")");
     }
     $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
 }
 /**
  * Confirmation screen to cancel consultation appointment or ressource booking
  * depends on calendar category
  */
 public function cancelBooking()
 {
     global $ilUser, $tpl;
     $entry = (int) $_GET['app_id'];
     include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
     $entry = new ilCalendarEntry($entry);
     $category = $this->calendarEntryToCategory($entry);
     if ($category->getType() == ilCalendarCategory::TYPE_CH) {
         include_once 'Services/Booking/classes/class.ilBookingEntry.php';
         $booking = new ilBookingEntry($entry->getContextId());
         if (!$booking->hasBooked($entry->getEntryId())) {
             $this->ctrl->returnToParent($this);
             return false;
         }
         $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
     } else {
         if ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
             $entry_title = ' ' . $entry->getTitle();
         } else {
             $this->ctrl->returnToParent($this);
             return false;
         }
     }
     $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
     $timezone = $ilUser->getTimeZone();
     switch ($user_settings->getTimeFormat()) {
         case ilCalendarSettings::TIME_FORMAT_24:
             $title = $entry->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $timezone);
             $title .= "-" . $entry->getEnd()->get(IL_CAL_FKT_DATE, 'H:i', $timezone);
             break;
         case ilCalendarSettings::TIME_FORMAT_12:
             $title = $entry->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $timezone);
             $title .= "-" . $entry->getEnd()->get(IL_CAL_FKT_DATE, 'h:ia', $timezone);
             break;
     }
     include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
     $conf = new ilConfirmationGUI();
     $conf->setFormAction($this->ctrl->getFormAction($this));
     $conf->setHeaderText($this->lng->txt('cal_cancel_booking_info'));
     $conf->setConfirm($this->lng->txt('cal_cancel_booking'), 'cancelconfirmed');
     $conf->setCancel($this->lng->txt('cancel'), 'cancel');
     $conf->addItem('app_id', $entry->getEntryId(), $title . ' - ' . $entry_title);
     $tpl->setContent($conf->getHTML());
 }
Ejemplo n.º 20
0
 protected function sentReminder(array $a_recipient_ids)
 {
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     include_once "./Services/Link/classes/class.ilLink.php";
     $link = ilLink::_getStaticLink($this->getRefId(), "svy");
     foreach ($a_recipient_ids as $user_id) {
         // use language of recipient to compose message
         $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
         $ulng->loadLanguageModule('survey');
         $subject = sprintf($ulng->txt('survey_reminder_subject'), $this->getTitle());
         $message = sprintf($ulng->txt('survey_reminder_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
         $message .= $ulng->txt('survey_reminder_body') . ":\n\n";
         $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
         $message .= "\n" . $ulng->txt('survey_reminder_link') . ": " . $link;
         $mail_obj = new ilMail(ANONYMOUS_USER_ID);
         $mail_obj->appendInstallationSignature(true);
         $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
     }
 }
Ejemplo n.º 21
0
 /**
  * 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();
 }
Ejemplo n.º 22
0
 static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
 {
     global $ilUser, $ilObjDataCache, $ilAccess;
     include_once "./Services/Notification/classes/class.ilNotification.php";
     include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
     $wiki = new ilObjWiki($a_wiki_ref_id, true);
     $page = new ilWikiPage($a_page_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     // 1st update will be converted to new - see below
     if ($a_action == "new") {
         return;
     }
     if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
         $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
         $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         $users = array_merge($users, $wiki_users);
         if (!sizeof($users)) {
             return;
         }
         ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
     } else {
         $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         if (!sizeof($users)) {
             return;
         }
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
     // #15192 - should always be present
     if ($a_page_id) {
         include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
         $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
     } else {
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getLink($a_wiki_ref_id);
     }
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     // see ilBlogPostingGUI::getSnippet()
     // see ilBlogPosting::getNotificationAbstract()
     include_once "Modules/Wiki/classes/class.ilWikiPageGUI.php";
     $pgui = new ilWikiPageGUI($page->getId());
     $pgui->setRawPageContent(true);
     $pgui->setAbstractOnly(true);
     $pgui->setFileDownloadLink(".");
     $pgui->setFullscreenLink(".");
     $pgui->setSourcecodeDownloadScript(".");
     $snippet = $pgui->showPage();
     $snippet = ilPageObject::truncateHTML($snippet, 500, "...");
     // making things more readable
     $snippet = str_replace('<br/>', "\n", $snippet);
     $snippet = str_replace('<br />', "\n", $snippet);
     $snippet = str_replace('</p>', "\n", $snippet);
     $snippet = str_replace('</div>', "\n", $snippet);
     $snippet = trim(strip_tags($snippet));
     // "fake" new (to enable snippet - if any)
     $current_version = array_shift($page->getHistoryEntries());
     $current_version = $current_version["nr"];
     if (!$current_version) {
         $a_type = ilNotification::TYPE_WIKI;
         $a_action = "new";
     }
     foreach (array_unique($users) as $idx => $user_id) {
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('wiki');
             $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle(), $page->getTitle());
             $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
             if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
                 // update/delete
                 $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
                 if ($snippet) {
                     $message .= "\n" . $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n";
                 }
                 // include comment/note text
                 if ($a_comment) {
                     $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
                 }
                 $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
             } else {
                 // new
                 $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
                 if ($snippet) {
                     $message .= $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n\n";
                 }
                 $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
             }
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
Ejemplo n.º 23
0
 /**
  * Build export meta data
  *
  * @return array 
  */
 protected function getExportMeta()
 {
     global $lng, $ilObjDataCache, $ilUser, $ilClientIniFile;
     /* see spec
     			Name of installation
     			Name of the course
     			Permalink to course
     			Owner of course object
     			Date of report generation
     			Reporting period
     			Name of person who generated the report.
     		*/
     ilDatePresentation::setUseRelativeDates(false);
     include_once './Services/Link/classes/class.ilLink.php';
     $data = array();
     $data[$lng->txt("trac_name_of_installation")] = $ilClientIniFile->readVariable('client', 'name');
     if ($this->obj_id) {
         $data[$lng->txt("trac_object_name")] = $ilObjDataCache->lookupTitle($this->obj_id);
         if ($this->ref_id) {
             $data[$lng->txt("trac_object_link")] = ilLink::_getLink($this->ref_id, ilObject::_lookupType($this->obj_id));
         }
         $data[$lng->txt("trac_object_owner")] = ilObjUser::_lookupFullname(ilObject::_lookupOwner($this->obj_id));
     }
     $data[$lng->txt("trac_report_date")] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX), IL_CAL_DATETIME);
     $data[$lng->txt("trac_report_owner")] = $ilUser->getFullName();
     return $data;
 }
 /**
  * Send info message about unassigned users
  * @param array $unassigned
  */
 protected function sendInfoAboutUnassignedUsers($unassigned)
 {
     if (!$unassigned) {
         return true;
     }
     $users = array();
     foreach ($unassigned as $user_id) {
         include_once './Services/User/classes/class.ilObjUser.php';
         $users[] = ilObjUser::_lookupFullname($user_id);
     }
     ilUtil::sendInfo($this->lng->txt('cal_ch_user_assignment_failed_info') . '<br />' . implode('<br />', $users), true);
     return true;
 }
Ejemplo n.º 25
0
 /**
  * Lookup bookings for own and managed consultation hours of an object
  * @param type $a_obj_id
  * @param type $a_usr_id
  * @return array
  */
 public static function lookupManagedBookingsForObject($a_obj_id, $a_usr_id)
 {
     $bookings = self::lookupBookingsForObject($a_obj_id, $a_usr_id);
     include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
     foreach (ilConsultationHourUtils::lookupManagedUsers($a_usr_id) as $managed_user_id) {
         foreach (self::lookupBookingsForObject($a_obj_id, $managed_user_id) as $booked_user => $booking) {
             $fullname = ilObjUser::_lookupFullname($managed_user_id);
             foreach ($booking as $booking_entry) {
                 $booking_entry['explanation'] = '(' . $fullname . ')';
                 $bookings[$booked_user][] = $booking_entry;
             }
         }
     }
     return $bookings;
 }