当前位置: 首页>>代码示例>>PHP>>正文


PHP ilUserUtil类代码示例

本文整理汇总了PHP中ilUserUtil的典型用法代码示例。如果您正苦于以下问题:PHP ilUserUtil类的具体用法?PHP ilUserUtil怎么用?PHP ilUserUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ilUserUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilLMMailNotification.php

示例2: fillRow

 /**
  * 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"]));
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:14,代码来源:class.ilExcDeliveredFilesTableGUI.php

示例3: fillRow

 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"]);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:51,代码来源:class.ilExAssignmentListTextTableGUI.php

示例4: fillRow

 /**
  * 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())));
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:18,代码来源:class.ilWikiRecentChangesTableGUI.php

示例5: confirmRemove

 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());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:14,代码来源:class.ilCourseParticipantsGroupsGUI.php

示例6: translateUserIds

 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilExAssignmentPeerReviewOverviewTableGUI.php

示例7: fillRow

 /**
  * 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", "");
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:51,代码来源:class.ilPageHistoryTableGUI.php

示例8: getItems

 /**
  * 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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:20,代码来源:class.ilExAssignmentTeamTableGUI.php

示例9: fillRow

 /**
  * 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();
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:49,代码来源:class.ilHistoryTableGUI.php

示例10: __construct

 /**
  * 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');
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:52,代码来源:class.ilSurveyAppraiseesTableGUI.php

示例11: getItems

 /**
  * 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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:21,代码来源:class.ilContributorTableGUI.php

示例12: importData

 /**
  * 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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:45,代码来源:class.ilWorkspaceAccessTableGUI.php

示例13: importData

 /**
  * 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);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:39,代码来源:class.ilWorkspaceAccessTableGUI.php

示例14: sendNotificationMail

 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);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:37,代码来源:class.ilObjSurvey.php

示例15: sendNotification

 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);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:100,代码来源:class.ilObjBlog.php


注:本文中的ilUserUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。