<?
User::a()->noLogin();
Jobs::a(User::a()->user)->searchJob('Перейти','Заводы',1);
if(isset(Module::a()->url[2])){
if(abs(intval(Module::a()->url[1]))==0)die(header("Location:/cities/"));
switch(Module::a()->url[2]){
case 'get':
$info = Plants::a(User::a()->user)->get(Module::a()->url[1]);
$_SESSION['info'] = $info['message'];
die(header("Location:/plants/"));
break;
case 'hasten':
$info = Plants::a(User::a()->user)->hasten(Module::a()->url[1]);
$_SESSION['info'] = $info['message'];
die(header("Location:/plants/"));
break;
default:
die(header("Location:/cities/"));
break;
}
}
$data = Plants::a(User::a()->user)->getAll();
$title = '<a href="/cities/"><img width="20" style="padding-right:3px" src="/img/flags/small/'.User::a()->user['country'].'.png">'.Country::a(User::a()->user)->data[User::a()->user['country']];
$title .= '</a>/Заводы<span style="float:right"><a href="/plants/?ref='.time().'"><img style="padding-right:5px" width="24" src="/img/icons/refresh.png"/></a></span>';
Template::a()->setTitle('Заводы',$title);
Template::a()->set('data',$data);
Template::a()->display('plants/index');
?>