本文整理汇总了PHP中Rating::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Rating::put方法的具体用法?PHP Rating::put怎么用?PHP Rating::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rating
的用法示例。
在下文中一共展示了Rating::put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$tool_content .= "<div class='col-sm-9'>";
foreach ($posts as $post) {
if ($blog_type == 'course_blog') {
$allow_to_edit = $post->permEdit($is_editor, $stud_allow_create, $uid);
} elseif ($blog_type == 'perso_blog') {
$allow_to_edit = $is_blog_editor;
}
$sharing_content = '';
$rating_content = '';
if ($sharing_allowed) {
$sharing_content = ($sharing_enabled) ? print_sharing_links($urlServer."modules/blog/index.php?$url_params&action=showPost&pId=".$post->getId(), $post->getTitle()) : '';
}
if ($ratings_enabled) {
$rating = new Rating('up_down', 'blogpost', $post->getId());
if ($blog_type == 'course_blog') {
$rating_content = $rating->put($is_editor, $uid, $course_id);
} elseif ($blog_type == 'perso_blog') {
//in this case send user_id as third argument instead of course_id which is 0
//since we only need this info for identifying user's blog
$rating_content = $rating->put(NULL, $uid, $user_id);
}
}
if ($comments_enabled && ($post->getCommenting() == 1)) {
$comm = new Commenting('blogpost', $post->getId());
$comment_content = "<a class='btn btn-primary btn-xs pull-right' href='$_SERVER[SCRIPT_NAME]?$url_params&action=showPost&pId=".$post->getId()."#comments_title'>$langComments (".$comm->getCommentsNum().")</a>";
} else {
$comment_content = "<div class=\"blog_post_empty_space\"></div>";
}
$tool_content .= "<div class='panel panel-action-btn-default'>
<div class='panel-heading'>
<div class='pull-right'>
示例2: foreach
$page = 0;
}
//retrieve blog posts
$posts = $blog->getBlogPostsDB($page, $posts_per_page);
/***blog posts area***/
$tool_content .= "<div class='row'>";
$tool_content .= "<div class='col-sm-9'>";
foreach ($posts as $post) {
$sharing_content = '';
$rating_content = '';
if ($sharing_allowed) {
$sharing_content = $sharing_enabled ? print_sharing_links($urlServer . "modules/blog/index.php?course={$course_code}&action=showPost&pId=" . $post->getId(), $post->getTitle()) : '';
}
if ($ratings_enabled) {
$rating = new Rating('up_down', 'blogpost', $post->getId());
$rating_content = $rating->put($is_editor, $uid, $course_id);
}
if ($comments_enabled) {
$comm = new Commenting('blogpost', $post->getId());
$comment_content = "<a class='btn btn-primary btn-xs pull-right' href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "#comments_title'>{$langComments} (" . $comm->getCommentsNum() . ")</a>";
} else {
$comment_content = "<div class=\"blog_post_empty_space\"></div>";
}
$tool_content .= "<div class='panel panel-action-btn-default'>\r\n <div class='panel-heading'>\r\n <div class='pull-right'>\r\n " . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=editPost&pId=" . $post->getId(), 'icon' => 'fa-edit', 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=delPost&pId=" . $post->getId(), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langSureToDelBlogPost, 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)))) . "\r\n </div>\r\n <h3 class='panel-title'>\r\n <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "'>" . q($post->getTitle()) . "</a>\r\n </h3> \r\n </div>\r\n <div class='panel-body'>\r\n <div class='label label-success'>" . nice_format($post->getTime(), true) . "</div><small>" . $langBlogPostUser . display_user($post->getAuthor(), false, false) . "</small><br><br>" . standard_text_escape(ellipsize_html($post->getContent(), $num_chars_teaser_break, "<strong> ...<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "'> <span class='smaller'>[{$langMore}]</span></a></strong>")) . "\r\n {$comment_content}\r\n </div>\r\n <div class='panel-footer'>\r\n <div class='row'>\r\n <div class='col-sm-6'>{$rating_content}</div>\r\n <div class='col-sm-6 text-right'>{$sharing_content}</div>\r\n </div> \r\n </div>\r\n </div>";
}
//display navigation links
$tool_content .= $blog->navLinksHTML($page, $posts_per_page);
$tool_content .= "</div>";
/***end of blog posts area***/
/***sidebar area***/
$tool_content .= "<div class='col-sm-3'>";
示例3: mathfilter
$user_stats[$myrow->poster_id] = '';
}
}
$tool_content .= "<td valign='top'>" . display_user($myrow->poster_id) . $user_stats[$myrow->poster_id] . "</td>";
$message = $myrow->post_text;
// support for math symbols
$message = mathfilter($message, 12, "../../courses/mathimg/");
if ($count == 0) {
$postTitle = "<b>{$langPostTitle}: </b>" . q($topic_subject);
} else {
$postTitle = "";
}
$rate_str = "";
if (setting_get(SETTING_FORUM_RATING_ENABLE, $course_id)) {
$rating = new Rating('thumbs_up', 'forum_post', $myrow->id);
$rate_str = $rating->put($is_editor, $uid, $course_id);
}
$anchor_link = "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&topic={$topic}&forum={$forum}&post_id={$myrow->id}#{$myrow->id}'>#{$myrow->id}</a><br/>";
if ($myrow->parent_post_id == -1) {
$parent_post_link = "<br/>{$langForumPostParentDel}";
} elseif ($myrow->parent_post_id != 0) {
$parent_post_link = "{$langForumPostParent}<a href='viewtopic.php?course={$course_code}&topic={$topic}&forum={$forum}&post_id={$myrow->parent_post_id}#{$myrow->parent_post_id}'>#{$myrow->parent_post_id}</a><br/><br/>";
} else {
$parent_post_link = "";
}
$tool_content .= "<td>\n\t <div>\n\t <a name='" . $myrow->id . "'></a>" . $anchor_link;
$tool_content .= "<b>{$langSent}: </b>" . $myrow->post_time . "<br>{$postTitle}\n\t </div>\n\t <br />{$message}<br />" . $parent_post_link . $rate_str . "\n\t</td>";
$dyntools = !$is_editor ? array() : array(array('title' => $langModify, 'url' => "editpost.php?course={$course_code}&post_id=" . $myrow->id . "&topic={$topic}&forum={$forum}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&post_id={$myrow->id}&topic={$topic}&forum={$forum}&delete=on", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDelete));
if ($topic_locked != 1) {
$dyntools[] = array('title' => $langForumPostReply, 'url' => "reply.php?course={$course_code}&topic={$topic}&forum={$forum}&parent_post={$myrow->id}", 'icon' => 'fa-reply');
}
示例4: showlinksofcategory
/**
* @brief display links of category
* @global type $is_editor
* @global type $course_id
* @global type $urlview
* @global type $tool_content
* @global type $urlServer
* @global type $course_code
* @global type $langLinkDelconfirm
* @global type $langDelete
* @global type $langUp
* @global type $langDown
* @global type $langEditChange
* @global type $is_in_tinymce
* @param type $catid
*/
function showlinksofcategory($catid) {
global $is_editor, $course_id, $urlview, $socialview_param, $tool_content,
$urlServer, $course_code,
$langLinkDelconfirm, $langDelete, $langUp, $langDown,
$langEditChange, $is_in_tinymce, $links_num, $langLinkSubmittedBy;
$tool_content .= "<tr>";
$result = Database::get()->queryArray("SELECT * FROM `link`
WHERE course_id = ?d AND category = ?d
ORDER BY `order`", $course_id, $catid);
$numberoflinks = count($result);
$links_num = 1;
foreach ($result as $myrow) {
$title = empty($myrow->title) ? $myrow->url : $myrow->title;
$aclass = ($is_in_tinymce) ? " class='fileURL' " : '';
$tool_content .= "<td class='nocategory-link'><a href='" . q($myrow->url) . "' $aclass target='_blank'>" . q($title) . " <i class='fa fa-external-link' style='color:#444'></i></a>";
if ($catid == -2 && $myrow->user_id != 0) {
$tool_content .= "<small> - $langLinkSubmittedBy ".display_user($myrow->user_id, false, false)."</small>";
}
if (!empty($myrow->description)) {
$tool_content .= "<br />" . standard_text_escape($myrow->description);
}
if ($catid == -2) { //social bookmarks can be rated
global $uid;
$rating = new Rating('thumbs_up', 'link', $myrow->id);
$tool_content .= $rating->put($is_editor, $uid, $course_id);
}
$tool_content .= "</td>";
if ($is_editor && !$is_in_tinymce) {
$tool_content .= "<td class='option-btn-cell'>";
$editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&action=editlink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param;
if (isset($category)) {
$editlink .= "&category=" . getIndirectReference($category);
}
$tool_content .= action_button(array(
array('title' => $langEditChange,
'icon' => 'fa-edit',
'url' => $editlink),
array('title' => $langUp,
'level' => 'primary',
'icon' => 'fa-arrow-up',
'disabled' => $links_num == 1,
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&urlview=$urlview&up=" . getIndirectReference($myrow->id) . $socialview_param,
),
array('title' => $langDown,
'level' => 'primary',
'icon' => 'fa-arrow-down',
'disabled' => $links_num >= $numberoflinks,
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&urlview=$urlview&down=" . getIndirectReference($myrow->id) . $socialview_param,
),
array('title' => $langDelete,
'icon' => 'fa-times',
'class' => 'delete',
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletelink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param,
'confirm' => $langLinkDelconfirm)
));
$tool_content .= "</td>";
} elseif ($catid == -2 && !$is_in_tinymce) {
if (isset($_SESSION['uid'])) {
if (is_link_creator($myrow->id)) {
$tool_content .= "<td class='option-btn-cell'>";
$editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&action=editlink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param;
$tool_content .= action_button(array(
array('title' => $langEditChange,
'icon' => 'fa-edit',
'url' => $editlink),
array('title' => $langDelete,
'icon' => 'fa-times',
'class' => 'delete',
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletelink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param,
'confirm' => $langLinkDelconfirm)
));
$tool_content .= "</td>";
} else {
if (abuse_report_show_flag('link', $myrow->id , $course_id, $is_editor)) {
$flag_arr = abuse_report_action_button_flag('link', $myrow->id, $course_id);
$tool_content .= "<td class='option-btn-cell'>".action_button(array($flag_arr[0])).$flag_arr[1]."</td>"; //action button option
} else {
$tool_content .= "<td> </td>";
}
}
}
//.........这里部分代码省略.........
示例5: showgroupsofcategory
function showgroupsofcategory($catid) {
global $is_editor, $course_id, $urlview, $socialview_param, $tool_content,
$course_code, $langGroupDelconfirm, $langDelete, $langUp, $langDown,
$langEditChange, $is_in_tinymce, $groups_num;
$tool_content .= "<tr>";
$result = Database::get()->queryArray("SELECT * FROM `group`
WHERE course_id = ?d AND category_id = ?d
ORDER BY `id`", $course_id, $catid);
foreach ($result as $myrow) {
$name = empty($myrow->name) ? $myrow->description : $myrow->name;
$tool_content .= "<td class='nocategory-link'>" . q($name) . " ";
if (!empty($myrow->description)) {
$tool_content .= "<br />" . standard_text_escape($myrow->description);
}
if ($catid == -2) {
global $uid;
$rating = new Rating('thumbs_up', 'group', $myrow->id);
$tool_content .= $rating->put($is_editor, $uid, $course_id);
}
$tool_content .= "</td>";
if ($is_editor && !$is_in_tinymce) {
$tool_content .= "<td class='option-btn-cell'>";
$tool_content .= action_button(array(
array('title' => $langEditChange,
'icon' => 'fa-edit',
'url' => "group_edit.php?course=$course_code&category=$catid&group_id=$myrow->id"),
array('title' => $langDelete,
'icon' => 'fa-times',
'class' => 'delete',
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&deletegroup=1&id=$myrow->id",
'confirm' => $langGroupDelconfirm)
));
$tool_content .= "</td>";
} /*elseif ($catid == -2 && !$is_in_tinymce) {
if (isset($_SESSION['uid'])) {
if (is_link_creator($myrow->id)) {
$tool_content .= "<td class='option-btn-cell'>";
$editgroup = "$_SERVER[SCRIPT_NAME]?course=$course_code&action=editgroup&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param;
$tool_content .= action_button(array(
array('title' => $langEditChange,
'icon' => 'fa-edit',
'url' => $editgroup),
array('title' => $langDelete,
'icon' => 'fa-times',
'class' => 'delete',
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletegroup&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param,
'confirm' => $langGroupDelconfirm)
));
$tool_content .= "</td>";
} else {
if (abuse_report_show_flag('group', $myrow->id , $course_id, $is_editor)) {
$flag_arr = abuse_report_action_button_flag('group', $myrow->id, $course_id);
$tool_content .= "<td class='option-btn-cell'>".action_button(array($flag_arr[0])).$flag_arr[1]."</td>"; //action button option
} else {
$tool_content .= "<td> </td>";
}
}
}
}*/
$tool_content .= "</tr>";
}
}