Commit 9b354868 authored by katka's avatar katka
Browse files

wt

parent 902c7918
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admin extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model ('pridanie_model');
$this->load->model ('admin_model');
$this->load->helper ('url');
}
function index()
{
if (!is_admin()) redirect('login');
$check1 ='NO';
$check2 ='YES';
$data['no'] = $this->admin_model->get_no($check1);
$data['yes'] = $this->admin_model->get_yes($check2);
$this->load->view('admin_view', $data);
}
function delete($id)
{
$this->pridanie_model->deleteVlastne($id);
set_flash_data('success', 'Dopravná situácia bola úspešne zmazaná.');
redirect('admin');
}
function check($id)
{
$check = 'YES';
$data = array
(
'check' => $check,
);
$this->pridanie_model->checkVlastne($data, $id);
set_flash_data('success', 'Dopravná situácia bola úspešne potvrdená.');
redirect('admin');
}
}
\ No newline at end of file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Auth extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->library ('googlemaps');
$this->load->helper (array('form', 'url'));
$this->load->library (array('form_validation', 'security', 'tank_auth'));
$this->lang->load ('tank_auth');
}
/**
* Login user on the site
*/
function login()
{
if (logged_in()) redirect('start');
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['disableDefaultUI'] = TRUE;
$config['disableMapTypeControl'] = TRUE;
$config['center'] = 'auto';
$config['zoom'] = '15';
$config['scrollwheel'] = FALSE;
$config['map_height'] = '550';
$config['onboundschanged'] = 'if (!centreGot){
var mapCentre = map.getCenter();
marker_0.setOptions({
position: new google.maps.LatLng(mapCentre.lat(), mapCentre.lng())
});}
centreGot = true;';
$this->googlemaps->initialize($config);
$marker = array();
$marker['icon'] = '/icon/person.png';
$marker['infowindow_content'] = '<div id="osoba"><a>Ahoj, práve sa nachádzaš tu.</a></div>';
$this->googlemaps->add_marker($marker);
$this->form_validation->set_rules('login', 'Login', 'trim|required|xss_clean')
->set_rules('password', 'Password', 'trim|required|xss_clean');
if ($this->form_validation->run())
{
$login = $this->form_validation->set_value('login');
$password = $this->form_validation->set_value('password');
if ($this->tank_auth->login($login, $password, 1, 0, 1))
{
set_flash_data('success', 'Vitajte na stránke.');
redirect('start/index');
}
else
{
set_flash_data('error', 'Nesprávne prihlasovacie meno alebo heslo, skúsťe to znova.');
redirect('login/index');
}
}
$data['map'] = $this->googlemaps->create_map();
$this->load->view('login_view', $data);
}
/**
* Logout user
*/
function logout()
{
$this->tank_auth->logout();
redirect('login');
}
/**
* Register user on the site
*/
function register()
{
if (logged_in()) redirect('');
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['disableDefaultUI'] = TRUE;
$config['disableMapTypeControl'] = TRUE;
$config['center'] = 'auto';
$config['zoom'] = '15';
$config['scrollwheel'] = FALSE;
$config['map_height'] = '550';
$config['onboundschanged'] = 'if (!centreGot){
var mapCentre = map.getCenter();
marker_0.setOptions({
position: new google.maps.LatLng(mapCentre.lat(), mapCentre.lng())
});}
centreGot = true;';
$this->googlemaps->initialize($config);
$marker = array();
$marker['icon'] = '/icon/person.png';
$marker['infowindow_content'] = '<div id="osoba"><a>Ahoj, práve sa nachádzaš tu.</a></div>';
$this->googlemaps->add_marker($marker);
$this->form_validation->set_rules('meno', 'Meno', 'trim|required|xss_clean')
->set_rules('priezvisko', 'Priezvisko', 'trim|required|xss_clean')
->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email|unique[users.email]')
->set_rules('password', 'Heslo', 'trim|required|xss_clean|min_length['.$this->config->item('password_min_length', 'tank_auth').']|max_length['.$this->config->item('password_max_length', 'tank_auth').']|alpha_dash')
->set_rules('password2', 'Potvrď heslo', 'trim|required|xss_clean|matches[password]')
->set_error_delimiters('<p class="validation_error">', '</p>');
$data = array();
if ($this->form_validation->run())
{
$username = '';
$email = $this->form_validation->set_value('email');
$password = $this->form_validation->set_value('password');
$activation = 0;
$data = $this->tank_auth->create_user($username, $email, $password, $activation);
if (!is_null($data))
{
$profile_data = array(
'meno' => $this->form_validation->set_value('meno'),
'priezvisko' => $this->form_validation->set_value('priezvisko'),
'avatar_25' => "/images/monkey30.png",
'avatar_75' => "/images/monkey300.png",
);
$this->tank_auth->update_profile($profile_data, $data['user_id']);
if ($this->tank_auth->login($email, $password, 1, 0, 1))
{
set_flash_data('success', 'Dakujeme za registráciu.');
redirect('start/index');
}
else
{
// chyba
}
}
// chyba
}
$data['map'] = $this->googlemaps->create_map();
$this->load->view('register_view', $data);
}
}
/* End of file auth.php */
/* Location: ./application/controllers/auth.php */
\ No newline at end of file
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Doprava extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library ('googlemaps');
$this->load->model ('mapa_model');
$this->load->helper ('url');
}
function hliadka()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_hliadka();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/hliadka.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/hliadka/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Dopravná hliadka';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Dopravná hliadka.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_hliadka();
$this->load->view('doprava_view', $data);
}
function nehoda()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_nehoda();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/nehoda.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/nehoda/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Dopravná nehoda';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Dopravná nehoda.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_nehoda();
$this->load->view('doprava_view', $data);
}
function kolona()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_kolona();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/kolona.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/kolona/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Dopravná kolóna';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Dopravná kolóna.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_kolona();
$this->load->view('doprava_view', $data);
}
function staciradar()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_staciradar();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/staciradar.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/staciradar/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Dopravný stacionárny radar';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Dopravný stacionárny radar.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_staciradar();
$this->load->view('doprava_view', $data);
}
function mobilradar()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_mobilradar();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/mobilradar.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/mobilradar/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Dopravný mobilný radar';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Dopravný mobilný radar.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_mobilradar();
$this->load->view('doprava_view', $data);
}
function pracacesta()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_pracacesta();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/pracacesta.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/pracacesta/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Práca na ceste';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Práca na ceste.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_pracacesta();
$this->load->view('doprava_view', $data);
}
function uzavrcesta()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_uzavrcesta();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/uzavrcesta.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/uzavrcesta/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Uzavretá cesta';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Uzavretá cesta.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_uzavrcesta();
$this->load->view('doprava_view', $data);
}
function zver()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_zver();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/zver.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/zver/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Pozor prebieha divá zver';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/Pozor prebieha divá zver.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/vlastne/'.$obj->id.'">'.$obj->nazov.'</a><img src="'.$obj->buble.'"><p>Čas pridania : '.$obj->time.'</p><p>Zdrzanie : '.$obj->duration.' min.</p><p>Označenie cesty : '.$obj->typ.'</p><p>Popis : '.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$datamap['map'] = $this->googlemaps->create_map();
$this->load->view('pohladmapa_view', $datamap);
$data['sel1'] = $this->mapa_model->get_vlastne($nazov, $check);
$data['sel2'] = $this->mapa_model->get_zver();
$this->load->view('doprava_view', $data);
}
function dobytok()
{
if (!logged_in()) redirect('login');
$check ='YES';
$config = array();
$config['minifyJS'] = TRUE;
$config['backgroundColor'] = '#EBEBE0';
$config['center'] ='slovenska republika';
$config['zoom'] = '8';
$config['minzoom'] = '8';
$config['map_height'] = '550';
$this->googlemaps->initialize($config);
$sel = $this->mapa_model->get_dobytok();
foreach ($sel as $obj){
$marker = array();
$marker['position'] = $obj->lat.','.$obj->lng;
$marker['icon'] = '/icon/dobytok.png';
$marker['infowindow_content'] = '<div id="buble"><a href="/pohlad/dobytok/'.$obj->id.'">'.$obj->nazov.'</a><br><p>'.$obj->time.'</p><img src="'.$obj->buble.'"><p>'.$obj->popis.'</p></div>';
$this->googlemaps->add_marker($marker);
}
$nazov ='Pozor prechádza dobytok';
$sel = $this->mapa_model->get_vlastne($nazov, $check);
foreach ($sel as $obj){
$marker = array();