Example #1
0
 /**
  * constructor; calls the requested MVC
  * 
  * @access public
  * @param Request $oRequest
  * @return void
  */
 public function __construct(Request $oRequest)
 {
     Event::RUN('mvc.controller.before');
     // get Request Array
     $aQueryArray = $oRequest->getQueryArray();
     // start requested Module/Class/Method/Arguments
     $oReflex = new Reflex();
     $bStatus = $oReflex->reflect($aQueryArray);
     // Request not handable
     if ($bStatus === FALSE) {
         Event::RUN('mvc.invalidRequest');
     }
 }
 /**
  * Smarty usage: {sort_heading key="localization.key.name" sort="foo"}
  *
  * Custom Smarty function for creating heading links to sort tables by
  * @params $params array associative array
  * @params $smarty Smarty
  * @return string heading link to sort table by
  */
 function smartySortHeading($params, &$smarty)
 {
     if (isset($params) && !empty($params)) {
         $sortParams = Request::getQueryArray();
         isset($params['sort']) ? $sortParams['sort'] = $params['sort'] : null;
         $sortDirection = $smarty->get_template_vars('sortDirection');
         $sort = $smarty->get_template_vars('sort');
         // Invert sort direction
         if ($params['sort'] == $sort) {
             if ($sortDirection == SORT_DIRECTION_ASC) {
                 $sortParams['sortDirection'] = SORT_DIRECTION_DESC;
             } else {
                 $sortParams['sortDirection'] = SORT_DIRECTION_ASC;
             }
         } else {
             $sortParams['sortDirection'] = SORT_DIRECTION_ASC;
         }
         $link = PKPRequest::url(null, null, null, Request::getRequestedArgs(), $sortParams, null, true);
         $text = isset($params['key']) ? Locale::translate($params['key']) : '';
         $style = isset($sort) && isset($params['sort']) && $sort == $params['sort'] ? ' style="font-weight:bold"' : '';
         return "<a href=\"{$link}\"{$style}>{$text}</a>";
     }
 }