本文整理汇总了PHP中forum::get_course_module方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_course_module方法的具体用法?PHP forum::get_course_module怎么用?PHP forum::get_course_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_course_module方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: while
/**
*
* @param forum $forum Forum
* @param object $cm Course-module object
* @param object $context Context object
* @param object $course Course object
*/
function next_forum(&$forum, &$cm, &$context, &$course)
{
// Skip if required to get to new forum
while ($this->forum != null) {
$this->next_discussion($discussion);
}
// Get record
if ($this->storedrecord) {
$record = $this->storedrecord;
$this->storedrecord = null;
} else {
if (!$this->rs) {
// Already used entire list and closed recordset
return false;
} else {
$record = rs_fetch_next_record($this->rs);
if (!$record) {
// End of the line. Mark everything as mailed
$this->mark_mailed($this->time);
rs_close($this->rs);
$this->rs = null;
return false;
}
}
}
// Set data
$this->storedrecord = clone $record;
$cm = forum_utils::extract_subobject($record, 'cm_');
$course = forum_utils::extract_subobject($record, 'c_');
$context = forum_utils::extract_subobject($record, 'x_');
$forum = new forum($course, $cm, $context, forum_utils::extract_subobject($record, 'f_'));
if ($forum->is_shared()) {
$forum->set_clone_reference($record->cloneid);
$cm = $forum->get_course_module();
$course = $forum->get_course();
$context = $forum->get_context();
}
$this->forum = $forum;
return true;
}