Example #1
0
/**
* builds html select
* @access public
* @param  $name string
* @param  $value array(label=>, value=>)
* @param  $title string
* @param  $selected array()
* @return string
*/
function htmlobject_select_simple($name, $value, $title = '', $selected = '')
{
    $html = new htmlobject_select();
    $html->name = $name;
    $html->title = $title;
    $html->selected = $selected;
    $html->text_index = array("value" => "value", "text" => "label");
    $html->text = $value;
    return $html->get_string();
}
 function get_sort()
 {
     $strR = '';
     if ($this->sort != '') {
         foreach ($this->head as $key_2 => $v) {
             if (isset($v['sortable']) == false) {
                 $v['sortable'] = true;
             }
             if ($v['sortable'] == true) {
                 $value[] = array("value" => $key_2, "label" => $v['title']);
             }
         }
         $sort = new htmlobject_select();
         $sort->id = 'p' . uniqid();
         $sort->name = $this->_var_prefix . 'sort';
         $sort->text_index = array("value" => "value", "text" => "label");
         $sort->text = $value;
         $sort->selected = array($this->sort);
         $str_sort = '<label for="' . $sort->id . '">' . $this->lang_label_sort . $sort->get_string() . '</label>';
         $order = new htmlobject_select();
         $order->id = 'p' . uniqid();
         $order->name = $this->_var_prefix . 'order';
         $order->text_index = array("value" => "value", "text" => "text");
         $order->text = array(array("value" => "ASC", "text" => "ASC"), array("value" => "DESC", "text" => "DESC"));
         $order->selected = array($this->order);
         $str_order = $order->get_string();
         if (count($this->limit_select) <= 0) {
             $this->limit_select = array(array("value" => 0, "text" => $this->lang_option_nolimit), array("value" => 10, "text" => 10), array("value" => 20, "text" => 20), array("value" => 30, "text" => 30), array("value" => 40, "text" => 40), array("value" => 50, "text" => 50));
         }
         $limit_input = new htmlobject_select();
         $limit_input->id = 'p' . uniqid();
         $limit_input->name = $this->_var_prefix . 'limit';
         $limit_input->text_index = array("value" => "value", "text" => "text");
         $limit_input->text = $this->limit_select;
         $limit_input->selected = array($this->limit);
         $str_limit = '<label for="' . $limit_input->id . '">' . $this->lang_label_limit . $limit_input->get_string() . '</label>';
         $offset_input = new htmlobject_input();
         $offset_input->id = 'p' . uniqid();
         $offset_input->name = $this->_var_prefix . 'offset';
         $offset_input->value = "{$this->offset}";
         $offset_input->type = 'text';
         $offset_input->size = 3;
         $str_offset = '<label for="' . $offset_input->id . '">' . $this->lang_label_offset . $offset_input->get_string() . '</label>';
         $max_input = new htmlobject_input();
         $max_input->name = $this->_var_prefix . 'max';
         $max_input->value = $this->max;
         $max_input->type = 'hidden';
         $action = new htmlobject_input();
         $action->name = $this->_var_prefix . 'action';
         $action->value = $this->lang_button_refresh;
         $action->type = 'submit';
         $strR = '<div class="sort_box">';
         $strR .= $max_input->get_string() . $str_sort . $str_order . $str_offset . $str_limit . $action->get_string();
         $strR .= '<div style="line-height:0px;clear:both;">&#160;</div>';
         $strR .= '</div>';
     }
     return $strR;
 }