protected function printViewContent() { ?> <a href="/portal/gallery/<?php echo $this->gallery->UniqueIdentifier; ?> /"> <div class="gallery-overlay"> <p> <?php $images = Image::find(new Equals('GalleryID', $this->gallery->UniqueIdentifier))->calculateAggregates(new Count('ImageID'))[0]; $imgText = $images == 1 ? "bilde" : "bildes"; print $images . ' ' . $imgText; ?> </p> </div> </a> <a href="/portal/gallery/<?php echo $this->gallery->UniqueIdentifier; ?> /"><p class="gallery-title"><?php echo htmlspecialchars($this->gallery->Title); ?> </p></a> <a href="/portal/gallery/<?php echo $this->gallery->UniqueIdentifier; ?> /"><img style="width: 100%; height: 100%;" src="<?php echo $this->gallery->getDefaultImage(); ?> "></a> <?php }
protected function beforeDelete() { parent::beforeDelete(); foreach (Image::find(new Equals('GalleryID', $this->UniqueIdentifier)) as $image) { $image->delete(); } }
public function createPresenters() { parent::createPresenters(); $model = $this->raiseEvent('GetRestModel'); $slideView = new ImageCommentsPanorama(Image::find(new Equals('GalleryID', $model->GalleryID))->addSort('Order'), 'SlideView'); $this->addPresenters($slideView); }
protected function printViewContent() { parent::printViewContent(); $html = new HtmlPageSettings(); $html->PageTitle = 'Pievienot vēl bildes galerijā'; ?> <div class="__container"> Bildes jau galerijā<br> <div id="image-orders" class="serialization"> <?php $images = Image::find(new Equals('GalleryID', $this->getData('GalleryID')))->addSort('Order'); foreach ($images as $image) { print '<div class="image-existing-container" iiid="' . $image->ImageID . '"><a href="" class="delete-image"><i class="fa fa-minus-circle"></i></a><img iiid="' . $image->ImageID . '" src="' . $image->getThumbnail() . ' "></div>'; } ?> </div> <div class="__clear-floats"></div> </div> <?php }
public static function checkRecords($oldVersion, $newVersion) { parent::checkRecords($oldVersion, $newVersion); if ($newVersion == 2) { foreach (Gallery::find() as $gallery) { $i = 0; foreach (Image::find(new Equals('GalleryID', $gallery->GalleryID)) as $image) { $image->Order = $i++; $image->save(); } } } }