. */ 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 .= "
| Position | "; $ret .= "Vacant places | "; $ret .= "Candidates | "; $ret .= "Open/closed | "; $ret .= ""; $ret .= " | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ".$row['position']." | "; else $ret .= "".$row['position']." | "; $ret .= "".$row['places']." | "; if( ($candidates_intime[ $row['id'] ]['pending']+$candidates_late[ $row['id'] ]['pending'])>0 ) $ret .= "".($candidates_intime[ $row['id'] ]['yes']+$candidates_late[ $row['id'] ]['yes'])." (".($candidates_intime[ $row['id'] ]['pending']+$candidates_late[ $row['id'] ]['pending'])." pending) | "; else $ret .= "".($candidates_intime[ $row['id'] ]['yes']+$candidates_late[ $row['id'] ]['yes'])." | "; switch( candidate_status($row['id']) ) { case "open": $ret .= "open | "; if( is_after_in('CandidateStart') ) { if( ($setup['PromoteAnonymousApplication'] && $setup['AuthSystem']=="None") || (isset($_SESSION['access_user']) && $_SESSION['access_user']) ) { $ret .= "candidate now | "; }elseif( $setup['PromoteAnonymousApplication'] && $setup['AuthSystem']!="None" ) { $ret .= "candidate now "; $ret .= "with / "; $ret .= "without "; $ret .= $ldap->getSystemName()." account | "; }else { $ret .= "candidate now | "; } }else { $ret .= ""; } break; case "temporallyclosed": $ret .= " | closed temporally | "; $ret .= ""; $closedtemporally = true; break; case "closed": default: $ret .= " | closed | "; $ret .= ""; } $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 .= "| Name | "; $ret .= "Local | "; $ret .= "approved | "; $ret .= "Application date | "; $ret .= "||
|---|---|---|---|---|---|
| ".$row['FirstName']." ".$row['LastName']." | "; else $ret .= "".$row['FirstName']." ".$row['LastName']." | "; $ret .= "".$row['BodyName']." | "; if( $row['Approved']=="yes" ) $ret .= "![]() | ";
else
$ret .= "![]() | ";
$ret .= "".get_date($row['Created'])." | "; $ret .= "
Failed loading candidature. Viewing not possible.
"; }else { $values = mysql_fetch_array($res); $ret .= "Log in to see the full candidature.
"; } // Create user interface $ui = new CandidateUI(get_int('id')); // Create the classes, add a value from MySQL $person = array(); for( $i=0; $i