I tried this on the view script: <?php echo $this->paginationControl($this->paginator, 'Sliding', 'page.phtml',array('software_id' => $this->software_id,'release_id' => $this->release_id,'doc_type' => $this->doc_type)); ?> don't seem to be having much luck!
this is what I'm doing on the controller, any ideas?
public function relnoteindexAction()
{
try {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()):
$this->view->identity = $auth->getIdentity();
$email = $auth->getIdentity();
$id = $this->user->getuserid($email);
$role = $this->user->checkrole($id);
if($this->acl->isAllowed($role, 'admin','relnoteindex')):
$form = new DocIndexForm();
$this->view->form = $form;
if($this->getRequest()->isGet()):
$formData = $this->getRequest()->getParams();
if($form->isValid($formData)):
$page = Zend_Filter::get($this->getRequest()->get('page'),'StripTags');
$software_id = Zend_Filter::get($this->getRequest()->get('software_id'),'StripTags');
$release_id = Zend_Filter::get($this->getRequest()->get('release_id'),'StripTags');
$doc_type = Zend_Filter::get($this->getRequest()->get('document_id'),'StripTags');
$this->view->software_id = $software_id;
$this->view->release_id = $release_id;
$this->view->doc_type = $doc_type;
$itemsPerPage = 1;
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$select = $this->db->select()
->from(array('p' =>'SOFTWARE_DOCUMENTS_VW'),
array('ID AS DOCID','TITLE','CREATED_BY','CREATION_DATE','LAST_UPDATE','SOFTWARE_ID','SOFTWARE_NAME',
'RELEASE_ID','RELEASE_NAME','DOC_TYPE_ID','DOC_NAME','COMPANY_ID','COMPANY_NAME','PUBLISHED',
'LOCKED_STATUS','LOCKED_BY','LOCKED_DATE'))
->where('p.SOFTWARE_ID = ?',$software_id)
->where('p.DOC_TYPE_ID = ?', $doc_type)
->where('p.RELEASE_ID= ?',$release_id);
$rows = $this->db->fetchAll($select);
$paginator = Zend_Paginator::factory($rows);
$paginator->setItemCountPerPage($itemsPerPage);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
else:
$form->populate($formData);
endif;
endif;
else:
$this->render('insufficient-permissions');
endif;
elseif (!$auth->hasIdentity()):
$this->_redirect('/register');
endif;
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->log->info("Controller: Administrator Action: relnoteindex Error: $msg" );
$this->render('error');
}
}
this is what I'm doing on the controller, any ideas?
public function relnoteindexAction()
{
try {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()):
$this->view->identity = $auth->getIdentity();
$email = $auth->getIdentity();
$id = $this->user->getuserid($email);
$role = $this->user->checkrole($id);
if($this->acl->isAllowed($role, 'admin','relnoteindex')):
$form = new DocIndexForm();
$this->view->form = $form;
if($this->getRequest()->isGet()):
$formData = $this->getRequest()->getParams();
if($form->isValid($formData)):
$page = Zend_Filter::get($this->getRequest()->get('page'),'StripTags');
$software_id = Zend_Filter::get($this->getRequest()->get('software_id'),'StripTags');
$release_id = Zend_Filter::get($this->getRequest()->get('release_id'),'StripTags');
$doc_type = Zend_Filter::get($this->getRequest()->get('document_id'),'StripTags');
$this->view->software_id = $software_id;
$this->view->release_id = $release_id;
$this->view->doc_type = $doc_type;
$itemsPerPage = 1;
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$select = $this->db->select()
->from(array('p' =>'SOFTWARE_DOCUMENTS_VW'),
array('ID AS DOCID','TITLE','CREATED_BY','CREATION_DATE','LAST_UPDATE','SOFTWARE_ID','SOFTWARE_NAME',
'RELEASE_ID','RELEASE_NAME','DOC_TYPE_ID','DOC_NAME','COMPANY_ID','COMPANY_NAME','PUBLISHED',
'LOCKED_STATUS','LOCKED_BY','LOCKED_DATE'))
->where('p.SOFTWARE_ID = ?',$software_id)
->where('p.DOC_TYPE_ID = ?', $doc_type)
->where('p.RELEASE_ID= ?',$release_id);
$rows = $this->db->fetchAll($select);
$paginator = Zend_Paginator::factory($rows);
$paginator->setItemCountPerPage($itemsPerPage);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
else:
$form->populate($formData);
endif;
endif;
else:
$this->render('insufficient-permissions');
endif;
elseif (!$auth->hasIdentity()):
$this->_redirect('/register');
endif;
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->log->info("Controller: Administrator Action: relnoteindex Error: $msg" );
$this->render('error');
}
}
On Tue, Sep 30, 2008 at 7:21 PM, Gabriel Baez <sheik316@gmail.com> wrote:
Yea I looked on the docs and didn't see it, thanks for the info.On Tue, Sep 30, 2008 at 5:00 PM, Daniel Skinner <skinner@destiny-denied.co.uk> wrote:
http://framework.zend.com/issues/browse/ZF-4430
Kind Regards,
*Daniel Skinner*
Daniel Skinner wrote:
In your view script:skinner@destiny-denied.co.uk <mailto:skinner@destiny-denied.co.uk>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination_control.phtml', array('specification' => $this->currentSpecificationUID)); ?>
The method signature is:
paginationControl(Zend_Paginator $paginator, $paginationType, $paginationPartialScript, Array $partialParameters = array);
So In my above example I passed the 'specification' parameter and it's available in the pagination control partial as $this->specification.
I think this should be noted in the documentation on Zend_Paginator somewhere. Shall I create an issue?
Kind Regards,
*Daniel Skinner*
*Tel:* 01977 87 80 22
*Fax:* 08455 08 36 15
*Mobile:* 07791 360 230
www.destiny-denied.co.uk <http://www.destiny-denied.co.uk/>
Gabriel Baez wrote:
Could you give an example on how you would pass the search parameters to the pagination control helper? thanks.
On Sun, Sep 28, 2008 at 4:28 AM, Daniel Skinner <skinner@destiny-denied.co.uk <mailto:skinner@destiny-denied.co.uk>> wrote:
Thanks Matt, I didn't realise that you could pass parameters to
the PaginationControl partial - I should have looked at the API
docs in more detail.
Daniel
Matthew Ratzloff wrote:
One way to do it:
1. Submit form as GET
2. Controller looks at Request object to pull appropriate
search parameters
2. Uses search parameters to create SQL query, which it
passes to paginator
3. Passes paginator and search parameters (including current
page number) to PaginationControl helper
-Matt
On Wed, Sep 24, 2008 at 2:39 PM, Daniel Skinner
<skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk><http://www.destiny-denied.co.uk/><mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>> wrote:
I am using Zend_Paginator in a very standard setup.
My index action of the controller produces a form. Also,
if the
form is filled in (i.e. is valid), it (the same index action)
proceeds to generate a collection of objects filtered by
information entered into the form. This collection of
objects in
then paginated and all is well for the first page of results.
When I click onto the next page, the form data is not sent
and so
there is no model for the paginator to work with.
My immediate idea was to add an additional parameter to the
first/next/last/prev links which could be used to
regenerate the
same model as the paginator was using with page 1.
The problem is that the pagination control is a partial
and I cant
figure out how to pass global view variables to it.
Is there a way to do this or is my general approach (i.e.
adding
query strings to the paginator URI's) wrong?
--
Kind Regards,
*Daniel Skinner*
*Tel:* 01977 87 80 22
*Fax:* 08455 08 36 15
*Mobile:* 07791 360 230
skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>
www.destiny-denied.co.uk <http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk>
没有评论:
发表评论