本文整理匯總了PHP中News::unsetAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::unsetAttributes方法的具體用法?PHP News::unsetAttributes怎麽用?PHP News::unsetAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類News
的用法示例。
在下文中一共展示了News::unsetAttributes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionIndex
public function actionIndex()
{
$model = new News();
$model->unsetAttributes();
$model->attributes = $this->aRequest('News');
$this->render('index', array('model' => $model));
}
示例2: actionNews
public function actionNews($slug = null)
{
if ($slug === null) {
$model = new News('search');
$model->unsetAttributes();
$model->isList = true;
$model->category_id = Yii::app()->request->getParam('category_id');
$this->render('news', array('model' => $model));
} else {
$model = $this->loadNews($slug);
$model->saveCounters(array('countViews' => 1));
// to memcache mb
$comment = new NewsComment();
if (isset($_POST['ajax']) && $_POST['ajax'] === 'newsComment-form') {
echo CActiveForm::validate($comment);
Yii::app()->end();
}
if (isset($_POST['NewsComment'])) {
$comment->attributes = $_POST['NewsComment'];
$comment->news_id = $model->id;
$comment->user_id = Yii::app()->user->id;
if ($comment->validate() && $comment->preSave()) {
$comment->unsetAttributes();
Yii::app()->user->setFlash('comment_success', true);
$this->redirect(array('/site/news', 'slug' => $model->slug, '#' => 'comments'));
}
}
$criteria = new CDbCriteria();
$criteria->compare('news_id', $model->id);
$criteria->order = '`id` ASC';
$comments = NewsComment::model()->findAll($criteria);
$this->render('news_inner', array('model' => $model, 'comment' => $comment, 'comments' => $comments));
}
}
示例3: actionIndex
public function actionIndex()
{
$model = new News('search');
$model->unsetAttributes();
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('index', array('model' => $model));
}
示例4: actionList
public function actionList()
{
$model = new News('search');
$model->unsetAttributes();
if(isset($_GET['News']))
$model->attributes=$_GET['News'];
Yii::app()->session['myurl'] = $this->createUrl('list');
$this->render('list',array('model'=>$model));
}
示例5: actionManage
public function actionManage()
{
$model = new News('search');
$model->unsetAttributes();
if (isset($_GET['News'])) {
$model->setAttributes($_GET['News']);
}
$this->render('manage', array('model' => $model));
}
示例6: actionIndex
public function actionIndex()
{
$model = new News('search');
$model->unsetAttributes();
if (isset($_GET['News'])) {
$model->setAttributes($_GET['News']);
}
$dataProvider = $model->search();
$this->render('//news/index', array('dataProvider' => $dataProvider, 'model' => $model));
}
示例7: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new News('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('admin', array('model' => $model));
}
示例8: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$model=new News('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['News']))
$model->attributes=$_GET['News'];
$this->render('index',array(
'model'=>$model,
));
}
示例9: actionIndex
public function actionIndex()
{
$this->pageName = Yii::t('NewsModule.default', 'MODULE_NAME');
$this->breadcrumbs = array($this->pageName);
$model = new News('search');
$model->unsetAttributes();
if (!empty($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('index', array('model' => $model));
}
示例10: actionIndex
public function actionIndex()
{
$this->layout = '//layouts/admin';
$this->pageTitle = 'Новости';
$this->breadcrumbs = array('Новости');
$model = new News('search');
$model->unsetAttributes();
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('index', array('model' => $model));
}
示例11: actionIndex
public function actionIndex()
{
$model = new News('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
$model->parent_id = $model->category_news_id;
$model->category_news_id = null;
dump($model->attributes, false);
}
$this->render('index', array('model' => $model));
}
示例12: actionIndex
public function actionIndex($id)
{
$catelog = CategoriesNews::model()->findByPk($id);
if ($catelog == null) {
throw new CHttpException('404', 'Không tìm thấy trang.');
}
$model = new News('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('index', array('model' => $model, 'catalog' => $catelog));
}
示例13: actionIndex
/**
* Manages all models.
*/
public function actionIndex($idTree = null, $organization = null)
{
if ($idTree != null && $organization != null) {
$allIfns = false;
if (!Tree::model()->exists('id=:id AND module=:module and organization=:organization', array(':id' => $idTree, ':module' => 'news', ':organization' => $organization))) {
throw new CHttpException(404, 'Страница не найдена.');
}
} else {
$allIfns = true;
}
$model = new News('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('index', array('model' => $model, 'idTree' => $allIfns ? CHtml::listData(Organization::model()->findAll('code<>:code', array(':code' => '8600')), 'code', 'code') : $idTree, 'organization' => $organization, 'allIfns' => $allIfns));
}
示例14: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
if ($this->menu_use[3]) {
$model = new News('searchInSide');
$news_type_list = array();
$criteria = new CDbCriteria();
$criteria->condition = 'status=:status AND news_type_id=5';
$criteria->params = array(':status' => 1);
$criteria->order = 'sort_order';
$news_type = NewsGroup::model()->findAll($criteria);
foreach ($news_type as $type) {
$news_type_list[$type->news_group_id] = $type->name_th;
}
$model->unsetAttributes();
// clear any default values
if (isset($_GET['News'])) {
$model->attributes = $_GET['News'];
}
$this->render('admin', array('model' => $model, 'news_type_list' => $news_type_list));
} else {
$this->redirect(array('site/index'));
}
}
示例15: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
if(Yii::app()->user->checkAccess('admin')){
$model=new News('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['News']))
$model->attributes=$_GET['News'];
$this->render('admin',array(
'model'=>$model,
));
} else {
$this->redirect('/admin/user/login');
}
}