/**
  * 管理 等级
  */
 function actionLevel()
 {
     $this->_pathway->addStep('浏览等级管理');
     if ($this->_context->isPOST()) {
         foreach ($_POST['id'] as $key => $value) {
             if (!isset($_POST['chk']) || !in_array($value, $_POST['chk'])) {
                 $arr = array('id' => $value, 'name' => $_POST['name'][$key], 'description' => $_POST['description'][$key], 'weight' => $_POST['weight'][$key], 'enabled' => $_POST['enabled'][$key]);
                 try {
                     $level = Levels::find()->getById($_POST['id'][$key]);
                     $level->changeProps($arr);
                     $level->save();
                 } catch (QDB_ActiveRecord_ValidateFailedException $ex) {
                 }
             }
         }
         if (isset($_POST['chk'])) {
             //Levels::meta()->destroyWhere("id in (?) and id > 5",$_POST['chk']);
             Levels::meta()->deleteWhere("id in (?) and id > 5", $_POST['chk']);
         }
     }
     // 分页查询内容列表
     $page = intval($this->_context->page);
     if ($page < 1) {
         $page = 1;
     }
     $select = Levels::find()->order('weight desc');
     $select->limitPage($page, 10);
     // 将分页信息和查询到的数据传递到视图
     $this->_view['pagination'] = $select->getPagination();
     $this->_view['levels'] = $select->getAll();
 }