public function index() { javascript::add(array('jquery.colorbox', 'photo_effects')); stylesheet::add(array('colorbox', 'colorbox-custom', 'photo_gallery')); $this->template->title = $this->template->heading = 'Photo Gallery'; $this->template->content = new View('album/index'); $this->template->content->albums = Auto_Modeler_ORM::factory('album')->fetch_all('album_order'); }
public function delete($album_url, $photo) { $photo = new Photo_Model($album_url . '/' . $photo); if (!$photo->id) { Event::run('system.404'); } if (isset($_POST['confirm'])) { $photo->replace_order($photo, 'down'); $url = Auto_Modeler_ORM::factory('album', $photo->album_id)->url_name; $photo->delete(); url::redirect('album/view/' . $url); } elseif (isset($_POST['cancel'])) { url::redirect('album/view/' . Auto_Modeler_ORM::factory('album', $photo->album_id)->url_name); } $this->template->content = View::factory('admin/confirm'); }
<ul id="album_list"> <?php foreach ($albums as $album) { ?> <?php $photos = $album->find_related('photos', array(), 'order'); $photo = count($photos) ? $photos->current() : Auto_Modeler_ORM::factory('photo'); ?> <li> <div class="album"> <?php echo html::anchor('album/view/' . $album->url_name, html::image('photo/thumbnail/' . $album->url_name . '/' . $photo->photo_filename, $album->url_name, TRUE)); ?> <br /> <div class="album_caption"> <?php echo $album->album_name; ?> <?php if (Auth::instance()->logged_in('admin')) { ?> <br /> <?php echo html::anchor('admin/album/edit/' . $album->id, html::image('images/fam_silk/wrench_orange.png', array('alt' => 'Edit', 'title' => 'Edit'))); ?> <?php echo html::anchor('admin/album/delete/' . $album->id, html::image('images/fam_silk/cross.png', array('alt' => 'Delete', 'title' => 'Delete'))); ?> <?php } ?>
public function reorder_process() { if (Session::instance()->get('image_csrf', NULL) == $this->input->get('csrf_token', '')) { Auto_Modeler_ORM::factory('photo')->batch_reorder($_GET['photo']); die('<p>Reorder Successful!</p>'); } else { die('<p>Unexpected Error Occurred. Please Try Again.</p>'); } }