Beispiel #1
0
     if ($input != '') {
         $data['favorites'][$selection]['source'] = $input;
         Aastra_save_user_context($user, 'currency', $data);
     }
     unset($main[$data['favorites'][$selection]['source']]);
     unset($currency[$data['favorites'][$selection]['source']]);
 }
 # Set choice for fav1
 if ($action == 'inputfav1' and $choice != '') {
     $choice = $data['favorites'][$selection]['source'];
 }
 # Create the Textmenu
 $object = new AastraIPPhoneTextMenu();
 # Position on the right page and Index
 if ($choice != '') {
     $array = find_default($choice);
     $page = $array['page'];
     $object->setDefaultIndex($array['index']);
 }
 # Display the list
 if ($page == 0) {
     $index = 1;
     $start = '';
     foreach ($main as $key => $value) {
         switch ($action) {
             case 'input1':
                 $object->addEntry($value, $XML_SERVER . '&action=set_1&input=' . $key);
                 break;
             case 'input2':
                 $object->addEntry($value, $XML_SERVER . '&action=set_2&input=' . $key);
                 break;
Beispiel #2
0
function sb_search_box_func($atts, $search_page = '')
{
    global $sb_config, $post, $size_low, $size_high, $price_low, $price_high;
    extract(shortcode_atts(array('size_low' => 'none', 'size_high' => 'none', 'price_low' => 'none', 'price_high' => 'none', 'results_per_page' => '10', 'keyword_examples' => "e.g. roller furling, fridge", 'layout' => ''), $atts));
    if ($search_page == '') {
        $search_page = $sb_config['search_page'];
    }
    $sb_config['data']['ln'] = $results_per_page;
    $fields_xml = load_fields_xml($atts);
    if ($fields_xml !== FALSE) {
        if (!function_exists("find_default")) {
            function find_default($id)
            {
                global $sb_config, $size_low, $size_high, $price_low, $price_high;
                $assoc1 = array('sl' => 'size_low', 'sh' => 'size_high', 'pl' => 'price_low', 'ph' => 'price_high');
                //first see if we have a $_GET value
                if (array_key_exists($id, $_GET) and $_GET[$id] != '') {
                    //echo "Find default $id: using GET value: ".$_GET[$id]."<br/>";
                    return intval($_GET[$id]);
                }
                //if not, see if there's a shortcode value supplied
                if (isset(${$assoc1[$id]}) and ${$assoc1[$id]} != '' and ${$assoc1[$id]} != 0 and ${$assoc1[$id]} != 'none') {
                    //echo "Find default $id: using sc value: ".var_dump(${$assoc1[$id]})."<br/>";
                    return ${$assoc1[$id]};
                }
                //otherwise, get limit value
                $assoc2 = array('sl' => 'size_min', 'sh' => 'size_max', 'pl' => 'price_min', 'ph' => 'price_max');
                //echo "Find default $id: using limit value: ".var_dump(strval($sb_config[$assoc2[$id]]))."<br/>";
                return strval($sb_config[$assoc2[$id]]);
            }
        }
        $sb_config['data']['sl'] = find_default('sl');
        $sb_config['data']['sh'] = find_default('sh');
        $sb_config['data']['pl'] = find_default('pl');
        $sb_config['data']['ph'] = find_default('ph');
        $a = '';
        //avoid values outside range
        if (intval($sb_config['data']['pl']) < intval($sb_config['price_min'])) {
            $sb_config['data']['pl'] = $sb_config['price_min'];
        }
        if (intval($sb_config['data']['pl']) > intval($sb_config['price_max'])) {
            $sb_config['data']['pl'] = $sb_config['price_min'];
        }
        if (intval($sb_config['data']['ph']) < intval($sb_config['price_min'])) {
            $sb_config['data']['ph'] = $sb_config['price_max'];
        }
        if (intval($sb_config['data']['ph']) > intval($sb_config['price_max'])) {
            $sb_config['data']['ph'] = $sb_config['price_max'];
        }
        if (intval($sb_config['data']['sl']) < intval($sb_config['size_min'])) {
            $sb_config['data']['sl'] = $sb_config['size_min'];
        }
        if (intval($sb_config['data']['sl']) > intval($sb_config['size_max'])) {
            $sb_config['data']['sl'] = $sb_config['size_min'];
        }
        if (intval($sb_config['data']['sh']) < intval($sb_config['size_min'])) {
            $sb_config['data']['sh'] = $sb_config['size_max'];
        }
        if (intval($sb_config['data']['sh']) > intval($sb_config['size_max'])) {
            $sb_config['data']['sh'] = $sb_config['size_max'];
        }
        //avoid max < min
        if ($sb_config['data']['pl'] > $sb_config['data']['ph']) {
            $temp = $sb_config['data']['ph'];
            $sb_config['data']['ph'] = $sb_config['data']['pl'];
            $sb_config['data']['pl'] = $temp;
        }
        if ($sb_config['data']['sl'] > $sb_config['data']['sh']) {
            $temp = $sb_config['data']['sh'];
            $sb_config['data']['sh'] = $sb_config['data']['sl'];
            $sb_config['data']['sl'] = $temp;
        }
        $sb_config['data']['cr'] = $sb_config['currency_1'];
        //start search box
        $a .= "<form method='get' action='" . site_url('/') . "' id='boat_search_v2'>";
        //first section - boat type
        $a .= "<p><input type='hidden' name='page_id' value='" . $search_page . "'>" . __('Boat type:', 'smartbroker') . '<br/>' . create_type_dropdown($fields_xml) . '</p>';
        //second section - size slider
        $a .= '<p>' . __('Boat size:', 'smartbroker') . '<br/>';
        $a .= "<input type='number' step='1' name='sl' value='" . $sb_config['data']['sl'] . "' style='width: 5em;'> to \r\n\t\t<input type='number' step='1' name='sh' value='" . $sb_config['data']['sh'] . "' style='width: 5em;'>&nbsp;" . $sb_config['units']['LOA'] . "</p>";
        //third section: price slider
        $a .= '<p>' . __('Price:', 'smartbroker') . '<br/>';
        if ($sb_config['currencies'][$sb_config['currency_1']]['suffix']) {
            $a .= "<input type='number' min='{$sb_config['price_min']}' max='{$sb_config['price_max']}' step='100'name='sl' value='" . $sb_config['data']['pl'] . "'> to \r\n\t\t\t<input type='number' min='{$sb_config['price_min']}' max='{$sb_config['price_max']}' step='100' name='sh' value='" . $sb_config['data']['ph'] . "'>&nbsp;" . $sb_config['currencies'][$sb_config['currency_1']]['symbol'] . "</p>";
        } else {
            $a .= $sb_config['currencies'][$sb_config['currency_1']]['symbol'] . "&nbsp;<input type='number' min='{$sb_config['price_min']}' max='{$sb_config['price_max']}' step='100' name='pl' value='" . $sb_config['data']['pl'] . "'>\r\n\t\t\tto <input type='number' min='{$sb_config['price_min']}' max='{$sb_config['price_max']}' step='100' name='ph' value='" . $sb_config['data']['ph'] . "'></p>";
        }
        //forth: advanced search
        $a .= "\r\n\t\t<div id='sb_advanced_options'>\r\n\t\t\t<hr/><p>" . __('Keywords:', 'smartbroker') . "<em><small> " . $keyword_examples . "</small></em><br/>\r\n\t\t\t<input name='lk' value=\"" . stripslashes($_GET['lk']) . "\" type='text' /></p>\r\n\t\t\t<p>" . __('Builder:', 'smartbroker') . "&nbsp;<span class='ui-icon ui-icon-info search_icon' title='Available makes are listed'>&nbsp;</span><br/>\r\n\t\t\t" . create_builder_dropdown($fields_xml) . "</p>\r\n\t\t\t<p>" . __('Currently lying:', 'smartbroker') . "&nbsp;<span class='ui-icon ui-icon-info search_icon' title='Boats are available in the countries listed.'>&nbsp;</span><br/>\r\n\t\t\t" . create_country_dropdown($fields_xml) . "</p>\r\n\t\t\t<p>" . __('Built after:', 'smartbroker') . "<br/>\r\n\t\t\t" . make_date_dropdown(intval($sb_config['year_min']), intval($sb_config['year_max'])) . "</p>\r\n\t\t</div> <!-- End sb_advanced_options -->";
        //fifth: advanced and search button
        $a .= "<a href='#'><small id='sb_show_advanced'>Show advanced search options &#9660;</small></a><br/><br/>\r\n\t\t<input type='submit' value='" . __('Search', 'smartbroker') . "' />";
        $a .= "<input type='hidden' name='ln' value='" . intval($sb_config['data']['ln']) . "'/>\r\n";
        $a .= "<input type='hidden' name='cr' value='" . $sb_config['currency_1'] . "'/>\r\n";
        $a .= "<div style='display: none;' id='size_min'>" . intval($sb_config['size_min']) . "</div>\r\n";
        $a .= "<div style='display: none;' id='size_max'>" . intval($sb_config['size_max']) . "</div>\r\n";
        $a .= "<div style='display: none;' id='price_min'>" . intval($sb_config['price_min']) . "</div>\r\n";
        $a .= "<div style='display: none;' id='price_max'>" . intval($sb_config['price_max']) . "</div>\r\n\r\n";
        $a .= "</form>";
        return $a;
    }
    return FALSE;
}