Resolved warning and issues for Fair administration except print/expoert reports and print award ceremony script

This commit is contained in:
Armanveer Gill 2024-12-31 19:12:42 -05:00
parent c0cf9df126
commit 36996267e0
17 changed files with 87 additions and 74 deletions

View File

@ -29,7 +29,7 @@
switch($_GET['action']) {
switch(get_value_from_array($_GET, 'action')) {
case 'check':
$fairs_id = intval($_GET['fairs_id']);

View File

@ -295,7 +295,7 @@ function load_server_cats_divs($fairs_id)
return array($data['categories'], $data['divisions'], $catmap, $divmap);
}
switch($_GET['action']) {
switch(get_value_from_array($_GET, 'action')) {
case 'award_upload':
$award_awards_id = intval($_POST['award_awards_id']);
$fairs_id = intval($_POST['fairs_id']);
@ -709,7 +709,7 @@ $q = $pdo->prepare("SELECT fairs.id, fairs.name, fairs.type, COUNT(award_awards.
GROUP BY fairs.id
ORDER BY fairs.name ");
$q->execute();
echo $q->errorInfo();
show_pdo_errors_if_any($pdo);
?>
<h4><?=i18n('Upload all winners to a source')?>:</h4>
@ -753,7 +753,7 @@ $q = $pdo->prepare("SELECT award_awards.id, award_awards.name AS awardname,
AND award_awards.year='{$config['FAIRYEAR']}'
ORDER BY fairs.name, award_awards.name");
$q->execute();
echo $pdo->errorInfo();
show_pdo_errors_if_any($pdo);
?>
<h4><?=i18n('Upload individual winners to a source')?>:</h4>

View File

@ -26,7 +26,7 @@
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
if($_GET['action']=="status") {
if(get_value_from_array($_GET, 'action')=="status") {
$q = $pdo->prepare("SELECT * FROM emailqueue WHERE finished IS NULL");
$q->execute();

View File

@ -102,7 +102,7 @@
if($action == 'sendstats') {
foreach(array_keys($stats_data) as $k) {
$stats[$k] = $_POST[$k];
$stats[$k] = get_value_from_array($_POST, $k);
}
$stats['year'] = $year;
if($fair['type'] == 'ysc') {

View File

@ -42,9 +42,9 @@
if($val==1)
{
$numchanged++;
$webfirst=$_POST['webfirst'][$id]=="yes"?"yes":"no";
$weblast=$_POST['weblast'][$id]=="yes"?"yes":"no";
$webphoto=$_POST['webphoto'][$id]=="yes"?"yes":"no";
$webfirst=get_value_from_2d_array($_POST,'webfirst', $id)=="yes"?"yes":"no";
$weblast=get_value_from_2d_array($_POST, 'weblast', $id)=="yes"?"yes":"no";
$webphoto=get_value_from_2d_array($_POST, 'webphoto', $id)=="yes"?"yes":"no";
$stmt = $pdo->prepare("UPDATE students SET
webfirst='$webfirst',
weblast='$weblast',

View File

@ -340,6 +340,7 @@ foreach($report_stock as $n=>$v) {
global $report_volunteers_fields, $report_fairs_fields;
global $report_tours_fields, $report_fundraisings_fields;
global $pdo;
$fieldvar = "report_{$report['type']}s_fields";
$allow_fields = array_keys($$fieldvar);
@ -360,26 +361,27 @@ foreach($report_stock as $n=>$v) {
/* field, value, x, y, w, h, lines, face, align, valign, fn, fs, fsize, overflow */
$vals = "'".$k."','".$v."','0','0','0','0','0','','','','','','0','truncate'";
} else {
if($v['lines'] == 0) $v['lines'] =1;
$fs = is_array($v['fontstyle']) ? implode(',',$v['fontstyle']) : '';
$opts = "{$v['align']} {$v['valign']}";
$vals = "'{$v['field']}','".$v['value']."',
'{$v['x']}','{$v['y']}','{$v['w']}',
'{$v['h']}','{$v['lines']}','{$v['face']}',
'$opts','{$v['valign']}',
'{$v['fontname']}','$fs','{$v['fontsize']}',
'{$v['on_overflow']}'";
if(get_value_from_array($v, 'lines') == 0) $v['lines'] =1;
$fs = is_array(get_value_from_array($v,'fontstyle')) ? implode(',',$v['fontstyle']) : '';
$opts = "{".get_value_from_array($v,'align')."} {". get_value_from_array($v, 'valign') ."}";
$vals = "'{'".get_value_from_array($v, 'field')."'}','".get_value_from_array($v, 'value')."',
'{".get_value_from_array($v, 'x')."}','{".get_value_from_array($v,'y')."}','{".get_value_from_array($v, 'w')."}',
'{".get_value_from_array($v, 'h')."}','{".get_value_from_array($v, 'lines')."}','{".get_value_from_array($v,'face')."}',
'$opts','{".get_value_from_array($v,'valign')."}',
'{".get_value_from_array($v, 'fontname')."}','$fs','{".get_value_from_array($v, 'fontsize')."}',
'{".get_value_from_array($v, 'on_overflow')."}'";
}
if($q != '') $q .= ',';
$q .= "({$report['id']}, '$type','$x',$vals)";
$x++;
}
echo $q;
$stmt = $pdo->prepare("INSERT INTO reports_items(`reports_id`,`type`,`ord`,
`field`,`value`,`x`, `y`, `w`, `h`,
`lines`, `face`, `align`,`valign`,
`fontname`,`fontstyle`,`fontsize`,`on_overflow`)
VALUES $q;");
VALUES $q");
$stmt->execute();
echo $pdo->erroInfo();
@ -473,7 +475,7 @@ foreach($report_stock as $n=>$v) {
}
function report_save($report)
{
{ global $pdo;
if($report['id'] == 0) {
/* New report */
$stmt = $pdo->prepare("INSERT INTO reports (`id`) VALUES ('')");
@ -511,7 +513,7 @@ foreach($report_stock as $n=>$v) {
WHERE `id`={$report['id']}");
$stmt->execute();
report_save_field($report, 'col', $report['loc']);
report_save_field($report, 'col', get_value_from_array($report, 'loc'));
report_save_field($report, 'group', array());
report_save_field($report, 'sort', array());
report_save_field($report, 'distinct', array());

View File

@ -459,13 +459,14 @@ function createDataTCPDF(x,y,w,h,align,valign,fontname,fontstyle,fontsize,value)
$doCanvasSample = false;
$doCanvasSampletcpdf = false;
$l_w=$report_stock[$report['option']['stock']]['label_width'];
$l_h=$report_stock[$report['option']['stock']]['label_height'];
$l_w=get_value_from_2d_array($report_stock, get_value_from_2d_array($report,'option','stock', ''),'label_width');
$l_h=get_value_from_2d_array($report_stock, get_value_from_2d_array($report,'option','stock', ''),'label_height');
if($l_w && $l_h && $report['option']['type']=="label") {
echo "<h4>Label Data Locations</h4>";
pdf_begin_page
pdf_begin_page;
$doCanvasSample=true;
$ratio=$l_h/$l_w;
$canvaswidth=600;
@ -494,7 +495,7 @@ $doCanvasSampletcpdf = false;
$x=0;
if($report['option']['type'] == 'label' || $report['option']['type'] == 'tcpdf_label') {
if(get_value_from_2d_array($report, 'option','type') == 'label' || get_value_from_2d_array($report, 'option','type') == 'tcpdf_label') {
$fontlist = array('' => 'Default');
$fl = PDF::getFontList();
foreach($fl as $f) $fontlist[$f] = $f;
@ -585,31 +586,31 @@ $doCanvasSampletcpdf = false;
echo "<h4>Grouping</h4>";
for($x=0;$x<3;$x++) {
echo "Group By".($x + 1).": ";
$f = $report['group'][$x]['field'];
$f = get_value_from_3d_array($report, 'group', $x, 'field');
field_selector("group[$x]", "group$x", $f);
echo "<br />";
}
echo "<h4>Sorting</h4>";
for($x=0;$x<5;$x++) {
echo "Sort By".($x + 1).": ";
$f = $report['sort'][$x]['field'];
$f = get_value_from_3d_array($report, 'sort', $x, 'field');
field_selector("sort[$x]", "sort$x",$f);
echo "<br />";
}
echo "<h4>Distinct</h4>";
echo "Distinct Column: ";
$x=0;
$f = $report['distinct'][$x]['field'];
$f = get_value_from_3d_array($report, 'distinct', $x, 'field');
field_selector("distinct[$x]", "distinct0", $f);
echo "<h4>Filtering</h4>";
echo "<table>";
for($x=0;$x<3;$x++) {
echo "<tr><td>Filter".($x + 1).":</td><td>";
field_selector("filter[$x][field]", "filter$x",$report['filter'][$x]['field']);
field_selector("filter[$x][field]", "filter$x",get_value_from_3d_array($report, 'filter', $x, 'field'));
echo "<br />";
selector("filter[$x][x]", $filter_ops,$report['filter'][$x]['x']);
$v = $report['filter'][$x]['value'];
selector("filter[$x][x]", $filter_ops,get_value_from_3d_array($report, 'filter', $x, 'x'));
$v = get_value_from_3d_array($report, 'filter', $x, 'value');
echo "Text=<input type=\"text\" size=\"20\" name=\"filter[$x][value]\" value=\"$v\">";
echo "</td></tr>";
}
@ -626,7 +627,7 @@ $doCanvasSampletcpdf = false;
}
echo "<br />";
if($report['system_report_id'] != 0) {
if(get_value_from_array($report, 'system_report_id') != 0) {
echo notice(i18n('This is a system report, it cannot be changed or deleted. To save changes you have made to it, please select the \'Save as a new report\' option.'));
}
echo "<select name=\"repaction\">";

View File

@ -197,7 +197,7 @@
$q=$pdo->prepare("SELECT * FROM schools WHERE id='".get_value_from_array($_GET, 'edit', '')."'");
$q->execute();
$r=$q->fetch(PDO::FETCH_OBJ);
print_r($r);
}
else if(get_value_from_array($_GET, 'action') == "add")
{
@ -213,7 +213,7 @@
echo "<table>\n";
echo "<tr><td>".i18n("School Name")."</td><td><input type=\"text\" name=\"school\" value=\"".htmlspecialchars(get_value_or_default($r->school))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("School Name")."</td><td><input type=\"text\" name=\"school\" value=\"".htmlspecialchars(get_value_property_or_default($r, 'school', ''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("School Language")."</td><td>";
echo "<select name=\"schoollang\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
@ -234,40 +234,40 @@
echo "<option $sel value=\"$k\">".i18n($v)."</option>\n";
}
echo "</select></td></tr>\n";
echo "<tr><td>".i18n("School Level")."</td><td><input type=\"text\" name=\"schoollevel\" value=\"".htmlspecialchars($r->schoollevel)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n("School Board")."</td><td><input type=\"text\" name=\"board\" value=\"".htmlspecialchars($r->board)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("School District")."</td><td><input type=\"text\" name=\"district\" value=\"".htmlspecialchars($r->district)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Address")."</td><td><input type=\"text\" name=\"address\" value=\"".htmlspecialchars($r->address)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"".htmlspecialchars($r->city)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n("School Level")."</td><td><input type=\"text\" name=\"schoollevel\" value=\"".htmlspecialchars(get_value_property_or_default($r, 'schoollevel', ''))."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n("School Board")."</td><td><input type=\"text\" name=\"board\" value=\"".htmlspecialchars(get_value_property_or_default($r, 'board', ''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("School District")."</td><td><input type=\"text\" name=\"district\" value=\"".htmlspecialchars(get_value_property_or_default($r,'district',''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Address")."</td><td><input type=\"text\" name=\"address\" value=\"".htmlspecialchars(get_value_property_or_default($r,'address', ''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"".htmlspecialchars(get_value_property_or_default($r,'city',''))."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n($config['provincestate'])."</td><td>";
emit_province_selector("province_code",$r->province_code);
emit_province_selector("province_code",get_value_property_or_default($r, 'province_code', ''));
echo "</td></tr>\n";
echo "<tr><td>".i18n($config['postalzip'])."</td><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n($config['postalzip'])."</td><td><input type=\"text\" name=\"postalcode\" value=\"".get_value_property_or_default($r,'postalcode')."\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars(get_value_property_or_default($r,'phone', ''))."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars(get_value_property_or_default($r,'fax', ''))."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
if($r->principal_uid > 0)
$pl = user_load_by_uid($r->principal_uid);
if(get_value_property_or_default($r, 'principal_uid') > 0)
$pl = user_load_by_uid(get_value_property_or_default($r, 'principal_uid'));
else
$pl = array();
/* Don't show autogenerated emails */
$e = $pl['email'][0] == '*' ? '' : $pl['email'];
echo "<tr><td>".i18n("Principal")."</td><td><input type=\"text\" name=\"principal\" value=\"".htmlspecialchars($pl['name'])."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Principal Email")."</td><td><input type=\"text\" name=\"principalemail\" value=\"".htmlspecialchars($e)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
$e = get_value_from_array($pl, 'email', 0) == '*' ? '' : get_value_from_array($pl, 'email');
echo "<tr><td>".i18n("Principal")."</td><td><input type=\"text\" name=\"principal\" value=\"".htmlspecialchars(get_value_from_array($pl,'name', ''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Principal Email")."</td><td><input type=\"text\" name=\"principalemail\" value=\"".htmlspecialchars(get_value_or_default($e, ''))."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("School Email")."</td><td><input type=\"text\" name=\"schoolemail\" value=\"".htmlspecialchars($r->schoolemail)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Access Code")."</td><td><input type=\"text\" name=\"accesscode\" value=\"".htmlspecialchars($r->accesscode)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n("School Email")."</td><td><input type=\"text\" name=\"schoolemail\" value=\"".htmlspecialchars(get_value_property_or_default($r, 'schoolemail', ''))."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Access Code")."</td><td><input type=\"text\" name=\"accesscode\" value=\"".htmlspecialchars(get_value_property_or_default($r,'accesscode',''))."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td colspan=2><br /><b>".i18n("Science head/teacher or science fair contact at school")."</b></td></tr>";
if($r->sciencehead_uid > 0)
$sh = user_load_by_uid($r->sciencehead_uid);
if(get_value_property_or_default($r, 'sciencehead_uid', '')> 0)
$sh = user_load_by_uid(get_value_property_or_default($r, 'sciencehead_uid', ''));
else
$sh = array();
/* Don't show autogenerated emails */
$e = $sh['email'][0] == '*' ? '' : $sh['email'];
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"scienceheademail\" value=\"".htmlspecialchars($e)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Name")."</td><td><input type=\"text\" name=\"sciencehead\" value=\"".htmlspecialchars($sh['name'])."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"scienceheadphone\" value=\"".htmlspecialchars($sh['phonework'])."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
$e = get_value_from_2d_array($sh, 'email',0, '') == '*' ? '' : get_value_from_2d_array($sh,'email', '');
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"scienceheademail\" value=\"".htmlspecialchars(get_value_or_default($e, ''))."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Name")."</td><td><input type=\"text\" name=\"sciencehead\" value=\"".htmlspecialchars(get_value_from_array($sh, 'name', ''))."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"scienceheadphone\" value=\"".htmlspecialchars(get_value_property_or_default($sh, 'phonework', ''))."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
if($config['participant_registration_type']=="schoolpassword")
{
@ -299,7 +299,7 @@
}
echo "<tr><td colspan=2><br /><b>".i18n("Demographic Information")."</b></td></tr>";
$ch = ($r->atrisk) == 'yes' ? 'checked="checked"' : '';
$ch = get_value_property_or_default($r,'atrisk', '') == 'yes' ? 'checked="checked"' : '';
echo "<tr><td align=\"right\"><input type=\"checkbox\" name=\"atrisk\" value=\"yes\" $ch /></td><td>".i18n("Inner City or At-Risk school")."</td></tr>\n";
echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";

View File

@ -48,7 +48,7 @@ if(!$show) $show="missing";
if(get_value_from_array($_POST, 'action') == "save") {
//first, delete anything thats supposed to eb deleted
if(count($_POST['delete'])) {
if(count(get_value_from_array($_POST, 'delete', []))) {
foreach($_POST['delete'] AS $del) {
$stmt = $pdo->prepare("DELETE FROM translations WHERE lang='".$_SESSION['translang']."' AND strmd5='".$del."'");
@ -103,7 +103,7 @@ echo "<br />";
if($show=="missing") $showquery="AND ( val is null OR val='' )";
else $showquery="";
$q=$pdo->prepare("SELECT * FROM translations WHERE lang='".$_SESSION['translang']."' $showquery ORDER BY str");
$q=$pdo->prepare("SELECT * FROM translations WHERE lang='".get_value_from_array($_SESSION, 'translang')."' $showquery ORDER BY str");
$q->execute();
$num=$q->rowCount();
echo i18n("Showing %1 translation strings",array($num),array("number of strings"));
@ -131,6 +131,7 @@ echo "<table class=\"tableedit\">";
echo "<tr><th>";
echo "<img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">\n";
echo "</th>";
global $translangname;
echo "<th>".i18n("English")." / ".$translangname."</th></tr>\n";
while($r=$q->fetch(PDO::FETCH_OBJ))
{

View File

@ -34,7 +34,7 @@
require_once('judges.inc.php');
$show_types = $_GET['show_types'];
$show_types = get_value_from_array($_GET, 'show_types', '');
if(user_valid_type($show_types) == false) $show_types = array('judge');
$show_complete = (get_value_from_array($_GET,'show_complete') == 'yes') ? 'yes' : 'no';
@ -364,7 +364,7 @@ function update (id)
WHERE users_id='{$r['id']}'");
$rr = $qq->fetch(PDO::FETCH_ASSOC);
$name = "{$rr['name']}".((trim($name)=='') ? '' : "<br />($name)");
$name = "{".get_value_from_array($rr, 'name')."}".((trim($name)=='') ? '' : "<br />($name)");
}
echo "<a href=\"#\" onclick=\"return openeditor({$r['id']})\">$name</a>";
echo "</td>";

View File

@ -73,6 +73,7 @@ function xmlCreateRecurse($d)
# Mainfunction to parse the XML defined by URL
function xml_parsexml ($String) {
global $Data;
$Encoding=xml_encoding($String);
$String=xml_deleteelements($String,"?");
$String=xml_deleteelements($String,"!");
@ -145,8 +146,9 @@ function xmlCreateRecurse($d)
}else {
if(substr_count($Node," ")){ $Node=substr($Node,0,strpos($String," ",$Start)-$Start); }
}
return $Node;
}
return $Node;
}

View File

@ -155,7 +155,7 @@ class FCKeditor
*/
public function CreateHtml()
{
$HtmlValue = htmlspecialchars( get_value_property_or_default($this, 'Value', 'sdf') ) ;
$HtmlValue = htmlspecialchars(get_value_property_or_default($this, 'Value', '')) ;
$Html = '' ;

View File

@ -19,6 +19,11 @@ function get_value_from_2d_array(array $ar, string $key1, string $key2, mixed $d
return isset($ar[$key1][$key2]) ? $ar[$key1][$key2] : $default;
}
function get_value_from_3d_array(array $ar, string $key1, string $key2, string $key3, mixed $default = null) : mixed
{
return isset($ar[$key1][$key2][$key3]) ? $ar[$key1][$key2][$key3] : $default;
}
function get_value(mixed $var) : mixed
{
return isset($var) ? $var : null;
@ -31,12 +36,11 @@ function get_value_or_default(mixed $var, mixed $default = null) : mixed {
function get_value_property_or_default(mixed $var, mixed $property, mixed $default = null) : mixed {
return $var ? $var->$property : $default;
return $var && isset($var->$property) ? $var->$property : $default;
}
function show_pdo_errors_if_any($pdo)
{// Check for errors after the query execution
$errorInfo = $pdo->errorInfo();

View File

@ -49,7 +49,7 @@ function judge_status_expertise(&$u)
$q->execute();
$r=$q->fetch(PDO::FETCH_OBJ);
$numcats=$r->num;
if($numcats != count($u['cat_prefs'])) return 'incomplete';
if($numcats != count(get_value_from_array($u, 'cat_prefs', []))) return 'incomplete';
$q=$pdo->prepare("SELECT COUNT(id) AS num FROM projectdivisions WHERE year='".$config['FAIRYEAR']."'");
$q->execute();

View File

@ -142,9 +142,9 @@ class lcsv
function output()
{
if($this->csvdata)
{
$filename=strtolower(get_value($this->page_subheader));
$filename=preg_replace("[^a-z0-9]","_",$filename);
{ print_r($this->page_subheader);
$filename=strtolower(get_value_property_or_default($this,'page_subheader', ''));
$filename=preg_replace("[^a-z0-9]","_",$filename);
//header("Content-type: application/csv");
header("Content-type: text/x-csv");
header("Content-disposition: inline; filename=sfiab_".$filename.".csv");

View File

@ -131,6 +131,8 @@ class TableEditor
var $rowsPerPage;
var $activePage;
var $downloadLink;
var $DEBUG;
/**#@-*/

View File

@ -521,7 +521,7 @@ function user_save(&$u)
* tables */
function user_delete_committee($u)
{
{ global $pdo;
$stmt = $pdo->prepare("DELETE FROM committees_link WHERE users_uid='{$u['uid']}'");
$stmt->execute();
}
@ -533,6 +533,7 @@ function user_delete_volunteer($u)
function user_delete_judge($u)
{
global $config;
global $pdo;
$ids = array();
$q = $pdo->prepare("SELECT id FROM users WHERE uid = '{$u['uid']}'");
$q->execute();
@ -542,7 +543,7 @@ function user_delete_judge($u)
$stmt = $pdo->prepare("DELETE FROM judges_teams_link WHERE users_id IN ($idlist)");
$stmt->execute();
$stmt = $pdo->prepare("DELETE FROM judges_specialawards_sel WHERE users_id IN($idlist)");
$stmt = $pdo->prepare("DELETE FROM judges_specialaward_sel WHERE users_id IN($idlist)");
$stmt->execute();
}
@ -582,7 +583,7 @@ function user_delete_alumni($u)
function user_delete($u, $type=false)
{
{ global $pdo;
$finish_delete = false;
if(!is_array($u)) {
@ -612,8 +613,8 @@ function user_delete($u, $type=false)
call_user_func("user_delete_$type", $u);
} else {
/* Delete the whole user */
if(is_array($u['types'])) {
foreach($u['types'] as $t) call_user_func("user_delete_$t", $u);
if(is_array(get_value_from_array($u,'types'))) {
foreach(get_value_from_array($u,'types') as $t) call_user_func("user_delete_$t", $u);
}
$finish_delete = true;
}