Author: david
Date: Fri Oct  7 12:49:27 2011
New Revision: 9965

Log:
Add report page for information objects

Added:
   trunk/apps/qubit/modules/informationobject/actions/reportsAction.class.php
   trunk/apps/qubit/modules/informationobject/templates/reportsSuccess.php

Added: 
trunk/apps/qubit/modules/informationobject/actions/reportsAction.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/informationobject/actions/reportsAction.class.php  
Fri Oct  7 12:49:27 2011        (r9965)
@@ -0,0 +1,77 @@
+<?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 InformationObjectReportsAction extends sfAction
+{
+  // Arrays not allowed in class constants
+  public static
+    $NAMES = array(
+      'report'
+    );
+
+  protected function addField($name)
+  {
+    switch ($name)
+    {
+      case 'report':
+        $choices = array(
+          $this->context->routing->generate(null, array($this->resource, 
'module' => 'informationobject', 'action' => 'print')) => 
$this->context->i18n->__('Full description'),
+          $this->context->routing->generate(null, array($this->resource, 
'module' => 'informationobject', 'action' => 'fileList')) => 
$this->context->i18n->__('File list'),
+          $this->context->routing->generate(null, array($this->resource, 
'module' => 'informationobject', 'action' => 'itemList')) => 
$this->context->i18n->__('Item list'),
+          $this->context->routing->generate(null, array($this->resource, 
'module' => 'informationobject', 'action' => 'storageLocations')) => 
$this->context->i18n->__('Physical storage locations'),
+        );
+
+        $this->form->setDefault($name, $this->context->routing->generate(null, 
array($this->resource, 'module' => 'informationobject', 'action' => 'print')));
+        $this->form->setValidator('descriptionStatus', new 
sfValidatorChoice(array('choices' => array_keys($choices))));
+        $this->form->setWidget($name, new sfWidgetFormChoice(array(
+          'expanded' => true,
+          'choices' => $choices)));
+
+        break;
+    }
+  }
+
+  protected function processForm()
+  {
+    foreach ($this->form as $field)
+    {
+      if (isset($this->request[$field->getName()]))
+      {
+        $this->processField($field);
+      }
+    }
+  }
+
+  public function execute($request)
+  {
+    $this->resource = $this->getRoute()->resource;
+
+    if (!isset($this->resource))
+    {
+      $this->forward404();
+    }
+
+    $this->form = new sfForm;
+
+    foreach ($this::$NAMES as $name)
+    {
+      $this->addField($name);
+    }
+  }
+}

Added: trunk/apps/qubit/modules/informationobject/templates/reportsSuccess.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/informationobject/templates/reportsSuccess.php     
Fri Oct  7 12:49:27 2011        (r9965)
@@ -0,0 +1,24 @@
+<h1><?php echo __('Reports') ?></h1>
+
+<h1 class="label">
+  <?php echo $resource->__toString() ?>
+</h1>
+
+<div class="section">
+
+<?php echo render_show(__('Select report'), $form->report) ?>
+
+</div>
+
+<div class="actions section">
+
+  <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+  <div class="content">
+    <ul class="clearfix links">
+      <li><?php echo link_to(__('Continue'), array($resource, 'module' => 
'informationobject', 'action' => 'reports')) ?></li>
+      <li><?php echo link_to(__('Cancel'), array($resource, 'module' => 
'informationobject', 'action' => 'index')) ?></li>
+    </ul>
+  </div>
+
+</div>

-- 
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.

Reply via email to