form_type= $form_type;
if (isset ($user))
{
$this->user_info= $user;
}
if (isset ($result_object))
{
$this->result_object= $result_object;
}
if ($this->form_type == self :: TYPE_USER_INFO)
{
$this->build_user_info_form();
}
elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH)
{
$this->build_simple_search();
}
$this->setDefaults();
}
protected function build_simple_search()
{
if (isset($_GET['search']) && (!empty($_GET['search'])))
{
$this->setDefaults(array(
'keyword' => Security::remove_XSS($_GET['search'])
));
}
$renderer =& $this->defaultRenderer();
$renderer->setElementTemplate('{element} ');
$this->addElement('text','keyword','');
$this->addElement('submit','submit',get_lang('Search'));
}
protected function build_user_info_form()
{
$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
$this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
$this->addElement('static', 'email', get_lang('Email'), '' . $this->user_info['email'] . '');
$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
$this->addElement('submit', null, get_lang('Back'));
}
function display()
{
parent :: display();
}
function setDefaults($defaults= array ())
{
parent :: setDefaults($defaults);
}
}
?>