.
*/
include("./include/include.php");
include("./include/AjaxResponse.php");
include("./include/CandidatePage.php");
include("./include/g_body.php");
page_header(isset($_GET['ajax']));
if( !$setup['CandidateAdminOpen'] ) {
echoln("This page is disabled. Please come back later.");
}else {
if( isset($_GET['ajax']) ) {
$response = new AjaxResponse();
if( get_int("post")>0 && is_after('CandidatePublish') ) {
$query = "SELECT `position` FROM `candidatepost` WHERE `id`=".addslashes(get_int("post"));
if( @mysql_num_rows( $res=doquery($query) )==1 ) {
$row = mysql_fetch_assoc($res);
$position = $row['position'];
if( get_int("id")>0 ) {
// Show full candidature
$response->addRefresh("candidateDetail", CandidatePage::getCandidateFull(get_int("id"), $position));
$response->setScrollToTop("candidateDetail");
}else {
// Show candidates for this post
$response->addRefresh("candidates", CandidatePage::getCandidates(get_int("post"), $position)."
");
$response->setScrollToTop("candidates");
}
}
}
header("Content-type: text/xml; charset=utf-8");
echoln($response->createResponse());
}else {
echoln("Information about candidatures
");
echoln("On this page you can candidate for open positions, as well view the candidatures of other people. You can candidate from ".$setup['CandidateStart']." until ");
echoln($setup['CandidateDeadline'].". If after that time there are less candidates than places for a certain position, the deadline will be extended until the opening of the Agora (".$setup['CandidateEndReal'].") ");
echoln("for this certain position");
if( $setup['CloseWhenEnoughCandidates'] ) {
echoln(". ");
}else {
echoln(" and will not be closed in case the amount of places for that certain position is reached within the extended deadline. ");
}
echoln("Then, after ".$setup['CandidateEndReal'].", the online system will be closed. Candidatures are only accepted via the online system, and not by other means. From ".$setup['CandidatePublish']." you ");
echoln("can see the candidatures online. ");
if( $setup['CandidateShowPending'] ) {
echoln("Both approved and pending candidatures will be shown. Only for approved candidatures the details of the candidature will be visible.");
}else {
echoln("Only approved candidatures will be shown.");
}
if( isset($_REQUEST['candidate']) || ($_SERVER['REQUEST_METHOD']=="POST" && !isset($_REQUEST['login'])) ) {
########################
### Candidature form ###
########################
echoln("Candidate now
");
if( is_after('CandidateStart') AND is_before('CandidateEndReal') ) {
// We are in candidature period
if( isset($_SESSION['sess_name']) && stripos($_SESSION['sess_name'], "account" )!==false ) {
// Trying to candidate with master account
echoln("You cannot candidate a master account.");
echoln("
You cannot candidate when logged in with the master account of your local. Please use your personal ".$ldap->getSystemName()." account.");
}else {
if( $_SERVER['REQUEST_METHOD']=="POST" AND !isset($_REQUEST['login']) ) {
if( !isset($_SESSION['candidate_id']) ) {
// No session?!
echoln("Cannot retrieve information from the session. Are you blocking cookies? To use this website you must enable cookies in your browser.");
$candidate_id = -1;
}else {
$candidate_id = $_SESSION['candidate_id'];
}
}else {
$candidate_id = 0;
if( isset($_GET['id']) ) {
// Person is trying to edit
$query = "SELECT `id` FROM `candidates` WHERE `username`='".addslashes($_SESSION['sess_name'])."' AND `id`=".addslashes(get_int("id"));
if( @mysql_num_rows( doquery($query) )==1 ) {
$candidate_id = get_int("id");
}else {
echoln("You cannot edit the candidature of somebody else. A new candidature will be created for you now.");
}
}elseif( get_int('post')>0 && isset($_SESSION['sess_name']) ) {
$query = "SELECT `id` FROM `candidates` WHERE (`username`='".addslashes($_SESSION['sess_name'])."' AND `username`!='') AND `Position`=".get_int('post');
if( @mysql_num_rows( $res=doquery($query) )==1 ) {
$row = mysql_fetch_array($res);
$candidate_id = $row['id'];
echoln("You already candidated for this position. You cannot candidate twice. You'll now have the possibility to update your already existing candidature.");
}
}
$_SESSION['candidate_id'] = $candidate_id;
}
if( $candidate_id!=-1 ) {
$Position = get_int("post");
if( $candidate_id==0 AND $setup['AuthSystem']!="None" ) {
echoln("The prefilled fields are loaded from your ".$ldap->getSystemName()." account. If you want to update the data in your ".$ldap->getSystemName()." account, please go to ");
echoln("www.aegee.org/accounts/. If you want to use them here as well, log out here, ");
echoln("update your ".$ldap->getSystemName()." account and log in here again (it is important you log in ");
echoln("here after you have saved the changes to your ".$ldap->getSystemName()." account. Prefilling only works on new candidatures, not when editing an existing candidature).");
}
include("./include/candidate.php");
}
}
}else {
echoln("Candidatures are not open at the moment.");
echoln("
Sorry, at this moment candidating is not possible.");
}
}else {
########################
### Own candidatures ###
########################
echoln("Your candidatures
");
if( !isset($_SESSION['sess_uid']) || $_SESSION['sess_uid']==0 ) {
// Not logged in
echoln("You are not logged in. Please log in to see your candidatures. ");
if( is_after('CandidateStart') AND is_before('CandidateEndReal') ) {
echoln("To candidate, you are adviced to log in as well. ");
if( !$setup['PromoteAnonymousApplication'] ) {
echoln("To candidate without logging in, click here.");
}
}
}else {
// Logged in
$query = "SELECT `candidates`.`id` AS `id`, `candidatepost`.`position` AS `Position`, `candidates`.`Approved` AS `Approved`
FROM `candidatepost`, `candidates`
WHERE `candidatepost`.`id`=`candidates`.`Position` AND
(`candidates`.`username`='".addslashes($_SESSION['sess_name'])."' OR CONCAT(`candidates`.`FirstName`, ' ', `candidates`.`LastName`)='".addslashes($_SESSION['sess_name'])."')";
if( @mysql_num_rows( $res=doquery($query) )>0 ) {
// Already candidated for at least one position
echoln("You candidated for the following position(s):");
echoln("");
echoln(" ");
echoln(" | Position | ");
echoln(" Approved | ");
echoln(" | ");
echoln("
");
$i = 0;
while( $row = mysql_fetch_array($res) ) {
$i++;
if( ($i%2)==1 )
echoln(" ");
else
echoln("
");
echoln(" | ".$row['Position']." | ");
if( $row['Approved']=="no" )
echoln(" no (rejected) | ");
else
echoln(" ".$row['Approved']." | ");
echoln(" edit | ");
echoln("
");
}
echoln("
");
}else {
// Did not candidate yet
echoln("You did not candidate for a position yet.");
}
if( is_after('CandidateStart') AND is_before('CandidateEndReal') ) {
echoln("To candidate, click on the 'candidate now' link in the list below.
");
}
}
##############################
### Overview of candidates ###
##############################
$position = "";
echoln(CandidatePage::getPositions($position));
echoln("");
if( get_int("post")>0 && is_after('CandidatePublish') ) {
#####################################
### Show candidates for this post ###
#####################################
echoln(CandidatePage::getCandidates(get_int("post"), $position));
echoln("
");
if( get_int("id")>0 ) {
#############################
### Show full candidature ###
#############################
echoln(CandidatePage::getCandidateFull(get_int("id"), $position));
}
echoln("
");
}
echoln("
");
}
}
}
page_footer(isset($_GET['ajax']));
?>