function &getData()
 {
     // Load the data
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__hotelreservation_offers' . ' WHERE offer_id = ' . $this->_offer_id . ' AND hotel_id = ' . $this->_hotel_id;
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->hotel_id = 0;
         $this->_data->offer_id = 0;
         $this->_data->offer_code = null;
         $this->_data->offer_name = null;
         $this->_data->offer_description = null;
         $this->_data->offer_content = null;
         $this->_data->offer_other_info = null;
         $this->_data->offer_min_nights = null;
         $this->_data->offer_max_nights = null;
         $this->_data->type_price_type_extranights = null;
         $this->_data->type_price_extranights = null;
         $this->_data->offer_day_1 = null;
         $this->_data->offer_day_2 = null;
         $this->_data->offer_day_3 = null;
         $this->_data->offer_day_4 = null;
         $this->_data->offer_day_5 = null;
         $this->_data->offer_day_6 = null;
         $this->_data->offer_day_7 = null;
         $this->_data->offer_datas = null;
         $this->_data->offer_datae = null;
         $this->_data->offer_datasf = null;
         $this->_data->offer_dataef = null;
         $this->_data->offer_order = null;
         $this->_data->offer_reservation_cost_val = 7.5;
         $this->_data->offer_reservation_cost_proc = 0;
         $this->_data->offer_commission = 10;
         $this->_data->themes = null;
         $this->_data->selectedThemes = null;
         $this->_data->is_available = null;
         $this->_data->public = 0;
         $this->_data->pictures = array();
         //check temporary files
         $pictures = makePathFile(JPATH_COMPONENT . PATH_OFFER_PICTURES . ($this->_data->offer_id + 0) . "/*.*");
         $files = glob($pictures);
         if (is_array($files) && count($files) > 0) {
             sort($files);
         }
         $this->_data->pictures = array();
         if (is_array($files) && count($files) > 0) {
             foreach ($files as $value) {
                 $this->_data->pictures[] = array('offer_picture_info' => 'add from cache', 'offer_picture_path' => PATH_OFFER_PICTURES . ($this->_data->offer_id + 0) . '/' . basename($value), 'offer_picture_enable' => 1);
             }
         }
     } else {
         $this->_data->pictures = array();
         //check temporary files
         $query = "\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t*\r\n\t\t\t\t\tFROM #__hotelreservation_offers_pictures\r\n\t\t\t\t\tWHERE offer_id =" . $this->_data->offer_id . "\r\n\t\t\t\t\tORDER BY offer_picture_id ";
         // dbg($query);
         //$this->_db->setQuery( $query );
         $files =& $this->_getList($query);
         if (isset($files)) {
             foreach ($files as $value) {
                 $this->_data->pictures[] = array('offer_picture_info' => $value->offer_picture_info, 'offer_picture_path' => $value->offer_picture_path, 'offer_picture_enable' => $value->offer_picture_enable);
             }
         }
     }
     $query = " \tSELECT \r\n\t\t\t\t\t\tr.room_id,\r\n\t\t\t\t\t\tr.room_name,\r\n\t\t\t\t\t\tr.max_adults,\r\n\t\t\t\t\t\tr.max_children,\t\r\n\t\t\t\t\t\t" . ($this->_offer_id > 0 ? "IF( ISNULL(ho.room_id), 0, 1 )" : "0") . "\t\t\t\t\t\tAS is_sel\t\t\t\t\t\t\t\r\n\t\t\t\t\tFROM #__hotelreservation_rooms r\r\n\t\t\t\t\t" . ($this->_offer_id > 0 ? "LEFT JOIN (\r\n\t\t\t\t\t\t\t select * from  #__hotelreservation_offers_rooms o_r  where  o_r.offer_id = {$this->_offer_id} \r\n\t\t\t\t\t\t) ho  on r.room_id = ho.room_id\r\n\t\t\t\t\t\t" : "") . "\r\n\t\t\t\t\tWHERE \r\n\t\t\t\t\t\tr.hotel_id = " . $this->_hotel_id . "\r\n\t\t\t\t\t\t";
     //dbg($query);
     $this->_data->itemRooms =& $this->_getList($query);
     if (isset($this->_data->itemRooms)) {
         foreach ($this->_data->itemRooms as $k => $r) {
             //dbg($r);
             $query = "SELECT *\tFROM  #__hotelreservation_offers_rates d where d.offer_id={$this->_offer_id} and d.room_id={$r->room_id}";
             //dbg($query);
             $res =& $this->_getList($query);
             if (isset($res) && count($res) > 0) {
                 foreach ($res as $d) {
                     //$d->week_types 	= explode(',', $d->week_types);
                     // dbg($d);
                     $this->_data->itemRooms[$k]->discounts = $d;
                 }
             } else {
                 $discounts = new stdClass();
                 $discounts->id = 0;
                 $discounts->offer_room_price_id = null;
                 $discounts->offer_id = $this->_offer_id;
                 $discounts->room_id = $r->room_id;
                 $discounts->price_1 = null;
                 $discounts->price_2 = null;
                 $discounts->price_3 = null;
                 $discounts->price_4 = null;
                 $discounts->price_5 = null;
                 $discounts->price_6 = null;
                 $discounts->price_7 = null;
                 $discounts->single_balancing = null;
                 $discounts->child_price = null;
                 $discounts->price_type = 1;
                 $discounts->extra_night_price = null;
                 $discounts->extra_pers_price = null;
                 $discounts->base_adults = null;
                 $discounts->base_children = null;
                 $this->_data->itemRooms[$k]->discounts = $discounts;
             }
         }
     }
     //clean unnecessary files
     $files = glob(makePathFile(JPATH_COMPONENT . PATH_OFFER_PICTURES . $this->_data->offer_id . "/" . "*.*"));
     //dump($files);
     if (is_array($files) && count($files) > 0) {
         foreach ($files as $pic) {
             $is_find = false;
             foreach ($this->_data->pictures as $value) {
                 if ($pic == makePathFile(JPATH_COMPONENT . $value['offer_picture_path'])) {
                     $is_find = true;
                     break;
                 }
             }
             //if( $is_find == false )
             //	@unlink( $pic );
         }
     }
     //~clean unnecessary files
     //dbg($this->_data->pictures);
     //~check temporary files
     //exit;
     $query = ' 	SELECT * FROM #__hotelreservation_offers_themes ORDER BY name';
     $this->_data->themes =& $this->_getList($query);
     $query = ' 	SELECT * FROM #__hotelreservation_offers_themes_relation where offerId=' . $this->_data->offer_id;
     $this->_data->selectedThemes =& $this->_getList($query);
     $query = " SELECT * FROM #__hotelreservation_offers_vouchers where offerId = " . $this->_data->offer_id . " ORDER BY voucher";
     $this->_data->vouchers =& $this->_getList($query);
     $this->_data->offer_datas = convertToFormat($this->_data->offer_datas);
     $this->_data->offer_datae = convertToFormat($this->_data->offer_datae);
     $this->_data->offer_datasf = convertToFormat($this->_data->offer_datasf);
     $this->_data->offer_dataef = convertToFormat($this->_data->offer_dataef);
     return $this->_data;
 }
 function sendNoAvailabilityEmail()
 {
     $email = JText::_('LNG_NO_AVAILABILITY_EMAIL', true);
     //return false;
     //$config =& JFactory::getConfig();
     //$this->itemAppSettings->sendmail_from = $config->get( 'config.mailfrom' );
     //$this->itemAppSettings->sendmail_name = $config->get( 'config.fromname' );
     $fromName = $this->itemAppSettings->company_name;
     //$mainframe->getCfg('fromname');
     $confirmEmail = $this->itemAppSettings->company_email;
     //$mainframe->getCfg('fromname');
     $datas = date("Y-m-d", mktime(0, 0, 0, $this->month_start, $this->day_start, $this->year_start));
     $datae = date("Y-m-d", mktime(0, 0, 0, $this->month_end, $this->day_end, $this->year_end));
     $datas = convertToFormat($datas);
     $datae = convertToFormat($datae);
     $mode = 1;
     //html
     $email = str_replace("<<hotel>>", $this->itemHotelSelected->hotel_name, $email);
     $email = str_replace("<<start_date>>", $datas, $email);
     $email = str_replace("<<end_date>>", $datae, $email);
     $email_subject = JText::_('LNG_NO_AVAILABILITY_EMAIL_SUBJECT', true);
     $email_subject = str_replace("<<hotel>>", $this->itemHotelSelected->hotel_name, $email_subject);
     JMail::sendMail($this->itemAppSettings->company_email, $this->itemAppSettings->company_name, $this->itemAppSettings->company_email, $email_subject, $email, $mode, null, array($this->itemHotelSelected->email));
 }
 echo "<table class='table table-striped table-bordered CSSTableGenerator' id='tblData' width='100%'>";
 echo "<th>S.No</th>";
 echo "<th>App ID</th>";
 echo "<th>App Name</th>";
 echo "<th>Version</th>";
 echo "<th>Last Date of Build</th>";
 echo "<th>Code Version</th>";
 echo "<th>Queued</th>";
 echo "<th>ScreenShots</th>";
 echo "<th>Deployed</th>";
 echo "<th>History</th>";
 while ($row = $result->fetch_assoc()) {
     # code...
     $id = $row["android_app_id"];
     $str = $row["date_of_build"];
     $str = convertToFormat($str);
     if (!strcmp($row["queued"], "0")) {
         $var = "&#10060";
     } else {
         # code...
         $var = "&#9989";
     }
     $dep = "&#10060";
     if (!strcmp($row["screenshots"], "No")) {
         $ss = "&#10060";
     } else {
         # code...
         $ss = "&#9989";
     }
     echo "<tr>";
     echo "<td>" . $i . "</td>";
 function &getData()
 {
     // Load the data
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__hotelreservation_packages' . ' WHERE package_id = ' . $this->_package_id;
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->package_id = null;
         $this->_data->hotel_id = null;
         $this->_data->package_name = null;
         $this->_data->package_type_price = null;
         $this->_data->package_price = null;
         $this->_data->package_price_1 = null;
         $this->_data->package_price_2 = null;
         $this->_data->package_price_3 = null;
         $this->_data->package_price_4 = null;
         $this->_data->package_price_5 = null;
         $this->_data->package_price_6 = null;
         $this->_data->package_price_7 = null;
         $this->_data->package_price_midweek = null;
         $this->_data->package_price_weekend = null;
         $this->_data->package_number = null;
         $this->_data->package_description = null;
         $this->_data->is_available = null;
         $this->_data->is_price_day = null;
         $this->_data->package_datas = null;
         $this->_data->package_datae = null;
     }
     if ($this->_data->is_price_day == false) {
         $this->_data->package_type_price = 1;
     }
     $this->_data->package_prices = null;
     $this->_data->package_prices[$this->_data->package_price_1][] = 1;
     $this->_data->package_prices[$this->_data->package_price_2][] = 2;
     $this->_data->package_prices[$this->_data->package_price_3][] = 3;
     $this->_data->package_prices[$this->_data->package_price_4][] = 4;
     $this->_data->package_prices[$this->_data->package_price_5][] = 5;
     $this->_data->package_prices[$this->_data->package_price_6][] = 6;
     $this->_data->package_prices[$this->_data->package_price_7][] = 7;
     $this->_data->package_datas = convertToFormat($this->_data->package_datas);
     $this->_data->package_datae = convertToFormat($this->_data->package_datae);
     if (JRequest::getVar('is_error') == "1") {
         //dbg($this->_data);
         $post = JRequest::get('post');
         if (count($post) > 0) {
             foreach ($post as $key => $value) {
                 //dbg($key.' >> '.$this->_data->$key.' | '.(property_exists($this->_data,$key)? "1" : "0"));
                 if (property_exists($this->_data, $key)) {
                     if (!is_array($value)) {
                         $this->_data->{$key} = $value;
                     } else {
                     }
                 } else {
                     if (strpos($key, "package_price_day") !== false) {
                         $this->_data->package_prices = array();
                         foreach ($post['package_price_day'] as $keyPos => $valPrice) {
                             for ($day = 1; $day <= 7; $day++) {
                                 //dbg( 'price_day_'.$keyPos.'_'.($day) );
                                 if (isset($post['day_' . $keyPos . '_' . $day])) {
                                     $this->_data->package_prices[$valPrice][] = $day;
                                 }
                             }
                         }
                     }
                     /*if( strpos($key, "room_number_datas") !== false )
                     		{
                     			$key_new = str_replace("room_number_datas_", "", $key);
                     			if( !isset($this->_data->room_intervals_numbers[ $key_new ]) )
                     			{
                     				$nr  							= new stdClass;
                     				$nr->room_interval_number_id 	= '';
                     				$nr->room_id				 	= '';
                     				$nr->nrs				 		= '';
                     				$nr->nre					 	= '';
                     				$nr->datas					 	= '';
                     				$nr->datae					 	= '';
                     				$nr->datai					 	= '';
                     				$nr->is_ignore_duplicate 		= false;
                     				$this->_data->room_intervals_numbers[ $key_new] = $nr;
                     			}
                     			
                     			$this->_data->room_intervals_numbers[ $key_new ]->datas = $value;
                     			
                     		}
                     		else if( strpos($key, "room_number_datae") !== false )
                     		{
                     			$key_new = str_replace("room_number_datae_", "", $key);
                     			if( !isset($this->_data->room_intervals_numbers[ $key_new ]) )
                     			{
                     				$nr  							= new stdClass;
                     				$nr->room_interval_number_id 	= '';
                     				$nr->room_id				 	= '';
                     				$nr->nrs				 		= '';
                     				$nr->nre					 	= '';
                     				$nr->datas					 	= '';
                     				$nr->datae					 	= '';
                     				$nr->datai					 	= '';
                     				$nr->is_ignore_duplicate 		= false;
                     				$this->_data->room_intervals_numbers[ $key_new] = $nr;
                     			}
                     			
                     			$this->_data->room_intervals_numbers[ $key_new ]->datae = $value;
                     			
                     		}
                     		else if( strpos($key, "room_number_datai") !== false )
                     		{
                     			$key_new = str_replace("room_number_datai_", "", $key);
                     			if( !isset($this->_data->room_intervals_numbers[ $key_new ]) )
                     			{
                     				$nr  							= new stdClass;
                     				$nr->room_interval_number_id 	= '';
                     				$nr->room_id				 	= '';
                     				$nr->nrs				 		= '';
                     				$nr->nre					 	= '';
                     				$nr->datas					 	= '';
                     				$nr->datae					 	= '';
                     				$nr->datai					 	= '';
                     				$nr->is_ignore_duplicate 		= false;
                     				
                     				$this->_data->room_intervals_numbers[ $key_new] = $nr;
                     			}
                     			
                     			$this->_data->room_intervals_numbers[ $key_new ]->datai = $value;
                     			
                     		}
                     		else */
                 }
             }
         }
     }
     return $this->_data;
 }