/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { //获取原node $model = $this->loadModel($id); //获取catalog表单 $model = $this->loadModel($id); $model->scenario = 'update'; $beforeModel = $model; $beforeParent = NULL; $beforeParent = $model->getParent()->id; $model->parent = $beforeParent; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Catalog'])) { $model->attributes = $_POST['Catalog']; $thumbUpload = CUploadedFile::getInstance($model, 'thumb_file'); if (!empty($thumbUpload)) { $model->thumb = Fircms::createFile($thumbUpload, 'thumb', 'update', $model->thumb, array(Yii::app()->config->get('thumbWidth'), Yii::app()->config->get('thumbHeight'))); } // 不等于自身id 不等于当前父节点 if ($model->parent != $model->id && $model->parent != $beforeParent) { //不允许是自身的子节点 if (!$this->loadModel($model->parent)->isDescendantOf($beforeModel)) { @$model->moveAsLast($this->loadModel($model->parent)); } } if ($model->saveNode()) { $this->redirect(array('admin')); } } $this->render('update', array('model' => $model)); }
public function getPageViews() { if ($this->_pageViews === NULL) { return Fircms::getViews('page'); } else { return $this->_pageViews; } }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Page'])) { $model->attributes = $_POST['Page']; $thumbUpload = CUploadedFile::getInstance($model, 'thumb_file'); if (!empty($thumbUpload)) { $model->thumb = Fircms::createFile($thumbUpload, 'thumb', 'update', $model->thumb, array(Yii::app()->config->get('thumbWidth'), Yii::app()->config->get('thumbHeight'))); } if ($model->save()) { $this->redirect(array('admin')); } } $this->render('update', array('model' => $model)); }
<?php /* @var $this Controller */ $this->beginContent('application.modules.admin.views.layouts.main'); ?> <div class="container-fluid" style="padding: 70px;"> <div class="row-fluid"> <div class="span2"> <?php $user_imgUrl = Fircms::formatUserImg(User::model()->findByPk(Yii::app()->user->id)->img); ?> <?php $this->widget('bootstrap.widgets.TbNav', array('type' => TbHtml::NAV_TYPE_TABS, 'encodeLabel' => false, 'stacked' => true, 'items' => array(array('label' => CHtml::image($user_imgUrl, '', array('width' => 80, 'height' => 80)) . Yii::app()->user->name, 'url' => array('/admin/default')), array('label' => "短信息", 'url' => array('/admin/message/index'), 'visible' => !Yii::app()->user->isGuest)))); ?> <?php $this->widget('bootstrap.widgets.TbNav', array('type' => TbHtml::NAV_TYPE_TABS, 'stacked' => true, 'items' => array(array('label' => '系统信息', 'url' => array('/admin/default/index'), 'action' => $this->id == 'default'), array('label' => '基本配置', 'url' => '#'), array('label' => '文件管理', 'url' => array('/admin/upload/admin')), array('label' => '参数管理', 'url' => array('/admin/config/admin')), array('label' => '信息管理', 'url' => array('/admin/message/admin')), array('label' => '模块管理', 'url' => array('/admin/plus/admin')), array('label' => '权限管理', 'url' => array('/auth')), array('label' => '用户管理', 'url' => array('/admin/user/admin'))))); ?> <!-- sidebar --> </div> <div class="span10"> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => $this->breadcrumbs, 'homeLabel' => '首页', 'homeUrl' => $this->createUrl('/admin'))); ?> <!-- breadcrumbs -->
public function orUser_imgLookup() { if ($this->from_user_id != Yii::app()->user->id) { $user_img = $this->from_user->img; } else { $user_img = $this->from_user->img; } return Fircms::formatUserImg($user_img); }