Example #1
0
</div>
<?php 
}
$validsubcattype = array('source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec');
$type = $_GET['type'];
if ($type == '') {
    $type = 'searchbox';
} else {
    check_valid_type($type);
}
$action = $_GET['action'];
if ($action == '') {
    $action = 'view';
}
if ($action == 'view') {
    print_type_list($type);
    ?>
<div style="margin-top: 8px">
<?php 
    if (in_array($type, $validsubcattype)) {
        print_sub_category_list($type);
    } elseif ($type == 'searchbox') {
        $perpage = 50;
        $dbtablename = return_category_db_table_name($type);
        $num = get_row_count($dbtablename);
        if (!$num) {
            print "<p align=\"center\">" . $lang_catmanage['text_no_record_yet'] . "</p>";
        } else {
            list($pagertop, $pagerbottom, $limit) = pager($perpage, $num, "?{$_SERVER['QUERY_STRING']}&");
            $res = sql_query("SELECT * FROM " . $dbtablename . " ORDER BY id ASC " . $limit) or sqlerr(__FILE__, __LINE__);
            ?>
    function form($instance)
    {
        #
        #       Set up some default widget settings
        #
        $default = array('title' => 'London', 'tflag' => '0', 'transparentflag' => '0', 'ampmflag' => '0', 'country' => 'GB', 'new_country_flag' => '', 'country_name' => 'United Kingdom', 'state' => '', 'state_name' => '', 'city' => 'London', 'size' => '150', 'typeflag' => '1000', 'text_color' => '#000000', 'border_color' => '#963939', 'background_color' => '#FFFFFF');
        if (!isset($instance['country'])) {
            $instance = $default;
        }
        // Extract value from instance
        $title = format_to_edit($instance['title']);
        #$title = htmlspecialchars($instance['title'], ENT_QUOTES);
        $tflag = htmlspecialchars($instance['tflag'], ENT_QUOTES);
        $transparent_flag = htmlspecialchars($instance['transparentflag'], ENT_QUOTES);
        $country = htmlspecialchars($instance['country'], ENT_QUOTES);
        $new_country_flag = htmlspecialchars($instance['new_country_flag'], ENT_QUOTES);
        $state = htmlspecialchars($instance['state'], ENT_QUOTES);
        $country_name = htmlspecialchars($instance['country_name'], ENT_QUOTES);
        $state_name = htmlspecialchars($instance['state_name'], ENT_QUOTES);
        $city = htmlspecialchars($instance['city'], ENT_QUOTES);
        $size = htmlspecialchars($instance['size'], ENT_QUOTES);
        $typeflag = htmlspecialchars($instance['typeflag'], ENT_QUOTES);
        $ampmflag = htmlspecialchars($instance['ampmflag'], ENT_QUOTES);
        $text_color = htmlspecialchars($instance['text_color'], ENT_QUOTES);
        $border_color = htmlspecialchars($instance['border_color'], ENT_QUOTES);
        $background_color = htmlspecialchars($instance['background_color'], ENT_QUOTES);
        #
        #
        #               START FORM OUTPUT
        #
        #
        echo '<div style="margin-bottom:10px"></div>';
        // Get country, state, city
        echo '<p><label for="' . $this->get_field_id('country') . '">Country <span style="display:inline;font-size:9px">(Save after selecting)</span>' . '<select id="' . $this->get_field_id('country') . '" name="' . $this->get_field_name('country') . '" style="width:100%">';
        $country_name = print_thecountry_list($country);
        echo '</select></label></p>';
        // Get province
        if (has_provinces($country)) {
            echo '<p><label for="' . $this->get_field_id('state') . '">Province or State <span style="display:inline;font-size:9px">(Save after selecting)</span>' . '<select id="' . $this->get_field_id('state') . '" name="' . $this->get_field_name('state') . '" style="width:100%">';
            $state_name = print_theprovince_list($country, $state);
            echo '</select></label></p>';
        } else {
            $state = "";
        }
        if ($new_country_flag == 1) {
            $city = "";
        }
        // Get city
        echo '<p><label for="' . $this->get_field_id('city') . '">City: ';
        echo '<input style="width: 90%;"t id="' . $this->get_field_id('city') . '" name="' . $this->get_field_name('city') . '" type="text" value="' . $city . '" /> </label></p>';
        // Set clock type
        echo '<p><label for="' . $this->get_field_id('typeflag') . '">' . 'Clock Type:&nbsp;';
        echo '<select id="' . $this->get_field_id('typeflag') . '" name="' . $this->get_field_name('typeflag') . '"  style="width:125px" >';
        print_type_list($typeflag);
        echo '</select></label>';
        echo '</p>';
        // Set Clock size
        echo "\n";
        echo '<p><label for="' . $this->get_field_id('size') . '">' . 'Clock Size: &nbsp;' . '<select id="' . $this->get_field_id('size') . '" name="' . $this->get_field_name('size') . '"  style="width:75px">';
        print_thesize_list($size);
        echo '</select></label></p>';
        // Set Text Clock color
        echo '<p><label for="' . $this->get_field_id('text_color') . '">' . 'Text Color: &nbsp;';
        echo '<select id="' . $this->get_field_id('text_color') . '" name="' . $this->get_field_name('text_color') . '"  style="width:75px" >';
        print_textcolor_list($text_color);
        echo '</select></label>';
        echo '</p>';
        if ($typeflag < 1000) {
            // Set Border Clock color
            echo '<p><label for="' . $this->get_field_id('border_color') . '">' . 'Border Color:&nbsp;';
            echo '<select id="' . $this->get_field_id('border_color') . '" name="' . $this->get_field_name('border_color') . '"  style="width:75px" >';
            print_bordercolor_list($border_color);
            echo '</select></label>';
            echo '</p>';
        } else {
            echo '<label for="' . $this->get_field_id('border_color') . '">';
            echo '<input id="' . $this->get_field_id('border_color') . '" name="' . $this->get_field_name('border_color') . '" type="hidden" value="' . $border_color . '" /></label>';
        }
        // Set Background Clock color
        echo '<p><label for="' . $this->get_field_id('background_color') . '">' . 'Background Color:&nbsp;';
        echo '<select id="' . $this->get_field_id('background_color') . '" name="' . $this->get_field_name('background_color') . '"  style="width:75px" >';
        print_backgroundcolor_list($background_color);
        echo '</select></label>';
        echo '</p>';
        //   Transparent option
        $transparent_checked = "";
        if ($transparent_flag == "1") {
            $transparent_checked = "CHECKED";
        }
        echo "\n";
        echo '<p><label for="' . $this->get_field_id('transparentflag') . '"> Transparent: 
		   <input type="checkbox"t id="' . $this->get_field_id('transparentflag') . '" name="' . $this->get_field_name('transparentflag') . '" value=1 ' . $transparent_checked . ' /> 
		   </label></p>';
        //   ampm option
        $ampm_checked = "";
        if ($ampmflag == "1") {
            $ampm_checked = "CHECKED";
        }
        echo "\n";
        echo '<p><label for="' . $this->get_field_id('ampmflag') . '"> am/pm format: 
		      <input type="checkbox"t id="' . $this->get_field_id('ampmflag') . '" name="' . $this->get_field_name('ampmflag') . '" value=1 ' . $ampm_checked . ' /> 
		      </label></p>';
        $title_checked = "";
        if ($tflag == "1") {
            $title_checked = "CHECKED";
        }
        echo '<p><label for="' . $this->get_field_id('tflag') . '"> City Title: 
		  <input type="checkbox"t id="' . $this->get_field_id('tflag') . '" name="' . $this->get_field_name('tflag') . '" value=1 ' . $title_checked . ' /> 
		  </label></p>';
        echo "\n";
        echo '<label for="' . $this->get_field_id('title') . '">';
        echo '<input type="hidden" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" />';
        echo '</label>';
    }