/**
  * Send notifications
  * @return 
  */
 public function send()
 {
     global $ilUser;
     switch ($this->getType()) {
         case self::TYPE_USER_BLOCKED:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('cont_user_blocked'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('cont_user_blocked2'));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'");
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true));
                 $this->appendBody("\n");
                 include_once "./Services/User/classes/class.ilUserUtil.php";
                 $this->appendBody($this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, ""));
                 $this->appendBody("\n");
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 $this->appendBody($this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId()));
                 $this->appendBody("\n");
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
                 $this->appendBody("\n");
                 $this->appendBody($this->createPermanentLink(array(), ""));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
     return true;
 }
 /**
  * Fill table row
  */
 protected function fillRow($file)
 {
     global $lng;
     $this->tpl->setVariable("FILE_ID", $file["returned_id"]);
     $this->tpl->setVariable("DELIVERED_FILE", $file["filetitle"]);
     $date = new ilDateTime($file['timestamp14'], IL_CAL_TIMESTAMP);
     $this->tpl->setVariable("DELIVERED_DATE", ilDatePresentation::formatDate($date));
     if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) {
         $this->tpl->setVariable("DELIVERED_OWNER", ilUserUtil::getNamePresentation($file["owner_id"]));
     }
 }
 protected function fillRow($a_set)
 {
     global $ilCtrl;
     if ($this->show_peer_review && isset($a_set["peer"])) {
         $acc_data = array();
         foreach ($a_set["peer"] as $peer_id => $peer_review) {
             $peer_name = ilUserUtil::getNamePresentation($peer_id);
             $acc_item = $peer_name;
             if ($peer_review[1]) {
                 $rating = new ilRatingGUI();
                 $rating->setObject($this->ass->getId(), "ass", $a_set["uid"], "peer");
                 $rating->setUserId($peer_id);
                 $acc_item .= " " . $rating->getHTML(false, false);
             }
             if ($peer_review[0]) {
                 $acc_item .= '<div class="small">' . nl2br($peer_review[0]) . "</div>";
             }
             $uploads = $this->ass->getPeerUploadFiles($a_set["uid"], $peer_id);
             if ($uploads) {
                 $acc_item .= '<div class="small">';
                 $ilCtrl->setParameter($this->parent_obj, "fu", $peer_id . "__" . $a_set["uid"]);
                 foreach ($uploads as $file) {
                     $ilCtrl->setParameter($this->parent_obj, "fuf", md5($file));
                     $dl = $ilCtrl->getLinkTarget($this->parent_obj, "downloadPeerReview");
                     $ilCtrl->setParameter($this->parent_obj, "fuf", "");
                     $acc_item .= '<a href="' . $dl . '">' . basename($file) . '</a><br />';
                 }
                 $ilCtrl->setParameter($this->parent_obj, "fu", "");
                 $acc_item .= '</div>';
             }
             $acc_data[$peer_id] = array("name" => $peer_name, "review" => $acc_item);
         }
         if ($acc_data) {
             $acc_data = ilUtil::sortArray($acc_data, "name", "asc");
             $acc = new ilAccordionGUI();
             $acc->setId($this->ass->getId() . "_" . $a_set["uid"]);
             $acc_html = "<ul>";
             foreach ($acc_data as $acc_item) {
                 $acc_html .= "<li>" . $acc_item["review"] . "</li>";
             }
             $acc_html .= "</ul>";
             $acc->addItem($this->lng->txt("show") . " (" . sizeof($acc_data) . ")", $acc_html);
             $this->tpl->setCurrentBlock("peer_bl");
             $this->tpl->setVariable("PEER_REVIEW", $acc->getHTML());
             $this->tpl->parseCurrentBlock();
         }
     }
     $this->tpl->setVariable("USER_NAME", $a_set["uname"]);
     $this->tpl->setVariable("USER_DATE", ilDatePresentation::formatDate(new ilDate($a_set["udate"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("USER_TEXT", $a_set["utext"]);
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $title = ilWikiPage::lookupTitle($a_set["id"]);
     $this->tpl->setVariable("TXT_PAGE_TITLE", $title);
     $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["date"], IL_CAL_DATETIME)));
     $ilCtrl->setParameterByClass("ilwikipagegui", "page", rawurlencode($title));
     $ilCtrl->setParameterByClass("ilwikipagegui", "old_nr", $a_set["nr"]);
     $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("ilwikipagegui", "preview"));
     // user name
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $this->tpl->setVariable("TXT_USER", ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
 }
 function confirmRemove()
 {
     global $ilAccess, $ilCtrl, $lng, $tpl;
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setFormAction($ilCtrl->getFormAction($this, 'remove'));
     $confirm->addHiddenItem("grp_id", $_GET["grp_id"]);
     $confirm->setHeaderText($lng->txt('grp_dismiss_member'));
     $confirm->setConfirm($lng->txt('confirm'), 'remove');
     $confirm->setCancel($lng->txt('cancel'), 'show');
     include_once './Services/User/classes/class.ilUserUtil.php';
     $confirm->addItem('usr_id', $_GET["usr_id"], ilUserUtil::getNamePresentation($_GET["usr_id"], false, false, "", true), ilUtil::getImagePath('icon_usr.svg'));
     $tpl->setContent($confirm->getHTML());
 }
 protected function translateUserIds($a_user_ids, $a_implode = false)
 {
     if (!is_array($a_user_ids) && is_numeric($a_user_ids)) {
         $a_user_ids = array($a_user_ids);
     }
     $res = array();
     include_once "Services/User/classes/class.ilUserUtil.php";
     foreach (array_unique($a_user_ids) as $user_id) {
         $res[] = ilUserUtil::getNamePresentation($user_id);
     }
     if ($a_implode) {
         $res = implode("<br />", $res);
     }
     return $res;
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     // rollback command
     if ($a_set["nr"] > 0) {
         $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
         $this->tpl->setCurrentBlock("command");
         $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
         $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation"));
         $this->tpl->parseCurrentBlock();
         $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
     }
     if (!$this->rselect) {
         $this->tpl->setVariable("RSELECT", 'checked="checked"');
         $this->rselect = true;
     } else {
         if (!$this->lselect) {
             $this->tpl->setVariable("LSELECT", 'checked="checked"');
             $this->lselect = true;
         }
     }
     $this->tpl->setVariable("NR", $a_set["nr"]);
     $this->tpl->setVariable("TXT_HDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["hdate"], IL_CAL_DATETIME)));
     $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
     $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1");
     $this->tpl->setVariable("HREF_OLD_PAGE", $ilCtrl->getLinkTarget($this->getParentObject(), "preview"));
     $ilCtrl->setParameter($this->getParentObject(), "history_mode", "");
     if (ilObject::_exists($a_set["user"])) {
         // user name
         $user = ilObjUser::_lookupName($a_set["user"]);
         $login = ilObjUser::_lookupLogin($a_set["user"]);
         //$this->tpl->setVariable("TXT_LINKED_USER",
         //	$user["lastname"].", ".$user["firstname"]." [".$login."]");
         // profile link
         include_once "./Services/User/classes/class.ilUserUtil.php";
         $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()));
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
         //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
         //	rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
         //$this->tpl->setVariable("USER_LINK",
         //	$ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
         //$img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall");
         //$this->tpl->setVariable("IMG_USER", $img);
         $this->tpl->setVariable("TXT_USER", $name_pres);
     }
     $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
 }
 /**
  * Get all completed tests
  */
 protected function getItems()
 {
     if ($this->mode == self::MODE_ADD) {
         $assigned = $this->assignment->getMembersOfAllTeams();
     } else {
         $assigned = array();
         $this->member_ids = $this->assignment->getTeamMembers($this->team_id);
     }
     include_once "Services/User/classes/class.ilUserUtil.php";
     $data = array();
     foreach ($this->member_ids as $id) {
         if (!in_array($id, $assigned)) {
             $data[] = array("id" => $id, "name" => ilUserUtil::getNamePresentation($id, false, false, "", true));
         }
     }
     $this->setData($data);
 }
 /**
  * Fill a single data row.
  */
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable("TXT_USER", ilUserUtil::getNamePresentation($a_set["user_id"], false, false));
     $this->tpl->setVariable('TXT_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set["date"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_ACTION", $this->createInfoText($a_set));
     if ($this->getObjType() == "lm" || $this->getObjType() == "dbk") {
         $obj_arr = explode(":", $a_set["obj_type"]);
         switch ($obj_arr[1]) {
             case "st":
                 $img_type = "st";
                 $class = "ilstructureobjectgui";
                 $cmd = "view";
                 break;
             case "pg":
                 $img_type = "pg";
                 $class = "illmpageobjectgui";
                 $cmd = "edit";
                 break;
             default:
                 $img_type = $obj_arr[0];
                 $class = "";
                 $cmd = "view";
                 break;
         }
         $this->tpl->setCurrentBlock("item_icon");
         $this->tpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_" . $img_type . ".svg"));
         $this->tpl->parseCurrentBlock();
         if ($class != "") {
             $this->tpl->setCurrentBlock("item_link");
             $this->ilCtrl->setParameterByClass($class, "obj_id", $a_set["obj_id"]);
             $this->tpl->setVariable("HREF_LINK", $this->ilCtrl->getLinkTargetByClass($class, $cmd));
             $this->tpl->setVariable("TXT_LINK", $a_set["title"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("item_title");
             $this->tpl->setVariable("TXT_TITLE", ilObject::_lookupTitle($a_set["obj_id"]));
             $this->tpl->parseCurrentBlock();
         }
     }
     if ($this->isCommentVisible() && $a_set["user_comment"] != "") {
         $this->tpl->setCurrentBlock("user_comment");
         $this->tpl->setVariable("TXT_COMMENT", $this->lng->txt("comment"));
         $this->tpl->setVariable("TXT_USER_COMMENT", $a_set["user_comment"]);
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * Constructor
  *
  * @access public
  * @param
  * @return
  */
 public function __construct($a_parent_obj, $a_parent_cmd, $a_raters_mode = false, $a_may_delete_rater = false, $a_fallback_url = null)
 {
     parent::__construct($a_parent_obj, $a_parent_cmd);
     global $lng, $ilCtrl;
     $this->raters_mode = (bool) $a_raters_mode;
     $this->fallback_url = trim($a_fallback_url);
     $this->lng = $lng;
     $this->ctrl = $ilCtrl;
     $this->setFormName('apprform');
     $this->addColumn('', '', '1%');
     $this->addColumn($this->lng->txt("lastname"), 'lastname', '');
     $this->addColumn($this->lng->txt("firstname"), 'firstname', '');
     $this->addColumn($this->lng->txt("email"), 'email', '');
     $this->addColumn($this->lng->txt("login"), 'login', '');
     if (!$this->raters_mode) {
         $this->addColumn($this->lng->txt("survey_360_raters_finished"), "finished");
         $this->addColumn($this->lng->txt("survey_360_appraisee_close_table"), "closed");
         $this->addColumn($this->lng->txt("actions"));
         $this->setTitle($this->lng->txt("survey_360_appraisees"));
     } else {
         $this->addColumn($this->lng->txt("survey_360_rater_finished"), "finished");
         $this->addColumn($this->lng->txt("survey_code_url"));
         $this->addColumn($this->lng->txt("survey_360_rater_mail_sent"), "sent");
         include_once "Services/User/classes/class.ilUserUtil.php";
         $this->setTitle($this->lng->txt("survey_360_edit_raters") . " : " . ilUserUtil::getNamePresentation($_REQUEST["appr_id"]));
     }
     $this->setRowTemplate("tpl.il_svy_svy_appraisees_row.html", "Modules/Survey");
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
     $this->setDefaultOrderField("last_name");
     $this->setDefaultOrderDirection("asc");
     if (!$this->raters_mode) {
         $this->addCommandButton('deleteAllUserData', $this->lng->txt('svy_delete_all_user_data'));
         $this->addMultiCommand('confirmAdminAppraiseesClose', $this->lng->txt('survey_360_appraisee_close_action'));
         $this->addMultiCommand('confirmDeleteAppraisees', $this->lng->txt('survey_360_remove_appraisees'));
         $this->setPrefix('appr_id');
         $this->setSelectAllCheckbox('appr_id');
     } else {
         $this->addMultiCommand('mailRaters', $this->lng->txt('mail'));
         if ($a_may_delete_rater) {
             $this->addMultiCommand('confirmDeleteRaters', $this->lng->txt('remove'));
         }
         $this->setPrefix('rtr_id');
         $this->setSelectAllCheckbox('rtr_id');
     }
 }
 /**
  * Get all completed tests
  */
 protected function getItems()
 {
     global $rbacreview;
     if ($this->contributor_ids) {
         $assigned = $rbacreview->assignedUsers($this->contributor_role_id);
     } else {
         $assigned = array();
         $this->contributor_ids = $rbacreview->assignedUsers($this->contributor_role_id);
     }
     include_once "Services/User/classes/class.ilUserUtil.php";
     $data = array();
     foreach ($this->contributor_ids as $id) {
         if (!in_array($id, $assigned)) {
             $data[] = array("id" => $id, "name" => ilUserUtil::getNamePresentation($id, false, false, "", true));
         }
     }
     $this->setData($data);
 }
 /**
  * Import data from DB
  */
 protected function importData()
 {
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $data = array();
     foreach ($this->handler->getPermissions($this->node_id) as $obj_id) {
         // title is needed for proper sorting
         // special modes should always be on top!
         $title = null;
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $caption = $this->lng->txt("wsp_set_permission_registered");
                 $title = "0" . $caption;
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $caption = $this->lng->txt("wsp_set_permission_all_password");
                 $title = "0" . $caption;
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $caption = $this->lng->txt("wsp_set_permission_all");
                 $title = "0" . $caption;
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $type_txt = $this->lng->txt("obj_" . $type);
                 if ($type === null) {
                     // invalid object/user
                 } else {
                     if ($type != "usr") {
                         $title = $caption = ilObject::_lookupTitle($obj_id);
                     } else {
                         $caption = ilUserUtil::getNamePresentation($obj_id, false, true);
                         $title = strip_tags($caption);
                     }
                 }
                 break;
         }
         if ($title) {
             $data[] = array("id" => $obj_id, "title" => $title, "caption" => $caption, "type" => $type_txt);
         }
     }
     $this->setData($data);
 }
 /**
  * Import data from DB
  */
 protected function importData()
 {
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $data = array();
     foreach ($this->handler->getPermissions($this->node_id) as $obj_id) {
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
                 $type = "registered";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
                 $type = "all_password";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
                 $type = "all_password";
                 $icon = "";
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $icon = ilUtil::getTypeIconPath($type, null, "tiny");
                 $icon_alt = $this->lng->txt("obj_" . $type);
                 if ($type != "usr") {
                     $title = ilObject::_lookupTitle($obj_id);
                 } else {
                     $title = ilUserUtil::getNamePresentation($obj_id, true, true);
                 }
                 break;
         }
         $data[] = array("id" => $obj_id, "title" => $title, "type" => $type, "icon" => $icon, "icon_alt" => $icon_alt);
     }
     $this->setData($data);
 }
 function sendNotificationMail($user_id, $anonymize_id, $appr_id)
 {
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $recipients = preg_split('/,/', $this->mailaddresses);
     foreach ($recipients as $recipient) {
         // #11298
         include_once "./Services/Notification/classes/class.ilSystemNotification.php";
         $ntf = new ilSystemNotification();
         $ntf->setLangModules(array("survey"));
         $ntf->setRefId($this->getRefId());
         $ntf->setSubjectLangId('finished_mail_subject');
         $messagetext = $this->mailparticipantdata;
         if (trim($messagetext)) {
             $data = ilObjUser::_getUserData(array($user_id));
             foreach ($data[0] as $key => $value) {
                 if ($this->getAnonymize()) {
                     $messagetext = str_replace('[' . $key . ']', '', $messagetext);
                 } else {
                     $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
                 }
             }
             $ntf->setIntroductionDirect($messagetext);
         } else {
             $ntf->setIntroductionLangId('survey_notification_finished_introduction');
         }
         // 360°? add appraisee data
         if ($appr_id) {
             $ntf->addAdditionalInfo('survey_360_appraisee', ilUserUtil::getNamePresentation($appr_id));
         }
         $active_id = $this->getActiveID($user_id, $anonymize_id, $appr_id);
         $ntf->addAdditionalInfo('results', $this->getParticipantTextResults($active_id), true);
         $ntf->setGotoLangId('survey_notification_tutor_link');
         $ntf->setReasonLangId('survey_notification_finished_reason');
         $ntf->sendMail(array($recipient), null, null);
     }
 }
 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);
     }
 }
Example #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";
     // 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]);
         }
     }
 }
 protected function getHeaderURL()
 {
     include_once './Services/User/classes/class.ilUserUtil.php';
     $url = ilUserUtil::getStartingPointAsUrl();
     if (!$url) {
         $url = "./goto.php?target=root_1";
     }
     return $url;
 }
Example #18
0
 /**
  * Finalizing output processing
  *
  * @param string $a_output
  * @return string
  */
 function postOutputProcessing($a_output)
 {
     // #8626/#9370
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "offline") && !$this->getAbstractOnly() && $this->add_date) {
         if (!$this->isInWorkspace()) {
             $author = "";
             $author_id = $this->getBlogPosting()->getAuthor();
             if ($author_id) {
                 include_once "Services/User/classes/class.ilUserUtil.php";
                 $author = ilUserUtil::getNamePresentation($author_id) . " - ";
             }
         }
         // prepend creation date
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $prefix = "<div class=\"il_BlockInfo\" style=\"text-align:right\">" . $author . ilDatePresentation::formatDate($this->getBlogPosting()->getCreated()) . "</div>";
         ilDatePresentation::setUseRelativeDates($rel);
         $a_output = $prefix . $a_output;
     }
     return $a_output;
 }
Example #19
0
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilAccess, $ilTabs, $ilUser, $ilToolbar;
     if (!$this->external_rater_360 && !$ilAccess->checkAccess("visible", "", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
     }
     $ilTabs->activateTab("info_short");
     include_once "./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
     $output_gui =& new ilSurveyExecutionGUI($this->object);
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     // "active" survey?
     $canStart = $this->object->canStartSurvey(null, $this->external_rater_360);
     $showButtons = $canStart["result"];
     if (!$showButtons) {
         if ($canStart["edit_settings"] && $ilAccess->checkAccess("write", "", $this->ref_id)) {
             $canStart["messages"][] = "<a href=\"" . $this->ctrl->getLinkTarget($this, "properties") . "\">&raquo; " . $this->lng->txt("survey_edit_settings") . "</a>";
         }
         ilUtil::sendInfo(implode("<br />", $canStart["messages"]));
     }
     $big_button = false;
     if ($showButtons) {
         // closing survey?
         $is_appraisee = false;
         if ($this->object->get360Mode() && $this->object->isAppraisee($ilUser->getId())) {
             $info->addSection($this->lng->txt("survey_360_appraisee_info"));
             $appr_data = $this->object->getAppraiseesData();
             $appr_data = $appr_data[$ilUser->getId()];
             $info->addProperty($this->lng->txt("survey_360_raters_status_info"), $appr_data["finished"]);
             if (!$appr_data["closed"]) {
                 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                 $button = ilLinkButton::getInstance();
                 $button->setCaption("survey_360_appraisee_close_action");
                 $button->setUrl($this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "confirmappraiseeclose"));
                 $close_button_360 = '<div>' . $button->render() . '</div>';
                 $txt = "survey_360_appraisee_close_action_info";
                 if ($this->object->get360SkillService()) {
                     $txt .= "_skill";
                 }
                 $info->addProperty($this->lng->txt("status"), $close_button_360 . $this->lng->txt($txt));
             } else {
                 ilDatePresentation::setUseRelativeDates(false);
                 $dt = new ilDateTime($appr_data["closed"], IL_CAL_UNIX);
                 $info->addProperty($this->lng->txt("status"), sprintf($this->lng->txt("survey_360_appraisee_close_action_status"), ilDatePresentation::formatDate($dt)));
             }
             $is_appraisee = true;
         }
         // handle code
         // validate incoming
         $code_input = false;
         $anonymous_code = $_POST["anonymous_id"];
         if ($anonymous_code) {
             $code_input = true;
             // if(!$this->object->isUnusedCode($anonymous_code, $ilUser->getId()))
             if (!$this->object->checkSurveyCode($anonymous_code)) {
                 $anonymous_code = null;
             } else {
                 // #15860
                 $this->object->bindSurveyCodeToUser($ilUser->getId(), $anonymous_code);
             }
         }
         if ($anonymous_code) {
             $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         } else {
             $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
             if ($anonymous_code) {
                 $code_input = true;
             }
         }
         // try to find code for current (registered) user from existing run
         if ($this->object->getAnonymize() && !$anonymous_code) {
             $anonymous_code = $this->object->findCodeForUser($ilUser->getId());
         }
         // get existing runs for current user, might generate code
         $participant_status = $this->object->getUserSurveyExecutionStatus($anonymous_code);
         if ($participant_status) {
             $anonymous_code = $participant_status["code"];
             $participant_status = $participant_status["runs"];
         }
         // (final) check for proper anonymous code
         if (!$this->object->isAccessibleWithoutCode() && !$is_appraisee && $code_input && (!$anonymous_code || !$this->object->isAnonymousKey($anonymous_code))) {
             $anonymous_code = null;
             ilUtil::sendInfo($this->lng->txt("wrong_survey_code_used"));
         }
         // :TODO: really save in session?
         $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         // code is mandatory and not given yet
         if (!$is_appraisee && !$anonymous_code && !$this->object->isAccessibleWithoutCode()) {
             $info->setFormAction($this->ctrl->getFormAction($this, "infoScreen"));
             $info->addSection($this->lng->txt("anonymization"));
             $info->addProperty("", $this->lng->txt("anonymize_anonymous_introduction"));
             $info->addPropertyTextinput($this->lng->txt("enter_anonymous_id"), "anonymous_id", "", 8, "infoScreen", $this->lng->txt("submit"), true);
         } else {
             // trunk/default
             if (!$this->object->get360Mode()) {
                 if ($anonymous_code) {
                     $info->addHiddenElement("anonymous_id", $anonymous_code);
                 }
                 $survey_started = $this->object->isSurveyStarted($ilUser->getId(), $anonymous_code);
                 if ($survey_started === 1) {
                     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                         if ($this->object->hasViewOwnResults()) {
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("svy_view_own_results");
                             $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
                             $ilToolbar->addButtonInstance($button);
                         }
                         if ($this->object->hasMailOwnResults()) {
                             if ($this->object->hasViewOwnResults()) {
                                 $ilToolbar->addSeparator();
                             }
                             require_once "Services/Form/classes/class.ilTextInputGUI.php";
                             $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
                             $mail->setSize(25);
                             $mail->setValue($ilUser->getEmail());
                             $ilToolbar->addInputItem($mail, true);
                             $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
                             include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
                             $button = ilSubmitButton::getInstance();
                             $button->setCaption("svy_mail_own_results");
                             $button->setCommand("mailUserResults");
                             $ilToolbar->addButtonInstance($button);
                         }
                     }
                     ilUtil::sendInfo($this->lng->txt("already_completed_survey"));
                 } elseif ($survey_started === 0) {
                     $big_button = array("resume", $this->lng->txt("resume_survey"));
                 } elseif ($survey_started === FALSE) {
                     $big_button = array("start", $this->lng->txt("start_survey"));
                 }
             } else {
                 $appr_ids = array();
                 // use given code (if proper external one)
                 if ($anonymous_code) {
                     $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
                     if ($anonymous_id) {
                         $appr_ids = $this->object->getAppraiseesToRate(0, $anonymous_id);
                     }
                 }
                 // registered user
                 // if an auto-code was generated, we still have to check for the original user id
                 if (!$appr_ids && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $appr_ids = $this->object->getAppraiseesToRate($ilUser->getId());
                 }
                 if (sizeof($appr_ids)) {
                     // map existing runs to appraisees
                     $active_appraisees = array();
                     if ($participant_status) {
                         foreach ($participant_status as $item) {
                             $active_appraisees[$item["appr_id"]] = $item["finished"];
                         }
                     }
                     $list = array();
                     foreach ($appr_ids as $appr_id) {
                         if ($this->object->isAppraiseeClosed($appr_id)) {
                             // closed
                             $list[$appr_id] = $this->lng->txt("survey_360_appraisee_is_closed");
                         } else {
                             if (array_key_exists($appr_id, $active_appraisees)) {
                                 // already done
                                 if ($active_appraisees[$appr_id]) {
                                     $list[$appr_id] = $this->lng->txt("already_completed_survey");
                                 } else {
                                     $list[$appr_id] = array("resume", $this->lng->txt("resume_survey"));
                                 }
                             } else {
                                 // start
                                 $list[$appr_id] = array("start", $this->lng->txt("start_survey"));
                             }
                         }
                     }
                     $info->addSection($this->lng->txt("survey_360_rate_other_appraisees"));
                     include_once "Services/User/classes/class.ilUserUtil.php";
                     foreach ($list as $appr_id => $item) {
                         $appr_name = ilUserUtil::getNamePresentation($appr_id, false, false, "", true);
                         if (!is_array($item)) {
                             $info->addProperty($appr_name, $item);
                         } else {
                             $this->ctrl->setParameter($output_gui, "appr_id", $appr_id);
                             $href = $this->ctrl->getLinkTarget($output_gui, $item[0]);
                             $this->ctrl->setParameter($output_gui, "appr_id", "");
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption($item[1], false);
                             $button->setUrl($href);
                             $big_button_360 = '<div>' . $button->render() . '</div>';
                             $info->addProperty($appr_name, $big_button_360);
                         }
                     }
                 } else {
                     if (!$is_appraisee) {
                         ilUtil::sendFailure($this->lng->txt("survey_360_no_appraisees"));
                     }
                 }
             }
         }
         if ($this->object->get360Mode() && $this->object->get360SelfAppraisee() && !$this->object->isAppraisee($ilUser->getId()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
             $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "addSelfAppraisee");
             $link = '<a href="' . $link . '">' . $this->lng->txt("survey_360_add_self_appraisee") . '</a>';
             $info->addProperty("&nbsp;", $link);
         }
     }
     if ($big_button) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption($big_button[1], false);
         $button->setCommand($big_button[0]);
         $button->setPrimary(true);
         $ilToolbar->addButtonInstance($button);
         $ilToolbar->setCloseFormTag(false);
         $info->setOpenFormTag(false);
     }
     /* #12016
     		else
     		{
     			$info->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
     		}
     		*/
     if (strlen($this->object->getIntroduction())) {
         $introduction = $this->object->getIntroduction();
         $info->addSection($this->lng->txt("introduction"));
         $info->addProperty("", $this->object->prepareTextareaOutput($introduction) . "<br />" . $info->getHiddenToggleButton());
     } else {
         $info->addSection("");
         $info->addProperty("", $info->getHiddenToggleButton());
     }
     $info->hideFurtherSections(false);
     if (!$this->object->get360Mode()) {
         $info->addSection($this->lng->txt("svy_general_properties"));
         $info->addProperty($this->lng->txt("survey_results_anonymization"), !$this->object->hasAnonymizedResults() ? $this->lng->txt("survey_results_personalized_info") : $this->lng->txt("survey_results_anonymized_info"));
         include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
         if ($ilAccess->checkAccess("write", "", $this->ref_id) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
             $info->addProperty($this->lng->txt("evaluation_access"), $this->lng->txt("evaluation_access_info"));
         }
     }
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $this->ctrl->forwardCommand($info);
 }
 /**
  * Fill table row
  *
  * @param array $a_set data array
  */
 protected function fillRow($node)
 {
     global $ilCtrl, $lng;
     $this->tpl->setVariable("LASTNAME", $node["lastname"]);
     $this->tpl->setVariable("FIRSTNAME", $node["firstname"]);
     $this->tpl->setVariable("LOGIN", $node["login"]);
     $this->tpl->setVariable("TITLE", $node["title"]);
     if (!$this->portfolio_mode) {
         $this->tpl->setVariable("TYPE", $node["obj_type"]);
         $this->tpl->setVariable("ICON_ALT", $node["obj_type"]);
         $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $node["type"]));
         $url = $this->handler->getGotoLink($node["wsp_id"], $node["obj_id"]);
     } else {
         $url = ilLink::_getStaticLink($node["obj_id"], "prtf", true);
     }
     $this->tpl->setVariable("URL_TITLE", $url);
     $this->tpl->setVariable("ACL_DATE", ilDatePresentation::formatDate(new ilDateTime($node["acl_date"], IL_CAL_UNIX)));
     asort($node["acl_type"]);
     foreach ($node["acl_type"] as $obj_id) {
         // see ilWorkspaceAccessTableGUI
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
                 $type = "registered";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
                 $type = "all_password";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
                 $type = "all_password";
                 $icon = "";
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $icon = ilUtil::getTypeIconPath($type, null, "tiny");
                 $icon_alt = $this->lng->txt("obj_" . $type);
                 if ($type != "usr") {
                     $title = ilObject::_lookupTitle($obj_id);
                 } else {
                     $title = ilUserUtil::getNamePresentation($obj_id, true, true);
                 }
                 break;
         }
         if ($icon) {
             $this->tpl->setCurrentBlock("acl_type_icon_bl");
             $this->tpl->setVariable("ACL_ICON", $icon);
             $this->tpl->setVariable("ACL_ICON_ALT", $icon_alt);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("acl_type_bl");
         $this->tpl->setVariable("ACL_TYPE", $title);
         $this->tpl->parseCurrentBlock();
     }
     if (!$this->portfolio_mode) {
         // files may be copied to own workspace
         if ($node["type"] == "file") {
             $ilCtrl->setParameter($this->parent_obj, "wsp_id", $this->parent_node_id);
             $ilCtrl->setParameter($this->parent_obj, "item_ref_id", $node["wsp_id"]);
             $url = $ilCtrl->getLinkTarget($this->parent_obj, "copyshared");
             $this->tpl->setCurrentBlock("action_bl");
             $this->tpl->setVariable("URL_ACTION", $url);
             $this->tpl->setVariable("ACTION", $lng->txt("copy"));
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * View wiki page.
  */
 function preview()
 {
     global $ilCtrl, $ilAccess, $lng, $tpl, $ilUser, $ilSetting, $ilToolbar;
     // block/unblock
     if ($this->getPageObject()->getBlocked()) {
         ilUtil::sendInfo($lng->txt("wiki_page_status_blocked"));
     }
     $this->increaseViewCount();
     $this->addHeaderAction();
     // content
     $this->setSideBlock();
     $wtpl = new ilTemplate("tpl.wiki_page_view_main_column.html", true, true, "Modules/Wiki");
     $callback = array($this, "observeNoteAction");
     // notes
     if (!$ilSetting->get("disable_comments") && ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId())) {
         $wtpl->setVariable("NOTES", $this->getNotesHTML($this->getPageObject(), true, ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), $ilAccess->checkAccess("write", "", $_GET["ref_id"]), $callback));
     }
     // permanent link
     $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($_GET["page"]) : "";
     include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
     $perma_link = new ilPermanentLinkGUI("wiki", $_GET["ref_id"], $append);
     $wtpl->setVariable("PERMA_LINK", $perma_link->getHTML());
     // page content
     $this->setOutputMode(IL_PAGE_PRESENTATION);
     $this->setRenderPageContainer(true);
     $wtpl->setVariable("PAGE", $this->showPage());
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     // last edited info
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $wtpl->setVariable("LAST_EDITED_INFO", $lng->txt("wiki_last_edited") . ": " . ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getLastChange(), IL_CAL_DATETIME)) . ", " . ilUserUtil::getNamePresentation($this->getPageObject()->getLastChangeUser(), false, true, $ilCtrl->getLinkTarget($this, "preview")));
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     //highlighting
     if ($_GET["srcstring"] != "") {
         include_once './Services/Search/classes/class.ilUserSearchCache.php';
         $cache = ilUserSearchCache::_getInstance($ilUser->getId());
         $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
         $search_string = $cache->getQuery();
         include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php";
         include_once "./Services/Search/classes/class.ilQueryParser.php";
         $p = new ilQueryParser($search_string);
         $p->parse();
         $words = $p->getQuotedWords();
         if (is_array($words)) {
             foreach ($words as $w) {
                 ilTextHighlighterGUI::highlight("ilCOPageContent", $w, $tpl);
             }
         }
         $this->fill_on_load_code = true;
     }
     return $wtpl->get();
 }
Example #22
0
 public function createTeamObject()
 {
     global $ilCtrl, $ilUser, $ilTabs, $lng, $tpl;
     $this->checkPermission("read");
     if ($this->ass->getDeadline() == 0 || mktime() < $this->ass->getDeadline()) {
         $options = ilExAssignment::getAdoptableTeamAssignments($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId());
         if (sizeof($options)) {
             $ilTabs->activateTab("content");
             $this->addContentSubTabs("content");
             include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
             $form = new ilPropertyFormGUI();
             $form->setTitle($lng->txt("exc_team_assignment_adopt_user"));
             $form->setFormAction($ilCtrl->getFormAction($this, "createAdoptedTeam"));
             $teams = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
             $teams->setValue(-1);
             $teams->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none_user"), -1));
             $current_map = ilExAssignment::getAssignmentTeamMap($this->ass->getId());
             include_once "Services/User/classes/class.ilUserUtil.php";
             foreach ($options as $id => $item) {
                 $members = array();
                 $free = false;
                 foreach ($item["user_team"] as $user_id) {
                     $members[$user_id] = ilUserUtil::getNamePresentation($user_id);
                     if (array_key_exists($user_id, $current_map)) {
                         $members[$user_id] .= " (" . $lng->txt("exc_team_assignment_adopt_already_assigned") . ")";
                     } else {
                         $free = true;
                     }
                 }
                 asort($members);
                 $members = implode("<br />", $members);
                 $option = new ilRadioOption($item["title"], $id);
                 $option->setInfo($members);
                 if (!$free) {
                     $option->setDisabled(true);
                 }
                 $teams->addOption($option);
             }
             $form->addItem($teams);
             $form->addCommandButton("createAdoptedTeam", $lng->txt("save"));
             $form->addCommandButton("showOverview", $lng->txt("cancel"));
             $tpl->setContent($form->getHTML());
             return;
         }
         $this->ass->getTeamId($ilUser->getId(), true);
         ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
     }
     $ilCtrl->redirect($this, "showOverview");
 }
Example #23
0
 /**
  * update complete page content in db (dom xml content is used)
  * 
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $lng, $ilDB, $ilUser, $ilLog, $ilCtrl;
     $lm_set = new ilSetting("lm");
     //echo "<br>**".$this->getId()."**";
     //echo "<br>PageObject::update[".$this->getId()."],validate($a_validate)";
     //echo "\n<br>dump_all2:".$this->dom->dump_mem(0, "UTF-8").":";
     //echo "\n<br>PageObject::update:".$this->getXMLFromDom().":";
     //debug_print_backtrace();
     //echo "<br>PageObject::update:".htmlentities($this->getXMLFromDom()); exit;
     // add missing pc ids
     if (!$this->checkPCIds()) {
         $this->insertPCIds();
     }
     // test validating
     if ($a_validate) {
         $errors = $this->validateDom();
     }
     //var_dump($errors); exit;
     if (empty($errors) && !$this->getEditLock()) {
         include_once "./Services/User/classes/class.ilUserUtil.php";
         $lock = $this->getEditLockInfo();
         $errors = $lng->txt("cont_not_saved_edit_lock_expired");
         $errors .= "</br>" . $lng->txt("obj_usr") . ": " . ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
         $errors .= "</br>" . $lng->txt("content_until") . ": " . ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
     }
     //echo "-".htmlentities($this->getXMLFromDom())."-"; exit;
     if (empty($errors)) {
         // @todo 1: is this page type or pc content type
         // related -> plugins should be able to hook in!?
         $this->performAutomaticModifications();
         // get xml content
         $content = $this->getXMLFromDom();
         $dom_doc = $this->getDomDoc();
         // this needs to be locked
         // write history entry
         $old_set = $ilDB->query("SELECT * FROM page_object WHERE " . "page_id = " . $ilDB->quote($this->getId(), "integer") . " AND " . "parent_type = " . $ilDB->quote($this->getParentType(), "text") . " AND " . "lang = " . $ilDB->quote($this->getLanguage(), "text"));
         $last_nr_set = $ilDB->query("SELECT max(nr) as mnr FROM page_history WHERE " . "page_id = " . $ilDB->quote($this->getId(), "integer") . " AND " . "parent_type = " . $ilDB->quote($this->getParentType(), "text") . " AND " . "lang = " . $ilDB->quote($this->getLanguage(), "text"));
         $last_nr = $ilDB->fetchAssoc($last_nr_set);
         if ($old_rec = $ilDB->fetchAssoc($old_set)) {
             // only save, if something has changed
             // added user id to the check for ilias 5.0, 7.10.2014
             if (($content != $old_rec["content"] || $ilUser->getId() != $old_rec["last_change_user"]) && !$a_no_history && !$this->history_saved && $lm_set->get("page_history", 1)) {
                 if ($old_rec["content"] != "<PageObject></PageObject>") {
                     $ilDB->manipulateF("DELETE FROM page_history WHERE " . "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s", array("integer", "text", "timestamp", "text"), array($old_rec["page_id"], $old_rec["parent_type"], $old_rec["last_change"], $old_rec["lang"]));
                     // the following lines are a workaround for
                     // bug 6741
                     $last_c = $old_rec["last_change"];
                     if ($last_c == "") {
                         $last_c = ilUtil::now();
                     }
                     $ilDB->insert("page_history", array("page_id" => array("integer", $old_rec["page_id"]), "parent_type" => array("text", $old_rec["parent_type"]), "lang" => array("text", $old_rec["lang"]), "hdate" => array("timestamp", $last_c), "parent_id" => array("integer", $old_rec["parent_id"]), "content" => array("clob", $old_rec["content"]), "user_id" => array("integer", $old_rec["last_change_user"]), "ilias_version" => array("text", ILIAS_VERSION_NUMERIC), "nr" => array("integer", (int) $last_nr["mnr"] + 1)));
                     $old_content = $old_rec["content"];
                     $old_domdoc = new DOMDocument();
                     $old_nr = $last_nr["mnr"] + 1;
                     $old_domdoc->loadXML('<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
                     // after history entry creation event
                     $this->__afterHistoryEntry($old_domdoc, $old_content, $old_nr);
                     $this->history_saved = true;
                     // only save one time
                 } else {
                     $this->history_saved = true;
                     // do not save on first change
                 }
             }
         }
         //echo htmlentities($content);
         $em = trim($content) == "<PageObject/>" ? 1 : 0;
         // @todo: pass dom instead?
         $iel = $this->containsDeactivatedElements($content);
         $inl = $this->containsIntLinks($content);
         $ilDB->update("page_object", array("content" => array("clob", $content), "parent_id" => array("integer", $this->getParentId()), "last_change_user" => array("integer", $ilUser->getId()), "last_change" => array("timestamp", ilUtil::now()), "is_empty" => array("integer", $em), "active" => array("integer", $this->getActive()), "activation_start" => array("timestamp", $this->getActivationStart()), "activation_end" => array("timestamp", $this->getActivationEnd()), "show_activation_info" => array("integer", $this->getShowActivationInfo()), "inactive_elements" => array("integer", $iel), "int_links" => array("integer", $inl)), array("page_id" => array("integer", $this->getId()), "parent_type" => array("text", $this->getParentType()), "lang" => array("text", $this->getLanguage())));
         // after update event
         $this->__afterUpdate($dom_doc, $content);
         //echo "<br>PageObject::update:".htmlentities($this->getXMLContent()).":";
         return true;
     } else {
         return $errors;
     }
 }
 /**
  * Build navigation block
  *
  * @param array $items
  * @param string $a_list_cmd
  * @param string $a_posting_cmd
  * @param bool $a_link_template
  * @param bool $a_show_inactive
  * @return string
  */
 function renderNavigation(array $items, $a_list_cmd = "render", $a_posting_cmd = "preview", $a_link_template = null, $a_show_inactive = false)
 {
     global $ilCtrl, $ilSetting;
     $max_detail_postings = 10;
     $wtpl = new ilTemplate("tpl.blog_list_navigation.html", true, true, "Modules/Blog");
     $wtpl->setVariable("NAVIGATION_TITLE", $this->lng->txt("blog_navigation"));
     $ilCtrl->setParameter($this, "blpg", "");
     include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
     $counter = 0;
     foreach ($items as $month => $postings) {
         $month_name = ilCalendarUtil::_numericMonthToString((int) substr($month, 5)) . " " . substr($month, 0, 4);
         if (!$a_link_template) {
             $ilCtrl->setParameter($this, "bmn", $month);
             $month_url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
         } else {
             $month_url = $this->buildExportLink($a_link_template, "list", $month);
         }
         // list postings for month
         if ($counter < $max_detail_postings) {
             foreach ($postings as $id => $posting) {
                 $is_active = ilBlogPosting::_lookupActive($id, "blp");
                 if (!$is_active && !$a_show_inactive) {
                     continue;
                 }
                 $counter++;
                 $caption = $posting["title"];
                 if (!$a_link_template) {
                     $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $month);
                     $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $id);
                     $url = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_posting_cmd);
                 } else {
                     $url = $this->buildExportLink($a_link_template, "posting", $id);
                 }
                 if (!$is_active) {
                     $wtpl->setVariable("NAV_ITEM_DRAFT", $this->lng->txt("blog_draft"));
                 } else {
                     if ($this->object->hasApproval() && !$posting["approved"]) {
                         $wtpl->setVariable("NAV_ITEM_APPROVAL", $this->lng->txt("blog_needs_approval"));
                     }
                 }
                 $wtpl->setCurrentBlock("navigation_item");
                 $wtpl->setVariable("NAV_ITEM_URL", $url);
                 $wtpl->setVariable("NAV_ITEM_CAPTION", $caption);
                 $wtpl->parseCurrentBlock();
             }
             $wtpl->setCurrentBlock("navigation_month_details");
             $wtpl->setVariable("NAV_MONTH", $month_name);
             $wtpl->setVariable("URL_MONTH", $month_url);
             $wtpl->parseCurrentBlock();
         } else {
             $wtpl->setCurrentBlock("navigation_month");
             $wtpl->setVariable("MONTH_NAME", $month_name);
             $wtpl->setVariable("URL_MONTH", $month_url);
             $wtpl->setVariable("MONTH_COUNT", sizeof($postings));
             $wtpl->parseCurrentBlock();
         }
     }
     $ilCtrl->setParameter($this, "bmn", $this->month);
     $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", "");
     // authors
     if ($this->id_type == self::REPOSITORY_NODE_ID) {
         $authors = array();
         foreach ($this->items as $month => $items) {
             foreach ($items as $item) {
                 if (($a_show_inactive || ilBlogPosting::_lookupActive($item["id"], "blp")) && $item["author"]) {
                     $authors[] = $item["author"];
                 }
             }
         }
         $authors = array_unique($authors);
         if (sizeof($authors) > 1) {
             include_once "Services/User/classes/class.ilUserUtil.php";
             $list = array();
             foreach ($authors as $user_id) {
                 if ($user_id) {
                     $ilCtrl->setParameter($this, "ath", $user_id);
                     $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
                     $ilCtrl->setParameter($this, "ath", "");
                     $name = ilUserUtil::getNamePresentation($user_id, true);
                     $idx = trim(strip_tags($name)) . "///" . $user_id;
                     // #10934
                     $list[$idx] = array($name, $url);
                 }
             }
             ksort($list);
             $wtpl->setVariable("AUTHORS_TITLE", $this->lng->txt("blog_authors"));
             $wtpl->setCurrentBlock("author");
             foreach ($list as $author) {
                 $wtpl->setVariable("TXT_AUTHOR", $author[0]);
                 $wtpl->setVariable("URL_AUTHOR", $author[1]);
                 $wtpl->parseCurrentBlock();
             }
         }
     }
     if (!$a_link_template) {
         // keywords
         $may_edit_keywords = $_GET["blpg"] && $this->mayContribute($_GET["blpg"]) && !$a_link_template && $a_list_cmd != "preview" && $a_list_cmd != "gethtml";
         $keywords = $this->getKeywords($a_show_inactive, $_GET["blpg"]);
         if ($keywords || $may_edit_keywords) {
             $wtpl->setVariable("KEYWORDS_TITLE", $this->lng->txt("blog_keywords"));
             if ($keywords) {
                 $max = max($keywords);
                 include_once "Services/Tagging/classes/class.ilTagging.php";
                 $wtpl->setCurrentBlock("keyword");
                 foreach ($keywords as $keyword => $counter) {
                     $ilCtrl->setParameter($this, "kwd", $keyword);
                     $url = $ilCtrl->getLinkTarget($this, $a_list_cmd);
                     $ilCtrl->setParameter($this, "kwd", "");
                     $wtpl->setVariable("TXT_KEYWORD", $keyword);
                     $wtpl->setVariable("SIZE_KEYWORD", ilTagging::calculateFontSize($counter, $max));
                     $wtpl->setVariable("URL_KEYWORD", $url);
                     $wtpl->parseCurrentBlock();
                 }
             } else {
                 $wtpl->setVariable("TXT_NO_KEYWORDS", $this->lng->txt("blog_no_keywords"));
             }
             if ($may_edit_keywords) {
                 $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $_GET["blpg"]);
                 $wtpl->setVariable("URL_EDIT_KEYWORDS", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords"));
                 $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", "");
                 $wtpl->setVariable("TXT_EDIT_KEYWORDS", $this->lng->txt("blog_edit_keywords"));
             }
         }
         // rss
         if ($this->object->hasRSS() && $ilSetting->get('enable_global_profiles') && $a_list_cmd == "preview") {
             // #10827
             $blog_id = $this->node_id;
             if ($this->id_type != self::WORKSPACE_NODE_ID) {
                 $blog_id .= "_cll";
             }
             $url = ILIAS_HTTP_PATH . "/feed.php?blog_id=" . $blog_id . "&client_id=" . rawurlencode(CLIENT_ID);
             $wtpl->setCurrentBlock("rss");
             $wtpl->setVariable("URL_RSS", $url);
             $wtpl->setVariable("IMG_RSS", ilUtil::getImagePath("rss.png"));
             $wtpl->parseCurrentBlock();
         }
     }
     return $wtpl->get();
 }
 /**
  * Parse Groups
  * @param array $groups
  */
 public function parse(array $appointments)
 {
     global $ilCtrl;
     $rows = array();
     $counter = 0;
     foreach ($appointments as $app) {
         include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
         $cal_entry = new ilCalendarEntry($app);
         include_once './Services/Booking/classes/class.ilBookingEntry.php';
         foreach (ilBookingEntry::lookupBookingsForAppointment($app) as $user_id) {
             include_once './Services/User/classes/class.ilUserUtil.php';
             $rows[$counter]['name'] = ilUserUtil::getNamePresentation($user_id, true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()), true, true);
             $message = ilBookingEntry::lookupBookingMessage($app, $user_id);
             if (strlen(trim($message))) {
                 $rows[$counter]['comment'] = '"' . $message . '"';
             }
             $rows[$counter]['title'] = $cal_entry->getTitle();
             $rows[$counter]['start'] = $cal_entry->getStart()->get(IL_CAL_UNIX);
             $rows[$counter]['start_str'] = ilDatePresentation::formatDate($cal_entry->getStart());
             $rows[$counter]['id'] = $app . '_' . $user_id;
             ++$counter;
         }
     }
     $this->setData($rows);
 }
 /**
  * Confirm deassigning members
  */
 function confirmDeassignMembers()
 {
     global $ilCtrl, $tpl, $lng, $ilTabs;
     $ilTabs->activateTab("grades");
     if (!is_array($_POST["member"]) || count($_POST["member"]) == 0) {
         ilUtil::sendFailure($lng->txt("no_checkbox"), true);
         $ilCtrl->redirect($this, "showSubmissions");
     } else {
         include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
         $cgui = new ilConfirmationGUI();
         $cgui->setFormAction($ilCtrl->getFormAction($this));
         $cgui->setHeaderText($lng->txt("rep_robj_xeph_msg_sure_to_deassign_participant"));
         $cgui->setCancel($lng->txt("cancel"), "showSubmissions");
         $cgui->setConfirm($lng->txt("remove"), "deassignMembers");
         include_once "./Services/User/classes/class.ilUserUtil.php";
         foreach ($_POST["member"] as $k => $m) {
             $cgui->addItem("member[{$k}]", $m, ilUserUtil::getNamePresentation((int) $k, false, false, "", true));
         }
         $tpl->setContent($cgui->getHTML());
     }
 }
 protected function parseJobToData(array $a_item, ilCronJob $job)
 {
     global $lng;
     $res = $a_item;
     $res["title"] = $job->getTitle();
     $res["description"] = $job->getDescription();
     $res["has_settings"] = $job->hasCustomSettings();
     if (!$res["title"]) {
         $res["title"] = $a_item["job_id"];
     }
     // schedule
     if (!$job->hasFlexibleSchedule()) {
         // schedule type changed
         if ($a_item["schedule_type"]) {
             ilCronManager::updateJobSchedule($job, null, null);
         }
         $a_item["schedule_type"] = $job->getDefaultScheduleType();
         $a_item["schedule_value"] = $job->getDefaultScheduleValue();
         $res["editable_schedule"] = false;
     } else {
         // schedule type changed
         if (!$a_item["schedule_type"]) {
             $a_item["schedule_type"] = $job->getDefaultScheduleType();
             $a_item["schedule_value"] = $job->getDefaultScheduleValue();
             ilCronManager::updateJobSchedule($job, $a_item["schedule_type"], $a_item["schedule_value"]);
         }
         $res["editable_schedule"] = true;
     }
     switch ($a_item["schedule_type"]) {
         case ilCronJob::SCHEDULE_TYPE_DAILY:
             $schedule = $lng->txt("cron_schedule_daily");
             break;
         case ilCronJob::SCHEDULE_TYPE_WEEKLY:
             $schedule = $lng->txt("cron_schedule_weekly");
             break;
         case ilCronJob::SCHEDULE_TYPE_MONTHLY:
             $schedule = $lng->txt("cron_schedule_monthly");
             break;
         case ilCronJob::SCHEDULE_TYPE_QUARTERLY:
             $schedule = $lng->txt("cron_schedule_quarterly");
             break;
         case ilCronJob::SCHEDULE_TYPE_YEARLY:
             $schedule = $lng->txt("cron_schedule_yearly");
             break;
         case ilCronJob::SCHEDULE_TYPE_IN_MINUTES:
             $schedule = sprintf($lng->txt("cron_schedule_in_minutes"), $a_item["schedule_value"]);
             break;
         case ilCronJob::SCHEDULE_TYPE_IN_HOURS:
             $schedule = sprintf($lng->txt("cron_schedule_in_hours"), $a_item["schedule_value"]);
             break;
         case ilCronJob::SCHEDULE_TYPE_IN_DAYS:
             $schedule = sprintf($lng->txt("cron_schedule_in_days"), $a_item["schedule_value"]);
             break;
     }
     $res["schedule"] = $schedule;
     // status
     if ($a_item["job_status"]) {
         $res["status"] = $lng->txt("cron_status_active");
     } else {
         $res["status"] = $lng->txt("cron_status_inactive");
     }
     $status_info = array();
     if ($a_item["job_status_ts"]) {
         $status_info[] = ilDatePresentation::formatDate(new ilDateTime($a_item["job_status_ts"], IL_CAL_UNIX));
     }
     if (!$a_item["job_status_type"]) {
         $status_info[] = $lng->txt("cron_changed_by_crontab");
     } else {
         $status_info[] = ilUserUtil::getNamePresentation($a_item["job_status_user_id"]);
     }
     $res["status_info"] = implode("<br />", $status_info);
     // result
     $result = "-";
     if ($a_item["job_result_status"]) {
         switch ($a_item["job_result_status"]) {
             case ilCronJobResult::STATUS_INVALID_CONFIGURATION:
                 $result = $lng->txt("cron_result_status_invalid_configuration");
                 break;
             case ilCronJobResult::STATUS_NO_ACTION:
                 $result = $lng->txt("cron_result_status_no_action");
                 break;
             case ilCronJobResult::STATUS_OK:
                 $result = $lng->txt("cron_result_status_ok");
                 break;
             case ilCronJobResult::STATUS_CRASHED:
                 $result = $lng->txt("cron_result_status_crashed");
                 break;
             case ilCronJobResult::STATUS_RESET:
                 $result = $lng->txt("cron_result_status_reset");
                 break;
         }
     }
     $res["result"] = $result;
     $result_info = array();
     if ($a_item["job_result_dur"]) {
         $result_info[] = $a_item["job_result_dur"] / 1000 . " sec";
     }
     if ($a_item["job_result_message"]) {
         $result_info[] = $a_item["job_result_message"];
     }
     if (DEVMODE && $a_item["job_result_code"]) {
         $result_info[] = $a_item["job_result_code"];
     }
     if (!$a_item["job_result_type"]) {
         $result_info[] = $lng->txt("cron_changed_by_crontab");
     } else {
         $result_info[] = ilUserUtil::getNamePresentation($a_item["job_result_user_id"]);
     }
     $res["result_info"] = implode("<br />", $result_info);
     if ($a_item["running_ts"]) {
         $res["last_run"] = strtotime("+1year", $a_item["running_ts"]);
     } else {
         if ($a_item["job_result_ts"]) {
             $res["last_run"] = $a_item["job_result_ts"];
         } else {
             $res["last_run"] = null;
         }
     }
     $res['is_manually_executable'] = $job->isManuallyExecutable();
     return $res;
 }
 /**
  * Save basic settings form
  *
  */
 public function saveBasicSettingsObject()
 {
     global $tpl, $lng, $ilCtrl, $ilSetting, $rbacsystem;
     if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->initBasicSettingsForm();
     if ($this->form->checkInput()) {
         $ilSetting->set("short_inst_name", $_POST["short_inst_name"]);
         $ilSetting->set("pub_section", $_POST["pub_section"]);
         $global_profiles = $_POST["pub_section"] ? (int) $_POST['enable_global_profiles'] : 0;
         $ilSetting->set('enable_global_profiles', $global_profiles);
         $ilSetting->set("open_google", $_POST["open_google"]);
         $ilSetting->set("locale", $_POST["locale"]);
         include_once "Services/User/classes/class.ilUserUtil.php";
         ilUserUtil::setStartingPoint($this->form->getInput('usr_start'), $this->form->getInput('usr_start_ref_id'));
         ilUserUtil::togglePersonalStartingPoint($this->form->getInput('usr_start_pers'));
         ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
         $ilCtrl->redirect($this, "showBasicSettings");
     }
     $this->setGeneralSettingsSubTabs("basic_settings");
     $this->form->setValuesByPost();
     $tpl->setContent($this->form->getHtml());
 }
 /**
  * Show delete booking confirmation
  */
 protected function confirmRejectBooking($a_send_notification = true)
 {
     global $ilTabs, $tpl;
     $this->setSubTabs();
     $ilTabs->activateSubTab('cal_ch_app_bookings');
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setFormAction($this->ctrl->getFormAction($this));
     if ($a_send_notification) {
         ilUtil::sendInfo($this->lng->txt('cal_ch_cancel_booking_info'));
         $confirm->setHeaderText($this->lng->txt('cal_ch_cancel_booking_sure'));
         $confirm->setConfirm($this->lng->txt('cal_ch_reject_booking'), 'rejectBooking');
     } else {
         ilUtil::sendInfo($this->lng->txt('cal_ch_delete_booking_info'));
         $confirm->setHeaderText($this->lng->txt('cal_ch_delete_booking_sure'));
         $confirm->setConfirm($this->lng->txt('cal_ch_delete_booking'), 'deleteBooking');
     }
     $confirm->setCancel($this->lng->txt('cancel'), 'bookingList');
     include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
     foreach ((array) $_REQUEST['bookuser'] as $bookuser) {
         $ids = explode('_', $bookuser);
         include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
         include_once './Services/User/classes/class.ilUserUtil.php';
         $entry = new ilCalendarEntry($ids[0]);
         $confirm->addItem('bookuser[]', $bookuser, ilUserUtil::getNamePresentation($ids[1], true, false, '', true, true) . ', ' . ilDatePresentation::formatDate($entry->getStart()));
     }
     $tpl->setContent($confirm->getHTML());
 }
 /**
  * @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]);
         }
     }
 }