Author: sevein
Date: Tue Jun 28 14:46:21 2011
New Revision: 9220
Log:
Add route/action/template for list accessions
Added:
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/listAction.class.php
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/listSuccess.php
Modified:
trunk/apps/qubit/config/routing.yml
Modified: trunk/apps/qubit/config/routing.yml
==============================================================================
--- trunk/apps/qubit/config/routing.yml Tue Jun 28 14:00:52 2011 (r9219)
+++ trunk/apps/qubit/config/routing.yml Tue Jun 28 14:46:21 2011 (r9220)
@@ -30,6 +30,12 @@
module: qtAccessionPlugin
action: edit
+list/accession:
+ url: /;accession/list
+ param:
+ module: qtAccessionPlugin
+ action: list
+
edit/accession:
url: /:slug;accession/edit
class: QubitResourceRoute
Added:
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/listAction.class.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/listAction.class.php
Tue Jun 28 14:46:21 2011 (r9220)
@@ -0,0 +1,46 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class qtAccessionPluginListAction extends sfAction
+{
+ public function execute($request)
+ {
+ if (!$this->context->user->hasCredential(array('contributor', 'editor',
'administrator'), false))
+ {
+ QubitAcl::forwardUnauthorized();
+ }
+
+ if (!isset($request->limit))
+ {
+ $request->limit = sfConfig::get('app_hits_per_page');
+ }
+
+ $criteria = new Criteria;
+
+ $criteria->addAscendingOrderByColumn('date');
+
+ // Page results
+ $this->pager = new QubitPager('QubitAccession');
+ $this->pager->setCriteria($criteria);
+ $this->pager->setMaxPerPage($request->limit);
+ $this->pager->setPage($request->page);
+
+ $this->accessions = $this->pager->getResults();
+ }
+}
Added:
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/listSuccess.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/listSuccess.php
Tue Jun 28 14:46:21 2011 (r9220)
@@ -0,0 +1,25 @@
+<h1><?php echo __('List accession records') ?></h1>
+
+<table class="sticky-enabled">
+ <thead>
+ <tr>
+ <th>
+ <?php echo __('Identifier') ?>
+ </th><th>
+ <?php echo __('Date') ?>
+ </th>
+ </tr>
+ </thead><tbody>
+ <?php foreach ($accessions as $item): ?>
+ <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
+ <td>
+ <?php echo link_to(render_title($item), array($item, 'module' =>
'accession')) ?>
+ </td><td>
+ <?php echo $item->getDate() ?>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+</table>
+
+<?php echo get_partial('default/pager', array('pager' => $pager)) ?>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.