id=$p_id;
$this->item=array();
$this->value=$value;
$this->cnt=0;
$this->default_value=-1;
$this->style_box="";
$this->filter="";
$this->position="normal";
}
public function get_id()
{
return $this->id;
}
public function set_id($id)
{
$this->id=$id;
return $this;
}
public function get_item()
{
return $this->item;
}
public function get_default_value()
{
return $this->default_value;
}
public function set_item($item)
{
$this->item=$item;
return $this;
}
public function set_default_value($default_value)
{
$this->default_value=$default_value;
return $this;
}
public function get_position()
{
return $this->position;
}
public function set_position($position)
{
if (!in_array($position, array("normal", "in-absolute", "absolute")))
{
throw new Exception("SB0005", EXC_PARAM_VALUE);
}
$this->position=$position;
return $this;
}
protected function compute_position()
{
$list_id=sprintf('%s_list', $this->id);
switch ($this->position)
{
case 'absolute':
case "normal":
case "in-absolute":
// Show when click
$javascript=sprintf('
$("%s_bt").onclick=function() {
displaySelectBox("%s");
}
', $this->id, $this->id);
break;
default:
break;
}
return $javascript;
}
function input()
{
$list_id=sprintf('%s_list', $this->id);
// Show when click
$javascript=$this->compute_position();
// display the button
printf('',
$this->id, $this->value);
printf('',
$this->id, $this->id, $this->default_value);
printf('
',
$this->id, $this->style_box);
// Show the filter if there is one,
if ($this->filter!="")
{
echo HtmlInput::filter_list($list_id);
}
// Print the list of possible options
printf('
', $list_id);
for ($i=0; $iitem); $i++)
{
if ($this->item[$i]['type']=="url")
{
printf('