Exemplo n.º 1
0
 public function showAction()
 {
     $show = $this->moduleData->show;
     $page = Digitalus_Builder::getPage();
     $params = $page->getParams();
     if (!isset($params['slide']) || $params['slide'] == null) {
         $index = 1;
     } else {
         $index = $params['slide'];
     }
     $mdlSlide = new Slideshow_Slide();
     $slide = $mdlSlide->getSlideByShow($show, $index);
     $count = $mdlSlide->countSlidesInShow($show);
     $pageLinks = new stdClass();
     if ($index == 1) {
         $pageLinks->first = null;
         $pageLinks->previous = null;
     } else {
         $pageLinks->first = Digitalus_Uri::get(false, false, array('slide' => 1));
         $pageLinks->previous = Digitalus_Uri::get(false, false, array('slide' => $index - 1));
     }
     if ($index < $count && $count > 1) {
         $pageLinks->next = Digitalus_Uri::get(false, false, array('slide' => $index + 1));
         $pageLinks->last = Digitalus_Uri::get(false, false, array('slide' => $count));
     } else {
         $pageLinks->next = null;
         $pageLinks->last = null;
     }
     $this->view->pageLinks = $pageLinks;
     $this->view->slide = $slide;
     $this->view->index = $index;
     $this->view->count = $count;
     $this->view->slides = $mdlSlide->getSlides($show);
 }
Exemplo n.º 2
0
 /**
  * Login action
  *
  * if the form has not been submitted this renders the login form
  * if it has then it validates the data
  * if it is sound then it runs the Digitalus_Auth_Adapter function
  * to authorise the request
  * on success it redirects to the admin home page
  *
  * @return void
  */
 public function loginAction()
 {
     $form = new Admin_Form_Login();
     $form->setAction($this->baseUrl . '/admin/auth/login');
     if ($this->_request->isPost() && $form->isValid($_POST)) {
         $uri = Digitalus_Filter_Post::get('uri');
         $username = Digitalus_Filter_Post::get('adminUsername');
         $password = Digitalus_Filter_Post::get('adminPassword');
         $auth = new Digitalus_Auth($username, $password);
         $result = $auth->authenticate();
         if ($result) {
             if ($uri == '' || $uri == 'admin/auth/login') {
                 $uri = 'admin';
             }
             $this->_redirect($uri);
         } else {
             $e = new Digitalus_View_Error();
             $e->add($this->view->getTranslation('The username or password you entered was not correct.'));
         }
         $this->view->uri = $uri;
     } else {
         $this->view->uri = Digitalus_Uri::get();
     }
     $this->view->form = $form;
 }
Exemplo n.º 3
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $view = $this->getView();
     $this->setAction($view->getBaseUrl() . Digitalus_Uri::get())->setAttrib('id', 'searchForm');
     $submitSearchForm = $this->createElement('hidden', 'submitSearchForm', array('value' => 1));
     $keywords = $this->createElement('text', 'keywords', array('required' => true, 'label' => $view->getTranslation('Keywords'), 'attribs' => array('size' => 50), 'validators' => array(array('NotEmpty', true)), 'errorMessages' => array($view->getTranslation('Please provide a keyword to search for!'))));
     $submit = $this->createElement('submit', 'submit', array('label' => $view->getTranslation('Search'), 'attribs' => array('class' => 'submit')));
     $this->addElement($submitSearchForm)->addElement($keywords)->addElement($submit)->addDisplayGroup(array('form_instance', 'submitSearchForm', 'keywords', 'submit'), 'guestbookGroup', array('legend' => $view->getTranslation('Search Site')));
 }