forked from science-ation/science-ation
85 lines
2.7 KiB
PHP
85 lines
2.7 KiB
PHP
<?
|
|
/*
|
|
This file is part of the 'Science Fair In A Box' project
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
Copyright (C) 2005-2009 James Grant <james@lightbox.org>
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; see the file COPYING. If not, write to
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA.
|
|
*/
|
|
?>
|
|
<?
|
|
require("../common.inc.php");
|
|
require_once("../user.inc.php");
|
|
require_once("../config_editor.inc.php");
|
|
|
|
function roll($currentfairyear, $newfairyear, $table, $fields)
|
|
{
|
|
$q=$pdo->prepare("SELECT * FROM $table WHERE year='$currentfairyear'");
|
|
$q->execute();
|
|
echo $pdo->errorInfo();
|
|
$names = '`'.join('`,`', $fields).'`';
|
|
while($r=$q->fetch(PDO::FETCH_ASSOC)) {
|
|
$vals = '';
|
|
foreach($fields as $f) {
|
|
$vals .= ",'".$r[$f]."'";
|
|
}
|
|
|
|
$stmt = $pdo->prepare("INSERT INTO $table(`year`,$names) VALUES ('$newfairyear'$vals)");
|
|
$stmt->execute();
|
|
echo $pdo->errorInfo();
|
|
}
|
|
}
|
|
|
|
$currentfairyear=2009;
|
|
$newfairyear=2010;
|
|
|
|
echo i18n("Rolling schools")."<br />";
|
|
//award types
|
|
$q=$pdo->prepare("SELECT * FROM schools WHERE year='$currentfairyear'");
|
|
$q->execute();
|
|
echo $pdo->errorInfo();
|
|
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
|
$puid = ($r->principal_uid == null) ? 'NULL' : ("'".intval($r->principal_uid)."'");
|
|
$shuid = ($r->sciencehead_uid == null) ? 'NULL' : ("'".intval($r->sciencehead_uid)."'");
|
|
|
|
|
|
$stmt = $pdo->prepare("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal_uid,schoolemail,sciencehead_uid,accesscode,lastlogin,junior,intermediate,senior,registration_password,projectlimit,projectlimitper,year) VALUES (
|
|
'".$r->school."',
|
|
'".$r->schoollang."',
|
|
'".$r->schoollevel."',
|
|
'".$r->board."',
|
|
'".$r->district."',
|
|
'".$r->phone."',
|
|
'".$r->fax."',
|
|
'".$r->address."',
|
|
'".$r->city."',
|
|
'".$r->province_code."',
|
|
'".$r->postalcode."',$puid,
|
|
'".$r->schoolemail."',$shuid,
|
|
'".$r->accesscode."',
|
|
NULL,
|
|
'".$r->junior."',
|
|
'".$r->intermediate."',
|
|
'".$r->senior."',
|
|
'".$r->registration_password."',
|
|
'".$r->projectlimit."',
|
|
'".$r->projectlimitper."',
|
|
'".$newfairyear."')");
|
|
$stmt->execute();
|
|
}
|
|
?>
|