. */ abstract class CandidatePage { public static function getPositions(&$position) { global $setup, $ldap; $ret = ""; $query = "SELECT `id`, `position`, `places`, `deadline` FROM `candidatepost` ORDER BY `position`"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { $query2 = "SELECT COUNT(`id`) AS `Num`, `Position`, `Approved` FROM `candidates` WHERE `Created`<='".addslashes(get_sql_date($setup['CandidateDeadline'])).":59' GROUP BY `Position`, `Approved`"; $candidates_intime = array(); if( @mysql_num_rows( $res2=doquery($query2) )>0 ) { while( $row2 = mysql_fetch_array($res2) ) { $candidates_intime[ $row2['Position'] ][ $row2['Approved'] ]=$row2['Num']; } } $query2 = "SELECT COUNT(`id`) AS `Num`, `Position`, `Approved` FROM `candidates` WHERE `Created`>'".addslashes(get_sql_date($setup['CandidateDeadline'])).":59' GROUP BY `Position`, `Approved`"; $candidates_late = array(); if( @mysql_num_rows( $res2=doquery($query2) )>0 ) { while( $row2 = mysql_fetch_array($res2) ) { $candidates_late[ $row2['Position'] ][ $row2['Approved'] ]=$row2['Num']; } } $ret .= "

Positions

"; if( !is_after('CandidateStart') ) { $ret .= "Candidating will possible from ".$setup['CandidateStart'].".

"; } $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $closedtemporally = false; $i=0; while( $row=mysql_fetch_array($res) ) { $i++; if( !isset($candidates_intime[ $row['id'] ]['yes']) ) $candidates_intime[ $row['id'] ]['yes'] = 0; if( !isset($candidates_intime[ $row['id'] ]['pending']) ) $candidates_intime[ $row['id'] ]['pending'] = 0; if( !isset($candidates_late[ $row['id'] ]['yes']) ) $candidates_late[ $row['id'] ]['yes'] = 0; if( !isset($candidates_late[ $row['id'] ]['pending']) ) $candidates_late[ $row['id'] ]['pending'] = 0; if( ($i%2)==1 ) $ret .= ""; else $ret .= ""; if( is_after('CandidatePublish') AND ( ($candidates_intime[ $row['id'] ]['yes']+$candidates_late[ $row['id'] ]['yes'])>0 OR ($setup['CandidateShowPending'] AND ($candidates_intime[ $row['id'] ]['pending']+$candidates_late[ $row['id'] ]['pending'])>0) ) ) $ret .= ""; else $ret .= ""; $ret .= ""; if( ($candidates_intime[ $row['id'] ]['pending']+$candidates_late[ $row['id'] ]['pending'])>0 ) $ret .= ""; else $ret .= ""; switch( candidate_status($row['id']) ) { case "open": $ret .= ""; if( is_after_in('CandidateStart') ) { if( ($setup['PromoteAnonymousApplication'] && $setup['AuthSystem']=="None") || (isset($_SESSION['access_user']) && $_SESSION['access_user']) ) { $ret .= ""; }elseif( $setup['PromoteAnonymousApplication'] && $setup['AuthSystem']!="None" ) { $ret .= ""; }else { $ret .= ""; } }else { $ret .= ""; } break; case "temporallyclosed": $ret .= ""; $ret .= ""; $closedtemporally = true; break; case "closed": default: $ret .= ""; $ret .= ""; } $ret .= ""; if( get_int("post")==$row['id'] ) { $position = $row['position']; } } $ret .= "
PositionVacant placesCandidatesOpen/closed 
".$row['position']."".$row['position']."".$row['places']."".($candidates_intime[ $row['id'] ]['yes']+$candidates_late[ $row['id'] ]['yes'])." (".($candidates_intime[ $row['id'] ]['pending']+$candidates_late[ $row['id'] ]['pending'])." pending)".($candidates_intime[ $row['id'] ]['yes']+$candidates_late[ $row['id'] ]['yes'])."opencandidate nowcandidate now "; $ret .= "with / "; $ret .= "without "; $ret .= $ldap->getSystemName()." accountcandidate now closed temporally closed 
"; if( $closedtemporally ) { $ret .= "

'Closed temporally' means that at the deadline there were not enough approved candidates yet for this position. If the pending candidatures will be approved, this list "; $ret .= "will be closed. If not all pending candidatures will be approved, this list will be re-opened. Please check in some days again.

"; } }else { $ret .= "There is no positions for candidates available."; } return $ret; } public static function getCandidates($positionId, $position) { global $setup; $ret = ""; $query = "SELECT `id`, `FirstName`, `LastName`, `BodyCode`, `Approved`, `Created`, `BodyName` "; $query .= "FROM `candidates` "; $query .= "LEFT JOIN `ab_bodies` USING (`BodyCode`) "; $query .= "WHERE `Position`=".addslashes($positionId)." AND "; if( $setup['CandidateShowPending'] ) { $query .= "(`Approved`='yes' OR `Approved`='pending') "; }else { $query .= "(`Approved`='yes') "; } $query .= "ORDER BY `FirstName`, `LastName`"; $ret .= "

Candidates for '".$position."'

"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $i=0; while( $row=mysql_fetch_array($res) ) { $i++; if( ($i%2)==1 ) $ret .= ""; else $ret .= ""; if( $row['Approved']=="pending" ) $ret .= ""; else $ret .= ""; $ret .= ""; if( $row['Approved']=="yes" ) $ret .= ""; else $ret .= ""; $ret .= ""; $ret .= ""; } $ret .= "
NameLocalapprovedApplication date
".$row['FirstName']." ".$row['LastName']."".$row['FirstName']." ".$row['LastName']."".$row['BodyName']."\"Approved\"\"Pending\"".get_date($row['Created'])."
"; }else { $ret .= "There is no candidates for this position."; } return $ret; } public static function getCandidateFull($id, $position) { include("./include/Cand.php"); include("./include/CandidateUI.php"); $ret = ""; // Read the files from ./include/CandFields/*.php and add them to $fields; $fields = array(); $sepfields = array(); // All fields including separators $dir = dirname($_SERVER["SCRIPT_FILENAME"])."/include/CandFields/*.php"; if( is_dir(dirname($dir)) ) { foreach( glob($dir) as $file ) { if( is_file($file) ) { if( substr(basename($file, ".php"), 3)!="Separator" ) { include("./include/CandFields/".basename($file)); $fields[] = substr(basename($file, ".php"), 3); } $sepfields[] = substr(basename($file, ".php"), 3); } } }else { debug(dirname($dir)." does not exist, failed loading application form fields"); } // Load the values from MySQL $values = array(); $query="SELECT * FROM `candidates` WHERE `id`=".addslashes(get_int('id'))." AND `approved`='yes' AND `position`=".addslashes(get_int("post")); if( @mysql_num_rows( $res=doquery($query) )!=1 ) { $ret .= "

Failed loading candidature. Viewing not possible.

"; }else { $values = mysql_fetch_array($res); $ret .= "

Candidature of '".$values['firstname']." ".$values['lastname']."' for '".$position."'

"; if( !(isset($_SESSION['access_user']) && $_SESSION['access_user']) ) { $ret .= "

Log in to see the full candidature.

"; } // Create user interface $ui = new CandidateUI(get_int('id'), get_int("post")); // Create the classes, add a value from MySQL $person = array(); for( $i=0; $iinit($values[ strtolower($fields[$i]) ]); } ### Show form ### $ret .= $ui->Open(); $ret .= $ui->Add("Created", get_date($values['created']), false, true); $ret .= $ui->Add("Modified", get_date($values['modified']), false, true); $ret .= $ui->Add("Approved", $values['approved'], false, true); $ret .= $ui->Separator(); for( $i=0; $iSeparator(); }else { if( $person[ $sepfields[$i] ]->get_accesspublic() ) { // Show field $ret .= $ui->Add( $person[ $sepfields[$i] ]->get_print_name(), nl2br($person[ $sepfields[$i] ]->getpublic()), false, true); } } } $ret .= $ui->Close(); } return $ret; } } ?>