本文整理汇总了PHP中Comments类的典型用法代码示例。如果您正苦于以下问题:PHP Comments类的具体用法?PHP Comments怎么用?PHP Comments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Comments类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionChangeStatus
/**
* Change Case status using select-box
*/
public function actionChangeStatus()
{
// check if user has permissions to changeStatusCases
if (Yii::app()->user->checkAccess('changeStatusCases')) {
// verify is request was made via post ajax
if (Yii::app()->request->isAjaxRequest && isset($_POST)) {
// get Cases object model
$model = $this->loadModel($_REQUEST['id']);
// set new status
$model->status_id = $_POST['changeto'];
// validate and save
if ($model->save()) {
// save log
$attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'CaseStatusChanged', 'log_resourceid' => $model->case_id, 'log_type' => Logs::LOG_UPDATED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->project_id);
Logs::model()->saveLog($attributes);
// create comment to let then know that some user change the case status
$modelComment = new Comments();
$modelComment->comment_date = date("Y-m-d G:i:s");
$modelComment->comment_text = Status::STATUS_COMMENT . ": " . $model->Status->status_id;
$modelComment->user_id = Yii::app()->user->id;
$modelComment->module_id = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $this->getId())))->module_id;
$modelComment->comment_resourceid = $model->case_id;
$modelComment->save(false);
// prepare email template for each project manager
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
$subject = Yii::t('email', 'CaseStatusChange') . " - " . $model->case_name;
//$Users = Users::model()->with('Clients')->findManagersByProject($model->project_id);
$Users = Projects::model()->findAllUsersByProject($model->project_id);
$recipientsList = array();
foreach ($Users as $client) {
$recipientsList[] = array('name' => $client->CompleteName, 'email' => $client->user_email);
}
// load template
$str = $this->renderPartial('//templates/cases/StatusChanged', array('case' => $model, 'user' => Users::model()->findByPk(Yii::app()->user->id), 'urlToCase' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->createUrl('cases/view', array('id' => $model->case_id)), 'typeNews' => $model->status_id == Status::STATUS_ACCEPTED || $model->status_id == Status::STATUS_TOREVIEW ? 'buenas' : 'malas', 'applicationName' => Yii::app()->name, 'applicationUrl' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->request->baseUrl), true);
$mailer->pushMail($subject, $str, $recipientsList, Emails::PRIORITY_NORMAL);
$output = Yii::t('cases', 'StatusChanged');
} else {
$output = Yii::t('cases', 'StatusError');
}
echo $output;
Yii::app()->end();
} else {
throw new CHttpException(403, Yii::t('site', '403_Error'));
}
} else {
throw new CHttpException(403, Yii::t('site', '403_Error'));
}
}
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:52,代码来源:CasesController.php
示例2: submitComment
public function submitComment()
{
$model = new Comments();
$model->submitComment();
// Now we redirect to the book, so it shows the new comment
header('Location: index.php?action=showbook&id=' . $_SESSION['bookid']);
}
开发者ID:apexJCL,项目名称:mvc,代码行数:7,代码来源:comments.php
示例3: newComment
public function newComment()
{
// POST İLE GÖNDERİLEN DEĞERLERİ ALALIM.
$postData = Input::all();
// FORM KONTROLLERİNİ BELİRLEYELİM
$rules = array('question_id' => 'required|integer', 'comment' => 'required');
// HATA MESAJLARINI OLUŞTURALIM
$messages = array('question_id.required' => 'İşleminiz yapılırken teknik bir sorun oluştu', 'question_id.integer' => 'İşleminiz yapılırken teknik bir sorun oluştu', 'comment.required' => 'Lütfen yanıtınızı yazın');
// KONTROL (VALIDATION) İŞLEMİNİ GERÇEKLEŞTİRELİM
$validator = Validator::make($postData, $rules, $messages);
// EĞER VALİDASYON BAŞARISIZ OLURSA HATALARI GÖSTERELİM
if ($validator->fails()) {
// KULLANICIYI SORU SAYFASINA GERİ GÖNDERELİM
return Redirect::to(URL::previous())->withErrors($validator->messages());
} else {
// SORUYU VERİTABANINA EKLEYELİM
$comment = new Comments();
$comment->user_id = Auth::user()->id;
$comment->question_id = $postData['question_id'];
$comment->comment = e(trim($postData['comment']));
$comment->created_at = date('Y-m-d H:i:s');
$comment->created_ip = Request::getClientIp();
$comment->save();
// KULLANICIYI YENİDEN SORUYA YÖNLENDİRELİM
return Redirect::to(URL::previous());
}
}
开发者ID:burak-tekin,项目名称:laravel-ornek-uygulama,代码行数:27,代码来源:CommentsController.php
示例4: actionSave_comment
/**
* Добавление / редактирование комментариев
*/
public function actionSave_comment()
{
if (Yii::app()->user->isGuest) {
$this->redirect($this->createAbsoluteUrl('base'));
}
// Редактирование или добавление новой
if (isset($_GET['idComment'])) {
$model = Comments::model()->findByPk($_GET['idComment']);
} else {
$model = new Comments();
}
if (isset($_POST['idArticle']) && isset($_POST['text']) && isset($_POST['idAuthor'])) {
$model->idArticle = $_POST['idArticle'];
$model->text = $_POST['text'];
$model->idUser = empty($this->_user) ? Users::getIdUserForAdmin() : $this->_user['idUser'];
$model->typeUser = $model->idUser == $_POST['idAuthor'] ? 'author' : (empty($this->_user) ? 'admin' : 'user');
if ($model->save()) {
if (Yii::app()->request->isAjaxRequest) {
$criteria = new CDbCriteria();
$criteria->with = array('idUser0');
$criteria->condition = 'idArticle = :idArticle AND deleted = 0 AND public = 1';
$criteria->params = array(':idArticle' => $_POST['idArticle']);
$comments = Comments::model()->findAll($criteria);
$commentsDataProvider = new CArrayDataProvider($comments, array('keyField' => 'idComment', 'pagination' => array('pageSize' => 50)));
$listComments = $this->renderPartial('_list_comments', array('dataProvider' => $commentsDataProvider), true);
echo CJSON::encode(array('listComments' => $listComments));
exit;
}
}
}
}
开发者ID:vitalya-xxx,项目名称:vitacod.ru,代码行数:34,代码来源:CommentsController.php
示例5: module_most_commented
function module_most_commented($mod_reference, $module_params)
{
global $smarty;
global $commentslib;
if (!isset($commentslib)) {
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments();
}
$type = 'wiki';
if (isset($module_params['objectType'])) {
$type = $module_params['objectType'];
if ($type != 'article' && $type != 'blog' && $type != 'wiki') {
//If parameter is not properly set then default to wiki
$type = 'wiki';
}
}
$result = $commentslib->order_comments_by_count($type, isset($module_params['objectLanguageFilter']) ? $module_params['objectLanguageFilter'] : '', $mod_reference['rows']);
if ($result === false) {
$smarty->assign('module_error', tra('Feature disabled'));
return;
}
$smarty->assign('modMostCommented', $result['data']);
$smarty->assign('modContentType', $type);
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:26,代码来源:mod-func-most_commented.php
示例6: smarty_function_poll
function smarty_function_poll($params, &$smarty)
{
global $polllib;
global $dbTiki;
global $commentslib;
global $feature_poll_comments;
extract($params);
// Param = zone
if (!is_object($polllib)) {
include_once 'lib/polls/polllib_shared.php';
}
include_once 'lib/commentslib.php';
if (isset($rate)) {
if (!$tikilib->page_exists($rate)) {
return false;
}
}
if (empty($id)) {
$id = $polllib->get_random_active_poll();
}
if ($id) {
$menu_info = $polllib->get_poll($id);
$channels = $polllib->list_poll_options($id);
if ($feature_poll_comments == 'y') {
$commentslib = new Comments($dbTiki);
$comments_count = $commentslib->count_comments("poll:" . $menu_info["pollId"]);
}
$smarty->assign('comments', $comments_count);
$smarty->assign('ownurl', 'tiki-poll_results.php?pollId=' . $id);
$smarty->assign('menu_info', $menu_info);
$smarty->assign('channels', $channels);
$smarty->display('tiki-poll.tpl');
}
}
开发者ID:BackupTheBerlios,项目名称:localis,代码行数:34,代码来源:function.poll.php
示例7: onmineAction
/** Comments on your records
*/
public function onmineAction()
{
$params = $this->_getAllParams();
$this->view->params = $params;
$comments = new Comments();
$this->view->comments = $comments->getCommentsOnMyRecords($this->getIdentityForForms(), $this->_getParam('page'), $this->_getParam('approval'));
}
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:9,代码来源:CommentsController.php
示例8: actionSendMail
public function actionSendMail()
{
if (!empty($_POST)) {
Yii::import('ext.yii-mail.YiiMailMessage');
$message = new YiiMailMessage();
$message->setBody($_POST['content']);
$message->subject = $_POST['subject'];
$message->from = $_POST['email'];
$message->to = Yii::app()->params['adminEmail'];
if (Yii::app()->mail->send($message)) {
$model = new Comments();
$model->title = $_POST['subject'];
$model->content = $_POST['content'];
$model->email = $_POST['email'];
$model->name = $_POST['fullName'];
$model->phone = $_POST['phone'];
$model->created = time();
if ($model->save()) {
return jsonOut(array('error' => false, 'message' => 'Cảm ơn bạn đã gửi thông tin, chúng tôi sẽ phản hồi cho bạn trong thời gian sớm nhất!'));
} else {
return json_encode(array('error' => true, 'message' => 'Lỗi hệ thống, gửi thông tin không thành công.'));
}
} else {
return json_encode(array('error' => true, 'message' => 'Gửi thông tin không thành công'));
}
}
}
开发者ID:phiphi1992,项目名称:fpthue,代码行数:27,代码来源:ContactController.php
示例9: indexAction
public function indexAction()
{
// Get, check and setup the parameters
if (!($widget_id = $this->getRequest()->getParam("id"))) {
throw new Stuffpress_Exception("No widget id provided to the widget controller");
}
// Verify if the requested widget exist and get its data
$widgets = new Widgets();
if (!($widget = $widgets->getWidget($widget_id))) {
throw new Stuffpress_Exception("Invalid widget id");
}
// Get the last comments
$comments = new Comments(array(Stuffpress_Db_Table::USER => $widget['user_id']));
$mycomments = $comments->getLastComments();
$data = new Data();
// Prepare the comments for output
foreach ($mycomments as &$comment) {
$time = strtotime($comment['timestamp']);
$item = $data->getItem($comment['source_id'], $comment['item_id']);
$comment['item'] = $item;
$comment['when'] = Stuffpress_Date::ago($time, "j M y");
$comment['comment'] = str_replace("\n", " ", $comment['comment']);
if (strlen($comment['comment']) > 50) {
$comment['comment'] = mb_substr($comment['comment'], 0, 47) . "...";
}
}
// Get the widget properties
$properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
$title = $properties->getProperty('title');
$this->view->title = $title ? $title : "Latest comments";
// Prepare the view for rendering
$this->view->comments = $mycomments;
}
开发者ID:kreativmind,项目名称:storytlr,代码行数:33,代码来源:LastcommentsController.php
示例10: deleteComment
public function deleteComment(Comments $comment)
{
/** @var myModel $this */
if (method_exists($this, 'decreaseCount')) {
$this->decreaseCount('commentCount');
}
return $comment->delete();
}
开发者ID:huoybb,项目名称:standard,代码行数:8,代码来源:commentableTrait.php
示例11: actionView
/**
* Вывод инфы о бане
* @param integer $id ID бана
*/
public function actionView($id)
{
// Подгружаем комментарии и файлы
$files = new Files();
//$this->performAjaxValidation($files);
$files->unsetAttributes();
$comments = new Comments();
$comments->unsetAttributes();
// Подгружаем баны
$model = Bans::model()->with('admin')->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
$geo = false;
// Проверка прав на просмотр IP
$ipaccess = Webadmins::checkAccess('ip_view');
if ($ipaccess) {
$geo = array('city' => 'Н/А', 'region' => 'Не определен', 'country' => 'Не определен', 'lat' => 0, 'lng' => 0);
$get = @file_get_contents('http://ipgeobase.ru:7020/geo?ip=' . $model->player_ip);
if ($get) {
$xml = @simplexml_load_string($get);
if (!empty($xml->ip)) {
$geo['city'] = $xml->ip->city;
$geo['region'] = $xml->ip->region;
$geo['country'] = $xml->ip->country;
$geo['lat'] = $xml->ip->lat;
$geo['lng'] = $xml->ip->lng;
}
}
}
// Добавление файла
if (isset($_POST['Files'])) {
// Задаем аттрибуты
$files->attributes = $_POST['Files'];
$files->bid = intval($id);
if ($files->save()) {
$this->refresh();
}
}
// Добавление комментария
if (isset($_POST['Comments'])) {
//exit(print_r($_POST['Comments']));
$comments->attributes = $_POST['Comments'];
$comments->bid = $id;
if ($comments->save()) {
$this->refresh();
}
}
// Выборка комментариев
$c = new CActiveDataProvider($comments, array('criteria' => array('condition' => 'bid = :bid', 'params' => array(':bid' => $id))));
// Выборка файлов
$f = new CActiveDataProvider(Files::model(), array('criteria' => array('condition' => 'bid = :bid', 'params' => array(':bid' => $id))));
// История банов
$history = new CActiveDataProvider('Bans', array('criteria' => array('condition' => '`bid` <> :hbid AND (`player_ip` = :hip OR `player_id` = :hid)', 'params' => array(':hbid' => $id, ':hip' => $model->player_ip, ':hid' => $model->player_id)), 'pagination' => array('pageSize' => 5)));
// Вывод всего на вьюху
$this->render('view', array('geo' => $geo, 'ipaccess' => $ipaccess, 'model' => $model, 'files' => $files, 'comments' => $comments, 'f' => $f, 'c' => $c, 'history' => $history));
}
开发者ID:urichalex,项目名称:CS-Bans,代码行数:61,代码来源:BansController.php
示例12: saveCommentTo
/**
* 这里可以作为一个通用的保存评论的方法来使用
* @param myModel $model
* @param $data
*/
protected function saveCommentTo(myModel $model, $data)
{
$comment = new Comments();
$comment->content = $data['content'];
$comment->commentable_id = $model->id;
$comment->commentable_type = get_class($model);
$comment->user_id = $this->auth->id;
$comment->save();
}
开发者ID:huoybb,项目名称:movie,代码行数:14,代码来源:myController.php
示例13: editCommentAction
public function editCommentAction(Sites $site, Comments $comment)
{
if ($this->request->isPost()) {
$comment->update($this->request->getPost());
$this->redirectByRoute(['for' => 'sites.show', 'site' => $site->id]);
}
$this->view->comment = $comment;
$this->view->form = myForm::buildCommentForm($site, $comment);
}
开发者ID:huoybb,项目名称:movie,代码行数:9,代码来源:SitesController.php
示例14: editCommentAction
public function editCommentAction(Episodes $episode, Comments $comment)
{
if ($this->request->isPost()) {
$comment->update($this->request->getPost());
return $this->redirectByRoute(['for' => 'movies.showEpisode', 'movie' => $episode->getMovie()->id, 'episode' => $episode->id]);
}
$this->view->comment = $comment;
$this->view->form = myForm::buildCommentForm($episode, $comment);
}
开发者ID:huoybb,项目名称:movie,代码行数:9,代码来源:EpisodesController.php
示例15: feature_home_pages
/**
* Computes the alternate homes for each feature
* (used in admin general template)
*
* @access public
* @return array of url's and labels of the alternate homepages
*/
function feature_home_pages($partial = false)
{
global $prefs, $tikilib, $commentslib;
$tikiIndex = array();
//wiki
$tikiIndex['tiki-index.php'] = tra('Wiki');
// Articles
if (!$partial && $prefs['feature_articles'] == 'y') {
$tikiIndex['tiki-view_articles.php'] = tra('Articles');
}
// Blog
if (!$partial && $prefs['feature_blogs'] == 'y') {
if ($prefs['home_blog'] != '0') {
global $bloglib;
require_once 'lib/blogs/bloglib.php';
$hbloginfo = $bloglib->get_blog($prefs['home_blog']);
$home_blog_name = substr($hbloginfo['title'], 0, 20);
} else {
$home_blog_name = tra('Set blogs homepage first');
}
$tikiIndex['tiki-view_blog.php?blogId=' . $prefs['home_blog']] = tra('Blog:') . $home_blog_name;
}
// Image gallery
if (!$partial && $prefs['feature_galleries'] == 'y') {
if ($prefs['home_gallery'] != '0') {
$hgalinfo = $tikilib->get_gallery($prefs['home_gallery']);
$home_gal_name = substr($hgalinfo["name"], 0, 20);
} else {
$home_gal_name = tra('Set Image gal homepage first');
}
$tikiIndex['tiki-browse_gallery.php?galleryId=' . $prefs['home_gallery']] = tra('Image Gallery:') . $home_gal_name;
}
// File gallery
if (!$partial && $prefs['feature_file_galleries'] == 'y') {
$filegallib = TikiLib::lib('filegal');
$hgalinfo = $filegallib->get_file_gallery($prefs['home_file_gallery']);
$home_gal_name = substr($hgalinfo["name"], 0, 20);
$tikiIndex['tiki-list_file_gallery.php?galleryId=' . $prefs['home_file_gallery']] = tra('File Gallery:') . $home_gal_name;
}
// Forum
if (!$partial && $prefs['feature_forums'] == 'y') {
require_once 'lib/comments/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments();
}
if ($prefs['home_forum'] != '0') {
$hforuminfo = $commentslib->get_forum($prefs['home_forum']);
$home_forum_name = substr($hforuminfo['name'], 0, 20);
} else {
$home_forum_name = tra('Set Forum homepage first');
}
$tikiIndex['tiki-view_forum.php?forumId=' . $prefs['home_forum']] = tra('Forum:') . $home_forum_name;
}
// Custom home
$tikiIndex['tiki-custom_home.php'] = tra('Custom home');
return $tikiIndex;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:64,代码来源:global.php
示例16: addCommentBy
public function addCommentBy(Users $user, $data)
{
$comment = new Comments();
$comment->content = $data['content'];
$comment->commentable_id = $this->id;
$comment->commentable_type = get_class($this);
$comment->user_id = $user->id;
$comment->save();
return $this;
}
开发者ID:huoybb,项目名称:movie,代码行数:10,代码来源:commentableTrait.php
示例17: _install
function _install()
{
global $dbTiki;
require_once 'lib/comments/commentslib.php';
$comments = new Comments($dbTiki);
$data = $this->getData();
$this->replaceReferences($data);
$attConverter = new Tiki_Profile_ValueMapConverter(array('none' => 'att_no', 'everyone' => 'att_all', 'allowed' => 'att_perm', 'admin' => 'att_admin'));
$id = $comments->replace_forum(0, $data['name'], $data['description'], $data['enable_flood_control'], $data['flood_interval'], $data['moderator'], $data['mail'], $data['enable_inbound_mail'], $data['enable_prune_unreplied'], $data['prune_unreplied_max_age'], $data['enable_prune_old'], $data['prune_max_age'], $data['per_page'], $data['topic_order'], $data['thread_order'], $data['section'], $data['list_topic_reads'], $data['list_topic_replies'], $data['list_topic_points'], $data['list_topic_last_post'], $data['list_topic_author'], $data['enable_vote_threads'], $data['show_description'], $data['inbound_pop_server'], $data['inbound_pop_port'], $data['inbound_pop_user'], $data['inbound_pop_password'], $data['outbound_address'], $data['enable_outbound_for_inbound'], $data['enable_outbound_reply_link'], $data['outbound_from'], $data['enable_topic_smiley'], $data['enable_topic_summary'], $data['enable_ui_avatar'], $data['enable_ui_flag'], $data['enable_ui_posts'], $data['enable_ui_level'], $data['enable_ui_email'], $data['enable_ui_online'], $data['approval_type'], $data['moderator_group'], $data['forum_password'], $data['enable_password_protection'], $attConverter->convert($data['attachments']), $data['attachments_store'], $data['attachments_store_dir'], $data['attachments_max_size'], $data['forum_last_n'], $data['comments_per_page'], $data['thread_style'], $data['is_flat'], $data['list_att_nb'], $data['list_topic_last_post_title'], $data['list_topic_last_post_avatar'], $data['list_topic_author_avatar'], $data['forum_language']);
return $id;
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:11,代码来源:Forum.php
示例18: editCommentAction
public function editCommentAction(Tags $tag, Comments $comment)
{
if ($this->request->isPost()) {
$comment->update($this->request->getPost());
return $this->success();
}
$this->view->mytag = $tag;
$this->view->comment = $comment;
$this->view->form = myForm::buildCommentForm($tag, $comment);
// dd($this->view->form);
}
开发者ID:huoybb,项目名称:standard,代码行数:11,代码来源:TagsController.php
示例19: actionComment
public function actionComment()
{
$rows = Comments::model()->findAll();
$model = new Comments();
if (isset($_POST['Comments'])) {
$model->attributes = $_POST['Comments'];
if ($model->save()) {
$this->redirect($this->createUrl('pages/comment'));
}
}
$this->render('comment', array('rows' => $rows, 'model' => $model));
}
开发者ID:bashik,项目名称:empty,代码行数:12,代码来源:PagesController.php
示例20: _delete
/**
* Удалает комментарии о соискателе и его фото
*
* @return void
*/
public function _delete()
{
// Удаляем комменты о соискателе из БД
$Comments = new Comments();
$Comments->removeCommentsByApplicantId($this->id);
// Удаляем фото
$applicantId = $this->id;
$validator = new Zend_Validate_File_Exists($_SERVER['DOCUMENT_ROOT'] . '/public/images/photos/');
if ($validator->isValid($applicantId . '.jpg')) {
unlink($_SERVER['DOCUMENT_ROOT'] . '/public/images/photos/' . $this->id . '.jpg');
}
}
开发者ID:eugenzor,项目名称:zfhrtool,代码行数:17,代码来源:Applicant.php
注:本文中的Comments类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论