public function testPathWithDefault()
 {
     $_SERVER['SCRIPT_NAME'] = '/default/index.php';
     $this->Dispatcher = Dispatcher::getInstance();
     $this->Dispatcher->setUrl('mycontroller/myaction/p1/1/p2/2/p3/3');
     $this->assertEqual(UrlComponent::path('default/index'), '/default/index');
 }
Exemple #2
0
 public function __construct($message, $code = 0)
 {
     if (ini_get('display_errors') == 1) {
         return parent::__construct($message, $code);
     }
     switch ($code) {
         case 404:
             header('location:' . UrlComponent::path('/pages/page404/'));
             break;
         case 403:
             header('location:' . UrlComponent::path('/pages/page403/'));
             break;
         default:
             header('location:' . UrlComponent::path('/pages/page500/'));
     }
     exit;
 }
					<?php 
echo FormHelper::text('href', '', array('size' => '100'));
?>
<br />
					<?php 
echo FormHelper::checkbox('target', '_blank', '_blank');
?>
 Ouvrir dans une nouvelle fenêtre
				</div>
				</fieldset>	
				
				<div>
					<input class="button" type="submit" value="Insérer dans l'éditeur"> 
					ou
					<a class="cancel" href="<?php 
echo UrlComponent::path(array('action' => 'insertionIndex'));
?>
">Annuler</a> 
				</div>
			</form>
		
  	</div><!-- #main -->
</div><!-- #content -->

<script src="/admin/js/tinymce/tiny_mce_popup.js"></script>
<script>
//	try {
	$(function() {
		$('form').submit(function() {
			var name		= $('#name').val(),
				path		= $('#path').val(),
 public function redirect($path = null, $code = null)
 {
     switch ($code) {
         case 301:
             $message = '301 Moved Permanently';
             break;
         case 404:
             $message = '404 Not Found';
             $altpath = '/pages/page404/';
             break;
         case 403:
             $message = '403 Forbidden';
             $altpath = '/pages/page403/';
             break;
         case 500:
             $message = '500 Internal Server Error';
             $altpath = '/pages/page500/';
             break;
         case 503:
             $message = '503 Service Unavailable';
             $altpath = '/pages/page503/';
             break;
     }
     $this->View->setAutorender(false);
     if (isset($message)) {
         //				header($_SERVER['SERVER_PROTOCOL'].' '.$message);
         //				header('Status: '.$message);
     }
     if (isset($altpath) && !$path) {
         $path = $altpath;
     }
     header('location:' . UrlComponent::path($path));
     exit;
 }
 public function testUrlTranslation()
 {
     $url = UrlComponent::path('/app/controller/action/param/value');
     $this->assertEqual($url, '/application/controlleur/action/param/value');
 }