Ejemplo n.º 1
0
 public function __viewIndex()
 {
     $sectionManager = new SectionManager($this->_Parent);
     if (!($section_id = $sectionManager->fetchIDFromHandle($this->_context['section_handle']))) {
         Administration::instance()->customError(__('Unknown Section'), __('The Section you are looking, <code>%s</code> for could not be found.', array($this->_context['section_handle'])));
     }
     $section = $sectionManager->fetch($section_id);
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), $section->get('name'))));
     $this->Form->setAttribute("class", $this->_context['section_handle']);
     $entryManager = new EntryManager($this->_Parent);
     $filter = $filter_value = $where = $joins = NULL;
     $current_page = isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg']) ? max(1, intval($_REQUEST['pg'])) : 1;
     if (isset($_REQUEST['filter'])) {
         list($field_handle, $filter_value) = explode(':', $_REQUEST['filter'], 2);
         $field_names = explode(',', $field_handle);
         foreach ($field_names as $field_name) {
             $filter_value = rawurldecode($filter_value);
             $filter = Symphony::Database()->fetchVar('id', 0, "SELECT `f`.`id`\n\t\t\t\t\t\t\t\t\t\t  FROM `tbl_fields` AS `f`, `tbl_sections` AS `s`\n\t\t\t\t\t\t\t\t\t\t  WHERE `s`.`id` = `f`.`parent_section`\n\t\t\t\t\t\t\t\t\t\t  AND f.`element_name` = '{$field_name}'\n\t\t\t\t\t\t\t\t\t\t  AND `s`.`handle` = '" . $section->get('handle') . "' LIMIT 1");
             $field =& $entryManager->fieldManager->fetch($filter);
             if ($field instanceof Field) {
                 // For deprecated reasons, call the old, typo'd function name until the switch to the
                 // properly named buildDSRetrievalSQL function.
                 $field->buildDSRetrivalSQL(array($filter_value), $joins, $where, false);
                 $filter_value = rawurlencode($filter_value);
             }
         }
         if (!is_null($where)) {
             $where = str_replace('AND', 'OR', $where);
             // multiple fields need to be OR
             $where = trim($where);
             $where = ' AND (' . substr($where, 2, strlen($where)) . ')';
             // replace leading OR with AND
         }
     }
     if (isset($_REQUEST['sort']) && is_numeric($_REQUEST['sort'])) {
         $sort = intval($_REQUEST['sort']);
         $order = $_REQUEST['order'] ? strtolower($_REQUEST['order']) : 'asc';
         if ($section->get('entry_order') != $sort || $section->get('entry_order_direction') != $order) {
             $sectionManager->edit($section->get('id'), array('entry_order' => $sort, 'entry_order_direction' => $order));
             redirect(Administration::instance()->getCurrentPageURL() . ($filter ? "?filter={$field_handle}:{$filter_value}" : ''));
         }
     } elseif (isset($_REQUEST['unsort'])) {
         $sectionManager->edit($section->get('id'), array('entry_order' => NULL, 'entry_order_direction' => NULL));
         redirect(Administration::instance()->getCurrentPageURL());
     }
     $this->Form->setAttribute('action', Administration::instance()->getCurrentPageURL() . '?pg=' . $current_page . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : ''));
     $this->appendSubheading($section->get('name'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/' . ($filter ? '?prepopulate[' . $filter . ']=' . $filter_value : ''), __('Create a new entry'), 'create button', NULL, array('accesskey' => 'c')));
     if (is_null($entryManager->getFetchSorting()->field) && is_null($entryManager->getFetchSorting()->direction)) {
         $entryManager->setFetchSortingDirection('DESC');
     }
     $entries = $entryManager->fetchByPage($current_page, $section_id, Symphony::Configuration()->get('pagination_maximum_rows', 'symphony'), $where, $joins);
     $aTableHead = array();
     $visible_columns = $section->fetchVisibleColumns();
     if (is_array($visible_columns) && !empty($visible_columns)) {
         foreach ($visible_columns as $column) {
             $label = $column->get('label');
             if ($column->isSortable()) {
                 if ($column->get('id') == $section->get('entry_order')) {
                     $link = Administration::instance()->getCurrentPageURL() . '?pg=' . $current_page . '&amp;sort=' . $column->get('id') . '&amp;order=' . ($section->get('entry_order_direction') == 'desc' ? 'asc' : 'desc') . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '');
                     $anchor = Widget::Anchor($label, $link, __('Sort by %1$s %2$s', array($section->get('entry_order_direction') == 'desc' ? __('ascending') : __('descending'), strtolower($column->get('label')))), 'active');
                 } else {
                     $link = Administration::instance()->getCurrentPageURL() . '?pg=' . $current_page . '&amp;sort=' . $column->get('id') . '&amp;order=asc' . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '');
                     $anchor = Widget::Anchor($label, $link, __('Sort by %1$s %2$s', array(__('ascending'), strtolower($column->get('label')))));
                 }
                 $aTableHead[] = array($anchor, 'col', array('id' => 'field-' . $column->get('id'), 'class' => 'field-' . $column->get('type')));
             } else {
                 $aTableHead[] = array($label, 'col', array('id' => 'field-' . $column->get('id'), 'class' => 'field-' . $column->get('type')));
             }
         }
     } else {
         $aTableHead[] = array(__('ID'), 'col');
     }
     $child_sections = array();
     $associated_sections = $section->fetchAssociatedSections(true);
     if (is_array($associated_sections) && !empty($associated_sections)) {
         foreach ($associated_sections as $key => $as) {
             $child_sections[$key] = $sectionManager->fetch($as['child_section_id']);
             $aTableHead[] = array($child_sections[$key]->get('name'), 'col');
         }
     }
     /**
      * Allows the creation of custom entries tablecolumns. Called
      * after all the Section Visible columns have been added  as well
      * as the Section Associations
      *
      * @delegate AddCustomPublishColumn
      * @since Symphony 2.2
      * @param string $context
      * '/publish/'
      * @param array $tableHead
      * An array of the current columns, passed by reference
      * @param integer $section_id
      * The current Section ID
      */
     Symphony::ExtensionManager()->notifyMembers('AddCustomPublishColumn', '/publish/', array('tableHead' => &$aTableHead, 'section_id' => $section->get('id')));
     ## Table Body
     $aTableBody = array();
     if (!is_array($entries['records']) || empty($entries['records'])) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $field_pool = array();
         if (is_array($visible_columns) && !empty($visible_columns)) {
             foreach ($visible_columns as $column) {
                 $field_pool[$column->get('id')] = $column;
             }
         }
         foreach ($entries['records'] as $entry) {
             $tableData = array();
             ## Setup each cell
             if (!is_array($visible_columns) || empty($visible_columns)) {
                 $tableData[] = Widget::TableData(Widget::Anchor($entry->get('id'), Administration::instance()->getCurrentPageURL() . 'edit/' . $entry->get('id') . '/'));
             } else {
                 $link = Widget::Anchor('None', Administration::instance()->getCurrentPageURL() . 'edit/' . $entry->get('id') . '/', $entry->get('id'), 'content');
                 foreach ($visible_columns as $position => $column) {
                     $data = $entry->getData($column->get('id'));
                     $field = $field_pool[$column->get('id')];
                     $value = $field->prepareTableValue($data, $position == 0 ? $link : null, $entry->get('id'));
                     if (!is_object($value) && strlen(trim($value)) == 0) {
                         $value = $position == 0 ? $link->generate() : __('None');
                     }
                     if ($value == 'None') {
                         $tableData[] = Widget::TableData($value, 'inactive field-' . $column->get('type') . ' field-' . $column->get('id'));
                     } else {
                         $tableData[] = Widget::TableData($value, 'field-' . $column->get('type') . ' field-' . $column->get('id'));
                     }
                     unset($field);
                 }
             }
             if (is_array($child_sections) && !empty($child_sections)) {
                 foreach ($child_sections as $key => $as) {
                     $field = $entryManager->fieldManager->fetch((int) $associated_sections[$key]['child_section_field_id']);
                     $parent_section_field_id = (int) $associated_sections[$key]['parent_section_field_id'];
                     if (!is_null($parent_section_field_id)) {
                         $search_value = $field->fetchAssociatedEntrySearchValue($entry->getData($parent_section_field_id), $parent_section_field_id, $entry->get('id'));
                     } else {
                         $search_value = $entry->get('id');
                     }
                     if (!is_array($search_value)) {
                         $associated_entry_count = $field->fetchAssociatedEntryCount($search_value);
                         $tableData[] = Widget::TableData(Widget::Anchor(sprintf('%d &rarr;', max(0, intval($associated_entry_count))), sprintf('%s/publish/%s/?filter=%s:%s', SYMPHONY_URL, $as->get('handle'), $field->get('element_name'), rawurlencode($search_value)), $entry->get('id'), 'content'));
                     }
                 }
             }
             /**
              * Allows Extensions to inject custom table data for each Entry
              * into the Publish Index
              *
              * @delegate AddCustomPublishColumnData
              * @since Symphony 2.2
              * @param string $context
              * '/publish/'
              * @param array $tableData
              *  An array of `Widget::TableData`, passed by reference
              * @param integer $section_id
              *  The current Section ID
              * @param integer $entry_id
              *  The Entry ID for this row
              */
             Symphony::ExtensionManager()->notifyMembers('AddCustomPublishColumnData', '/publish/', array('tableData' => &$tableData, 'section_id' => $section->get('id'), 'entry_id' => $entry));
             $tableData[count($tableData) - 1]->appendChild(Widget::Input('items[' . $entry->get('id') . ']', NULL, 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow($tableData, NULL, 'id-' . $entry->get('id'));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm', null, array('data-message' => __('Are you sure you want to delete the selected entries?'))));
     $toggable_fields = $section->fetchToggleableFields();
     if (is_array($toggable_fields) && !empty($toggable_fields)) {
         $index = 2;
         foreach ($toggable_fields as $field) {
             $options[$index] = array('label' => __('Set %s', array($field->get('label'))), 'options' => array());
             foreach ($field->getToggleStates() as $value => $state) {
                 $options[$index]['options'][] = array('toggle-' . $field->get('id') . '-' . $value, false, $state);
             }
             $index++;
         }
     }
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
     if ($entries['total-pages'] > 1) {
         $ul = new XMLElement('ul');
         $ul->setAttribute('class', 'page');
         ## First
         $li = new XMLElement('li');
         if ($current_page > 1) {
             $li->appendChild(Widget::Anchor(__('First'), Administration::instance()->getCurrentPageURL() . '?pg=1' . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('First'));
         }
         $ul->appendChild($li);
         ## Previous
         $li = new XMLElement('li');
         if ($current_page > 1) {
             $li->appendChild(Widget::Anchor(__('&larr; Previous'), Administration::instance()->getCurrentPageURL() . '?pg=' . ($current_page - 1) . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('&larr; Previous'));
         }
         $ul->appendChild($li);
         ## Summary
         $li = new XMLElement('li', __('Page %1$s of %2$s', array($current_page, max($current_page, $entries['total-pages']))));
         $li->setAttribute('title', __('Viewing %1$s - %2$s of %3$s entries', array($entries['start'], $current_page != $entries['total-pages'] ? $current_page * Symphony::Configuration()->get('pagination_maximum_rows', 'symphony') : $entries['total-entries'], $entries['total-entries'])));
         $ul->appendChild($li);
         ## Next
         $li = new XMLElement('li');
         if ($current_page < $entries['total-pages']) {
             $li->appendChild(Widget::Anchor(__('Next &rarr;'), Administration::instance()->getCurrentPageURL() . '?pg=' . ($current_page + 1) . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('Next &rarr;'));
         }
         $ul->appendChild($li);
         ## Last
         $li = new XMLElement('li');
         if ($current_page < $entries['total-pages']) {
             $li->appendChild(Widget::Anchor(__('Last'), Administration::instance()->getCurrentPageURL() . '?pg=' . $entries['total-pages'] . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('Last'));
         }
         $ul->appendChild($li);
         $this->Form->appendChild($ul);
     }
 }
Ejemplo n.º 2
0
 function __viewIndex()
 {
     $sectionManager = new SectionManager($this->_Parent);
     if (!($section_id = $sectionManager->fetchIDFromHandle($this->_context['section_handle']))) {
         $this->_Parent->customError(E_USER_ERROR, __('Unknown Section'), __('The Section you are looking, <code>%s</code> for could not be found.', array($this->_context['section_handle'])), false, true);
     }
     $section = $sectionManager->fetch($section_id);
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), $section->get('name'))));
     $this->Form->setAttribute("class", $this->_context['section_handle']);
     $entryManager = new EntryManager($this->_Parent);
     $authors = AuthorManager::fetch();
     $filter = $filter_value = $where = $joins = NULL;
     $current_page = isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg']) ? max(1, intval($_REQUEST['pg'])) : 1;
     if (isset($_REQUEST['filter'])) {
         list($field_handle, $filter_value) = explode(':', $_REQUEST['filter'], 2);
         $field_names = explode(',', $field_handle);
         foreach ($field_names as $field_name) {
             $filter_value = rawurldecode($filter_value);
             $filter = Symphony::Database()->fetchVar('id', 0, "SELECT `f`.`id` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   FROM `tbl_fields` AS `f`, `tbl_sections` AS `s` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   WHERE `s`.`id` = `f`.`parent_section` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   AND f.`element_name` = '{$field_name}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   AND `s`.`handle` = '" . $section->get('handle') . "' LIMIT 1");
             $field =& $entryManager->fieldManager->fetch($filter);
             if (is_object($field)) {
                 $field->buildDSRetrivalSQL(array($filter_value), $joins, $where, false);
                 $filter_value = rawurlencode($filter_value);
             }
         }
         if ($where != null) {
             $where = str_replace('AND', 'OR', $where);
             // multiple fields need to be OR
             $where = trim($where);
             $where = ' AND (' . substr($where, 2, strlen($where)) . ')';
             // replace leading OR with AND
         }
     }
     if (isset($_REQUEST['sort']) && is_numeric($_REQUEST['sort'])) {
         $sort = intval($_REQUEST['sort']);
         $order = $_REQUEST['order'] ? strtolower($_REQUEST['order']) : 'asc';
         if ($section->get('entry_order') != $sort || $section->get('entry_order_direction') != $order) {
             $sectionManager->edit($section->get('id'), array('entry_order' => $sort, 'entry_order_direction' => $order));
             redirect($this->_Parent->getCurrentPageURL() . ($filter ? "?filter={$field_handle}:{$filter_value}" : ''));
         }
     } elseif (isset($_REQUEST['unsort'])) {
         $sectionManager->edit($section->get('id'), array('entry_order' => NULL, 'entry_order_direction' => NULL));
         redirect($this->_Parent->getCurrentPageURL());
     }
     $this->Form->setAttribute('action', $this->_Parent->getCurrentPageURL() . '?pg=' . $current_page . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : ''));
     ## Remove the create button if there is a section link field, and no filtering set for it
     $section_links = $section->fetchFields('sectionlink');
     if (count($section_links) > 1 || !$filter && $section_links || is_object($section_links[0]) && $filter != $section_links[0]->get('id')) {
         $this->appendSubheading($section->get('name'));
     } else {
         $this->appendSubheading($section->get('name'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'new/' . ($filter ? '?prepopulate[' . $filter . ']=' . $filter_value : ''), __('Create a new entry'), 'create button'));
     }
     if (is_null($entryManager->getFetchSorting()->field) && is_null($entryManager->getFetchSorting()->direction)) {
         $entryManager->setFetchSortingDirection('DESC');
     }
     $entries = $entryManager->fetchByPage($current_page, $section_id, Symphony::Configuration()->get('pagination_maximum_rows', 'symphony'), $where, $joins);
     $aTableHead = array();
     $visible_columns = $section->fetchVisibleColumns();
     if (is_array($visible_columns) && !empty($visible_columns)) {
         foreach ($visible_columns as $column) {
             $label = $column->get('label');
             if ($column->isSortable()) {
                 if ($column->get('id') == $section->get('entry_order')) {
                     $link = $this->_Parent->getCurrentPageURL() . '?pg=' . $current_page . '&amp;sort=' . $column->get('id') . '&amp;order=' . ($section->get('entry_order_direction') == 'desc' ? 'asc' : 'desc') . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '');
                     $anchor = Widget::Anchor($label, $link, __('Sort by %1$s %2$s', array($section->get('entry_order_direction') == 'desc' ? __('ascending') : __('descending'), strtolower($column->get('label')))), 'active');
                 } else {
                     $link = $this->_Parent->getCurrentPageURL() . '?pg=' . $current_page . '&amp;sort=' . $column->get('id') . '&amp;order=asc' . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '');
                     $anchor = Widget::Anchor($label, $link, __('Sort by %1$s %2$s', array(__('ascending'), strtolower($column->get('label')))));
                 }
                 $aTableHead[] = array($anchor, 'col');
             } else {
                 $aTableHead[] = array($label, 'col');
             }
         }
     } else {
         $aTableHead[] = array(__('ID'), 'col');
     }
     $child_sections = NULL;
     $associated_sections = $section->fetchAssociatedSections();
     if (is_array($associated_sections) && !empty($associated_sections)) {
         $child_sections = array();
         foreach ($associated_sections as $key => $as) {
             $child_sections[$key] = $sectionManager->fetch($as['child_section_id']);
             $aTableHead[] = array($child_sections[$key]->get('name'), 'col');
         }
     }
     ## Table Body
     $aTableBody = array();
     if (!is_array($entries['records']) || empty($entries['records'])) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         $field_pool = array();
         if (is_array($visible_columns) && !empty($visible_columns)) {
             foreach ($visible_columns as $column) {
                 $field_pool[$column->get('id')] = $column;
             }
         }
         foreach ($entries['records'] as $entry) {
             $tableData = array();
             ## Setup each cell
             if (!is_array($visible_columns) || empty($visible_columns)) {
                 $tableData[] = Widget::TableData(Widget::Anchor($entry->get('id'), $this->_Parent->getCurrentPageURL() . 'edit/' . $entry->get('id') . '/'));
             } else {
                 $link = Widget::Anchor('None', $this->_Parent->getCurrentPageURL() . 'edit/' . $entry->get('id') . '/', $entry->get('id'), 'content');
                 foreach ($visible_columns as $position => $column) {
                     $data = $entry->getData($column->get('id'));
                     $field = $field_pool[$column->get('id')];
                     $value = $field->prepareTableValue($data, $position == 0 ? $link : null, $entry->get('id'));
                     if (!is_object($value) && strlen(trim($value)) == 0) {
                         $value = $position == 0 ? $link->generate() : __('None');
                     }
                     if ($value == 'None') {
                         $tableData[] = Widget::TableData($value, 'inactive');
                     } else {
                         $tableData[] = Widget::TableData($value);
                     }
                     unset($field);
                 }
             }
             if (is_array($child_sections) && !empty($child_sections)) {
                 foreach ($child_sections as $key => $as) {
                     $field = $entryManager->fieldManager->fetch((int) $associated_sections[$key]['child_section_field_id']);
                     $parent_section_field_id = (int) $associated_sections[$key]['parent_section_field_id'];
                     if (!is_null($parent_section_field_id)) {
                         $search_value = $field->fetchAssociatedEntrySearchValue($entry->getData($parent_section_field_id), $parent_section_field_id, $entry->get('id'));
                     } else {
                         $search_value = $entry->get('id');
                     }
                     $associated_entry_count = $field->fetchAssociatedEntryCount($search_value);
                     $tableData[] = Widget::TableData(Widget::Anchor(sprintf('%d &rarr;', max(0, intval($associated_entry_count))), sprintf('%s/symphony/publish/%s/?filter=%s:%s', URL, $as->get('handle'), $field->get('element_name'), rawurlencode($search_value)), $entry->get('id'), 'content'));
                 }
             }
             $tableData[count($tableData) - 1]->appendChild(Widget::Input('items[' . $entry->get('id') . ']', NULL, 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow($tableData, $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $toggable_fields = $section->fetchToggleableFields();
     if (is_array($toggable_fields) && !empty($toggable_fields)) {
         $index = 2;
         foreach ($toggable_fields as $field) {
             $options[$index] = array('label' => __('Set %s', array($field->get('label'))), 'options' => array());
             foreach ($field->getToggleStates() as $value => $state) {
                 $options[$index]['options'][] = array('toggle-' . $field->get('id') . '-' . $value, false, $state);
             }
             $index++;
         }
     }
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
     if ($entries['total-pages'] > 1) {
         $ul = new XMLElement('ul');
         $ul->setAttribute('class', 'page');
         ## First
         $li = new XMLElement('li');
         if ($current_page > 1) {
             $li->appendChild(Widget::Anchor(__('First'), $this->_Parent->getCurrentPageURL() . '?pg=1' . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('First'));
         }
         $ul->appendChild($li);
         ## Previous
         $li = new XMLElement('li');
         if ($current_page > 1) {
             $li->appendChild(Widget::Anchor(__('&larr; Previous'), $this->_Parent->getCurrentPageURL() . '?pg=' . ($current_page - 1) . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('&larr; Previous'));
         }
         $ul->appendChild($li);
         ## Summary
         $li = new XMLElement('li', __('Page %1$s of %2$s', array($current_page, max($current_page, $entries['total-pages']))));
         $li->setAttribute('title', __('Viewing %1$s - %2$s of %3$s entries', array($entries['start'], min($entries['limit'], max(1, $entries['remaining-entries'])), $entries['total-entries'])));
         $ul->appendChild($li);
         ## Next
         $li = new XMLElement('li');
         if ($current_page < $entries['total-pages']) {
             $li->appendChild(Widget::Anchor(__('Next &rarr;'), $this->_Parent->getCurrentPageURL() . '?pg=' . ($current_page + 1) . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('Next &rarr;'));
         }
         $ul->appendChild($li);
         ## Last
         $li = new XMLElement('li');
         if ($current_page < $entries['total-pages']) {
             $li->appendChild(Widget::Anchor(__('Last'), $this->_Parent->getCurrentPageURL() . '?pg=' . $entries['total-pages'] . ($filter ? "&amp;filter={$field_handle}:{$filter_value}" : '')));
         } else {
             $li->setValue(__('Last'));
         }
         $ul->appendChild($li);
         $this->Form->appendChild($ul);
     }
 }