• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
On MVC

#4
[eluser]behnampmdg3[/eluser]
Controller
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ad_details extends CI_Controller {

    public function show_ad($ad_id)
        {
            if(is_numeric($ad_id))
                {
                    $this->load->model('places_model');
                    $place = $this->places_model->place_details($ad_id);
                    if($place)
                        {
                            $data['title'] = html_entity_decode(ucwords($place['title']));
                            if($place['furnished']=='on')
                                {
                                    $furnished = "Furnished";
                                }
                            else
                                {
                                    $furnished = "";
                                }
                            if($place['washer_dryer']=='on')
                                {
                                    $washer_dryer = "Washer / Dryer";
                                }
                            else
                                {
                                    $washer_dryer = "";
                                }
                            if($place['tv']=='on')
                                {
                                    $tv = "TV available";
                                }
                            else
                                {
                                    $tv = "";
                                }
                            if($place['pet']=='on')
                                {
                                    $pet = "Pets Allowed";
                                }
                            else
                                {
                                    $pet = "";
                                }
                            if($place['carpark']=='on')
                                {
                                     $carpark = "Carpark Available";
                                }
                            else
                                {
                                    $carpark = "";
                                }
                            if($place['internet']=='on')
                                {
                                    $internet = "ADSL Available";
                                }
                            else
                                {
                                    $internet = "";
                                }
                            if($place['own_bathroom']=='on')
                                {
                                    $own_bathroom = "Own Bathroom";
                                }
                            else
                                {
                                    $own_bathroom = "";
                                }
                            if($place['aircondition']=='on')
                                {
                                    $aircondition = "Airconditioned";
                                }
                            else
                                {
                                    $aircondition = "";
                                }
                        
                            $data['details'][] = array('AID'=>$place['AID'],
                            'title'=>html_entity_decode($place['title']),
                            'comments'=>html_entity_decode($place['comments']),
                            'date_added'=>($place['date_added']),
                            'suburb'=>html_entity_decode($place['suburb']),
                            'city'=>html_entity_decode($place['city']),
                            'suburb'=>html_entity_decode($place['suburb']),
                            'cn'=>html_entity_decode($place['cn']),
                            'security_bond'=>html_entity_decode($place['security_bond']),
                            'building_type'=>html_entity_decode($place['building_type']),
                            'weekly_rent'=>html_entity_decode($place['weekly_rent']),
                            'address'=>html_entity_decode($place['address']),
                            'furnished'=>$furnished,
                            'washer_dryer'=>$washer_dryer,
                            'tv'=>$tv,
                            'pet'=>$pet,
                            'carpark'=>$carpark,
                            'internet'=>$internet,
                            'own_bathroom'=>$own_bathroom,
                            'aircondition'=>$aircondition,
                            );
                            $this->load->vars($data);
                            $this->view_things();
                        }
                    else
                        {
                            $this->invalid_ad();
                        }
                }
            else
                {
                    $this->invalid_ad();
                }
        }
    
        
    public function invalid_ad()
        {
            $data['invalid']=true;
            $data['title']='Flatmatescenter invalid Ad id!';
            $this->load->vars($data);
            $this->load->view('header_view');
            $this->load->view('invalid_ad_details_view');
            $this->load->view('footer_view');
        }
        
        
    public function view_things()
        {
            $this->load->view('header_view');
            $this->load->view('ad_details_view');
            $this->load->view('footer_view');
        }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */


Messages In This Thread
On MVC - by El Forum - 11-16-2012, 03:26 AM
On MVC - by El Forum - 11-16-2012, 03:27 AM
On MVC - by El Forum - 11-16-2012, 03:28 AM
On MVC - by El Forum - 11-16-2012, 03:29 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.