<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different URLs to chosen controllers and their actions (functions).
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
	Router::connect('/', array('controller' => 'home', 'action' => 'home'));
	Router::connect('/login', array('controller' => 'home', 'action' => 'login'));
	Router::connect('/logout', array('controller' => 'home', 'action' => 'logout'));
	Router::connect('/impressum', array('controller' => 'home', 'action' => 'impressum'));
	Router::connect('/agb', array('controller' => 'home', 'action' => 'agb'));
        
	Router::connect('/contact', array('controller' => 'extra', 'action' => 'contact'));
	Router::connect('/cooperators', array('controller' => 'extra', 'action' => 'cooperators'));
  Router::connect('/team', array('controller' => 'extra', 'action' => 'team'));
  Router::connect('/premium', array('controller' => 'extra', 'action' => 'premium'));
  Router::connect('/advertise', array('controller' => 'extra', 'action' => 'advertise'));
  Router::connect('/adv/company', array('controller' => 'extra', 'action' => 'company'));
  Router::connect('/adv/worker', array('controller' => 'extra', 'action' => 'worker'));
            
	Router::connect('/plus', array('controller' => 'service', 'action' => 'index'));
  Router::connect('/plus/:list', array('controller' => 'service','action'=>'index'),array("list"=>"[a-z0-9]+"));
  Router::connect('/plus/show/:item', array('controller' => 'service','action'=>'show'),array("item"=>"[a-z0-9]+"));
  Router::connect('/plus/:list/:item', array('controller' => 'service','action'=>'show'),array("list"=>"[a-z0-9]+","item"=>"[a-z0-9]+"));
	
	Router::connect('/company', array('controller' => 'home', 'action' => 'company'));
	
  Router::connect('/company/registration', array('controller' => 'registration', 'action' => 'company'));
        
	Router::connect('/registration', array('controller' => 'registration', 'action' => 'worker'));
	Router::connect('/registration/active/:code', array('controller' => 'registration', 'action' => 'active'),array("code" => ".+"));
	
  Router::connect('/password/reset', array('controller' => 'registration', 'action' => 'password_reset'));
  Router::connect('/password/replace/:code', array('controller' => 'registration', 'action' => 'password_replace'),array("code" => ".+"));
        
	Router::connect('/profil', array('controller' => 'user', 'action' => 'profil'));
	Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+"));
	Router::connect('/profil/edit', array('controller' => 'user', 'action' => 'profil_edit'));
	Router::connect('/settings', array('controller' => 'user', 'action' => 'settings_account'));
	Router::connect('/settings/pages', array('controller' => 'user', 'action' => 'settings_pageInh'));
	Router::connect('/settings/pages/:page', array('controller' => 'user', 'action' => 'settings_pageInh'),array("page" => "[0-9]+"));
	Router::connect('/settings/isearch', array('controller' => 'user', 'action' => 'settings_isearch'));
	Router::connect('/settings/delete', array('controller' => 'user', 'action' => 'profil_delete'));
	Router::connect('/settings/img', array('controller' => 'user', 'action' => 'avatar_upload'));
	
	
	
	Router::connect('/user/:id', array('controller' => 'user', 'action' => 'profil'),array("id" => "[0-9]+"));
	Router::connect('/user/:id/page/:page', array('controller' => 'user', 'action' => 'profil'),array("id" => "[0-9]+","page" => "[0-9]+"));
	
	Router::connect('/opening', array('controller' => 'job', 'action' => 'openingList'));
	Router::connect('/opening/add', array('controller' => 'job', 'action' => 'openingAdd'));
	Router::connect('/opening/edit/:id', array('controller' => 'job', 'action' => 'openingEdit'),array("id" => "[0-9]+"));
	Router::connect('/opening/:id', array('controller' => 'job', 'action' => 'openingGet'),array("id" => "[0-9]+"));
	Router::connect('/opening/:id/application', array('controller' => 'job', 'action' => 'applicationByOpening'),array("id" => "[0-9]+"));
	Router::connect('/opening/:id/:extra', array('controller' => 'job', 'action' => 'openingGet'), array("id" => "[0-9]+"));
	
	Router::connect('/application', array('controller' => 'job', 'action' => 'applicationList'));
	Router::connect('/application/:id', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+"));
		
	Router::connect('/application/:id/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+"));
	Router::connect('/application/:id/curriculum:vitea', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'vitea' => '(?i:vitea)'));
	Router::connect('/application/:id/mess:ages', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'ages' => '(?i:ages)'));
	Router::connect('/application/:id/arc:hiv', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'hiv' => '(?i:hiv)'));
	
	Router::connect('/applicate/:id', array('controller' => 'job', 'action' => 'applicationSend'),array("id" => "[0-9]+"));
	Router::connect('/applicate/extern', array('controller' => 'job', 'action' => 'applicationSendExt'));
	Router::connect('/applicate/extern/info', array('controller' => 'job', 'action' => 'applicationSendExtInfo'));
	
	Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite'));
	
	//Router::connect('/search', array('controller' => 'search', 'action' => 'listopening'));
	Router::connect('/search', array('controller' => 'search', 'action' => 'opening'));
	Router::connect('/search/company', array('controller' => 'search', 'action' => 'company'));
	Router::connect('/search/worker', array('controller' => 'search', 'action' => 'worker'));
	Router::connect('/search/auto', array('controller' => 'search', 'action' => 'auto'));
	Router::connect('/search/education', array('controller' => 'search', 'action' => 'education'));
	Router::connect('/search/academy', array('controller' => 'search', 'action' => 'academy'));
	Router::connect('/search/internship', array('controller' => 'search', 'action' => 'internship'));
	
	/*****
	 *  Extern
	 *
	 */
	Router::connect('/extern/button/company/:id', array('controller' => 'extern', 'action' => 'button_company'),array("id" => "[0-9]+"));
	Router::connect('/extern/button/opening/extern', array('controller' => 'extern', 'action' => 'button_opening_extern'),array("id" => "[0-9]+"));
	Router::connect('/extern/button/opening/:id', array('controller' => 'extern', 'action' => 'button_opening'),array("id" => "[0-9]+"));
	
	
	Router::parseExtensions('pdf');
	Router::connect('/application/:id.pdf', array('controller' => 'pdf', 'action' => 'applicationGetPdf'),array("id" => "[0-9]+"));
	Router::connect('/profil.pdf', array('controller' => 'pdf', 'action' => 'profilGetPdf'));
	
	Router::parseExtensions('json');
	Router::connect('/profil/save/cv', array('controller' => 'user', 'action' => 'saveCvJson'));
	Router::connect('/settings/pages/delete', array('controller' => 'user', 'action' => 'savePageDeleteJson'));
	Router::connect('/settings/pages/order', array('controller' => 'user', 'action' => 'savePageOrder'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
//Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
//	CakePlugin::routes();

/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
//	require CAKE . 'Config' . DS . 'routes.php';