/** * 录入 * */ public function actionCreate() { parent::_acl(); $model = new Post(); $attr = $this->_gets->getPost('attr'); $imageList = $this->_gets->getPost('imageList'); $imageListSerialize = XUtils::imageListSerialize($imageList); if (isset($_POST['Post'])) { $style = $this->_gets->getPost('style'); $acl = $this->_gets->getPost('acl'); $styleFormat = XUtils::titleStyle($style); $file = XUpload::upload($_FILES['attach'], array('thumb' => true, 'thumbSize' => array(400, 250))); $model->attributes = $_POST['Post']; if (is_array($file)) { $model->attach_status = 'Y'; $model->attach_file = $file['pathname']; $model->attach_thumb = $file['paththumbname']; } $model->title_style = $styleFormat['text']; $model->title_style_serialize = $styleFormat['serialize']; $model->acl = is_array($acl) ? implode(',', $acl) : ''; $model->image_list = $imageListSerialize['dataSerialize']; if ($model->save()) { Attr::create($model->id, $attr); Post2tags::build('create', $_POST['Post']['tags'], $model->id, $model->catalog_id); AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id)); $this->redirect(array('index')); } } $attrData = Attr::dataReset($attr); $attrModel = Attr::lists($model->catalog_id, 'post'); $this->render('create', array('model' => $model, 'imageList' => $imageListSerialize['data'], 'attrModel' => $attrModel, 'attrData' => $attrData)); }