Remove pager from Company Category index list.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 20 May 2012 15:49:12 +0000 (17:49 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 20 May 2012 15:49:12 +0000 (17:49 +0200)
I am going to use just the Tree with the categories.

apps/companyfront/modules/category/actions/actions.class.php
apps/companyfront/modules/category/templates/indexSuccess.php

index e144889..b27e802 100644 (file)
@@ -18,13 +18,10 @@ class categoryActions extends sfActions
     //Just 1 user owns a company. Should this be improved?
     $companyId = CompanyTable::getInstance()->findOneByUserId($userId)->getId();
 
-    //Doctrine Query used to show a pager with the Company Categories.
+    //Doctrine Query used to show a list with the Company Categories.
     $query=CompanyCategoryTable::getInstance()->getCompanyCategoriesByCompanyIdQuery($companyId);
 
-    $this->pager = new sfDoctrinePager('CompanyCategoryDescription', sfConfig::get('app_max_categories_on_pager'));
-    $this->pager->setQuery($query);
-    $this->pager->setPage($request->getParameter('page', 1));
-    $this->pager->init();
+    $this->companyCategories = $query->execute();
   }
 
   public function executeShow(sfWebRequest $request)
index e9c8e90..d86021c 100644 (file)
@@ -1,25 +1,5 @@
 <h2><?php echo __('Company Category Index') ?></h2>
 
-<?php include_partial('category/list', array('company_categories' => $pager->getResults())) ?>
+<?php include_partial('category/list', array('company_categories' => $companyCategories)) ?>
 
-<?php if ($pager->haveToPaginate()): ?>
-  <div class="pagination">
-    <a href="<?php echo url_for('companycategories_index') ?>?page=1"><?php echo __('first page') ?></a>
-
-    <a href="<?php echo url_for('companycategories_index') ?>?page=<?php echo $pager->getPreviousPage() ?>"><?php echo __('<< prev') ?></a>
-
-    <?php foreach ($pager->getLinks() as $page): ?>
-      <?php if ($page == $pager->getPage()): ?>
-        <?php echo $page ?>
-      <?php else: ?>
-        <a href="<?php echo url_for('companycategories_index') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
-      <?php endif; ?>
-    <?php endforeach; ?>
-
-    <a href="<?php echo url_for('companycategories_index') ?>?page=<?php echo $pager->getNextPage() ?>"><?php echo __('next >>') ?></a>
-
-    <a href="<?php echo url_for('companycategories_index') ?>?page=<?php echo $pager->getLastPage() ?>"><?php echo __('last page') ?></a>
-  </div>
-<?php endif; ?>
-
-<a href="<?php echo url_for('category/new') ?>" class="bt_green"><span class="bt_green_lft"></span><strong>Create new Category</strong><span class="bt_green_r"></span></a>
+<a href="<?php echo url_for('category/new') ?>" class="bt_green"><span class="bt_green_lft"></span><strong><?php echo __('Create new Category') ?></strong><span class="bt_green_r"></span></a>