Esempio n. 1
0
<img alt="Large" height="242" src="<?php 
echo insert_room_photo($pid, 'large');
?>
" width="340" />
<form action="/pictures/ajax_update_picture" method="post" onsubmit="new Ajax.Request('/pictures/ajax_update_picture', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">    <input id="hosting_id" name="hosting_id" type="hidden" value="<?php 
echo $rid;
?>
" />
    <input id="picture_id" name="picture_id" type="hidden" value="<?php 
echo $pid;
?>
" />
    <input type="text" size="20" name="picture[caption]" id="picture_caption" value="<?php 
echo $caption !== null ? $caption : 'Add a caption...';
?>
" onfocus="if($('picture_caption').value == 'Add a caption...'){$('picture_caption').value = '';}" />
    <input id="update_caption_submit_button" name="commit" onclick="if($('picture_caption').value =='Add a caption...'){alert('You only need to click Save if you are adding or editing a caption. Please enter your own caption before clicking save.'); return false;}" type="submit" value="Save" />
</form><a href="#" onclick="if (confirm('Are you sure you want to delete this photo from your listing?')) { new Ajax.Request('/rooms/ajax_delete_photo?hosting_id=<?php 
echo $rid;
?>
&amp;picture_id=<?php 
echo $pid;
?>
', {asynchronous:true, evalScripts:true}); }; return false;"><img alt="Delete_minus" src="<?php 
echo IMG_DIR;
?>
/icons/delete_minus.png" /> Delete Photo And Caption</a>
Esempio n. 2
0
 function ajax_get_results()
 {
     $opt = $this->input->get(null, true);
     $res = new stdClass();
     $res->debug = new stdClass();
     // for debug
     if ((empty($opt['lat']) || empty($opt['lng'])) && (empty($opt['sw_lat']) || empty($opt['sw_lng']) || empty($opt['ne_lat']) || empty($opt['ne_lng']))) {
         $opt['lat'] = 37.3056;
         $opt['lng'] = 126.5427;
     }
     // 지도 검색 범위 지정되지 않은 경우 알아서 지정 //TODO: 검색결과에 맞춰서 조절
     if (empty($opt['sw_lat']) || empty($opt['sw_lng']) || empty($opt['ne_lat']) || empty($opt['ne_lng'])) {
         $dist_limit = 1000;
         $dist_unit = 69;
         $opt['sw_lat'] = $opt['lat'] - $dist_limit / abs(cos(deg2rad($opt['lat'])) * $dist_unit);
         $opt['ne_lat'] = $opt['lat'] - $dist_limit / abs(cos(deg2rad($opt['lat'])) * $dist_unit);
         $opt['sw_lng'] = $opt['lng'] - $dist_limit / $dist_unit;
         $opt['ne_lng'] = $opt['lng'] - $dist_limit / $dist_unit;
     }
     // boundary 너무 좁은 경우 알아서 넓히기
     if ($opt['ne_lat'] - $opt['sw_lat'] < 0.01) {
         $opt['ne_lat'] += 0.05;
         $opt['sw_lat'] -= 0.05;
     }
     if ($opt['ne_lng'] > $opt['sw_lat'] && $opt['ne_lng'] - $opt['sw_lng'] < 0.01) {
         $opt['ne_lng'] += 0.05;
         $opt['sw_lng'] -= 0.05;
     }
     $opt['limit_offset'] = ($opt['page'] - 1) * $opt['per_page'];
     switch (CURRENT_LANGUAGE) {
         case 'en':
             $date_pattern = '/\\d{1,2}\\/\\d{1,2}\\/\\d{4,4}/';
             break;
         case 'ko':
         case 'ja':
             $date_pattern = '/\\d{4,4}\\/\\d{1,2}\\/\\d{1,2}/';
             break;
         case 'zh':
             $date_pattern = '/\\d{4,4}-\\d{1,2}-\\d{1,2}/';
             break;
         default:
     }
     $res->debug->pattern = $date_pattern;
     $res->debug->lang = CURRENT_LANGUAGE;
     $res->debug->opt_orig = $opt;
     if (isset($opt['checkin']) && !preg_match($date_pattern, $opt['checkin'])) {
         unset($opt['checkin']);
     }
     if (isset($opt['checkout']) && !preg_match($date_pattern, $opt['checkout'])) {
         unset($opt['checkout']);
     }
     $res->debug->opt = $opt;
     $this->search_model->generate_options($opt);
     $properties = $this->search_model->search();
     $res->query = $this->db->last_query();
     $count_all = $this->search_model->count_all();
     $count_all = $count_all[0]->count_all;
     $currency_rate = $this->_generate_currency_table(CURRENT_CURRENCY);
     foreach ($properties as $k => $i) {
         $properties[$k]->user_thumbnail_url = insert_user_photo($i->user_id, 'tiny', !$i->user_has_photo);
         $properties[$k]->picture_ids = !empty($i->picture_ids) ? explode(',', $i->picture_ids) : array(null);
         $properties[$k]->hosting_thumbnail_url = insert_room_photo($properties[$k]->picture_ids[0], 'x_small');
         $properties[$k]->price = round($i->price_native / (double) $currency_rate[$i->native_currency]['rate'], 0);
     }
     $facets = array();
     // count amenities in entire search result
     $amenity_list = $this->rooms_model->get_amenity_list();
     $amenities_count_raw = $this->search_model->count_amenities();
     $amenities_count = array();
     foreach ($amenities_count_raw as $k => $i) {
         $amenities_count[$i->amenity_id] = $i->count;
     }
     $facets['hosting_amenity_ids'] = array();
     $facets['top_amenities'] = array(array(0, array(0, -1)), array(0, array(0, -1)), array(0, array(0, -1)));
     foreach ($amenity_list as $k => $i) {
         if (empty($amenities_count[$k])) {
             $amenities_count[$k] = 0;
         }
         $tmp = array($k, array(lang('amenity_' . $i->name), $amenities_count[$k]));
         $facets['hosting_amenity_ids'][] = $tmp;
         // Caculate top three amenities
         if ($amenities_count[$k] > $facets['top_amenities'][2][1][1]) {
             for ($j = 2; $j > 0 && $amenities_count[$k] > $facets['top_amenities'][$j - 1][1][1]; $j--) {
                 $facets['top_amenities'][$j] = $facets['top_amenities'][$j - 1];
             }
             $facets['top_amenities'][$j] = $tmp;
         }
     }
     // count property types in entire search result
     $property_type_list = $this->rooms_model->get_property_type_list();
     $property_type_count_raw = $this->search_model->count_property_types();
     $property_type_count = array();
     foreach ($property_type_count_raw as $k => $i) {
         $property_type_count[$i->property_type_id] = $i->count;
     }
     $facets['property_type_id'] = array();
     foreach ($property_type_list as $k => $i) {
         $facets['property_type_id'][] = array($k, array(lang('property_type_' . $i), empty($property_type_count[$k]) ? 0 : $property_type_count[$k]));
     }
     // count room types in entire search result
     $facets['room_type'] = array();
     $room_type_count = $this->search_model->count_room_types();
     foreach ($room_type_count as $i) {
         $facets['room_type'][] = array($i->room_type, array(lang('room_type_' . $i->room_type), $i->count));
     }
     $page_start = $opt['limit_offset'] + 1;
     $count_page = $page_start + count($properties) - 1;
     $page_total = ceil($count_all / $opt['per_page']);
     $res->properties = $properties;
     $res->geocode_precision = 'address';
     $res->results_count_html = "\n<b>{$page_start}&ndash; {$count_page}</b> of <b>{$count_all} listings</b>\n";
     $res->results_count_top_html = "{$count_all} results\n";
     $res->results_pagination_html = $this->_generate_pagination($opt, $opt['page'], $page_total);
     $res->sort = empty($opt['sort']) ? 0 : $opt['sort'];
     $res->view_type = empty($opt['search_view']) ? 0 : $opt['search_view'];
     $res->facets = $facets;
     echo json_encode($res);
 }
Esempio n. 3
0
<div id="dashboard_v2"> 
 
  <div class="row"> 
    <div class="col full heading"> 
      <div class="heading_content"> 

<div class="edit_listing_photo"><a href="<?php 
echo site_url('rooms/' . $room->id);
?>
"><img alt="<?php 
echo $room->photo_id ? 'small' : 'Room_default_no_photos';
?>
" height="65" src="<?php 
echo insert_room_photo($room->photo_id, 'small');
?>
" /></a></div> 
 
<div class="listing_info"> 
  <h3><?php 
echo anchor('rooms/' . $room->id, $room->name, array('id' => 'listing_title_banner'));
?>
</h3> 
  <span class="actions"> 
    <div class="set-availability action_button" data-has-availability="<?php 
echo $room->active == '1' ? 'true' : 'false';
?>
" data-available-url="<?php 
echo site_url('rooms/change_availability/' . $room->id . '?is_available=1&redirect=%2Frooms&sig=' . $sig);
?>
" data-unavailable-url="<?php 
echo site_url('rooms/change_availability/' . $room->id . '?is_available=0&redirect=%2Frooms&sig=' . $sig);
Esempio n. 4
0
            </div> 
            </div> 
            <div id="right_side" class="col half rounded"> 
            <div class="photo-padding"> 
                <div id="all_photos"> 
                    <ul id="sortable_photos" style="float:left;">
                    	<?php 
foreach ($photos as $photo) {
    ?>
 
						<li class="photo" id="photo_<?php 
    echo $photo->id;
    ?>
" style="position: relative; ">
						    <img alt="Mini_square" height="40" src="<?php 
    echo insert_room_photo($photo->id, 'mini_square');
    ?>
" width="40">
						    <br>
						      <a href="#" onclick="select_picture_thumbnail('<?php 
    echo $photo->id;
    ?>
'); new Ajax.Updater('current_photo', '/rooms/ajax_update_current_photo?hosting_id=<?php 
    echo $room->id;
    ?>
&amp;picture_id=<?php 
    echo $photo->id;
    ?>
', {asynchronous:true, evalScripts:true}); return false;">Edit</a>
						</li>                    	
						<?php