</div> </div> <?php } ?> <div class="interior"> <p><?php echo Localization::translate('shop_decor', $this->lang); ?> </p> <?php $criteria = new CDbCriteria(); $criteria->condition = "id_boutique=:id"; $criteria->params = array(":id" => $model->id); $img = BoutiqueImages::model()->findAll($criteria); if (!empty($img)) { foreach ($img as $item) { ?> <a href="<?php echo $item->src; ?> " class="interior-img fancybox" rel="gallery"><img width="110" height="110" src="<?php echo $item->small_src; ?> " alt="Картинка"></a> <?php } } else {
public function actionDeleteGallery() { $success = false; $id = $_REQUEST['id']; if (is_numeric($id)) { $model = BoutiqueImages::model()->findByPk($id); if (is_object($model)) { $src = Yii::app()->basePath . "/.." . $model->src; if ($model->delete()) { $success = true; if (is_file($src)) { unlink($src); } } } } echo json_encode(array('status' => $success ? 'success' : 'fail')); }