public function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     $title = company_title::get_titlebyid($this->deptid);
     // Then show the fields about where this block appears.
     if ($this->action == 0) {
         $mform->addElement('header', 'header', get_string('createtitle', 'local_manage_company_dept_title'));
     } else {
         $mform->addElement('header', 'header', get_string('edittitles', 'local_manage_company_dept_title'));
     }
     $mform->addElement('hidden', 'companyid', $this->selectedcompany);
     $mform->setType('companyid', PARAM_INT);
     $mform->addElement('hidden', 'titleid', $this->deptid);
     $mform->setType('titleid', PARAM_INT);
     $mform->addElement('hidden', 'action', $this->action);
     $mform->setType('action', PARAM_INT);
     //$mform->addElement('select', 'deptid', get_string('title', 'block_iomad_company_admin'), $titleslist);
     //$mform->disabledIf('deptid', 'action', 'eq', 1);
     $mform->addElement('text', 'fullname', get_string('fullnametitle', 'local_manage_company_dept_title'), 'maxlength = "254" size = "50"');
     $mform->addHelpButton('fullname', 'fullnametitle', 'local_manage_company_dept_title');
     $mform->addRule('fullname', get_string('missingfullnametitle', 'local_manage_company_dept_title'), 'required', null, 'client');
     $mform->setType('fullname', PARAM_MULTILANG);
     $mform->addElement('text', 'shortname', get_string('shortnametitle', 'local_manage_company_dept_title'), 'maxlength = "100" size = "20"');
     $mform->addHelpButton('shortname', 'shortnametitle', 'local_manage_company_dept_title');
     $mform->addRule('shortname', get_string('missingshortnametitle', 'local_manage_company_dept_title'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_MULTILANG);
     /* if ($this->deptid) {
        echo "ggh";
        $mform->addElement('hidden', 'chosenid', $this->deptid);
        } else {
        $mform->addElement('hidden', 'chosenid', 0);
        } */
     //$mform->setType('chosenid', PARAM_INT);
     $this->add_action_buttons();
 }