Beispiel #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'))));
     //###########################################################
 }
 public function createattributecsvAction()
 {
     $csvString = '';
     // prepare the header
     $fishBaseAttr = array(Fish::COL_SAMPLE_CODE);
     $imageBaseAttr = array(Image::COL_ORIGINAL_FILENAME, Image::COL_RATIO_EXTERNAL);
     $meta = new Default_MetaData();
     $attribRowset = array_merge($fishBaseAttr, $meta->getAttributesBasic('FISH'), $imageBaseAttr, $meta->getAttributesBasic('IMAGE'));
     /*handle last item differently
      * credit:grobemo
      * 24-Apr-2009 08:13
      * http://de3.php.net/manual/en/control-structures.foreach.php
      */
     $last_item = end($attribRowset);
     foreach ($attribRowset as $attr) {
         if ($attr == $last_item) {
             if (is_array($attr) && array_key_exists(AttributeDescriptor::COL_NAME, $attr)) {
                 $csvString .= $attr[AttributeDescriptor::COL_NAME];
             } else {
                 $csvString .= $attr;
             }
         } else {
             if (is_array($attr) && array_key_exists(AttributeDescriptor::COL_NAME, $attr)) {
                 $csvString .= $attr[AttributeDescriptor::COL_NAME] . ',';
             } else {
                 $csvString .= $attr . ',';
             }
         }
     }
     $csvString .= "\n";
     $this->view->csvString = $csvString;
     // generate the download file
     Zend_Layout::resetMvcInstance();
     $this->render('csvstring');
 }
Beispiel #3
0
 public function searchAction()
 {
     $request = $this->getRequest();
     $formValues = $this->namespace->formValues;
     $this->view->callingAction = $this->defaultNamespace->callingAction;
     // get meta data select for image and fish descriptors
     $metaData = new Default_MetaData();
     $metaData->getSelectForGroups(FALSE);
     $select = $metaData->addWhereToSelect($formValues);
     //TODO test with multiple fish / multiple image checked attributes
     //changed, if images are found, but search was for fish, multiple image attributes would cause multiple entries
     //TODO error: only first fish without images shown due to this group; if there are many fishes without image, there is only one of them shown in list
     $select->group('fish.' . Fish::COL_ID);
     if ($this->defaultNamespace->callingAction == 'annotation/browse/byfish') {
         $select->joinLeft(array('vaa' => 'v_all_annotations'), 'vaa.' . CeHasImage::COL_IMAGE_ID . ' = ' . 'image.' . Image::COL_ID, array());
         //auf cehas_image damit die ausgefiltert werden die keine annotationen haben
         $select->group('image.' . Image::COL_ID);
         $resultArray = Zend_Registry::get('DB_CONNECTION1')->fetchAll($select);
         if ($resultArray != array()) {
             $resultKey = new Ble422_Guid();
             $this->defaultNamespace->{$resultKey} = $resultArray;
             $redirect = new Zend_Controller_Action_Helper_Redirector();
             $redirect->setGotoSimple('start', 'browse', 'annotation', array('resultKey' => $resultKey));
         }
     } else {
         //select only own fish
         if ($this->defaultNamespace->callingAction == 'user/edit/myfishes') {
             $select->where('fish.' . Fish::COL_USER_ID . ' = ?', $this->defaultNamespace->callingActionId);
         }
         //new
         $this->namespace->select = $select;
         //new
         /**
          * Pagination control
          */
         $paginator = new Ble422_Paginator_Extended($select, $this->getRequest());
         //static + dynamic header array
         $statArray = array(array('raw' => Fish::COL_SAMPLE_CODE, 'name' => 'Fish sample code'));
         $dynArray = array();
         $i = 0;
         foreach ($metaData->fishRowSetArray as $fishAttr) {
             $dynInnerArray = array('raw' => 'ATDE_' . $fishAttr[AttributeDescriptor::COL_ID], 'name' => $fishAttr[AttributeDescriptor::COL_NAME] . '<br>' . $fishAttr['UNIT']);
             $dynArray[$i] = $dynInnerArray;
             $i++;
         }
         $headerArray = array_merge($statArray, $dynArray);
         unset($i);
         unset($dynArray);
         unset($dynInnerArray);
         $paginator->setHeader($headerArray);
         $paginator->setCurrentPageNumber($this->getRequest()->getParam('page'))->setItemCountPerPage(1000)->setPageRange(10)->orderBy($this->getRequest()->getParam('orderBy'));
         //$this->_getParam('pageRange'));
         Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/list_pagination_control.phtml');
         $this->view->paginator = $paginator;
         $storage = Zend_Auth::getInstance()->getStorage()->read();
         $constUserRole = User::COL_ROLE;
         $this->view->userRole = $storage->{$constUserRole};
     }
 }
Beispiel #4
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'));
 }
Beispiel #5
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'));
 }
 public function imagesAction()
 {
     $ceId = $this->getRequest()->getParam(CalibrationExercise::COL_ID);
     $metaData = new Default_MetaData();
     $select = $metaData->getSelectForGroups();
     $select->join(array('cehim' => CeHasImage::TABLE_NAME), $this->dbAdapter->quoteIdentifier('image.' . Image::COL_ID) . '=' . $this->dbAdapter->quoteIdentifier('cehim.' . CeHasImage::COL_IMAGE_ID), array());
     $select->where(CeHasImage::COL_CALIBRATION_EXERCISE_ID . "=?", $ceId);
     //prepare the header
     $headerArray = array(Image::COL_ORIGINAL_FILENAME => 'Original file name', Fish::COL_SAMPLE_CODE => 'Fish sample code', Image::COL_DIM_X => 'Width', Image::COL_DIM_Y => 'Height');
     foreach ($metaData->fishRowSetArray as $fishAttr) {
         $headerArray = $headerArray + array('ATDE_' . $fishAttr[AttributeDescriptor::COL_ID] => $fishAttr[AttributeDescriptor::COL_NAME] . '<br>' . $fishAttr['UNIT']);
     }
     foreach ($metaData->imageRowSetArray as $imAttr) {
         $headerArray = $headerArray + array('ATDE_' . $imAttr[AttributeDescriptor::COL_ID] => $imAttr[AttributeDescriptor::COL_NAME] . '<br>' . $imAttr['UNIT']);
     }
     $imagesArray[0] = $headerArray;
     //echo $select;
     $imagesArray = array_merge($imagesArray, $this->dbAdapter->fetchAll($select));
     $this->configureView($imagesArray, $ceId, 'images.csv');
 }
Beispiel #7
0
 /**
  * grouping function
  * checks the CSV file and prepares the datasets for import, and gives detailled arrays back for single steps for further processing and report
  * 1. checks the CSV file column against uploaded files
  * 2. checks the header
  * 3. checks the columns with value list entries and changes from strings to ids
  * 4. splits and checks the datasets against fish and image form
  * @param $key the subdirectory for csv and image files
  * @param $systemAttributes INPUT from flex assigning, elements order is 1:1 to csvHeadings
  * @param $csvHeadings INPUT from flex assigning, elements order is 1:1 to systemAttributes
  * @param $filenames filenames of files to upload, including import.csv
  * @return unknown_type
  */
 public function checkCsv($key, $systemAttributes, $csvHeadings, $filenames)
 {
     $this->key = $key;
     $this->logger = new Ble422_ArrayLogger(self::RELATIVE_PATH_IMPORT_LOGS . $this->key . '_import_log.txt');
     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);
     }
     //print_r($this->parser->getHeadings());
     $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');
     }
     if (empty($filenames)) {
         return array('returnCode' => 'initial error', 'message' => 'Error: no filenames found');
     }
     //echo $this->datasets[0]['Über2'];
     //echo $this->datasets[1]['Über3'];
     if (count($systemAttributes) >= 1 && count($csvHeadings) >= 1) {
         $useManualAssociation = TRUE;
         if (count($systemAttributes) != count($csvHeadings)) {
             return array('returnCode' => 'initial error', 'message' => 'Error: number of system attributes and CSV file headings not equal');
         }
         //delete the additional information from the attribute string
         foreach ($systemAttributes as &$attr) {
             $pos = strrpos($attr, '#');
             if ($pos === false) {
                 // not found
             } else {
                 //- 1 because space sign
                 $attr = substr($attr, 0, $pos - 1);
             }
         }
         //$headingsArray = $this->createHeadingsArray();
         $datasets = $this->getDatasetsWithNewHeadings($datasets, $systemAttributes, $csvHeadings);
         $headings = $systemAttributes;
     } else {
         $useManualAssociation = FALSE;
     }
     //additional array (keys without spaces) for xml XXX has no recursive handling --------------
     $datasetsForXml = array();
     foreach ($datasets as $rowNo => $dataset) {
         $newDataset = array();
         foreach ($dataset as $keyName => $value) {
             $newKeyName = str_replace(' ', '_', $keyName);
             $newDataset += array($newKeyName => $value);
         }
         $datasetsForXml[$rowNo] = $newDataset;
     }
     //----------------------------------------------------------
     $this->logger->log(array('user' => AuthQuery::getUserName()));
     $this->logger->log(array('originalInput' => $datasets));
     //XXX handle association array added info
     try {
         if (!$useManualAssociation) {
             $fileNamesCsv = $this->extractColumn($datasets, Image::COL_ORIGINAL_FILENAME);
         } else {
             $fileNamesCsv = $this->extractColumn($datasets, Image::COL_ORIGINAL_FILENAME);
         }
     } catch (OutOfBoundsException $e) {
         return array('returnCode' => 'initial error', 'message' => "Error: column not found\n" . $e->getMessage);
     }
     try {
         $this->extractColumn($datasets, Fish::COL_SAMPLE_CODE);
     } catch (OutOfBoundsException $e) {
         return array('returnCode' => 'initial error', 'message' => "Error: column not found\n" . $e->getMessage);
     }
     $resultsCheckFileCsvAssoc = $this->checkFileCsvAssoc($fileNamesCsv, $filenames);
     $this->logger->log($resultsCheckFileCsvAssoc, 'resultsCheckFileCsvAssoc');
     $this->rowHasUniqueUploadedFile = $resultsCheckFileCsvAssoc['rowHasUniqueUploadedFile'];
     $fishBaseAttr = array(Fish::COL_SAMPLE_CODE);
     $imageBaseAttr = array(Image::COL_ORIGINAL_FILENAME, Image::COL_RATIO_EXTERNAL);
     $meta = new Default_MetaData();
     $attribRowset = array_merge($fishBaseAttr, $meta->getAttributesBasic('FISH'), $imageBaseAttr, $meta->getAttributesBasic('IMAGE'));
     $resultsCheckHeader = $this->checkHeader($headings, $attribRowset);
     $this->logger->log($resultsCheckHeader, 'resultsCheckHeader');
     //print_r($resultsCheckHeader);
     $this->matchingCols = $resultsCheckHeader['matchingColumns'];
     //get matching columns which have value list attributes
     $matchingColsWithValuelist = $resultsCheckHeader['matchingColumns'];
     foreach ($matchingColsWithValuelist as $key => $match) {
         if (is_array($match)) {
             //meta data
             if ($match[AttributeDescriptor::COL_VALUE_LIST] == 0) {
                 unset($matchingColsWithValuelist[$key]);
             }
         } else {
             //base date
             unset($matchingColsWithValuelist[$key]);
         }
     }
     $attribRowsetWithValuelist = array_merge($meta->getAttributesAndValuelist('FISH'), $meta->getAttributesAndValuelist('IMAGE'));
     $resultsCheckValuelistCells = $this->checkValuelistCells($datasets, $matchingColsWithValuelist, $attribRowsetWithValuelist);
     $this->logger->log($resultsCheckValuelistCells, 'resultsCheckValuelistCells');
     //		//additional array (keys without spaces) for xml --------------
     //		//copy the array
     //		$resultsCheckValuelistCellsForXml = array();
     //		foreach ($resultsCheckValuelistCells as $key => $val) {
     //			$resultsCheckValuelistCellsForXml[$key] = $val;
     //		}
     //		//replace the subarray 'modifiedDatasets'
     //				foreach ($resultsCheckValuelistCells['modifiedDatasets'] as $rowNo => $attrValPair) {
     //					$newDataset = array();
     //					foreach ($attrValPair as $keyName => $value) {
     //						$newKeyName = str_replace(' ', '_', $keyName);
     //						$newDataset += array($newKeyName => $value);
     //					}
     //					$resultsCheckValuelistCellsForXml['modifiedDatasets'][$rowNo] = $newDataset;
     //				}
     //
     //		//----------------------------------------------------------
     $modifiedDatasets = $resultsCheckValuelistCells['modifiedDatasets'];
     //function gets matching cols from member variable
     $resultsValidateAgainstForms = $this->validateAgainstForms($modifiedDatasets);
     $this->logger->log($resultsValidateAgainstForms, 'resultsValidateAgainstForms');
     //set member array preparedDatasets = all successful validated datasets
     $validRows = $resultsValidateAgainstForms['validRows'];
     $preparedDatasets = array();
     foreach ($validRows as $rowNo => $dataset) {
         $preparedDatasets[$rowNo]['fishFormDataset'] = $resultsValidateAgainstForms['fishFormDatasets'][$rowNo];
         $preparedDatasets[$rowNo]['imageFormDataset'] = $resultsValidateAgainstForms['imageFormDatasets'][$rowNo];
         //XXX append original filename out of original datasets
         //$preparedDatasets[$rowNo][Image::COL_ORIGINAL_FILENAME] = $datasets[$rowNo][Image::COL_ORIGINAL_FILENAME];
     }
     $this->preparedDatasets = $preparedDatasets;
     $this->logger->log($this->preparedDatasets, 'preparedDatasets');
     $resultsCheckDatasetsAgainstDatabase = $this->checkDatasetsAgainstDatabase($datasets);
     $this->logger->log($resultsCheckDatasetsAgainstDatabase, 'resultsCheckDatasetsAgainstDatabase');
     //aggregate returnCodes
     $returnCode = '';
     if ($resultsCheckFileCsvAssoc['returnCode'] == 'warning' || $resultsCheckHeader['returnCode'] == 'warning' || $resultsCheckValuelistCells['returnCode'] == 'warning' || $resultsValidateAgainstForms['returnCode'] == 'warning' || $resultsCheckDatasetsAgainstDatabase['returnCode'] == 'warning') {
         $returnCode = 'warning';
     }
     if ($resultsCheckFileCsvAssoc['returnCode'] == 'error' || $resultsCheckHeader['returnCode'] == 'error' || $resultsCheckValuelistCells['returnCode'] == 'error' || $resultsValidateAgainstForms['returnCode'] == 'error' || $resultsCheckDatasetsAgainstDatabase['returnCode'] == 'error') {
         $returnCode = 'error';
     }
     if ($returnCode == '') {
         $returnCode = 'success';
     }
     $resultsCheckFileCsvAssocForXml = $this->reduceCheckResultForXml($resultsCheckFileCsvAssoc);
     $resultsCheckHeaderForXml = $this->reduceCheckResultForXml($resultsCheckHeader);
     $resultsCheckValuelistCellsForXml = $this->reduceCheckResultForXml($resultsCheckValuelistCells);
     $resultsValidateAgainstFormsForXml = $this->reduceCheckResultForXml($resultsValidateAgainstForms);
     $resultsCheckDatasetsAgainstDatabaseForXml = $this->reduceCheckResultForXml($resultsCheckDatasetsAgainstDatabase);
     //		//give upload process the valid unique filenames
     //		$resultsCheckFileCsvAssocForXml['rowHasUniqueUploadedFile'] = $this->rowHasUniqueUploadedFile;
     $result = array('returnCode' => $returnCode, 'originalInput' => $datasetsForXml, 'resultsCheckFileCsvAssoc' => $resultsCheckFileCsvAssocForXml, 'resultsCheckHeader' => $resultsCheckHeaderForXml, 'resultsCheckValuelistCells' => $resultsCheckValuelistCellsForXml, 'resultsValidateAgainstForms' => $resultsValidateAgainstFormsForXml, 'resultsCheckDatasetsAgainstDatabase' => $resultsCheckDatasetsAgainstDatabaseForXml);
     //		print_r($result);
     //		print_r($this->preparedDatasets);
     $this->saveToNamespace();
     return $result;
 }
Beispiel #8
0
 public function addimagesatrandomAction()
 {
     //$imageNamespace = new Zend_Session_Namespace('image_search');
     $this->defaultNamespace->callingAction = '/ce/edit/addimagesatrandom';
     $this->defaultNamespace->callingActionId = $this->callingCeId;
     $attribFormValues = $this->getAttriFormValues();
     //--------------------------------------------------------------------------------
     //from search/index
     $this->formImageSearch = new Image_Form_Search();
     $this->formImageSearch->removeElement(Image::COL_ID);
     $this->formImageSearch->removeElement('save');
     //$this->formImageSearch->removeElement('kind');
     //$this->formImageSearch->addElement('submit', 'submit', array('label'=>'Search'        ));
     //set all elements to required=FALSE
     //clear all validators
     $formElements = $this->formImageSearch->getElements();
     foreach ($formElements as $elem) {
         $elem->setRequired(false);
         $elem->clearValidators();
     }
     //$this->formImageSearch->setElements($formElements);
     //----------------------------------------------------
     if ($this->formImageSearch->isValid($attribFormValues)) {
         $metaData = new Default_MetaData();
         $metaData->getSelectForGroups(TRUE);
         $select = $metaData->addWhereToSelect($attribFormValues);
         $resultRowset = Zend_Registry::get('DB_CONNECTION1')->fetchAll($select);
         //TODO resultRowset is empty
         $imageIds = array();
         foreach ($resultRowset as $rowNo => $row) {
             $imageIds[] = $row[Image::COL_ID];
         }
         //delete duplicate imageIds from multiple set values
         $uniqueImageIds = array_unique($imageIds);
         //----------------------------------------------------
         //
         //substract already assigned datasets
         $ceId = $this->defaultNamespace->callingActionId;
         $ceHasIm = new CeHasImage();
         $ceHasImSet = $ceHasIm->fetchAll(CeHasImage::COL_CALIBRATION_EXERCISE_ID . '=' . $ceId);
         if (count($ceHasImSet) > 0) {
             $possibleImageIds = array();
             foreach ($uniqueImageIds as $key => $id) {
                 $alreadyAssigned = false;
                 foreach ($ceHasImSet as $ceHasImRow) {
                     if ($id == $ceHasImRow[CeHasImage::COL_IMAGE_ID]) {
                         $alreadyAssigned = true;
                     }
                 }
                 if (!$alreadyAssigned) {
                     array_push($possibleImageIds, $id);
                 }
             }
         } else {
             //no images assigned
             $possibleImageIds = $uniqueImageIds;
         }
         //----------------------------------------------------
         $randomImageIds = Ble422_ArrayHelper::array_pick($possibleImageIds, $this->getRequest()->getParam("noImages"));
         //insert new images into ce
         $ceHimTable = new CeHasImage();
         foreach ($randomImageIds as $imageId) {
             $data = array(CeHasImage::COL_CALIBRATION_EXERCISE_ID => $this->callingCeId, CeHasImage::COL_IMAGE_ID => $imageId);
             $ceHimTable->insert($data);
         }
     }
     $this->redirectTo('index');
 }
Beispiel #9
0
 public function searchAction()
 {
     $request = $this->getRequest();
     $formValues = $this->namespace->formValues;
     $this->view->callingAction = $this->defaultNamespace->callingAction;
     // get meta data select for image and fish descriptors
     $metaData = new Default_MetaData();
     $metaData->getSelectForGroups(TRUE);
     $select = $metaData->addWhereToSelect($formValues);
     if ($this->defaultNamespace->callingAction == 'annotation/browse/byimage') {
         unset($this->namespace->ceArray);
         $select->joinLeft(array('vaa' => 'v_all_annotations'), 'vaa.' . CeHasImage::COL_IMAGE_ID . ' = ' . 'image.' . Image::COL_ID, array());
         //auf cehas_image damit die ausgefiltert werden die keine annotationen haben
         $select->where(Annotations::COL_WS_REF . "=? ", 1);
         $select->orWhere(Annotations::COL_FINAL . " = ? ", 1);
         $select->orWhere(Annotations::COL_GROUP . "=? ", 1);
         $select->orWhere(Annotations::COL_WEBGR_REF . "=? ", 1);
         $select->group('image.' . Image::COL_ID);
         $resultArray = Zend_Registry::get('DB_CONNECTION1')->fetchAll($select);
         if ($resultArray != array()) {
             $resultKey = new Ble422_Guid();
             $this->defaultNamespace->{$resultKey} = $resultArray;
             $redirect = new Zend_Controller_Action_Helper_Redirector();
             $redirect->setGotoSimple('start', 'browse', 'annotation', array('resultKey' => $resultKey));
         }
     } else {
         //select only own images
         if ($this->defaultNamespace->callingAction == 'user/edit/myimages') {
             $select->where('image.' . Image::COL_USER_ID . ' = ?', $this->defaultNamespace->callingActionId);
         }
         //filter double datasets caused by multiple meta data
         //$select->group('image.'.Image::COL_ID);
         //get already assigned datasets for setting disabled in view
         if ($this->defaultNamespace->callingAction == '/ce/edit/addimages') {
             $ceId = $this->defaultNamespace->callingActionId;
             $ceHasIm = new CeHasImage();
             $rowSet = $ceHasIm->fetchAll(CeHasImage::COL_CALIBRATION_EXERCISE_ID . '=' . $ceId);
             if (count($rowSet) > 0) {
                 $assignedImages = array();
                 foreach ($rowSet as $row) {
                     $assignedImages[$row[CeHasImage::COL_IMAGE_ID]] = TRUE;
                 }
                 $this->view->assignedImages = $assignedImages;
             }
         }
         //echo $select;
         /**
          * Pagination control
          */
         $paginator = new Ble422_Paginator_Extended($select, $this->getRequest());
         //			echo $select->__toString();
         //			die();
         //static + dynamic header array
         $statArray = array(array('raw' => Image::COL_ORIGINAL_FILENAME, 'name' => 'Original file name'), array('raw' => Fish::COL_SAMPLE_CODE, 'name' => 'Fish sample code'), array('raw' => Image::COL_DIM_X, 'name' => 'Width'), array('raw' => Image::COL_DIM_Y, 'name' => 'Height'));
         $dynArray = array();
         $i = 0;
         foreach ($metaData->fishRowSetArray as $fishAttr) {
             $dynInnerArray = array('raw' => 'ATDE_' . $fishAttr[AttributeDescriptor::COL_ID], 'name' => $fishAttr[AttributeDescriptor::COL_NAME] . '<br>' . $fishAttr['UNIT']);
             $dynArray[$i] = $dynInnerArray;
             $i++;
         }
         $headerArray = array_merge($statArray, $dynArray);
         unset($i);
         unset($dynArray);
         unset($dynInnerArray);
         $i = 0;
         foreach ($metaData->imageRowSetArray as $imAttr) {
             $dynInnerArray = array('raw' => 'ATDE_' . $imAttr[AttributeDescriptor::COL_ID], 'name' => $imAttr[AttributeDescriptor::COL_NAME] . '<br>' . $imAttr['UNIT']);
             $dynArray[$i] = $dynInnerArray;
             $i++;
         }
         $headerArray = array_merge($headerArray, $dynArray);
         unset($i);
         unset($dynArray);
         unset($dynInnerArray);
         $paginator->setHeader($headerArray);
         $paginator->setCurrentPageNumber($this->getRequest()->getParam('page'))->setItemCountPerPage(1000)->setPageRange(10)->orderBy($this->getRequest()->getParam('orderBy'));
         //$this->_getParam('pageRange'));
         Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/list_pagination_control.phtml');
         $this->view->paginator = $paginator;
     }
 }