示例#1
0
 function getmeals($meals)
 {
     //$meals=strtolower($meals);
     //$meals=explode(';',$meals);
     $lists = TourHelper::getMealList();
     return AHtml::bootrapCheckBoxList($lists, 'jform[meal][]', '', $meals, 'id', 'title');
 }
示例#2
0
 function display($tpl = null)
 {
     $this->config = JBFactory::getConfig();
     $input = JFactory::getApplication()->input;
     AImporter::model('tour');
     $cart = JModelLegacy::getInstance('TourCart', 'bookpro');
     $cart->load();
     $cart->clear();
     $model = new BookProModelTour();
     $id = $input->getInt('id');
     $this->tour = $model->getComplexItem($id);
     $this->itineraries = TourHelper::buildItinerary($id);
     //$this->packages	= $packages;
     $date = TourHelper::getDateFirstInPackagerateFromTourid($this->tour->id);
     $this->date = JFactory::getDate($date)->format(DateHelper::getConvertDateFormat('P'));
     $this->tour->rdate = $this->date;
     $dispatcher = JDispatcher::getInstance();
     //$this->_prepareDocument();
     //		$dispatcher		= JDispatcher::getInstance();
     //		$this->event 	= new stdClass();
     //		JPluginHelper::importPlugin('bookpro');
     //		$results 		= $dispatcher->trigger('onBookproProductAfterTitle', array ($this->tour));
     //		$this->event->afterDisplayTitle=isset($results[0])?$results[0]:null;
     parent::display($tpl);
 }
示例#3
0
 /**
  * Prepare to display page.
  * 
  * @param string $tpl name of used template
  */
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $input = JFactory::getApplication()->input;
     $this->duration = TourHelper::getDurationBox($this->state->get('filter.days'), 'filter_days');
     $this->category = $this->getCategoryBox($this->state->get('filter.cat_id'));
     JToolBarHelper::title(JText::_('COM_BOOKPRO_MANAGER_TOURS'));
     parent::display($tpl);
 }
示例#4
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $this->depart = $app->getUserStateFromRequest('booking.depart', 'depart', '');
     $input = JFactory::getApplication()->input;
     $this->tour_id = $input->get('id', '', 'int');
     $tourModel = new BookProModelTour();
     $this->tour = $tourModel->getItem($this->tour_id);
     $this->document = JFactory::getDocument();
     $user = JFactory::getUser();
     $this->document->setTitle(JText::_('COM_BOOKPRO_REGISTER_VIEW'));
     $rowFields = TourHelper::getCustomfieldsByInquiry();
     $form = new RADForm($rowFields, null, '');
     $this->fields = $form->getFields();
     parent::display($tpl);
 }
示例#5
0
 public function display($tpl = null)
 {
     $this->tour_id = JFactory::getApplication()->input->get('tour_id');
     $this->items = $this->get('Items');
     $this->state = $this->get('State');
     if ($this->tour_id) {
         $this->state->set('filter.tour_id', $this->tour_id);
     } else {
         $this->tour_id = $this->state->get('filter.tour_id');
     }
     $this->pagination = $this->get('Pagination');
     $this->tours_filter = TourHelper::getToursFilter('tour_id', $this->tour_id);
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->addToolbar();
     parent::display($tpl);
 }
	<?php 
if ($itemsCount == 0) {
    ?>
		<tr>
			<td colspan="13" class="emptyListInfo"><?php 
    echo JText::_('No reservations.');
    ?>
</td>
		</tr>
		<?php 
}
?>
		<?php 
for ($i = 0; $i < $itemsCount; $i++) {
    $subject = $this->items[$i];
    $tour = TourHelper::getBookedTour($subject->id);
    $orderlink = JUri::root() . 'index.php?option=com_bookpro&view=orderdetail&order_number=' . $subject->order_number . '&email=' . $subject->email;
    ?>

		<tr class="row<?php 
    echo $i % 2;
    ?>
">
			<td style="text-align: right; white-space: nowrap;"><?php 
    echo number_format($pagination->getRowOffset($i), 0, '', ' ');
    ?>
</td>
			<td class="checkboxCell"><?php 
    echo JHTML::_('grid.checkedout', $subject, $i);
    ?>
</td>
示例#7
0
 function do_add_to_cart()
 {
     $pass_validate = true;
     $item_id = STInput::request('item_id', '');
     if ($item_id <= 0 || get_post_type($item_id) != 'st_tours') {
         STTemplate::set_message(__('This tour is not available..', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $number = 1;
     $adult_number = intval(STInput::request('adult_number', 1));
     $child_number = intval(STInput::request('child_number', 0));
     $infant_number = intval(STInput::request('infant_number', 0));
     $data['adult_number'] = $adult_number;
     $data['child_number'] = $child_number;
     $data['infant_number'] = $infant_number;
     $max_number = intval(get_post_meta($item_id, 'max_people', true));
     $type_tour = get_post_meta($item_id, 'type_tour', true);
     $data['type_tour'] = $type_tour;
     $today = date('Y-m-d');
     $check_in = STInput::request('check_in', '');
     $check_out = STInput::request('check_out', '');
     if (!$check_in || !$check_out) {
         STTemplate::set_message(__('Select a tour in the calendar above.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $compare = TravelHelper::dateCompare($today, $check_in);
     if ($compare < 0) {
         STTemplate::set_message(__('This tour has expired', ST_TEXTDOMAIN), 'danger');
         $pass_validate = false;
         return false;
     }
     $booking_period = intval(get_post_meta($item_id, 'tours_booking_period', true));
     $period = TravelHelper::dateDiff($today, $check_in);
     if ($period < $booking_period) {
         STTemplate::set_message(sprintf(__('This tour allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
         $pass_validate = false;
         return false;
     }
     if ($adult_number + $child_number + $infant_number > $max_number) {
         STTemplate::set_message(sprintf(__('Max of people for this tour is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $tour_available = TourHelper::checkAvailableTour($item_id, strtotime($check_in), strtotime($check_out));
     if (!$tour_available) {
         STTemplate::set_message(__('The check in, check out day is not invalid or this tour not available.', ST_TEXTDOMAIN), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $free_people = intval(get_post_meta($item_id, 'max_people', true));
     $result = TourHelper::_get_free_peple($item_id, strtotime($check_in), strtotime($check_out));
     if (is_array($result) && count($result)) {
         $free_people = intval($result['free_people']);
     }
     if ($free_people < $adult_number + $child_number + $infant_number) {
         STTemplate::set_message(sprintf(__('This tour only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
         $pass_validate = FALSE;
         return false;
     }
     $data_price = STPrice::getPriceByPeopleTour($item_id, strtotime($check_in), strtotime($check_out), $adult_number, $child_number, $infant_number);
     $total_price = $data_price['total_price'];
     $sale_price = STPrice::getSaleTourSalePrice($item_id, $total_price, $type_tour, strtotime($check_in));
     $data['check_in'] = date('m/d/Y', strtotime($check_in));
     $data['check_out'] = date('m/d/Y', strtotime($check_out));
     $people_price = STPrice::getPeoplePrice($item_id, strtotime($check_in), strtotime($check_out));
     $data = wp_parse_args($data, $people_price);
     $data['ori_price'] = $sale_price;
     $data['currency'] = TravelHelper::get_current_currency('symbol');
     $data['currency_rate'] = TravelHelper::get_current_currency('rate');
     $data['currency_pos'] = TravelHelper::get_current_currency('booking_currency_pos');
     $data['commission'] = TravelHelper::get_commission();
     $data['data_price'] = $data_price;
     $data['discount_rate'] = STPrice::get_discount_rate($item_id, strtotime($check_in));
     if ($pass_validate) {
         $data['duration'] = $type_tour == 'daily_tour' ? floatval(get_post_meta($item_id, 'duration_day', true)) : '';
         if ($pass_validate) {
             STCart::add_cart($item_id, $number, $sale_price, $data);
         }
     }
     return $pass_validate;
 }
示例#8
0
        echo JText::_('MOD_BOOKPRO_TOUR_CATEGORY');
        ?>
					:&nbsp;
					<?php 
        echo $tour->cat_title;
        ?>
				</p>
				<?php 
    }
    ?>
				<?php 
    if ($showduration) {
        ?>
				<p>
					 <span><?php 
        echo TourHelper::buildDuration($tour);
        ?>
 </span>
				</p>
				<?php 
    }
    ?>

			</div>

		</div>
	</div>
	<?php 
    if (($i + 1) % $products_per_row == 0) {
        echo '</div>';
        echo '<div class="row-fluid">';
示例#9
0
			</thead>
			<tfoot>
				<tr>
					<td colspan="11"><?php 
echo $this->pagination->getListFooter();
?>
					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php 
if (count($this->items)) {
    foreach ($this->items as $i => $item) {
        $link = JRoute::_('index.php?option=com_bookpro&view=passenger&task=passenger.edit&id=' . $item->id);
        $checked = JHTML::_('grid.id', $i, $item->id);
        $tour = TourHelper::getBookedTour($item->order_id);
        $orderlink = JUri::root() . 'index.php?option=com_bookpro&view=orderdetail&order_number=' . $item->order_number . '&email=' . $item->email;
        ?>
				<tr class="row<?php 
        echo $i % 2;
        ?>
">
					<td><?php 
        echo $checked;
        ?>
</td>					
					
					<td><a href="<?php 
        echo $link;
        ?>
"><?php 
示例#10
0
        ?>
 							</a>						</div>					</div>					<?php 
    }
    ?>
			</div>
				
				<?php 
    if ($showdest) {
        ?>
				<p>
					<?php 
        echo JText::_('MOD_BOOKPRO_TOUR_DESTINATION');
        ?>
					:&nbsp;
					<?php 
        echo TourHelper::getTourDestination($tour->id);
        ?>
				</p>
				<?php 
    }
    ?>
				<?php 
    if ($showcat) {
        ?>
				<p>
					<?php 
        echo JText::_('MOD_BOOKPRO_TOUR_CATEGORY');
        ?>
					:&nbsp;
					<?php 
        echo $tour->cat_title;
		<?php 
$lang = JFactory::getLanguage();
$local = substr($lang->getTag(), 0, 2);
$doc = JFactory::getDocument();
AImporter::helper('tour');
$cart = $displayData;
$passengers = TourHelper::getPassengerForm($cart->filter['adult'], $cart->filter['child'], $cart->filter['infant']);
JsHelper::addDatePickerLib();
$doc->addScript(JURI::base() . 'components/com_bookpro/assets/js/view-tourconfirm.js');
$depart_start = $cart->filter['start'];
$p_mindate = JFactory::getDate($depart_start);
$p_mindate->modify('+2 day');
//adult old year >12
$a_mindate = JFactory::getDate($depart_start)->sub(new DateInterval('P108Y'));
$a_maxdate = JFactory::getDate($depart_start)->sub(new DateInterval('P12Y'));
$a_maxdate->modify('+1 day');
//(2-12)
$c_mindate = JFactory::getDate($depart_start)->sub(new DateInterval('P12Y'));
$c_mindate->modify('+2 day');
$c_maxdate = JFactory::getDate()->sub(new DateInterval('P3D'));
//(<2)
$i_mindate = JFactory::getDate($depart_start)->sub(new DateInterval('P2Y'));
$i_mindate->modify('+2 day');
$js = '
		    var a_mindate="' . $a_mindate->format('Y-m-d') . '";
		    var a_maxdate="' . $a_maxdate->format('Y-m-d') . '";
		    var c_mindate="' . $c_mindate->format('Y-m-d') . '";
		    var c_maxdate="' . $c_maxdate->format('Y-m-d') . '";
		    var i_mindate="' . $i_mindate->format('Y-m-d') . '";		
		    var dateFormat="' . DateHelper::getConvertDateFormat('J') . '";
		';
<?php

/**
 * @package 	Bookpro
 * @author 		Ngo Van Quan
 * @link 		http://joombooking.com
 * @copyright 	Copyright (C) 2011 - 2012 Ngo Van Quan
 * @license 	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @version 	$Id$
 **/
AImporter::helper('tour');
defined('_JEXEC') or die('Restricted access');
$order_id = $displayData;
$rowFields = TourHelper::getCustomfieldsByOrderid($order_id);
if ($rowFields) {
    ?>
	
					
						<div class="box-heading">
									<?php 
    echo JText::_('COM_BOOKPRO_CUSTOM_FIELDS');
    ?>
							</div>
<table class="table" cellpadding="10">
	<?php 
    foreach ($rowFields as $rowField) {
        ?>
		<tr>
			<td class="tdtitleorder">
				<?php 
        echo $rowField->title;
示例#13
0
 static function getMeal($m)
 {
     $meals = TourHelper::getMealList();
     $html = "";
     foreach ($meals as $meal) {
         if ($meal->id == $m) {
             $html .= " " . $meal->title;
         }
     }
     return $html;
 }
示例#14
0
 private function getBookedSeat($date, $tour_id)
 {
     $db = JFactory::getDbo();
     $query = TourHelper::getBookedSeatQuery($db, $date, (int) $tour_id);
     $db->setQuery($query);
     return $db->loadResult();
 }
示例#15
0
 private function fillTOURInfo($input)
 {
     AImporter::model('tour', 'orderinfos', 'passengers');
     AImporter::helper('tour', 'date', 'bookpro', 'image');
     $duration = TourHelper::buildDuration($this->orderComplex->tour);
     $input = str_replace('{duration}', $duration, $input);
     $input = str_replace('{tour_name}', $this->orderComplex->tour->title, $input);
     $input = str_replace('{tour_number}', $this->orderComplex->tour->code, $input);
     $input = str_replace('{depart}', DateHelper::formatDate($this->orderComplex->tour->start), $input);
     if ($this->orderComplex->tour->type = "TOUR") {
         $customfield = BookProHelper::renderLayout('tour', $this->orderComplex->tour);
         $input = str_replace('{infosummary}', $customfield, $input);
         $layout = new JLayoutFile('addons', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts');
         $html = $layout->render($this->orderComplex);
         $input = str_replace('{addons}', $html, $input);
         $layout = new JLayoutFile('passengers', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts');
         $html = $layout->render($this->orderComplex->passengers);
         $input = str_replace('{passengers}', $html, $input);
     } elseif ($this->orderComplex->tour->type = "TOUR_INQUIRY") {
         $customfield = BookProHelper::renderLayout('customfieldvalue', $this->order->id);
         $input = str_replace('{customfields}', $customfield, $input);
         $customfield = BookProHelper::renderLayout('tour', $this->orderComplex);
         $input = str_replace('{infosummary}', $customfield, $input);
     }
     return $input;
 }
示例#16
0
	jQuery("#sendInquiry").live('click',function(){
		$("input[name='view']").val('inquiry');
		$("#tourBook").submit();
	});
	
	function addLeadingZero(num) {
	    if (num < 10) {
	      return "0" + num;
	    } else {
	      return "" + num;
	    }
	  }
	<?php 
$result = '';
$startarr = TourHelper::getDateInPackagerateFromTourid($this->tour->id);
if ($startarr) {
    for ($i = 0; $i < count($startarr); $i++) {
        $result = $result . ',' . JFactory::getDate($startarr[$i])->format('d-m-Y');
    }
}
?>
		 		 $result = "<?php 
echo $result;
?>
";
		 		 $onlydates = $result.split(',');

	 
	 $("#depart_id" ).datepicker({
		  firstDay: 1,
示例#17
0
                foreach ($tours as $tour) {
                    $type_tour = get_post_meta($tour, 'type_tour', true);
                    $data_tour = AvailabilityHelper::_getdataTourEachDate($tour, strtotime($check_in), strtotime($check_in));
                    $booking_period = intval(get_post_meta($tour, 'tours_booking_period', true));
                    if (is_array($data_tour) && count($data_tour)) {
                        $full = 0;
                        foreach ($data_tour as $key => $val) {
                            $period = TravelHelper::dateDiff($today, date('Y-m-d', $val->check_in));
                            if ($val->status != 'available' || $period < $booking_period) {
                                $full += 1;
                            }
                        }
                        if ($full == count($data_tour)) {
                            $results[] = $tour;
                        }
                    } else {
                        if ($type_tour != 'daily_tour') {
                            $results[] = $tour;
                        }
                    }
                }
            }
            if (count($results)) {
                $cant_book = array_unique(array_merge($cant_book, $results));
            }
            return $cant_book;
        }
    }
    $tourhelper = new TourHelper();
    $tourhelper->init();
}
示例#18
0
 function _check_validate()
 {
     $data = array();
     $order_item_id = STInput::request('order_item_id', '');
     $st_first_name = STInput::request('st_first_name', '');
     if (empty($st_first_name)) {
         STAdmin::set_message(__('The firstname field is not empty.', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     $st_last_name = STInput::request('st_last_name', '');
     if (empty($st_last_name)) {
         STAdmin::set_message(__('The lastname field is not empty.', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     $st_email = STInput::request('st_email', '');
     if (empty($st_email)) {
         STAdmin::set_message(__('The email field is not empty.', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     $st_phone = STInput::request('st_phone', '');
     if (empty($st_phone)) {
         STAdmin::set_message(__('The phone field is not empty.', ST_TEXTDOMAIN), 'danger');
         return false;
     }
     if (STInput::request('section', '') != 'edit_order_item') {
         $item_id = intval(STInput::request('item_id', ''));
         if ($item_id <= 0 || get_post_type($item_id) != 'st_tours') {
             STAdmin::set_message(__('The tour field is not empty.', ST_TEXTDOMAIN), 'danger');
             return false;
         }
         $type_tour = get_post_meta($item_id, 'type_tour', true);
         $today = date('Y-m-d');
         $check_in = STInput::request('check_in', '');
         $check_out = STInput::request('check_out', '');
         if (!$check_in || !$check_out) {
             STAdmin::set_message(__('Select a tour in the calendar above.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = FALSE;
             return false;
         }
         $compare = TravelHelper::dateCompare($today, $check_in);
         if ($compare < 0) {
             STAdmin::set_message(__('This tour has expired', ST_TEXTDOMAIN), 'danger');
             $pass_validate = false;
             return false;
         }
         $duration = ($type_tour = 'daily_tour') ? get_post_meta($item_id, 'duration_day', true) : '';
         $booking_period = intval(get_post_meta($item_id, 'tours_booking_period', true));
         $period = TravelHelper::dateDiff($today, $check_in);
         if ($period < $booking_period) {
             STAdmin::set_message(sprintf(__('This tour allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period), 'danger');
             $pass_validate = false;
             return false;
         }
         $adult_number = intval(STInput::request('adult_number', 1));
         $child_number = intval(STInput::request('child_number', 0));
         $infant_number = intval(STInput::request('infant_number', 0));
         $max_number = intval(get_post_meta($item_id, 'max_people', true));
         if ($adult_number + $child_number + $infant_number > $max_number) {
             STAdmin::set_message(sprintf(__('Max of people for this tour is %d people', ST_TEXTDOMAIN), $max_number), 'danger');
             return false;
         }
         $tour_available = TourHelper::checkAvailableTour($item_id, strtotime($check_in), strtotime($check_out));
         if (!$tour_available) {
             STAdmin::set_message(__('The check in, check out day is not invalid or this tour not available.', ST_TEXTDOMAIN), 'danger');
             $pass_validate = FALSE;
             return false;
         }
         $free_people = intval(get_post_meta($item_id, 'max_people', true));
         $result = TourHelper::_get_free_peple($item_id, strtotime($check_in), strtotime($check_out), $order_item_id);
         if (is_array($result) && count($result)) {
             $free_people = intval($result['free_people']);
         }
         if ($free_people > $max_number) {
             STAdmin::set_message(sprintf(__('This tour only vacant %d people', ST_TEXTDOMAIN), $free_people), 'danger');
             $pass_validate = FALSE;
             return false;
         }
         $data['order_item_id'] = $order_item_id;
         $data['item_id'] = $item_id;
         $data['check_in'] = date('m/d/Y', strtotime($check_in));
         $data['check_out'] = date('m/d/Y', strtotime($check_out));
         $data['adult_number'] = $adult_number;
         $data['child_number'] = $child_number;
         $data['infant_number'] = $infant_number;
         $data['type_tour'] = $type_tour;
         $data['duration'] = $duration;
         $people_price = STPrice::getPeoplePrice($item_id, strtotime($check_in), strtotime($check_out));
         $data = wp_parse_args($data, $people_price);
     }
     return $data;
 }
        ?>
">
			                	<span class="item-title"><?php 
        echo $data->title;
        ?>
</span>
			                	<div class="intinerary-desc"><?php 
        echo $data->desc;
        ?>
</div>
			                	<?php 
        if ($data->meal) {
            ?>
					                <div class="meal-title float_right">
						                <?php 
            echo JText::sprintf('COM_BOOKPRO_TOUR_MEALS', TourHelper::getMealIntinerary($data->meal));
            ?>
					                </div>
				                <?php 
        }
        ?>
			                </div>     
	                </div>      
                </div>

            <?php 
    }
}
?>
    
</div>
示例#20
0
<?php

/**
 * @package 	Bookpro
 * @author 		Ngo Van Quan
 * @link 		http://joombooking.com
 * @copyright 	Copyright (C) 2011 - 2012 Ngo Van Quan
 * @license 	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @version 	$Id$
 **/
defined('_JEXEC') or die('Restricted access');
$tour = $displayData;
//$startarr	= explode(',',JString::trim($tour->start));
$startarr = TourHelper::getDateInPackagerateFromTourid($tour->id);
$date = TourHelper::getDateFirstInPackagerateFromTourid($tour->id);
$firstdate = JFactory::getDate($date)->format('Y-m');
?>
<div class="responsive-calendar">
  <div class="controls">
      <a class="pull-left" data-go="prev"><div class="btn"><i class="icon-chevron-left"></i></div></a>
      <h4><span data-head-year></span> <span data-head-month></span></h4>
      <a class="pull-right" data-go="next"><div class="btn"><i class="icon-chevron-right"></i></div></a>
  </div><hr/>
  <div class="day-headers">
    <div class="day header"><?php 
echo JText::_('MON');
?>
</div>
    <div class="day header"><?php 
echo JText::_('TUE');
?>
示例#21
0
						
					<a
						href="<?php 
    echo JRoute::_('index.php?option=com_bookpro&view=itineraries&tour_id=' . $subject->id);
    ?>
"
						class="btn btn-small">Lists</a> <a
						href="<?php 
    echo JRoute::_(ARoute::view('itinerary', null, null, array('layout' => 'edit', 'tour_id' => $subject->id)));
    ?>
"
						class="btn btn-small">Add</a>
						
						<br/>
						<?php 
    echo TourHelper::getTourDestination($subject->id);
    ?>
						</td>
				
					
					
				</tr>
				<?php 
}
?>
				<?php 
?>
			</tbody>
		</table>
		<input type="hidden" name="task" value="" /> <input type="hidden"
			name="boxchecked" value="0" /> <input type="hidden"