/**
  *	Draw all locations
  *		@param $location_id
  *		@param $params
  *		@param $draw
  */
 public static function DrawAllSubLocations($location_id = '', $params = array(), $draw = true)
 {
     $tag_name = isset($params['tag_name']) ? $params['tag_name'] : 'l_sub_locaton';
     $tag_id = isset($params['tag_id']) ? $params['tag_id'] : 'id_l_sub_locaton';
     $selected_value = isset($params['selected_value']) ? $params['selected_value'] : '';
     $javascript_event = isset($params['javascript_event']) ? ' ' . $params['javascript_event'] : '';
     $output = '<select name="' . $tag_name . '" id="' . $tag_id . '"' . $javascript_event . '>';
     $output .= '<option value="">-- ' . _ALL_SUB_LOCATIONS . ' --</option>';
     $locations = ListingsSubLocations::GetAllSubLocations($location_id, 'name ASC');
     for ($i = 0; $i < $locations[1]; $i++) {
         if ($selected_value == $locations[0][$i]['id']) {
             $selected_state = 'selected="selected"';
         } else {
             $selected_state = '';
         }
         $output .= '<option ' . $selected_state . ' value="' . $locations[0][$i]['id'] . '">' . $locations[0][$i]['name'] . '</option>';
     }
     $output .= '</select>';
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
Example #2
0
    /**
     *	Draws inquiry sub form
     *		@param $params
     *		@param $draw
     */
    private static function DrawInquirySubForm($params, $draw = true)
    {
        $output = '';
        $visitor_locations = isset($params['visitor_locations']) ? $params['visitor_locations'] : '';
        $visitor_sub_locations = isset($params['visitor_sub_locations']) ? $params['visitor_sub_locations'] : '';
        $visitor_description = isset($params['visitor_description']) ? $params['visitor_description'] : '';
        $visitor_availability = isset($params['visitor_availability']) ? $params['visitor_availability'] : '';
        $visitor_preferred_contact = isset($params['visitor_preferred_contact']) ? $params['visitor_preferred_contact'] : '';
        $inquiry_type = isset($params['inquiry_type']) ? $params['inquiry_type'] : '0';
        $locations = ListingsLocations::DrawAllLocations(array('tag_name' => 'visitor_locations', 'tag_id' => 'id_visitor_locations', 'selected_value' => $visitor_locations, 'javascript_event' => 'onchange="jQuery(\'#id_act\').val(\'location_reload\');jQuery(\'#frmInquiryForm\').submit();"'), false) . ' &nbsp;';
        $sub_locations = ListingsSubLocations::DrawAllSubLocations($visitor_locations, array('tag_name' => 'visitor_sub_locations', 'tag_id' => 'id_visitor_sub_locations', 'selected_value' => $visitor_sub_locations), false);
        $output .= _DESCRIBE_WHAT_YOU_NEED . '<br>';
        $output .= '<textarea id="id_visitor_description" name="visitor_description" maxlength="2048">' . $visitor_description . '</textarea><br><br>';
        $output .= '<b>' . _CONTACT_INFORMATION . '</b> <br>';
        $output .= '<div class="left_panel">
					<label>' . _NAME . ':</label> <input id="id_visitor_name" name="visitor_name" type="text" maxlength="50" autocomplete="off" value="' . (isset($params['visitor_name']) ? $params['visitor_name'] : '') . '" /><br>
					<label>' . _EMAIL . ':</label> <input id="id_visitor_email" name="visitor_email" type="text" maxlength="70" autocomplete="off" value="' . (isset($params['visitor_email']) ? $params['visitor_email'] : '') . '" /><br>
					<label>' . _PHONE . ':</label> <input id="id_visitor_phone" name="visitor_phone" type="text" maxlength="20" autocomplete="off" value="' . (isset($params['visitor_phone']) ? $params['visitor_phone'] : '') . '" />
					</div>';
        $output .= '<div class="right_panel">
					<label>' . _LOCATION . ':</label> ' . $locations . '<br>
					<label>' . _SUB_LOCATION . ':</label> ' . $sub_locations . '<br>
					
					<label>' . _I_AM_AVAILABLE . ':</label> ';
        $output .= '<select id="id_visitor_availability" name="visitor_availability">';
        foreach (self::$arr_availabilities as $key => $val) {
            $output .= '<option value="' . $key . '"' . ($visitor_availability == $key ? ' selected="selected"' : '') . '>' . $val . '</option>';
        }
        $output .= '</select><br>';
        $output .= '<label>' . _PREFERRED_TO_BE_CONTACTED . ':</label> ';
        $output .= '<select id="id_visitor_preferred_contact" name="visitor_preferred_contact">';
        foreach (self::$arr_preferred_contacts as $key => $val) {
            $output .= '<option value="' . $key . '"' . ($visitor_preferred_contact == $key ? ' selected="selected"' : '') . '>' . $val . '</option>';
        }
        $output .= '</select>';
        $output .= '
				</div>					
				<div style="margin:10px auto;text-align:center;">
					' . str_replace('_COUNT_', $inquiry_type == 1 ? '1' : ModulesSettings::Get('inquiries', 'maximum_replies'), _INQUIRY_FORM_DISCLAIMER) . '<br><br>
					<input type="submit" class="form_button" name="" value="' . _SUBMIT . '">
				</div>';
        if (isset($params['focus_field']) && !empty($params['focus_field'])) {
            $output .= '<script type="text/javascript">appSetFocus("id_' . $params['focus_field'] . '");</script>';
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #3
0
    /**
     * Draws advanced search form
     * 		@param $draw
     */
    public static function DrawAdvancedSearch($draw = true)
    {
        $keyword = isset($_POST['keyword']) ? trim(prepare_input($_POST['keyword'])) : '';
        $keyword = str_replace('"', '&#034;', $keyword);
        $keyword = str_replace("'", '&#039;', $keyword);
        $search_in = Application::Get('search_in');
        $sel_categories = isset($_POST['sel_categories']) ? (int) $_POST['sel_categories'] : '';
        $sel_listings_locations = isset($_POST['sel_listings_locations']) ? prepare_input($_POST['sel_listings_locations']) : '';
        $sel_listings_sub_locations = isset($_POST['sel_listings_sub_locations']) ? prepare_input($_POST['sel_listings_sub_locations']) : '';
        $sel_view = isset($_POST['sel_view']) ? prepare_input($_POST['sel_view']) : '';
        $sel_sortby = isset($_POST['sel_sortby']) ? prepare_input($_POST['sel_sortby']) : '';
        $sel_orderby = isset($_POST['sel_orderby']) ? prepare_input($_POST['sel_orderby']) : '';
        $chk_with_images = isset($_POST['chk_with_images']) ? prepare_input($_POST['chk_with_images']) : '';
        // prepare categories array
        $objCategories = Categories::Instance();
        $total_categories = $objCategories->GetAllExistingCategories();
        $total_countries = Countries::GetAllCountries('priority_order DESC, name ASC');
        $output = '<form style="margin:10px" id="frmAdvSearch" name="frmAdvSearch" action="index.php?page=search_advanced" method="post">
			' . draw_hidden_field('task', 'advanced_search', false) . '
			' . draw_hidden_field('p', '1', false) . '
			' . draw_hidden_field('search_in', 'listings') . '
			' . draw_token_field(false) . '
		
			<input type="text" name="keyword" value="' . $keyword . '" placeholder="' . _SEARCH_KEYWORDS . '...">		
			<span>' . _IN . '</span>
			<select name="sel_categories">';
        $output .= '<option value="">-- ' . _ALL . ' --</option>';
        foreach ($total_categories as $key => $val) {
            if ($val['level'] == '1') {
                $category_name = $val['name'];
            } else {
                if ($val['level'] == '2') {
                    $category_name = '&nbsp;&nbsp;&bull; ' . $val['name'];
                } else {
                    if ($val['level'] == '3') {
                        $category_name = '&nbsp;&nbsp;&nbsp;&nbsp;:: ' . $val['name'];
                    }
                }
            }
            $output .= '<option ' . ($sel_categories == $val['id'] ? 'selected="selected"' : '') . ' value="' . $val['id'] . '">' . $category_name . '</option>';
        }
        $output .= '</select>&nbsp;';
        $output .= ListingsLocations::DrawAllLocations(array('tag_name' => 'sel_listings_locations', 'selected_value' => $sel_listings_locations, 'javascript_event' => 'onchange="jQuery(\'#frmAdvSearch\').submit();"'), false) . ' &nbsp;';
        $output .= ListingsSubLocations::DrawAllSubLocations($sel_listings_locations, array('tag_name' => 'sel_listings_sub_locations', 'selected_value' => $sel_listings_sub_locations), false);
        $output .= '<span style="float:right;">
			<input value="' . _SEARCH . '" class="form_button" type="submit">
			</span>
		
			<div style="padding-top:4px;margin-left:-3px;">
			<table><tbody><tr>
			<td>' . _VIEW . ':
				<select name="sel_view">
					<option value="0" ' . ($sel_view == '0' ? ' selected="selected"' : '') . '>-- ' . _ALL . ' --</option>
					<option value="1" ' . ($sel_view == '1' ? ' selected="selected"' : '') . '>' . _TODAY . '</option>
					<option value="2" ' . ($sel_view == '2' ? ' selected="selected"' : '') . '>' . _YESTERDAY . '</option>
					<option value="3" ' . ($sel_view == '3' ? ' selected="selected"' : '') . '>' . _LAST_7_DAYS . '</option>
				</select>&nbsp;
			</td>
			<td>' . _SORT_BY . ':
				<select name="sel_sortby">
					<option value="0" ' . ($sel_sortby == '0' ? ' selected="selected"' : '') . '>' . _DATE . '</option>
					<option value="1" ' . ($sel_sortby == '1' ? ' selected="selected"' : '') . '>' . _VIEW . '</option>
				</select>&nbsp;
			</td>
			<td>' . _ORDER_BY . ':
				<select name="sel_orderby">
					<option value="ASC" ' . ($sel_orderby == 'ASC' ? ' selected="selected"' : '') . '>' . _ASCENDING . '</option>
					<option value="DESC" ' . ($sel_orderby == 'DESC' ? ' selected="selected"' : '') . '>' . _DESCENDING . '</option>
				</select>&nbsp;
			</td>
			<td style="padding-top:4px;"><input name="chk_with_images" type="checkbox" ' . ($chk_with_images == '1' ? ' checked="checked"' : '') . ' value="1">' . _WITH_IMAGES_ONLY . '</td>
			</tr>
			</tbody>
			</table>
			</div>
			
		</form>';
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #4
0
 /**
  * Before Edit mode
  */
 public function BeforeDetailsRecord()
 {
     // prepare array for sub-location
     $listing_location_id = (int) $this->result[0][0]['listing_location_id'];
     $total_sub_locations = ListingsSubLocations::GetAllSubLocations($listing_location_id, 'name ASC');
     $arr_sub_locations = array();
     foreach ($total_sub_locations[0] as $key => $val) {
         $arr_sub_locations[$val['id']] = $val['name'];
     }
     $this->arrDetailsModeFields['separator_general']['listing_sub_location_id'] = array('title' => _SUB_LOCATION, 'type' => 'enum', 'width' => '', 'source' => $arr_sub_locations, 'required' => true);
 }
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('listings')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $lid = isset($_GET['lid']) ? (int) $_GET['lid'] : '0';
    $mode = 'view';
    $msg = '';
    // Start main content
    $objListingsLocations = new ListingsLocations();
    $location_info = $objListingsLocations->GetInfoByID($lid);
    $location_info_name = isset($location_info['name']) ? $location_info['name'] : '';
    if (!empty($lid) && count($location_info)) {
        $objListingsSubLocations = new ListingsSubLocations($lid);
        if ($action == 'add') {
            $mode = 'add';
        } else {
            if ($action == 'create') {
                if ($objListingsSubLocations->AddRecord()) {
                    $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                    $mode = 'view';
                } else {
                    $msg = draw_important_message($objListingsSubLocations->error, false);
                    $mode = 'add';
                }
            } else {
                if ($action == 'edit') {
                    $mode = 'edit';
                } else {