Example #1
0
 /**
  * Method used to redirect client to page with particular arguments.
  *
  * @access   public
  * @param    array $aArgs
  * @sicne    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function redirectTo(array $aArgs = [])
 {
     Router::relocate($this->url($aArgs));
 }
Example #2
0
 /**
  * Relocate to another page and show alert message.
  *
  * Type of messages:
  * - success
  * - info
  * - warning
  * - danger
  *
  * @static
  * @access   public
  * @param    string $location URL
  * @param    string $content  message content
  * @param    string $type     message type
  * @throws   Exception
  * @throws   Exception\Fatal
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public static function flash($location, $content, $type = 'success')
 {
     if (!in_array($type, ['success', 'info', 'warning', 'danger'])) {
         throw new Exception\Fatal('Unknown type of flash message ("' . $type . '").');
     }
     self::set("flash", serialize(["content" => $content, "type" => $type]));
     self::$blockFlashRemoval = FALSE;
     if (strpos($location, 'http://') === FALSE) {
         $base = '';
     } else {
         $base = Config::get('routing.base_url');
     }
     Router::relocate($base . $location);
 }