forked from science-ation/science-ation
Updates converting from year to conference id.
This commit is contained in:
parent
54070f1836
commit
c3cf698524
@ -88,18 +88,16 @@
|
||||
"SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"),
|
||||
|
||||
"sponsors_primarycontacts"=>array("name"=>"Organization sponsors (primary contacts)","query"=>
|
||||
"SELECT uid, MAX(users.conferences_id) AS conferences_id, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary
|
||||
FROM sponsors,
|
||||
users_sponsor,
|
||||
users
|
||||
"SELECT users.id, conferences_id, organization, firstname, lastname, email, `primary`
|
||||
FROM users
|
||||
JOIN user_roles on users.id = user_roles.id
|
||||
JOIN roles ON user_roles.roles_id = roles.id
|
||||
WHERE
|
||||
users.id=users_sponsor.users_id
|
||||
AND users_sponsor.sponsors_id=sponsors.id
|
||||
AND users.types LIKE '%sponsor%'
|
||||
AND users.email!=''
|
||||
GROUP BY uid
|
||||
HAVING deleted='no' AND users_sponsor.primary='yes'
|
||||
ORDER BY users.email
|
||||
roles.type = 'sponsor'
|
||||
AND email != ''
|
||||
AND deleted='no'
|
||||
AND `primary`='yes'
|
||||
ORDER BY email
|
||||
"),
|
||||
"sponsors_allcontacts"=>array("name"=>"Organization sponsors (all contacts)","query"=>
|
||||
"SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email
|
||||
|
@ -33,7 +33,7 @@ if($catr=mysql_fetch_object($catq))
|
||||
|
||||
$pdf=new lpdf( i18n($config['fairname']),
|
||||
i18n("Checkin List")." - ".i18n($catr->category),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']-logo-200.gif"
|
||||
);
|
||||
|
||||
$pdf->newPage();
|
||||
|
@ -299,21 +299,26 @@
|
||||
}
|
||||
|
||||
|
||||
$q=mysql_query("SELECT COUNT(id) AS num FROM users
|
||||
LEFT JOIN users_committee ON users_committee.users_id=users.id
|
||||
WHERE types LIKE '%committee%'
|
||||
AND year='$year'
|
||||
AND users_committee.committee_active='yes'
|
||||
AND deleted='no'");
|
||||
$q=mysql_query("SELECT COUNT(users.id) AS num FROM users
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE roles.type = 'committee'
|
||||
AND users.conferences_id = '{$conference['id']}'
|
||||
AND users.deleted = 'no'");
|
||||
|
||||
$r = mysql_fetch_object($q);
|
||||
$stats['committee_members'] = $r->num;
|
||||
|
||||
$q=mysql_query("SELECT COUNT(id) AS num FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id
|
||||
WHERE users.year='$year'
|
||||
AND users.types LIKE '%judge%'
|
||||
AND users.deleted='no'
|
||||
AND users_judge.judge_complete='yes'
|
||||
AND users_judge.judge_active='yes'");
|
||||
$q=mysql_query("
|
||||
SELECT COUNT(users.id) AS num FROM users
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE users.conferences_id = '{$conference['id']}'
|
||||
AND users.deleted = 'no'
|
||||
AND roles.type = 'judge'
|
||||
AND user_roles.complete='yes'
|
||||
AND user_roles.active='yes'");
|
||||
|
||||
$r=mysql_fetch_object($q);
|
||||
$stats['judges'] = $r->num;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
} else if($type=="pdf") {
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("List of Prospects By Appeal"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(8);
|
||||
@ -125,7 +125,7 @@
|
||||
} else if($type=="pdf") {
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Results of Appeal by Purpose"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(8);
|
||||
|
@ -51,7 +51,7 @@ if(!$scriptformat) $scriptformat="default";
|
||||
if($type=="pdf") {
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Awards Ceremony Script"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
|
@ -972,12 +972,13 @@ function report_judges_fromwhere($report, $components)
|
||||
|
||||
$q = " FROM users
|
||||
LEFT JOIN accounts ON accounts.id=users.accounts_id
|
||||
LEFT JOIN user_roles as ROLE_JUDGE ON (ROLE_JUDGE.users_id=users.id AND ROLE_JUDGE.type='judge')
|
||||
LEFT JOIN user_roles as ROLE_JUDGE ON (ROLE_JUDGE.users_id=users.id)
|
||||
JOIN roles ON roles.id = ROLE_JUDGE.roles_id
|
||||
$teams_from
|
||||
$projects_from
|
||||
$students_from
|
||||
WHERE
|
||||
users.types LIKE '%judge%'
|
||||
ROLE_JUDGE.type='judge'
|
||||
$conferences_id_where
|
||||
$teams_where
|
||||
$projects_where
|
||||
|
@ -36,7 +36,7 @@ if($type=="pdf")
|
||||
{
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Judge List"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
@ -105,16 +105,15 @@ $table['widths']=array();
|
||||
$table['dataalign']=array();
|
||||
|
||||
$q=mysql_query("SELECT
|
||||
users.*,
|
||||
users_judge.*
|
||||
users.*
|
||||
FROM
|
||||
users
|
||||
JOIN users_judge ON users.id=users_judge.users_id
|
||||
WHERE
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE
|
||||
roles.type = 'judge' AND
|
||||
users.deleted='no' AND
|
||||
users.conferences_id='".$conference['id']."'
|
||||
AND users.types LIKE '%judge%'
|
||||
|
||||
ORDER BY
|
||||
lastname,
|
||||
firstname");
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Judging Team Project Assignments"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
|
@ -51,7 +51,7 @@ if($report)
|
||||
|
||||
$rep=new lpdf( i18n($conference['name']),
|
||||
"$reportname Mailing Labels",
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->setPageStyle("labels");
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Program Awards"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Project Details"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Project Judging Team Assignments"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
|
@ -46,16 +46,16 @@ $u = user_load($eid);
|
||||
switch($_GET['action']) {
|
||||
case 'save':
|
||||
$stats = $_POST['stats'];
|
||||
$year = intval($_POST['year']);
|
||||
$conferences_id = intval($_POST['conferences_id']);
|
||||
|
||||
foreach($stats as $k=>$v) {
|
||||
$stats[$k] = mysql_escape_string($stats[$k]);
|
||||
}
|
||||
|
||||
// $str = join(',',$stats);
|
||||
$keys = '`fairs_id`,`year`,`'.join('`,`', array_keys($stats)).'`';
|
||||
$vals = "'{$u['fairs_id']}','$year','".join("','", array_values($stats))."'";
|
||||
mysql_query("DELETE FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}' AND year='$year'");
|
||||
$keys = '`fairs_id`,`conferences_id`,`'.join('`,`', array_keys($stats)).'`';
|
||||
$vals = "'{$u['fairs_id']}','$conferences_id','".join("','", array_values($stats))."'";
|
||||
mysql_query("DELETE FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}' AND conferences_id='$conferences_id'");
|
||||
echo mysql_error();
|
||||
mysql_query("INSERT INTO fairs_stats (`id`,$keys) VALUES ('',$vals)");
|
||||
echo mysql_error();
|
||||
@ -104,8 +104,6 @@ $server_config['scholarships'] = false;
|
||||
$server_config['delegates'] = false;
|
||||
$server_any_stats = false;
|
||||
|
||||
$year = intval($_POST['year']);
|
||||
if($year < 1900) $year = $config['FAIRYEAR'];
|
||||
|
||||
/* Get the stats we want from this fair */
|
||||
$q = mysql_query("SELECT * FROM fairs WHERE id='{$u['fairs_id']}'");
|
||||
@ -119,38 +117,31 @@ foreach($s as $k) {
|
||||
$server_any_stats = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
$s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'fair_stats.php';
|
||||
echo "<form id=\"year_form\" name=\"year_form\" method=\"post\" action=\"$s\">";
|
||||
echo i18n('Select Year').": ";
|
||||
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
|
||||
echo "<select name=\"year\" id=\"year\" onchange=\"this.form.submit()\">";
|
||||
while($i = mysql_fetch_assoc($q)) {
|
||||
$y = $i['year'];
|
||||
$sel = ($config['FAIRYEAR'] == $y) ? 'selected=\"selected\"' : '';
|
||||
echo "<option value=\"$y\" $sel>$y</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</form>";
|
||||
*/
|
||||
echo "<br />";
|
||||
|
||||
/* Load stats */
|
||||
$confDat = null;
|
||||
if(array_key_exists('conferences_id', $_POST)){
|
||||
$conferences_id = intval($_POST['conferences_id']);
|
||||
$confDat = get_conference_info($conferences_id);
|
||||
}
|
||||
if($confDat == null){ // can't be an else, as get_conference_info returns null if the id isn't found
|
||||
$conferences_id = $conference['id'];
|
||||
$confDat = get_conference_info($conferences_id);
|
||||
}
|
||||
|
||||
$q = mysql_query("SELECT * FROM fairs_stats WHERE fairs_id='{$u['fairs_id']}'
|
||||
AND year='$year'");
|
||||
AND conferences_id='$conferences_id'");
|
||||
$stats = mysql_fetch_assoc($q);
|
||||
|
||||
/* Print stats */
|
||||
|
||||
|
||||
/* Print all blocks the server requests */
|
||||
|
||||
echo "<br />";
|
||||
echo "<form id=\"stats_form\" name=\"stats_form\">";
|
||||
echo "<input type=\"hidden\" name=\"year\" value=\"$year\" />";
|
||||
echo "<input type=\"hidden\" name=\"conferences_id\" value=\"$conferences_id\" />";
|
||||
|
||||
if($server_config['info']) {
|
||||
echo '<h3>'.i18n('%1 Fair information', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 information', array($confDat['name'])).'</h3>';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Fair Start Date').':</td>';
|
||||
echo "<td><input type=\"text\" size=\"12\" name=\"stats[start_date]\" value=\"{$stats['start_date']}\">(YYYY-MM-DD)</td></tr>";
|
||||
@ -176,7 +167,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
|
||||
|
||||
if($server_config['next_chair']) {
|
||||
echo '<h3>'.i18n('%1 - %2 Chairperson (if known)', array($year, $year+1)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Chairperson (if known)', array($confDat['name'])).'</h3>';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Name').': </td>';
|
||||
echo "<td><input type=text name=\"stats[next_chair_name]\" value=\"{$stats['next_chair_name']}\"></td>";
|
||||
@ -195,7 +186,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
}
|
||||
|
||||
if($server_config['delegates']) {
|
||||
echo '<h3>'.i18n('%1 CWSF Delegates and Alternatives', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 CWSF Delegates and Alternatives', array($confDat['name'])).'</h3>';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Delegate Name(s)').'</td><td>'.i18n('Email').'</td><td>'.i18n('Jacket Size').'<td></tr>';
|
||||
for($x=1;$x<=3;$x++) {
|
||||
@ -216,7 +207,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
}
|
||||
|
||||
if($server_config['scholarships']) {
|
||||
echo '<h3>'.i18n('%1 Scholarships', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Scholarships', array($confDat['name'])).'</h3>';
|
||||
echo 'How many university/college scholarships are available at your fair? (use a format like: <br /><b>6 - University of British Columbia - Entrance Scholarships</b><br />';
|
||||
echo '<textarea name="stats[scholarships]" rows="4\" cols="80">'.htmlspecialchars($stats['scholarships']).'</textarea>';
|
||||
echo '<br /><br />';
|
||||
@ -224,7 +215,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
|
||||
if($server_config['participation']) {
|
||||
$rangemap = array(1=>'1-3', 4=>'4-6', 7=>'7-8', 9=>'9-10', 11=>'11-12');
|
||||
echo '<h3>'.i18n('%1 Fair participation', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 participation', array($confDat['name'])).'</h3>';
|
||||
echo '<br />';
|
||||
echo i18n("Number of students").": ";
|
||||
echo "<input type=text name=\"stats[students_total]\" size=\"5\" value=\"{$stats['students_total']}\">";
|
||||
@ -257,7 +248,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
}
|
||||
|
||||
if($server_config['schools_ext']) {
|
||||
echo '<h3>'.i18n('%1 Extended School/Participant data', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Extended School/Participant data', array($confDat['name'])).'</h3>';
|
||||
echo '<br />';
|
||||
?>
|
||||
<table><tr>
|
||||
@ -284,7 +275,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
<?
|
||||
}
|
||||
if($server_config['minorities']) {
|
||||
echo '<h3>'.i18n('%1 Data on minority groups', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Data on minority groups', array($confDat['name'])).'</h3>';
|
||||
echo '<br />';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Number of First Nations students');
|
||||
@ -295,7 +286,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
echo '<br />';
|
||||
}
|
||||
if($server_config['guests'] ) {
|
||||
echo '<h3>'.i18n('%1 Guests visiting the fair', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Guests visiting the fair', array($confDat['name'])).'</h3>';
|
||||
echo '<br />';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Number of Students that visited the fair (tours, etc.)');
|
||||
@ -310,7 +301,7 @@ $stats = mysql_fetch_assoc($q);
|
||||
}
|
||||
|
||||
if($server_config['sffbc_misc']) {
|
||||
echo '<h3>'.i18n('%1 Misc. SFFBC Questions', array($year)).'</h3>';
|
||||
echo '<h3>'.i18n('%1 Misc. SFFBC Questions', array($confDat['name'])).'</h3>';
|
||||
echo '<br />';
|
||||
echo '<table>';
|
||||
echo '<tr><td>'.i18n('Number of Teachers supporting student projects');
|
||||
|
@ -17,7 +17,7 @@ class pdf extends TCPDF {
|
||||
|
||||
function __construct($report_name='', $format='LETTER', $orientation='P')
|
||||
{
|
||||
global $config;
|
||||
global $conference;
|
||||
|
||||
/* Start an output PDF */
|
||||
|
||||
@ -50,16 +50,16 @@ class pdf extends TCPDF {
|
||||
// set document information
|
||||
$this->SetCreator('SFIAB');
|
||||
$this->SetAuthor('SFIAB');
|
||||
$this->SetTitle(i18n($config['fairname']));
|
||||
$this->SetTitle(i18n($conference['name']));
|
||||
$this->SetSubject($report_name);
|
||||
$this->SetKeywords('');
|
||||
|
||||
/* Set default header data (K_PATH_IMAGES/logo-500.jpg, 16mm wide, header, name)
|
||||
/* Set default header data (K_PATH_IMAGES/[conference id]-logo-500.jpg, 16mm wide, header, name)
|
||||
* PDFs use JPG internally, so we should feed it a jpeg, if we dont', tcpdf will
|
||||
* convert it to a jpg anyway, and that takes FOREVER if there's lots of
|
||||
* pages/labels.*/
|
||||
$this->SetHeaderData('logo-500.jpg', 16 /* mm */,
|
||||
i18n($config['fairname']), i18n($report_name));
|
||||
$this->SetHeaderData($conference['id'] . '-logo-500.jpg', 16 /* mm */,
|
||||
i18n($conference['name']), i18n($report_name));
|
||||
|
||||
// set header and footer fonts
|
||||
$this->setHeaderFont(Array('helvetica', '', 14));
|
||||
@ -315,7 +315,6 @@ class pdf extends TCPDF {
|
||||
|
||||
function label_new()
|
||||
{
|
||||
global $config;
|
||||
/* Advance to new label */
|
||||
// echo "cindex=$this->current_label_index, perpage=$this->labels_per_page\n";
|
||||
if($this->current_label_index + 1 == $this->labels_per_page) {
|
||||
|
77
user.inc.php
77
user.inc.php
@ -99,7 +99,6 @@ function user_load($users_id, $accounts_id = false)
|
||||
$u = array_merge($u, $userDat);
|
||||
$u['id'] = intval($u['id']);
|
||||
$u['accounts_id'] = intval($u['accounts_id']);
|
||||
$u['year'] = intval($u['year']);
|
||||
|
||||
// Convenience
|
||||
$u['name'] = ($u['firstname'] ? "{$u['firstname']} " : '').$u['lastname'];
|
||||
@ -234,11 +233,6 @@ function user_load($users_id, $accounts_id = false)
|
||||
|
||||
/* Do this assignment without recursion :) */
|
||||
unset($u['orig']);
|
||||
/*
|
||||
echo "<pre>";
|
||||
print_r($u);
|
||||
echo "</pre>";
|
||||
*/
|
||||
$orig = $u;
|
||||
$u['orig'] = $orig;
|
||||
$u['required_fields']=user_all_fields_required(array_keys($u['roles']));
|
||||
@ -454,11 +448,7 @@ function user_get_fields($userRoles = null){
|
||||
$fields[$fieldName]['options'] = array(1 => 'Very Little', 2 => 'Little', 3 => 'Average', 4 => 'Knowledgable', 5 => 'Very Knowledgable');
|
||||
while($divdata = mysql_fetch_assoc($divquery)){
|
||||
$divid = $divdata['id'];
|
||||
$fields[$fieldName]['entries'][$divdata['id']] = $divdata['division'];/*
|
||||
$subdivquery = mysql_query("SELECT * FROM projectsubdivisions WHERE conferences_id = {$conference['id']} AND projectdivisions_id = $divid");
|
||||
while($subdivdata = mysql_fetch_assoc($subdivquery)){
|
||||
$divisions[$divdata['division']][$subdivdata['id']] = $subdivdata['subdivision'];
|
||||
}*/
|
||||
$fields[$fieldName]['entries'][$divdata['id']] = $divdata['division'];
|
||||
}
|
||||
break;
|
||||
case 'divsub_prefs':
|
||||
@ -472,7 +462,6 @@ function user_get_fields($userRoles = null){
|
||||
$divquery = mysql_query("SELECT * FROM projectdivisions WHERE conferences_id = {$conference['id']}");
|
||||
while($divdata = mysql_fetch_assoc($divquery)){
|
||||
$divid = $divdata['id'];
|
||||
// $fields[$fieldName]['entries'][$divdata['id']] = array('division' => $divdata['division']);
|
||||
$subset = array();
|
||||
$subdivquery = mysql_query("SELECT * FROM projectsubdivisions WHERE conferences_id = {$conference['id']} AND projectdivisions_id = $divid");
|
||||
while($subdivdata = mysql_fetch_assoc($subdivquery)){
|
||||
@ -543,24 +532,9 @@ function user_get_fields($userRoles = null){
|
||||
$fields['available_times']['entries'][$slot['id']] = trim($slot['name'] . ' (' . $slot['date'] . ' ' . $slot['starttime'] . ' - ' . $slot['endtime'] . ')');
|
||||
}
|
||||
}
|
||||
// echo "<pre>";
|
||||
// print_r($fields);
|
||||
// echo "</pre>";
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/* FIXME: these are going to need conference IDs too */
|
||||
function user_load_by_accounts_id_year($uid, $year)
|
||||
{
|
||||
echo "FIXME";
|
||||
exit;
|
||||
$q = mysql_query("SELECT id FROM users WHERE uid='$uid' AND year <= '$year'");
|
||||
if(!mysql_num_rows($q)) return false;
|
||||
$i = mysql_fetch_assoc($q);
|
||||
return user_load($i['id']);
|
||||
}
|
||||
|
||||
// this depends on the naming convention that any given role that needs a completion check
|
||||
// will have a function called <role>_status_update, which updates their status with the
|
||||
// current session data and returns 'complete' or 'incomplete' accordingly.
|
||||
@ -849,7 +823,7 @@ function user_purge($u, $role=false)
|
||||
/* Duplicate a row in the users table, or any one of the users_* tables. */
|
||||
function user_dupe_row($db, $key, $val, $newval)
|
||||
{
|
||||
global $config;
|
||||
global $conference;
|
||||
$nullfields = array('deleteddatetime'); /* Fields that can be null */
|
||||
$q = mysql_query("SELECT * FROM $db WHERE $key='$val'");
|
||||
if(mysql_num_rows($q) != 1) {
|
||||
@ -862,8 +836,8 @@ function user_dupe_row($db, $key, $val, $newval)
|
||||
foreach($i as $k=>$v) {
|
||||
if($v == NULL && in_array($k, $nullfields))
|
||||
$i[$k] = 'NULL';
|
||||
else if($k == 'year')
|
||||
$i[$k] = $config['FAIRYEAR'];
|
||||
else if($k == 'conferences_id')
|
||||
$i[$k] = $conference['id'];
|
||||
else
|
||||
$i[$k] = '\''.mysql_escape_string($v).'\'';
|
||||
}
|
||||
@ -879,41 +853,6 @@ function user_dupe_row($db, $key, $val, $newval)
|
||||
$id = mysql_insert_id();
|
||||
return $id;
|
||||
}
|
||||
/* Used by the login scripts to copy one user from one year to another */
|
||||
function user_dupe($u, $new_year)
|
||||
{
|
||||
/* Dupe a user if:
|
||||
* - They don't exist in the current year
|
||||
* (users->year != the target year (passed in so we can use it in the rollover script) )
|
||||
* - They have a previous year entry
|
||||
* (users->year DESC LIMIT 1 == 1 row)
|
||||
* - That previous entry has deleted=no */
|
||||
|
||||
/* Find the last entry */
|
||||
$q = mysql_query("SELECT id,uid,year,deleted FROM users WHERE uid='{$u['uid']}'
|
||||
ORDER BY year DESC LIMIT 1");
|
||||
$r = mysql_fetch_object($q);
|
||||
if($r->deleted == 'yes') {
|
||||
echo "Cannot duplicate user ID {$u['id']}, they are deleted. Undelete them first.\n";
|
||||
exit;
|
||||
}
|
||||
if($r->year == $new_year) {
|
||||
echo "Cannot duplicate user ID {$u['id']}, they already exist in year $new_year\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = user_dupe_row('users', 'id', $u['id'], NULL);
|
||||
$q = mysql_query("UPDATE users SET year='$new_year' WHERE id='$id'");
|
||||
|
||||
/* Load the new user */
|
||||
$u2 = user_load($id);
|
||||
|
||||
foreach($u2['types'] as $t) {
|
||||
user_dupe_row("users_$t", 'users_id', $u['id'], $id);
|
||||
}
|
||||
/* Return the ID of the new user */
|
||||
return $id;
|
||||
}
|
||||
|
||||
/* Returns true if loaded user ($u) is allowed to add role $role to their
|
||||
* profile. THis is intended as a last-stop mechanism, preventing, for example
|
||||
@ -1275,13 +1214,7 @@ function try_login($user, $pass)
|
||||
$user = mysql_real_escape_string($user);
|
||||
$q = mysql_query("SELECT id,password,deleted FROM accounts WHERE username='$user'");
|
||||
echo mysql_error();
|
||||
/*
|
||||
$q = mysql_query("SELECT id,username,password,year,deleted
|
||||
FROM users
|
||||
WHERE username='$user'
|
||||
AND deleted='no'
|
||||
ORDER BY year DESC LIMIT 1");
|
||||
*/
|
||||
|
||||
if(mysql_num_rows($q) < 1) return false;
|
||||
|
||||
$r = mysql_fetch_assoc($q);
|
||||
|
Loading…
Reference in New Issue
Block a user