/**
  * Renders search template into the view
  *
  * @param string $template Template HTML code
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($template, $recordManagement)
 {
     $filters = $recordManagement->getConditions()->getFilters();
     $templateUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\TemplateUtility');
     $templateUtility->initTemplateUtility('search', $recordManagement, $this->controllerContext->getUriBuilder());
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     $arguments = array("filters" => $filters);
     $url = $urlUtility->createURL("list", $arguments);
     $code = '<form action="' . $url . '" method="post"  class="tx_ezqueries_form tx_ezqueries_search_form">';
     $code .= $templateUtility->fillMarkers($template);
     $code .= '</form>';
     return $code;
 }
 /**
  * Renders list template into the view
  *
  * @param string $template Template HTML code
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($template, $recordManagement)
 {
     $this->records = $recordManagement->getRecords();
     $this->i = $recordManagement->getConditions()->getStartRecord();
     $templateUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\TemplateUtility');
     $templateUtility->initTemplateUtility('list', $recordManagement, $this->controllerContext->getUriBuilder());
     $templateUtility->setRecordCount(count($this->records));
     $templateUtility->setRecordNumber($this->i);
     $code = $this->interpretTemplate($template, $templateUtility);
     $this->i = $recordManagement->getConditions()->getStartRecord();
     $templateUtility->setRecordNumber($this->i);
     $code = $templateUtility->fillMarkers($code);
     return $code;
 }
Esempio n. 3
0
 /**
  * Renders new form elements
  *
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($recordManagement)
 {
     $this->columns = $recordManagement->getTable()->getSelectedColumns();
     $this->columnTypes = $recordManagement->getTable()->getColumnTypes();
     $search = $recordManagement->getConditions()->getSearch();
     $filters = $recordManagement->getConditions()->getFilters();
     // Generate URL
     $arguments = array("search" => $search, "filters" => $filters);
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     $url = $urlUtility->createURL("create", $arguments);
     // Generate form
     $code = '<div class="tx_ezqueries_new"><form action="' . $url . '" method="post" id="tx_ezqueries_new_form" class="tx_ezqueries_form tx_ezqueries_new_form">';
     $code .= $this->generateFormElements($url);
     $code .= '</form></div>';
     return $code;
 }
 /**
  * Renders sortable column headers for the list view
  *
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($recordManagement)
 {
     $columns = $recordManagement->getTable()->getSelectedColumns();
     $columnTypes = $recordManagement->getTable()->getColumnTypes();
     $orderBy = $recordManagement->getConditions()->getOrderBy();
     $order = $recordManagement->getConditions()->getOrder();
     $search = $recordManagement->getConditions()->getSearch();
     $filters = $recordManagement->getConditions()->getFilters();
     $code = '';
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     foreach ($columns as $column) {
         if ($columnTypes[$column['name']]['sortable'] == TRUE) {
             $arguments = array("orderBy" => $column['name'], "order" => 'ASC', "search" => $search, "filters" => $filters);
             $imgClass = 'tx_ezqueries_image_order';
             $class = '';
             if ($column['name'] == $orderBy) {
                 if ($order == 'ASC') {
                     $arguments = array("orderBy" => $column['name'], "order" => 'DESC', "search" => $search, "filters" => $filters);
                     $imgClass = 'tx_ezqueries_image_order tx_ezqueries_image_order_asc';
                 } else {
                     $arguments = array("orderBy" => $column['name'], "order" => 'ASC', "search" => $search, "filters" => $filters);
                     $imgClass = 'tx_ezqueries_image_order tx_ezqueries_image_order_desc';
                 }
             }
             $url = $urlUtility->createURL("list", $arguments);
             $columnValue = '<a class="tx_ezqueries_link tx_ezqueries_link_sort tx_ezqueries_list_link_sort ' . $imgClass . '" href="' . $url . '"><span class="tx_ezqueries_link_sort_text">' . $column['columnName'] . '</span></a>';
             $class = 'tx_ezqueries_list_header_sortable';
         } else {
             $columnValue = $column['columnName'];
             $class = '';
         }
         $code .= '<th class="tx_ezqueries_list_header ' . $class . ' tx_ezqueries_list_header_' . $column['cssName'] . '" nowrap="nowrap">' . $columnValue . '</th>';
     }
     return $code;
 }
 /**
  * Renders edit template into the view
  *
  * @param string $template Template HTML code
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($template, $recordManagement)
 {
     $primaryKeys = $recordManagement->getRecords(0)->getPrimaryKeys();
     $search = $recordManagement->getConditions()->getSearch();
     $filters = $recordManagement->getConditions()->getFilters();
     $templateUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\TemplateUtility');
     $templateUtility->initTemplateUtility('edit', $recordManagement, $this->controllerContext->getUriBuilder());
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     $arguments = array("primaryKeys" => $primaryKeys, "search" => $search, "filters" => $filters);
     $url = $urlUtility->createURL("update", $arguments);
     if (strpos($template, '<form>') !== FALSE) {
         $formStartCode = substr($template, strpos($template, '<form>'), 6);
         $template = str_replace($formStartCode, '<form action="' . $url . '" method="post"  class="tx_ezqueries_form tx_ezqueries_edit_form">', $template);
         $code .= $templateUtility->fillMarkers($template);
     } else {
         $code = '<form action="' . $url . '" method="post"  class="tx_ezqueries_form tx_ezqueries_edit_form">';
         $code .= $templateUtility->fillMarkers($template);
         $code .= '</form>';
     }
     return $code;
 }
 /**
  * Renders a record browser
  *
  * @param string $action Controller action
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @return string $code
  */
 public function render($action, $recordManagement)
 {
     $i = 0;
     $code = '';
     $recordPosition = 0;
     $records = $recordManagement->getRecords();
     if ($records) {
         $primaryKeys = $records[0]->getPrimaryKeys();
         $primaryKeysArray = $recordManagement->getPrimaryKeys();
         $countPrimaryKeys = count($primaryKeys);
         $countRightKeys = 0;
         $orderBy = $recordManagement->getConditions()->getOrderBy();
         $order = $recordManagement->getConditions()->getOrder();
         $search = $recordManagement->getConditions()->getSearch();
         $filters = $recordManagement->getConditions()->getFilters();
         $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
         $code .= '<div class="tx_ezqueries_options_recordbrowser">';
         foreach ($primaryKeysArray as $keys) {
             $countRightKeys = 0;
             foreach ($primaryKeys as $column => $value) {
                 if ($keys[$column] == $value) {
                     $countRightKeys++;
                 }
             }
             if ($countRightKeys == $countPrimaryKeys) {
                 $recordPosition = $i;
                 break;
             } else {
                 $i++;
             }
         }
         if ($recordPosition != 0) {
             $arguments = array("primaryKeys" => $primaryKeysArray[$recordPosition - 1], "orderBy" => $orderBy, "order" => $order, "search" => $search, "filters" => $filters);
             $url = $urlUtility->createURL($action, $arguments);
             $code .= '<div class="tx_ezqueries_options_recordbrowser_previous"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_' . $action . '" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('recordbrowser_previous', 'ezqueries') . '</a></div>';
         }
         if ($recordPosition < count($primaryKeysArray) - 1) {
             $arguments = array("primaryKeys" => $primaryKeysArray[$recordPosition + 1], "orderBy" => $orderBy, "order" => $order, "search" => $search, "filters" => $filters);
             $url = $urlUtility->createURL($action, $arguments);
             $code .= '<div class="tx_ezqueries_options_recordbrowser_next"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_' . $action . '" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('recordbrowser_next', 'ezqueries') . '</a></div>';
         }
         $code .= '</div>';
     }
     return $code;
 }
 /**
  * Renders new form elements
  *
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @param array $dataSource
  * @param string $foreignKey
  * @return string $code
  */
 public function render($recordManagement, $dataSource, $foreignKey)
 {
     $columns = $recordManagement->getTable()->getSelectedColumns();
     $foreignKeyRelationColumn = $recordManagement->getTable()->getForeignKeyRelationColumn();
     $records = $recordManagement->getRecords();
     // Generate URL
     $arguments = array('foreignKey' => $foreignKey);
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     $url = $urlUtility->createURL("assign", $arguments);
     // Generate form
     $code = '<form action="' . $url . '" method="post" name="tx_ezqueries_relation_form" id="tx_ezqueries_relation_form" class="tx_ezqueries_form tx_ezqueries_relation_form">';
     $code .= '<table class="tx_ezqueries_relation">';
     $code .= '<tr><td class="tx_ezqueries_relation_left_column">';
     $code .= '<div class="tx_ezqueries_relation_info_text tx_ezqueries_relation_info_text_selected_elements">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('relation_selected_elements', 'ezqueries') . '</div>';
     $code .= '</td><td class="tx_ezqueries_relation_right_column">';
     $code .= '<div class="tx_ezqueries_relation_info_text tx_ezqueries_relation_info_text_selectable_elements">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('relation_selectable_elements', 'ezqueries') . '</div>';
     $code .= '</td></tr>';
     $code .= '<tr><td class="tx_ezqueries_relation_left_column">';
     $code .= '<ul class="tx_ezqueries_relation_entries">';
     if ($records !== NULL) {
         foreach ($records as $record) {
             $recordData = $record->getData();
             $code .= '<li id="' . $recordData[$foreignKeyRelationColumn] . '" class="tx_ezqueries_relation_entry">';
             $code .= '<span class="tx_ezqueries_relation_entry_name">';
             foreach ($columns as $column => $name) {
                 $code .= $recordData[$column] . ' ';
             }
             $code .= '</span>';
             $code .= '<span class="tx_ezqueries_relation_delete_entry">X</span>';
             $code .= '</li>';
         }
     }
     $code .= '</ul>';
     $code .= '</td><td class="tx_ezqueries_relation_right_column">';
     $code .= '<div class="tx_ezqueries_select_wrapper tx_ezqueries_relation_select_wrapper">';
     $code .= '<div class="tx_ezqueries_select_filter">';
     $code .= '<input name="regexp" class="tx_ezqueries_select_filter_input" placeholder="' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('select_filter_label', 'ezqueries') . '" />';
     $code .= '</div>';
     $code .= '<select name="tx_ezqueries_relation_select" class="tx_ezqueries_relation_select tx_ezqueries_select" size="10">';
     foreach ($dataSource as $sourceRecord) {
         $sourceRecordLength = count($sourceRecord);
         $code .= '<option class="tx_ezqueries_relation_option" value="' . $sourceRecord[$sourceRecordLength - 1] . '">';
         $counter = 0;
         foreach ($sourceRecord as $recordItem) {
             if ($counter < $sourceRecordLength - 1) {
                 if ($counter !== 0) {
                     $code .= ' ';
                 }
                 $code .= $recordItem;
             }
             $counter++;
         }
         $code .= '</option>';
     }
     $code .= '</select></div>';
     $code .= '<input class="tx_ezqueries_input_hidden tx_ezqueries_input_relation_data_old" type="hidden" value="';
     if ($records !== NULL) {
         foreach ($records as $record) {
             $recordData = $record->getData();
             $code .= $recordData[$foreignKeyRelationColumn] . '<->';
         }
     }
     $code .= '" name="tx_ezqueries_ezqueriesplugin[relationDataOld]" />';
     $code .= '<input class="tx_ezqueries_input_hidden tx_ezqueries_input_relation_data_new" type="hidden" value="';
     if ($records !== NULL) {
         foreach ($records as $record) {
             $recordData = $record->getData();
             $code .= $recordData[$foreignKeyRelationColumn] . '<->';
         }
     }
     $code .= '" name="tx_ezqueries_ezqueriesplugin[relationDataNew]" />';
     $code .= '</td></tr></table>';
     $code .= '<div class="tx_ezqueries_form_row tx_ezqueries_form_row_submit"><input class="tx_ezqueries_submit tx_ezqueries_submit_relation" name="' . $url . '" type="submit" value="' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('relation_form_submit', 'ezqueries') . '" /></div>';
     $code .= '</form>';
     return $code;
 }
Esempio n. 8
0
 /**
  * Search for markers in a code (template) and replace them with content
  *
  * @param string $code Any code
  * @return string $code
  */
 public function fillMarkers($code)
 {
     // Markers
     $formValueMarkerStart = '<formelement';
     $formValueMarkerEnd = '</formelement>';
     $valueMarkerStart = '<value>';
     $valueMarkerEnd = '</value>';
     $sortMarkerStart = '<sort';
     $sortMarkerEnd = '</sort>';
     $submitMarkerStart = '<submit';
     $submitMarkerEnd = '</submit>';
     $detailMarkerStart = '<detail';
     $detailMarkerEnd = '</detail>';
     $editMarkerStart = '<edit';
     $editMarkerEnd = '</edit>';
     $previousMarkerStart = '<previous';
     $previousMarkerEnd = '</previous>';
     $nextMarkerStart = '<next';
     $nextMarkerEnd = '</next>';
     $closeMarkerStart = '<close';
     $closeMarkerEnd = '</close>';
     $deleteMarkerStart = '<delete';
     $deleteMarkerEnd = '</delete>';
     $newMarkerStart = '<new';
     $newMarkerEnd = '</new>';
     $searchMarkerStart = '<search';
     $searchMarkerEnd = '</search>';
     $listMarkerStart = '<list';
     $listMarkerEnd = '</list>';
     $parityMarker = '<parity />';
     $indexMarker = '<index />';
     $recordCountMarker = '<recordcount />';
     $contentMarkerStart = '<content';
     $contentMarkerEnd = '</content>';
     $labelMarkerStart = '<columnlabel>';
     $labelMarkerEnd = '</columnlabel>';
     $loclabelMarkerStart = '<locallang>';
     $loclabelMarkerEnd = '</locallang>';
     $argumentMarkerStart = '<parameter>';
     $argumentMarkerEnd = '</parameter>';
     $pageBrowserMarker = '<pagebrowser />';
     $conversionUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\ConversionUtility');
     $valueUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\ValueUtility');
     $languageUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\LanguageUtility');
     $filterUtility = $this->objectManager->get('Frohland\\Ezqueries\\Utility\\FilterUtility');
     $recordBrowser = $this->objectManager->get('Frohland\\Ezqueries\\ViewHelpers\\PageBrowserViewHelper');
     $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->uriBuilder);
     $formUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\FormUtility', $this->uriBuilder);
     $this->data = array();
     $this->primaryKeys = array();
     if ($this->record) {
         $this->data = $this->record->getData();
         $this->primaryKeys = $this->record->getPrimaryKeys();
     }
     // Template type?
     switch ($this->templateType) {
         // #### Edit ####
         case 'edit':
             // Form value
             if (strpos($code, $formValueMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $formValueMarkerStart), strpos($code, $formValueMarkerEnd) + strlen($formValueMarkerEnd) - strpos($code, $formValueMarkerStart));
                 $formValueMarkerAttributes = $this->getMarkerAttributes($markerCode, $formValueMarkerStart);
                 $formValueMarkerValue = $this->getMarkerValue($markerCode, $formValueMarkerEnd);
                 $replaceCode = '';
                 // Form value without attributes
                 if ($formValueMarkerAttributes['type'] == NULL) {
                     if ($this->columnTypes[$formValueMarkerValue]['type'] !== 'additional' || isset($this->columnTypes[$formValueMarkerValue]['additionalType'])) {
                         $replaceCode .= $formUtility->generateFormElement($formValueMarkerValue, $this->data[$formValueMarkerValue], $this->columnTypes, 'edit', $this->data);
                     } else {
                         $replaceCode = $valueUtility->generateValue($formValueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                     }
                 } else {
                     // Form value with attributes
                     if ($formValueMarkerAttributes['type'] == 'select') {
                         $options = explode(',', $formValueMarkerAttributes['options']);
                         $replaceCode .= '<select class="tx_ezqueries_select" id="' . $formValueMarkerValue . '" size="1" name="tx_ezqueries_ezqueriesplugin[' . $formValueMarkerValue . ']">';
                         $replaceCode .= '<option selected="selected">' . $this->data[$formValueMarkerValue] . '</option>';
                         foreach ($options as $option) {
                             $replaceCode .= '<option>' . $option . '</option>';
                         }
                         $replaceCode .= '</select>';
                     }
                 }
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             } else {
                 // Edit submit
                 if (strpos($code, $submitMarkerStart) !== FALSE) {
                     $markerCode = substr($code, strpos($code, $submitMarkerStart), strpos($code, $submitMarkerEnd) + strlen($submitMarkerEnd) - strpos($code, $submitMarkerStart));
                     $submitMarkerAttributes = $this->getMarkerAttributes($markerCode, $submitMarkerStart);
                     $submitMarkerValue = $this->getMarkerValue($markerCode, $submitMarkerEnd);
                     $replaceCode = '';
                     $submitClass = '';
                     if ($submitMarkerAttributes['onSubmit'] == 'dontClosePopup') {
                         $submitClass = 'tx_ezqueries_submit_popup';
                     }
                     $arguments = array("primaryKeys" => $this->primaryKeys, "search" => $this->search, "filters" => $this->filters);
                     $url = $urlUtility->createURL("update", $arguments);
                     $replaceCode = '<input class="tx_ezqueries_submit tx_ezqueries_submit_edit ' . $submitClass . '" name="' . $url . '" type="submit" value="' . $languageUtility->translateValue($submitMarkerValue) . '" />';
                     $newCode = str_replace($markerCode, $replaceCode, $code);
                     $code = $this->fillMarkers($newCode);
                     return $code;
                 } else {
                     // Value
                     if (strpos($code, $valueMarkerStart) !== FALSE) {
                         $markerCode = substr($code, strpos($code, $valueMarkerStart), strpos($code, $valueMarkerEnd) + strlen($valueMarkerEnd) - strpos($code, $valueMarkerStart));
                         $valueMarkerValue = $this->getMarkerValue($markerCode, $valueMarkerEnd);
                         $replaceCode = $valueUtility->generateValue($valueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                         $newCode = str_replace($markerCode, $replaceCode, $code);
                         $code = $this->fillMarkers($newCode);
                         return $code;
                     } else {
                         break;
                     }
                 }
             }
             // #### New ####
         // #### New ####
         case 'new':
             // Form value
             if (strpos($code, $formValueMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $formValueMarkerStart), strpos($code, $formValueMarkerEnd) + strlen($formValueMarkerEnd) - strpos($code, $formValueMarkerStart));
                 $formValueMarkerAttributes = $this->getMarkerAttributes($markerCode, $formValueMarkerStart);
                 $formValueMarkerValue = $this->getMarkerValue($markerCode, $formValueMarkerEnd);
                 $replaceCode = '';
                 // Form value without attributes
                 if ($formValueMarkerAttributes['type'] == NULL) {
                     $replaceCode .= $formUtility->generateFormElement($formValueMarkerValue, $this->data[$formValueMarkerValue], $this->columnTypes, 'new', $this->data);
                 } else {
                     // Form value with attributes
                     if ($formValueMarkerAttributes['type'] == 'select') {
                         $options = explode(',', $formValueMarkerAttributes['options']);
                         $replaceCode .= '<select class="tx_ezqueries_select" id="' . $formValueMarkerValue . '" size="1" name="tx_ezqueries_ezqueriesplugin[' . $formValueMarkerValue . ']">';
                         $replaceCode .= '<option selected="selected">' . $this->data[$formValueMarkerValue] . '</option>';
                         foreach ($options as $option) {
                             $replaceCode .= '<option>' . $option . '</option>';
                         }
                         $replaceCode .= '</select>';
                     }
                 }
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             } else {
                 // New submit
                 if (strpos($code, $submitMarkerStart) !== FALSE) {
                     $markerCode = substr($code, strpos($code, $submitMarkerStart), strpos($code, $submitMarkerEnd) + strlen($submitMarkerEnd) - strpos($code, $submitMarkerStart));
                     $submitMarkerAttributes = $this->getMarkerAttributes($markerCode, $submitMarkerStart);
                     $submitMarkerValue = $this->getMarkerValue($markerCode, $submitMarkerEnd);
                     $replaceCode = '';
                     $submitClass = '';
                     if ($submitMarkerAttributes['onSubmit'] == 'dontClosePopup') {
                         $submitClass = 'tx_ezqueries_submit_popup';
                     }
                     $arguments = array("search" => $this->search, "filters" => $this->filters);
                     $url = $urlUtility->createURL("create", $arguments);
                     $replaceCode = '<input class="tx_ezqueries_submit tx_ezqueries_submit_new ' . $submitClass . '" name="' . $url . '" type="submit" value="' . $languageUtility->translateValue($submitMarkerValue) . '" />';
                     $newCode = str_replace($markerCode, $replaceCode, $code);
                     $code = $this->fillMarkers($newCode);
                     return $code;
                 } else {
                     // Value
                     if (strpos($code, $valueMarkerStart) !== FALSE) {
                         $markerCode = substr($code, strpos($code, $valueMarkerStart), strpos($code, $valueMarkerEnd) + strlen($valueMarkerEnd) - strpos($code, $valueMarkerStart));
                         $valueMarkerValue = $this->getMarkerValue($markerCode, $valueMarkerEnd);
                         $replaceCode = $valueUtility->generateValue($valueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                         $newCode = str_replace($markerCode, $replaceCode, $code);
                         $code = $this->fillMarkers($newCode);
                         return $code;
                     } else {
                         break;
                     }
                 }
             }
             // #### Search ####
         // #### Search ####
         case 'search':
             // Form value
             if (strpos($code, $formValueMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $formValueMarkerStart), strpos($code, $formValueMarkerEnd) + strlen($formValueMarkerEnd) - strpos($code, $formValueMarkerStart));
                 $formValueMarkerAttributes = $this->getMarkerAttributes($markerCode, $formValueMarkerStart);
                 $formValueMarkerValue = $this->getMarkerValue($markerCode, $formValueMarkerEnd);
                 $replaceCode = '';
                 $replaceCode = $filterUtility->generateFilterElement($formValueMarkerValue, $this->columnTypes, $formValueMarkerAttributes['placeholder']);
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             } else {
                 // Search submit
                 if (strpos($code, $submitMarkerStart) !== FALSE) {
                     $markerCode = substr($code, strpos($code, $submitMarkerStart), strpos($code, $submitMarkerEnd) + strlen($submitMarkerEnd) - strpos($code, $submitMarkerStart));
                     $submitMarkerAttributes = $this->getMarkerAttributes($markerCode, $submitMarkerStart);
                     $submitMarkerValue = $this->getMarkerValue($markerCode, $submitMarkerEnd);
                     $replaceCode = '';
                     $submitClass = '';
                     if ($submitMarkerAttributes['onSubmit'] == 'dontClosePopup') {
                         $submitClass = 'tx_ezqueries_submit_popup';
                     }
                     $arguments = array("filters" => $this->filters);
                     $url = $urlUtility->createURL("list", $arguments);
                     $replaceCode = '<input class="tx_ezqueries_submit tx_ezqueries_submit_search ' . $submitClass . '" name="' . $url . '" type="submit" value="' . $languageUtility->translateValue($submitMarkerValue) . '" />';
                     $newCode = str_replace($markerCode, $replaceCode, $code);
                     $code = $this->fillMarkers($newCode);
                     return $code;
                 } else {
                     // Value
                     if (strpos($code, $valueMarkerStart) !== FALSE) {
                         $markerCode = substr($code, strpos($code, $valueMarkerStart), strpos($code, $valueMarkerEnd) + strlen($valueMarkerEnd) - strpos($code, $valueMarkerStart));
                         $valueMarkerValue = $this->getMarkerValue($markerCode, $valueMarkerEnd);
                         $replaceCode = $valueUtility->generateValue($valueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                         $newCode = str_replace($markerCode, $replaceCode, $code);
                         $code = $this->fillMarkers($newCode);
                         return $code;
                     } else {
                         break;
                     }
                 }
             }
             // #### Detail ####
         // #### Detail ####
         case 'detail':
             // Value
             if (strpos($code, $valueMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $valueMarkerStart), strpos($code, $valueMarkerEnd) + strlen($valueMarkerEnd) - strpos($code, $valueMarkerStart));
                 $valueMarkerValue = $this->getMarkerValue($markerCode, $valueMarkerEnd);
                 $replaceCode = $valueUtility->generateValue($valueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             } else {
                 // Content
                 if (strpos($code, $contentMarkerStart) !== FALSE) {
                     $markerCode = substr($code, strpos($code, $contentMarkerStart), strpos($code, $contentMarkerEnd) + strlen($contentMarkerEnd) - strpos($code, $contentMarkerStart));
                     $contentMarkerAttributes = $this->getMarkerAttributes($markerCode, $contentMarkerStart);
                     $contentMarkerValue = $this->getMarkerValue($markerCode, $contentMarkerEnd);
                     $replaceCode = '';
                     $filters = array();
                     if (isset($contentMarkerAttributes['filter'])) {
                         $filters[$contentMarkerAttributes['filter']] = $contentMarkerAttributes['filterValue'];
                     }
                     $arguments = array('filters' => $filters);
                     $url = $urlUtility->createURL(NULL, $arguments, $contentMarkerValue);
                     $replaceCode = '<div class="tx_ezqueries_ajax_content" id="' . $url . '"></div>';
                     $newCode = str_replace($markerCode, $replaceCode, $code);
                     $code = $this->fillMarkers($newCode);
                     return $code;
                 }
             }
             break;
             // #### List ####
         // #### List ####
         case 'list':
             // Value
             if (strpos($code, $valueMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $valueMarkerStart), strpos($code, $valueMarkerEnd) + strlen($valueMarkerEnd) - strpos($code, $valueMarkerStart));
                 $valueMarkerValue = $this->getMarkerValue($markerCode, $valueMarkerEnd);
                 $replaceCode = $valueUtility->generateValue($valueMarkerValue, $this->data, $this->columnTypes, $this->search, $this->uriBuilder, $this, $this->recordManagementRepository, $this->arguments);
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             } else {
                 // New link
                 if (strpos($code, $newMarkerStart) !== FALSE) {
                     $markerCode = substr($code, strpos($code, $newMarkerStart), strpos($code, $newMarkerEnd) + strlen($newMarkerEnd) - strpos($code, $newMarkerStart));
                     $newMarkerAttributes = $this->getMarkerAttributes($markerCode, $newMarkerStart);
                     $newMarkerValue = $this->getMarkerValue($markerCode, $newMarkerEnd);
                     $replaceCode = '';
                     $linkClass = '';
                     $linkTitle = '';
                     if ($newMarkerAttributes['type'] == 'button') {
                         $linkClass = 'tx_ezqueries_link_button';
                     }
                     if (isset($newMarkerAttributes['title'])) {
                         $linkTitle = $languageUtility->translateValue($newMarkerAttributes['title']);
                     }
                     $arguments = array("search" => $this->search, "filters" => $this->filters);
                     $url = $urlUtility->createURL("new", $arguments);
                     $replaceCode = '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_new tx_ezqueries_' . $this->templateType . '_link_new" href="' . $url . '" >' . $languageUtility->translateValue($newMarkerValue) . '</a>';
                     $newCode = str_replace($markerCode, $replaceCode, $code);
                     $code = $this->fillMarkers($newCode);
                     return $code;
                 } else {
                     // Sort
                     if (strpos($code, $sortMarkerStart) !== FALSE) {
                         $markerCode = substr($code, strpos($code, $sortMarkerStart), strpos($code, $sortMarkerEnd) + strlen($sortMarkerEnd) - strpos($code, $sortMarkerStart));
                         $sortMarkerAttributes = $this->getMarkerAttributes($markerCode, $sortMarkerStart);
                         $sortMarkerValue = $this->getMarkerValue($markerCode, $sortMarkerEnd);
                         $replaceCode = '';
                         $linkTitle = '';
                         $arguments = array("orderBy" => $sortMarkerValue, "order" => 'ASC', "search" => $this->search, "filters" => $this->filters);
                         $imgClass = 'tx_ezqueries_image_order';
                         if ($sortMarkerValue == $this->orderBy) {
                             if ($this->order == 'ASC') {
                                 $arguments = array("orderBy" => $sortMarkerValue, "order" => 'DESC', "search" => $this->search, "filters" => $this->filters);
                                 $imgClass = 'tx_ezqueries_image_order tx_ezqueries_image_order_asc';
                             } else {
                                 $arguments = array("orderBy" => $sortMarkerValue, "order" => 'ASC', "search" => $this->search, "filters" => $this->filters);
                                 $imgClass = 'tx_ezqueries_image_order tx_ezqueries_image_order_desc';
                             }
                         }
                         $url = $urlUtility->createURL("list", $arguments);
                         if (isset($sortMarkerAttributes['title'])) {
                             $linkTitle = $languageUtility->translateValue($sortMarkerAttributes['title']);
                         }
                         if ($sortMarkerAttributes['as'] == NULL) {
                             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link tx_ezqueries_link_sort tx_ezqueries_list_link_sort ' . $imgClass . '" href="' . $url . '"><span class="tx_ezqueries_link_sort_text">' . $sortMarkerValue . '</span></a>';
                         } else {
                             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link tx_ezqueries_link_sort tx_ezqueries_list_link_sort ' . $imgClass . '" href="' . $url . '"><span class="tx_ezqueries_link_sort_text">' . $languageUtility->translateValue($sortMarkerAttributes['as']) . '</span></a>';
                         }
                         $newCode = str_replace($markerCode, $replaceCode, $code);
                         $code = $this->fillMarkers($newCode);
                         return $code;
                     } else {
                         // Parity
                         if (strpos($code, $parityMarker) !== FALSE) {
                             $markerCode = $parityMarker;
                             if ($this->recordNumber % 2 == 0) {
                                 $replaceCode = 'odd';
                             } else {
                                 $replaceCode = 'even';
                             }
                             $newCode = str_replace($markerCode, $replaceCode, $code);
                             $code = $this->fillMarkers($newCode);
                             return $code;
                         } else {
                             // Record count
                             if (strpos($code, $recordCountMarker) !== FALSE) {
                                 $markerCode = $recordCountMarker;
                                 $replaceCode = $this->recordManagement->getConditions()->getRecordsCount();
                                 $newCode = str_replace($markerCode, $replaceCode, $code);
                                 $code = $this->fillMarkers($newCode);
                                 return $code;
                             } else {
                                 // Search link
                                 if (strpos($code, $searchMarkerStart) !== FALSE) {
                                     $markerCode = substr($code, strpos($code, $searchMarkerStart), strpos($code, $searchMarkerEnd) + strlen($searchMarkerEnd) - strpos($code, $searchMarkerStart));
                                     $searchMarkerAttributes = $this->getMarkerAttributes($markerCode, $searchMarkerStart);
                                     $searchMarkerValue = $this->getMarkerValue($markerCode, $searchMarkerEnd);
                                     $replaceCode = '';
                                     $linkClass = '';
                                     $linkTitle = '';
                                     if ($searchMarkerAttributes['type'] == 'button') {
                                         $linkClass = 'tx_ezqueries_link_button';
                                     }
                                     if (isset($searchMarkerAttributes['title'])) {
                                         $linkTitle = $languageUtility->translateValue($searchMarkerAttributes['title']);
                                     }
                                     $arguments = array("filters" => $this->filters);
                                     $url = $urlUtility->createURL("search", $arguments);
                                     $replaceCode = '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_search tx_ezqueries_' . $this->templateType . '_link_search" href="' . $url . '" >' . $languageUtility->translateValue($searchMarkerValue) . '</a>';
                                     $newCode = str_replace($markerCode, $replaceCode, $code);
                                     $code = $this->fillMarkers($newCode);
                                     return $code;
                                 } else {
                                     // Index
                                     if (strpos($code, $indexMarker) !== FALSE) {
                                         $markerCode = $indexMarker;
                                         $replaceCode = $this->recordNumber;
                                         $newCode = str_replace($markerCode, $replaceCode, $code);
                                         $code = $this->fillMarkers($newCode);
                                         return $code;
                                     } else {
                                         // Page browser
                                         if (strpos($code, $pageBrowserMarker) !== FALSE) {
                                             $markerCode = $pageBrowserMarker;
                                             $replaceCode = $recordBrowser->render($this->recordManagement, $this->uriBuilder);
                                             $newCode = str_replace($markerCode, $replaceCode, $code);
                                             $code = $this->fillMarkers($newCode);
                                             return $code;
                                         } else {
                                             break;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
     }
     // Detail link
     if (strpos($code, $detailMarkerStart) !== FALSE) {
         $markerCode = substr($code, strpos($code, $detailMarkerStart), strpos($code, $detailMarkerEnd) + strlen($detailMarkerEnd) - strpos($code, $detailMarkerStart));
         $detailMarkerAttributes = $this->getMarkerAttributes($markerCode, $detailMarkerStart);
         $detailMarkerValue = $this->getMarkerValue($markerCode, $detailMarkerEnd);
         $replaceCode = '';
         $linkClass = '';
         $linkTitle = '';
         if ($detailMarkerAttributes['type'] == 'button') {
             $linkClass = 'tx_ezqueries_link_button';
         }
         if (isset($detailMarkerAttributes['title'])) {
             $linkTitle = $languageUtility->translateValue($detailMarkerAttributes['title']);
         }
         if ($this->templateType == 'list') {
             $arguments = array("primaryKeys" => $this->primaryKeysArray[$this->recordNumber], "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
         } else {
             $arguments = array("primaryKeys" => $this->primaryKeys, "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
         }
         $url = $urlUtility->createURL("detail", $arguments);
         $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_detail tx_ezqueries_' . $this->templateType . '_link_detail" href="' . $url . '" >' . $languageUtility->translateValue($detailMarkerValue) . '</a>';
         $newCode = str_replace($markerCode, $replaceCode, $code);
         $code = $this->fillMarkers($newCode);
         return $code;
     } else {
         // Edit link
         if (strpos($code, $editMarkerStart) !== FALSE) {
             $markerCode = substr($code, strpos($code, $editMarkerStart), strpos($code, $editMarkerEnd) + strlen($editMarkerEnd) - strpos($code, $editMarkerStart));
             $editMarkerAttributes = $this->getMarkerAttributes($markerCode, $editMarkerStart);
             $editMarkerValue = $this->getMarkerValue($markerCode, $editMarkerEnd);
             $replaceCode = '';
             $linkClass = '';
             $linkTitle = '';
             if ($editMarkerAttributes['type'] == 'button') {
                 $linkClass = 'tx_ezqueries_link_button';
             }
             if (isset($editMarkerAttributes['title'])) {
                 $linkTitle = $languageUtility->translateValue($editMarkerAttributes['title']);
             }
             if ($this->templateType == 'list') {
                 $arguments = array("primaryKeys" => $this->primaryKeysArray[$this->recordNumber], "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
             } else {
                 $arguments = array("primaryKeys" => $this->primaryKeys, "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
             }
             $url = $urlUtility->createURL("edit", $arguments);
             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_edit tx_ezqueries_' . $this->templateType . '_link_edit" href="' . $url . '" >' . $languageUtility->translateValue($editMarkerValue) . '</a>';
             $newCode = str_replace($markerCode, $replaceCode, $code);
             $code = $this->fillMarkers($newCode);
             return $code;
         } else {
             // Delete link
             if (strpos($code, $deleteMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $deleteMarkerStart), strpos($code, $deleteMarkerEnd) + strlen($deleteMarkerEnd) - strpos($code, $deleteMarkerStart));
                 $deleteMarkerAttributes = $this->getMarkerAttributes($markerCode, $deleteMarkerStart);
                 $deleteMarkerValue = $this->getMarkerValue($markerCode, $deleteMarkerEnd);
                 $replaceCode = '';
                 $linkClass = '';
                 $linkTitle = '';
                 if ($deleteMarkerAttributes['type'] == 'button') {
                     $linkClass = 'tx_ezqueries_link_button';
                 }
                 if (isset($deleteMarkerAttributes['title'])) {
                     $linkTitle = $languageUtility->translateValue($deleteMarkerAttributes['title']);
                 }
                 if ($this->templateType == 'list') {
                     $arguments = array("primaryKeys" => $this->primaryKeysArray[$this->recordNumber], "search" => $this->search, "filters" => $this->filters);
                 } else {
                     $arguments = array("primaryKeys" => $this->primaryKeys, "search" => $this->search, "filters" => $this->filters);
                 }
                 $url = $urlUtility->createURL("delete", $arguments);
                 $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_delete tx_ezqueries_' . $this->templateType . '_link_delete" href="' . $url . '" >' . $languageUtility->translateValue($deleteMarkerValue) . '</a>';
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             }
         }
     }
     if ($this->templateType == 'detail' || $this->templateType == 'edit' || $this->templateType == 'new' || $this->templateType == 'search') {
         // Close link
         if (strpos($code, $closeMarkerStart) !== FALSE) {
             $markerCode = substr($code, strpos($code, $closeMarkerStart), strpos($code, $closeMarkerEnd) + strlen($closeMarkerEnd) - strpos($code, $closeMarkerStart));
             $closeMarkerAttributes = $this->getMarkerAttributes($markerCode, $closeMarkerStart);
             $closeMarkerValue = $this->getMarkerValue($markerCode, $closeMarkerEnd);
             $replaceCode = '';
             $linkClass = '';
             $linkTitle = '';
             if ($closeMarkerAttributes['type'] == 'button') {
                 $linkClass = 'tx_ezqueries_link_button';
             }
             if (isset($closeMarkerAttributes['title'])) {
                 $linkTitle = $languageUtility->translateValue($closeMarkerAttributes['title']);
             }
             if ($this->templateType == 'detail' || $this->templateType == 'edit') {
                 $arguments = array("search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
             } else {
                 $arguments = array("search" => $this->search, "filters" => $this->filters);
             }
             $url = $urlUtility->createURL("list", $arguments);
             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_' . $this->templateType . ' tx_ezqueries_link_abort" href="' . $url . '" >' . $languageUtility->translateValue($closeMarkerValue) . '</a>';
             $newCode = str_replace($markerCode, $replaceCode, $code);
             $code = $this->fillMarkers($newCode);
             return $code;
         }
     }
     if ($this->templateType == 'detail' || $this->templateType == 'edit') {
         // Previous link
         if (strpos($code, $previousMarkerStart) !== FALSE) {
             $markerCode = substr($code, strpos($code, $previousMarkerStart), strpos($code, $previousMarkerEnd) + strlen($previousMarkerEnd) - strpos($code, $previousMarkerStart));
             $previousMarkerAttributes = $this->getMarkerAttributes($markerCode, $previousMarkerStart);
             $previousMarkerValue = $this->getMarkerValue($markerCode, $previousMarkerEnd);
             $replaceCode = '';
             $linkClass = '';
             $linkTitle = '';
             if ($previousMarkerAttributes['type'] == 'button') {
                 $linkClass = 'tx_ezqueries_link_button';
             }
             if (isset($previousMarkerAttributes['title'])) {
                 $linkTitle = $languageUtility->translateValue($previousMarkerAttributes['title']);
             }
             if ($this->recordPosition != 0) {
                 $arguments = array("primaryKeys" => $this->primaryKeysArray[$this->recordPosition - 1], "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
                 $url = $urlUtility->createURL($this->templateType, $arguments);
                 $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_' . $this->templateType . '" href="' . $url . '">' . $languageUtility->translateValue($previousMarkerValue) . '</a>';
             }
             $newCode = str_replace($markerCode, $replaceCode, $code);
             $code = $this->fillMarkers($newCode);
             return $code;
         } else {
             // Next link
             if (strpos($code, $nextMarkerStart) !== FALSE) {
                 $markerCode = substr($code, strpos($code, $nextMarkerStart), strpos($code, $nextMarkerEnd) + strlen($nextMarkerEnd) - strpos($code, $nextMarkerStart));
                 $nextMarkerAttributes = $this->getMarkerAttributes($markerCode, $nextMarkerStart);
                 $nextMarkerValue = $this->getMarkerValue($markerCode, $nextMarkerEnd);
                 $replaceCode = '';
                 $linkClass = '';
                 $linkTitle = '';
                 if ($nextMarkerAttributes['type'] == 'button') {
                     $linkClass = 'tx_ezqueries_link_button';
                 }
                 if (isset($nextMarkerAttributes['title'])) {
                     $linkTitle = $languageUtility->translateValue($nextMarkerAttributes['title']);
                 }
                 if ($this->recordPosition < count($this->primaryKeysArray) - 1) {
                     $arguments = array("primaryKeys" => $this->primaryKeysArray[$this->recordPosition + 1], "search" => $this->search, "orderBy" => $this->orderBy, "order" => $this->order, "filters" => $this->filters);
                     $url = $urlUtility->createURL($this->templateType, $arguments);
                     $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . ' tx_ezqueries_link_' . $this->templateType . '" href="' . $url . '">' . $languageUtility->translateValue($nextMarkerValue) . '</a>';
                 }
                 $newCode = str_replace($markerCode, $replaceCode, $code);
                 $code = $this->fillMarkers($newCode);
                 return $code;
             }
         }
     }
     // Labels
     if (strpos($code, $labelMarkerStart) !== FALSE) {
         $markerCode = substr($code, strpos($code, $labelMarkerStart), strpos($code, $labelMarkerEnd) + strlen($labelMarkerEnd) - strpos($code, $labelMarkerStart));
         $labelMarkerValue = $this->getMarkerValue($markerCode, $labelMarkerEnd);
         $replaceCode = '<label for="' . str_replace('.', '_', $labelMarkerValue) . '">' . $this->selectedColumns[$labelMarkerValue]['columnName'];
         if (($this->columnTypes[$labelMarkerValue]['not_null'] == TRUE || $this->columnTypes[$labelMarkerValue]['required'] == 'true') && ($this->templateType == 'edit' || $this->templateType == 'new')) {
             $replaceCode .= '<span class="tx_ezqueries_required_mark"></span>';
         }
         $replaceCode .= '</label>';
         // Hook for setting a custom label (label, column, view)
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['templateUtilty']['hookSetCustomLabel'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ezqueries']['templateUtilty']['hookSetCustomLabel'] as $_classRef) {
                 $_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                 $replaceCode = $_procObj->hookSetCustomLabel($replaceCode, $labelMarkerValue, $this->templateType, $this->data);
             }
         }
         $newCode = str_replace($markerCode, $replaceCode, $code);
         $code = $this->fillMarkers($newCode);
         return $code;
     }
     if (strpos($code, $loclabelMarkerStart) !== FALSE) {
         $markerCode = substr($code, strpos($code, $loclabelMarkerStart), strpos($code, $loclabelMarkerEnd) + strlen($loclabelMarkerEnd) - strpos($code, $loclabelMarkerStart));
         $labelMarkerValue = $this->getMarkerValue($markerCode, $loclabelMarkerEnd);
         $replaceCode = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($labelMarkerValue, 'ezqueries');
         $newCode = str_replace($markerCode, $replaceCode, $code);
         $code = $this->fillMarkers($newCode);
         return $code;
     }
     // Arguments
     if (strpos($code, $argumentMarkerStart) !== FALSE) {
         $markerCode = substr($code, strpos($code, $argumentMarkerStart), strpos($code, $argumentMarkerEnd) + strlen($argumentMarkerEnd) - strpos($code, $argumentMarkerStart));
         $argumentMarkerValue = $this->getMarkerValue($markerCode, $argumentMarkerEnd);
         $replaceCode = $this->arguments[$argumentMarkerValue];
         $newCode = str_replace($markerCode, $replaceCode, $code);
         $code = $this->fillMarkers($newCode);
         return $code;
     }
     // List link
     if (strpos($code, $listMarkerStart) !== FALSE) {
         $markerCode = substr($code, strpos($code, $listMarkerStart), strpos($code, $listMarkerEnd) + strlen($listMarkerEnd) - strpos($code, $listMarkerStart));
         $listMarkerAttributes = $this->getMarkerAttributes($markerCode, $listMarkerStart);
         $listMarkerValue = $this->getMarkerValue($markerCode, $listMarkerEnd);
         $linkClass = '';
         $linkTitle = '';
         if (isset($listMarkerAttributes['title'])) {
             $linkTitle = $languageUtility->translateValue($listMarkerAttributes['title']);
         }
         if (isset($listMarkerAttributes['linkTo'])) {
             $page = $listMarkerAttributes['linkTo'];
             $redirect = 'true';
             // Link type
             if (isset($listMarkerAttributes['type'])) {
                 if ($listMarkerAttributes['type'] == 'button') {
                     $linkClass = 'tx_ezqueries_link_button';
                 }
             }
             // Redirect
             if (isset($listMarkerAttributes['redirect'])) {
                 $redirect = $listMarkerAttributes['redirect'];
             }
             if ($redirect == 'true') {
                 $linkClass .= ' tx_ezqueries_link_redirect ';
             }
             // Filter column
             if (isset($listMarkerAttributes['filter'])) {
                 if (isset($listMarkerAttributes['filterColumn'])) {
                     $filters[$listMarkerAttributes['filter']] = $this->data[$listMarkerAttributes['filterColumn']];
                 } else {
                     $filters[$listMarkerAttributes['filter']] = $this->data[$listMarkerAttributes['filter']];
                 }
                 $arguments = array('filters' => $filters);
             } else {
                 $arguments = array();
             }
             $url = $urlUtility->createURL('list', $arguments, $page);
             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . '" onclick="return ' . $redirect . ';" href="' . $url . '">' . $languageUtility->translateValue($listMarkerValue) . '</a>';
         } else {
             // Link type
             if (isset($listMarkerAttributes['type'])) {
                 if ($listMarkerAttributes['type'] == 'button') {
                     $linkClass = 'tx_ezqueries_link_button';
                 }
             }
             $arguments = array("filters" => $this->filters);
             $url = $urlUtility->createURL('list', $arguments);
             $replaceCode .= '<a title="' . $linkTitle . '" class="tx_ezqueries_link ' . $linkClass . '" href="' . $url . '">' . $languageUtility->translateValue($listMarkerValue) . '</a>';
         }
         $newCode = str_replace($markerCode, $replaceCode, $code);
         $code = $this->fillMarkers($newCode);
         return $code;
     }
     return $code;
 }
 /**
  * Renders a page browser
  *
  * @param \Frohland\Ezqueries\Domain\Model\RecordManagement $recordManagement
  * @param UriBuilder $uriBuilder
  * @return string $code
  */
 public function render($recordManagement, $uriBuilder = NULL)
 {
     $code = '';
     $startRecord = $recordManagement->getConditions()->getStartRecord();
     $recordsPerPage = $recordManagement->getConditions()->getRecordsPerPage();
     $maxPages = $recordManagement->getConditions()->getMaxPages();
     $recordsCount = $recordManagement->getConditions()->getRecordsCount();
     $orderBy = $recordManagement->getConditions()->getOrderBy();
     $order = $recordManagement->getConditions()->getOrder();
     $search = $recordManagement->getConditions()->getSearch();
     $filters = $recordManagement->getConditions()->getFilters();
     $pageCount = 0;
     $actualPage = 1;
     if ($uriBuilder == NULL) {
         $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $this->controllerContext->getUriBuilder());
     } else {
         $urlUtility = $this->objectManager->create('Frohland\\Ezqueries\\Utility\\URLUtility', $uriBuilder);
     }
     // Are there more than one page to create?
     if ($recordsCount >= $recordsPerPage) {
         $i = 1;
         // Get actual Page and number of pages
         for ($start = 0; $start < $recordsCount; $start = $start + $recordsPerPage) {
             if ($start == $startRecord) {
                 $actualPage = $i - 1;
             }
             $pageCount++;
             $i++;
         }
         if ($maxPages == 0) {
             $maxPages = $pageCount;
         }
         if ($pageCount == 1 || $pageCount == 0) {
             return $code;
         }
         $code .= '<div class="tx_ezqueries_options_pagebrowser"><div class="tx_ezqueries_options_pagebrowser_pages">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_pages', 'ezqueries') . ' </div>';
         // Create page browser elements
         for ($page = 0; $page < $pageCount; $page++) {
             $arguments = array("startRecord" => $page * $recordsPerPage, "orderBy" => $orderBy, "order" => $order, "search" => $search, "filters" => $filters);
             $url = $urlUtility->createURL("list", $arguments);
             if ($pageCount > $maxPages) {
                 // Links to pages
                 if ($page == $actualPage) {
                     $code .= '<div class="tx_ezqueries_options_pagebrowser_actualpage">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</div>';
                 } else {
                     if ($page >= $actualPage - $maxPages / 2 && $page <= $actualPage + $maxPages / 2) {
                         $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</a></div>';
                     } else {
                         if ($actualPage - $maxPages / 2 < 0 && $page <= $actualPage + $maxPages / 2 + -1 * ($actualPage - $maxPages / 2)) {
                             $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</a></div>';
                         } else {
                             if ($actualPage + $maxPages / 2 > $pageCount - 1 && $page >= $actualPage - $maxPages / 2 - ($actualPage + $maxPages / 2 - ($pageCount - 1))) {
                                 $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</a></div>';
                             } else {
                                 // Link to first page
                                 if ($page == 0) {
                                     //$code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_first','ezqueries') . '</a></div>';
                                     $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . '1' . '</a></div>';
                                     $code .= '<div class="tx_ezqueries_options_pagebrowser_points">...</div>';
                                 }
                                 // Link to last page
                                 if ($page == $pageCount - 1) {
                                     $code .= '<div class="tx_ezqueries_options_pagebrowser_points">...</div>';
                                     //$code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_last','ezqueries') . '</a></div>';
                                     $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . $pageCount . '</a></div>';
                                 }
                             }
                         }
                     }
                 }
             } else {
                 if ($page == $actualPage) {
                     $code .= '<div class="tx_ezqueries_options_pagebrowser_actualpage">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</div>';
                 } else {
                     $code .= '<div class="tx_ezqueries_options_pagebrowser_page"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . ' ' . ($page + 1) . '</a></div>';
                 }
             }
         }
         $arguments = array("startRecord" => 0, "recordsPerPage" => 'all', "orderBy" => $orderBy, "order" => $order, "search" => $search, "filters" => $filters);
         $url = $urlUtility->createURL("list", $arguments);
         $code .= '<div class="tx_ezqueries_options_pagebrowser_all" style="display: none;"><a class="tx_ezqueries_link tx_ezqueries_link_button tx_ezqueries_link_pagebrowser" href="' . $url . '">' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('pagebrowser_page', 'ezqueries') . '</a></div>';
         $code .= '</div>';
     }
     return $code;
 }