public function actionIndex() { $this->pageTitle = 'Фотографии'; $model = new OrgsImages('search'); $model->unsetAttributes(); // clear any default values if(isset($_GET['OrgsImages'])) $model->attributes=$_GET['OrgsImages']; $dataProvider = $model->search(); $dataProvider->pagination->pageSize = 25; $this->render('index',array( 'model'=>$model, 'model_search'=>$dataProvider )); }
<?php $src = Yii::app()->createAbsoluteUrl('/file/file/company',array('id'=>$data->id)); echo CHtml::link(CHtml::image($src,'',array('style'=>'width:155px;height:auto;')), $src ,array('data-lightbox'=>'lb-'.$data->id)); OrgsImages::model()->updateByPk($data->id,array('verified'=>1)); ?>
protected function beforeDelete(){ if(!parent::beforeDelete()) return false; OrgsImages::model()->updateAll(array('uploaded_by'=>null),array('condition'=>'uploaded_by='.$this->id)); Orgs::model()->updateAll(array('author'=>null),array('condition'=>'author='.$this->id)); $this->deleteModelDir(); // удалили модель? удаляем и файл и всю папку return true; }