Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     $radioKind = new Zend_Form_Element_Radio('kind');
     $radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
     $radioKind->setValue('and');
     $radioKind->setLabel('Search field combination:');
     $radioKind->setRequired(true);
     $this->addElement($radioKind);
     $fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE);
     $fishSampleCode->setLabel('Fish Sample Code:');
     //---------------------------------------------------------
     //read the available image attributes from attribute descriptor+group image
     $metadata = new Default_MetaData();
     $fishRowSetArray = $metadata->getAttributesComplete('fish');
     //----------------------------------------------------------
     $this->addDynamicElements($fishRowSetArray, true);
     $this->addElement($fishSampleCode);
     $this->addElement('submit', 'submit', array('label' => 'search'));
     $this->addElement('hidden', 'Token');
     $this->setElementFilters(array('StringTrim'));
     //#####################new###################################
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'dynamic_form')), array('Description', array('placement' => 'prepend')), 'Form'));
     $this->setElementDecorators(array('ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     $this->setSubFormDecorators(array('FormElements', array('HtmlTag', array('tag' => 'tr'))));
     foreach ($this->getSubForms() as $index => $subform) {
         $subform->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
     }
     $this->submit->setDecorators(array(array('decorator' => 'ViewHelper', 'options' => array('helper' => 'formSubmit')), array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td', 'colspan' => 2)), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
     //###########################################################
 }
Exemple #2
0
 public function getAttributes($key)
 {
     $this->key = $key;
     try {
         $parser = new Ble422_CsvParser(self::RELATIVE_PATH_UPLOAD_CACHE . $this->key . '/import.csv', TRUE, ',', NULL, TRUE);
     } catch (Exception $e) {
         return array('returnCode' => 'initial error', 'message' => $e->getMessage);
     }
     $headings = $parser->getHeadings();
     if (count($headings) <= 1) {
         return array('returnCode' => 'initial error', 'message' => 'Error: zero or only one heading found, wrong delitimer?');
     }
     $datasets = array();
     $datasets = $parser->get(0);
     if (empty($datasets)) {
         return array('returnCode' => 'initial error', 'message' => 'Error: no dataset found');
     }
     //add attributes from table fish and image (not defined over attribute system) manually
     $fishBaseAttr = array(array(AttributeDescriptor::COL_NAME => Fish::COL_SAMPLE_CODE, AttributeDescriptor::COL_REQUIRED => TRUE));
     $imageBaseAttr = array(array(AttributeDescriptor::COL_NAME => Image::COL_ORIGINAL_FILENAME, AttributeDescriptor::COL_REQUIRED => TRUE), array(AttributeDescriptor::COL_NAME => Image::COL_RATIO_EXTERNAL, AttributeDescriptor::COL_REQUIRED => TRUE));
     $meta = new Default_MetaData();
     $attribRowset = array();
     $attribRowset[0] = array(AttributeDescriptor::COL_NAME => "--ignore--");
     foreach ($fishBaseAttr as $key => $val) {
         $attribRowset[] = $val;
     }
     $fishAttribs = $meta->getAttributesComplete('FISH', AttributeDescriptor::COL_NAME);
     foreach ($fishAttribs as $key => $val) {
         $attribRowset[] = $val;
     }
     foreach ($imageBaseAttr as $key => $val) {
         $attribRowset[] = $val;
     }
     $imageAttribs = $meta->getAttributesComplete('IMAGE', AttributeDescriptor::COL_NAME);
     foreach ($imageAttribs as $key => $val) {
         $attribRowset[] = $val;
     }
     return array('returnCode' => 'success', 'message' => 'success', 'csvHeadings' => $headings, 'systemAttributes' => $attribRowset);
 }
Exemple #3
0
 public function __construct()
 {
     parent::__construct();
     $this->addElement('hidden', Image::COL_ID, array('required' => true));
     $this->addElement('text', Image::COL_ORIGINAL_FILENAME, array('label' => 'original filename:', 'required' => true));
     $this->addElement('text', Image::COL_RATIO_EXTERNAL, array('label' => 'ratio physical structure length / pixel [micrometer]:', 'required' => true));
     //---------------------------------------------------------
     //read the available image attributes from attribute descriptor+group image
     $metadata = new Default_MetaData();
     $imageRowSetArray = $metadata->getAttributesComplete('image');
     //----------------------------------------------------------
     $this->addDynamicElements($imageRowSetArray);
     $this->addElement('submit', 'save', array('label' => 'Save'));
     $this->addElement('hidden', 'Token');
     $this->setElementFilters(array('StringTrim'));
 }
Exemple #4
0
 public function __construct()
 {
     parent::__construct();
     $this->addElement('hidden', Fish::COL_ID, array('required' => true));
     $fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE);
     $fishSampleCode->setLabel('Fish Sample Code:');
     //---------------------------------------------------------
     //read the available image attributes from attribute descriptor+group image
     $metadata = new Default_MetaData();
     $fishRowSetArray = $metadata->getAttributesComplete('fish');
     //----------------------------------------------------------
     $this->addDynamicElements($fishRowSetArray);
     $this->addElement($fishSampleCode);
     $this->addElement('submit', 'save', array('label' => 'Save'));
     $this->addElement('hidden', 'Token');
     $this->setElementFilters(array('StringTrim'));
 }