コード例 #1
0
 public function __construct($id = NULL)
 {
     parent::__construct();
     if ($id != NULL and (ctype_digit($id) or is_int($id))) {
         // try and get a row with this ID
         $data = $this->db->getwhere($this->table_name, array('id' => $id))->result(FALSE);
         // try and assign the data
         if (count($data) == 1 and $data = $data->current()) {
             foreach ($data as $key => $value) {
                 $this->data[$key] = $value;
             }
         }
     } else {
         if ($id != NULL and is_string($id)) {
             // try and get a row with this username/email
             $data = $this->db->orwhere(array('url_name' => $id))->get($this->table_name)->result(FALSE);
             // try and assign the data
             if (count($data) == 1 and $data = $data->current()) {
                 foreach ($data as $key => $value) {
                     $this->data[$key] = $value;
                 }
             }
         }
     }
 }
コード例 #2
0
 public function delete()
 {
     if ($this->delete_file()) {
         return parent::delete();
     }
     return FALSE;
 }
コード例 #3
0
 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');
 }
コード例 #4
0
 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');
 }
コード例 #5
0
<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 
    }
    ?>
コード例 #6
0
 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>');
     }
 }