/**
  * Init form
  */
 protected function initForm()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
     $title = $this->isNew ? $this->pl->txt('add_new_type') : $this->pl->txt('edit_type');
     $this->setTitle($title);
     $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $item->setRequired(true);
     $item->setValue($this->type->getTitle());
     $this->addItem($item);
     $item = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $item->setValue($this->type->getDescription());
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->lng->txt('languages'), 'languages');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $langs = $this->lng->getInstalledLanguages();
     $options = array();
     foreach ($langs as $lang_code) {
         $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
     }
     $item->setOptions($options);
     $item->setValue($this->type->getLanguages());
     $item->setRequired(true);
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->lng->txt('roles'), 'roles');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $roles = $this->rbac->getRolesByFilter(ilRbacReview::FILTER_ALL, 0, '');
     $options = array();
     $hide_roles = array(14, 5);
     foreach ($roles as $role) {
         if (strpos($role['title'], 'il_') === 0 || in_array($role['obj_id'], $hide_roles)) {
             // Don't show auto-generated roles. If this takes to much performance, write query...
             continue;
         }
         $options[$role['obj_id']] = $role['title'];
     }
     $item->setOptions($options);
     $item->setValue($this->type->getRoles());
     $item->setInfo($this->pl->txt('roles_info'));
     $this->addItem($item);
     $item = new ilMultiSelectInputGUI($this->pl->txt('available_objects'), 'available_objects');
     $item->setWidth(self::WIDTH_MULTISELECT_INPUT);
     $options = array();
     foreach (srCertificateType::getAllAvailableObjectTypes() as $type) {
         $options[$type] = $type;
     }
     $item->setOptions($options);
     $item->setValue($this->type->getAvailableObjects());
     $item->setRequired(true);
     $item->setInfo($this->pl->txt('available_objects_info'));
     $this->addItem($item);
     $this->addCommandButton('saveType', $this->lng->txt('save'));
 }