function execute(CommandContext $context) { $albumMapper = RequestRegistry::getAlbumMapper(); $imageMapper = RequestRegistry::getImageMapper(); $album = $context->get('album'); $images = $album->getImages(); foreach ($images as $image) { $imageMapper->delete($image); } $albumMapper->delete($album); return; }
function execute(CommandContext $context) { $albumMapper = RequestRegistry::getAlbumMapper(); $album = null; if ($context->get('album-id') != null) { $album = $albumMapper->find($context->get('album-id')); } if ($context->get('album-slug') != null) { $album = $albumMapper->findBySlug($context->get('album-slug')); } if ($album === null) { $error = "Album Not Found, Check that you've sent 'album-id' or 'album-slug' in the command context, and that it's a valid slug/id"; throw new Exception($error); } $context->addParam('album', $album); return; }
function gallery_grid() { $albums = RequestRegistry::getAlbumMapper()->findAllLiveAlbumsForPeriod($this->content['period']); $cell_counter = 0; $grid = "<table id='gallery-grid'>\n"; $grid .= "<tr>\n"; foreach ($albums as $album) { if (!$album->hasImages()) { continue; } $image = $album->getFeaturedImage(); $cell_counter++; $grid .= "<td><a href='{$this->url($album)}'><img src='{$image->getSource()}' /></a><br /><span class='gallery-caption'>{$album->getTitle()}</span></td>\n"; if ($cell_counter % 3 == 0) { $grid .= "\n</tr>\n<tr>\n"; } } $grid .= "</tr>\n"; $grid .= "</table>"; return $grid; }
function sidebar() { $album = $this->content; //Archive Albums Links List $this_year = date('Y'); $last_year = $this_year - 1; $year_before_last = $last_year - 1; $this_month = date('F'); $last_month = date('F', mktime(0, 0, 0, date('n') - 1, 1, date('Y'))); $month_before_last = date('F', mktime(0, 0, 0, date('n') - 2, 1, date('Y'))); $archive_array = array($this_month, $last_month, $month_before_last, $this_year, $last_year, $year_before_last); $archive_section = "<div class='sidebar-links-title'>\n" . "<p>Gallery Archive</p>\n" . "</div>\n" . "<ul class='sidebar-links-list'>\n"; foreach ($archive_array as $period) { $lower_period = strtolower($period); if (!RequestRegistry::getAlbumMapper()->albumsExistForPeriod($lower_period)) { continue; } $content = array('type' => 'gallery/archive', 'period' => $lower_period); $archive_section .= "<li>" . "<a href='{$this->url($content)}'>{$period}</a></li>\n"; } $archive_section .= "</ul>\n"; //Recent Albums Link List $five_recent_albums = RequestRegistry::getAlbumMapper()->findFiveMostRecentLiveAlbums(); $recent_section = "<div class='sidebar-links-title'>\n" . "<p>Recent Galleries</p>\n" . "</div>\n" . "<ul class='sidebar-links-list'>\n"; foreach ($five_recent_albums as $album) { if (!$album->hasImages()) { continue; } $recent_section .= "<li><a href='{$this->url($album)}'>{$album->getTitle()}</a></li>\n"; } $recent_section .= "</ul>\n"; $sidebar = "<div id='sidebar'>\n"; $sidebar .= $recent_section . $archive_section; $sidebar .= "</div>\n"; return $sidebar; }
function execute(CommandContext $context) { $album = $context->get('album'); $albumMapper = RequestRegistry::getAlbumMapper(); $albumMapper->insert($album); }
public function execute(CommandContext $context) { $albumMapper = RequestRegistry::getAlbumMapper(); $albumMapper->update($context->get('album')); return; }
function execute(CommandContext $context) { $context->addParam('albums', RequestRegistry::getAlbumMapper()->findAllAlbumsForIndex()); }
<?php include '../init.php'; $formHelper = RequestRegistry::getFormHelper(); $albums = RequestRegistry::getAlbumMapper()->findAll(); $_REQUEST['album-id'] = isset($_GET['album-id']) ? $_GET['album-id'] : 1; $context = CommandRunner::run('get-album'); $thisAlbum = $context->get('album'); $editNewsHref = $thisAlbum->getNewsId() == 0 ? '#' : "/admin/list-news.php?newsevent-id={$thisAlbum->getNewsId()}"; $editEventHref = $thisAlbum->getEventId() == 0 ? '#' : "/admin/list-events.php?newsevent-id={$thisAlbum->getEventId()}"; $images = $thisAlbum->getImages(); include '../inc/doctype.php'; ?> <html> <head> <title>Immanuel College Admin Panel</title> <link rel='stylesheet' type='text/css' href='css/style.css' /> <script type='text/javascript' src='js/jquery-1.3.2.min.js'></script> <script type='text/javascript' src='js/generic-functions.js'></script> <script type='text/javascript' src='js/font/cufon-yui.js'></script> <script type='text/javascript' src='js/font/Sanuk-Black_500.font.js'></script> <script type='text/javascript' src='js/font/Sanuk-Regular_500.font.js'></script> <script type="text/javascript"> Cufon.replace('h1', { fontFamily: 'Sanuk-Black'}); Cufon.replace('li.page-nav-link>a', { fontFamily: 'Sanuk-Black'}); Cufon.replace('li.nav-link>a', { fontFamily: 'Sanuk-Black'}); Cufon.replace('div#home-show-links a', { fontFamily: 'Sanuk-Black'}); var album_id = <?php echo $thisAlbum->getId(); ?>