Exemple #1
0
 /**
  * 内容模型管理
  */
 public function indexAction($page = null)
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         //保存修改
         if (!is_array($_POST['Model']['content_model_rank'])) {
             $_POST['Model']['content_model_rank'] = array();
         }
         foreach ($_POST['Model']['content_model_rank'] as $_k => $_v) {
             $flag = Yii::app()->db->createCommand()->update('{{content_model}}', array('content_model_rank' => $_POST['Model']['content_model_rank'][$_k] ? intval($_POST['Model']['content_model_rank'][$_k]) : 255, 'content_model_lasttime' => $_SERVER['REQUEST_TIME']), 'content_model_id=:content_model_id', array(':content_model_id' => $_k));
             if ($flag) {
                 //记录操作日志
                 $message = '{user_name}修改了内容模型({model_name})排序';
                 $data = array('user_id' => Yii::app()->user->id, 'user_name' => Yii::app()->user->name, 'model_name' => ContentModel::get_model_name_by_id($_k), 'addons_data' => $_POST);
                 AdminLogs::add(Yii::app()->user->id, 'Content/Model', $_k, 'Modify', 'success', $message, $data);
             }
         }
         ContentModel::update_cache();
         //$this->refresh();
         $this->redirect[] = array('text' => '', 'href' => '/content/model/index');
         $this->message('修改内容模型完成', self::MSG_SUCCESS, true);
     }
     $this->getView()->assign(array('models' => ContentModelModel::inst()->getModelsByCache()));
 }