本文整理汇总了PHP中Comment::getStatuses方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::getStatuses方法的具体用法?PHP Comment::getStatuses怎么用?PHP Comment::getStatuses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::getStatuses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdateStatus
public function actionUpdateStatus()
{
$ids = Yii::app()->request->getPost('ids');
$status = Yii::app()->request->getPost('status');
$models = Comment::model()->findAllByPk($ids);
if (!array_key_exists($status, Comment::getStatuses())) {
throw new CHttpException(404, Yii::t('CommentsModule.admin', 'Ошибка проверки статуса.'));
}
if (!empty($models)) {
foreach ($models as $comment) {
$comment->status = $status;
$comment->save();
}
}
echo Yii::t('CommentsModule', 'Статус успешно изменен');
}
示例2: array
<div class="col-md-11 col-sm-10">
<?php echo $form->textArea($model, 'text',
array(
'class'=>'form-control',
'rows'=>5,
'placeholder'=>'Отзыв'
));
?>
</div>
</div> <!-- / .form-group -->
<div class="form-group">
<?php echo $form->label($model, 'status', array('class'=>'col-md-1 col-sm-2 control-label')); ?>
<div class="col-md-11 col-sm-10">
<?php
echo $form->dropDownList($model, 'status', Comment::getStatuses(), array(
'encode'=>false,
// 'empty'=>'Выбрать',
'class'=>'form-control',
));
?>
</div>
</div>
<div style="margin-bottom: 0;" class="form-group">
<div class="col-md-offset-1 col-md-11 col-sm-offset-2 col-sm-10">
<button class="btn btn-primary" type="submit"><?php echo $model->isNewRecord ? 'Создать' : 'Сохранить'; ?></button>
示例3: Comment
<?php
/**
* Product comments
*
* @var $model StoreProduct
*/
Yii::import('comments.models.Comment');
$module = Yii::app()->getModule('comments');
$comments = new Comment('search');
if (!empty($_GET['Comment'])) {
$comments->attributes = $_GET['Comment'];
}
$comments->class_name = 'application.modules.store.models.StoreProduct';
$comments->object_pk = $model->id;
// Fix sort url
$dataProvider = $comments->search();
$dataProvider->pagination->pageSize = Yii::app()->settings->get('core', 'productsPerPageAdmin');
$dataProvider->sort->route = 'applyCommentsFilter';
$dataProvider->pagination->route = 'applyCommentsFilter';
$this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'id' => 'productCommentsListGrid', 'filter' => $comments, 'ajaxUrl' => Yii::app()->createUrl('/store/admin/products/applyCommentsFilter', array('id' => $model->id)), 'enableHistory' => false, 'columns' => array(array('class' => 'CCheckBoxColumn'), array('class' => 'SGridIdColumn', 'name' => 'id'), array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), array("/comments/admin/comments/update", "id"=>$data->id))'), array('name' => 'email'), array('name' => 'text', 'value' => 'Comment::truncate($data, 100)'), array('name' => 'status', 'filter' => Comment::getStatuses(), 'value' => '$data->statusTitle'), array('name' => 'created'), array('class' => 'CButtonColumn', 'updateButtonUrl' => 'Yii::app()->createUrl("/comments/admin/comments/update", array("id"=>$data->id))', 'deleteButtonUrl' => 'Yii::app()->createUrl("/comments/admin/comments/delete", array("id"=>$data->id))', 'template' => '{update}{delete}'))));
示例4: array
/* array(
'name' => 'name',
'type' => 'raw',
'value' => 'CHtml::link(CHtml::encode($data->name), array("update", "id"=>$data->id))',
),
array(
'name'=>'email',
), */
array(
'header' => 'Отзыв',
'name'=>'text',
// 'value'=>'Comment::truncate($data, 100)'
),
array(
'name'=>'status',
'filter'=>Comment::getStatuses(),
'value'=>'$data->statusTitle',
),
array(
'header' => 'Объект',
'type'=>'raw',
'value'=>'CHtml::link($data->getOwner_title(), $data->getViewUrlAdmin(), array("target"=>"_blank"))',
'filter'=>false
),
array(
'header' => 'Дата',
'name'=>'created',
'filter'=>false
示例5: array
<?php
/**
* Display comments list
*
* @var $model Comment
**/
Yii::app()->clientScript->registerScriptFile($this->module->assetsUrl . '/admin/comments.index.js');
$this->pageHeader = Yii::t('CommentsModule.core', 'Комментарии');
$this->breadcrumbs = array('Home' => $this->createUrl('/admin'), Yii::t('CommentsModule.core', 'Комментарии'));
$this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'id' => 'commentsListGrid', 'filter' => $model, 'customActions' => array(array('label' => Yii::t('CommentsModule.core', 'Подтвержден'), 'url' => '#', 'linkOptions' => array('onClick' => 'return setCommentsStatus(1, this);')), array('label' => Yii::t('CommentsModule.core', 'Ждет одобрения'), 'url' => '#', 'linkOptions' => array('onClick' => 'return setCommentsStatus(0, this);')), array('label' => Yii::t('CommentsModule.core', 'Спам'), 'url' => '#', 'linkOptions' => array('onClick' => 'return setCommentsStatus(2, this);'))), 'columns' => array(array('class' => 'CCheckBoxColumn'), array('class' => 'SGridIdColumn', 'name' => 'id'), array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), array("update", "id"=>$data->id))'), array('name' => 'email'), array('name' => 'text', 'value' => 'Comment::truncate($data, 100)'), array('name' => 'status', 'filter' => Comment::getStatuses(), 'value' => '$data->statusTitle'), array('name' => 'owner_title', 'filter' => false), 'ip_address', array('name' => 'created'), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
示例6: array
<?php
/**
* Comment form
*/
Yii::import('zii.widgets.jui.CJuiDatePicker');
return array('id' => 'commentUpdateForm', 'elements' => array('tab1' => array('type' => 'form', 'title' => '', 'elements' => array('status' => array('type' => 'dropdownlist', 'items' => Comment::getStatuses()), 'name' => array('type' => 'text'), 'email' => array('type' => 'text'), 'text' => array('type' => 'textarea', 'style' => 'height:200px'), 'created' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s'))), 'updated' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')))))));