Example #1
0
 public function init()
 {
     $this->setName('f2')->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $cateOptions = Default_Model_Constraints::backup_loai();
     $loai = new Zend_Form_Element_Select('loai');
     $loai->setLabel('Loại')->addMultiOptions($cateOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $saveOptions = array('0' => 'Lưu trên host', '1' => 'Tải về máy');
     $save = new Zend_Form_Element_Select('save');
     $save->setLabel('Save')->addMultiOptions($saveOptions)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'database', 'action' => 'index'), null, true);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $loai, $save, $submit, $cancel));
     $this->addDisplayGroup(array('submit', 'cancel'), 'btnsubmit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Example #2
0
 public function indexAction()
 {
     // TODO Auto-generated {0}::indexAction() default action
     $backups = $this->backup->getAll();
     $paginator = Zend_Paginator::factory($backups);
     $currentPage = 1;
     //Check if the user is not on page 1
     $page = $this->_getParam('page');
     if (!empty($page)) {
         //Where page is the current page
         $currentPage = $this->_getParam('page');
     }
     //Set the properties for the pagination
     $paginator->setItemCountPerPage(20);
     $paginator->setPageRange(10);
     $paginator->setCurrentPageNumber($currentPage);
     Zend_Paginator::setDefaultScrollingStyle('Sliding');
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('includes/pagination.phtml');
     $paginator->setView($this->view);
     $this->view->paginator = $paginator;
     $this->view->loais = Default_Model_Constraints::backup_loai();
 }