. */ include("./include/include.php"); include("./include/Cand.php"); include("./include/CandidateUI.php"); require_once("./include/Popup.php"); define("POPUP_HEIGHT", 600); define("POPUP_WIDTH", 550); define("POPUP_TOP", 50); define("POPUP_TITLE", "View all candidate data"); if( !in_array("candidate_viewdetail", $_SESSION['sess_functions']) ) { $popup = new Popup(POPUP_TITLE, "You are not authorized to see this page."); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH)->setTop(POPUP_TOP); echo $popup->createPopup(); }else { $content = ""; // 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 in case we are editing $values = array(); $query="SELECT * FROM `candidates` WHERE `id`=".addslashes(get_int('id')); if( @mysql_num_rows( $res=doquery($query) )==1 ) { $values = mysql_fetch_array($res); }else { $content .= "

Failed loading candidature. Editing not possible.

"; } // Create user interface $ui = new CandidateUI(get_int('id')); // Create the classes, add a value from MySQL $person = array(); for( $i=0; $iinit($values[ $fields[$i] ]); } } ### Show form ### $content .= $ui->Open(); $content .= $ui->Add("Created", get_date($values['Created'])); $content .= $ui->Add("Modified", get_date($values['Modified'])); $content .= $ui->Add("Account", $values['username']); $content .= $ui->Add("Approved", $values['Approved']); $content .= $ui->Separator(); for( $i=0; $iSeparator(); }else { if( $person[ $sepfields[$i] ]->get_access( false )!=Cand::ACCESS_NO ) { // Show field $content .= $ui->Add( $person[ $sepfields[$i] ]->get_print_name(), $person[ $sepfields[$i] ]->get(), false, $person[ $sepfields[$i] ]->get_compulsory()); } } } $content .= $ui->Close(); $content .= "Close window"; $popup = new Popup(POPUP_TITLE, $content); $popup->setHeight(POPUP_HEIGHT)->setWidth(POPUP_WIDTH)->setTop(POPUP_TOP); echo $popup->createPopup(); } ?>