Guest User

Untitled

a guest
Jun 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <?php
  2. class BlackoutController extends Zend_Controller_Action {
  3. function __call($name, $var) {
  4. $this->_redirect('/', array('exit' => 1));
  5. }
  6.  
  7. function init() {
  8.  
  9. }
  10. function preDispatch() {
  11. $auth = Zend_Auth::getInstance();
  12. if (!$auth->hasIdentity()) {
  13. $this->_redirect('auth/login');
  14. }
  15. }
  16. function indexAction() {
  17. $this->_redirect($this->_request->getBaseUrl());
  18. }
  19.  
  20. function editAction() {
  21. Zend_Dojo::enableView($this->view);
  22. $this->view->dojo()
  23. ->addStyleSheetModule('dijit.themes.tundra')
  24. ->setDjConfigOption('usePlainJson', true)
  25. ->enable();
  26. $auth = Zend_Auth::getInstance();
  27. $user = $auth->getStorage()->read($data);
  28. $acl = Zend_Registry::get('acl');
  29. if (!($acl->isAllowed($user->role, 'district', 'edit'))) {
  30. $this->_redirect($this->_request->getBaseUrl());
  31. }
  32. $db = Zend_Registry::get('db');
  33. $this->view->title = "Edit Blackout Dates";
  34.  
  35. // quarter start selector
  36.  
  37. $this->view->quarterform = $this->formQuarter();
  38.  
  39. // blackout entries
  40.  
  41. }
  42. function formQuarter() {
  43. $form = new Zend_Dojo_Form(array('name' => 'quarter_dates'));
  44. $form->setAction('/blackout/edit')->setMethod('post');
  45. $q1 = new Zend_Dojo_Form_Element_DateTextBox('q1');
  46. $q1->setLabel('q1');
  47. $q2 = new Zend_Dojo_Form_Element_DateTextBox('q2');
  48. $q2->setLabel('q2');
  49. $q3 = new Zend_Dojo_Form_Element_DateTextBox('q3');
  50. $q3->setLabel('q3');
  51. $q4 = new Zend_Dojo_Form_Element_DateTextBox('q4');
  52. $q4->setLabel('q4');
  53. $form->addElements(array($q1, $q2, $q3, $q4));
  54. $form->addElement('submit', 'process', array('label' => 'process'));
  55. return $form;
  56. }
  57. }
Add Comment
Please, Sign In to add comment