Author: sevein
Date: Mon Aug  8 16:59:21 2011
New Revision: 9465

Log:
Add rightsholder module and autocomplete action

Added:
   trunk/apps/qubit/modules/rightsholder/
   trunk/apps/qubit/modules/rightsholder/actions/
   trunk/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
   trunk/apps/qubit/modules/rightsholder/templates/
   trunk/apps/qubit/modules/rightsholder/templates/listSuccess.php

Added: 
trunk/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php  
Mon Aug  8 16:59:21 2011        (r9465)
@@ -0,0 +1,47 @@
+<?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 RightsHolderAutocompleteAction extends sfAction
+{
+  public function execute($request)
+  {
+    if (!isset($request->limit))
+    {
+      $request->limit = sfConfig::get('app_hits_per_page');
+    }
+
+    $criteria = new Criteria;
+    $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
+    $criteria->add(QubitActorI18n::CULTURE, 
$this->context->user->getCulture());
+
+    if (isset($request->query))
+    {
+      $criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, 
"$request->query%", Criteria::LIKE);
+    }
+
+    $this->pager = new QubitPager('QubitRightsHolder');
+    $this->pager->setCriteria($criteria);
+    $this->pager->setMaxPerPage($request->limit);
+    $this->pager->setPage($request->page);
+
+    $this->rightsHolders = QubitRightsHolder::get($criteria);
+
+    $this->setTemplate('list');
+  }
+}

Added: trunk/apps/qubit/modules/rightsholder/templates/listSuccess.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/rightsholder/templates/listSuccess.php     Mon Aug 
 8 16:59:21 2011        (r9465)
@@ -0,0 +1,40 @@
+<h1><?php echo __('Search rights holder') ?></h1>
+
+<?php if (isset($error)): ?>
+
+  <div class="search-results">
+    <ul>
+      <li><?php echo $error ?></li>
+    </ul>
+  </div>
+
+<?php else: ?>
+
+  <table class="sticky-enabled">
+    <thead>
+      <tr>
+        <th>
+          <?php echo __('Name') ?>
+        </th>
+      </tr>
+    </thead><tbody>
+      <?php foreach ($rightsholders as $item): ?>
+        <tr class="<?php echo 0 == ++$row % 2 ? 'even' : 'odd' ?>">
+          <td>
+            <?php echo link_to(render_title($item), $item) ?>
+          </td>
+        </tr>
+      <?php endforeach; ?>
+    </tbody>
+  </table>
+
+  <?php echo get_partial('default/pager', array('pager' => $pager)) ?>
+
+<?php endif; ?>
+
+<div class="search">
+  <form action="<?php echo url_for(array('module' => 'rightsholder', 'action' 
=> 'list')) ?>">
+    <input name="subquery" value="<?php echo 
esc_entities($sf_request->subquery) ?>"/>
+    <input class="form-submit" type="submit" value="<?php echo __('Search 
rights holder')) ?>"/>
+  </form>
+</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