/**
  * Inits the element to select the importhandler
  * and takes over the elements of the import form
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return mixed
  */
 public function initElements()
 {
     //create the element to select the import format
     $formatElt = tao_helpers_form_FormFactory::getElement('importHandler', 'Radiobox');
     $formatElt->setDescription(__('Choose import format'));
     $formatElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
     // should never happen anyway
     $importHandlerOptions = array();
     foreach ($this->importHandlers as $importHandler) {
         $importHandlerOptions[get_class($importHandler)] = $importHandler->getLabel();
     }
     $formatElt->setOptions($importHandlerOptions);
     $classUriElt = tao_helpers_form_FormFactory::getElement('classUri', 'Hidden');
     //		$classUriElt->setValue($class->getUri());
     $this->form->addElement($classUriElt);
     $classUriElt = tao_helpers_form_FormFactory::getElement('id', 'Hidden');
     $this->form->addElement($classUriElt);
     $this->form->addElement($formatElt);
     $this->form->createGroup('formats', __('Supported import formats'), array('importHandler'));
     if (!is_null($this->subForm)) {
         //			load dynamically the method regarding the selected format
         $this->form->setElements(array_merge($this->form->getElements(), $this->subForm->getElements()));
         foreach ($this->subForm->getGroups() as $key => $group) {
             $this->form->createGroup($key, $group['title'], $group['elements'], $group['options']);
         }
     }
 }
 /**
  * Short description of method initElements
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return mixed
  */
 public function initElements()
 {
     if (count($this->exportHandlers) > 1) {
         //create the element to select the import format
         $formatElt = tao_helpers_form_FormFactory::getElement('exportHandler', 'Radiobox');
         $formatElt->setDescription(__('Choose export format'));
         //mandatory field
         $formatElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
         $formatElt->setOptions($this->getFormats());
         if (isset($_POST['exportHandler'])) {
             if (array_key_exists($_POST['exportHandler'], $this->getFormats())) {
                 $formatElt->setValue($_POST['exportHandler']);
             }
         }
         $this->form->addElement($formatElt);
         $this->form->createGroup('formats', __('Supported export formats'), array('exportHandler'));
     }
     if (isset($this->data['instance'])) {
         $item = $this->data['instance'];
         if ($item instanceof core_kernel_classes_Resource) {
             //add an hidden elt for the instance Uri
             $uriElt = tao_helpers_form_FormFactory::getElement('uri', 'Hidden');
             $uriElt->setValue($item->getUri());
             $this->form->addElement($uriElt);
         }
     }
     if (isset($this->data['class'])) {
         $class = $this->data['class'];
         if ($class instanceof core_kernel_classes_Class) {
             //add an hidden elt for the class uri
             $classUriElt = tao_helpers_form_FormFactory::getElement('classUri', 'Hidden');
             $classUriElt->setValue($class->getUri());
             $this->form->addElement($classUriElt);
         }
     }
     $idElt = tao_helpers_form_FormFactory::getElement('id', 'Hidden');
     $this->form->addElement($idElt);
     foreach ($this->subForm->getElements() as $element) {
         $this->form->addElement($element);
     }
     foreach ($this->subForm->getGroups() as $group) {
         $this->form->createGroup($group['title'], $group['title'], $group['elements'], $group['options']);
     }
 }