本文整理汇总了PHP中forum::get_name方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_name方法的具体用法?PHP forum::get_name怎么用?PHP forum::get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 . '&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;
}
示例2: show
/**
* Skjema for å opprette ny tråd
*/
protected function show()
{
// kontroller rankkravet
if (!$this->forum->check_rank()) {
// sett opp ranknavnet
$rank_info = game::$ranks['items_number'][\Kofradia\Forum\Category::TOPIC_MIN_RANK];
echo '
<div class="bg1_c xsmall">
<h1 class="bg1">Ny forumtråd i ' . htmlspecialchars($this->forum->get_name()) . '<span class="left"></span><span class="right"></span></h1>
<p class="h_left"><a href="forum?id=' . $this->forum->id . '">« Tilbake</a></p>
<div class="bg1">
<div class="error_box" style="padding: 10px 0">
<p>Du har for lav rank for å kunne opprette forumtråder i forumet.</p>
<p>For å kunne opprette en ny forumtråd må du ha nådd ranken <b>' . htmlspecialchars($rank_info['name']) . '</b>.</p>
<p>Se også <a href="' . ess::$s['relative_path'] . '/node/5">hjelp</a>.</p>
<p><a href="forum?id=' . $this->forum->id . '">Tilbake</a></p>
</div>
</div>
</div>';
return;
}
// kontroller blokkeringer
$block = $this->forum->check_block();
// opprette forumtråden?
if (!$block && isset($_POST['opprett'])) {
$title = postval("title");
$text = postval("text");
// type forumtråd og låst/ulåst
$type = NULL;
$locked = NULL;
if ($this->forum->fmod) {
$type = postval("type");
$locked = isset($_POST['locked']);
}
// forsøk å opprett forumtråden
$this->forum->add_topic($title, $text, $type, $locked);
}
echo '
<div class="bg1_c forumw forumnewtopic">
<h1 class="bg1">Ny forumtråd i ' . htmlspecialchars($this->forum->get_name()) . '<span class="left"></span><span class="right"></span></h1>
<p class="h_left"><a href="forum?id=' . $this->forum->id . '">« Tilbake</a></p>
<div class="bg1">
<boxes />
<div id="topic_info_add"></div>
<div class="forum_reply_edit_c">
<form action="" method="post">
<dl class="dl_2x">
<dt>Tittel</dt>
<dd>
<input type="text" name="title" id="topic_title" class="styled w300" value="' . htmlspecialchars(postval("title")) . '" maxlength="40" />';
if ($this->forum->fmod) {
$type = intval(postval("type"));
echo '
<select name="type" id="topic_type">
<option value="1"' . ($type == 1 ? ' selected="selected"' : '') . '>Normal forumtråd</option>
<option value="2"' . ($type == 2 ? ' selected="selected"' : '') . '>Sticky forumtråd</option>
<option value="3"' . ($type == 3 ? ' selected="selected"' : '') . '>Viktig forumtråd</option>
</select>
</dd>
<dt>Låst</dt>
<dd><input type="checkbox" name="locked" id="topic_locked"' . (isset($_POST['locked']) ? ' checked="checked"' : '') . ' /><label for="topic_locked"> Lås forumtråden for endringer</label>';
}
echo '</dd>
<dt>Innhold</dt>
<dd><textarea name="text" rows="20" cols="75" id="topic_text">' . htmlspecialchars(postval("text")) . '</textarea></dd>
</dl>
<p class="c">Husk at <a href="' . ess::$s['relative_path'] . '/node/6" target="_blank">forumreglene</a> til enhver tid skal følges.</p>
<p class="c">
' . show_sbutton("Opprett", 'name="opprett" accesskey="s" id="topic_add"') . '
' . show_sbutton("Forhåndsvis", 'name="preview" accesskey="p" id="topic_preview"') . '
</p>
</form>
</div>
<div id="topic_info">';
// forhåndsvisning
if (isset($_POST['preview'])) {
$data = array("ft_text" => postval("text"));
echo '
<div class="forum">' . \Kofradia\Forum\Category::template_topic_preview($data) . '
</div>';
}
echo '
</div>
</div>
</div>';
// div javascript
ess::$b->page->add_js_file(ess::$s['relative_path'] . "/js/forum.js");
ess::$b->page->add_js_domready('
new NewForumTopic(' . $this->forum->id . ');');
}
示例3: show_forum
/**
* Vis forumet
*/
protected function show_forum()
{
// markere som sett?
if ($this->forum->ff) {
$this->forum->ff->uinfo->forum_seen();
}
// vise slettede forumtråder?
$show_deleted = false;
if (isset($_GET['sd']) && $this->forum->fmod) {
// ff
if ($this->forum->ff && !access::has("mod")) {
ess::$b->page->add_message("Du viser også forumtråder som ble slettet for mindre enn " . game::timespan(\Kofradia\Forum\Topic::FF_HIDE_TIME, game::TIME_FULL) . " siden.");
} else {
ess::$b->page->add_message("Du viser også slettede forumtråder.");
}
$show_deleted = true;
}
$vis_bokser = isset($_GET['vis_bokser']) && !$show_deleted;
// vis forum informasjon
echo '
<div class="bg1_c forumw">
<h1 class="bg1">' . htmlspecialchars($this->forum->get_name()) . '<span class="left"></span><span class="right"></span></h1>
<p class="h_right">
<a href="topic_new?f=' . $this->forum->id . '">Opprett ny forumtråd</a>' . ($this->forum->fmod && !$vis_bokser && !$show_deleted ? '
<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array(), array("vis_bokser" => true))) . '">Vis merk innlegg knapp</a>' : ($vis_bokser ? '
<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array("vis_bokser"))) . '">Skjul valg</a>' : '')) . '
</p>
<p class="h_left">
<a href="sok?s' . $this->forum->id . '">Søk</a>
<a href="' . ess::$s['relative_path'] . '/node/6">Forumregler</a>' . ($this->forum->fmod && !$vis_bokser ? $show_deleted ? '
<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array("sd"))) . '">Skjul slettede</a>' : '
<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array(), array("sd" => true))) . '">Vis slettede</a>' : '') . '
</p>
<div class="bg1">';
// hvor lenge etter den er slettet vi kan vise den
$access_expire = max(time() - \Kofradia\Forum\Topic::FF_HIDE_TIME, $this->forum->ff ? $this->forum->ff->data['ff_time_reset'] : 0);
// finn ut hvor mange topics det er
$expire_deleted = $show_deleted ? !$this->forum->ff || access::has("mod") ? "" : " AND (ft_deleted = 0 OR ft_deleted > {$access_expire})" : " AND ft_deleted = 0";
$result = \Kofradia\DB::get()->query("\n\t\t\tSELECT COUNT(IF(ft_type = 1, 1, NULL)) AS normal, COUNT(IF(ft_type = 2, 1, NULL)) AS sticky, COUNT(IF(ft_type = 3, 1, NULL)) AS important\n\t\t\tFROM forum_topics\n\t\t\tWHERE ft_fse_id = {$this->forum->id}{$expire_deleted}");
$count = $result->fetch();
unset($result);
// alle important og sticky topics skal vises på første siden
// mens bare 15 normale topics skal vises på hver side
$pagei = new pagei(pagei::PER_PAGE, 15, pagei::TOTAL, $count['normal'], pagei::ACTIVE_GET, "p");
if (isset($_GET['p']) && (string) $pagei->active != $_GET['p']) {
$add = $pagei->active > 1 ? '&p=' . $pagei->active : '';
redirect::handle("forum?id={$this->forum->id}{$add}");
}
// sjekke status?
$fs_count = 0;
// markere alle emner og svar som lest?
if (isset($_GET['fs_force']) && login::$logged_in && \Kofradia\Forum\Category::$fs_check) {
// legg til og oppdater innleggene på denne siden
\Kofradia\DB::get()->exec("\n\t\t\t\tINSERT INTO forum_seen (fs_ft_id, fs_u_id, fs_time)\n\t\t\t\t\n\t\t\t\tSELECT ft_id, " . login::$user->id . ", IFNULL(fr_time, ft_time)\n\t\t\t\tFROM forum_topics\n\t\t\t\t\tLEFT JOIN forum_replies ON ft_last_reply = fr_id\n\t\t\t\tWHERE ft_fse_id = {$this->forum->id} AND ft_type = 1 AND ft_deleted = 0\n\t\t\t\tORDER BY IFNULL(fr_time, ft_time) DESC\n\t\t\t\tLIMIT {$pagei->start}, {$pagei->per_page}\n\t\t\t\t\n\t\t\t\tON DUPLICATE KEY UPDATE fs_time = VALUES(fs_time)");
redirect::handle(game::address("forum", $_GET, array("fs_force")));
}
// oppdater tidspunkt for visning hvis crewforum
if (login::$logged_in && $pagei->active == 1 && $this->forum->id >= 5 && $this->forum->id <= 7) {
login::$user->params->update("forum_{$this->forum->id}_last_view", time(), true);
}
if ($pagei->active == 1 && ($count['important'] > 0 || $count['sticky'] > 0) || $count['normal'] > 0) {
echo ($this->forum->fmod && $vis_bokser ? '
<form action="" method="post">' : '') . '
<table width="100%" class="table forum tablem">
<thead>
<tr>
<th>Tittel' . ($this->forum->fmod && $vis_bokser ? ' (<a href="#" class="box_handle_toggle" rel="emne[]">Merk alle</a>)' : '') . '</th>
<th>Trådstarter</th>
<th>Svar</th>
<th><abbr title="Visninger">Vis</abbr></th>
<th>Siste innlegg</th>
</tr>
</thead>
<tbody' . ($this->forum->fmod && $vis_bokser ? ' class="pointer"' : '') . '>';
$i = 0;
// skal vi hente important og sticky topics?
if ($pagei->active == 1 && ($count['important'] > 0 || $count['sticky'] > 0)) {
// hent important og sticky forumtråder
$result = $this->get_topics(false, $show_deleted);
// vis hver topic
while ($row = $result->fetch()) {
// sjekke status?
$fs_info = '';
$fs_link_suffix = '';
if (\Kofradia\Forum\Category::$fs_check) {
if (empty($row['fs_time'])) {
$fs_info = ' <span class="fs_ft_new">NY!</span>';
$fs_count++;
} elseif ($row['fs_time'] < $row['fr_time']) {
$fs_info = ' <span class="fs_fr_new">' . $row['fs_new'] . ' <span class="fs_fr_newi">NY' . ($row['fs_new'] == 1 ? '' : 'E') . '</span></span>';
$fs_link_suffix = '&fs';
}
}
echo '
<tr class="' . (++$i % 2 == 0 ? 'color2_1' : 'color2_0') . ($row['ft_deleted'] != 0 ? ' ft_deleted' : '') . '" id="emne_' . $row['ft_id'] . '">
<td class="f"><a href="topic?id=' . $row['ft_id'] . $fs_link_suffix . '">' . htmlspecialchars($row['ft_title']) . '</a> ' . ($row['ft_type'] == 3 ? '<span style="color: #CCFF00; font-weight: bold">(Viktig)</span>' : '<span style="color: #CCFF00">(Sticky)</span>') . ($row['ft_locked'] == 1 ? ' <span class="forum_lock">(låst)</span>' : '') . ($row['ft_deleted'] != 0 ? ' (slettet)' : '') . $fs_info . '</td>
<td class="t_uinfo">' . game::profile_link($row['ft_up_id'], $row['up_name'], $row['up_access_level']) . '<br /><span class="f_time">' . ess::$b->date->get($row['ft_time'])->format() . '</span></td>
//.........这里部分代码省略.........