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


PHP forum::get_link_params方法代码示例

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


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

示例1: display_subscribe_options

 /**
  * Display subscribe options.
  * @param forum $forum Forum
  * @param string $text Textual note
  * @param int $subscribed
  * @param bool $button True if subscribe/unsubscribe button should be shown
  * @param bool $viewlink True if 'view subscribers' link should be shown
  * @return string HTML code for this area
  */
 public function display_subscribe_options($forum, $text, $subscribed, $button, $viewlink)
 {
     $out = '<div class="forumng-subscribe-options">' . '<h3>' . get_string('subscription', 'forumng') . '</h3>' . '<p>' . $text . '</p>';
     $cm = $forum->get_course_module();
     if ($button) {
         $outsubmit = '';
         $currentgroupid = forum::get_activity_group($cm, true);
         if ($currentgroupid == forum::NO_GROUPS) {
             $currentgroupid = 0;
         }
         if ($subscribed == forum::FULLY_SUBSCRIBED || $subscribed == forum::FULLY_SUBSCRIBED_GROUPMODE) {
             $outsubmit .= '<input type="submit" name="submitunsubscribe" value="' . get_string('unsubscribeshort', 'forumng') . '" />';
         } else {
             if ($subscribed == forum::PARTIALLY_SUBSCRIBED) {
                 //print both subscribe button and unsubscribe button
                 $outsubmit .= '<input type="submit" name="submitsubscribe" value="' . get_string('subscribelong', 'forumng') . '" />' . '<input type="submit" name="submitunsubscribe" value="' . get_string('unsubscribelong', 'forumng') . '" />';
             } else {
                 if ($subscribed == forum::NOT_SUBSCRIBED) {
                     //default unsubscribed, print subscribe button
                     $outsubmit .= '<input type="submit" name="submitsubscribe" value="' . get_string('subscribeshort', 'forumng') . '" />';
                 } else {
                     if ($subscribed == forum::THIS_GROUP_PARTIALLY_SUBSCRIBED) {
                         $outsubmit .= '<input type="submit" name="submitsubscribe_thisgroup" value="' . get_string('subscribegroup', 'forumng') . '" />' . '<input type="submit" name="submitunsubscribe_thisgroup" value="' . get_string('unsubscribegroup_partial', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
                     } else {
                         if ($subscribed == forum::THIS_GROUP_SUBSCRIBED) {
                             $outsubmit .= '<input type="submit" name="submitunsubscribe_thisgroup" value="' . get_string('unsubscribegroup', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
                         } else {
                             if ($subscribed == forum::THIS_GROUP_NOT_SUBSCRIBED) {
                                 $outsubmit .= '<input type="submit" name="submitsubscribe_thisgroup" value="' . get_string('subscribegroup', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
                             }
                         }
                     }
                 }
             }
         }
         $out .= '<form action="subscribe.php" method="post"><div>' . $forum->get_link_params(forum::PARAM_FORM) . '<input type="hidden" name="back" value="view" />' . $outsubmit . '</div></form>';
     }
     if ($viewlink) {
         $out .= ' <div class="forumng-subscribe-admin">' . '<a href="subscribers.php?' . $forum->get_link_params(forum::PARAM_HTML) . '">' . get_string('viewsubscribers', 'forumng') . '</a></div>';
     }
     $out .= '</div>';
     return $out;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:52,代码来源:forum_type.php

示例2: print_view_page

 /**
  * Displays the view page (usually showing a list of discussions).
  * @param forum $forum Forum
  * @param int $groupid Group ID
  */
 public function print_view_page($forum, $groupid)
 {
     global $SESSION;
     $forumid = $forum->get_id();
     $baseurl = 'view.php?' . $forum->get_link_params(forum::PARAM_PLAIN);
     if (isset($SESSION->forumng_discussionlist[$forumid]) && property_exists($SESSION->forumng_discussionlist[$forumid], 'groupid') && $SESSION->forumng_discussionlist[$forumid]->groupid != $groupid) {
         unset($SESSION->forumng_discussionlist[$forumid]->page);
         unset($SESSION->forumng_discussionlist[$forumid]->groupid);
     }
     //Remember the sort order and page number in session variables
     //Unset the page session variable when the sort links are clicked
     // or groupid has been changed (using the group dropdown box)
     $sortorder = optional_param('sort', '', PARAM_ALPHA);
     if (!$sortorder) {
         if (isset($SESSION->forumng_discussionlist[$forumid]->sort)) {
             $sortorder = $SESSION->forumng_discussionlist[$forumid]->sort;
         } else {
             $sortorder = 'd';
         }
     } else {
         if (optional_param('sortlink', '', PARAM_ALPHA)) {
             $SESSION->forumng_discussionlist[$forumid]->sort = $sortorder;
             unset($SESSION->forumng_discussionlist[$forumid]->page);
         }
     }
     $page = optional_param('page', 0, PARAM_INT);
     if (!$page) {
         if (isset($SESSION->forumng_discussionlist[$forumid]->page)) {
             $page = $SESSION->forumng_discussionlist[$forumid]->page;
         } else {
             $page = 1;
         }
     } else {
         $SESSION->forumng_discussionlist[$forumid]->page = $page;
         $SESSION->forumng_discussionlist[$forumid]->groupid = $groupid;
     }
     $baseurl .= '&page=' . $page;
     $sortchar = substr($sortorder, 0, 1);
     if (strlen($sortorder) == 2) {
         $sortreverse = substr($sortorder, 1, 1) == 'r' ? true : false;
     } else {
         $sortreverse = false;
     }
     $baseurl .= '&sort=' . $sortchar;
     $baseurl .= $sortreverse ? 'r' : '';
     $sort = forum::get_sort_code($sortchar);
     $list = $forum->get_discussion_list($groupid, $forum->can_view_hidden(), $forum->can_manage_discussions(), $page, $sort, $sortreverse);
     $sticky = $list->get_sticky_discussions();
     $normal = $list->get_normal_discussions();
     // Remove discussions from list if the forumtype thinks we can't see
     // them
     foreach ($sticky as $key => $value) {
         if (!$this->can_view_discussion($value)) {
             unset($sticky[$key]);
         }
     }
     foreach ($normal as $key => $value) {
         if (!$this->can_view_discussion($value)) {
             unset($normal[$key]);
         }
     }
     // Intro
     print $forum->display_intro();
     // Draft posts
     $drafts = $forum->get_drafts();
     if (count($drafts) > 0) {
         print $forum->display_draft_list_start();
         foreach ($drafts as $draft) {
             print $draft->display_draft_list_item($forum, $draft == end($drafts));
         }
         print $forum->display_draft_list_end();
     }
     //print info about the start and end dtates of the forum from the form setting;
     $stringend = has_capability('mod/forumng:ignorepostlimits', $forum->get_context()) ? 'capable' : '';
     $startdate = $forum->get_postingfrom();
     $enddate = $forum->get_postinguntil();
     // Before start date
     if (time() < $startdate) {
         $message = get_string('beforestartdate' . $stringend, 'forumng', forum_utils::display_date($startdate));
         print "<div class='forumng-show-dates'>{$message}</div>";
     } else {
         if (time() < $enddate) {
             $message = get_string('beforeenddate' . $stringend, 'forumng', forum_utils::display_date($enddate));
             print "<div class='forumng-show-dates'>{$message}</div>";
         }
     }
     // After end date
     if ($enddate && time() >= $enddate) {
         $message = get_string('afterenddate' . $stringend, 'forumng', forum_utils::display_date($enddate));
         print "<div class='forumng-show-dates'>{$message}</div>";
     }
     // Post button - temporarily disabled when in all-groups mode
     print $groupid == NULL ? '' : $forum->display_post_button($groupid);
     print $list->display_paging_bar($baseurl);
     if (count($sticky) + count($normal) > 0) {
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:general_forum_type.php

示例3: digest_add_post_for_user

 /**
  * Updates the in-memory digest records to add a new post to the given
  * user's digests.
  * @param object $user User object (must include special ->emailtype, etc)
  * @param array $userdigests Array of user id => digest information object
  * @param forum_post $post Post object
  * @param forum_post $inreplyto Parent post
  * @param forum_discussion $discussion Discus
  * @param forum $forum
  * @param object $cm
  * @param object $course
  * @param object $context
  */
 private static function digest_add_post_for_user(&$user, &$userdigests, &$post, &$inreplyto, &$discussion, &$forum, &$cm, &$course, &$context)
 {
     global $CFG;
     // Set up digest for user if required
     if (!array_key_exists($user->id, $userdigests)) {
         $userdigests[$user->id] = new StdClass();
         $userdigests[$user->id]->discussionid = -1;
         // So we do header next
         $userdigests[$user->id]->user = $user;
         $userdigests[$user->id]->forumid = -1;
         // Get header text
         $headerdata = new object();
         $headerdata->sitename = format_string($course->fullname, true);
         $headerdata->userprefs = $CFG->wwwroot . '/user/edit.php?id=' . $user->id . '&amp;course=' . $course->id;
         $userdigests[$user->id]->text = get_string('digestmailheader', 'forumng', $headerdata) . "\n\n";
         // Get header HTML
         $html = "<head>";
         foreach ($CFG->stylesheets as $stylesheet) {
             $html .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
         }
         $html .= "</head>\n<body id='forumng-email'>\n";
         $headerdata->userprefs = '<a target="_blank" href="' . $headerdata->userprefs . '">' . get_string('digestmailprefs', 'forumng') . '</a>';
         $html .= '<div class="forumng-emailheader"><p>' . get_string('digestmailheader', 'forumng', $headerdata) . '</p></div><hr size="1" noshade="noshade" />';
         $userdigests[$user->id]->html = $html;
         // Get email subject
         $userdigests[$user->id]->subject = get_string('digestmailsubject', 'forumng', format_string($course->shortname, true));
     }
     // New forum?
     if ($userdigests[$user->id]->forumid != $forum->get_id()) {
         $userdigests[$user->id]->forumid = $forum->get_id();
     }
     // Is this a new discussion?
     if ($userdigests[$user->id]->discussionid != $discussion->get_id()) {
         $strforums = get_string('forums', 'forumng');
         // Per-discussion header (text mode)
         $text = "\n \n";
         $text .= '=====================================================================';
         $text .= "\n \n";
         $text .= "{$course->shortname} -> {$strforums} -> " . format_string($forum->get_name(), true);
         if ($discussion->get_subject(false) !== $forum->get_name()) {
             $text .= " -> " . format_string($discussion->get_subject(false), true);
         }
         $text .= "\n";
         // HTML mode
         $html = '<hr size="1" noshade="noshade" />';
         $html .= "<div class='forumng-breadcrumbs'>" . "<a target='_blank' href='{$CFG->wwwroot}/course/view.php?id={$course->id}'>{$course->shortname}</a> -> " . "<a target='_blank' href='{$CFG->wwwroot}/mod/forumng/index.php?id={$course->id}'>{$strforums}</a> -> " . "<a target='_blank' href='{$CFG->wwwroot}/mod/forumng/view.php?" . $forum->get_link_params(forum::PARAM_HTML) . "'>" . format_string($forum->get_name(), true) . "</a>";
         if ($discussion->get_subject(false) !== $forum->get_name()) {
             $html .= " -> <a target='_blank' href='{$CFG->wwwroot}/mod/forumng/discuss.php?" . $discussion->get_link_params(forum::PARAM_HTML) . "'>" . format_string($discussion->get_subject(false), true) . "</a>";
         }
         $html .= '</div>';
         $userdigests[$user->id]->text .= $text;
         $userdigests[$user->id]->html .= $html;
         $userdigests[$user->id]->discussionid = $discussion->get_id();
     }
     // Get both plaintext and html versions (and subject).
     // The html version will be blank if set to
     // plain text mode.
     $post->build_email($inreplyto, $subject, $text, $html, $user->emailtype & 1, $user->emailtype & 2, $user->emailtype & 4, $user->lang, $user->timezone, true);
     $userdigests[$user->id]->text .= $text;
     $userdigests[$user->id]->html .= $html;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:74,代码来源:forum_cron.php


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