<?php namespace Config;

// Create a new instance of our RouteCollection class.
$routes = Services::routes();

// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
{
    require SYSTEMPATH . 'Config/Routes.php';
}

/**
 * --------------------------------------------------------------------
 * Router Setup
 * --------------------------------------------------------------------
 */
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

/**
 * --------------------------------------------------------------------
 * Route Definitions
 * --------------------------------------------------------------------
 */



// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Home::index');
$routes->get('ajaxSearch', 'Home::ajaxSearch');
$routes->get('pages', 'Pages::create');
$routes->get('contact-us', 'SendMail::index');
$routes->get('/about-us', 'Home::about_us');
$routes->get('/news', 'Home::news');
$routes->get('/news/(:num)', 'Home::newItem/$1');
$routes->get('/addnews', 'Home::addNews');
$routes->post('/addnews', 'Home::addNews');
$routes->get('/updatenews/(:num)', 'Home::editNews/$1');
$routes->post('/updatenews', 'Home::updateNews');
$routes->get('/adduser', 'Home::addUser');
$routes->get('/users', 'Home::users');
$routes->post('/adduser', 'Home::addUserDetails');
$routes->get('/updateuser/(:num)', 'Home::updateUser/$1');
$routes->post('/updateuser', 'Home::updateUserDetails');
$routes->get('/admin', 'Home::login');
$routes->post('/login', 'Home::login');
$routes->get('/portal', 'Home::adminPortal');
$routes->get('/logout', 'Home::logout');
$routes->get('/addcourse', 'Home::addCourse');
$routes->post('/addcourse', 'Home::storeCourse');
$routes->get('/updatecourse/(:num)', 'Home::editCourse/$1');
$routes->post('/updatecourse', 'Home::updateCourse');
$routes->get('/schedules', 'Home::viewSchedules');
$routes->post('/schedules', 'Home::viewSchedules');
$routes->get('/addschedule', 'Home::addSchedule');
$routes->post('/addschedule', 'Home::storeSchedule');
$routes->get('/updateschedule/(:num)', 'Home::updateSchedule/$1');
$routes->post('/updateschedule', 'Home::updateScheduleDetails');
$routes->get('/allcourses', 'Home::viewCourses');
$routes->get('/deletecourse/(:num)', 'Home::deletecourse/$1');
$routes->get('/deletestudent/(:num)', 'Home::deletestudent/$1');
$routes->get('/deleteschedule/(:num)', 'Home::deleteschedule/$1');
$routes->get('/category/(:num)', 'Home::viewCatCourses/$1');
$routes->get('/(:num)', 'Home::viewCatCourses/$1');
$routes->get('/course/(:num)', 'Home::viewCourse/$1');
$routes->get('courses/(:num)', 'Home::CourseView/$1'); 
$routes->get('/course', 'Home::viewCourse/$1');
$routes->get('/trainers', 'Home::viewTrainers');
$routes->get('/students', 'Home::viewStudents');
$routes->post('/students', 'Home::viewStudents');
$routes->get('/student/(:num)', 'Home::viewStudent/$1');
$routes->get('/studentsearch', 'Home::searchStudent');
$routes->post('/studentsearch', 'Home::searchStudent');
$routes->get('/trainersearch', 'Home::searchTrainer');
$routes->post('/trainersearch', 'Home::searchTrainer');
$routes->get('/trainer/(:num)', 'Home::viewTrainer/$1');
$routes->get('/applytrainer', 'Home::registerTrainer');
$routes->post('/applytrainer', 'Home::applyTrainer');
$routes->get('/applycourse/(:num)', 'Home::registerStudent/$1');
$routes->get('/applyonline/(:num)', 'Home::onlineStudent/$1');
$routes->post('/applycourse/', 'Home::registerStudentDetails');
$routes->post('/applyonline/', 'Home::onlineStudentDetails');
$routes->get('/applicants', 'Home::viewApplicants');
$routes->get('/', 'SendMail::index');

/**
 * --------------------------------------------------------------------
 * Additional Routing
 * --------------------------------------------------------------------
 *
 * There will often be times that you need additional routing and you
 * need to it be able to override any defaults in this file. Environment
 * based routes is one such time. require() additional route files here
 * to make that happen.
 *
 * You will have access to the $routes object within that file without
 * needing to reload it.
 */
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
{
    require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}
