示例#1
0
 public function onDisplay()
 {
     $this->view->cats = $this->categories;
     try {
         $this->view->category = $this->categories->getElement($this->getParam('catId'));
     } catch (\Exception $ex) {
         $userEx = new UserException($this->l('No Such Category'));
         $userEx->setUserDescription($this->l('Maybe wrong link? or the category was deleted'));
         throw $userEx;
     }
     try {
         $this->view->programs = $this->programs->getPrograms($this->view->category, 0, 100, true);
     } catch (\Exception $ex) {
         $userEx = new UserException($this->l('Empty Category'));
         $userEx->setUserDescription($this->l('This category has no articles in it'));
         throw $userEx;
     }
 }
示例#2
0
 public function onDisplay()
 {
     $exception = $this->getParam("exception");
     $this->view->userException = array();
     $this->view->messages = array();
     if ($exception instanceof \Exception) {
         $this->view->messages[] = $exception;
         while ($exception->getPrevious() != null) {
             $exception = $exception->getPrevious();
             $this->view->messages[] = $exception;
             if ($exception instanceof UserException) {
                 $this->view->userException[] = $exception;
             }
         }
     }
     if (empty($this->view->userException)) {
         $ex = new UserException($this->l('title_unknown'));
         $ex->setUserDescription($this->l('desc_unknown'));
         $this->view->userException[] = $ex;
     }
 }