public function actionPageGalleryImage($recordType = 'ContactPageGallery', $recordId = 1) { $title = 'Contact page gallery'; $modelName = 'PageGalleryImage'; $criteria = new CDbCriteria(); $criteria->compare('recordId', $recordId, false, 'AND', false); $criteria->compare('recordType', $recordType, false, 'AND', false); $criteria->order = "displayOrder ASC"; $galleryImages = PageGalleryImage::model()->findAll($criteria); if (isset($_POST) && $_POST) { $uploadedFiles = CUploadedFile::getInstancesByName($modelName); if ($uploadedFiles) { foreach ($uploadedFiles as $fileKey => $fileVal) { $file = new $modelName(); $file->file = $fileVal; $file->recordId = $recordId; $file->recordType = $recordType; $file->save(); } $this->redirect('PageGalleryImage'); } } $this->render('_pageGalleryImage', ['galleryImages' => $galleryImages, 'title' => $title, 'recordType' => $recordType, 'recordId' => $recordId]); }
<?php /** * @var $this SiteController * */ /** @var $isMobile \Device */ $isMobile = Yii::app()->device->isDevice('mobile'); $this->pageTitle = 'Contacts'; /** @var $offices Office[] */ $offices = Office::model()->with(array("branches" => array('condition' => "bra_status = 'Active' AND business_unit is not null AND business_unit > 0")))->findAll(); $pageGalleryImages = PageGalleryImage::model()->officePhotos()->findAll(); $imagePath = Yii::app()->params['imgUrl'] . "/ContactPageGallery/1/"; ?> <div class="detail-box-listings contact-page"> <?php if ($pageGalleryImages) { ?> <div class="slider-container"> <div class="slider"> <?php foreach ($pageGalleryImages as $key => $pageGalleryImage) { $fullThumbImagePath = $imagePath . $pageGalleryImage->fullName; $fullOrgImagePath = $imagePath . $pageGalleryImage->name; ?> <div class="item item<?php echo $key; ?> "> <a href="<?php