File: /home/awaldron/www/archive/ras/application/controllers/gallery.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Gallery extends CI_Controller {
public function index() {
redirect('/gallery/view');
$data['page_title'] = "Photo Galleries";
$data['tab_on'] = "gallery";
$data['slider'] = false;
$data['split'] = false;
$data['splash'] = 'splash-family'.rand(1,3).'.jpg';
$this->load->view('v_page_head',$data);
$this->load->view('vGallery');
$this->load->view('v_page_foot');
}
public function view( $gallery = 'custom_homes' )
{
$data['page_title'] = "Photo Galleries";
$data['tab_on'] = "gallery";
$data['slider'] = false;
$data['split'] = false;
switch ( $gallery ) {
case 'custom_homes' :
$gal_ids = explode(',', G_CUSTOM_HOMES) ;
$data['page_title'] = "Custom Homes Gallery";
$data['gallery_desc'] = "A sample of the quality craftsmanship we put into every custom home.";
$data['splash'] = 'splash-family3.jpg';
break;
case 'add_reno' :
$gal_ids = explode(',', G_ADD_RENO) ;
$data['page_title'] = "Additions & Renovations Gallery";
$data['gallery_desc'] = "A sample of the quality craftsmanship we put into every home renovation.";
$data['splash'] = 'splash-family2.jpg';
break;
case 'interiors' :
$gal_ids = explode(',', G_INTERIORS) ;
$data['page_title'] = "Interiors Gallery";
$data['gallery_desc'] = "A sample of the luxury of living in a R.A. Snoznik custom home.";
$data['splash'] = 'splash-family1.jpg';
break;
default : break;
}
$this->db->select();
$this->db->from("ras_gallery as A, ras_gallery_phogal as B, ras_gallery_photo as C");
$this->db->where_in("A.gal_id", $gal_ids);
$this->db->where("B.gal_id = A.gal_id");
$this->db->where("B.order = 1");
$this->db->where("B.photo_id = C.photo_id");
$this->db->order_by("A.gal_id", "ASC");
$q = $this->db->get();
$data['gdata'] = rset($q);
$this->load->view('v_page_head',$data);
$this->load->view('vGalleryView',$data);
$this->load->view('v_page_foot');
}
public function show( $gal_id ) {
$data = array();
$data['gal'] = array();
$data['tab_on'] = 'gallery';
$data['split'] = false;
$data['slider'] = false;
$q = $this->db->get_where('ras_gallery', array('gal_id' => $gal_id));
$gallery = rset($q);
$data['g'] = $gallery[0];
$this->db->select();
$this->db->from("ras_gallery_phogal");
$this->db->join('ras_gallery_photo', 'ras_gallery_phogal.photo_id = ras_gallery_photo.photo_id');
$this->db->where('ras_gallery_phogal.gal_id', $gal_id);
$this->db->order_by("ras_gallery_phogal.order", "ASC");
$q = $this->db->get();
$data['g']['images'] = rset($q);
$this->load->view('vGallerific', $data);
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */