/** * * build a single page gallery display of albums and images within them * @see perch_gallery_album * @param string $template_album * @param string $template_listing * @param string $template_image * @param bool $return */ function perch_gallery_build($opts = array(), $return = false) { $default_opts = array('template' => 'b_static_list_image.html', 'skip-template' => false); $opts = array_merge($default_opts, $opts); if ($opts['skip-template']) { $return = true; } $API = new PerchAPI(1.0, 'perch_gallery'); $Albums = new PerchGallery_Albums($API); $list = $Albums->return_all(); if ($opts['skip-template']) { $out = array(); foreach ($list as $Album) { $out[] = perch_gallery_album_images($Album->albumSlug(), $opts, true); } return $out; } $r = false; $Template = $API->get('Template'); if (PerchUtil::count($list) > 0) { foreach ($list as $Album) { $r .= perch_gallery_album_images($Album->albumSlug(), $opts, true); } } if ($return) { return $r; } echo $r; }
public function render_inputs($details = array()) { if (!class_exists('PerchGallery_Albums')) { require_once PerchUtil::file_path(PERCH_PATH . '/addons/apps/perch_gallery/PerchGallery_Albums.class.php'); require_once PerchUtil::file_path(PERCH_PATH . '/addons/apps/perch_gallery/PerchGallery_Album.class.php'); } $id = $this->Tag->input_id(); $val = ''; if (isset($details[$id]) && $details[$id] != '') { $json = $details[$id]; $val = $json['albumSlug']; } $API = new PerchAPI(1, 'perch_gallery'); $Albums = new PerchGallery_Albums($API); $albums = $Albums->return_all(); $opts = array(); $opts[] = array('label' => '', 'value' => ''); if (PerchUtil::count($albums)) { foreach ($albums as $Album) { $opts[] = array('label' => $Album->albumTitle(), 'value' => $Album->albumSlug()); } } if (PerchUtil::count($opts)) { $s = $this->Form->select($id, $opts, $val); } else { $s = '-'; } return $s; }
<?php include 'PerchGallery_Albums.class.php'; include 'PerchGallery_Album.class.php'; include 'PerchGallery_Images.class.php'; include 'PerchGallery_Image.class.php'; include 'PerchGallery_ImageVersions.class.php'; include 'PerchGallery_ImageVersion.class.php'; $API = new PerchAPI(1.0, 'perch_gallery'); $Lang = $API->get('Lang'); $Albums = new PerchGallery_Albums($API); $albums = $Albums->return_all(); $Images = new PerchGallery_Images($API); $images = $Images->get_recent_for_dashboard(5); ?> <div class="widget"> <h2> <?php echo $Lang->get('Gallery'); ?> <a href="<?php echo PerchUtil::html(PERCH_LOGINPATH . '/addons/apps/perch_gallery/edit/'); ?> " class="add button"><?php echo $Lang->get('Add Album'); ?> </a> </h2> <div class="bd"> <?php if (PerchUtil::count($images)) {
<?php $HTML = $API->get('HTML'); $GalleryAlbums = new PerchGallery_Albums($API); $Form = $API->get('Form'); if ($Form->submitted()) { $items = $Form->find_items('a-'); if (PerchUtil::count($items)) { foreach ($items as $albumID => $albumOrder) { $Album = $GalleryAlbums->find($albumID); if (is_object($Album)) { $data = array('albumOrder' => $albumOrder); $Album->update($data); } } $Alert->set('success', $Lang->get('Album orders successfully updated.')); } } $albums = $GalleryAlbums->return_all();