Ejemplo n.º 1
0
 /**
  * Управление галереями.
  *
  * @return void
  */
 public function actionIndex()
 {
     $model = new Gallery('search');
     $model->unsetAttributes();
     // clear any default values
     $model->setAttributes(Yii::app()->getRequest()->getParam('Gallery', []));
     $this->render('index', ['model' => $model]);
 }
Ejemplo n.º 2
0
 public function actionAddimage()
 {
     if ($this->access > UserAccessTable::FULL_ACCESS) {
         return 0;
     }
     $fileid = $_POST['fileid'];
     $propertyid = $property_id = Yii::app()->user->getState('property_id');
     $images = $this->getImages();
     $index = count($images) + 1;
     $primary = 0;
     $model = new Gallery();
     $model->setAttributes(array('propertyid' => $propertyid, 'index' => $index, 'primary' => $primary, 'fileid' => $fileid));
     $result = $model->save();
     $resultData = array();
     if ($result) {
         $resultData = $model->getAttributes();
         $resultData['file'] = $model->file->getAttributes();
     }
     echo json_encode(array('result' => $result, 'data' => $resultData));
     die;
 }