Compare commits

...

582 Commits

Author SHA1 Message Date
jacob
fc503f505c Small modification to ensure that the user variable at least includes their name if they have no roles; 2012-03-06 18:22:18 +00:00
jacob
88ed011e5a Modified the user info structure to explain the users' t-shirt size as an enumeration rather than a varchar 2012-02-22 15:57:29 +00:00
jacob
f61b4b94f3 Quick patches:
- wording changes for creating an account and recovering passwords
 - updated rollover script to copy the conference logo
2012-02-15 16:36:52 +00:00
jacob
680528d387 Misplaced not operator preventing people from registering new projects 2012-02-10 22:04:58 +00:00
jacob
6893a22276 Updated code to allow invitaiton of committee members. 2012-02-10 20:19:19 +00:00
james
4f8b8c6a57 Forward port substitutions on firstname/lastname for new user welcome email 2012-02-10 17:37:59 +00:00
jacob
f16f5b6211 A small patch. Allows registration id's in the user field with a zero value to be handled the same way as a null value. 2012-02-08 21:30:37 +00:00
jacob
6ea87600da Updated the user_copy function to avoid copying the registrations_id and grade fields. 2012-02-07 17:31:33 +00:00
jacob
0f26cbbf2c Quick fix to make sure you can't switch to an inactive conference through the API 2012-02-06 17:41:50 +00:00
jacob
b1d2fd76a6 Another bug fix on conferences.php 2011-12-20 15:40:17 +00:00
jacob
01589a1518 Bug fixes for conference managament "wizard". 2011-12-20 15:21:48 +00:00
james
80ec239bd9 CSS fixups 2011-12-20 15:10:30 +00:00
jacob
14c192d69f Added the pronunciation field to the user object for participants 2011-04-08 18:24:24 +00:00
james
0e188391d8 Update on the winners.php to work with the new user system 2011-04-08 18:08:17 +00:00
james
2811eef8d2 Some touch-ups to get prize nomination working properly with the new system 2011-04-08 16:28:21 +00:00
james
36cc0e289c Forward port truncate username fix into trunk 2011-03-29 19:42:00 +00:00
james
974d42fa91 Fix "Try Report" from report editor - if no conference id passed in, use the current conference id, which it was set to do, but $conference wasnt global'd in the function 2011-03-29 18:27:12 +00:00
james
ef46b5811b And fix the same bug with the prize order saving 2011-03-28 18:38:49 +00:00
james
497f6eddd7 fix a bug in saving the award order (we need to .load on a div that actually exists) 2011-03-28 18:36:58 +00:00
jacob
75e7d4e574 Just a few quick query updates 2011-03-28 14:44:25 +00:00
james
b519726d73 Update website consent page 2011-03-27 17:11:36 +00:00
james
a1b0c33a64 Take website first/last name censent into consideration for app
Update project info
2011-03-27 17:08:59 +00:00
james
ade9e1b876 Update confirmed participants page from students table to users table 2011-03-27 16:49:22 +00:00
jacob
3e290af2dc Quick query fix 2011-03-24 21:34:12 +00:00
jacob
4a9e2ca163 Updated e-mail to accomodate custom e-mail address confirmation messages. 2011-03-24 21:04:28 +00:00
james
98f6a9f76d Update more communication emails (teachers, principals)
Tweak award eligibility display
Add "Account" info to student reports (email, username, pendingemail)
Move some project identification stuff around and fix the groupings
2011-03-23 19:44:08 +00:00
james
3af6933f73 hmm better implement the selection of eligibility - it wasnt working here for me, but was on some windows browsers.. so.. be explicit with what its doing and now it should work everywhere 2011-03-22 20:40:31 +00:00
james
23d8765fa6 Fix all participant emails in communication module
Make queries for communications easier, all you need is a users.id queried, the system will find everything else for you
Add ability to use [PASSWORD], [USERNAME], [EMAIL] (tries accounts.email first, if its not there, it uses accounts.pendingemail), in _ANY_ email.  [REGNUM] also added but will obviously only work for participants
Add "all" section to the tabs list for user editor, so a user without any roles can still get the basic pages like "account",  "roles", and "personal info"
Put count on participant invitations for teachers (and superusers)
Fix a bug where changing a password for a different user didnt work (it changed YOURS!)
2011-03-22 04:37:51 +00:00
james
5147b3a62b Fix daves commit from last night, we dont use year anymore, we use conferences_id 2011-03-20 19:20:03 +00:00
dave
58af12c9cb Commit from branch2.3, match the categories/divs with the project year to avoid printing categories from previous years. 2011-03-20 00:09:00 +00:00
james
d59908033e Always put the app text under the barcode so people know what its for :p
Fix the naming of the barcode function for consistency
2011-03-19 21:05:18 +00:00
james
12bb399d48 Fix the conference logo not working on reports (FINALLY! god for such a stupid bug it took me forever to realize it), also tweaked the barcode code a bit 2011-03-19 20:49:06 +00:00
james
c493120128 INcrease the size of the barcode slightly. 2011-03-17 23:16:44 +00:00
james
047dd2c86f Oops missed one (IMPORTANT) barcode commit 2011-03-17 23:13:51 +00:00
james
c338261abc Add iPhone app stuff to trunk/ 2011-03-17 23:06:16 +00:00
dennis
2e303635ea Changes to facilitate running in Windows OS IIS or Apache werb server 2011-03-15 20:28:10 +00:00
james
3b2bf0a0e2 Oops, fix off-by-one in safetyquestion report editor fields 2011-03-15 00:08:59 +00:00
james
41085e2c46 Add fields for project safety question answers to report buildeir 2011-03-14 22:04:30 +00:00
james
d182699702 shrink RegNum column, it doesnt need to be so big.
fix project_details custom report for students->users
2011-03-14 21:24:39 +00:00
james
9c080c76f5 Add some trimming to username/passwords/emails (to prevent people from putting spaces before and/or after their email address causing it to be invalid)
Updated report system to read students from users table instead of students table
Fix tcpdf tables spanning multiple pages spilling into the header area
Fix calling an invalid add_table function (its addTable yo!)
2011-03-14 20:59:16 +00:00
james
badc2e9378 forward port translation changes on participant special award pages 2011-03-10 16:17:21 +00:00
james
81fafb609c Add ability fo superuser to SEE anyones current password 2011-03-10 15:01:17 +00:00
james
6d189a907f If the email is already validated (like if they clicked the link more than once) just tell them thats the case instead of telling them its invalid (which it is) 2011-03-09 23:43:19 +00:00
james
a463b591cc Make participant invite table header clickable to sort 2011-03-09 02:49:41 +00:00
james
ae8ec49388 Allow admin or superuser to uninvite students from any school 2011-03-08 17:46:25 +00:00
james
43283059ae show pendingemail in school list if email isnt set (and let them know its unconfirmed)
show "no name set" in school list if the name (firstname." ".lastname) is blank
2011-03-07 22:34:28 +00:00
james
5270935d3b A few tweaks to get the simcoe signature page back to 1 page
- reduce some spacing
 - remove final <hr /> from bottom
2011-03-07 20:05:26 +00:00
james
ef327f008b Update the javascript based count when the page loads 2011-03-07 17:48:06 +00:00
james
e47f65729d Trim the summary before splitting to count words (gets rid of leading and trailing whitespace causing extra 'words') 2011-03-07 16:28:02 +00:00
james
7583dc7dc6 More better output for school info on partifipant invite list (see whats going on!) 2011-03-05 04:44:27 +00:00
james
caf1207fbf Put some superuser stuff on the participant invite page so alison can see whats going on 2011-03-05 04:39:06 +00:00
james
b26d9a3dc4 Fix school list 2011-03-05 03:13:15 +00:00
james
c995e226c7 Update registration_list
Update registration_statistics
Update registration_receivedforms
Update student_editor
2011-03-04 22:29:55 +00:00
james
953e95ac3e Update student/project editor for admin
Fix the registration_list.php to work again - temporarily disable "create new project" and the ability to ADD students to an existing project
2011-03-04 21:52:37 +00:00
james
9caa5b0a17 Fix the local sfiab side of special awards
Add "numstudents" to top of participant main page
2011-03-04 20:07:10 +00:00
james
c6ba56f57a Fix the -1 for the god damn last time 2011-03-04 19:56:15 +00:00
james
af47f30aeb Fix special award nominations to work with "-1" special award (i dont want to nomiiated for special awradsa) 2011-03-04 19:21:30 +00:00
james
afd81015eb Send the -1 award through for 'no special awards' 2011-03-04 16:38:15 +00:00
james
a28ab561eb Properly handle award id = -1 for "i dont want special awards" 2011-03-04 16:15:10 +00:00
james
c0299dc870 Update docs for account/edit, and tweak link_username_to_email 2011-03-04 16:01:59 +00:00
james
7d6d1851cd michael couldnt find the registration number becuase it was called 'num' so now give him both 'num' and 'registration_number' 2011-03-04 05:51:23 +00:00
james
133b41da5b Fix typo, argh 2011-03-04 05:28:14 +00:00
james
9a33f52e15 global $conference in joinproject 2011-03-04 05:19:42 +00:00
james
81f6702412 Wehn adding a project, get the WHOLE project object to return using getProject instead of simply quering it manually 2011-03-04 04:54:50 +00:00
james
0255fdbb88 Add firstname and lastname to the incomplete log for a better idea 2011-03-04 04:45:21 +00:00
james
ac30e13078 Add teacher emaisl to communications tool 2011-03-04 02:26:22 +00:00
james
acbd76aa03 FIx missing numstudents in project object 2011-03-04 01:32:52 +00:00
james
9efd7d89f9 UPdate teh numstudents API docs 2011-03-04 01:05:47 +00:00
james
cbfd66bb28 add numstudents API to the project object
also add a unique constraint on the user_roles table (user_id,role_id)
2011-03-04 01:05:15 +00:00
james
7254d983d8 FIx bug in special awards saving 2011-03-04 00:49:25 +00:00
james
5df66f4b7e Commit earlier fix to getProject returning invalid project object, im assuming this fixes michaels issue even though i havent heard yet... 2011-03-04 00:18:39 +00:00
james
c87f23397f Add better debug messages to output 2011-03-03 23:14:52 +00:00
james
4c15b72a8b and finally, fix special awards registration in teh system 2011-03-03 22:42:49 +00:00
james
2d2b9f4ef2 Update project page and status 2011-03-03 22:40:35 +00:00
james
020bebc1ab Fix project saving when session registration id isnt set properly, but we have it from the user object 2011-03-03 22:33:52 +00:00
james
b9d8a9c8c5 catch a few more role/add errors, and show more debug if it (by chance) hits the defualt case 2011-03-03 22:17:05 +00:00
james
3360fe95eb Tweak signature page 2011-03-03 22:04:11 +00:00
james
056d4d23bb Updates to old participant pages to work with new user system 2011-03-03 21:55:05 +00:00
james
4aced55922 Remove 'special awards' from participants user profile, it shoudlnt be there! 2011-03-03 21:38:35 +00:00
james
f31cc5c5fa remove the not used special awards section 2011-03-03 21:20:30 +00:00
james
b1940cbb9a Don't let students sign up for more special awards than tehy are allowed to 2011-03-03 20:58:54 +00:00
james
42ba7a3db9 Pass in the registrations id for the user 2011-03-03 20:55:12 +00:00
james
39dd0e6897 Some adjustments to student status, and make the old "main" page start to work again 2011-03-03 20:52:17 +00:00
james
bd4eb9a9cc Reorder status array for Michael
Remove registrations_id from field list
Adjust remove dateofbirth in favour of birthdate
2011-03-03 19:24:49 +00:00
james
699e12523f make foodreq field based on configuration
api registration/fields accepts both string (to json decode) or a post array, so the testapi page works
2011-03-03 18:11:36 +00:00
james
6ca366e1b8 Oosp actually put in the db update too 2011-03-03 17:39:14 +00:00
james
d0702e9dc1 Add participant_fields and participant_required_fields 2011-03-03 17:37:56 +00:00
james
9b1e3fa964 Add judge completesections
Fix typo in participant page
2011-03-03 16:34:22 +00:00
james
bca687a50e tweak studnet status, rename functions to make more sense
particpants 'role' is now complete if their own personal info is complete
registration status is now separate and dictates whether the registrations overall status is complete or not
2011-03-03 16:24:09 +00:00
james
17d15584d0 Only check single user complete status for their 'role' to be complete
The overall registration status is now done completely separate
2011-03-03 16:15:48 +00:00
james
04283b7383 Add ability to edit users from the account_list
TODO: force user to join a conference if they dont have a user record for the conference yet (then roles cna be added, like say, committee :p )
2011-03-03 05:44:49 +00:00
james
f58e53cdb8 Okay really completely get rid of the role if '{$type}_enable'=='no'
Move account_list to main admin page
2011-03-03 05:36:36 +00:00
james
8588846591 Undo the roletype change, i think there's more going on here than i originally thought.. it hink we use the $_SESSION['roles'] in two different ways at some point, fixing one breaks the other, need to investigate more 2011-03-03 05:32:46 +00:00
james
5ce75f9a82 Allow uninviting participants 2011-03-03 05:13:29 +00:00
james
a5eeefa195 Dont display anything for volunteer registration if its complete disabled
Tweak setting school id when inviting participants when an account is both a teacher AND an admin (still need to set the school!)
Disable registration_list for now, so Alison doesnt try it and see it broken and get frustrated
2011-03-03 05:03:44 +00:00
james
002704889b Add doc for nummentors to project object 2011-03-03 04:43:03 +00:00
james
22b4d119f6 Move nummentors to project object
Remove registration/edit (we dont need to post anything back... for now...)
2011-03-03 04:42:13 +00:00
james
26e4204015 Fix a bug in loading users (cant call user_load() within any function that is called within user_load itself, like all the individual page checks -- in this case, emergencycontactStatus()
Add special awards display to project/view
Add special awards saving to project/edit
2011-03-03 04:24:21 +00:00
jacob
b9fbc56372 A start on adding the special awards API 2011-03-03 03:00:35 +00:00
james
95bbdab5f6 Add safetyquestions as part of the project/view and project/edit API 2011-03-03 02:57:40 +00:00
james
4fe1b04db3 Few code touchups, emergencyContactStatus pulls from users not students 2011-03-03 02:23:47 +00:00
james
0b50b6b8f8 If a registration role type is completely disabled (via "{$type}_enable"="no") then report "not available" for that role, regardless of what the registration_type says 2011-03-03 02:18:15 +00:00
james
cd140c198a Add basic project info to registration/view 2011-03-03 01:53:04 +00:00
james
0d365bc731 mentors are also incomplete if we have less than we say we're gonna have 2011-03-03 01:46:37 +00:00
james
04dcd31b6a Oops registration_id not registrations_id
Also fix the roletype error on main page
2011-03-03 01:36:41 +00:00
james
53b155215d Add missing } 2011-03-02 23:58:38 +00:00
james
648e1bb031 Oops move registration into the righ tsection 2011-03-02 23:56:13 +00:00
james
9ff6a1cf58 Tweak doc 2011-03-02 23:53:35 +00:00
james
87940b54de Add API registration/view
Add API registration/edit
2011-03-02 23:52:44 +00:00
jacob
b955b01965 Erg - indeed, a fix for something I overlooked 2011-03-02 23:00:14 +00:00
jacob
0c6f1c3b70 Added the necessary code for updating the grade category that a project belongs in whenever it or it's participants are modified. 2011-03-02 22:41:26 +00:00
james
1749d8c67b Fix the contact form 2011-03-02 21:17:59 +00:00
jacob
902e45fe2e Missing function definition. Not sure why that didn't show up before... 2011-03-02 20:39:57 +00:00
jacob
c0b592dbd1 A quick catch to avoid errors on checking a students registration info when they have none 2011-03-02 20:28:20 +00:00
james
44ac9e6640 Remove registrations_id from one other place too 2011-03-02 17:46:53 +00:00
james
6f882b38b9 Remove registrations_id from the mentor object, it gets set when a mentor is added automatically, but should never be changed 2011-03-02 17:45:36 +00:00
james
693fb1e398 Oops fix is_array typo 2011-03-02 17:39:13 +00:00
james
46f292ba16 Switch mentors to only be "edit" instead of "add and edit"
If a id exists, it is updated
If no id exists, it is created

edit now returns the full mentor view array
2011-03-02 17:18:13 +00:00
jacob
e538262cc6 Update to user_load to ensure that the roles statuses are directly checked upon loading the user. 2011-03-02 17:12:13 +00:00
james
86ab58acac Fixes to maek signature page work 2011-03-02 16:50:28 +00:00
jacob
e7fac7406f Some user data that was expected in the session was not getting updated
on the user load.  Fixed.
2011-03-02 15:57:38 +00:00
james
5f289a6761 Update signature page to properly pull student info from users instead of students 2011-03-02 14:41:32 +00:00
james
5dba209aae Fix json_decode, we need the second parameter to specify an assoc array instead of an object 2011-03-02 14:26:18 +00:00
james
0e45df5df8 Add page_text's for participant and teacher invite only 2011-03-02 06:41:14 +00:00
james
1bc55cf742 Add two missing emails (for teachers and participants) 2011-03-02 06:26:33 +00:00
james
32b3d1d368 Add a quick and dirty participant_invite page to allow teachers to invite participants, since the teacher interface hasnt been created yet on the drupal side 2011-03-02 06:22:27 +00:00
james
963e1cdd31 Update wording on school info page to be more clear 2011-03-02 05:25:31 +00:00
james
0c3f01f238 Put a useful link on the main page, since there's nothing else 2011-03-02 05:25:00 +00:00
james
ead770775d Make sending emails with HTML work properly if there's no HTML yet 2011-03-02 05:24:09 +00:00
james
2b808e5e48 Make school feedback work 2011-03-02 05:23:38 +00:00
james
d6efd6749e Tweak the docs 2011-03-01 20:09:33 +00:00
jacob
e10d31f2c8 Updated the api for api/project/mentor/add and api/project/mentor/edit. Both now accept an array of
mentor arrays (now referred to as 'mentors' instead of 'mentor').  /edit will only accept an array,
but /add will accept that or no parameters to generate a fresh empty record.
2011-03-01 19:57:05 +00:00
james
3419f06b0b emergencycontact ORDER BY id 2011-03-01 17:59:08 +00:00
james
d3801e5a17 mentor/view ORDER BY id 2011-03-01 17:58:13 +00:00
james
ec5736c29f Return associated array instead of indexed on addMentor 2011-03-01 17:56:13 +00:00
james
3cf5b38994 Fix path of ajax script for user select autocomplete
Add label to the field so they know what to type in
2011-03-01 16:21:29 +00:00
jacob
143b255375 Oops - needed to move a line with some other modified code. 2011-02-28 21:54:21 +00:00
jacob
a773a76ed9 Quick touch-up on the user structure, adding a subset to the user role status for the participant role. Fixing also (I think) the problem with users always seeming to have the complete status 2011-02-28 21:45:51 +00:00
james
69bc561055 allow project/add and project/mentor/add to pass in an corresponding input array, and save that into the newly created project/mentor 2011-02-28 19:00:24 +00:00
jacob
2eeff8d688 Moved participant registration completion checks into participant.inc.php, and added the participant_status_update function to call them all and find get the total status.
Updated judge.inc.php and volunteer.inc.php - they were previously putting the complete status for a role into the user object as a separate value (eg. $user['judge_status'] = 'complete';).  Updated that to put it in the user's role list directly (eg. $user['roles']['judge']['status'] = 'complete').
Updated register_participants_namecheck.php to use the user table and check the session against the normal user_auth_required.
2011-02-25 22:30:50 +00:00
jacob
d10d5f3835 Quick fixes:
1) desk and outlet information no longer required when saving a project if they're not required in the config
 2) Updated the project/save api to have consistent return value with other api functions
2011-02-25 16:19:15 +00:00
jacob
82746f754b Added the emergencycontact info to the code describing the structure of the user object (user_get_fields). 2011-02-24 18:42:46 +00:00
jacob
2ec08b64d9 Adding additional student fields to the users table
Added name confirmation to the api in api/user/displayname/get and pi/user/displayname/confirm
2011-02-24 17:44:12 +00:00
james
0968725a5f Adjust Dennis's conferences editor commit slightly 2011-02-23 23:18:06 +00:00
james
4ba97420ee Forward port the new 'custom - judges - all years' report 2011-02-23 23:12:42 +00:00
james
b9c95e8719 Oops remove the second unneeded parameter 2011-02-23 23:06:20 +00:00
james
3ac1d9f92d Forward port translation changes 2011-02-23 23:05:27 +00:00
james
56119710a0 Upgrade TCPDF from 5_3_00 to 5_9_056 2011-02-23 22:42:29 +00:00
james
4f319cea75 tcpdf supports png's internally as well, and png's give better color results in the final pdf (see simcoe county logo!) 2011-02-23 22:33:30 +00:00
james
ac334f2534 Add working school editor -- some things in it will need to be refactored out, but for now, just leave it as is so alison can get to editing her schools 2011-02-23 21:57:33 +00:00
jacob
19676aa403 Modified the authentication api to store project registration id and registration number in the session.
Updated the project api's to use project id/number stored in the session
2011-02-23 21:12:12 +00:00
james
0320f662dd remove the student table from the register_participants_signature auth
add 'participant' to the auth requirement for projects in the API
2011-02-23 19:30:50 +00:00
james
06fdbe1621 Fix commmittee member management page to work with new user system (and to force committee rollover since we didnt do it on rollover) 2011-02-23 18:50:46 +00:00
james
22a46874ee Misc login/invite fixes 2011-02-23 17:50:06 +00:00
james
518472136d Update the account list with more details 2011-02-23 17:48:44 +00:00
jacob
74cfb14bf4 minor touch-up: don't need to load the emergency contact's id when loading it as part of the user object. 2011-02-23 17:35:50 +00:00
james
fa3a661b62 Allow superuser to edit other peoples accounts
Show pending email if there is one
2011-02-23 17:09:39 +00:00
james
6b37f4b721 Move user_editor_window to the root, so it can share a common user_edit_tabs.inc between user_edit (for the logged in user) and user_editor_window (for admins to edit users)
Start fixing the school editor (not done yet)

Update jqueryui (1.8.9) and jquery (1.4.4 - NOT 1.5 - 1.5 causes conflicts with autocomplete and validaotor plugins)
2011-02-23 16:45:00 +00:00
james
79baaa37b6 Make password optional for create account (it'll pick a random one if not specified) 2011-02-23 16:42:08 +00:00
james
a484939f1b Move openeditor() to sfiab.js common file, and update references to it 2011-02-23 16:40:17 +00:00
dennis
ee657d49a1 Dennis. Changes allow 'installation' in windows servers (and others) Complete functionality in windows servers still 'in work' 2011-02-22 21:54:34 +00:00
jacob
6c0e0cb0ca Added emergency contact info as an array member of the user object.
Updated register_participants_emergencycontact.php to link emergency contacts directly to the users, and allow multiple emergency contacts for a single user.
Added the users_id field to the emergencycontact table, allowing that direct link.
2011-02-22 20:52:54 +00:00
james
ab566836e7 Upgrade jquery and jqueryui, so we can use built-in autocomplete 2011-02-22 17:50:14 +00:00
james
a451a47a94 Fix displaying science head emails, and add them to the list-view as well for convenience 2011-02-22 15:49:06 +00:00
james
7eb89d98a2 use addTable instead of add_table for consistency between interfaces 2011-02-22 15:24:19 +00:00
james
1d2642527e Add a simple index to the top of the APIDOC page 2011-02-21 22:17:58 +00:00
james
8d7eb7ca72 add api/project/signatureform API 2011-02-21 22:07:06 +00:00
james
8aaff3cbd7 Add another missing semi-colon 2011-02-21 21:40:52 +00:00
jacob
f22dfb3c93 Added project mentor management to the api, and functions for testing it 2011-02-21 19:42:13 +00:00
james
e06eb7dbd8 Add missing ; to 194
Remove duplicate INSERT of roles (its in 193, no need to do it again?!)
2011-02-21 16:22:29 +00:00
jacob
64ef61d88f Added api functionality for disconnecting a user from a registration : api/project/remove 2011-02-18 21:53:07 +00:00
jacob
f785a71be2 Oops - removed debug output from the project/new api.
Updated getProject to take userId as a parameter, rather than the registration number.
2011-02-18 20:48:56 +00:00
jacob
40e139b7a1 Fix for logical error in how I connected users to registrations. Had the wrong ID field connecting them. 2011-02-18 20:25:47 +00:00
jacob
e6dfe1c476 Added joinProject function in register_participants.inc.php, and added the api for it at /api/project/join 2011-02-18 19:19:56 +00:00
jacob
c1d248dbd3 Added the soulmate for a lonely opening brace. 2011-02-18 17:12:32 +00:00
jacob
6519392bd5 Added getRegistrationsId() function, returning the registration ID for the specified user 2011-02-18 17:05:07 +00:00
james
96f36d4681 Implement project\/view 2011-02-18 16:56:35 +00:00
jacob
340a45127b Added code preventing users from creating more than one registration/project 2011-02-18 16:46:44 +00:00
james
3c0151263f Convert project/edit to pass a 'project' object as JSON instead of individual fields 2011-02-18 16:37:11 +00:00
jacob
ef4a14a386 modified the project/add API to not expect any data, but simply create the project. 2011-02-18 16:14:23 +00:00
jacob
3745d8cfd9 Added api functionality for creating and saving projects 2011-02-17 22:04:47 +00:00
james
b71a0dc994 email_send should send html version of email if we have it, also dont translate the subject & body thorugh i18n() 2011-02-17 16:36:17 +00:00
jacob
dfb54ec9df Added date of birth, food requriements, t-shirt size and medical alert info to the users table as student fields 2011-02-16 19:08:58 +00:00
james
93f4703b71 Add account_list (temporary hack)
user_invite can find users by username OR by email address
if the account is found, but user_load fails, thats okay, it just means that they dont have any roles yet
2011-02-16 18:39:59 +00:00
james
4ac3a8f974 Revert Dennis's commit - improper line endings caused the whole files to be replaced 2011-02-16 16:59:33 +00:00
dennis
ce35d4ccee Changes by Dennis. Required to provide for a clean install on Windows server ISPs (also my Windows xp workstation with PHP and mySQL). There should be NO changes to functionality. 2011-02-10 14:46:58 +00:00
james
221213e1d8 Add grade to participant required fields 2011-02-02 23:19:15 +00:00
james
ebc7d7ad1d Fix the other two places that used the array_diff_assoc incorrectly (by simply removing it) 2011-02-01 21:59:06 +00:00
james
b4d018f771 Fix user_save to properly update the status of all roles that the user has
Fix special awards tab to load&save properly
Fix volunteer positions tab to load&save properly
2011-02-01 20:10:11 +00:00
jacob
347b12ab2e Oops - only update the session user id for the newly created user if it's the same account and the same conference as the one doing the user creation 2011-01-28 20:16:43 +00:00
james
8714fe7a1d Fix invitation emails 2011-01-28 20:02:21 +00:00
jacob
ceb55a49a6 Add a user id to the session when someone adds a role (and thus a user) to an account that does not currently correspond to any user records. 2011-01-28 19:57:09 +00:00
james
462427c1b1 Fix divisions insert check 2011-01-28 18:22:18 +00:00
james
cb6796b95d Languages group fix 2011-01-28 18:12:30 +00:00
james
349af780ed Email address fix for user_list (now show accounts.username and accounts.email) 2011-01-28 18:01:31 +00:00
jacob
552ce74d96 Couple of quick fixes:
- the "languages" field needed to be regrouped when applied to a Science Olympics account
 - Modified account/create api to test all errors and return them as a group, rather than exiting on the first error
2011-01-27 22:55:42 +00:00
james
a5bd01f621 Bunch of fixes 2011-01-26 23:15:58 +00:00
james
97076cbe32 Add function to copy schools from a different conference.
fix the user_load_by_uid calls, but im not sure if simply replacing them with user_load() is the 'right' fix.. but at least the page loads now :p
2011-01-11 20:10:51 +00:00
james
9230b559db Forward port mysql 5.1 16 character username limit difference 2010-12-30 14:24:05 +00:00
james
e0f0a5dd90 Re-do user_invite to allow users to be invited by admin/config's - its not complete, but its working, it still needs to send emails though to tell the user of their new role, but i need to think on how to do that because if its a new account then it could be just a username/password without an email, but if its invited then the email __IS__ the username, but we shouldnt rely on the email being valid until its been confirmed via the email confirmation.. ugh?!?! 2010-12-21 23:16:20 +00:00
james
8f2e8f985b Adjust wording slightly 2010-12-21 22:57:46 +00:00
james
beac7bb44e Forward port the "auto-select novice" change 2010-12-16 16:56:49 +00:00
james
459eb17e98 Add a hidden config option (put it in data/config.inc.php) to not require API access over SSL 2010-12-08 21:18:07 +00:00
james
8f17e80169 If there's less than 2 conferences (specifically, 1 conference) then dont show the conference selector in the header 2010-12-07 19:29:02 +00:00
james
673b0b51f8 Make conference saving work again 2010-12-07 19:26:39 +00:00
james
e278505bc0 Simplify the user list and make it work again 2010-12-06 20:26:39 +00:00
james
39ff0dd2ce More fixes to (hopefully) allow a superuser to add admin/config roles 2010-12-06 19:33:38 +00:00
james
0acf5a5661 Allow superuser to always access admin/config even if its not in their session roles 2010-12-06 18:33:02 +00:00
jacob
8817e5eb86 Updated the user loading to only include fields that are relevant to the roles, accounting for the fact that certain roles (eg. juge) have different fields for different conference types. 2010-12-02 20:28:19 +00:00
jacob
336cec80e0 Quick fix for an error showing up in some field types for the api
Added an error catch, re-indexing the languages array when a user is saved, to ensure that the indecies are numeric
2010-12-02 18:43:35 +00:00
jacob
77a3c77e69 oops - forgot to remove debugging remarks 2010-12-02 17:54:01 +00:00
jacob
dfd468505c Modified the api loging for better readability and to include the output 2010-12-02 17:50:16 +00:00
jacob
128fc6a3b5 Added logging to the API, and separated the log file creation into a common function 2010-12-02 17:25:23 +00:00
jacob
a6544f40c4 Added an error check in saving the user, avoiding duplicate keys on an insert if bad data is passed in. Touched up the error output to make finding errors a pinch easier. 2010-12-02 16:33:04 +00:00
jacob
6b94ef5c76 Added abillity to uninvite a user from a particular role where allowed, and api function (/user/uninvite)
Added function user_list_modifiable, which returns a list of user info that the current user is allowed to modify (users.inc.php)
Added api for calling user_list_modifiable (/user/list)
2010-12-01 19:40:45 +00:00
jacob
39f53e4168 Added teacher abillity to add/remove students
Updated the user_save to output more meaningful errors
Updates on 'questions' and 'pagetext' tables to change the 0 conference ID to -1, matching the -1 year
2010-11-29 22:54:12 +00:00
jacob
1e1fa0097a Updated super/conferences.php, adding a rollback if there are errors in copying a conference.
Added compvars.php, which is a test script for comparing data after it's been rolled over from one conference to another - used to test the rollover in super/conferences.php.
Updated usage of the role "student", replacing it with "participant".
2010-11-26 16:50:17 +00:00
james
57561c829d Add copyoriginal and copyparent to API 2010-11-25 20:47:32 +00:00
james
46b39f81e0 Add copyoriginal, copyparent, and notes(currently unused) to conferences table
Add code in create conference and copy conference to set copyoriginal and copyparent
Add missing json_decode to API (we expect ALL arrays being POSTED to be json encoded)
2010-11-25 20:45:44 +00:00
jacob
e9f46edb0e Added code for inviting users, access to it through the api 2010-11-23 20:58:38 +00:00
jacob
8f255f4eb8 Added an icon for conference management. Added fields in the config for teachers 2010-11-18 22:46:46 +00:00
jacob
0720cb0ae0 Updated super/conferences to properly manage existing conferences, and touched up it's UI to fit the site theme 2010-11-18 20:44:48 +00:00
james
63178e596b Add dictionary documentation
Update Test API page to link to apidocs and dictionary
2010-11-18 17:24:18 +00:00
jacob
1701e965ef Added a quick link to test api/registration/dictionary 2010-11-18 17:10:53 +00:00
jacob
8b15620f69 Added the api/registration/dictionary functionality 2010-11-18 17:00:26 +00:00
jacob
e730a5ab05 Added the rollover for the fiscal year, and removed the rollover for the fair year 2010-11-18 16:38:12 +00:00
jacob
f6eee9666a Updated to properly use the user_save function 2010-11-18 16:02:11 +00:00
jacob
31baeaa715 SQL error fix 2010-11-18 15:59:22 +00:00
james
a8b0adce05 fix typo 2010-11-17 23:47:37 +00:00
jacob
1b098f85b3 The API depends on a return value from the user_save function, which was not being generated.
Updated user_save to return 'ok' on success, and an error message otherwise.
Updated api.php to make use of user_save's retun value.
2010-11-17 21:02:32 +00:00
jacob
6c5669c3f4 Arg - accidentally committed with a data dump... 2010-11-17 16:37:44 +00:00
jacob
1972323a65 Correction on how the multiselect fields are described 2010-11-17 16:12:10 +00:00
jacob
2848ed177d Quick correction on how lang is described in the user_get_fields function 2010-11-17 15:52:02 +00:00
jacob
0ff766175b Updates on the data that gets returned when describing the user structure
Modified user code to properly save the volunteer availability data
Updated the UI to properly use the user_save function to update judge and volunteer info
2010-11-16 22:51:42 +00:00
james
61fba8a93c json_decode always returns an object unless you tell it to give you an associative array (2nd parameter)
give multi-select-lists as full object's where appropriate (might be more too? special awards?)
2010-11-16 21:19:16 +00:00
jacob
a0c64963e0 small mod on user save function 2010-11-16 20:54:46 +00:00
jacob
cf2e2eb6db Modified some of the user preference data as it's stored in the user array 2010-11-16 20:42:40 +00:00
jacob
1e2340beb1 Some updates on the interface for creating conferences
Modified the user object, correcting some issues with judging availability and volunteer availability.
2010-11-16 19:53:26 +00:00
james
7113a3df95 Oops, i never committed this before - add configerence id as an optional parameter to /auth/login 2010-11-16 04:29:16 +00:00
jacob
00f380483b Rewrote the installation script to deal with conferences
Writing UI components to create conferences from within the user interface - still buggy
2010-11-10 23:05:24 +00:00
jacob
a3b72f7aa3 Altering tables projectdivisions, projectsubdivisions, and projectcategories, changing their primary keys from (year, id) to (conferences_id, id) 2010-11-10 19:25:46 +00:00
jacob
a7a7735347 Added grouping to the list of user information fields 2010-11-10 18:47:01 +00:00
jacob
769d5ee969 A quick fix. The award_awards_table had the conferences_id set to 0 where the year was -1. Modified it to match. 2010-11-05 17:48:19 +00:00
jacob
88c6d9a0dd Further updates in migrating to conference id 2010-11-03 20:59:03 +00:00
jacob
c3cf698524 Updates converting from year to conference id. 2010-11-03 17:18:02 +00:00
jacob
54070f1836 Several updates on migrating from fair years to conference id's 2010-11-02 20:35:47 +00:00
jacob
1c1a0673c3 Adding conferences_id to the last two tables that need it 2010-11-02 16:24:04 +00:00
jacob
89475dae93 A quick function update 2010-11-01 21:51:27 +00:00
jacob
e4d94ffca2 Updated the communication queries in communication.inc.php to use the conferences system rather than fair years. 2010-11-01 21:23:17 +00:00
jacob
5e0886c812 Minor correction 2010-11-01 17:21:58 +00:00
jacob
ca0e700952 More conversions from fair year to conference id 2010-11-01 17:14:42 +00:00
jacob
d8df2be109 Quick patch on my last commit. 2010-11-01 15:28:51 +00:00
jacob
21261a99af Many updates of queries, switching from usage of FAIRYEAR to conference_id. 2010-11-01 15:24:59 +00:00
jacob
4f35702bbf Added API function for modifying account information 2010-10-28 21:22:12 +00:00
jacob
d0d3c7b7c4 Separated the functionality of school selection from the pages, implemented it in the API 2010-10-27 16:40:17 +00:00
jacob
f1b9123835 Added a couple of field descriptions in the user fields 2010-10-26 19:38:08 +00:00
jacob
92d46976f7 Separating judging timeslot selection into the user object 2010-10-26 18:15:04 +00:00
james
0bcd811101 Fix passing in role list by ids 2010-10-25 23:58:48 +00:00
james
3971df267f Add registration field roles to testapi.php page
Fix char(2) field detection
2010-10-25 23:55:38 +00:00
james
19e146547f Fix api registration fields when roles ar epassed in
roles can be passed in as array of ids or array of types
2010-10-25 23:12:35 +00:00
jacob
bb40bf4da1 Updated the user_load and user_save functions to handle judges special awards selection.
Updated judge_special_awards.php to use that method rather than direct SQL queries.
2010-10-25 18:07:55 +00:00
jacob
7625c2e309 User settings touch-ups 2010-10-22 21:17:25 +00:00
jacob
cee52c6b67 Updated function for getting user info structure. Used it in the user_load function. 2010-10-22 18:43:17 +00:00
james
a5887bdf96 Oops fix the docs 2010-10-22 15:12:45 +00:00
james
a035a6f8e3 Add registration/fields API
Fix $roles array use colliding with global $roles array ($roles should never be used anywhere! its a master list of all of the roles set in the bootstrap!)
2010-10-22 15:06:49 +00:00
jacob
bae700dead Starting on code for getting relevant field descriptions for user data depending on
the roles for that user.
2010-10-21 21:56:09 +00:00
jacob
3867b9b539 Fixes on the modified user_load function 2010-10-21 16:08:41 +00:00
jacob
b9bcb127a6 Updated these tables to include the conference id:
award_awards
	award_prizes
	award_types
	award_awards_projectcategories
	award_awards_projectdivisions
	winners
	students
	projects
	registrations

Also modified all code that uses those tables to work with the conference id
instead of the year, with the exception of these files:
	communication.inc.php
	reports_students.inc.php
	rerollprizes.php
	remote.php
The "rerollprizes.php" probably doesn't matter, having been a one-time usage
file anyway.  The others will need to be modified in the future to correctly
use the conference id instead of the year.
2010-10-20 21:58:26 +00:00
jacob
78bf0c8751 Modified user_load to load only fields relevant to the roles that the user has 2010-10-20 19:44:18 +00:00
james
a792b763a1 remove username from the standard user fields
add 'required_fields' array to the user object so the API users know which fields are needed
2010-10-20 17:25:43 +00:00
james
c367656d02 also load committee whether its active or not 2010-10-15 01:46:53 +00:00
james
ab068fdfbb Fix updateSessionRoles once and for all 2010-10-15 01:31:07 +00:00
james
759ecc0a1a Oops its user_load not users_load 2010-10-14 23:06:21 +00:00
james
f225787e39 Properly update the session roles from the API side
Allow (u) to be empty if we dont have it, we can get it from the session users_id
2010-10-14 20:38:48 +00:00
james
241618c74f Fix saving active/deactive roles
Fix the session roles when roles are modified and only put 'active' ones into the session roles array
2010-10-14 20:31:10 +00:00
james
ba793ac8e0 Fix rolestasks saving of the level for each item
Fix tableeditor css to only modify anything in the tableeditor/tableview classes
Fix saving language for volunteers
Fix error message for saving phone numbers on organization and personal
Fix schoolfeedback and schoolinfo pages
Update school select tab, better html and school options list
Fix css for tertiary menu to show difference between selected and non-selected
2010-10-14 19:42:20 +00:00
jacob
01d70abf74 Added teacher interface in olympics
UI touch ups
2010-10-14 17:51:56 +00:00
jacob
4a3ea7dba9 Changed the scienceolympic judge settings to a generic activity selection tab (replacing so_judge_other.php with activities.php)
Altered use of schedule_users_availability_link.  It no longer distinguishes by role.
2010-10-14 15:26:47 +00:00
james
e55a6f901a fix schedule display boxes to be the same for FF/IE/Chrome
Add min/max judges/volunteers/teams
Add defaults
Update science olympic tab display
Add Teams/Volunteers/Judges status to admin schedule view
2010-10-14 15:11:52 +00:00
james
2b4b42c250 Dont make jquery elements bigger, it messes stuff up! 2010-10-14 14:31:16 +00:00
jacob
8e4306ae3b Updated volunteer preferences to work with the new interface and with the new conference id system 2010-10-14 14:10:49 +00:00
jacob
9229b1665b Added user settings config for science olympic judges 2010-10-13 21:01:01 +00:00
jacob
941b5e127f Quick correction on automatic e-mail 2010-10-12 18:00:17 +00:00
jacob
f0d1578ac3 Added generic "account" password recovery 2010-10-12 16:49:38 +00:00
jacob
607834bc0e updating _SESSION when user roles are modified 2010-10-08 20:28:56 +00:00
jacob
7d5f5cccd0 Removed some usage of old user functions. Added role handling in testapi.php 2010-10-08 18:43:20 +00:00
jacob
835047f3a8 Role functions debugged in account.inc.php, using them in user_main.php and user.inc.php 2010-10-08 16:07:07 +00:00
jacob
177f49f805 moving code for modifying user roles into accounts.inc.php. Incomplete. Broken. 2010-10-07 22:02:45 +00:00
james
fce116316e Implement the role/* functions 2010-10-06 21:01:17 +00:00
jacob
98dcfd6399 added some skeletal function stubs 2010-10-06 20:01:15 +00:00
jacob
daa714e5ef Added functionality in the main page for managing roles 2010-10-06 17:05:54 +00:00
jacob
052024b6d6 Updates for letting users register in roles. Incomplete 2010-10-05 21:46:29 +00:00
james
e590c94690 Fix api for categories (projectcategories_load wouldnt have ever worked!) 2010-10-05 20:24:43 +00:00
james
4ddbffe4bb Oops, guess i should test before committing -- this fixes the syntax error, as well as allows more weird chars to be properly set and saved as division/category titles 2010-10-05 20:18:32 +00:00
james
e7222337f7 Fix a typo 2010-10-05 19:45:28 +00:00
james
eb1012f7c5 Oops, also bump the DB version so it runs the new updates 2010-10-05 19:45:05 +00:00
james
4f42407073 migrate categories/divisions/subdivisions from FAIRYEAR to conferences_id
rename API call /config to /config/variables
update API with /config members for divisions/subdivisions/categories
2010-10-05 19:43:30 +00:00
jacob
d2afb6a94e Modifications on how roles get handled 2010-10-05 15:04:15 +00:00
james
898bdaacfc Oops put account/edit APIDOCS back in 2010-10-01 21:06:57 +00:00
james
f0b362eff7 Add account/view api 2010-10-01 21:04:05 +00:00
james
a92544bbea Implement user/edit
Remove saving some stuff from user_save
2010-10-01 19:42:52 +00:00
james
895bcc36e2 Add user/view API
Change user_load() to explicitly load specific values instead of all values, as there's now some fields that need to be deleted but we cant delete them yet...
2010-10-01 19:28:26 +00:00
jacob
9db042fc10 Modifications on editing users 2010-10-01 18:47:28 +00:00
james
e0eef7effa Add /api/config 2010-10-01 17:13:48 +00:00
jacob
88055eb6a6 oops - committed with some code remarked 2010-09-30 14:41:08 +00:00
jacob
637a35ca60 Separated (un)registering teams for events into schedule.inc.php and added it to the api 2010-09-29 21:23:54 +00:00
james
8b2de95005 Be a bit smarter with "notimplemented", add API impelmentation status, and basic details to the apidocs page 2010-09-28 20:37:44 +00:00
james
b5ed7c174f use 'events' and 'locations' instead of 'list' in the return object 2010-09-28 20:24:32 +00:00
jacob
0a02525d14 Added some API functionality used in schoolschedule.php 2010-09-28 20:09:31 +00:00
james
eb3c8f0d77 Add not implemented API comments of what still needs to get done 2010-09-28 19:48:03 +00:00
james
cbcb1743ce add class clear to CSS so menu's work properly again 2010-09-28 19:07:31 +00:00
james
3e8271c869 Make apidoc valid html 2010-09-27 20:51:16 +00:00
james
c413d54f6d a few apidoc cleanups 2010-09-27 20:50:37 +00:00
james
0f9588cdf4 Add APIDOC for the rest of the existing api 2010-09-27 20:45:57 +00:00
james
08340544d9 Add api documentation 2010-09-27 20:38:49 +00:00
james
54bf2201de Oops fix typo 2010-09-27 20:04:12 +00:00
james
55bdb2aec5 Add account/create API
Start adding some basic APIDOC comments to be parsed out into documentation later
2010-09-27 19:52:43 +00:00
james
64a0432c55 Add account registration and email address confirmation 2010-09-27 19:13:56 +00:00
jacob
c009ef1e3a Added user_school.php, a form tab for user to select the school to which they belong. Updated user_edit.php to use it. 2010-09-27 16:14:09 +00:00
james
bce4bdb2b2 Change "pageid" and "NAV_PAGE_ID" to "navident" and "NAV_IDENT" and add the field to the database
Add schedule class details to "new" theme
2010-09-23 21:09:04 +00:00
james
8282ceaf96 need tbody for tablesorter 2010-09-23 17:21:47 +00:00
james
ff3ab7151e Handle topic-menu headings that arent linked 2010-09-23 17:07:19 +00:00
james
a6ec8ef874 Fix the SESSION debug output 2010-09-23 16:41:40 +00:00
james
ffd09ae67e Fix clicking on secondary nav 2010-09-23 16:37:19 +00:00
james
60c6235649 Re-write the naviagation agian - no more ajax menus, and it auto-selects the first secondary and first tertiary pages when clicking a higher level 2010-09-23 16:17:24 +00:00
james
2292af3206 Use div_prefs and cat_prefs (make the scheduler work again)
Give higher preference to not having leftover judges
Treat 'indifferent' cat_prefs as cost=0 even though its a 2 (on the 0-4 scale)
2010-09-22 18:28:51 +00:00
james
a8fa8e7a99 Disable DEPRECATED warnings 2010-09-11 00:53:03 +00:00
james
70d359c15b PHP 5.3 DEPRECATED split() so, convert all split()'s to explode()'s 2010-09-10 19:38:56 +00:00
useradvocate
517563a97a TUAG- various tune ups to HTML,CSS 2010-09-09 20:13:48 +00:00
useradvocate
5dab48e574 TUAG- various tune ups to HTML,CSS 2010-09-09 20:13:29 +00:00
useradvocate
eef65869bb TUAG- various tune ups to HTML,CSS 2010-09-09 20:13:10 +00:00
useradvocate
755b9c8560 TUAG- various tune ups to HTML,CSS 2010-09-09 20:12:41 +00:00
james
c9bf5f4227 get rid of the custom fundraising module primary nav 2010-09-09 16:42:40 +00:00
james
07f2aa208e Add class="clear to primary and secondary menu's 2010-09-09 15:22:22 +00:00
james
3913bb397d List all conferences with status in the api call, instead of just the running ones 2010-09-07 19:59:37 +00:00
james
dfb6112e66 Split committee management out 2010-09-03 16:59:05 +00:00
james
a5f309c022 Add session variables and date list by conference to API test page 2010-09-02 19:14:59 +00:00
james
146f557759 Add science olympics teams api to testapi page 2010-09-02 19:01:49 +00:00
james
959843d4c4 Add a simple API test page for checking some api calls
Update /api/dates to use current conference id if one isnt specificed
2010-09-02 18:53:48 +00:00
james
6963b7104b switch conference API 2010-09-02 17:38:13 +00:00
james
c8ada5f7c2 Move the schedule to the teacher account 2010-09-01 19:27:55 +00:00
james
88cdfebdea Move team management to teacher interface 2010-09-01 17:53:35 +00:00
james
d01a3088b7 dd api for managing science olympics teams 2010-08-31 20:50:11 +00:00
james
de564f3c55 More user stuff to get things workinga gain
Add a API module for science olympics
2010-08-31 20:12:41 +00:00
james
ec3be0f10f More changes to be able to at least barely use the system again 2010-08-31 19:41:32 +00:00
james
3766b0a3f6 Fix navigation when loading a page that exists in the nav structure 2010-08-31 17:41:54 +00:00
james
81f3f3235a Fix logging in and switching conferences, man, this is becoming a mess 2010-08-31 17:35:58 +00:00
dave
e03902bbec Merge judge_availablilty into judge_other and delete
judge_availability.php
2010-08-31 07:23:49 +00:00
james
4bf2897f18 Add changes for API Authenication and force API to use SSL 2010-08-24 16:04:12 +00:00
dave
05432715e4 fix spacing 2010-08-24 00:04:57 +00:00
dave
49648aed94 Don't validate it right away, that causes the invlaidHandler to be run
and the form to be submitted (since in SFIAB we actually want to save a
partially-filled but invalid form).  Need anothe way to trigger
validation without also triggering the submission
2010-08-24 00:04:56 +00:00
dave
2db3ce6b9e Validate the form on load so the user can see the problems right away. 2010-08-24 00:04:53 +00:00
james
56707e4941 Oops sort the menu's correctly, and restrict the editor to one less level than before (as per TUAG request) 2010-08-20 19:59:20 +00:00
james
358d413365 Remove the accordion from the tertiary menu, and move the tertiary menu <div> to the <div id="main"> as specified in TUAG's prototype 2010-08-20 18:16:21 +00:00
james
4143f289af A few more cleanups, and unfortunately we cant convert the whole $config to javascript, so just do the SFIABDIRECTORY that we need for now, we can add more later 2010-08-20 18:00:47 +00:00
james
030f2030e8 update classic theme too 2010-08-20 17:47:51 +00:00
james
15d057ae1f Add the missing files 2010-08-20 17:45:53 +00:00
james
69234c1657 Update rolestasks to be conference-type specific
Add a  'new' theme for TUAG to start implementing
2010-08-20 17:40:11 +00:00
james
71b0489493 A few more cleanups, and link the admin and config primary menu icons to real pages so we can remove the (old) links 2010-08-20 15:42:18 +00:00
james
02998f98d6 A few more UI div recommendations and CSS touchups
Make php '$config' array available in javascript as javascript 'config' object
2010-08-20 15:11:11 +00:00
james
a449fce300 Rename system setup page 2010-08-20 14:29:49 +00:00
dave
b4a021411d judge main questions 2010-08-19 22:56:35 +00:00
dave
9f3dc6c9dc Fix user loading 2010-08-19 22:56:33 +00:00
dave
7b454e322a Cleanup the roles page so it's not so vertically abundant. 2010-08-19 22:56:31 +00:00
james
1427900873 Cleanup the temporary user_main page a bit, even though its still temporary 2010-08-19 20:13:43 +00:00
james
78614ef309 Set some redirects to user_edit instead of user_account
Disable the importantdates box again
2010-08-19 20:07:08 +00:00
james
ffcab968d3 move navigation javascripts to a separate file 2010-08-19 18:58:25 +00:00
james
f0907a5d47 Add new div's as directed by UI guys 2010-08-19 18:55:34 +00:00
dave
de52f85ec3 Use a second list for "other things to do". Things like the account
info and role info don't need to be complete/incomplete
2010-08-08 17:15:17 +00:00
dave
79286a56e0 Can we please turn off the important dates for a logged in user. It
gets in the way of everything.  Disabling for now.
2010-08-08 09:13:07 +00:00
dave
ceb80636e1 Start of the new user editor, some works, most things don't. 2010-08-08 09:09:49 +00:00
dave
7faf0fff45 Update user accoutn to make it look better 2010-08-08 09:09:48 +00:00
dave
4ba55b274c Updates to user_personal to use form validator 2010-08-08 09:09:46 +00:00
dave
5112bc5ffb Playing with user_personal.php 2010-08-08 09:09:38 +00:00
james
57f7bd5212 Add conferences and dates api 2010-07-28 21:49:58 +00:00
james
2c7e23b276 Fix some user/account bugs
Start fixing the schoolstudents page (it now adds users, but it doesnt re-load them or edit htem or delete them)
2010-07-27 19:06:36 +00:00
james
32dd83fbde Fix the primary nav 2010-07-23 18:55:11 +00:00
james
d871810065 fix alignment of the top table 2010-07-21 20:19:48 +00:00
james
9e3473dd33 Add another missing <tbody> ... </tbody> 2010-07-21 20:17:59 +00:00
james
589b3aa173 Oops forgot to remove some debug 2010-07-21 20:16:25 +00:00
james
71074eaf24 Get rid of the old (not used anymore) taskNav function
Add some missing <tbody> tags so the tablesorter doesnt choke (every table with class=tableview MUST have a <tbody> element, even if there are no <tr>'s inside the body
2010-07-21 20:14:05 +00:00
james
b4f206c6db Migrate stuff out of primarynav into the login box 2010-07-21 19:27:50 +00:00
james
5d06ea17e6 Fix the bug where the first load of the accordion doesnt populate correctly 2010-07-21 19:20:34 +00:00
james
a4ea8b2f4d More updates to the nav - now keeps track of the accordion tab position, and which link within the accordion is seelcted 2010-07-21 18:37:03 +00:00
james
f704f14134 make sure user_load is called in the right directory
unset session navigation when switching conferences
2010-07-21 15:16:39 +00:00
james
b3ce18ca0c Fix one small issue with db update 204
Allow logging in if the user isnt in the conference (just go to the user_account page for now, i guess eventually it'll need to go to a "register for the conference" page
Some fixes and updates to the menu/navigation, still not perfect, btu getting there
2010-07-21 15:14:32 +00:00
james
aaea2764b6 Spell bootstrap correctly 2010-07-16 16:37:21 +00:00
james
0a4acc7dd5 Refactor checks & startup & initialization/loading to a bootstrap common file 2010-07-16 16:36:44 +00:00
james
ec27794017 refactor all functions except header/footer functions from common.inc.php to common.inc.functions.php 2010-07-16 16:17:03 +00:00
james
e8c8bf33fe Fix some nav issues and start the task of detecting where in teh nav we are if we didnt navigate to the page through the links
Some general formatting cleanups on the common.inc too
2010-07-15 21:24:10 +00:00
jacob
fa69916607 Adding conferences_id fields to judges tables. Will later drop the year fields 2010-07-15 21:18:36 +00:00
jacob
5cd3f22088 migration to new user system 2010-07-15 20:28:35 +00:00
jacob
bffcf724d8 Udated user_list to work with new account system 2010-07-15 20:00:10 +00:00
james
5207e193fc Authenticate and check for superuser on all /super pages 2010-07-15 19:52:44 +00:00
james
ce9bb827ef Finally, a working roletasks editor, complete with drag'n'drop 2010-07-15 19:05:20 +00:00
dave
0c0f139027 Move the javascript include to common.inc 2010-07-15 09:18:08 +00:00
dave
1f5b0697ed Don't need user_password.php anymore 2010-07-15 09:18:06 +00:00
dave
a40100c03f Part of the last commit belongs on this one. Move the user, email, and
password stuff ot of user_personal.php
2010-07-15 09:18:05 +00:00
dave
28004d6fe8 typo 2010-07-15 09:18:04 +00:00
dave
582ffb6586 Don't need to check users_id, user_auth_required does that now. 2010-07-15 09:18:03 +00:00
dave
ba2738b813 Fix redirection on login and on forced password changes. 2010-07-15 09:18:02 +00:00
dave
dd6228f5d7 Implement password expired, force the user to set a new password. 2010-07-15 09:17:59 +00:00
jacob
a403202786 Updates to work with new user system. Also updated the committees_link table fieldname to use "accounts_id" instead of "users_uid" and updated code accordingly. 2010-07-14 21:04:50 +00:00
jacob
004c9b64d2 Partially modified to work with new user account system 2010-07-14 20:26:07 +00:00
dave
c81bc0c7da Save the username link 2010-07-14 19:02:05 +00:00
dave
80537e75f2 Add a field so we can record email->username linkage 2010-07-14 18:57:00 +00:00
jacob
82bdfdbd10 Fixes for issue with record id's 2010-07-14 18:30:04 +00:00
dave
712348dbb9 Fix email checking
user_account now saves info, and does online-checking of usernames.
Form validation is fun!
2010-07-14 18:09:28 +00:00
dave
1697287a35 First-child with CSS 2010-07-14 18:09:26 +00:00
dave
74ecb60f90 We can do the first child thing with CSS, no need to call any
javascript.
2010-07-14 18:09:23 +00:00
dave
994759d660 keep username and email synced if the checkbox is checked. 2010-07-14 18:09:19 +00:00
james
d5912ac1e8 Start un-breaking all the broken UI navigation 2010-07-13 21:23:39 +00:00
justin
45e1e79072 make showing the winners link optional 2010-07-13 20:18:50 +00:00
jacob
6eab783fb6 Fixed an omission in the script - user ID's were not being updated in the users table to point to the appropriate record in the accounts table 2010-07-13 20:07:06 +00:00
justin
8a16a90c0e place pronunciation on one line in the default script (issue 372) 2010-07-13 19:46:51 +00:00
justin
39c402f3f5 and make sure the setting doesn't override an existing school entry 2010-07-13 19:23:18 +00:00
justin
c877ce1f95 automatically select the same school as the first partner when added a second to a registration 2010-07-13 19:16:35 +00:00
dave
83c683063e 6 character passwords 2010-07-13 18:28:13 +00:00
dave
9ce7df3f9b Try without any textinput fudging. Fix the input type, don't use
"email"
2010-07-13 18:27:14 +00:00
dave
0f580472f6 Account editor (that doesn't edit yet) but uses a jquery input
validator.  Had to move the global .error class to div.error and
span.error (the only ways error() uses them).  For the rest of the
cases, like when .error is used to indicate input errors, we should
convert to using the input validator if we're all happy with it.
2010-07-13 18:00:53 +00:00
jacob
a1455b30b6 Three small fixes:
1) Needed to include deleted records that were getting omitted
2) typo in debug output
3) "users" records with a year of 0 get deleted after the corresponding "accounts" record is created
2010-07-13 17:01:50 +00:00
justin
f3403c901c fix some syntax errors, that should be the last of them 2010-07-13 14:39:47 +00:00
james
282c2599ce Put update 196 back in after dave somehow removed it?! 2010-07-13 13:40:44 +00:00
dave
4d8e359049 Fix award ceremony script. 2010-07-13 05:20:38 +00:00
dave
1be2301844 Add an oid field to confrences so we know which conferences are the same
year after year.. we should probably keep the "year" column there too..
it's easier to query that than querying the config variables to find all
the years taht the conference was active (needed for ceremony script and
report generation)
2010-07-13 05:20:37 +00:00
dave
98d264ef67 Rename $_SESSION['conferenceid'] to $_SESSION['conferences_id'] for
naming consistency.
2010-07-13 05:20:35 +00:00
justin
6e464998b5 fix typo 2010-07-13 04:47:47 +00:00
dave
7fb84ea200 Apparently Safari takes the "email" seriously, and won't let anything go
that isn't really an email.. no so good for usernames.  We need a "I
don't have an email" button  or somethign .
2010-07-13 04:33:42 +00:00
dave
ccf1b9c453 Fix an update bug. The code needs to be run to set the conference ID
before we can build a UNIQUE index on the conference id.
2010-07-13 04:25:00 +00:00
dave
b6f43280d7 fix naming and types 2010-07-13 03:54:34 +00:00
justin
024cd25fa6 added warning when registrations have started (issue 255) 2010-07-13 03:33:58 +00:00
dave
7c918c0167 update the user personal information editor, the superuser edit flags
for admin/config/super don't quite work yet.
2010-07-13 03:30:26 +00:00
dave
88f8ce044b Update role activate/deactive page 2010-07-13 03:30:25 +00:00
dave
c3f2e0c589 Update the password change page 2010-07-13 03:30:24 +00:00
dave
2a4b64588d Update /config files too 2010-07-13 03:30:23 +00:00
dave
ad0468e4e1 Convert to new user_auth_required. Some report edits too that I don't
feel like filtering out
2010-07-13 03:30:17 +00:00
dave
8d1c6e1cd4 Add an option to bypass the actual db version update write to the
database, so for testing the same update can be applied over and over
without needing to update the db.
2010-07-13 03:30:14 +00:00
dave
5338adefa9 Remove uneeded function 2010-07-13 03:30:12 +00:00
dave
b1f2718a3c Users can login and logout and look at their home pages. 2010-07-13 03:30:11 +00:00
dave
56987c174a update db version 2010-07-13 03:30:10 +00:00
dave
f5618851dd Remvoe old db update 2010-07-13 03:30:09 +00:00
dave
61a9d73835 Move db updates to 197 2010-07-13 03:30:07 +00:00
dave
801d2580be Add config/admin roles and conversion script 2010-07-13 03:30:06 +00:00
dave
2e17685fc2 More fields for hte account 2010-07-13 03:30:05 +00:00
dave
514c1f12b9 Move my 196 update to 198. Add conferences_id migration to users table 2010-07-13 03:30:04 +00:00
dave
68737a68b7 Move 196 upfdate to 198. I have a big 196 already committeed to my
local tree, and james is working on 197.
2010-07-13 03:30:02 +00:00
dave
54fd1cf19c More judge fields 2010-07-13 03:30:00 +00:00
justin
78f4bcb43a resetting prize form appropriately now (issue 411). Also fixed unreported issue preventing checkboxes in this form from being properly set. 2010-07-13 02:02:31 +00:00
justin
e69e6bc64e fix prize saving so the description is actually saved (issue 478) 2010-07-13 01:03:39 +00:00
justin
4a148a415f allow multiple awards to be marked as cwsf awards (issue 226) 2010-07-13 00:26:39 +00:00
justin
9ef983c671 change "Reports Editor" to "Report Management" (issue 366) 2010-07-12 23:23:52 +00:00
justin
30d01eeb74 eligibility editor now checks that no two divisional awards have overlapping eligibility criteria (issue 249) 2010-07-12 23:11:07 +00:00
james
6021d9f486 Start implementing the secondary menu
Fix importantdates div to not load when the div isnt there
2010-07-12 20:29:20 +00:00
justin
ac450aefdf Add ability to remove all current divisional awards when running this script (bug 233) 2010-07-12 19:47:29 +00:00
james
2c6a491710 Switch doctype to HTML5
Properly float the important dates div
Remove table from page heading icon/title/help icon and use divs/floats instead
Temporarily make the login form post to the login.php page so one can still login
2010-07-12 19:40:06 +00:00
justin
8c12e443b0 enable deleting of fundraising campaigns under certain conditions 2010-07-12 19:02:49 +00:00
justin
54b258e793 remove # from every row 2010-07-11 18:18:56 +00:00
justin
b80a3e0772 add table for project languages. 2010-07-11 18:09:00 +00:00
justin
7b90784828 add support to link to fair website 2010-07-11 14:46:44 +00:00
justin
4cba8caa3c enter salutations using a textfield, not a dropdown. 2010-07-11 13:52:28 +00:00
justin
343f0f8acd fix spelling error 2010-07-11 02:27:00 +00:00
jacob
2563f8295e Fixes for bugs 418 and 412
- when editing awards, the list now gets refreshed upon update
  - increased size of donors notes fields
2010-07-09 21:54:06 +00:00
james
5956a15754 Final UI changes for the day.... 2010-07-09 20:35:05 +00:00
james
39c8d90d1e More UI changes 2010-07-09 20:25:31 +00:00
james
5321de365f More UI recommendations 2010-07-09 19:24:04 +00:00
james
fe5b170371 Re-arrange some stuff as per new UI specs 2010-07-09 19:04:25 +00:00
jacob
b09257b47e Bug #427 asterisks added on judge expertise fields (required fields) 2010-07-09 18:36:30 +00:00
jacob
2aa8e3805a quick patch 2010-07-06 17:50:52 +00:00
jacob
342dbe6cad Oops - correcting a query 2010-07-06 15:47:27 +00:00
jacob
887610f5e3 Added script for copying/converting user data into the new format, populating the accounts and user_roles table
Modified user.inc and user_login to handle authentication on the new accounts table
2010-07-06 15:32:26 +00:00
james
75c806bf7e temporarily set the fairyear in install3 so user_create works? 2010-07-05 20:36:40 +00:00
james
548ebf24db Updates and cleanups to the installer 2010-07-05 19:37:24 +00:00
james
16c5e8ecc9 Switch back to CSS layout 2010-06-28 18:00:47 +00:00
jacob
07f76fdac8 Addded a pendingemail field to the accounts table 2010-06-24 14:45:51 +00:00
james
c086e7e0bb refactor config into config & super pages, 'config' page is now 'conference config' specifically for the conference, all non-conference related tasks are moved to the superuser page 2010-06-23 21:18:06 +00:00
jacob
1743beb14e Populating the roles table, add "superuser" field to the accounts table 2010-06-23 20:45:12 +00:00
james
41ca527d20 Use proper fieldname conventions 2010-06-23 19:58:33 +00:00
jacob
55b5080575 Added new databases for user/role management 2010-06-23 19:45:33 +00:00
james
4faa4b8dc4 Migrate all dates to use conferences ONLY, instead of dual conference/FAIRYEAR setup 2010-06-23 16:06:01 +00:00
jacob
24c80b1654 Disabled deleting teams if they're registered for events 2010-06-23 15:52:27 +00:00
james
dc63df156c Fix SQL Injection and XSS vulnerability - woohoo our first 0-day exploit!
http://inj3ct0r.com/exploits/12613
http://packetstorm.linuxsecurity.com/1006-exploits/fairinabox-sqlxss.txt
2010-06-23 05:07:57 +00:00
james
b7f3274543 Massive overhaul of the configuration variables
- split into system variables and conference variables
- rely on conference_id instead of year
2010-06-22 21:32:03 +00:00
jacob
b3448b7c7c updated to delete links between schedule registrations and users when a schedule registration is deleted 2010-06-22 19:35:36 +00:00
jacob
00716cd84d layout tweaks 2010-06-22 17:14:23 +00:00
jacob
c699135bce Added some last tidbits to the UI for selecting team members at a specific event
Added functionality in listSelector.js to validate data when it's switched from one list to another
2010-06-22 16:56:47 +00:00
jacob
964a855275 DB table for linking users to teams in events 2010-06-22 14:53:08 +00:00
jacob
54f6a2e251 Created a javascript "listSelector" class that can be used to select a list of items from an existing list.
Added a form in schoolschedule.php which uses that class to select students on a team
2010-06-21 22:06:18 +00:00
james
e02e5ba687 Remove a bunch of conferenceid=0 checks -- we now always have a conference id 2010-06-17 21:14:00 +00:00
james
4f65058f59 Migrate config options theme and theme_icons from Global(FAIRYEAR) to Special(no fair year associated) 2010-06-17 20:56:03 +00:00
jacob
7cb1f55a3e updates on the student list editor for teachers 2010-06-17 20:22:18 +00:00
james
6c4a54fe94 Create science fair conferences for all past years that the system knows about
Also add a temporary year field to the conferences table, to make migration easier (easier to find a conference id for a given science fair year)
2010-06-17 20:03:45 +00:00
james
054c62dfa8 Couple small tweaks - science olympics event rename to science olympics activity, sort events by eventtype first 2010-06-17 19:31:50 +00:00
james
d45ababbbb Dont insert blank events into the schedule 2010-06-17 16:07:27 +00:00
james
e1ef58f988 Oops fix my missing semicolon now 2010-06-17 15:14:36 +00:00
jacob
13bc1b3d9a D'OH 2010-06-17 15:11:59 +00:00
jacob
970ac57f21 syntax error in the earlier version 2010-06-17 15:11:04 +00:00
james
56b5e8269a add defaults for min/max team size and number of teams to each event
pull those defaults when creating a new scheduled event
show registered teams when viewing an event as an admin
2010-06-17 15:06:11 +00:00
jacob
f1a43a9cec DB updates that I forgot to include with my last commit 2010-06-17 14:02:30 +00:00
jacob
0503030a35 Updates for managing students 2010-06-16 21:33:43 +00:00
james
6ea88362e8 Only allow registration for science olympic events 2010-06-16 18:14:44 +00:00
james
dad86ce72b Only show teams for the current conference now that teams have a conference :) 2010-06-16 17:57:51 +00:00
james
4c56a33d7c s/School Access/School Home 2010-06-16 17:50:12 +00:00
jacob
8e8f9f7c3b Fixed a stray quotation mark that broke a query 2010-06-16 17:45:13 +00:00
james
bbf46aa47f Don't let admin remove scheduled events if they have teams registered 2010-06-16 17:09:42 +00:00
james
dd230b2cdf Show registered teams on admin schedule
Move more stuff to common include
2010-06-16 16:15:17 +00:00
jacob
7e749f0295 Added conferences_id to the so_teams table and updated corresponding code accordingly
Partially implemented student manager under school dashboard for science olypmics
2010-06-16 15:16:25 +00:00
james
7ca5edc2a1 Show team registrations on the schedule view for teachers 2010-06-15 22:01:09 +00:00
james
a4ea7f6b1e Move some common schedule functions out
Properly show current capacity in schedule view
2010-06-15 21:52:03 +00:00
james
e5d9460d73 Add schedule view for school access, allow schools to register teams for events 2010-06-15 21:43:21 +00:00
jacob
41efbd89b0 Renamed manage_teams.php to schoolteams.php for consistency
Started adding a page for the school to modify students under SOIAB
2010-06-15 18:14:01 +00:00
jacob
ebe9f4b522 Separated the school access pages into separate documents 2010-06-15 16:57:50 +00:00
james
3b0ad48451 Fix crumbtrails 2010-06-15 15:44:25 +00:00
james
1fa7139482 Add a title field and default it to the event name (lets them do things like "Compound Boggle #1" and "Compound Boggle #2"
Add max team capacity editor and numbers to display
2010-06-14 20:37:31 +00:00
jacob
76652861d4 Added conference filter to event location editor 2010-06-14 20:12:54 +00:00
jacob
c9ebee5c10 Forgot to update the code version on my last commit 2010-06-14 19:44:49 +00:00
jacob
f090e957c6 Modified events table to filter properly by event and handle URLs properly
Slight change in tableeditor to allow it to properly filter a value of zero (not treating it as null)
2010-06-14 19:43:10 +00:00
james
e98ec8751b add event types
schedule shows event types in different colours
add tabs to schedule editor windor for each event type
forward port ENUM changes to tableeditor
fix bug in emit_minute_selector
2010-06-14 19:25:49 +00:00
jacob
f116d9c5fc Added team management for SOIAB. Minor typo correction in conferences.php 2010-06-14 18:30:39 +00:00
james
bd7e107c0e Again :p 2010-06-14 16:58:58 +00:00
james
3b7d24c823 Adjust the schedule default start/end times 2010-06-14 16:58:33 +00:00
james
7e4a3af95d Put back int judges -- we'll need them for science olympics yet - but in a different capacity 2010-06-14 16:57:16 +00:00
james
23142cf01a Hide events that are not in the time frame defined by the schedule 2010-06-14 16:20:25 +00:00
james
49f127dbd1 Properly set the width of each event when its placed on the schedule based on the size of the table cell its going into, and re-place all the events on window.resize :) 2010-06-11 20:39:29 +00:00
james
76f1a79fe7 Oops, remove teh database name from the db update on create table 2010-06-11 20:27:53 +00:00
james
d7be4a15dc Oops commit the missing file :) 2010-06-11 20:20:46 +00:00
james
a928b97396 Add a fixme to deleting events from the schedule to make sure we dont forget :) 2010-06-11 20:08:27 +00:00
james
badea469f6 Switch hour and minute in the editor to dropdowns
Fix passing extra parameters to emit_hour_selector
Allow emit_minute_selector to work with different minute intervals
2010-06-11 20:04:51 +00:00
james
4edd9baad3 Working schedule event editor for adding, editing and removing events from the schedule. 2010-06-11 19:36:50 +00:00
james
80fc39bf7f Implement start hour and end hour for schedule view
Implement event duration height calculations
2010-06-11 15:55:16 +00:00
jacob
44fd9bea1f Added function for saving submitted settings when science fair/olympic inclusion is chosen 2010-06-11 14:48:29 +00:00
jacob
7d38b43cfc school management partially updated 2010-06-10 22:10:20 +00:00
jacob
5b7f7dca00 add specific character encoding 2010-06-10 20:37:49 +00:00
james
56ce08201a Add schedule database 2010-06-10 20:37:11 +00:00
james
df3af58ffa Place already scheduled events on the schedule table, still doesnt do duration, messing with the stupid arrays now... gotta go 2010-06-10 20:35:02 +00:00
jacob
4b95aebe8f Added an event editor 2010-06-10 19:50:49 +00:00
james
6a24618359 Event scheduling start - shows times and locations and lets you click about in the table 2010-06-10 19:40:50 +00:00
james
ba20d1b974 Move session stuff up so it can be set before its used to determine the conference 2010-06-10 19:40:20 +00:00
jacob
e0efe11f03 Added a command at the end to switch the character encoding for the entire database 2010-06-10 19:09:00 +00:00
james
78e311322c Set the record type and default sort 2010-06-10 18:45:38 +00:00
james
0938342569 Always create new tables with UTF8 2010-06-10 18:36:10 +00:00
jacob
558a724e0e correcting field name 2010-06-10 18:25:26 +00:00
jacob
dab613b746 Added locations table and editor 2010-06-10 18:09:16 +00:00
james
122248a03c Move the conference block above the configuration/dates loading, so we can load the right dates for the conference (and probably soon, the right configuration variables too!) 2010-06-10 17:58:27 +00:00
jacob
c44068929a Somehow the "exit" got remarked from the top of populate_fake. Unremarked it. 2010-06-10 16:13:19 +00:00
james
6ab03749f5 Rework admin page for science olympics
Add stubs for events & scheduling and event locations
2010-06-09 20:40:04 +00:00
james
86a43e909a Implement conference specific logos 2010-06-09 20:24:52 +00:00
james
703cc18425 Make JPG files using GD so it handles transaprency, but keep making the GIF/PNG's from convert binary 2010-06-09 19:23:27 +00:00
dave
d1c607f575 New TCPDF signature page 2010-06-09 17:05:21 +00:00
james
fa56770b8a Recommit 175 FULL due to missing 174 php 2010-06-09 16:51:49 +00:00
dave
6049ce9edb Missing file, that's why it wasn't converting properly 2010-06-09 16:45:51 +00:00
james
fbba2e7e20 Needed to add a "no" value to the "deleted" field when creating a new user 2010-06-09 16:14:01 +00:00
james
4c9692682a added a line for catching "set" field type in the character set update
created a full database dump in UTF-8 encoding for installer
2010-06-09 15:41:50 +00:00
james
4799b4ffd8 Add back the UTF8 database set names call, and switch all emails to use UTF8 encoding 2010-06-09 15:14:41 +00:00
james
d5ed8a1fc4 Modified version of update 173 to handle special windows characters 2010-06-09 15:11:14 +00:00
dave
cb51fef47d Name column consistently 2010-06-09 07:44:02 +00:00
dave
0567451a58 Implement fair name/logo as fields in a report instead of special
options.  This way, the logo/fairname can be moved around and
resized.   Ensure those fields exist in each report.  Convert name/logo
preferences in all existing reports, and adjust the yloc/height of
existing fields to make way for the headers if they exist.
2010-06-09 07:43:59 +00:00
dave
a46cb110ca Add logo and fairname to labels (still doesn't scale the contents of the
label).
2010-06-09 05:21:42 +00:00
dave
76e8f8c3e2 Convert everythign to millimeters 2010-06-09 05:21:40 +00:00
dave
f1082a1c40 Add TABLOID to tcpdf 2010-06-09 05:21:38 +00:00
dave
8438c48e4b Remove lpdf setup routines 2010-06-09 05:21:35 +00:00
jacob
a2239d84da Modifications to fix db update problems 2010-06-08 20:31:52 +00:00
dave
ee2e03df4b Remove TCPDF example from source 2010-06-08 19:24:26 +00:00
dave
180550f15e Fix load/save now that face and lines are gone. Change TCPDF report
types to use the old types.
2010-06-08 18:57:01 +00:00
dave
ce1d289a31 Convert labels to new format and millimeters. Drop now-unused columns
"face" and "lines".
2010-06-08 18:49:21 +00:00
dave
d67500fe1a Mostly working TCPDF conversion for both labels and reports 2010-06-08 18:49:20 +00:00
dave
6ab3522970 Fix a TCPDF bug causing misaligned table headers on a page break 2010-06-08 18:49:17 +00:00
dave
b0842d28ee Delete unneeded file 2010-06-08 18:49:16 +00:00
dave
1f1691167c Convert all width to millimeters 2010-06-08 18:49:14 +00:00
dave
dcf3f1687d Upgrade to TCPDF 5.3 2010-06-08 18:48:10 +00:00
dave
d6dcdf1ea6 More sensible values for margins 2010-06-08 18:47:59 +00:00
jacob
6504d09886 Added updates for converting from Latin1 to utf8 character encoding 2010-06-04 20:23:59 +00:00
james
20382fc44a Remove old superconfig
Remove Age Categories from config for scienceolympics -- for now, all science olympics ive heard of just use the grades as designations
2010-06-04 17:12:38 +00:00
james
cf05b063c1 A few more tweaks to the date config - if we have a conference year should be 0, if we dont have a conference, conference should be 0 and year should be set. 2010-06-04 17:09:35 +00:00
james
b47b88ab9b Update front-end dates 2010-06-04 16:48:02 +00:00
james
b51b4420db Update dates configuration for science olympics 2010-06-04 16:45:56 +00:00
james
36024b63ca Sneak in one more update to 172 2010-06-03 19:29:31 +00:00
james
14308b5991 Start of adding 'conferences' and ability to switch between running conferences 2010-06-03 19:21:27 +00:00
james
d779a6ea27 Oops missed the CSS for the lightswitches 2010-05-28 12:00:09 +00:00
justin
a586ad8e93 enhance reporting capabilities for judging score entry 2010-05-27 21:55:10 +00:00
james
c47eb2ac30 Movethe link somewhere a bit better, still requires config access to get to 2010-05-27 20:41:33 +00:00
james
8aae3b3522 Add a (non-working for demo only!) superconfig page to turn on/off the science fair and science olympics components 2010-05-27 20:33:08 +00:00
dave
f7532e8ebc Add address to the primary contact in an awards report 2010-05-07 07:29:31 +00:00
669 changed files with 99673 additions and 36265 deletions

View File

@ -6,4 +6,5 @@ RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-l
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^web/(.*)$ cms.php?f=$1 [L]
RewriteRule ^api/(.*)$ api.php?request=$1 [L]

556
account.inc.php Normal file
View File

@ -0,0 +1,556 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2010 David Grant <dave@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.
*/
?>
<?
function account_valid_user($user)
{
/* Find any character that doesn't match the valid username characters
* (^ inverts the matching remember */
$x = preg_match('[^a-zA-Z0-9@.-_]',$user);
/* If x==1, a match was found, and the input is bad */
return ($x == 1) ? false : true;
}
function account_valid_password($pass)
{
/* Same as user, but allow more characters */
$x = preg_match('[^a-zA-Z0-9 ~!@#$%^&*()-_=+|;:,<.>/?]',$pass);
/* If x==1, a match was found, and the input is bad */
if($x == 1) return false;
if(strlen($pass) < 6) return false;
return true;
}
/* Duplicate of common.inc.php:generatePassword, which will be deleted
* eventually when ALL users are handled through this file */
function account_generate_password($pwlen=8)
{
//these are good characters that are not easily confused with other characters :)
$available="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
$len=strlen($available) - 1;
$key="";
for($x=0;$x<$pwlen;$x++)
$key.=$available{rand(0,$len)};
return $key;
}
function account_set_password($accounts_id, $password = NULL)
{
$save_old = false;
if($password == NULL) {
$q = mysql_query("SELECT passwordset FROM accounts WHERE id='$accounts_id'");
$a = mysql_fetch_assoc($q);
/* Generate a new password */
$password = account_generate_password(12);
/* save the old password only if it's not an auto-generated one */
if($a['passwordset'] != '0000-00-00') $save_old = true;
/* Expire the password */
$save_set = "'0000-00-00'";
} else {
/* Set the password, no expiry, save the old */
$save_old = true;
$save_set = 'NOW()';
}
$p = mysql_escape_string($password);
$set = ($save_old == true) ? 'oldpassword=password, ' : '';
$set .= "password='$p', passwordset=$save_set ";
$query = "UPDATE accounts SET $set WHERE id='$accounts_id'";
mysql_query($query);
echo mysql_error();
return $password;
}
function account_load($id)
{
$id = intval($id);
//we dont want password or the pending email code in here
$q = mysql_query("SELECT id,
username,
link_username_to_email,
passwordset,
email,
pendingemail,
superuser,
deleted,
deleted_datetime,
created
FROM accounts WHERE id='$id'");
if(mysql_num_rows($q) == 0) {
return false;
}
if(mysql_num_rows($q) > 1) {
return false;
}
$a = mysql_fetch_assoc($q);
return $a;
}
function account_get_password($id) {
$id=intval($id);
$q=mysql_query("SELECT password FROM accounts WHERE id='$id'");
$r=mysql_fetch_object($q);
return $r->password;
}
function account_load_by_username($username)
{
$un = mysql_real_escape_string($username);
$q = mysql_query("SELECT * FROM accounts WHERE username='$un'");
if(mysql_num_rows($q) == 0) {
return false;
}
if(mysql_num_rows($q) > 1) {
return false;
}
$a = mysql_fetch_assoc($q);
return $a;
}
function account_create($username,$password=NULL)
{
global $config;
$errMsg = '';
/* Sanity check username */
if(!account_valid_user($username)) {
$errMsg .= i18n('Invalid user name "%1"', array($username)) . "\n";
}else{
/* Make sure the account doesn't exist */
$us = mysql_real_escape_string($username);
$q = mysql_query("SELECT * FROM accounts WHERE username='$us'");
if(mysql_num_rows($q)) {
$errMsg .= i18n("The username %1 is already in use", array($username)) . "\n";
}
}
//if the password is set, make sure its valid, if its null, thats OK, it'll get generated and set by account_set_password
if($password && !account_valid_password($password)) {
$errMsg .= i18n("Invalid password") . "\n";
}
if($errMsg != '') return $errMsg;
/* Create the account */
mysql_query("INSERT INTO accounts (`username`,`created`,`deleted`,`superuser`)
VALUES ('$us', NOW(),'no','no')");
echo mysql_error();
$accounts_id = mysql_insert_id();
account_set_password($accounts_id, $password);
$a = account_load($accounts_id);
return $a;
}
function account_set_email($accounts_id,$email) {
global $config;
//we dont actually set the email until its confirmed, we only set the pending email :p
if(isEmailAddress($email)) {
$code=generatePassword(24);
mysql_query("UPDATE accounts SET email=NULL, pendingemail='".mysql_real_escape_string($email)."', pendingemailcode='$code' WHERE id='$accounts_id'");
$link = account_build_email_confirmation_link($accounts_id);
email_send('account_email_confirmation',$email,array(),array("EMAIL"=>$email,"EMAILCONFIRMATIONLINK"=>$link));
}
}
// generate the email confirmation URL. Separated from account_set_email for use elsewhere.
// returns null if no confirmation code is set for this account
function account_build_email_confirmation_link($accounts_id){
global $config;
$q = mysql_query("SELECT pendingemail, pendingemailcode FROM accounts WHERE id = $accounts_id");
$row = mysql_fetch_assoc($q);
$code = $row['pendingemailcode'];
$email = $row['pendingemail'];
if(trim($code) == ''){
return null;
}
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
$urlemailconfirm = "emailconfirmation.php?i=$accounts_id&e=".rawurlencode($email)."&c=".$code;
return $urlmain."/".$urlemailconfirm;
}
// add the specified role to the account's user record for the specified conference
// return true on success, false on failure
function account_add_role($accounts_id, $roles_id, $conferences_id, $password = null){
global $config;
global $conference;
//if we get role as a type string instead of an id (eg, 'teacher'), lets just look it up
if(!is_numeric($roles_id)) {
$tq=mysql_query("SELECT id FROM roles WHERE type='".mysql_real_escape_string($roles_id)."'");
$tr=mysql_fetch_object($tq);
$roles_id=$tr->id;
}
// avoid injections
$accounts_id=intval($accounts_id);
$roles_id=intval($roles_id);
$conferences_id=intval($conferences_id);
$password=mysql_real_escape_string($password);
// make sure the specified id's actually exist
if(mysql_result(mysql_query("SELECT COUNT(*) FROM accounts WHERE id = $accounts_id"), 0) != 1){
return "invalidaccount";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM roles WHERE id = $roles_id"), 0) != 1){
return "invalidrole";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM conferences WHERE id = $conferences_id"), 0) != 1){
return "invalidconference";
}
// find out if this account has a user record for this conference
$data = mysql_fetch_array(mysql_query("
SELECT * FROM users
WHERE conferences_id = $conferences_id
AND accounts_id = $accounts_id
"));
if(is_array($data)){
// they do indeed have a user record for this conference. Let's load it
$u = user_load($data['id']);
$users_id = $data['id'];
}else{
// They're not actually connected to this conference, let's hook 'em up
$u = user_create($accounts_id, $conferences_id);
$users_id = $u['id'];
// if this applies to their current session, update their session user id
if($_SESSION['accounts_id'] == $accounts_id && $_SESSION['conferences_id'] == $conferences_id){
$_SESSION['users_id'] = $users_id;
}
}
// we now have the user id that we need, let's check to see whether or not they
// already have the specified role.
if(mysql_result(mysql_query("SELECT COUNT(*) FROM user_roles WHERE users_id = $users_id AND roles_id = $roles_id"), 0) != 0){
// they already have this role. shell_exec("man true");
return 'ok';
}
// see if this role conflicts with existing ones
if(!account_add_role_allowed($accounts_id, $conferences_id, $roles_id)){
return 'invalidrole(account_add_role_allowed)';
}
// get the type of the role (eg. "judge", "participant", etc.)
$role = mysql_result(mysql_query("SELECT type FROM roles WHERE id = $roles_id"), 0);
if($_SESSION['superuser']!='yes') {
// and see if it's a valid one for this conference
if(!array_key_exists($role . '_registration_type', $config)){
return 'invalidrole(_registration_type)';
}
}
if( in_array("admin",$_SESSION['roles']) ||
in_array("config",$_SESSION['roles']) ||
$_SESSION['superuser']=="yes")
{
//do nothing, we're logged in a a superuser, admin or config, so we
//dont want/need to check the types, just go ahead and invite them
//its easie than reversing the logic of the if above.
}
else {
// and let's see if we meet the conditions for the registration type
$error = "";
switch($config[$role . '_registration_type']){
case 'open':
case 'openorinvite':
// this is allowed.
break;
case 'singlepassword':
if($password != $config[$role . '_registration_singlepassword']){
$error = "invalidpassword";
}
break;
case 'schoolpassword':
if($password != null){
$schoolId = $u['schools_id'];
$schoolDat = mysql_fetch_assoc(mysql_query("SELECT registration_password FROM schools WHERE id=$schoolId"));
if(is_array($schoolDat)){
if($password == $schoolDat['registration_password']) $valid = true;
$error = "invalidpassword";
}
}
break;
case 'invite':
if( in_array("teacher",$_SESSION['roles']) && $role=='participant') {
//if they are a teacher, they can add a participant role a-ok
$error = '';
}
else {
$error = 'invalidrole(invite_only)';
}
break;
}
}
if($error != ""){
return $error;
}
// *whew* all conditions have been met. Let's go ahead and create the record
if(!mysql_query("INSERT INTO user_roles (accounts_id, users_id, roles_id, active, complete) VALUES($accounts_id, $users_id, $roles_id, 'yes', 'no')")){
return "mysqlerror:" . mysql_error();
}
$a=account_load($accounts_id);
$password=account_get_password($accounts_id);
//in this case, we want to send to pendingemail if thats all we have, because
//its possible that this is a new user that was just added and we just sent
//the email confirmation email as well, so on new user invitation, they will get
//the invite email as well as the email confirmation email.
if($a['email']) $e=$a['email'];
else if($a['pendingemail']) $e=$a['pendingemail'];
email_send("{$role}_new_invite",
$e,
array("FAIRNAME"=>$conference['name']),
array("FAIRNAME"=>$conference['name'],
"EMAIL"=>$e,
"USERNAME"=>$a['username'],
"PASSWORD"=>$password,
"ROLE"=>$role)
);
// if we made it this far, the role was successfully added
return 'ok';
}
// find out if the specifed role can be added to this account at the specified conference
function account_add_role_allowed($accounts_id, $roles_id, $conferences_id){
$returnval = true;
// avoid injections
$accounts_id *= 1;
$roles_id *= 1;
$conferences_id *= 1;
// get the user id for this account/conference
$userdat = mysql_fetch_assoc(mysql_query("SELECT id FROM users WHERE accounts_id = $accounts_id AND conferences_id = $conferences_id"));
// If this condition isn't met, then the account is not connected to the conference.
// In that case, the role can be allowed as there is no conflict.
if(is_array($userdat)){
$users_id = $userdat['id'];
// get the roles for the specified account at the specified conference
$query = mysql_query("
SELECT * FROM user_roles
WHERE users_id = $users_id
");
while($returnval && $row = mysql_fetch_assoc($query)){
switch($row['type']){
case 'participant':
// Student cant' add any other role
$returnval = false;
break;
default:
if($role == 'participant') {
// No role can add the participant role
$returnval = false;
}
// All other roles can coexist (even the fair role)
break;
}
}
}
return $returnval;
}
// remove the specified role from the account's user record for the specified conference
// return true on success, false on failure
function account_remove_role($accounts_id, $roles_id, $conferences_id){
// avoid injections
$accounts_id *= 1;
$roles_id *= 1;
$conferences_id *= 1;
// make sure the specified id's actually exist
if(mysql_result(mysql_query("SELECT COUNT(*) FROM accounts WHERE id = $accounts_id"), 0) != 1){
return "invalidaccount";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM roles WHERE id = $roles_id"), 0) != 1){
return "invalidrole";
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM conferences WHERE id = $conferences_id"), 0) != 1){
return "invalidconference";
}
// very little error catching needed here. If the role's there, we hopfully succeed in
// removing it. If it's not, then we succeed in doing nothing
$data = mysql_fetch_array(mysql_query("
SELECT * FROM users
WHERE conferences_id = $conferences_id
AND accounts_id = $accounts_id
"));
if(is_array($data)){
// they do indeed have a user record for this conference.
$users_id = $data['id'];
// Do role-specific remove actions
$role = mysql_result(mysql_query("SELECT `type` FROM roles WHERE id = $roles_id"), 0);
switch($role) {
case 'committee':
mysql_query("DELETE FROM committees_link WHERE accounts_id='{$accounts_id}'");
break;
case 'judge':
mysql_query("DELETE FROM judges_teams_link WHERE users_id='$users_id'");
mysql_query("DELETE FROM judges_specialawards_sel WHERE users_id='$users_id'");
break;
default:
break;
}
// and now we can remove the role link itself
mysql_query("DELETE FROM user_roles WHERE roles_id={$roles_id} AND users_id='$users_id'");
}
return 'ok';
}
// A function for handling updates of any fields that can be modified through an API call.
// returns 'ok' on success, error message otherwise.
function account_update_info($fields){
if($_SESSION['accounts_id']) {
$accounts_id = $_SESSION['accounts_id'];
}else{
return 'you must be logged in to change your account settings';
}
if(!is_array($fields)) return 'account_update_info expects an array';
$message = 'ok';
$updates = array();
foreach($fields as $index => $value){
switch($index){
case 'username':
if(account_valid_user($value)){
$u = mysql_real_escape_string($value);
$q = mysql_query("SELECT id FROM accounts WHERE username = '$u' AND deleted = 'no' AND id != $accounts_id");
if(mysql_num_rows($q) != 0){
$message = "username already in use";
}else{
$updates[$index] = $value;
}
}else{
$message = "invalid username";
}
break;
case 'password':
$q = mysql_query("SELECT password FROM accounts WHERE id='$accounts_id' AND password='" . mysql_real_escape_string($value) . "'");
if(mysql_num_rows($q)){
// ignore this parameter. The password has not changed
}else if(!account_valid_password($value)){
$message = "invalid password";
}else{
$updates[$index] = $value;
}
break;
case 'link_username_to_email':
if(in_array($value, array('yes', 'no'))){
if($value=='yes') {
//if its yes, we can only do it if username==email
if($fields['username']==$fields['email']) {
$updates[$index] = $value;
} else {
$message="username and email must match for link_username_toemail";
}
}
else {
$updates[$index] = $value;
}
}else{
$message = '"link_username_to_email" must be either a "yes" or "no" value';
}
break;
case 'email':
if(isEmailAddress($value)){
$updates[$index] = $value;
}else{
$message = 'invalid e-mail address';
}
break;
default:
$message = 'invalid field name';
}
}
if($message != 'ok'){
return $message;
}
// the data's all been validated, so we can continue with the actual update.
// doing it separately from the above loop to ensure that it's an all-or nothing update;
// none of it will happen if any one part is erroneous.
foreach($updates as $index => $value){
switch($index){
case 'username':
$username = mysql_real_escape_string($value);
mysql_query("UPDATE accounts SET username = '$username' WHERE id = $accounts_id");
break;
case 'password':
account_set_password($accounts_id, mysql_real_escape_string($value));
break;
case 'link_username_to_email':
mysql_query("UPDATE accounts SET link_username_to_email = '$value' WHERE id = $accounts_id");
break;
case 'email':
account_set_email($accounts_id, $value);
break;
}
}
return $message;
}
?>

33
activities.inc.php Normal file
View File

@ -0,0 +1,33 @@
<?
/*
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 James Grant <james@lightbox.org>
Copyright (C) 2009 David Grant <dave@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.
*/
function activities_status(&$u)
{
global $config;
/* They must select a language */
if(count($u['languages']) < 1) return 'incomplete';
return 'complete';
}

190
activities.php Normal file
View File

@ -0,0 +1,190 @@
<?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 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.
*/
?>
<?php
require_once('common.inc.php');
require_once('user.inc.php');
require_once('activities.inc.php');
require_once("questions.inc.php");
require_once('user_edit.inc.php');
/* Ensure they're logged in as a judge, volunteer or admin */
user_auth_required(array(), array('judge', 'volunteer', 'admin'));
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
if($edit_id != $_SESSION['users_id'])
user_auth_required('admin');
else
user_auth_required();
$u = user_load($edit_id);
// load the times at which the various events are happening
$times = array();
$q = mysql_query("
SELECT schedule.id, date, hour, minute, duration, title
FROM schedule
JOIN events ON schedule.events_id = events.id
WHERE schedule.conferences_id = {$conference['id']}
ORDER BY date, hour, minute
");
$x = 0;
while($r = mysql_fetch_assoc($q)){
$dateParts = explode('-', $r['date']);
$startTime = mktime($r['hour'], $r['minute'], 0, $dateParts[1], $dateParts[2], $dateParts[0]);
$endTime = $startTime + $r['duration'] * 60;
$times[$r['id']] = array(
'date' => $r['date'],
'starttime' => date('g:ia', $startTime),
'endtime' => date('g:ia', $endTime),
'name' => $r['title'],
);
}
switch($_GET['action']) {
case 'save':
if(!is_array($_POST['languages'])) $_POST['languages']=array();
$u['languages'] = array();
foreach($_POST['languages'] AS $val)
$u['languages'][] = $val;
$u['willing_chair'] = ($_POST['willing_chair'] == 'yes') ? 'yes' : 'no';
$u['highest_psd'] = stripslashes($_POST['highest_psd']);
$u['available_events'] = array_values($_POST['time']);
user_save($u);
/*
if(is_array($_POST['questions'])){
questions_save_answers("judgereg",$u['id'],$_POST['questions']);
}
*/
happy_("Preferences successfully saved");
$u = user_load($u['id']);
$newstatus=activities_status($u);
?>
<script type="text/javascript">
user_update_tab_status('activities','<?=$newstatus?>');
</script>
<?
exit;
}
$fields = array('languages[]', 'willing_chair','highest_psd','time[]');
$required = array('languages[]');
if(count($times) > 1) $required[] = 'time[]';
?>
<h4><?=i18n("Activity Information")?> - <span class="status_activities"></span></h4>
<br/>
<form class="editor" id="activities_form">
<table width="90%">
<tr><td style="text-align: left" colspan="2"><b><?=i18n('Language(s)')?></b><hr /></td></tr>
<tr><?=user_edit_item($u, 'Languages', 'languages[]', 'languages')?></tr>
<?php if(count($times) > 1) { ?>
<tr><td style="text-align: left" colspan="2"><br /><b><?=i18n('Time Availability')?></b><hr />
<i><?=i18n('Please specify the events you are available for')?></i>
</td></tr>
<?php
// get a list of the times they already have selected
$sel = array();
$q = mysql_query("
SELECT eual.* FROM schedule_users_availability_link eual
JOIN schedule ON schedule.id = eual.schedule_id
WHERE eual.users_id=\"{$u['id']}\"
AND schedule.conferences_id = {$conference['id']}
ORDER BY `schedule`.`date`, `schedule`.`hour`, `schedule`.`minute`
");
while($r = mysql_fetch_assoc($q)) {
foreach($times as $x => $t) {
if($x == $r['schedule_id']){
$sel[] = $x;
}
}
}
$items = array();
foreach($times as $x => $t) {
$items[$x] = "{$t['name']} ({$t['date']} {$t['starttime']} - {$t['endtime']})";
}
echo '<tr>';
user_edit_item($u, 'Time Availability', 'time[]', 'checklist', $items, $sel);
echo '</tr>';
}
//questions_print_answer_editor('judgereg', $u, 'questions');
?>
</table>
<br />
<button><?=i18n("Save Information")?></button>
</form>
<script type="text/javascript">
function activities_save()
{
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/activities.php?action=save&users_id=<?=$u['id']?>", $("#activities_form").serializeArray());
return false;
}
$(document).ready(function() {
$("#activities_form").validate({
errorPlacement: function(error, element) {
if( element.attr('type') == 'checkbox' ) {
error.insertAfter( element.parent("span") );
} else {
error.insertAfter(element);
}
},
rules: {
"languages[]": { required: true },
"time[]": { required: <?=in_array('time[]', $required)?'true':'false'?> },
},
messages: {
"languages[]": { required: "<?=i18n('Please select the language(s) you can work in')?>" },
"time[]": { required: "<?=i18n('Please select the time(s) you are available')?>" }
},
submitHandler: function() {
activities_save();
return false;
},
cancelHandler: function() {
activities_save();
return false;
}
});
user_update_tab_status('activities');
});
</script>

144
admin/account_list.php Normal file
View File

@ -0,0 +1,144 @@
<?
/*
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 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.
*/
?>
<?
if($_GET['show_types'])
$NAV_IDENT=$_GET['show_types'][0];
if($_POST['show_types'])
$NAV_IDENT=$_POST['show_types'][0];
require_once('../common.inc.php');
require_once('../user.inc.php');
require_once('../judge.inc.php');
user_auth_required('admin');
require_once('judges.inc.php');
if($_GET['action']=="join" && $_GET['accounts_id']) {
//we're making this user join this conference
echo "joining {$_GET['accounts_id']} with {$conference['id']}";
$u = user_create(intval($_GET['accounts_id']), $conference['id']);
echo happy(i18n("User joined conference"));
}
send_header("Account List",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php')
);
$querystr = "SELECT * FROM accounts ORDER BY username";
/*
echo $querystr;
echo "<br />\n";
echo "<br />\n";
*/
$q = mysql_query($querystr);
echo mysql_error();
echo "<br />\n";
$num = mysql_num_rows($q);
echo i18n("Listing %1 account total.",array($num));
echo mysql_error();
echo "<table class=\"tableview\">";
echo "<thead>";
echo "<tr>";
echo " <th>".i18n("Account ID")."</th>";
echo " <th>".i18n("Username")."</th>";
echo " <th>".i18n("Email Address")."</th>";
echo " <th>".i18n("Pending Email")."</th>";
echo " <th>".i18n("User Info")."</th>";
// echo " <th>".i18n("Actions")."</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$tally = array();
$tally['active'] = array();
$tally['inactive'] = array();
$tally['active']['complete'] = 0;
$tally['active']['incomplete'] = 0;
$tally['active']['na'] = 0;
$tally['inactive']['complete'] = 0;
$tally['inactive']['incomplete'] = 0;
$tally['inactive']['na'] = 0;
while($r=mysql_fetch_assoc($q)) {
// get the role data for this user
echo "<tr>";
echo "<td>";
echo $r['id'];
echo "</td>";
echo "<td>";
echo $r['username'];
echo "</td>";
echo "<td>";
echo $r['email'];
echo "</td><td>";
echo $r['pendingemail'];
echo "</td>";
echo "<td>";
$u=user_load_by_accounts_id($r['id']);
if($u) {
//we can edit them even if they dont have any roles, duh
echo "<b>";
echo "<a href=\"#\" onclick=\"return openeditor({$u['id']})\">";
if($u['firstname'] || $u['lastname']) {
echo $u['firstname']." ".$u['lastname'];
}
else {
echo i18n("No name specified");
}
echo "</a>";
echo "</b>";
echo "<br />";
if(count($u['roles'])) {
echo "<table>";
foreach($u['roles'] AS $r=>$rd) {
echo "<tr><td>";
echo $rd['name'];
echo "</td>";
if($rd['active']=="yes"){ $cl="happy"; $cls=""; } else { $cl="error"; $cls="not "; }
echo "<td class=\"$cl\">{$cls}active</td>";
if($rd['complete']=="yes"){ $cl="happy"; $cls=""; } else { $cl="error"; $cls="not "; }
echo "<td class=\"$cl\">{$cls}complete</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "no roles";
}
}
else {
echo "no user record for this conference. ";
echo " <a href=\"account_list.php?action=join&accounts_id={$r['id']}\">click to join conference</a>";
}
echo "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
send_footer();
?>

View File

@ -24,7 +24,8 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require_once("awards.inc.php");
user_auth_required('admin');
send_header('Create All Divisional Awards',
array('Committee Main' => 'committee_main.php',
@ -38,21 +39,31 @@
if($_GET['award_types_id']) $award_types_id=$_GET['award_types_id'];
else if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
if($_GET['force'] == "true") {
$q=mysql_query("SELECT id FROM award_awards WHERE award_types_id='1' AND conferences_id='{$conference['id']}'");
while($r=mysql_fetch_object($q)) {
award_delete($r->id);
}
}
//first, we can only do this if we dont have any type=divisional awards created yet
$q=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE award_types_id='1' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE award_types_id='1' AND conferences_id='{$conference['id']}'");
$r=mysql_fetch_object($q);
if($r->num)
{
echo error(i18n("%1 Divisional awards already exist. There must not be any divisional awards in order to run this wizard",array($r->num)));
echo "<p><a href='award_awardcreatedivisional.php?force=true'>" . i18n("Proceed Anyways?") . "</a> ";
echo i18n("This will delete all existing divisional awards.");
echo "</p>";
}
else
{
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
$div[$r->id]=$r->division;
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
$cat[$r->id]=$r->category;
@ -60,7 +71,7 @@
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array();
while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
@ -79,7 +90,7 @@
if($_GET['action']=="create" && $_GET['sponsors_id'])
{
$q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$q=mysql_query("SELECT * FROM award_prizes WHERE conferences_id='-1' AND award_awards_id='0' ORDER BY `order`");
$prizes=array();
while($r=mysql_fetch_object($q))
{
@ -106,27 +117,27 @@
$c_category=$cat[$c_id];
echo i18n("Creating %1 - %2",array($c_category,$d_division))."<br />";
mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,name,criteria,`order`,year) VALUES (
mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,name,criteria,`order`,conferences_id) VALUES (
'{$_GET['sponsors_id']}',
'1',
'$c_category - $d_division',
'".i18n("Best %1 projects in the %2 division",array($c_category,$d_division))."',
'$ord',
'{$config['FAIRYEAR']}'
'{$conference['id']}'
)");
echo mysql_error();
$award_awards_id=mysql_insert_id();
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$award_awards_id','$c_id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$award_awards_id','$d_id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,conferences_id) VALUES ('$award_awards_id','$c_id','{$conference['id']}')");
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,conferences_id) VALUES ('$award_awards_id','$d_id','{$conference['id']}')");
$ord++;
echo "&nbsp;&nbsp;".i18n("Prizes: ");
foreach($prizes AS $prize)
{
mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,year) VALUES (
mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,conferences_id) VALUES (
'$award_awards_id',
'{$prize['cash']}',
'{$prize['scholarship']}',
@ -139,7 +150,7 @@
'{$prize['trophystudentreturn']}',
'{$prize['trophyschoolkeeper']}',
'{$prize['trophyschoolreturn']}',
'{$config['FAIRYEAR']}'
'{$conference['id']}'
)");
echo $prize['prize'].",";
}
@ -172,10 +183,10 @@
echo "</select>";
echo "</td></tr>";
echo "<tr><td>".i18n("Prizes")."</td><td><a href=\"award_prizes.php?award_awards_id=-1\">Edit prize template for divisional awards</a>";
//the 'generic' template prizes for the awards are stored with year =-1 and award_awards_id=0
echo "<tr><td>".i18n("Prizes")."</td><td><a href=\"award_awards.php?action=edit_prize_template\">Edit prize template for divisional awards</a>";
//the 'generic' template prizes for the awards are stored with conferences_id =-1 and award_awards_id=0
$q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$q=mysql_query("SELECT * FROM award_prizes WHERE conferences_id='-1' AND award_awards_id='0' ORDER BY `order`");
if(mysql_num_rows($q))
{

View File

@ -24,19 +24,17 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('awards.inc.php');
switch($_GET['action']) {
case 'draw_awards_table':
draw_awards_table();
exit;
case 'awardinfo_load':
$id = intval($_GET['id']);
$q=mysql_query("SELECT * FROM award_awards WHERE id='$id'");
$ret = mysql_fetch_assoc($q);
//json_encode NEEDS UTF8 DATA, but we store it in the database as ISO :(
foreach($ret AS $k=>$v) {
$ret[$k]=iconv("ISO-8859-1","UTF-8",$v);
}
//echo iconv("ISO-8859-1","UTF-8",json_encode($ret));
echo json_encode($ret);
exit;
@ -50,8 +48,8 @@
$id=intval($_POST['id']);
if($id == -1) {
$q=mysql_query("INSERT INTO award_awards (year,self_nominate,schedule_judges)
VALUES ('{$config['FAIRYEAR']}','yes','yes')");
$q=mysql_query("INSERT INTO award_awards (conferences_id,self_nominate,schedule_judges)
VALUES ('{$conference['id']}','yes','yes')");
$id = mysql_insert_id();
happy_("Award Created");
/* Set the award_id in the client */
@ -60,18 +58,18 @@
$q = "UPDATE award_awards SET
award_types_id='".intval($_POST['award_types_id'])."',
presenter='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['presenter'])))."',
presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."',
excludefromac='".(($_POST['excludefromac'] == 1) ? 1 : 0)."',
cwsfaward='".(($_POST['cwsfaward'] == 1) ? 1 : 0)."',
self_nominate='".(($_POST['self_nominate'] == 'yes') ? 'yes' : 'no')."',
schedule_judges='".(($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no')."',
description='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['description'])))."' ";
description='".mysql_escape_string(stripslashes($_POST['description']))."' ";
if(array_key_exists('name', $_POST)) {
/* These values may be disabled, if they name key exists, assume
* they aren't disabled and save them too */
$q .= ",name='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['name'])))."',
criteria='".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['criteria'])))."',
$q .= ",name='".mysql_escape_string(stripslashes($_POST['name']))."',
criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."',
sponsors_id='".intval($_POST['sponsors_id'])."' ";
}
$q .= "WHERE id='$id'";
@ -107,14 +105,43 @@
error_("Invalid data");
exit;
}
foreach($_POST['categories'] AS $key=>$cat) {
if(!is_numeric($cat)) {
error_("Invalid data");
exit;
}
}
foreach($_POST['divisions'] AS $key=>$div) {
if(!is_numeric($div)) {
error_("Invalid data");
exit;
}
}
$q=mysql_query("SELECT (CASE WHEN ((SELECT a.award_types_id FROM award_awards AS a WHERE id=$id) = 1) THEN (
SELECT COUNT(*) AS c FROM award_awards AS aa
LEFT JOIN award_awards_projectcategories AS aapc ON (aa.id = aapc.award_awards_id)
LEFT JOIN award_awards_projectdivisions AS aapd ON (aa.id = aapd.award_awards_id)
WHERE aa.conferences_id = {$conference['id']} AND
aa.award_types_id=1 AND
aa.id != $id AND
projectcategories_id IN (". implode(",", $_POST['categories']) .") AND
projectdivisions_id IN (". implode(",", $_POST['divisions']) .")
) ELSE 0 END) as c");
$r = mysql_fetch_object($q);
if($r->c != 0) {
error_("Cannot save. There is already a divisional award with the same eligibility criteria.");
exit;
}
//wipe out any old award-category links
mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'");
foreach($_POST['categories'] AS $key=>$cat) {
$c = intval($cat);
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year)
VALUES ('$id','$c','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,conferences_id)
VALUES ('$id','$c','{$conference['id']}')");
echo mysql_error();
}
@ -124,8 +151,8 @@
//now add the new ones
foreach($_POST['divisions'] AS $key=>$div) {
$d = intval($div);
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year)
VALUES ('$id','$d','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,conferences_id)
VALUES ('$id','$d','{$conference['id']}')");
echo mysql_error();
}
happy_("Eligibility information saved");
@ -155,14 +182,11 @@
case 'prizeinfo_load':
$id = intval($_GET['id']);
if($id == -1) {
$q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$q=mysql_query("SELECT * FROM award_prizes WHERE conferences_id='-1' AND award_awards_id='0' ORDER BY `order`");
} else {
$q = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='$id' ORDER BY `order`");
}
while($r=mysql_fetch_assoc($q)) {
foreach($r AS $k=>$v) {
$r[$k]=iconv("ISO-8859-1","UTF-8",$v);
}
$ret[] = $r;
}
echo json_encode($ret);
@ -172,19 +196,19 @@
$q = mysql_query("SELECT * FROM award_prizes WHERE id='$id'");
$ret=mysql_fetch_assoc($q);
foreach($ret AS $k=>$v) {
$ret[$k]=iconv("ISO-8859-1","UTF-8",$v);
$ret[$k]=$v;
}
echo json_encode($ret);
exit;
case 'prize_create':
$aaid = intval($_GET['award_awards_id']);
$year = $config['FAIRYEAR'];
$conferenceId = $conference['id'];
if($aaid == -1) {
$aaid = 0;
$year = -1;
$conferenceId = -1;
}
mysql_query("INSERT INTO award_prizes(award_awards_id,year) VALUES ('$aaid','$year');");
mysql_query("INSERT INTO award_prizes(award_awards_id,conferences_id) VALUES ('$aaid','$conferenceId');");
$ret = array('id' => mysql_insert_id() );
echo json_encode($ret);
exit;
@ -192,16 +216,16 @@
case 'prize_save':
$id = intval($_POST['id']);
$q="UPDATE award_prizes SET
prize='".mysql_escape_string(stripslashes(iconv("UTF-8","ISO-8859-1",$_POST['prize'])))."',
prize='".mysql_escape_string(stripslashes($_POST['prize']))."',
cash='".intval($_POST['cash'])."',
scholarship='".intval($_POST['scholarship'])."',
value='".intval($_POST['value'])."',
number='".intval($_POST['number'])."',
excludefromac='".(($_POST['excludefromac']==1)? 1 : 0)."',
trophystudentkeeper='".(($_POST['trophystudentkeeper']==1) ? 1 : 0)."',
trophystudentreturn='".(($_POST['trophystudentreturn']==1) ? 1 : 0)."',
trophyschoolkeeper='".(($_POST['trophyschoolkeeper']==1) ? 1 : 0)."',
trophyschoolreturn='".(($_POST['trophyschoolreturn']==1) ? 1 : 0)."'
trophystudentkeeper='".(array_key_exists('trophystudentkeeper', $_POST) ? 1 : 0)."',
trophystudentreturn='".(array_key_exists('trophystudentreturn', $_POST) ? 1 : 0)."',
trophyschoolkeeper='".(array_key_exists('trophyschoolkeeper', $_POST) ? 1 : 0)."',
trophyschoolreturn='".(array_key_exists('trophyschoolreturn', $_POST) ? 1 : 0)."'
WHERE id='$id'";
mysql_query($q);
// echo $q;
@ -403,7 +427,7 @@ function awardinfo_save()
$("#popup_editor").dialog('close');
popup_editor(award_id, '');
}
draw_awards_table();
});
return false;
}
@ -414,17 +438,32 @@ function update_eligibility()
award_tab_update['eligibility'] = award_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibility_load&id="+award_id,
function(json){
$("[name=categories\\[\\]]").val(json.categories);
$("[name=divisions\\[\\]]").val(json.divisions);
$("[name^=\"divisions\"]").attr('checked',false);
$("[name^=\"categories\"]").attr('checked',false);
for(i=0;i<json.categories.length;i++) {
var c=json.categories[i];
$("#eligibility_categories_"+c).attr('checked', 'checked');
}
for(i=0;i<json.divisions.length;i++) {
var d=json.divisions[i];
$("#eligibility_divisions_"+d).attr('checked', 'checked');
}
});
}
function prizefields_reset() {
$(".prizeinfo").removeAttr("checked");
$(".prizeinfo").attr("disabled", "disabled").val('');
$("#prizeinfo_save").attr("disabled", "disabled");
}
function prizelist_refresh()
{
$("#prizelist").tableDnD({
onDrop: function(table, row) {
var order = $.tableDnD.serialize();
$("#prizeinfo_info").load("<?=$_SERVER['PHP_SELF']?>?action=prize_order&"+order);
$("#debug").load("<?=$_SERVER['PHP_SELF']?>?action=prize_order&"+order);
/* Change the order */
var rows = table.tBodies[0].rows;
for (var i=0; i<rows.length; i++) {
@ -474,11 +513,31 @@ function edit_prize(id)
$("#prizeinfo_scholarship").val(json.scholarship);
$("#prizeinfo_value").val(json.value);
$("#prizeinfo_number").val(json.number);
$("#prizeinfo_trophystudentkeeper").val([json.trophystudentkeeper]);
$("#prizeinfo_trophystudentreturn").val([json.trophystudentreturn]);
$("#prizeinfo_trophyschoolreturn").val([json.trophyschoolreturn]);
$("#prizeinfo_trophyschoolkeeper").val([json.trophyschoolkeeper]);
$("#prizeinfo_excludefromac").val([json.excludefromac]);
if(json.trophystudentkeeper == 1) {
$("#prizeinfo_trophystudentkeeper").attr("checked", "checked");
} else {
$("#prizeinfo_trophystudentkeeper").removeAttr("checked");
}
if(json.trophystudentreturn == 1) {
$("#prizeinfo_trophystudentreturn").attr("checked", "checked");
} else {
$("#prizeinfo_trophystudentreturn").removeAttr("checked");
}
if(json.trophyschoolreturn == 1) {
$("#prizeinfo_trophyschoolreturn").attr("checked", "checked");
} else {
$("#prizeinfo_trophyschoolreturn").removeAttr("checked");
}
if(json.trophyschoolkeeper == 1) {
$("#prizeinfo_trophyschoolkeeper").attr("checked", "checked");
} else {
$("#prizeinfo_trophyschoolkeeper").removeAttr("checked");
}
if(json.excludefromac == 1) {
$("#prizeinfo_excludefromac").attr("checked", "checked");
} else {
$("#prizeinfo_excludefromac").removeAttr("checked");
}
$(".prizeinfo").removeAttr("disabled");
$("#prizeinfo_save").removeAttr("disabled");
});
@ -505,12 +564,13 @@ function prize_delete(id)
{
var confirm = confirmClick('Are you sure you want to delete this prize?');
if(confirm == true) {
$("#prizeinfo_info").load("<?$_SERVER['PHP_SELF']?>?action=prize_delete&id="+id,null,
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=prize_delete&id="+id, $("#prizeinfo").serializeArray(),
function(responseText, textStatus, XMLHttpRequest)
{
$(".prizelist_tr#"+id).fadeTo('slow', 0);
$(".prizelist_tr#"+id).remove();
prizelist_refresh();
prizefields_reset();
});
}
return 0;
@ -642,7 +702,7 @@ $(document).ready(function() {
</td></tr>
<tr><td><?=i18n("Type")?>:</td><td>
<?
$tq=mysql_query("SELECT id,type FROM award_types WHERE year='{$config['FAIRYEAR']}' ORDER BY type");
$tq=mysql_query("SELECT id,type FROM award_types WHERE conferences_id='{$conference['id']}' ORDER BY type");
echo "<select id=\"awardinfo_award_types_id\" name=\"award_types_id\">";
//only show the "choose a type" option if we are adding,if we are editing, then they must have already chosen one.
echo $firsttype;
@ -687,20 +747,20 @@ $(document).ready(function() {
// if(count($currentcategories)==0) $class="class=\"error\""; else $class="";
//now select all the categories so we can list them all
$cq=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
$cq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY mingrade");
echo mysql_error();
while($cr=mysql_fetch_object($cq)) {
echo "<input type=\"checkbox\" id=\"eligibility_categories_{$cr->id}\" name=\"categories[]\" value=\"$cr->id\" />".i18n($cr->category)."<br />";
echo "<input type=\"checkbox\" id=\"eligibility_categories_{$cr->id}\" name=\"categories[]\" value=\"$cr->id\" /> ".i18n($cr->category)."<br />";
}
?>
</td></tr>
<tr><td><?=i18n("Divisions")?>:</td><td>
<?
$dq=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division");
$dq=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY division");
echo mysql_error();
while($dr=mysql_fetch_object($dq)) {
echo "<input type=\"checkbox\" id=\"eligibility_divisions_{$dr->id}\" name=\"divisions[]\" value=\"$dr->id\" />".i18n($dr->division)."<br />";
echo "<input type=\"checkbox\" id=\"eligibility_divisions_{$dr->id}\" name=\"divisions[]\" value=\"$dr->id\" /> ".i18n($dr->division)."<br />";
}
// if(count($currentcategories)==0 || count($currentdivisions)==0)
// echo "<tr><td colspan=\"2\" class=\"error\">".i18n("At least one age category and one division must be selected")."</td></tr>";
@ -801,6 +861,8 @@ function popup_editor(id, mode)
* activation anyway */
award_tab_update = new Array();
prizefields_reset();
/* Force no tabs to be selected, need to set collapsible
* to true first */
$('#editor_tabs').tabs('option', 'collapsible', true);
@ -843,7 +905,7 @@ function awardlist_refresh()
onDrop: function(table, row) {
var order = $.tableDnD.serialize();
// $(row).fadeTo('fast',1);
$("#award_info").load("<?=$_SERVER['PHP_SELF']?>?action=award_order&"+order);
$("#debug").load("<?=$_SERVER['PHP_SELF']?>?action=award_order&"+order);
/* Change the order */
var rows = table.tBodies[0].rows;
@ -873,6 +935,10 @@ function award_delete(id)
}
function draw_awards_table(){
$('#awards_table').load("<?=$_SERVER['PHP_SELF']?>?action=draw_awards_table");
}
$(document).ready(function() {
awardlist_refresh();
});
@ -934,7 +1000,7 @@ echo "</select>";
echo "</td></tr>";
echo "<tr><td>";
$q=mysql_query("SELECT id,type FROM award_types WHERE year='{$config['FAIRYEAR']}' ORDER BY type");
$q=mysql_query("SELECT id,type FROM award_types WHERE conferences_id='{$conference['id']}' ORDER BY type");
echo "<select name=\"award_types_id\" onchange=\"document.forms.filterchange.submit()\">";
echo "<option value=\"all\">".i18n("All Award Types")."</option>";
while($r=mysql_fetch_object($q)) {
@ -973,43 +1039,63 @@ echo "</table>";
<br /><br />
<?
/* For some reason, this submit button opens the dialog then it closes right away, but it doesn't
* if the entry is done through the a href */
//<input type="submit" onClick="award_create();" value="<?=i18n("Create New Award")>" />
echo "<div id=\"awards_table\">";
draw_awards_table();
echo "</div>";
if($sponsors_id) $where_asi="AND sponsors_id='$sponsors_id'";
if($award_types_id) $where_ati="AND award_types_id='$award_types_id'";
// if($award_sponsors_confirmed) $where_asc="AND award_sponsors.confirmed='$award_sponsors_confirmed'";
if($_GET['action'] == 'edit_prize_template') {
if(!$orderby) $orderby="order";
?><script type="text/javascript">
$(document).ready(function() {
popup_editor(-1,'template');
});
</script>
<?
}
send_footer();
$q=mysql_query("SELECT
award_awards.id,
award_awards.name,
award_awards.order,
award_awards.award_source_fairs_id,
award_types.type,
sponsors.organization
FROM
award_awards
LEFT JOIN sponsors ON sponsors.id = award_awards.sponsors_id
LEFT JOIN award_types ON award_types.id = award_awards.award_types_id
WHERE
award_awards.year='{$config['FAIRYEAR']}'
$where_asi
$where_ati
AND award_types.year='{$config['FAIRYEAR']}'
ORDER BY `$orderby`");
function draw_awards_table(){
global $config;
global $conference;
$award_types_id=$_SESSION['award_types_id'];
$sponsors_id=$_SESSION['sponsors_id'];
echo mysql_error();
/* For some reason, this submit button opens the dialog then it closes right away, but it doesn't
* if the entry is done through the a href */
//<input type="submit" onClick="award_create();" value="<?=i18n("Create New Award")>" />
if(mysql_num_rows($q))
{
echo "* ".i18n("Click on the Script Order and drag to re-order the awards");
echo "<table id=\"awardlist\" class=\"tableview\" >";
echo "<tr class=\"nodrop nodrag\">";
echo " <th>".i18n("Order")."</th>";
echo " <th>".i18n("Sponsor")."</th>";
if($sponsors_id) $where_asi="AND sponsors_id='$sponsors_id'";
if($award_types_id) $where_ati="AND award_types_id='$award_types_id'";
// if($award_sponsors_confirmed) $where_asc="AND award_sponsors.confirmed='$award_sponsors_confirmed'";
if(!$orderby) $orderby="order";
$q=mysql_query("SELECT
award_awards.id,
award_awards.name,
award_awards.order,
award_awards.award_source_fairs_id,
award_types.type,
sponsors.organization
FROM
award_awards
LEFT JOIN sponsors ON sponsors.id = award_awards.sponsors_id
LEFT JOIN award_types ON award_types.id = award_awards.award_types_id
WHERE
award_awards.conferences_id='{$conference['id']}'
$where_asi
$where_ati
AND award_types.conferences_id='{$conference['id']}'
ORDER BY `$orderby`");
echo mysql_error();
if(mysql_num_rows($q)){
echo "* ".i18n("Click on the Script Order and drag to re-order the awards");
echo "<table id=\"awardlist\" class=\"tableview\" >";
echo "<tr class=\"nodrop nodrag\">";
echo " <th>".i18n("Order")."</th>";
echo " <th>".i18n("Sponsor")."</th>";
echo " <th>".i18n("Type")."</th>";
echo " <th>".i18n("Name")."</th>";
echo " <th>".i18n("Prizes")."</th>";
@ -1039,8 +1125,8 @@ if(mysql_num_rows($q))
echo " <td $eh align=\"center\">{$numr['num']}</td>";
echo " <td align=\"center\">";
// echo "<img border=\"0\" src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\">";
// echo "&nbsp;";
// echo "<img border=\"0\" src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\">";
// echo "&nbsp;";
echo "<a onclick=\"award_delete({$r->id});\" href=\"#\" ><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
echo " </td>\n";
@ -1049,24 +1135,9 @@ if(mysql_num_rows($q))
if($hasexternal)
echo "<tr class=\"externalaward\"><td colspan=\"6\">".i18n("Indicates award imported from an external source")."</td></tr>";
echo "</table>\n";
echo "</form>";
// echo "</form>";
}
echo "<br />";
// echo "<a href=\"award_prizes.php?award_awards_id=-1\">Edit prizes for the generic prize template</a>";
if($_GET['action'] == 'edit_prize_template') {
?><script type="text/javascript">
$(document).ready(function() {
popup_editor(-1,'template');
});
</script>
<?
}
send_footer();
//echo "<a href=\"award_prizes.php?award_awards_id=-1\">Edit prizes for the generic prize template</a>";
}
?>

View File

@ -23,7 +23,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('curl.inc.php');
require_once('awards.inc.php');
@ -71,7 +71,7 @@ case 'check':
}
//get a list of all the existing awards for this external source
$aq=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND year='{$config['FAIRYEAR']}'");
$aq=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND conferences_id='{$conference['id']}'");
$existingawards=array();
while($ar=mysql_fetch_object($aq)) {
$existingawards[$ar->id] = true;
@ -109,7 +109,7 @@ case 'check':
$tq=mysql_query("SELECT * FROM award_awards WHERE
external_identifier='$identifier' AND
award_source_fairs_id='$fairs_id' AND
year='$year'");
conferences_id='{$conference['id']}'");
if(mysql_num_rows($tq) == 0) {
/* Award doesn't exist, create it, then update it with the common code below */
mysql_query("INSERT INTO award_awards (award_types_id,
@ -121,9 +121,9 @@ case 'check':
$award_id=mysql_insert_id();
/* By default make all divs/cats eligible */
foreach($divs as $id=>$d)
mysql_query("INSERT INTO award_awards_projectdivisions(award_awards_id,projectdivisions_id,year) VALUES ('$award_id','$id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectdivisions(award_awards_id,projectdivisions_id,conferences_id) VALUES ('$award_id','$id','{$conference['id']}')");
foreach($cats as $id=>$c)
mysql_query("INSERT INTO award_awards_projectcategories(award_awards_id,projectcategories_id,year) VALUES ('$award_id','$id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO award_awards_projectcategories(award_awards_id,projectcategories_id,conferences_id) VALUES ('$award_id','$id','{$conference['id']}')");
} else {
echo i18n("Award already exists, updating info")."<br />";
$awardrecord=mysql_fetch_object($tq);

View File

@ -24,7 +24,7 @@ require_once('../common.inc.php');
require_once('../user.inc.php');
require_once('../projects.inc.php');
require_once('curl.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
//function get_cwsf_award_winners()
function get_winners($awardid, $fairs_id)
@ -68,7 +68,7 @@ function get_winners($awardid, $fairs_id)
$awards = array();
if($awardid == -1) {
/* Get all for this fair */
$q=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q) == 0) {
error_("Can't find award id $awardid");
return false;
@ -78,7 +78,7 @@ function get_winners($awardid, $fairs_id)
}
} else {
/* Get the award */
$q=mysql_query("SELECT * FROM award_awards WHERE id='$awardid' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM award_awards WHERE id='$awardid' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q)!=1) {
error_("Can't find award id $awardid");
return false;
@ -98,7 +98,7 @@ function get_winners($awardid, $fairs_id)
$winners=array( 'id' => $award['id'],
'award_name' => $award['name'],
'external_identifier' => $award['external_identifier'],
'year' => $config['FAIRYEAR'],
'year' => $config['FAIRYEAR'], // FIXME - this needs to be updated to use conference id's
'prizes' => array());
if($fair['type'] != 'sfiab') {
@ -115,7 +115,7 @@ function get_winners($awardid, $fairs_id)
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
awards_prizes_id='$pid' AND
winners.year='{$config['FAIRYEAR']}'");
winners.conferences_id='{$conference['id']}'");
echo mysql_error();
/* Get all projects assigned to this prize */
$prizewinners = array();
@ -123,7 +123,7 @@ function get_winners($awardid, $fairs_id)
/* Get the students */
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='{$project['registrations_id']}'
AND year='{$config['FAIRYEAR']}'");
AND conferences_id='{$conference['id']}'");
$students=array();
while($s=mysql_fetch_assoc($sq)) {
@ -179,7 +179,7 @@ function count_winners($awardid, $fairs_id)
$awards = array();
if($awardid == -1) {
/* Get all for this fair */
$q=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q) == 0) {
error_("Can't find award id $awardid");
return 0;
@ -189,7 +189,7 @@ function count_winners($awardid, $fairs_id)
}
} else {
/* Get the award */
$q=mysql_query("SELECT * FROM award_awards WHERE id='$awardid' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM award_awards WHERE id='$awardid' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q)!=1) {
error_("Can't find award id $awardid");
return 0;
@ -208,7 +208,7 @@ function count_winners($awardid, $fairs_id)
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
awards_prizes_id='$pid' AND
winners.year='{$config['FAIRYEAR']}'");
winners.conferences_id='{$conference['id']}'");
$wc = mysql_fetch_assoc($wq);
$count += $wc['C'];
}
@ -224,7 +224,7 @@ function load_server_cats_divs($fairs_id)
$q = mysql_query("SELECT * FROM fairs WHERE id='$fairs_id'");
$fair = mysql_fetch_assoc($q);
$req = array('get_categories' => array('year' => $config['FAIRYEAR']),
$req = array('get_categories' => array('year' => $config['FAIRYEAR']), // FIXME - this needs to be updated to use conference id's
'get_divisions' => array('year' => $config['FAIRYEAR'])
);
$data = curl_query($fair, $req);
@ -235,7 +235,7 @@ function load_server_cats_divs($fairs_id)
} else {
$catmap = array();
/* Load ours */
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY mingrade");
while($r=mysql_fetch_object($q)) {
foreach($data['categories'] as $id=>$c) {
if($c['mingrade'] == $r->mingrade) {
@ -249,7 +249,7 @@ function load_server_cats_divs($fairs_id)
$divmap = unserialize($fair['divmap']);
} else {
$ret['divmap'] = array();
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$lowest = 999;
$lowest_id = 0;
@ -423,7 +423,7 @@ case 'additional_materials':
$q = mysql_query("SELECT * FROM fairs WHERE id='{$a['award_source_fairs_id']}'");
$fair = mysql_fetch_assoc($q);
$req = array('award_additional_materials' => array(
'year'=>$config['FAIRYEAR'],
'year'=>$config['FAIRYEAR'], // FIXME - this needs to be updated to use conference id's
'identifier'=>$a['external_identifier'])
);
$data = curl_query($fair, $req, $url);
@ -662,7 +662,7 @@ if(!function_exists('curl_init')) {
$q = mysql_query("SELECT fairs.id, fairs.name, fairs.type, COUNT(award_awards.id) as AWARD_COUNT FROM fairs
LEFT JOIN award_awards ON award_awards.award_source_fairs_id=fairs.id
WHERE award_awards.award_source_fairs_id IS NOT NULL
AND award_awards.year='{$config['FAIRYEAR']}'
AND award_awards.conferences_id='{$conference['id']}'
GROUP BY fairs.id
ORDER BY fairs.name ");
echo mysql_error();
@ -706,7 +706,7 @@ $q = mysql_query("SELECT award_awards.id, award_awards.name AS awardname,
FROM award_awards
LEFT JOIN fairs ON fairs.id=award_awards.award_source_fairs_id
WHERE award_awards.award_source_fairs_id IS NOT NULL
AND award_awards.year='{$config['FAIRYEAR']}'
AND award_awards.conferences_id='{$conference['id']}'
ORDER BY fairs.name, award_awards.name");
echo mysql_error();

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Awards",
array('Committee Main' => 'committee_main.php',

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
//make sure storage folder exists
if(!file_exists("../data/userfiles"))

View File

@ -0,0 +1,56 @@
<?
/*
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 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_once("../common.inc.php");
require_once("../user.inc.php");
require_once("../committee.inc.php");
user_auth_required('admin');
require("../tableeditor.class.php");
/* Now, start the output for this page */
send_header("Committee Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php' ),
"committee_management");
echo "<a href=\"committees.php\">Manage Committee Members</a><br />";
$_SESSION['last_page'] = 'committee_management';
//make sure storage folder exists
$editor=new TableEditor("committees",
array("name"=>"Committee Name",
)
);
$editor->setPrimaryKey("id");
$editor->setDefaultSortField("name");
$editor->setRecordType("Committee");
$editor->execute();
send_footer();
?>

View File

@ -26,14 +26,14 @@
require_once("../user.inc.php");
require_once("../committee.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
if($_POST['users_uid'])
$uid = intval($_POST['users_uid']);
if($_POST['accounts_id'])
$accounts_id = intval($_POST['accounts_id']);
/* Now, start the output for this page */
send_header("Committee Management",
send_header("Committee Member Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php' ),
"committee_management");
@ -46,16 +46,10 @@ if($_POST['users_uid'])
<script type="text/javascript">
<!--
function openeditor(id)
{
window.open("user_editor_window.php?id="+id,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
}
function neweditor()
{
var username = document.forms.addmember.add_member.value;
window.open("user_editor_window.php?type=committee&username="+username,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
window.open("../user_editor_window.php?type=committee&username="+username,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
document.forms.addmember.add_member.value = "";
return false;
}
@ -101,7 +95,7 @@ function actionSubmit()
alert('You must choose an action');
return false;
}
if(document.forms.memberaction.users_uid.selectedIndex==0)
if(document.forms.memberaction.accounts_id.selectedIndex==0)
{
alert('You must choose a member');
return false;
@ -109,7 +103,7 @@ function actionSubmit()
if(document.forms.memberaction.action.selectedIndex == 2) {
// Edit
var id = document.forms.memberaction.users_uid.options[document.forms.memberaction.users_uid.selectedIndex];
var id = document.forms.memberaction.accounts_id.options[document.forms.memberaction.accounts_id.selectedIndex];
openeditor(id.value);
// alert("id="+id.value);
return false;
@ -125,24 +119,15 @@ function actionSubmit()
</script>
<?
if($_POST['addcommittee'])
{
//add a new committee
mysql_query("INSERT INTO committees (name) VALUES ('".mysql_escape_string($_POST['addcommittee'])."')");
echo happy(i18n("Committee successfully added"));
}
if($_POST['committees_id'] && $_POST['committees_ord']) {
if($_POST['committees_id']) {
//re-order the committees
$x=0;
$ids=$_POST['committees_id'];
$ords=$_POST['committees_ord'];
$titles=$_POST['title'];
$pords = $_POST['order'];
while($ids[$x]) {
$cid = intval($ids[$x]);
mysql_query("UPDATE committees SET ord='".intval($ords[$x])."' WHERE id='$cid'");
$x++;
$ctitle = $titles[$cid];
@ -153,12 +138,12 @@ if($_POST['committees_id'] && $_POST['committees_ord']) {
if(!is_array($ctitle)) continue;
// print_r($ctitle);
foreach($ctitle as $uid=>$title) {
$o = intval($cord[$uid]);
foreach($ctitle as $accounts_id=>$title) {
$o = intval($cord[$accounts_id]);
$t = mysql_escape_string(stripslashes($title));
$u = intval($uid);
$u = intval($accounts_id);
$q = "UPDATE committees_link SET title='$t', ord='$o'
WHERE committees_id='$cid' AND users_uid='$u'";
WHERE committees_id='$cid' AND accounts_id='$u'";
// echo $q;
mysql_query($q);
}
@ -170,12 +155,12 @@ if($_POST['committees_id'] && $_POST['committees_ord']) {
if($_POST['action']=="assign")
{
if($_POST['committees_id'] && $_POST['users_uid']) {
if($_POST['committees_id'] && $_POST['accounts_id']) {
$cid = intval($_POST['committees_id']);
$q=mysql_query("SELECT * FROM committees_link WHERE committees_id='$cid' AND users_uid='$uid'");
$q=mysql_query("SELECT * FROM committees_link WHERE committees_id='$cid' AND accounts_id='$accounts_id'");
if(!mysql_num_rows($q)) {
mysql_query("INSERT INTO committees_link (committees_id,users_uid) VALUES ('$cid','$uid')");
mysql_query("INSERT INTO committees_link (committees_id,accounts_id) VALUES ('$cid','$accounts_id')");
echo happy(i18n("Successfully added member to committee"));
}
else
@ -185,15 +170,9 @@ if($_POST['action']=="assign")
echo error(("You must choose both a member and a committee"));
}
if($_GET['deletecommittee']) {
$del = intval($_GET['deletecommittee']);
mysql_query("DELETE FROM committees WHERE id='$del'");
echo happy(i18n("Committee removed"));
}
if($_POST['action']=="remove") {
/* user_delete takes care of unlinking the user in other tables */
user_delete($uid, 'committee');
user_delete($accounts_id, 'committee');
echo happy(i18n("Committee member deleted"));
}
@ -201,41 +180,12 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
$mem = intval($_GET['unlinkmember']);
$com = intval($_GET['unlinkcommittee']);
//unlink the member from the committee
mysql_query("DELETE FROM committees_link WHERE users_uid='$mem' AND committees_id='$com'");
mysql_query("DELETE FROM committees_link WHERE accounts_id='$mem' AND committees_id='$com'");
echo happy(i18n("Committee member unlinked from committee"));
}
echo "<table>";
echo "<tr><td>";
echo "<h4>".i18n("Add Committee")."</h4>\n";
echo "<form method=\"post\" action=\"committees.php\">\n";
echo "<table>\n";
echo "<tr><td>".i18n("Committee Name").": </td><td><input type=\"text\" size=\"15\" name=\"addcommittee\" /></td>";
echo " <td><input type=\"submit\" value=\"".i18n("Add")."\" /></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "</td><td width=\"40\">&nbsp;</td><td>";
echo "<h4>".i18n("Add Committee Member")."</h4>\n";
echo "<form method=\"post\" name=\"addmember\" action=\"committees.php\" onsubmit=\"return neweditor();\">\n";
echo "<table>\n";
echo "<tr><td>".i18n("Member Email").": </td><td>";
echo "<input type=\"text\" size=\"15\" name=\"add_member\" />\n";
echo "</td>\n";
echo " <td><input type=\"submit\" onclick=\"return neweditor();\" value=\"".i18n("Add")."\" /></td></tr>\n";
echo "</table>\n";
echo "<a href=\"committees.php\">".i18n("Reload committee list (needed after adding a new member)")."</a>\n";
echo "</form>\n";
echo "</td></tr>";
echo "</table>";
echo "<hr />";
echo "<h4>".i18n("Committee Member Management")."</h4>\n";
echo '<a href="../user_invite.php?type=committee">Create a new member</a><br/>';
echo "<a href=\"committee_committees.php\">Manage Committees</a><br />";
echo "<form name=\"memberaction\" method=\"post\" action=\"committees.php\" onsubmit=\"return actionSubmit()\">\n";
echo "<table>";
echo "<tr><td>";
@ -247,14 +197,19 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
echo "</select>";
echo "</td><td>";
$q=mysql_query("SELECT uid,MAX(year),firstname,lastname,email,deleted FROM users WHERE types LIKE '%committee%' GROUP BY uid ORDER BY firstname");
echo "<select name=\"users_uid\">";
$query = "
SELECT accounts_id, firstname, lastname, email, deleted FROM users WHERE accounts_id IN(
SELECT accounts_id FROM user_roles JOIN roles ON user_roles.roles_id = roles.id WHERE roles.type = 'committee'
)
AND conferences_id = " . $conference['id'];
$q = mysql_query($query);
echo "<select name=\"accounts_id\">";
echo "<option value=\"\">".i18n("Select a Member")."</option>\n";
while($r=mysql_fetch_object($q))
{
if($r->deleted != 'no') continue;
if($r->deleted == 'yes') continue;
$displayname = $r->firstname.' '.$r->lastname;
echo "<option value=\"$r->uid\">$displayname ($r->email)</option>\n";
echo "<option value=\"$r->accounts_id\">$displayname ($r->email)</option>\n";
}
echo "</select>";
@ -290,71 +245,57 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
$q=mysql_query("SELECT * FROM committees ORDER BY ord,name");
if(mysql_num_rows($q))
{
echo "<h4>".i18n("Committees")."</h4>";
echo "<form method=\"post\" action=\"committees.php\">\n";
echo "<table>";
echo "<tr><td colspan=\"2\"></td><td><b>".i18n('Title')."</b></td>";
echo "<td><b>".i18n('Order')."</b></td>";
echo "<td><b>".i18n("Public Email / Private Email")."</b></td></tr>";
while($r=mysql_fetch_object($q))
{
echo "<tr><td colspan=\"2\"></td><th colspan=\"2\">".i18n('Title within committee / Sort order')."</th>";
echo "</tr>";
while($r=mysql_fetch_object($q)) {
echo "<tr>";
echo "<td colspan=\"3\">";
echo "<td colspan=\"4\">";
echo "<input type=\"hidden\" name=\"committees_id[]\" value=\"$r->id\" />";
echo "<input size=\"1\" type=\"text\" name=\"committees_ord[]\" value=\"$r->ord\" />";
echo "&nbsp; <b>$r->name</b>";
// echo "<input size=\"1\" type=\"text\" name=\"committees_ord[]\" value=\"$r->ord\" />";
echo "<b>".i18n($r->name)."</b>";
$q2=mysql_query("SELECT
committees_link.title,
committees_link.ord,
users.uid,
MAX(users.year) AS my,
users.lastname
committees_link.accounts_id
FROM committees_link
JOIN users ON users.uid = committees_link.users_uid
WHERE committees_id='{$r->id}'
GROUP BY users.uid
ORDER BY ord,
users.lastname ");
if(mysql_num_rows($q2)==0) {
echo "&nbsp; &nbsp;";
echo "<a title=\"Remove Committee\" onclick=\"return confirmClick('Are you sure you want to remove this committee?');\" href=\"committees.php?deletecommittee=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=\"0\" alt=\"Remove Committee\" /></a>";
}
ORDER BY ord");
echo "</td></tr>\n";
echo mysql_error();
while($r2=mysql_fetch_object($q2)) {
$u = user_load_by_uid($r2->uid);
$u = user_load_by_accounts_id($r2->accounts_id);
//if rollover is proper, this shouldnt be necessary, but, the simcoe rollover didnt do this, so lets do it here as a safety
if(!$u) {
$roleq=mysql_query("SELECT * FROM roles WHERE type='committee'");
$roler=mysql_fetch_object($roleq);
//hmm thats okay,w e must have missed something in the rollover... sicne its tied to the accounts_id, we just need to add a record
account_add_role($r2->accounts_id,$roler->id,$conference['id']);
//and now we should be able to load them
$u = user_load_by_accounts_id($r2->accounts_id);
}
echo "<tr><td align=\"right\">&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<a title=\"Edit Member\" href=\"#\" onclick=\"openeditor({$u['id']})\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\" border=\"0\" alt=\"Edit\" /></a>";
echo "&nbsp;";
echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember={$u['uid']}&amp;unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>";
echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember={$u['accounts_id']}&amp;unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>";
echo "</td>";
echo "<td valign=\"top\">";
echo "<b>{$u['name']}</b>";
echo "<b>{$u['firstname']} {$u['lastname']}</b>";
echo "</td><td>";
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['uid']}]\" size=\"15\">";
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"25\">";
echo "</td><td>";
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['uid']}]\" size=\"2\">";
echo "</td><td>";
if($u['email']) {
list($b,$a)=split("@",$u['email']);
echo "<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>";
}
if($u['emailprivate']) {
if($u['email']) echo " <b>/</b> ";
list($b,$a)=split("@",$u['emailprivate']);
echo "<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>";
}
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['accounts_id']}]\" size=\"2\">";
echo "</td></tr>\n";
}
echo "<tr><td colspan=\"2\">&nbsp;</td></tr>\n";
echo "<tr><td colspan=\"4\">&nbsp;</td></tr>\n";
}
echo "<tr><td colspan=\"2\"><input type=\"submit\" value=\"".i18n("Save Committee Orders and Titles")."\" /></td></tr>\n";
echo "</table>";

View File

@ -1,92 +1,154 @@
<?
$mailqueries=array(
"myself"=>array("name"=>"Yourself (for testing)","query"=>"SELECT users.id FROM users WHERE users.id='{$_SESSION['users_id']}'"),
"committee_all"=>array("name"=>"Committee members (all)","query"=>
"SELECT firstname, lastname, organization, email FROM users WHERE types LIKE '%committee%' AND deleted='no' GROUP BY uid"),
"SELECT users.id FROM users
JOIN accounts ON users.accounts_id=accounts.id
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type = 'committee' AND accounts.deleted = 'no' "),
/* The WHERE clause evaluates which rows to add to the GROUP
BY, the HAVING clase evaluates which grouped rows show up. We
want to to evaluate 'deleted' AFTER the grouping, so we catch
the case where the MAX(year) has deleted='yes'. If we use WHERE
the case where the MAX(conferences_id) has deleted='yes'. If we use WHERE
deleted='no', we'll only add non-deleted rows to the group, and
end up picking up a user active in, say 2007 and 2008, but
deleted in 2009. */
"judges_all"=>array("name"=>"Judges from all years (except deleted judges)","query"=>
"SELECT firstname, lastname, email, deleted, MAX(year)
FROM users WHERE types LIKE '%judge%' GROUP BY uid HAVING deleted='no' ORDER BY email"),
"judges_all"=>array("name"=>"Judges from all conferences (except deleted judges)","query"=>
"SELECT firstname, lastname, email, deleted, MAX(conferences_id) FROM users
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type ='judge' GROUP BY users.accounts_id HAVING deleted='no' ORDER BY email"),
"judges_active_thisyear"=>array("name"=>"Judges active for this year", "query"=>
"SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"),
"judges_active_thisconference"=>array("name"=>"Judges active for this conference", "query"=>
"SELECT users.id FROM users
LEFT JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type='judge' AND conferences_id={$conference['id']} AND deleted='no' AND user_roles.active='yes' ORDER BY email"),
"judges_inactive"=>array("name"=>"Judges not active for this year", "query"=>
"SELECT firstname, lastname, email, judge_active, deleted, MAX(year)
FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id
WHERE types LIKE '%judge%'
GROUP BY uid HAVING deleted='no' AND ((max(year)='{$config['FAIRYEAR']}' AND judge_active='no') OR max(year)<'{$config['FAIRYEAR']}')
ORDER BY email"),
"judges_inactive_thisconference"=>array("name"=>"Judges in the conference that are not active", "query"=>
"SELECT users.id FROM users
LEFT JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type='judge' AND conferences_id={$conference['id']} AND deleted='no' AND user_roles.active='no' ORDER BY email"),
"judges_active_complete_thisyear"=>array("name"=>"Judges active for this year and complete", "query"=>
"SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND users_judge.judge_complete='yes' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"),
"judges_inactive_allconferences"=>array("name"=>"Judges inactive for any conference", "query"=>
"SELECT users.id FROM users
LEFT JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type='judge' AND deleted='no' AND user_roles.active='no' ORDER BY email"),
"judges_active_incomplete_thisyear"=>array("name"=>"Judges active for this year but not complete", "query"=>
"SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND users_judge.judge_complete='no' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"),
"judges_active_complete_thisconference"=>array("name"=>"Judges active for this conference and complete", "query"=>
"SELECT users.id FROM users
LEFT JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.id
WHERE roles.type = 'judge' AND conferences_id = {$conference['id']}
AND user_roles.complete='yes'
AND deleted='no'
AND user_roles.active='yes'
ORDER BY email"),
"participants_complete_thisyear"=>array("name"=>"Participants complete this year","query"=>
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='".$config['FAIRYEAR']."' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
"judges_active_incomplete_thisconference"=>array("name"=>"Judges active for this conference but not complete", "query"=>
"SELECT users.id FROM users
LEFT JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.id
WHERE roles.type = 'judge' AND conferences_id = {$conference['id']}
AND user_roles.complete='no'
AND deleted='no'
AND user_roles.active='yes'
ORDER BY email"),
"participants_complete_paymentpending_thisyear"=>array("name"=>"Participants complete this year but payment pending","query"=>
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='".$config['FAIRYEAR']."' AND registrations.status!='complete' AND registrations.status='paymentpending' ORDER BY students.email"),
"participants_all_thisconference"=>array("name"=>"Participants (all) for this conference","query"=>
"SELECT users.id
FROM users
JOIN user_roles ON user_roles.users_id=users.id
JOIN roles ON user_roles.roles_id=roles.id
WHERE users.conferences_id='{$conference['id']}'
AND roles.type='participant'"),
"participants_notcomplete_thisyear"=>array("name"=>"Participants not complete this year","query"=>
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='".$config['FAIRYEAR']."' AND registrations.status!='complete' AND registrations.status!='new' ORDER BY students.email"),
"participants_complete_thisconference"=>array("name"=>"Participants complete/paymentpending for this conference","query"=>
"SELECT users.id FROM users
JOIN registrations ON users.registrations_id=registrations.id
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type = 'participant'
AND registrations.conferences_id='".$conference['id']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending')"),
"participants_complete_paymentpending_thisconference"=>array("name"=>"Participants payment pending for this conference","query"=>
"SELECT users.id FROM users
JOIN registrations ON users.registrations_id=registrations.id
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type = 'participant'
AND registrations.conferences_id='".$conference['id']."'
AND registrations.status='paymentpending'"),
"participants_notcomplete_thisconference"=>array("name"=>"Participants not complete for this conference","query"=>
"SELECT users.id
FROM users
JOIN user_roles ON user_roles.users_id=users.id
JOIN roles ON user_roles.roles_id=roles.id
LEFT JOIN registrations ON users.registrations_id=registrations.id
WHERE users.conferences_id='{$conference['id']}'
AND roles.type='participant'
AND (registrations.status IS NULL OR registrations.status='open' OR registrations.status='new')"),
/* // FIXME - not sure if this has a sensible equivalent when dealing with "conferences" rather than fair years
"participants_complete_lastyear"=>array("name"=>"Participants complete last year","query"=>
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='".($config['FAIRYEAR']-1)."' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
"participants_complete_allconferences"=>array("name"=>"Participants complete for all conferences","query"=>
"participants_complete_allyears"=>array("name"=>"Participants complete all years","query"=>
"SELECT DISTINCT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
"SELECT users.id, users.firstname, users.lastname, accounts.email FROM users
JOIN accounts on users.accounts_id=accounts.id
JOIN registrations ON users.registrations_id=registrations.id
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE roles.type = 'participant'
AND (registrations.status='complete' OR registrations.status='paymentpending') ORDER BY accounts.email"),
"participants_cwsf_thisyear"=>array("name"=>"CWSF Winners for this year","query"=>"
SELECT DISTINCT students.firstname, students.lastname, students.email
*/
"participants_cwsf_thisconference"=>array("name"=>"CWSF Winners for this conference","query"=>"
SELECT users.id
FROM award_awards
JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id
JOIN winners ON winners.awards_prizes_id=award_prizes.id
JOIN projects ON winners.projects_id=projects.id
JOIN registrations ON projects.registrations_id=registrations.id
JOIN students ON students.registrations_id=registrations.id
WHERE award_awards.cwsfaward='1' AND winners.year='".$config['FAIRYEAR']."'
ORDER BY students.email"),
JOIN users ON users.registrations_id=registrations.id
WHERE award_awards.cwsfaward='1'
AND winners.conferences_id='".$conference['id']."' "),
"sponsors"=>array("name"=>"Organization sponsors","query"=>
"SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"),
"sponsors_primarycontacts"=>array("name"=>"Organization sponsors (primary contacts)","query"=>
"SELECT uid, MAX(users.year) AS year, 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
FROM sponsors,
users_sponsor,
users
WHERE
users.id=users_sponsor.users_id
AND users_sponsor.sponsors_id=sponsors.id
AND users.types LIKE '%sponsor%'
AND users.deleted='no'
AND users.email!=''
ORDER BY users.email
"),
"SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email
FROM sponsors
JOIN users_sponsor ON users_sponsor.sponsors_id = sponsors.id
JOIN users ON users.id = users_sponsor.users_id
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.roles_id
WHERE
roles.type = 'sponsor'
AND users.deleted='no'
AND users.email!=''
ORDER BY users.email"),
/*
"special_award_sponsors_unconfirmed"=>array("name"=>"Special award sponsors (unconfirmed only)","query"=>
@ -96,22 +158,87 @@
"SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"),
*/
"school_principals"=>array("name"=>"School principals","query"=>
"SELECT school, principal AS firstname, schoolemail AS email FROM schools WHERE schools.year='".$config['FAIRYEAR']."' AND schoolemail!=''"),
"school_scienceheads"=>array("name"=>"School science heads","query"=>
"SELECT school, sciencehead AS firstname, scienceheademail AS email FROM schools WHERE schools.year='".$config['FAIRYEAR']."' AND scienceheademail!=''"),
"school_teachers_thisyear"=>array("name"=>"Teachers (as entered by students) this year","query"=>
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".$config['FAIRYEAR']."' AND teacheremail!=''"),
"school_principals"=>array("name"=>"School principals this conference","query"=>
"SELECT principal_uid AS id FROM schools
WHERE schools.conferences_id='".$conference['id']."'
AND principal_uid>0
"),
"school_scienceheads"=>array("name"=>"School science heads this conference","query"=>
"SELECT sciencehead_uid AS id FROM schools
WHERE schools.conferences_id='".$conference['id']."'
AND sciencehead_uid>0
"),
"teachers_with_school"=>array("name"=>"Teachers with a school in this conference","query"=>
"SELECT users.id
FROM users
JOIN schools ON users.schools_id=schools.id
JOIN user_roles ON users.id=user_roles.users_id
JOIN roles ON user_roles.roles_id=roles.id
WHERE schools.conferences_id='".$conference['id']."'
AND roles.type='teacher'
"),
"teachers_without_school"=>array("name"=>"Teachers without a school in this conference","query"=>
"SELECT users.id
FROM users
JOIN user_roles ON users.id=user_roles.users_id
JOIN roles ON user_roles.roles_id=roles.id
WHERE roles.type='teacher'
AND users.conferences_id='".$conference['id']."'
AND (users.schools_id='' OR users.schools_id=0)
"),
/*
"school_teachers_thisconference"=>array("name"=>"Teachers (as entered by students) for this conference","query"=>
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE conferences_id='".$conference['id']."' AND teacheremail!=''"),
*/
/* // FIXME again, not sure that this has a sensible equivalent with conferences
"school_teachers_lastyear"=>array("name"=>"Teachers (as entered by students) last year","query"=>
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".($config['FAIRYEAR']-1)."' AND teacheremail!=''"),
"school_teachers_allyears"=>array("name"=>"Teachers (as entered by students) all years","query"=>
*/
/*
"school_teachers_allconferences"=>array("name"=>"Teachers (as entered by students) all conferences","query"=>
"SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE teacheremail!=''"),
*/
/* Volunteers */
"volunteers_active_complete_thisyear"=>array("name"=>"Volunteers active for this year and complete", "query"=>
"SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='yes' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND types LIKE '%volunteer%' ORDER BY email"),
"volunteers_active_complete_thisconference"=>array("name"=>"Volunteers active for this conference and complete", "query"=>
"SELECT users.id, firstname, lastname, email
FROM users LEFT 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 roles.type='volunteer'
AND user_roles.complete='yes'
AND user_roles.active='yes'
AND users.deleted='no'
ORDER BY email"),
"volunteers_active_incomplete_thisyear"=>array("name"=>"Volunteers active for this year but not complete", "query"=>
"SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='no' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND users.types LIKE '%volunteer%' ORDER BY email"),
"volunteers_active_incomplete_thisconference"=>array("name"=>"Volunteers active for this conference but not complete", "query"=>
"SELECT users.id, firstname, lastname, email
FROM users LEFT 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 roles.type='volunteer'
AND user_roles.complete='no'
AND user_roles.active='yes'
AND users.deleted='no'
ORDER BY email"),
"accounts_email_unconfirmed" => array("name" => "Users active in any active conference with unconfirmed e-mail addresses", "query" =>
"SELECT users.id
FROM users
JOIN accounts ON users.accounts_id = accounts.id
JOIN conferences ON users.conferences_id = conferences.id
WHERE conferences.status = 'running'
AND accounts.pendingemail IS NOT NULL
AND accounts.pendingemail != ''
"),
"accounts_email_unconfirmed_thisconference" => array("name" => "Users active for this conference with unconfirmed e-mail addresses", "query" =>
"SELECT users.id
FROM users JOIN accounts ON users.accounts_id = accounts.id
WHERE users.conferences_id = {$conference['id']}
AND accounts.pendingemail IS NOT NULL
AND accounts.pendingemail != ''
"),
);
?>

View File

@ -24,7 +24,7 @@
<?
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
function launchQueue() {
if(!file_exists("../data/logs")) {
@ -136,28 +136,12 @@ case 'dialog_choose':
case 'email_save':
$id = intval($_POST['emails_id']);
//we need to character encode BEFORE we myql_real_escape_strintg
//otherwise, a smartquote ' will turn into a normal ' that ends up
//not being escaped!
$name=$_POST['name'];
$description=$_POST['description'];
$from=$_POST['from'];
$subject=$_POST['subject'];
$bodyhtml=$_POST['bodyhtml'];
//add //TRANSLIT to approximate any characters (eg smartquotes) that it doesnt know
$bodyhtml=iconv("UTF-8","ISO-8859-1//TRANSLIT",$bodyhtml);
$name=iconv("UTF-8","ISO-8859-1//TRANSLIT",$name);
$description=iconv("UTF-8","ISO-8859-1//TRANSLIT",$description);
$from=iconv("UTF-8","ISO-8859-1//TRANSLIT",$from);
$subject=iconv("UTF-8","ISO-8859-1//TRANSLIT",$subject);
//Now its safe to escape it for the db query
$name = mysql_real_escape_string(stripslashes($name));
$description = mysql_real_escape_string(stripslashes($description));
$from = mysql_real_escape_string(stripslashes($from));
$subject = mysql_real_escape_string(stripslashes($subject));
$bodyhtml = mysql_real_escape_string(stripslashes($bodyhtml));
// escape all strings for the db query
$name = mysql_real_escape_string($_POST['name']);
$description = mysql_real_escape_string($_POST['description']);
$from = mysql_real_escape_string($_POST['from']);
$subject = mysql_real_escape_string($_POST['subject']);
$bodyhtml = mysql_real_escape_string($_POST['bodyhtml']);
$type = mysql_real_escape_string($_POST['type']);
$key = mysql_real_escape_string($_POST['key']);
@ -305,10 +289,12 @@ case 'dialog_edit':
<option value="LASTNAME">[LASTNAME]</option>
<option value="NAME">[NAME]</option>
<option value="SALUTATION">[SALUTATION]</option>
<option value="USERNAME">[USERNAME]</option>
<option value="PASSWORD">[PASSWORD]</option>
<option value="REGNUM">[REGNUM]</option>
<option value="URLMAIN">[URLMAIN]</option>
<option value="URLLOGIN">[URLLOGIN]</option>
<option value="EMAILCONFIRMATIONLINK">[EMAILCONFIRMATIONLINK]</option>
</select>
</td></tr></table>
</td>
@ -684,6 +670,8 @@ case "email_get_list":
$urllogin = "$urlmain/login.php";
while($r=mysql_fetch_object($recipq)) {
$u=user_load_by_uid($r->users_uid);
$confirmationLink = account_build_email_confirmation_link($u['accounts_id']);
$replacements=array(
"FAIRNAME"=>$config['fairname'],
"SALUTATION"=>$u['salutation'],
@ -694,6 +682,7 @@ case "email_get_list":
"ORGANIZATION"=>$u['sponsor']['organization'],
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
"EMAILCONFIRMATIONLINK" => $confirmationLink,
);
if($u['email'] && $u['email'][0] != '*') {
@ -818,7 +807,9 @@ case "email_get_list":
$urllogin = "$urlmain/login.php";
while($r=mysql_fetch_object($recipq)) {
if($r->uid)
if($r->id)
$u=user_load($r->id);
else if($r->uid)
$u=user_load_by_uid($r->uid);
else if($r->users_uid)
$u=user_load_by_uid($r->users_uid);
@ -831,27 +822,47 @@ case "email_get_list":
"FIRSTNAME"=>$r->firstname,
"LASTNAME"=>$r->lastname,
"NAME"=>$r->firstname." ".$r->lastname,
"EMAIL"=>$r->email,
"ORGANIZATION"=>$r->organization,
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
);
}
if($u) {
$a=account_load($u['accounts_id']);
$apassword=account_get_password($u['accounts_id']);
$confirmationLink = account_build_email_confirmation_link($u['accounts_id']);
if($a['email']) {
$e=$a['email'];
}
else if ($a['pendingemail']) {
$e=$a['pendingemail'];
}
else {
$e="";
}
if($u['registrations_id']) {
$regq=mysql_query("SELECT num FROM registrations WHERE id='{$u['registrations_id']}'");
$regr=mysql_fetch_assoc($regq);
}
$replacements=array(
"FAIRNAME"=>$config['fairname'],
"SALUTATION"=>$u['salutation'],
"FIRSTNAME"=>$u['firstname'],
"LASTNAME"=>$u['lastname'],
"NAME"=>$u['name'],
"EMAIL"=>$u['email'],
"EMAIL"=>$e,
"USERNAME"=>$a['username'],
"PASSWORD"=>$apassword,
"REGNUM"=>$regq['num'],
"ORGANIZATION"=>$u['sponsor']['organization'],
"URLMAIN"=>$urlmain,
"URLLOGIN"=>$urllogin,
"EMAILCONFIRMATIONLINK" => $confirmationLink,
);
$toname=$u['name'];
$toemail=$u['email'];
$toemail=$e;
}
if($toemail) {

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
if($_GET['action']=="status") {
$q=mysql_query("SELECT * FROM emailqueue WHERE finished IS NULL");

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('xml.inc.php');
function xml_dearray(&$array)

View File

@ -28,11 +28,11 @@ include "xml.inc.php";
{
global $config;
$winners=array();
$winners_ids=array();
$q=mysql_query("SELECT * FROM award_awards WHERE cwsfaward='1' AND year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q)==1)
$q=mysql_query("SELECT * FROM award_awards WHERE cwsfaward='1' AND conferences_id='".$conference['id']."'");
while($award=mysql_fetch_object($q))
{
$award=mysql_fetch_object($q);
$pq=mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='$award->id'");
while($prize=mysql_fetch_object($pq))
{
@ -51,11 +51,16 @@ include "xml.inc.php";
WHERE
winners.projects_id=projects.id AND
awards_prizes_id='$prize->id' AND
winners.year='".$config['FAIRYEAR']."'");
winners.conferences_id='".$conference['id']."'");
echo mysql_error();
while($project=mysql_fetch_object($wq))
{
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$project->registrations_id' AND year='".$config['FAIRYEAR']."'");
if(array_key_exists($project->id, $winners_ids)) {
continue;
} else {
$winners_ids[$project->id] = true;
}
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$project->registrations_id' AND conferences_id='".$conference['id']."'");
$students=array();
$cwsf_agecategory=0;
while($s=mysql_fetch_object($sq))
@ -117,7 +122,7 @@ include "xml.inc.php";
<?
require("../common.inc.php");
require("../projects.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("One-Click CWSF Registration",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
@ -188,21 +193,20 @@ include "xml.inc.php";
if($ok)
{
$q=mysql_query("SELECT * FROM award_awards WHERE cwsfaward='1' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM award_awards WHERE cwsfaward='1' AND conferences_id='".$conference['id']."'");
if(!mysql_num_rows($q))
{
echo error(i18n("Cannot find an award that is specified as the Canada-Wide Science Fair Award"));
echo i18n("Please go to the awards manager and select which award identifies your CWSF students");
}
else if(mysql_num_rows($q)>1)
{
echo error(i18n("There is more than one award that is identified as your Canada-Wide Science Fair award."));
echo i18n("Please go to the awards manager and choose only one award that identifies your CWSF students");
}
else
{
$award=mysql_fetch_object($q);
echo "<b>".i18n("CWSF Award").":</b> ".$award->name."<br />";
echo "<b>".i18n("CWSF Awards").":</b> <br />";
echo "<ul>";
while($award=mysql_fetch_object($q)) {
echo "<li>{$award->name}</li>";
}
echo "</ul>";
echo i18n("Please review the list of winning projects/students below. If it is all correct then you can click the 'Register for CWSF' button at the bottom of the page to send the information to YSC");
echo "<br />";
echo "<br />";
@ -258,7 +262,7 @@ include "xml.inc.php";
echo "</td><td>";
$t=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$winner['projectdivisions_id']."'");
$t=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' AND id='".$winner['projectdivisions_id']."'");
$tr=mysql_fetch_object($t);
echo $tr->division;
echo "<br />";

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
$q=mysql_query("SELECT * FROM documents WHERE id='".$_GET['id']."'");
if($r=mysql_fetch_object($q))
{

View File

@ -31,7 +31,7 @@
if(!file_exists("../data/documents/.htaccess"))
file_put_contents("../data/documents/.htaccess","Order Deny,Allow\r\nDeny From All\r\n");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Internal Document Manager",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),

View File

@ -1,175 +0,0 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2008 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("../tableeditor.class.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
include ("fundraising_sponsorship_handler.inc.php");
include ("fundraising_goals_handler.inc.php");
include ("fundraising_main.inc.php");
send_header("Donations",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Fundraising' => 'admin/fundraising.php'),
"fundraising"
);
?>
<script type="text/javascript">
$(document).ready(function() {
//initialize the dialog
$("#sponsorship_editor").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: false,
draggable: false
});
$("#fund_editor").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: falsefundraising
draggable: false
});
refresh_fundraising_table();
});
function popup_sponsorship_editor(url) {
var w = (document.documentElement.clientWidth * 0.6);
$('#sponsorship_editor').dialog('option','width',w);
//let the height autocalculate
/*
var h = (document.documentElement.clientHeight * 0.6);
$('#sponsorship_editor').dialog('option','height',h);
*/
$('#sponsorship_editor').dialog('option','buttons',{ "<?=i18n("Save")?>": function() { save_sponsorship(); },
"<?=i18n("Cancel")?>": function(){ $(this).dialog("close");}});
$('#sponsorship_editor').dialog('open');
$('#sponsorship_editor_content').load(url);
return false;
}
function save_sponsorship() {
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
$("#fundraisingsponsorship").serializeArray(),
function() {
$('#sponsorship_editor').dialog('close');
refresh_fundraising_table();
});
return false;
}
function popup_fund_editor(url) {
var w = (document.documentElement.clientWidth * 0.6);
$('#fund_editor').dialog('option','width',w);
//let the height autocalculate
/*
var h = (document.documentElement.clientHeight * 0.6);
$('#fund_editor').dialog('option','height',h);
*/
$('#fund_editor').dialog('option','buttons',{ "<?=i18n("Save")?>": function() { save_fund(); },
"<?=i18n("Cancel")?>": function(){ $(this).dialog("close");}});
$('#fund_editor').dialog('open');
$('#fund_editor_content').load(url);
return false;
}
function save_fund() {
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
$("#fundraisingfundraising").serializeArray(),
function(data) {
$('#fund_editor').dialog('close');
refresh_fundraising_table();
});
return false;
}
function delete_fund(id) {
if(confirmClick('Are you sure you want to remove this fund?')) {
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
{ action: 'funddelete', delete: id },
function() {
refresh_fundraising_table();
}
);
}
return false;
}
function delete_sponsorship(id) {
if(confirmClick('Are you sure you want to remove this sponsorship?')) {
$('#debug').load("<?=$config['SFIABDIRECTORY']?>/admin/fundraising.php",
{ action: 'sponsorshipdelete', delete: id },
function() {
refresh_fundraising_table();
}
);
}
return false;
}
function refresh_fundraising_table() {
$("#fundraisingmain").load("fundraising.php?action=fundraisingmain");
}
</script>
<?
//first, insert any defaults
$q=mysql_query("SELECT * FROM fundraising WHERE year='".$config['FAIRYEAR']."'");
if(!mysql_num_rows($q)) {
$q=mysql_query("SELECT * FROM fundraising WHERE year='-1'");
while($r=mysql_fetch_object($q)) {
mysql_query("INSERT INTO fundraising (`type`,`name`,`description`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','".mysql_real_escape_string($r->description)."','$r->system','$r->goal','".$config['FAIRYEAR']."')");
}
}
echo "<div id=\"fundraisingmain\">";
echo "</div>";
echo "<br />\n";
echo "<br />\n";
echo "<a href=\"sponsorship_levels.php\">Manage Donation Levels</a>\n";
echo "<br />\n";
echo "<a href=\"donors.php\">Manage Donors</a>\n";
echo "<br />\n";
?>
<div style="display: none" title="<?=i18n("Donation Editor")?>" id="sponsorship_editor">
<div id="sponsorship_editor_content">
</div>
</div>
<div style="display: none" title="<?=i18n("Fund Editor")?>" id="fund_editor">
<div id="fund_editor_content">
</div>
</div>
<?
send_footer();
?>

View File

@ -24,7 +24,8 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require_once("../account.inc.php");
user_auth_required('admin');
require_once("fundraising_common.inc.php");
@ -40,7 +41,7 @@ switch($_GET['action']) {
case 'organizationinfo_save':
$id=intval($_POST['sponsor_id']);
if($id==-1) {
$q=mysql_query("INSERT INTO sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
$q=mysql_query("INSERT INTO sponsors (conferences_id) VALUES ('".$conference['id']."')");
$id=mysql_insert_id();
echo json_encode(array("id"=>$id));
save_activityinfo("Created donor/sponsor", $id, $_SESSION['users_uid'],"System");
@ -213,22 +214,20 @@ switch($_GET['action']) {
echo "<tr><td>";
echo i18n("Appeal").":";
echo "</td><td>";
$query = mysql_query(
"SELECT accounts.id as acc_id, users.id as usr_id, users.deleted, MAX(users.id) FROM accounts JOIN users ON" .
" users.accounts_id = accounts.id" .
" WHERE users.sponsors_id = '$id'" .
" AND types LIKE '%sponsor%'" .
" GROUP BY acc_id" .
" HAVING deleted='no'" .
" ORDER BY `primary` DESC, lastname, firstname"
);
// loop through each contact in the donor
$query = mysql_query("SELECT users.id,users.uid,users.deleted,MAX(year)
FROM users
LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
WHERE
sponsors_id='$id'
AND types LIKE '%sponsor%'
GROUP BY uid
HAVING deleted='no'
ORDER BY users_sponsor.primary DESC,lastname,firstname
");
echo mysql_error();
$uids=array();
while($r=mysql_fetch_object($query)) {
$uids[]=$r->uid;
$uids[]=$r->usr_id;
}
$q=mysql_query("SELECT * FROM fundraising_campaigns
@ -352,12 +351,12 @@ switch($_GET['action']) {
case 'newcontactsearch':
if($_POST['email'])
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY uid HAVING deleted='no'");
$q=mysql_query("SELECT *, MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
if($r=mysql_fetch_object($q)) {
echo i18n("There is an exact email address match for %1",array($_POST['email']));
echo "<ul>";
echo "<li><a href=\"#\" onclick=\"useexistingcontact($r->uid)\">$r->firstname $r->lastname $r->email $r->phonehome</a></li>\n";
echo "<li><a href=\"#\" onclick=\"useexistingcontact($r->accounts_id)\">$r->firstname $r->lastname $r->email $r->phonehome</a></li>\n";
echo "</ul>";
?>
@ -381,7 +380,7 @@ switch($_GET['action']) {
if($_POST['email'])
$searchstr.=" AND email LIKE '%".$_POST['email']."%'";
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE $searchstr GROUP BY uid HAVING deleted='no'");
$q=mysql_query("SELECT *, MAX(id) FROM users WHERE $searchstr GROUP BY accounts_id HAVING deleted='no'");
$num=mysql_num_rows($q);
if($num==0) {
echo i18n("No existing users match, will create a new user");
@ -390,7 +389,7 @@ switch($_GET['action']) {
echo i18n("Did you mean one of these existing users? (click to choose one)")."<br />";
echo "<ul>";
while($r=mysql_fetch_object($q)) {
echo "<li><a href=\"#\" onclick=\"useexistingcontact($r->uid)\">$r->firstname $r->lastname $r->email $r->phonehome</a></li>\n";
echo "<li><a href=\"#\" onclick=\"useexistingcontact($r->accounts_id)\">$r->firstname $r->lastname $r->email $r->phonehome</a></li>\n";
}
echo "</ul>";
}
@ -473,13 +472,13 @@ function delete_contact(){
}
function addexisting_contact() {
$uid=intval($_POST['uid']);
$sponsors_id=intval($_POST['id']);
echo "Linking uid=$uid to sponsors_id=$sponsors_id <br />";
$accid = intval($_POST['accounts_id']);
$sponsors_id = intval($_POST['id']);
echo "Linking accounts_id=$accid to sponsors_id=$sponsors_id <br />";
echo "uid $uid has users.id {$u['id']}";
// echo "uid $uid has users.id {$u['id']}";
$u=user_load_by_uid($uid);
$u=user_load_by_accounts_id($accid);
$u['sponsors_id']=$sponsors_id;
$u['types'][]="sponsor";
user_save($u);
@ -498,7 +497,7 @@ function save_contact(){
if($_POST['recordtype'] == 'new'){
if($_POST['email']) {
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY uid HAVING deleted='no'");
$q=mysql_query("SELECT *,MAX(id) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY accounts_id HAVING deleted='no'");
if(mysql_num_rows($q)) {
error_("A user with that email address already exists");
exit;
@ -508,8 +507,11 @@ function save_contact(){
// this is a new record being submitted. Create the user.
$successMessage = "Contact created successfully";
$successLog = "Added contact ";
$u = user_create("sponsor", $_POST['email']);
$id = $u['id'];
$acc = account_create($_POST['email']);
$accid = $acc['id'];
$usr = user_create($accid);
user_add_role($usr, 'sponsor');
//sponsor
}else if($_POST['recordtype'] == 'existing'){
// this is an existing record being updated. Load the user.
$successMessage = "Contact updated successfully";
@ -523,14 +525,16 @@ function save_contact(){
$p = ($_POST['primary']=='yes')?'yes':'no';
if($p == 'no') {
/* Make sure this sponsor ($sponsor_id) has a primary */
$query = "SELECT users_id
FROM users_sponsor, users
$query = "SELECT users.id
FROM users
JOIN user_roles ON users_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.id
WHERE
users_sponsor.users_id=users.id
AND sponsors_id='$sponsor_id'
AND `primary`='yes'
AND year='".$config['FAIRYEAR']."'
AND users_id!='$id'";
roles.type = 'sponsor'
AND users.sponsors_id='$sponsor_id'
AND users.`primary`='yes'
AND users.conferences_id = '{$conference['id']}'
AND users.id != '$id'";
$q = mysql_query($query);
if(mysql_num_rows($q) == 0) {
/* This has to be the primary since there isn't one already */
@ -600,17 +604,18 @@ function draw_contactsinfo_form($contact = null){
// start our accordion
echo "<div id=\"contactaccordion\" style=\"width: 740px;\">\n";
// loop through each contact and draw a form with their data in it.
$query = mysql_query("SELECT *,MAX(year) FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
WHERE
sponsors_id='" . $sponsor_id . "'
AND types LIKE '%sponsor%'
GROUP BY uid
HAVING deleted='no'
ORDER BY users_sponsor.primary DESC,lastname,firstname
$query = mysql_query("
SELECT *, MAX(conferences_id)
FROM users
JOIN user_roles ON user_roles.users_id = users.id
JOIN roles ON roles.id = user_roles.id
WHERE roles.type = 'sponsor'
AND users.sponsors_id = '" . $sponsor_id . "'
GROUP BY conferences_id
HAVING deleted = 'no'
ORDER BY `primary` DESC , lastname, firstname
");
echo mysql_error();
while($contact = mysql_fetch_array($query)){
// draw a header for this user
@ -641,7 +646,6 @@ function draw_contactsinfo_form($contact = null){
// draw a form in which to enter information about the various contacts
function draw_contact_form($sponsor_id, $contact = null){
global $salutations;
global $config;
//grab the sponsor details, so we can do diff things for individual vs organization
@ -653,7 +657,7 @@ function draw_contact_form($sponsor_id, $contact = null){
}else{
$id = "new";
if($sponsor->donortype=="individual") {
list($firstname,$lastname)=split(" ",$sponsor->organization,2);
list($firstname,$lastname)=explode(" ",$sponsor->organization,2);
$contact['firstname']=$firstname;
$contact['lastname']=$lastname;
$contact['email']=$sponsor->email;
@ -687,14 +691,7 @@ function draw_contact_form($sponsor_id, $contact = null){
<tr>
<td><?=i18n("Salutation"); ?></td>
<td>
<select name="salutation">
<option value=""><?=i18n("Choose")?></option>
<?
foreach($salutations AS $salutation) {
if($contact['salutation']==$salutation) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$salutation\">$salutation</option>\n";
}
?>
<input name="salutation" type="text" value="<?=htmlspecialchars($contact['salutation'])?>">
</select>
</td>
<td><?=i18n("Position"); ?></td>
@ -741,7 +738,7 @@ function draw_contact_form($sponsor_id, $contact = null){
<tr>
<td><?=i18n("Notes"); ?></td>
<td colspan="3"><textarea name="notes" cols="60" rows="4"><?=htmlspecialchars($contact['notes'])?></textarea></td>
<td colspan="3"><textarea name="notes" cols="60" rows="8"><?=htmlspecialchars($contact['notes'])?></textarea></td>
</tr>
<tr>
<td><?=i18n("Primary Contact")?></td>
@ -815,8 +812,8 @@ function draw_activityinfo_form(){
FROM fundraising_donor_logs AS fdl
LEFT JOIN users ON fdl.users_id=users.id
LEFT JOIN fundraising_campaigns ON fdl.fundraising_campaigns_id=fundraising_campaigns.id
WHERE sponsors_id=" . $sponsorid. " ORDER BY dt DESC";
//echo "<tr><td colspan=\"3\">" . $query . "</td></tr>";
WHERE fdl.sponsors_id=" . $sponsorid. " ORDER BY dt DESC";
// echo "<tr><td colspan=\"4\">" . $query . "</td></tr>";
$q = mysql_query($query);
echo mysql_error();
if(mysql_num_rows($q)) {
@ -1052,9 +1049,9 @@ function update_contactsinfo()
);
}
function contactsinfo_save(uid) {
function contactsinfo_save(accounts_id) {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save&id="+id, $("#contact_" + uid).serializeArray(),
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save&id="+id, $("#contact_" + accounts_id).serializeArray(),
function() {
$("#contactaccordion").accordion();
update_contactsinfo();
@ -1062,9 +1059,9 @@ function contactsinfo_save(uid) {
return false;
}
function contactsinfo_delete(uid) {
function contactsinfo_delete(accounts_id) {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_delete&id="+id, $("#contact_" + uid).serializeArray(),
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_delete&id="+id, $("#contact_" + accounts_id).serializeArray(),
function() {
$("#contactaccordion").accordion();
update_contactsinfo();
@ -1114,9 +1111,9 @@ function donewcontactsearch() {
$("#newcontactsearch").load("<?=$_SERVER['PHP_SELF']?>?action=newcontactsearch",$("#contact_new").serializeArray());
}
function useexistingcontact(uid) {
function useexistingcontact(accounts_id) {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_addexisting",{id: id, uid: uid} ,function() { update_contactsinfo(); });
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_addexisting",{id: id, accounts_id: accounts_id} ,function() { update_contactsinfo(); });
}
function togglefulldonationhistory() {
@ -1239,7 +1236,7 @@ echo "<hr />";
</td></tr>
*/
?>
<tr><td><?=i18n("Notes")?></td><td colspan="5"><textarea id="organizationinfo_notes" name="notes" rows="4" cols="60"></textarea></td></tr>
<tr><td><?=i18n("Notes")?></td><td colspan="5"><textarea id="organizationinfo_notes" name="notes" rows="8" cols="60"></textarea></td></tr>
</table>
<input id="organizationinfo_save_button" type="submit" value="<?=i18n("Save")?>" onClick="return organizationinfo_save()" />
</form>

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
echo "<br />\n";
//$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization");

91
admin/events.php Normal file
View File

@ -0,0 +1,91 @@
<?
/*
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 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("../tableeditor.class.php");
require_once("../user.inc.php");
user_auth_required('admin');
send_header("Events Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Events & Scheduling' => 'admin/eventsscheduling.php'),
"events_scheduling" );
echo "<br />";
$editor = new TableEditor('events',
array(
"name" => "Event Name",
"eventtype" => "Type",
"suggested_grades" => "Suggested Grades",
),
array(
"name" => "Event Name",
"eventtype" => "Type",
"summary" => "Summary",
"website" => "Link to Description",
"suggested_grades" => "Suggested Grades",
"default_min_teams" => "Minimum Number of Teams",
"default_max_teams" => "Maximum Number of Teams",
"default_min_team_size" => "Minimum Team Size",
"default_max_team_size" => "Maximum Team Size",
"default_min_judges" => "Minimum Number of Judges",
"default_max_judges" => "Maximum Number of Judges",
"default_min_volunteers" => "Minimum Number of Volunteers",
"default_max_volunteers" => "Maximum Number of Volunteers"
),
array(
"conferences_id" => $conference['id']
)
);
$eventtypes=array( array('key'=>"general", 'val'=>"General"),
array('key'=>"scienceolympic", 'val'=>"Science Olympics Activity"),
array('key'=>"sciencefairjudging", 'val'=>"Science Fair Judging"),
array('key'=>"tour", 'val'=>"Tour")
);
$editor->setFieldOptions("eventtype",$eventtypes);
$editor->setPrimaryKey("id");
$editor->setRecordType("Event");
$editor->setDefaultSortField("eventtype,name");
$editor->filterList("conferences_id", $conference['id']);
$editor->setFieldDefaultValue("default_min_teams",1);
$editor->setFieldDefaultValue("default_max_teams",4);
$editor->setFieldDefaultValue("default_min_team_size",1);
$editor->setFieldDefaultValue("default_max_team_size",6);
$editor->setFieldDefaultValue("default_min_judges",1);
$editor->setFieldDefaultValue("default_max_judges",2);
$editor->setFieldDefaultValue("default_min_volunteers",1);
$editor->setFieldDefaultValue("default_max_volunteers",5);
$editor->execute();
send_footer();
?>

View File

@ -0,0 +1,41 @@
<?
/*
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 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");
user_auth_required('admin');
send_header("Events &amp; Scheduling",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
"events_scheduling" );
echo "<br />";
echo "<a href=\"locations.php\">".i18n('Event Locations')."</a><br />";
echo "<a href=\"events.php\">".i18n('Event Management')."</a><br />";
echo "<a href=\"schedule.php\">".i18n('Schedule Management')."</a><br />";
send_footer();
?>

View File

@ -215,7 +215,7 @@ TRACE("Grid size: {$grid_size}m\n");
$div = array();
TRACE("Loading Project Divisions...\n");
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q))
{
$divshort[$r->id]=$r->division_shortform;
@ -225,7 +225,7 @@ while($r=mysql_fetch_object($q))
TRACE("Loading Project Age Categories...\n");
$cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$catshort[$r->id]=$r->category_shortform;
$cat[$r->id]=$r->category;
@ -236,7 +236,7 @@ TRACE("Loading Projects...\n");
$projects = array();
$q = mysql_query("SELECT projects.* FROM projects, registrations
WHERE
projects.year='{$config['FAIRYEAR']}'
projects.conferences_id='{$conference['id']}'
AND registrations.id = projects.registrations_id
".getJudgingEligibilityCode());
while($p = mysql_fetch_object($q)) {
@ -597,7 +597,7 @@ for($x=0;$x<$a->num_buckets; $x++) {
print_r($projects);
/* Assign floor numbers */
mysql_query("UPDATE projects SET floornumber=0 WHERE year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE projects SET floornumber=0 WHERE conferences_id='{$conference['id']}'");
foreach($projects as $pid=>$p) {
mysql_query("UPDATE projects SET floornumber='{$p['floornumber']}' WHERE id='$pid'");

View File

@ -24,16 +24,16 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
$catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$_GET['cat']."'");
$catq=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' AND id='".$_GET['cat']."'");
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();
@ -48,7 +48,7 @@ if($catr=mysql_fetch_object($catq))
registrations
left outer join projects on projects.registrations_id=registrations.id
WHERE
registrations.year='".$config['FAIRYEAR']."'
registrations.conferences_id='".$conference['id']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending' )
AND projects.projectcategories_id='$catr->id'
ORDER BY
@ -74,7 +74,7 @@ if($catr=mysql_fetch_object($catq))
}
while($r=mysql_fetch_object($q))
{
$divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'");
$divq=mysql_query("SELECT division,division_shortform FROM projectdivisions WHERE conferences_id='".$conference['id']."' AND id='".$r->projectdivisions_id."'");
$divr=mysql_fetch_object($divq);
$sq=mysql_query("SELECT students.firstname,

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('xml.inc.php');
require_once('stats.inc.php');
require_once('curl.inc.php');
@ -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;

View File

@ -37,7 +37,7 @@
'delegates' => 'Delegate information/jacket size for CWSF',
);
user_auth_required('committee', 'admin');
user_auth_required('admin');
switch($_GET['action']) {
@ -92,7 +92,7 @@ function stats_save()
<input type="hidden" name="fairs_id" value="<?=$f['id']?>" />
<table class="editor">
<?
$selected_stats = split(',', $f['gather_stats']);
$selected_stats = explode(',', $f['gather_stats']);
foreach($stats as $s=>$d) {
$ch = in_array($s, $selected_stats) ? 'checked="checked"' : '';
echo "<tr><td class=\"left\"><input type=\"checkbox\" id=\"stats_$s\" name=\"stats[]\" value=\"$s\" $ch /></td>";

View File

@ -3,7 +3,7 @@
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
$q = mysql_query("SELECT * FROM judges WHERE passwordexpiry IS NULL");
while($i = mysql_fetch_object($q)) {

View File

@ -24,7 +24,7 @@
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
if($_GET['action']=="refresh") {
?>

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("fundraising_common.inc.php");
switch($_GET['action']){
@ -36,19 +36,29 @@ switch($_GET['action']){
echo "<div id=\"campaignaccordion\" style=\"width: 780px;\">\n";
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
echo "<h3><a href=\"#\">".htmlspecialchars($r->name)."</a></h3>\n";
echo "<h3 id=\"campaigntitle_{$r->id}\"><a href=\"#\">".htmlspecialchars($r->name)."</a></h3>\n";
echo "<div id=\"campaign_{$r->id}\">\n";
echo "<table>\n";
echo "<form id=\"campaigninfo_{$r->id}\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" onsubmit=\"return campaigninfo_save($r->id)\">\n";
echo "<input type=\"hidden\" name=\"campaign_id\" value=\"{$r->id}\" />\n";
echo "<table>\n";
display_campaign_form($r);
?>
<tr><td colspan="6" style="text-align: center;">
<br />
<input type="submit" value="<?=i18n("Save Appeal")?>"></td>
</tr>
</table>
</form>
<tr><td colspan="6" style="text-align: center;">
<br />
<?php
echo "<form id=\"campaignremove_{$r->id}\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" onsubmit=\"return campaigninfo_remove($r->id)\">\n";
echo "<input type=\"hidden\" name=\"campaign_id\" value=\"{$r->id}\" />\n";
?>
<br />
<input type="submit" value="<?=i18n("Delete Appeal")?>"></td>
</form>
</td></tr>
</table>
</div>
<?
}
@ -429,7 +439,7 @@ switch($_GET['action']){
echo "<input type=\"button\" onclick=\"return opensendemaildialog($campaign_id,$email->id)\" value=\"".i18n("Send as email")."\" />";
echo "<br />\n";
if($email->lastsent) {
list($date,$time)=split(" ",$email->lastsent);
list($date,$time)=explode(" ",$email->lastsent);
echo i18n("Last Sent");
echo "<br />".format_date($date);
echo "<br />".format_time($time);
@ -493,8 +503,35 @@ switch($_GET['action']){
mysql_query("DELETE FROM emails WHERE id='$emails_id'");
happy_("Communicaton removed");
}
exit;
break;
case "campaign_remove":
$campaign_id = $_POST['campaign_id'];
if(is_numeric($campaign_id)) {
mysql_query("DELETE FROM fundraising_campaigns WHERE
(SELECT COUNT(*) FROM fundraising_donations WHERE fundraising_campaigns_id = $campaign_id) = 0 AND
(SELECT count(*) FROM emails WHERE fundraising_campaigns_id = $campaign_id) = 0 AND
id = $campaign_id");
if(mysql_affected_rows() == 0) {
error_("Cannot delete campaign. It is in use.");
} else {
mysql_query("DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id = $campaign_id");
mysql_query("DELETE FROM fundraising_donations WHERE fundraising_campaigns_id = $campaign_id");
mysql_query("DELETE FROM fundraising_donor_logs WHERE fundraising_campaigns_id = $campaign_id");
mysql_query("DELETE FROM emailqueue WHERE fundraising_campaigns_id = $campaign_id");
mysql_query("DELETE FROM emails WHERE fundraising_campaigns_id = $campaign_id");
happy_("Campaign removed");
echo "<script type=\"text/javascript\">";
echo " $('#campaigntitle_$campaign_id').remove();";
echo " $('#campaign_$campaign_id').remove();";
echo "</script>";
}
} else {
error_("Invalid Campaign ID");
}
exit;
break;
}
@ -612,6 +649,11 @@ function campaigninfo_save(id) {
return false;
}
function campaigninfo_remove(id) {
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=campaign_remove", $("#campaignremove_"+id).serializeArray());
return false;
}
function update_tab_overview() {
$("#campaign_tab_overview").load("<?$_SERVER['PHP_SELF']?>?action=manage_tab_overview&id="+currentcampaignid);
}

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("fundraising_common.inc.php");
$userslist=array();

View File

@ -1,6 +1,5 @@
<?
$campaign_types=array("Mail","Email","Phone","Personal Visit","Event","Other");
$salutations=array("Mr.","Mrs.","Ms","Dr.","Professor");
function getGoal($goal) {
global $config;

View File

@ -1,88 +0,0 @@
<?
if($_GET['action']=="fundraisingmain") {
//this table is eventually going to be massive, and probably not in a tableview format, it'll show goals as well as all ongoing fund pledges, probabilities, etc as well as over/under, etc, all prettily colour coded.. basically a good overview of the total fundraising status of the fair.
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY system DESC,goal");
echo "<table class=\"fundraisingtable\">";
while($r=mysql_fetch_object($q)) {
echo "<tr>";
echo "<th><a title=\"".i18n("Edit fund details")."\" onclick=\"return popup_fund_editor('fundraising_types.php?id=$r->id')\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
if($r->system=="no") {
//echo "<a title=\"".i18n("Remove Fund")."\" onclick=\"return confirmClick('Are you sure you want to remove this fund and all sponsorships inside it?')\" href=\"fundraising.php?action=funddelete&delete=$r->id\">";
echo "<img style=\"cursor:pointer\" onclick=\"return delete_fund($r->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
// echo "</a>";
}
echo "</th>\n";
echo "<th colspan=\"5\">".i18n($r->name)."</th>\n";
echo "<th style=\"text-align: right\"><nobr>".format_money($r->budget)."</nobr></th>\n";
echo "</tr>\n";
if($r->type=="general")
$orsql.="OR fundraising_type IS NULL";
$typetotal=0;
$typeprobtotal=0;
$sq=mysql_query("
SELECT fundraising_donations.id, sponsors.organization AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
FROM fundraising_donations
JOIN sponsors ON fundraising_donations.sponsors_id=sponsors.id
WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
UNION
SELECT fundraising_donations.id, CONCAT(users.firstname,' ',users.lastname) AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
FROM fundraising_donations
JOIN users ON fundraising_donations.users_uid=users.uid
WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
ORDER BY status DESC, probability DESC, name
");
echo mysql_error();
while($sr=mysql_fetch_object($sq)) {
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
echo "<td>";
echo "<img style=\"cursor:pointer;\" onclick=\"delete_sponsorship($sr->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
echo "</td>";
echo "<td style=\"cursor: pointer;\" onclick=\"popup_sponsorship_editor('fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type')\">";
echo "$sr->name</td>\n";
echo "<td>$sr->status</td>";
echo "<td>";
if($sr->status=="pending") {
echo "$sr->probability%";
echo "</td>";
echo "<td><nobr>".format_money($sr->value)."</nobr></td>";
}
else
echo "</td><td></td>\n";
$probval=$sr->probability/100*$sr->value;
echo "<td style=\"text-align: right\"><nobr>".format_money($probval)."</nobr></td>";
echo "<td></td>\n";
echo "</tr>\n";
$typeprobtotal+=$probval;
$typetotal+=$sr->value;
}
echo "<tr>";
echo "<td><a onclick=\"return popup_sponsorship_editor('fundraising_sponsorship.php?fundraising_type=$r->type')\" href=\"#\">add</a></td>";
echo "<td colspan=\"3\" style=\"text-align: right; font-weight: bold;\">".i18n("%1 Total",array($r->name),array("Fundraising type total, eg) Award Sponsorship Total"))."</td>\n";
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typetotal)."</nobr></td>\n";
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typeprobtotal)."</nobr></td>\n";
$typediff=$typeprobtotal-$r->goal;
echo "<td style=\"font-weight: bold; text-align: right;\"><nobr>".format_money($typediff)."</nobr></td>\n";
echo "</tr>\n";
$totalgoal+=$r->goal;
$totaldiff+=$typediff;
echo "<tr><td colspan=\"7\">&nbsp;</td></tr>\n";
}
echo "<tr>";
echo "<td colspan=\"2\"><a onclick=\"return popup_fund_editor('fundraising_types.php')\" href=\"#\">add fund type</a></td>";
echo "<td colspan=\"4\" style=\"font-weight: bold; text-align: right;\">".i18n("Total Net Position")."</td><td style=\"text-align: right; font-weight: bold;\">".format_money($totaldiff)."</td></tr>\n";
echo "</table>\n";
exit;
}

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("fundraising_common.inc.php");
send_header("Fundraising Reports",

View File

@ -23,7 +23,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("fundraising_common.inc.php");
require_once("../lpdf.php");
require_once("../lcsv.php");
@ -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);

View File

@ -24,7 +24,7 @@
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
//first, insert any default fundraising donor levels
$q=mysql_query("SELECT * FROM fundraising_donor_levels WHERE fiscalyear='".$config['FISCALYEAR']."'");
@ -175,7 +175,7 @@
echo $config['FISCALYEAR'];
echo "</td></tr>\n";
echo "<tr><td>".i18n("Fiscal Year End")."</td><td>";
list($month,$day)=split("-",$config['fiscal_yearend']);
list($month,$day)=explode("-",$config['fiscal_yearend']);
emit_month_selector("fiscalendmonth",$month);
emit_day_selector("fiscalendday",$day);
echo "</td></tr>\n";
@ -299,9 +299,9 @@
case "setup_save":
$fye=sprintf("%02d-%02d",intval($_POST['fiscalendmonth']),intval($_POST['fiscalendday']));
mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE config SET val='$fye' WHERE var='fiscal_yearend' AND conferences_id='{$conference['id']}'");
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['registeredcharity'])."' WHERE var='registered_charity' AND conferences_id='{$conference['id']}'");
mysql_query("UPDATE config SET val='".mysql_real_escape_string($_POST['charitynumber'])."' WHERE var='charity_number' AND conferences_id='{$conference['id']}'");
happy_("Fundraising module setup saved");
exit;
break;

View File

@ -1,153 +0,0 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2008 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");
user_auth_required('committee', 'admin');
if($_GET['id']) {
$id=intval($_GET['id']);
$q=mysql_query("SELECT fundraising_donations.*, sponsors.organization FROM fundraising_donations,sponsors WHERE fundraising_donations.id='$id' AND fundraising_donations.sponsors_id=sponsors.id");
$sponsorship=mysql_fetch_object($q);
$formaction="sponsorshipedit";
}
else
{
$formaction="sponsorshipadd";
$fundraising_type=$_GET['fundraising_type'];
}
?>
<script type="text/javascript">
function typechange() {
var t=($("[name=sponsortype]:checked").val());
if(t=="organization") {
$("#sponsor_type_organization").show();
$("#sponsor_type_individual").hide();
} else {
$("#sponsor_type_organization").hide();
$("#sponsor_type_individual").show();
}
}
</script>
<?
echo "<form id=\"fundraisingsponsorship\">";
echo "<input type=\"hidden\" name=\"action\" value=\"$formaction\">";
echo "<input type=\"hidden\" name=\"fundraising_donations_id\" value=\"$id\">";
echo "<table cellspacing=0 cellpadding=0 class=\"tableedit\">";
if($formaction=="sponsorshipadd") {
echo "<tr><th>".i18n("Donor Type")."</th>";
echo "<td>";
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"organization\"> ".i18n("Organization");
echo "&nbsp;"; echo "&nbsp;"; echo "&nbsp;";
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"individual\"> ".i18n("Individual");
echo "</td></tr>\n";
echo "<tr><th>".i18n("Donor")."</th>";
echo "<td>";
$q=mysql_query("SELECT * FROM sponsors ORDER BY organization");
echo mysql_error();
echo "<span id=\"sponsor_type_organization\" style=\"display: none;\">";
echo "<select name=\"sponsors_id\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
while($r=mysql_fetch_object($q)) {
if($r->id==$sponsorship->sponsors_id) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->id\">$r->organization</option>\n";
}
echo "</select>&nbsp;<a href=\"donors.php?action=add\">".i18n("Add")."</a>\n";
echo "</span>";
$q=mysql_query("SELECT users.*, MAX(year) AS year FROM users WHERE (firstname!='' AND lastname!='') GROUP BY uid HAVING deleted='no' ORDER BY lastname,firstname");
echo mysql_error();
echo "<span id=\"sponsor_type_individual\" style=\"display: none;\">";
echo "<select name=\"users_uid\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
while($r=mysql_fetch_object($q)) {
if($r->uid==$sponsorship->users_uid) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->uid\">[$r->year][$r->uid] $r->lastname, $r->firstname ($r->email)</option>\n";
}
echo "</span>";
}
else {
echo "<tr><th>".i18n("Donor Type")."</th>";
echo "<td>";
if($sponsorship->sponsors_id) echo i18n("Organization");
else echo i18n("Individual");
echo "</td></tr>\n";
echo "<tr><th>".i18n("Donor")."</th>";
echo "<td>";
echo $sponsorship->organization;
}
echo "</td></tr>\n";
echo "<tr><th>".i18n("Donation Allocation")."</th>";
echo "<td>";
$q=mysql_query("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY name");
echo mysql_error();
echo "<select name=\"fundraising_type\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
while($r=mysql_fetch_object($q)) {
if($r->type==$sponsorship->fundraising_type || $r->type==$fundraising_type) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->type\">$r->name</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><th>".i18n("Amount")."</th><td><input type=\"text\" name=\"value\" value=\"$sponsorship->value\"></td></tr>\n";
echo "<tr><th>".i18n("Status")."</th>";
echo "<td>";
echo "<select name=\"status\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
$statuses=array("pending","confirmed","received");
foreach($statuses AS $status) {
if($sponsorship->status==$status) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$status\">".i18n(ucfirst($status))."</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><th>".i18n("Probability")."</th>";
echo "<td>";
echo "<select name=\"probability\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
$probs=array("25","50","75","90","95","99","100");
foreach($probs AS $prob) {
if($sponsorship->probability==$prob) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$prob\">$prob%</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "</table>\n";
echo "</form>\n";
?>

View File

@ -24,7 +24,7 @@
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
if($_GET['id']) {
$id=intval($_GET['id']);

View File

@ -24,15 +24,15 @@
<?
include "../common.inc.php";
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
$ret=array();
foreach($config['languages'] AS $l=>$ln) {
if($l==$config['default_language']) continue;
$q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='".md5(iconv("ISO-8859-1","UTF-8",$_GET['str']))."'");
$q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='".md5($_GET['str'])."'");
if($r=mysql_fetch_object($q))
$ret[$l]=iconv("ISO-8859-1","UTF-8",$r->val);
$ret[$l]=$r->val;
else
$ret[$l]="";
$ret[$l]="";
}
echo json_encode($ret);
?>

View File

@ -26,66 +26,121 @@
require_once("../user.inc.php");
require_once("../committee.inc.php");
user_auth_required('committee','admin');
user_auth_required('admin');
send_header("Administration",
array('Committee Main' => 'committee_main.php'),
"administration");
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"registration.php\">".theme_icon("participant_registration")."<br />".i18n("Participant Registration")."</a></td>";
echo " <td><a href=\"committees.php\">".theme_icon("committee_management")."<br />".i18n("Committee Management")."</a></td>";
echo " <td><a href=\"judges.php\">".theme_icon("judging_management")."<br />".i18n("Judging Management")."</a></td>";
echo " <td>";
if($config['volunteer_enable'] == 'yes')
echo "<a href=\"volunteers.php\">".theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."</a>";
else
echo theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td></tr>";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"awards.php\">".theme_icon("awards_management")."<br />".i18n("Awards Management")."</a></td>";
echo " <td><a href=\"schools.php\">".theme_icon("schools_management")."<br />".i18n("Schools Management")."</a></td>";
echo " <td>";
if($config['tours_enable'] == 'yes')
echo "<a href=\"tours.php\">".theme_icon("tour_management")."<br />".i18n("Tour Management")."</a>";
else
echo theme_icon("tour_management")."<br />".i18n("Tour Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " <td>";
if($config['participant_regfee_items_enable'] == 'yes')
echo "<a href=\"regfee_items_manager.php\">".theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."</a>";
else
echo theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo " <td><a href=\"reports.php\">".theme_icon("print/export_reports")."<br />".i18n("Print / Export Reports")."</a></td>";
echo " <td><a href=\"reports_ceremony.php\">".theme_icon("print_awards_ceremony_scripts")."<br />".i18n("Print Award Ceremony Scripts")."</a></td>";
echo " <td><a href=\"reports_editor.php\">".theme_icon("report_management")."<br />".i18n("Report Management")."</a></td>";
echo " <td><a href=\"translations.php\">".theme_icon("translations_management")."<br />".i18n("Translations Management")."</a></td>";
echo " <td>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo "<td></td><td></td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
if($config['score_entry_enable'] == 'yes') {
echo "<td><a href=\"judging_score_entry.php\">".theme_icon("judging_score_entry")."<br />".i18n("Judging Score Entry")."</a></td>";
if($conference['type']=='sciencefair') {
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"registration.php\">".theme_icon("participant_registration")."<br />".i18n("Participant Registration")."</a></td>";
echo " <td><a href=\"committees.php\">".theme_icon("committee_management")."<br />".i18n("Committee Management")."</a></td>";
echo " <td><a href=\"judges.php\">".theme_icon("judging_management")."<br />".i18n("Judging Management")."</a></td>";
echo " <td><a href=\"account_list.php\">".theme_icon("account_management")."<br />".i18n("Account Management")."</a></td>";
echo " <td>";
if($config['volunteer_enable'] == 'yes')
echo "<a href=\"volunteers.php\">".theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."</a>";
else
echo theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td></tr>";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"awards.php\">".theme_icon("awards_management")."<br />".i18n("Awards Management")."</a></td>";
echo " <td><a href=\"schools.php\">".theme_icon("schools_management")."<br />".i18n("Schools Management")."</a></td>";
echo " <td>";
if($config['tours_enable'] == 'yes')
echo "<a href=\"tours.php\">".theme_icon("tour_management")."<br />".i18n("Tour Management")."</a>";
else
echo theme_icon("tour_management")."<br />".i18n("Tour Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " <td>";
if($config['participant_regfee_items_enable'] == 'yes')
echo "<a href=\"regfee_items_manager.php\">".theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."</a>";
else
echo theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo " <td><a href=\"reports.php\">".theme_icon("print/export_reports")."<br />".i18n("Print / Export Reports")."</a></td>";
echo " <td><a href=\"reports_ceremony.php\">".theme_icon("print_awards_ceremony_scripts")."<br />".i18n("Print Award Ceremony Scripts")."</a></td>";
echo " <td><a href=\"reports_editor.php\">".theme_icon("report_management")."<br />".i18n("Report Management")."</a></td>";
echo " <td><a href=\"translations.php\">".theme_icon("translations_management")."<br />".i18n("Translations Management")."</a></td>";
echo " <td>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo "<td></td><td></td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
if($config['score_entry_enable'] == 'yes') {
echo "<td><a href=\"judging_score_entry.php\">".theme_icon("judging_score_entry")."<br />".i18n("Judging Score Entry")."</a></td>";
}
echo " <td><a href=\"winners.php\">".theme_icon("enter_winning_projects")."<br />".i18n("Enter Winning Projects")."</a></td>";
echo " <td><a href=\"cwsfregister.php\">".theme_icon("one-click_cwsf_registration")."<br />".i18n("One-Click CWSF Registration")."</a></td>";
echo " <td><a href=\"fair_stats.php\">".theme_icon("fair_stats")."<br />".i18n("Upload Fair Statistics")."</a></td>";
echo " <td><a href=\"user_list.php?show_types[]=fair\">".theme_icon("sciencefair_management")."<br />".i18n("Feeder/Upstream Fair Management")."</a></td>";
echo " </tr>\n";
echo "</table>\n";
}
echo " <td><a href=\"winners.php\">".theme_icon("enter_winning_projects")."<br />".i18n("Enter Winning Projects")."</a></td>";
echo " <td><a href=\"cwsfregister.php\">".theme_icon("one-click_cwsf_registration")."<br />".i18n("One-Click CWSF Registration")."</a></td>";
echo " <td><a href=\"fair_stats.php\">".theme_icon("fair_stats")."<br />".i18n("Upload Fair Statistics")."</a></td>";
echo " <td><a href=\"user_list.php?show_types[]=fair\">".theme_icon("sciencefair_management")."<br />".i18n("Feeder/Upstream Fair Management")."</a></td>";
echo " </tr>\n";
echo "</table>\n";
else {
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"eventsscheduling.php\">".theme_icon("events_management")."<br />".i18n("Events & Scheduling")."</a></td>";
echo " <td><a href=\"registration.php\">".theme_icon("participant_registration")."<br />".i18n("Participant Registration")."</a></td>";
echo " <td><a href=\"committees.php\">".theme_icon("committee_management")."<br />".i18n("Committee Management")."</a></td>";
echo " <td><a href=\"judges.php\">".theme_icon("judging_management")."<br />".i18n("Judging Management")."</a></td>";
echo " <td>";
if($config['volunteer_enable'] == 'yes')
echo "<a href=\"volunteers.php\">".theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."</a>";
else
echo theme_icon("volunteer_management")."<br />".i18n("Volunteer Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td></tr>";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"awards.php\">".theme_icon("awards_management")."<br />".i18n("Awards Management")."</a></td>";
echo " <td><a href=\"schools.php\">".theme_icon("schools_management")."<br />".i18n("Schools Management")."</a></td>";
echo " <td>";
if($config['tours_enable'] == 'yes')
echo "<a href=\"tours.php\">".theme_icon("tour_management")."<br />".i18n("Tour Management")."</a>";
else
echo theme_icon("tour_management")."<br />".i18n("Tour Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " <td>";
if($config['participant_regfee_items_enable'] == 'yes')
echo "<a href=\"regfee_items_manager.php\">".theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."</a>";
else
echo theme_icon("registration_fee_items_management")."<br />".i18n("Registration Fee Items Management")."<br /><i>(".i18n("disabled").")</i>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo " <td><a href=\"reports.php\">".theme_icon("print/export_reports")."<br />".i18n("Print / Export Reports")."</a></td>";
echo " <td><a href=\"reports_ceremony.php\">".theme_icon("print_awards_ceremony_scripts")."<br />".i18n("Print Award Ceremony Scripts")."</a></td>";
echo " <td><a href=\"reports_editor.php\">".theme_icon("report_management")."<br />".i18n("Report Management")."</a></td>";
echo " <td><a href=\"translations.php\">".theme_icon("translations_management")."<br />".i18n("Translations Management")."</a></td>";
echo " <td>";
echo "</td>";
echo " </tr>\n";
echo " <tr>";
echo "<td></td><td></td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";
echo " <td><a href=\"winners.php\">".theme_icon("enter_winning_projects")."<br />".i18n("Enter Winners")."</a></td>";
echo " </tr>\n";
echo "</table>\n";
}
echo "<hr />";
echo "<table class=\"adminconfigtable\">";
echo " <tr>";

View File

@ -1,7 +1,7 @@
<?
function getJudgingTeams()
{
global $config;
global $config, $conference;
$q=mysql_query("SELECT judges_teams.id,
judges_teams.num,
@ -9,7 +9,7 @@ function getJudgingTeams()
FROM
judges_teams
WHERE
judges_teams.year='".$config['FAIRYEAR']."'
judges_teams.conferences_id='".$conference['id']."'
ORDER BY
num,name
");
@ -87,7 +87,7 @@ function getJudgingTeams()
$lq=mysql_query("SELECT projects.language
FROM judges_teams_timeslots_projects_link
LEFT JOIN projects ON judges_teams_timeslots_projects_link.projects_id=projects.id
WHERE judges_teams_timeslots_projects_link.year='{$config['FAIRYEAR']}' AND
WHERE judges_teams_timeslots_projects_link.conferences_id='{$conference['id']}' AND
judges_teams_id='$r->id' ");
echo mysql_error();
$projectlangs=array();
@ -114,7 +114,7 @@ function getJudgingTeams()
judges_teams_awards_link.award_awards_id=award_awards.id
AND judges_teams_awards_link.judges_teams_id='$r->id'
AND award_awards.award_types_id=award_types.id
AND award_types.year='{$config['FAIRYEAR']}'
AND award_types.conferences_id='{$conference['id']}'
ORDER BY
name
");
@ -143,7 +143,7 @@ function getJudgingTeam($teamid)
FROM
judges_teams
WHERE
judges_teams.year='".$config['FAIRYEAR']."' AND
judges_teams.conferences_id='".$conference['id']."' AND
judges_teams.id='$teamid'
ORDER BY
num,
@ -203,7 +203,7 @@ function getJudgingTeam($teamid)
judges_teams_awards_link.award_awards_id=award_awards.id
AND judges_teams_awards_link.judges_teams_id='$r->id'
AND award_awards.award_types_id=award_types.id
AND award_types.year='{$config['FAIRYEAR']}'
AND award_types.conferences_id='{$conference['id']}'
ORDER BY
name
");
@ -250,11 +250,13 @@ function judges_load_all()
$ret = array();
$query = "SELECT id FROM users WHERE types LIKE '%judge%'
AND year='{$config['FAIRYEAR']}'
AND deleted='no'
ORDER BY lastname, firstname";
$r = mysql_query($query);
$r = mysql_query("
SELECT users.id FROM users JOIN user_roles ur ON ur.users_id = users.id
JOIN roles ON roles.id = ur.roles_id WHERE roles.type = 'judge'
AND conferences_id='{$conference['id']}'
AND deleted='no'
ORDER BY lastname, firstname
");
while($i = mysql_fetch_assoc($r)) {
$u = user_load($i['id']);
if($u['judge_complete'] == 'no') continue;

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Judges",
array('Committee Main' => 'committee_main.php',

View File

@ -29,7 +29,7 @@
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
$preferencechoices=array(
-2=>"Very Low",
@ -141,7 +141,7 @@ if($judgeinfo['special_award_only'] == "yes"){
}
// get their preference for age category
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}'");
$catPreferenceText = mysql_error() . "<ul>";
while($r=mysql_fetch_object($q)) {
@ -156,7 +156,7 @@ $catPreferenceText .= "</ul>";
<tr><td>
<ul>
<li><strong><?="Complete for {$config['FAIRYEAR']}";?>: </strong>
<li><strong><?="Complete for {$conference['name']}";?>: </strong>
<?=$completeText;?></li>
<li><strong><?=i18n("Special awards");?>: </strong>
@ -182,7 +182,7 @@ $catPreferenceText .= "</ul>";
<?php
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
$divs=array();
while($r=mysql_fetch_object($q))
{
@ -198,7 +198,7 @@ foreach($divs as $div)
echo "<td>";
$subq=mysql_query("SELECT * FROM projectsubdivisions WHERE
projectdivisions_id='$div' AND year='{$config['FAIRYEAR']}' ORDER BY subdivision");
projectdivisions_id='$div' AND conferences_id='{$conference['id']}' ORDER BY subdivision");
$sd = array();
while($subr=mysql_fetch_object($subq)) {
if($u['div_prefs_sub'][$subr->id] == 1) {

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
include "judges.inc.php";
send_header("Invite Judges",

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
include "judges.inc.php";
send_header("Judging Division Groupings",
@ -56,14 +56,14 @@ function newbuttonclicked(jdivs)
$div = array();
$divshort = array();
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$divshort[$r->id]=$r->division_shortform;
$div[$r->id]=$r->division;
}
$cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$cat[$r->id]=$r->category;
}
@ -72,7 +72,7 @@ function newbuttonclicked(jdivs)
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array();
while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
@ -97,7 +97,7 @@ function newbuttonclicked(jdivs)
function get_all_divs()
{
global $config;
global $config, $conference;
global $divshort, $div,$cat, $langr;
global $divcat;
@ -157,7 +157,7 @@ function get_all_divs()
" projectdivisions_id='{$cdl[$id]['div']}' ".
" AND projectcategories_id='{$cdl[$id]['cat']}' ".
" AND language='{$cdl[$id]['lang']}' ".
" AND registrations.year='{$config['FAIRYEAR']}'".
" AND registrations.conferences_id='{$conference['id']}'".
" AND projects.registrations_id=registrations.id".
" AND (registrations.status='complete' OR registrations.status='paymentpending')");

View File

@ -28,7 +28,12 @@
require_once('../projects.inc.php');
require_once('judges.inc.php');
require_once('anneal.inc.php');
// INFO ONLY: Re Windows OS. I have not found a test that works for both methods of starting this
// SERVER_ADDR is Always null in Windows OS IIS server
// when I launch using judges_sa_launcher_apache.php I could test using SERVER_NAME
// However when I Launch using $WshShell->run($bat_filename,0,false ); for Windows IIS it seems:
// All the $_SERVER variables are set as if were a website page so any variable I have tried will cause a bailout
// THUS.. There is no test I have found to verify this was run from the command line (or in background) for Windows
if($_SERVER['SERVER_ADDR']) {
echo "This script must be run from the command line";
exit;
@ -109,7 +114,7 @@ function judges_cost_function($annealer, $bucket_id, $ids)
if($bucket_id == 0) {
/* This is the placeholder for all judges, there's a slight
* cost for not using a judge */
$cost = count($ids) * 5;
$cost = count($ids) * 8;
// TRACE("Extra judge team cost=$cost\n");
return $cost;
}
@ -139,15 +144,19 @@ function judges_cost_function($annealer, $bucket_id, $ids)
for($y=0; $y < count($t['cats']); $y++) {
$l = $t['cats'][$y];
/* Lookup the judge cat pref for this category */
$pref = -$j['catprefs'][$l] + 2;
$pref = -$j['cat_prefs'][$l] + 2;
/* $pref = 0 (best match) --- 4 (worst match) */
//but wait, if they're "indifferent" then we really dont care, so the cost for it shoudl be 0.
if($pref==2) $pref=0;
$cpref += $pref;
}
$dpref = 0;
for($y=0; $y < count($t['divs']); $y++) {
$l = $t['divs'][$y];
/* Lookup the judge cat pref for this category */
$pref = -$j['divprefs'][$l] + 2;
$pref = -$j['div_prefs'][$l] + 5;
/* $pref = 0 (best match) --- 4 (worst match) */
$dpref += $pref;
}
@ -158,6 +167,8 @@ function judges_cost_function($annealer, $bucket_id, $ids)
//division matching is more important than category matching
$cost += 3 * $dpref;
// TRACE(" div/cat cost=$cost\n");
/* See if the judge is willing to chair a team */
if($j['willing_chair'] == 'yes') $have_chair = true;
@ -196,9 +207,12 @@ function judges_cost_function($annealer, $bucket_id, $ids)
/* Small penalty for a jteam with very little experience,
* but only if there's more than 1 person on the team */
$exp_cost = 0;
if($years_experience_weighted<5 && count($ids)>1) {
$cost += (5-$years_experience_weighted)*2;
$exp_cost += (5-$years_experience_weighted)*2;
}
$cost += $exp_cost;
// TRACE("Experience cost: $exp_cost\n");
// TRACE("Team $bucket_id, cost is $cost\n");
@ -340,7 +354,7 @@ set_status("Loading Data From Database...");
TRACE("\n\n");
$div = array();
TRACE("Loading Project Divisions...\n");
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
{
$divshort[$r->id]=$r->division_shortform;
@ -350,7 +364,7 @@ while($r=mysql_fetch_object($q))
TRACE("Loading Project Age Categories...\n");
$cat = array();
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$cat[$r->id]=$r->category;
TRACE(" {$r->id} - {$r->category}\n");
@ -367,7 +381,7 @@ while($r=mysql_fetch_object($q)) {
TRACE("Loading Judging Round time data...\n");
$round_special_awards = array();
$round = array();
$q = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='0' AND `year`='{$config['FAIRYEAR']}'");
$q = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='0' AND `conferences_id`='{$conference['id']}'");
/* Loads judges_timeslots.id, .starttime, .endtime, .date, .name */
while($r = mysql_fetch_assoc($q)) {
TRACE(" id:{$r['id']} type:{$r['type']} name:{$r['name']}\n");
@ -414,7 +428,7 @@ foreach($keys as $jdiv_id) {
if($x > 0) TRACE("\t- ");
TRACE($cat[$d['cat']]." ".$div[$d['div']]." - ".$langr[$d['lang']]);
$qp = mysql_query("SELECT projects.* FROM projects, registrations WHERE ".
" projects.year='".$config['FAIRYEAR']."' AND ".
" projects.conferences_id='".$conference['id']."' AND ".
" projectdivisions_id='{$d['div']}' AND ".
" projectcategories_id='{$d['cat']}' AND ".
" language='{$d['lang']}' AND " .
@ -441,27 +455,27 @@ foreach($keys as $jdiv_id) {
/* Clean out the judging teams that were autocreated in a previous run */
TRACE("Deleting autocreated divisional and special award judging teams:");
$q = mysql_query("SELECT * FROM judges_teams WHERE autocreate_type_id=1 AND year={$config['FAIRYEAR']}");
$q = mysql_query("SELECT * FROM judges_teams WHERE autocreate_type_id=1 AND conferences_id={$conference['id']}");
while($r = mysql_fetch_object($q)) {
$id = $r->id;
print(" $id");
/* Clean out the judges_teams_link */
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$id' AND year={$config['FAIRYEAR']}");
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$id' AND conferences_id={$conference['id']}");
print mysql_error();
/* Awards */
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$id' AND year={$config['FAIRYEAR']}");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$id' AND conferences_id={$conference['id']}");
print mysql_error();
/* Timeslots */
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$id' AND year={$config['FAIRYEAR']}");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$id' AND conferences_id={$conference['id']}");
print mysql_error();
/* Timeslots projects */
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$id' AND year={$config['FAIRYEAR']}");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$id' AND conferences_id={$conference['id']}");
print mysql_error();
}
echo "\n";
/* Finally, delete all the autocreated judges teams */
mysql_query("DELETE FROM judges_teams WHERE autocreate_type_id=1 AND year={$config['FAIRYEAR']}");
mysql_query("DELETE FROM judges_teams WHERE autocreate_type_id=1 AND conferences_id={$conference['id']}");
print mysql_error();
/* Also delete any judges_teams_link that link to teams that dont exist, just
@ -469,7 +483,7 @@ print mysql_error();
$q=mysql_query("SELECT judges_teams_link.id, judges_teams.id AS judges_teams_id
FROM judges_teams_link
LEFT JOIN judges_teams ON judges_teams_link.judges_teams_id=judges_teams.id
WHERE judges_teams_link.year={$config['FAIRYEAR']}");
WHERE judges_teams_link.conferences_id={$conference['id']}");
$n=0;
while($r=mysql_fetch_object($q)) {
if(!$r->judges_teams_id) {
@ -500,7 +514,7 @@ foreach($judges as &$j) {
$q = mysql_query("SELECT users_id FROM judges_teams_link WHERE
users_id='{$j['id']}'
AND year='{$config['FAIRYEAR']}'");
AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q) != 0) {
TRACE(" {$j['name']} is already on a judging team, skipping.\n");
unset($judges[$j['id']]);
@ -526,7 +540,7 @@ foreach($judges as &$j) {
WHERE
award_awards.id=judges_specialaward_sel.award_awards_id
AND judges_specialaward_sel.users_id='{$j['id']}'
AND award_awards.year='{$config['FAIRYEAR']}'");
AND award_awards.conferences_id='{$conference['id']}'");
echo mysql_error();
if($j['special_award_only'] == 'yes') {
@ -569,7 +583,7 @@ if(count($judges)==0) {
/* Load the numbers for any user-defined judge teams that already exist,
* these numbers will be off-limits for auto-assigning numbers */
$q = mysql_query("SELECT * FROM judges_teams WHERE year={$config['FAIRYEAR']}");
$q = mysql_query("SELECT * FROM judges_teams WHERE conferences_id={$conference['id']}");
$used_judges_teams_numbers = array();
while($i = mysql_fetch_assoc($q)) {
$used_judges_teams_numbers[] = $i['num'];
@ -598,8 +612,8 @@ function judge_team_create($num, $name)
{
global $config;
$name = mysql_escape_string($name);
mysql_query("INSERT INTO judges_teams (num,name,autocreate_type_id,year)
VALUES ('$num','$name','1','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_teams (num,name,autocreate_type_id,conferences_id)
VALUES ('$num','$name','1','{$conference['id']}')");
$id = mysql_insert_id();
return $id;
}
@ -608,9 +622,9 @@ function judge_team_add_judge($team_id, $users_id)
{
global $config, $judges;
mysql_query("INSERT INTO judges_teams_link
(users_id,judges_teams_id,captain,year)
(users_id,judges_teams_id,captain,conferences_id)
VALUES ('$users_id','$team_id','{$judges[$users_id]['willing_chair']}',
'{$config['FAIRYEAR']}')");
'{$conferences['id']}')");
echo mysql_error();
}
@ -796,7 +810,7 @@ for($x=1;$x<count($jteam); $x++) {
award_awards_projectcategories,
award_awards_projectdivisions
WHERE
award_awards.year='{$config['FAIRYEAR']}'
award_awards.conferences_id='{$conference['id']}'
AND award_awards.id=award_awards_projectcategories.award_awards_id
AND award_awards.id=award_awards_projectdivisions.award_awards_id
AND award_awards_projectcategories.projectcategories_id='{$cfg['cat']}'
@ -807,7 +821,7 @@ for($x=1;$x<count($jteam); $x++) {
echo error(i18n("Cannot find award for %1 - %2",array($cat[$cfg['cat']],$div[$cfg['div']])));
} else {
$r=mysql_fetch_object($q);
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,conferences_id) VALUES ('$r->id','$team_id','{$conferences['id']}')");
/* Add the award ID to the jdiv, if it's not already there */
if(!in_array($r->id, $jdiv[$t['jdiv_id']]['award_ids'])) {
$jdiv[$t['jdiv_id']]['award_ids'][] = $r->id;
@ -883,7 +897,7 @@ if($round_divisional2 == NULL) {
/* Assign all the awards in this jdiv */
foreach($jd['award_ids'] as $aid) {
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$aid','$team_id','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,conferences_id) VALUES ('$aid','$team_id','{$conference['id']}')");
}
}
@ -1001,10 +1015,10 @@ if($config['scheduler_enable_sa_scheduling'] == 'yes') {
/* Load special awards */
$q = "SELECT award_awards.name,award_awards.id FROM award_awards,award_types
WHERE
award_awards.year='{$config['FAIRYEAR']}'
award_awards.conferences_id='{$conference['id']}'
AND award_types.id=award_awards.award_types_id
AND award_awards.schedule_judges='yes'
AND award_types.year='{$config['FAIRYEAR']}'
AND award_types.conferences_id='{$conference['id']}'
AND award_types.type='Special'
";
$r = mysql_query($q);
@ -1041,8 +1055,8 @@ if($config['scheduler_enable_sa_scheduling'] == 'yes') {
$required_judges += $min;
/* Link the award to this team */
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year)
VALUES ('{$i->id}','{$sa_jteam[$x]['id']}','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,conferences_id)
VALUES ('{$i->id}','{$sa_jteam[$x]['id']}','{$conference['id']}')");
TRACE("Created Team: {$i->name}, ".count($projects)." projects => $min judges needed (db id:{$sa_jteam[$x]['id']}) \n");
$x++;
@ -1233,15 +1247,15 @@ if($config['scheduler_enable_sa_scheduling'] == 'yes') {
/* Do timeslot and project timeslot assignment */
mysql_query("INSERT INTO judges_teams_timeslots_link
(judges_teams_id,judges_timeslots_id,year)
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '{$config['FAIRYEAR']}')");
(judges_teams_id,judges_timeslots_id,conferences_id)
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '{$conference['id']}')");
echo mysql_error();
foreach($t['projects'] as $proj) {
$pid = $proj['id'];
mysql_query("INSERT INTO judges_teams_timeslots_projects_link
(judges_teams_id,judges_timeslots_id,projects_id,year)
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '$pid', '{$config['FAIRYEAR']}')");
(judges_teams_id,judges_timeslots_id,projects_id,conferences_id)
VALUES ('{$t['id']}', '{$r['timeslots'][0]['id']}', '$pid', '{$conference['id']}')");
echo mysql_error();
}
$ids = $a->bucket[$x];
@ -1274,7 +1288,7 @@ $available_timeslots=array();
$q=mysql_query("SELECT * FROM judges_timeslots WHERE
round_id='{$round_divisional1['id']}'
AND year='{$config['FAIRYEAR']}'
AND conferences_id='{$conference['id']}'
AND type='timeslot'
ORDER BY date,starttime");
$x=0;
@ -1443,16 +1457,16 @@ for($k=0; $k<$keys_count; $k++) {
/* if jteam_id isn't 0, instert it into the db */
mysql_query("INSERT INTO judges_teams_timeslots_link ".
" (judges_teams_id,judges_timeslots_id,year)".
" (judges_teams_id,judges_timeslots_id,conferences_id)".
" VALUES ('{$jteam[$jteam_id]['team_id']}', ".
" '{$available_timeslots[$y]['id']}', ".
" '{$config['FAIRYEAR']}')");
" '{$conference['id']}')");
mysql_query("INSERT INTO judges_teams_timeslots_projects_link ".
" (judges_teams_id,judges_timeslots_id,projects_id,year) ".
" (judges_teams_id,judges_timeslots_id,projects_id,conferences_id) ".
" VALUES ('{$jteam[$jteam_id]['team_id']}', ".
" '{$available_timeslots[$y]['id']}', ".
" '$pid', '{$config['FAIRYEAR']}')");
" '$pid', '{$conference['id']}')");
}
printf("\n");

View File

@ -1,15 +1,54 @@
<?
//make sure logs folder exists, and htaccess it to deny access
if(!file_exists("../data/logs"))
@mkdir("../data/logs");
if(!file_exists("../data/logs/.htaccess"))
@file_put_contents("../data/logs/.htaccess","Order Deny,Allow\r\nDeny From All\r\n");
require_once('../common.inc.functions.php');
$logPath = get_logpath();
// Check which OS we are running
$pos = strpos(getcwd(),'/');
if($pos === false)
{
// Windows os server.
// if IIS Web Server use WScript.Shell 'run' command and.. we need a batch file to start a process and return immediately
$bat_filename = "../data/judges_sa.bat";
if(file_exists($bat_filename)){
// delete the batch file then re-create it with the current date
unlink($bat_filename);
}
$bat_file = fopen($bat_filename, "w");
if($bat_file) {
fwrite($bat_file, "ECHO OFF"."\n");
fwrite($bat_file, "START /BELOWNORMAL /B php judges_sa.php >$logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &"."\n");
fwrite($bat_file, "EXIT"."\n");
fclose($bat_file);
}
$WshShell = new COM("WScript.Shell");
// next line designed for Windows os with IIS web server. It will probably fail if Windows using apache web server
try {
$oExec = $WshShell->run($bat_filename,0,false ); // THIS SHOULD WORK for windows using IIS as webserver.
}
catch (Exception $e) {
// if the wshshell-> run fails then we are perhaps running an apache server and the next might work.
// But, the call in judges_sa_launcher_apache.php does not return until completed so I use this logic
// to inform the user how to get to the status page.
// CAUTION: This path REQUIRES that php be compiled with CLI option and other things Dennis does not understand!
// This may work for some servers. NEVER use this on a shared server - you will hog it and get your account suspended.
echo " This server requires manual intervention to start the scheduler and to navigate to the Status page.<br/>";
echo " The scheduler will run at normal priority - which in some servers may present a sluggish response.<br />";
echo " Please follow these instruction exactly:<br />";
echo " 1. Click 'Start the Scheduler' link ONCE. (You will not see any change in this screen) <br />";
echo " *** DO NOT Click 'Start the Scheduler' more than once!<br />";
echo " 2. Click 'Check the Status' link and wait. (You will be taken to the Status Page. There, you should see that the scheduler is running.) <br />";
echo "<br /><a href=\"judges_sa_launcher_apache.php\">Start the Scheduler</a><br /><br />";
echo "<a href=\"judges_scheduler_status.php\">Check the Status</a><br />";
exit;
// This is the call that works - but it does not return until judges_sa is finished so... I launch it from another window
// exec("php judges_sa.php >$logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &");
}
}
else{
// *nix server
//add PHP_SELF just so when we do a process listing on the server we know which fair its running for
//the argument does not get used by the script at all
exec("nice php judges_sa.php {$_SERVER['PHP_SELF']} >../data/logs/judge_scheduler_".date("YmdHis").".log 2>&1 &");
exec("nice php judges_sa.php {$_SERVER['PHP_SELF']} > $logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &");
}
usleep(1500000); // 1.5 second to allow the judges_sa to update the % status to 0% otherwise the status page will think its not running if it gets there too soon
header("Location: judges_scheduler_status.php");
exit;

View File

@ -0,0 +1,8 @@
<?php
require_once('../common.inc.functions.php');
$logPath = get_logpath();
// In Windows OS with Apache server this exec call will start judges_sa.php as a separate process but the call to exec() does not return until the scheduler completes. Note the process runs at normal priority. Status can be checked with judges_scheduler_status.php. This is a temporary solution for Windows / Apache
exec("php judges_sa.php >$logPath/judge_scheduler_".date("YmdHis").".log 2>&1 &");
exit;
?>

View File

@ -151,6 +151,7 @@ echo "<br />";
echo "<a href=\"reports.php\">".i18n("Print/Export Reports")."</a>";
echo "<br />";
echo "<br />";
echo "Note: If you are using Windows Internet Explorer and do not see status updates do this:<br /> Click menu bar 'Tools' then 'Internet Options'.<br /> In the 'General' Tab under 'Browsing history' click 'Settings'.<br /> Under 'Check for newer versions of stored pages:'<br /> Select the option 'Every time I visit the webpage'.<br /> Click OK then OK";
}
send_footer();

View File

@ -1,6 +1,6 @@
<?
include "../data/config.inc.php";
mysql_connect($DBHOST,$DBUSER,$DBPASS);
mysql_connect($DBHOST,substr($DBUSER,0,16),$DBPASS);
mysql_select_db($DBNAME);
$q=mysql_query("SELECT val FROM config WHERE year='0' AND var='judge_scheduler_percent'");
$r=mysql_fetch_object($q);

View File

@ -26,11 +26,11 @@ ogram; see the file COPYING. If not, write to
require("../common.inc.php");
require_once("../user.inc.php");
require("../config_editor.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("judges.inc.php");
require("judges_schedulerconfig_check.inc.php");
$action = config_editor_handle_actions("Judge Scheduler", $config['FAIRYEAR'], "var");
$action = config_editor_handle_actions("Judge Scheduler", $conference['id'], "var");
if($action == 'update') {
header("Location: judges_schedulerconfig.php");
exit;
@ -43,7 +43,7 @@ ogram; see the file COPYING. If not, write to
'Judges' => 'admin/judges.php')
);
config_editor("Judge Scheduler", $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
config_editor("Judge Scheduler", $conference['id'], "var", $_SERVER['PHP_SELF']);
echo "<hr />";
if($_GET['action']=="reset")

View File

@ -2,10 +2,10 @@
function judges_scheduler_check_timeslots()
{
global $config;
global $conference;
$q=mysql_query("SELECT * FROM judges_timeslots WHERE ".
" year='".$config['FAIRYEAR']."'".
" conferences_id='".$conference['id']."'".
" AND `type`='divisional1'" );
if(mysql_num_rows($q)) {
$round=mysql_fetch_object($q);
@ -18,11 +18,11 @@ function judges_scheduler_check_timeslots()
function judges_scheduler_check_timeslots_sa()
{
global $config;
global $conference;
$rows = 0;
$q=mysql_query("SELECT * FROM judges_timeslots WHERE ".
" year='".$config['FAIRYEAR']."'".
" conferences_id='".$conference['id']."'".
" AND `type`='special'" );
if(mysql_num_rows($q)) {
while(( $round=mysql_fetch_object($q))) {
@ -35,13 +35,13 @@ function judges_scheduler_check_timeslots_sa()
function judges_scheduler_check_awards()
{
global $config;
global $config, $conferenece;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
$div[$r->id]=$r->division;
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q))
$cat[$r->id]=$r->category;
@ -49,7 +49,7 @@ function judges_scheduler_check_awards()
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE conferences_id='".$conference['id']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array();
while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
@ -75,9 +75,9 @@ function judges_scheduler_check_awards()
award_awards_projectcategories,
award_awards_projectdivisions
WHERE
award_awards.year='{$config['FAIRYEAR']}'
AND award_awards_projectcategories.year='{$config['FAIRYEAR']}'
AND award_awards_projectdivisions.year='{$config['FAIRYEAR']}'
award_awards.conferences_id='{$conference['id']}'
AND award_awards_projectcategories.conferences_id='{$conference['id']}'
AND award_awards_projectdivisions.conferences_id='{$conference['id']}'
AND award_awards.id=award_awards_projectcategories.award_awards_id
AND award_awards.id=award_awards_projectdivisions.award_awards_id
AND award_awards_projectcategories.projectcategories_id='$c'
@ -95,8 +95,6 @@ function judges_scheduler_check_awards()
function judges_scheduler_check_jdivs()
{
global $config;
$q=mysql_query("SELECT DISTINCT jdiv_id FROM judges_jdiv ");
$rows = mysql_num_rows($q);
@ -106,7 +104,7 @@ function judges_scheduler_check_jdivs()
function judges_scheduler_check_judges()
{
global $config;
global $config, $conference;
$ok = 1;
$jdiv = array();
@ -120,7 +118,7 @@ function judges_scheduler_check_judges()
$l = $r->lang;
$qp = mysql_query("SELECT COUNT(projects.id) as cnt FROM projects, registrations WHERE ".
" projects.year='".$config['FAIRYEAR']."' AND ".
" projects.conferences_id='".$conference['id']."' AND ".
" projectdivisions_id='$d' AND ".
" projectcategories_id='$c' AND ".
" language='$l' AND " .
@ -208,7 +206,7 @@ function judges_scheduler_check_judges()
echo "<br />";
echo "<br />";
/* $jq=mysql_query("SELECT COUNT(judges.id) AS num FROM judges,judges_years WHERE complete='yes' AND deleted='no' AND judges_years.year='{$config['FAIRYEAR']}' AND judges_years.judges_id=judges.id");
/* $jq=mysql_query("SELECT COUNT(judges.id) AS num FROM judges,judges_years WHERE complete='yes' AND deleted='no' AND judges_years.conferences_id='{$conference['id']}' AND judges_years.judges_id=judges.id");
$jr=mysql_fetch_object($jq);
$currentjudges=$jr->num;*/
/* FIXME: this his highly inefficient :), but won't be done very often */

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
include "judges.inc.php";
if($_GET['edit']) $edit=$_GET['edit'];
@ -35,11 +35,11 @@
if($action=="delete" && $_GET['delete'])
{
//ALSO DELETE: team members, timeslots, projects, awards
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams WHERE id='".$_GET['delete']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['delete']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='".$_GET['delete']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='".$_GET['delete']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='".$_GET['delete']."' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams WHERE id='".$_GET['delete']."' AND conferences_id='".$conference['id']."'");
message_push(happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team")));
}
@ -49,7 +49,7 @@
FROM
judges_teams
WHERE
year='".$config['FAIRYEAR']."'
conferences_id='".$conference['id']."'
AND autocreate_type_id='1'
");
echo mysql_error();
@ -58,11 +58,11 @@
{
//okay now we can start deleting things! whew!
//first delete any linkings to the team
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND conferences_id='".$conference['id']."'");
$numdeleted++;
}
if($numdeleted)
@ -76,18 +76,18 @@
$q2=mysql_query("SELECT *
FROM judges_teams
WHERE
year='".$config['FAIRYEAR']."'
conferences_id='".$conference['id']."'
");
$numdeleted=0;
while($r2=mysql_fetch_object($q2))
{
//okay now we can start deleting things! whew!
//first delete any linkings to the team
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND conferences_id='".$conference['id']."'");
$numdeleted++;
}
if($numdeleted)
@ -148,7 +148,7 @@
if($addaward)
{
//link up the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('".$_POST['award']."','$edit','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,conferences_id) VALUES ('".$_POST['award']."','$edit','".$conference['id']."')");
message_push(happy(i18n("Award assigned to team")));
}
}
@ -171,7 +171,7 @@
if($action=="unassign")
{
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$edit' AND award_awards_id='".$_GET['unassign']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$edit' AND award_awards_id='".$_GET['unassign']."' AND conferences_id='".$conference['id']."'");
message_push(happy(i18n("Award unassigned from judge team")));
//keep editing the same team
$action="edit";
@ -180,7 +180,7 @@
if($action=="createall")
{
//first make sure we dont have any non-divisional award teams (dont want people hitting refresh and adding all the teams twice
$q=mysql_query("SELECT COUNT(*) AS c FROM judges_teams WHERE autocreate_type_id!='1' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT COUNT(*) AS c FROM judges_teams WHERE autocreate_type_id!='1' AND conferences_id='".$conference['id']."'");
$r=mysql_fetch_object($q);
if($r->c)
{
@ -198,8 +198,8 @@
award_types
WHERE
award_awards.award_types_id=award_types.id
AND award_awards.year='".$config['FAIRYEAR']."'
AND award_types.year='".$config['FAIRYEAR']."'
AND award_awards.conferences_id='".$conference['id']."'
AND award_types.conferences_id='".$conference['id']."'
AND award_types_id!='1'
ORDER BY
award_types_order,
@ -210,11 +210,11 @@
{
// print_r($r);
$name=mysql_escape_string("($r->award_type) $r->name");
mysql_query("INSERT INTO judges_teams(num,name,autocreate_type_id,year) VALUES ('$num','$name','$r->award_types_id','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams(num,name,autocreate_type_id,conferences_id) VALUES ('$num','$name','$r->award_types_id','".$conference['id']."')");
echo mysql_error();
$team_id=mysql_insert_id();
//now link the new team to the award
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,conferences_id) VALUES ('$r->id','$team_id','".$conference['id']."')");
message_push(happy(i18n("Created team #%1: %2",array($num,$name))));
$num++;
}
@ -223,7 +223,7 @@
if($action=="add" && $_GET['num'])
{
mysql_query("INSERT INTO judges_teams(num,year) VALUES ('".$_GET['num']."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams(num,conferences_id) VALUES ('".$_GET['num']."','".$conference['id']."')");
echo mysql_error();
$edit=mysql_insert_id();
$action="edit";
@ -301,9 +301,9 @@ function addclicked()
award_awards,
award_types
WHERE
award_awards.year='".$config['FAIRYEAR']."'
award_awards.conferences_id='".$conference['id']."'
AND award_types.id=award_awards.award_types_id
AND award_types.year='{$config['FAIRYEAR']}'
AND award_types.conferences_id='{$conference['id']}'
ORDER BY
award_type_order,
name
@ -323,10 +323,10 @@ function addclicked()
)
LEFT JOIN judges_teams_awards_link ON award_awards.id = judges_teams_awards_link.award_awards_id
WHERE
award_awards.year='".$config['FAIRYEAR']."' AND
award_awards.conferences_id='".$conference['id']."' AND
judges_teams_awards_link.award_awards_id IS NULL
AND award_types.id=award_awards.award_types_id
AND award_types.year='{$config['FAIRYEAR']}'
AND award_types.conferences_id='{$conference['id']}'
ORDER BY
award_type_order,
name";
@ -403,7 +403,7 @@ function addclicked()
echo "</tr></thead>";
foreach($teams AS $team)
{
echo "<tr><td>#".$team['num']."</td><td>";
echo "<tr><td>".$team['num']."</td><td>";
echo $team['name'];
echo "</td>";

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('judges.inc.php');
send_header("Judging Team Members",
@ -75,7 +75,7 @@ function showMemberDetails(judgeId){
function editMember(memberId){
if(memberId == undefined) memberId = selectedMemberId;
hideMemberDetails();
window.open("user_editor_window.php?id="+memberId,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
window.open("../user_editor_window.php?id="+memberId,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
}
function hideMemberDetails(){
@ -109,7 +109,7 @@ jQuery(document).ready(function(){
if($_POST['action']=="add" && $_POST['team_num'] && count($_POST['judgelist'])>0)
{
//first check if this team exists.
$q=mysql_query("SELECT id,name FROM judges_teams WHERE num='".$_POST['team_num']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT id,name FROM judges_teams WHERE num='".$_POST['team_num']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q))
{
$r=mysql_fetch_object($q);
@ -138,7 +138,7 @@ jQuery(document).ready(function(){
else
{
//lets make the first one we add a captain, the rest, non-captains :)
mysql_query("INSERT INTO judges_teams_link (users_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams_link (users_id,judges_teams_id,captain,conferences_id) VALUES ('$selectedjudge','$team_id','$captain','".$conference['id']."')");
$added++;
}
//if this is alreayd no, then who cares, but if its the first one that is going into the new team, then
@ -155,11 +155,11 @@ jQuery(document).ready(function(){
if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['users_id'])
{
mysql_query("DELETE FROM judges_teams_link WHERE users_id='".$_GET['users_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_link WHERE users_id='".$_GET['users_id']."' AND judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
echo happy(i18n("Removed judge from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
//if there is still members left in the team, make sure we have a captain still
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q))
{
//make sure the team still has a captain!
@ -183,7 +183,7 @@ jQuery(document).ready(function(){
if(!$gotcaptain)
{
//make the first judge the captain
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='$firstjudge' AND year='".$config['FAIRYEAR']."'");
mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='$firstjudge' AND conferences_id='".$conference['id']."'");
echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned"));
}
}
@ -191,7 +191,7 @@ jQuery(document).ready(function(){
if($_GET['action']=="empty" && $_GET['team_num'] && $_GET['team_id'])
{
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='".$_GET['team_id']."' AND conferences_id='".$conference['id']."'");
echo happy(i18n("Emptied all judges from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name'])));
}
@ -272,14 +272,14 @@ jQuery(document).ready(function(){
/* Load all the teams */
$teams = array();
$q = mysql_query("SELECT * FROM judges_teams WHERE year='{$config['FAIRYEAR']}'");
$q = mysql_query("SELECT * FROM judges_teams WHERE conferences_id='{$conference['id']}'");
while($i = mysql_fetch_assoc($q)) {
$teams[$i['id']] = $i;
}
/* And the links */
$links = array();
$q = mysql_query("SELECT * FROM judges_teams_link WHERE year='{$config['FAIRYEAR']}'");
$q = mysql_query("SELECT * FROM judges_teams_link WHERE conferences_id='{$conference['id']}'");
while($i = mysql_fetch_assoc($q)) {
$judgelist[$i['users_id']]['teams_links'][] = $i;
}

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("judges.inc.php");
require("../projects.inc.php");
@ -87,11 +87,11 @@ if($_GET['action']=="delete" && $_GET['delete'] && $_GET['edit'])
if($_POST['action']=="assign" && $_POST['edit'] && $_POST['timeslot'] && $_POST['project_id'])
{
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$config['FAIRYEAR']."')");
mysql_query("INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,conferences_id) VALUES ('".$_POST['edit']."','".$_POST['timeslot']."','".$_POST['project_id']."','".$conference['id']."')");
echo happy(i18n("Project assigned to team timeslot"));
}
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
@ -212,7 +212,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
projectnumber is not null
" . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND
projects.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
ORDER BY
projectnumber";
}
@ -232,7 +232,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
" . getJudgingEligibilityCode(). " AND
projects.registrations_id=registrations.id AND
judges_teams_timeslots_projects_link.projects_id IS NULL AND
projects.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
ORDER BY
projectnumber";
}
@ -300,7 +300,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
projectnumber
");
@ -407,7 +407,7 @@ if( ($action=="edit" || $action=="assign" ) && $edit)
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
projectnumber
");

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('judges.inc.php');
$round_str = array('timeslot' => 'Judging Timeslot',
@ -56,8 +56,8 @@
if(count($_POST['teams']) && count($_POST['timeslots'])) {
foreach($_POST['teams'] AS $tm) {
foreach($_POST['timeslots'] AS $ts) {
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year)
VALUES ('$tm','$ts','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,conferences_id)
VALUES ('$tm','$ts','{$conference['id']}')");
}
}
@ -126,7 +126,7 @@ function checkinvert(what)
echo "<a href=\"\" onclick=\"return checkinvert('timeslots')\">invert selection</a>";
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
@ -141,7 +141,7 @@ function checkinvert(what)
echo "</tr>\n";
$q=mysql_query("SELECT * FROM judges_timeslots
WHERE year='{$config['FAIRYEAR']}'
WHERE conferences_id='{$conference['id']}'
AND round_id='0' ORDER BY date,starttime");
while($r=mysql_fetch_object($q)) {
echo "<tr>";

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
$round_str = array('timeslot' => 'Judging Timeslot',
'divisional1' => 'Divisional Round 1',
@ -81,7 +81,7 @@
if($save == true) {
if($round_id == 0) {
/* New entry */
mysql_query("INSERT INTO judges_timeslots (round_id,year) VALUES('0','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_timeslots (round_id,conferences_id) VALUES('0','{$conference['id']}')");
$round_id = mysql_insert_id();
}
@ -135,8 +135,8 @@
if($save == true) {
if($timeslot_id == 0) {
/* New entry */
mysql_query("INSERT INTO judges_timeslots (round_id,date,type,year) VALUES('$round_id',
'$date','timeslot','{$config['FAIRYEAR']}')");
mysql_query("INSERT INTO judges_timeslots (round_id,date,type,conferences_id) VALUES('$round_id',
'$date','timeslot','{$conference['id']}')");
$timeslot_id = mysql_insert_id();
}
@ -173,19 +173,19 @@
DATE_ADD('$date $hr:$min:00', INTERVAL $tt MINUTE) AS startnext ");
echo mysql_error();
$r=mysql_fetch_object($q);
list($ed,$et)=split(" ",$r->endtime);
list($nd,$nt)=split(" ",$r->startnext);
list($ed,$et)=explode(" ",$r->endtime);
list($nd,$nt)=explode(" ",$r->startnext);
$starttime = sprintf("%02d:%02d:00", $hr, $min);
mysql_query("INSERT INTO judges_timeslots (date,type,round_id,starttime,endtime,year) VALUES (
mysql_query("INSERT INTO judges_timeslots (date,type,round_id,starttime,endtime,conferences_id) VALUES (
'$date','timeslot','{$round_data['id']}',
'$starttime', '$et',
'{$config['FAIRYEAR']}')");
'{$conference['id']}')");
echo mysql_error();
$date=$nd;
list($s_h,$s_m,$s_s)=split(":",$nt);
list($e_h,$e_m,$e_s)=split(":",$et);
list($s_h,$s_m,$s_s)=explode(":",$nt);
list($e_h,$e_m,$e_s)=explode(":",$et);
message_push(happy(i18n("Adding timeslot: %1",array("$date $hr:$min - $e_h:$e_m"))));
$hr=$s_h;
$min=$s_m;
@ -353,7 +353,7 @@
echo "<th>".i18n("Actions")."</th>";
echo "</tr>";
$q=mysql_query("SELECT * FROM judges_timeslots WHERE year='{$config['FAIRYEAR']}' AND `type`!='timeslot' ORDER BY date,starttime");
$q=mysql_query("SELECT * FROM judges_timeslots WHERE conferences_id='{$conference['id']}' AND `type`!='timeslot' ORDER BY date,starttime");
while($r=mysql_fetch_object($q)) {
echo "<tr>";
$qq = mysql_query("SELECT * FROM judges_timeslots WHERE round_id='{$r->id}' ORDER BY `date`,`starttime`");

View File

@ -25,14 +25,13 @@
require("../common.inc.php");
require_once("../user.inc.php");
require_once("judges.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Judging Score Entry - Update",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judging Score Entry' => 'admin/judging_score_entry.php')
);
$year=$config['FAIRYEAR'];
$project_id = NULL;
if($_GET['projectid']) {
$project_id = $_GET['projectid'];
@ -50,7 +49,7 @@
mysql_query("UPDATE judges_teams_timeslots_projects_link
SET score=" . $score .
" WHERE judges_teams_id = " . mysql_real_escape_string($_POST["team_" . $curr_team . "_id"]) .
" and projects_id =$project_id and year=$year");
" and projects_id =$project_id and conferences_id={$conference['id']}");
echo mysql_error();
}
$curr_team--;
@ -60,11 +59,11 @@
?>
<?
if($project_id) {
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']} ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']} ORDER BY id");
$q=mysql_query("SELECT judges_teams_timeslots_projects_link.judges_teams_id,

View File

@ -25,10 +25,10 @@
require("../common.inc.php");
require_once("../user.inc.php");
require_once("judges.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $conferences_id=$conference['id'];
if($_GET['csv'] == 'yes') {
header("Content-type: text/csv");
@ -42,11 +42,11 @@
}
?>
<?
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id = '$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -60,6 +60,9 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
projects.projectcategories_id,
projects.projectdivisions_id,
judges_teams_id as res_team_id,
count(score) as score_count,
count((SELECT count(*) FROM judges_teams_timeslots_projects_link WHERE
projectid=judges_teams_timeslots_projects_link.projects_id)) as score_total_count,
avg(score) as score,
avg(score + (SELECT 70-avg(score)
FROM judges_teams_timeslots_projects_link
@ -70,7 +73,7 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
left outer join projects on projects.registrations_id=registrations.id
left outer join judges_teams_timeslots_projects_link on projects.id=judges_teams_timeslots_projects_link.projects_id
WHERE
registrations.year='$year' "
registrations.conferences_id='$conferences_id' "
. getJudgingEligibilityCode() . "
GROUP BY projectid
ORDER BY
@ -79,8 +82,33 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
echo mysql_error();
if($_GET['csv'] != 'yes') {
?>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#div-cat-best").click(function() {
// set sorting column and direction, this will sort on the first and third column the column index starts at zero
var sorting = [[2,0],[3,0],[5,1]];
// sort on the first column
$(".tableview").trigger("sorton",[sorting]);
// return false to stop default link action
return false;
});
$("#overall-best").click(function() {
// set sorting column and direction, this will sort on the first and third column the column index starts at zero
var sorting = [[5,1]];
// sort on the first column
$(".tableview").trigger("sorton",[sorting]);
// return false to stop default link action
return false;
});
});
</script>
<?php
echo "<a href='judging_score_entry.php?csv=yes'>" . i18n("Generate CSV Report") . "</a>\n";
echo "<br /><a href='#' id='div-cat-best'>" . i18n("Sort By Best in Division/Category") . "</a>\n";
echo "<br /><a href='#' id='overall-best'>" . i18n("Sort By Best Overall") . "</a>\n";
echo "<table class=\"tableview\">";
echo "<thead>";
echo "<tr>";
echo "<th>".i18n("Proj Num")."</th>";
echo "<th>".i18n("Project Title")."</th>";
@ -88,8 +116,11 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
echo "<th>".i18n("Division")."</th>";
echo "<th>".i18n("Score")."</th>";
echo "<th>".i18n("Normalized Score")."</th>";
echo "<th>".i18n("Judgings")."</th>";
echo "<th>".i18n("Action")."</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
} else {
echo "Project #\tTitle\tCategory\tDivision\tScore\tNormalized Scores\tJudge Name\tJudges Score\n";
}
@ -121,10 +152,18 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
echo "<td>".i18n($cats[$r->projectcategories_id])."</td>\n";
echo "<td>".i18n($divs[$r->projectdivisions_id])."</td>\n";
echo "<td>" . number_format($r->score, 2) . "</td>\n";
echo "<td>" . number_format($r->norm_score, 2) . "</td>\n";
echo "<td class='judging_score'>" . number_format($r->score, 2) . "</td>\n";
echo "<td class='judging_score'><strong>" . number_format($r->norm_score, 2) . "</strong></td>\n";
if ($r->score_count == $r->score_total_count) {
echo "<td>";
} else if ($r->score_count == 0) {
echo "<td class='caution'>";
} else {
echo "<td class='error'>";
}
echo number_format($r->score_count, 0) . "/" . number_format($r->score_total_count, 0) . "</td>\n";
echo "<td align=\"center\">";
if($year==$config['FAIRYEAR']) {
if($conferences_id == $conference['id']){
echo "<a href=\"judging_score_edit.php?projectid=$r->projectid\">";
echo i18n("Edit Scores");
echo "</a>";
@ -134,6 +173,7 @@ $ORDERBY="projects.projectcategories_id, projects.projectdivisions_id, projects.
}
}
if($_GET['csv'] != 'yes') {
echo "</tbody>";
echo "</table>\n";
echo "<br />";

59
admin/locations.php Normal file
View File

@ -0,0 +1,59 @@
<?
/*
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 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("../tableeditor.class.php");
require_once("../user.inc.php");
user_auth_required('admin');
send_header("Event Locations",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Events & Scheduling' => 'admin/eventsscheduling.php'),
"events_scheduling" );
echo "<br />";
$editor = new TableEditor("locations",
array(
"name" => "Location Name"
),
array(
"name" => "Location Name"
),
array(
"conferences_id" => $conference['id']
)
);
$editor->filterList("conferences_id", $conference['id']);
$editor->setPrimaryKey("id");
$editor->setRecordType("Location");
$editor->setDefaultSortField("name");
$editor->execute();
send_footer();
?>

View File

@ -26,8 +26,7 @@ require_once('../common.inc.php');
require_once('../user.inc.php');
require_once('../register_participants.inc.php');
$auth_type = user_auth_required(array('fair','committee'), 'admin');
$auth_type = user_auth_required(array(), array('fair','admin'));
$registrations_id=intval($_GET['id']);
$action = $_GET['action'];
@ -43,7 +42,7 @@ if($auth_type == 'fair') {
the master copy of the fairs_id in the project */
$q=mysql_query("SELECT * FROM projects WHERE
registrations_id='$registrations_id'
AND year='{$config['FAIRYEAR']}'
AND conferences_id='{$conference['id']}'
AND fairs_id=$fairs_id");
if(mysql_num_rows($q) != 1) {
echo "permission denied.";
@ -56,14 +55,14 @@ if($auth_type == 'fair') {
switch($action) {
case 'project_load':
project_load();
project_load2();
break;
case 'project_regenerate_number':
/* Save first */
project_save();
/* Now generate */
$q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$i=mysql_fetch_assoc($q);
$id = $i['id'];
@ -90,10 +89,10 @@ exit;
function project_save()
{
global $registrations_id, $config;
global $registrations_id, $config, $conference;
//first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='{$registrations_id}' AND conferences_id='{$conference['id']}'");
$projectinfo=mysql_fetch_object($q);
if(!projectinfo) {
echo error(i18n("Invalid project to update"));
@ -113,23 +112,23 @@ function project_save()
$title=stripslashes($_POST['title']);
mysql_query("UPDATE projects SET ".
"title='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",$title))."', ".
"title='".mysql_escape_string($title)."', ".
"projectdivisions_id='".intval($_POST['projectdivisions_id'])."', ".
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
"req_special='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['req_special'])))."', ".
"summary='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['summary'])))."', ".
"req_special='".mysql_escape_string(stripslashes($_POST['req_special']))."', ".
"summary='".mysql_escape_string(stripslashes($_POST['summary']))."', ".
"summarycountok='$summarycountok',".
"projectsort='".mysql_escape_string(stripslashes($_POST['projectsort']))."'".
"WHERE id='".intval($_POST['id'])."'");
echo mysql_error();
happy_("Project information successfully updated");
happy_('Project Information Saved');
//check if they changed the project number
if($_POST['projectnumber']!=$projectinfo->projectnumber) {
//check if hte new one is available
$q=mysql_query("SELECT * FROM projects WHERE year='".$config['FAIRYEAR']."' AND projectnumber='".$_POST['projectnumber']."'");
$q=mysql_query("SELECT * FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber='".$_POST['projectnumber']."'");
if(mysql_num_rows($q)) {
error_("Could not change project number. %1 is already in use",array($_POST['projectnumber']));
} else {
@ -142,31 +141,24 @@ function project_save()
}
function project_load()
function project_load2()
{
global $registrations_id, $config;
//now lets find out their MAX grade, so we can pre-set the Age Category
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
$gradeinfo=mysql_fetch_object($q);
//now lets grab all the age categories, so we can choose one based on the max grade
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
//save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
$agecategories[$r->id]['category']=$r->category;
$agecategories[$r->id]['mingrade']=$r->mingrade;
$agecategories[$r->id]['maxgrade']=$r->maxgrade;
if($gradeinfo->maxgrade >= $r->mingrade && $gradeinfo->maxgrade <= $r->maxgrade)
$projectcategories_id=$r->id;
}
global $registrations_id, $config, $conference;
$projectcategories_id=getProjectCategory($registrations_id);
//now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one
$projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
//save these in an array, so we can use them below
$agecategories[$r->id]['category']=$r->category;
$agecategories[$r->id]['mingrade']=$r->mingrade;
$agecategories[$r->id]['maxgrade']=$r->maxgrade;
}
//make sure that if they changed their grade on the student page, we update their projectcategories_id accordingly
if($projectcategories_id && $projectinfo->projectcategories_id!=$projectcategories_id) {
echo notice(i18n("Age category changed, updating to %1",array($agecategories[$projectcategories_id]['category'])));
@ -230,11 +222,11 @@ function countwords()
<?
//###### Feature Specific - filtering divisions by category
if($config['filterdivisionbycategory']=="yes"){
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectcategoriesdivisions_link.year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT projectdivisions.* FROM projectdivisions,projectcategoriesdivisions_link WHERE projectdivisions.id=projectdivisions_id AND projectcategories_id=".$projectcategories_id." AND projectdivisions.conferences_id='".$conference['id']."' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' ORDER BY division");
echo mysql_error();
//###
} else
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY division");
echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n";

View File

@ -25,7 +25,7 @@
require("../tableeditor.class.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Registration Fee Items Manager",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
@ -38,7 +38,7 @@
'cost' => 'Cost',
'per' => 'Cost Per',
), null,
array('year' => $config['FAIRYEAR'])
array('conference' => $conference['name'])
);
$editor->setPrimaryKey("id");
@ -48,7 +48,7 @@
array('key' => 'project', 'val' => "Project")
) );
$editor->setFieldInputType("per", 'select');
$editor->filterList('year',$config['FAIRYEAR']);
$editor->filterList('conference',$conference['name']);
$editor->execute();

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Participant Registration",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),

View File

@ -25,18 +25,18 @@
require_once('../common.inc.php');
require_once('../user.inc.php');
$auth_type = user_auth_required(array('fair','committee'), 'admin');
$auth_type = user_auth_required(array(), array('fair', 'admin'));
//require_once('../register_participants.inc.php');
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conference_id']) $conference_id=intval($_GET['conference_id']);
else $conference_id=$conference['id'];
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -44,7 +44,7 @@ $action=$_GET['action'];
switch($action) {
case 'load_row':
$id = intval($_GET['id']);
$q = list_query($year, '', $id);
$q = list_query($conference_id, '', $id);
$r = mysql_fetch_object($q);
print_row($r);
exit;
@ -56,13 +56,13 @@ case 'delete':
$p = mysql_fetch_assoc($q);
mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'");
}
mysql_query("DELETE FROM registrations WHERE id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM registrations WHERE id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM users WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
// mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM mentors WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM emergencycontact WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
happy_("Registration and all related data successfully deleted");
exit;
}
@ -300,19 +300,20 @@ $(document).ready(function() {
selected: -1
});
/*
$("#newproject").click(function() {
popup_editor(-1);
}
);
*/
});
</script>
<br />
<table width="100%">
<table style="width: 500px;">
<tr><td>
<?=i18n("Choose Status")?>:
<form name="statuschangerform" method="get" action="registration_list.php">
<?=i18n("Choose Status")?>:
<select name="showstatus" onchange="document.forms.statuschangerform.submit()">
<?
@ -331,7 +332,9 @@ $(document).ready(function() {
}
?>
</select></form></td>
<td align="right"><button id="newproject"><?=i18n("Create New Project")?></button></td>
<?
// echo <td align=\"right\"><button id=\"newproject\">".i18n("Create New Project")."</button></td>\n";
?>
</tr></table>
<?
@ -347,28 +350,28 @@ if($showstatus) {
}
else $wherestatus="";
$q = list_query($year, $wherestatus, false);
$q = list_query($conference_id, $wherestatus, false);
echo "<table id=\"registration_list\" class=\"tableview\">";
echo "<thead><tr>";
if($showstatus) $stat="&showstatus=".$showstatus;
echo "<th>".i18n("Status")."</th>";
echo "<th>".i18n("Email Address")."</th>";
echo "<th>".i18n("Reg Num")."</th>";
echo "<th>".i18n("Proj Num")."</th>";
echo "<th>".i18n("Project Title")."</th>";
echo "<th>".i18n("Age Category")."</th>";
echo "<th>".i18n("Division")."</th>";
echo "<th>".i18n("School(s)")."</th>";
echo "<th>".i18n("Student(s)")."</th>";
echo "<th>".i18n("Participant Details")."</th>";
echo "<th>".i18n("Action")."</th>";
echo "</tr></thead>";
echo "<tbody>";
while($r=mysql_fetch_object($q)) {
echo "<tr id=\"row_{$r->reg_id}\">";
print_row($r);
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
@ -377,7 +380,7 @@ echo "<br/><br/>The statistics have moved here: <a href=\"registration_stats.php
send_footer();
/* Now some helper fucntions we call more than once */
function list_query($year, $wherestatus, $reg_id)
function list_query($conference_id, $wherestatus, $reg_id)
{
global $auth_type;
@ -393,7 +396,6 @@ function list_query($year, $wherestatus, $reg_id)
$q=mysql_query("SELECT registrations.id AS reg_id,
registrations.num AS reg_num,
registrations.status,
registrations.email,
projects.title,
projects.projectnumber,
projects.projectcategories_id,
@ -403,7 +405,7 @@ function list_query($year, $wherestatus, $reg_id)
left outer join projects on projects.registrations_id=registrations.id
WHERE
1
AND registrations.year='$year'
AND registrations.conferences_id='$conference_id'
$wherestatus
$reg $fair
ORDER BY
@ -417,7 +419,7 @@ function list_query($year, $wherestatus, $reg_id)
function print_row($r)
{
global $cats, $divs, $config, $year;
global $cats, $divs, $config, $conference_id, $conference;
switch($r->status) {
case "new": $status_text="New"; break;
case "open": $status_text="Open"; break;
@ -431,7 +433,7 @@ function print_row($r)
$pcl = "style=\"cursor:pointer;\" onclick=\"popup_editor('{$r->reg_id}','project');\"";
echo "<td $scl>{$status_text}</td>";
echo "<td $scl>{$r->email}</td>";
// echo "<td $scl>{$r->email}</td>";
echo "<td $scl>{$r->reg_num}</td>";
$pn = str_replace(' ', '&nbsp;', $r->projectnumber);
echo "<td $scl>$pn</td>";
@ -440,44 +442,66 @@ function print_row($r)
echo "<td $scl>".i18n($cats[$r->projectcategories_id])."</td>";
echo "<td $scl>".i18n($divs[$r->projectdivisions_id])."</td>";
$sq=mysql_query("SELECT students.firstname,
students.lastname,
students.id,
echo "<td>";
$sq=mysql_query("SELECT users.firstname,
users.lastname,
users.id,
schools.school,
schools.board,
schools.id AS schools_id
schools.id AS schools_id,
accounts.username,
accounts.email,
accounts.pendingemail
FROM
students,schools
users
JOIN accounts ON users.accounts_id=accounts.id
LEFT JOIN schools ON users.schools_id=schools.id
WHERE
students.registrations_id='$r->reg_id'
AND
students.schools_id=schools.id
users.registrations_id='$r->reg_id'
");
echo mysql_error();
$studnum=1;
$schools="";
$students="";
while($studentinfo=mysql_fetch_object($sq))
{
$students.="$studentinfo->firstname $studentinfo->lastname<br />";
$schools.="$studentinfo->school <br />";
}
$scl = "style=\"cursor:pointer;\" onclick=\"popup_editor('{$r->reg_id}','');\"";
//if theres more than 1, we should show some headings between the tables
if(mysql_num_rows($sq)>1) $showheadings=true;
while($studentinfo=mysql_fetch_object($sq)) {
if($studentinfo->email) $e=$studentinfo->email;
else if($studentinfo->pendingemail) $e=$studentinfo->pendingemail;
else $e="";
if($showheadings)
echo "<b>Participant #$studnum</b><br />";
echo "<table style=\"cursor:pointer; border-collapse: collapse;\" onclick=\"popup_editor('{$r->reg_id}','');\">";
echo "<tr><th>Name</th><td>$studentinfo->firstname $studentinfo->lastname</td></tr>\n";
echo "<tr><th>Username</th><td>$studentinfo->username</td></tr>\n";
if($e && $studentinfo->username!=$e) {
echo "<tr><th>Email</th><td>$e</td></tr>\n";
}
echo "<tr><th>School</th><td>$studentinfo->school</td></tr>\n";
echo "</table>\n";
$studnum++;
}
echo "</td>";
echo "<td $scl>$schools</td>";
echo "<td $scl>$students</td>";
echo "<td align=\"center\" >";
if($year==$config['FAIRYEAR']) {
if($conference_id==$conference['id']) {
echo "<a title=\"".i18n("Delete this registration")."\" href=\"#\" onClick=\"delete_registration({$r->reg_id});return false\" >";
echo "<img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0>";
echo "</a>";
echo "<form target=\"_blank\" method=\"post\" action=\"../register_participants.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"continue\">";
echo "<input type=\"hidden\" name=\"email\" value=\"$r->email\">";
echo "<input type=\"hidden\" name=\"regnum\" value=\"$r->reg_num\">";
echo "<input type=\"submit\" value=\"".i18n("Login")."\">";
echo "</form>";
/*
echo "<form target=\"_blank\" method=\"post\" action=\"../register_participants.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"continue\">";
echo "<input type=\"hidden\" name=\"email\" value=\"$r->email\">";
echo "<input type=\"hidden\" name=\"regnum\" value=\"$r->reg_num\">";
echo "<input type=\"submit\" value=\"".i18n("Login")."\">";
echo "</form>";
*/
}

View File

@ -22,10 +22,10 @@
*/
?>
<?
require("../common.inc.php");
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require("../register_participants.inc.php");
user_auth_required('admin');
require_once("../register_participants.inc.php");
send_header("Input Received Signature Forms",
array('Committee Main' => 'committee_main.php',
@ -37,7 +37,7 @@
$showformatbottom=true;
if($_POST['action']=="received" && $_POST['registration_number'])
{
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)==1)
{
$r=mysql_fetch_object($q);
@ -45,14 +45,13 @@ $showformatbottom=true;
$reg_num=$r->num;
$reg_status=$r->status;
if($r->status=='new')
{
if($r->status=='new') {
echo error(i18n("Invalid Registration Status (%1 is New). Cannot receive an empty form.",array($_POST['registration_number'])));
}
else
{
//make sure all of the statuses are correct
$statusstudent=studentStatus($reg_id);
$statusstudent=studentsStatus($reg_id);
$statusemergencycontact=emergencycontactStatus($reg_id);
$statusproject=projectStatus($reg_id);
if($config['participant_mentor']=="yes")
@ -78,10 +77,10 @@ $showformatbottom=true;
projects,projectcategories,projectdivisions
WHERE
projects.registrations_id='$reg_id'
AND
projects.projectcategories_id=projectcategories.id
AND
projects.projectdivisions_id=projectdivisions.id
AND projects.projectcategories_id=projectcategories.id
AND projects.projectdivisions_id=projectdivisions.id
AND projectcategories.conferences_id=projects.conferences_id
AND projectdivisions.conferences_id=projects.conferences_id
");
echo mysql_Error();
@ -100,15 +99,15 @@ echo mysql_Error();
echo "<tr><td><b>".i18n("Project Title")."</b></td><td>$projectinfo->title</td></tr>";
echo "<tr><td><b>".i18n("Category / Division")."</b></td><td>$projectinfo->category / $projectinfo->division</td></tr>";
$q=mysql_query("SELECT students.firstname,
students.lastname,
$q=mysql_query("SELECT users.firstname,
users.lastname,
schools.school
FROM
students,schools
users,schools
WHERE
students.registrations_id='$reg_id'
users.registrations_id='$reg_id'
AND
students.schools_id=schools.id
users.schools_id=schools.id
");
$studnum=1;
@ -125,8 +124,7 @@ echo mysql_Error();
echo "</table>\n";
echo "<br />";
if($r->status!='complete')
{
if($r->status!='complete') {
echo "<table style=\"margin-left: 30px;\">";
echo "<tr><td colspan=\"3\">";
echo i18n("Is this the correct form to register?");
@ -137,30 +135,28 @@ echo mysql_Error();
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"registration_number\" value=\"$reg_num\" />";
echo "<input type=\"hidden\" name=\"action\" value=\"receivedno\" />";
echo "<input type=submit value=\"".i18n("No, this is the wrong form")."\" style=\"width: 400px;\"/>";
echo "<input type=submit value=\"".i18n("No, this is the wrong form")."\" style=\"width: 400px; height: 40px; margin: 10px;\"/>";
echo "</form>";
if($config['regfee']>0)
{
if($config['regfee']>0) {
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"registration_number\" value=\"$reg_num\" />";
echo "<input type=\"hidden\" name=\"action\" value=\"receivedyes\" />";
echo "<input type=submit value=\"".i18n("Yes, right form with registration fee")."\" style=\"width: 400px;\"/>";
echo "<input type=submit value=\"".i18n("Yes, right form with registration fee")."\" style=\"width: 400px; height: 40px; margin: 10px;\"/>";
echo "</form>";
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"registration_number\" value=\"$reg_num\" />";
echo "<input type=\"hidden\" name=\"action\" value=\"receivedyesnocash\" />";
echo "<input type=submit value=\"".i18n("Yes, right form without registration fee")."\" style=\"width: 400px;\"/>";
echo "<input type=submit value=\"".i18n("Yes, right form without registration fee")."\" style=\"width: 400px; height: 40px; margin: 10px;\"/>";
echo "</form>";
}
else
{
else {
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"registration_number\" value=\"$reg_num\" />";
echo "<input type=\"hidden\" name=\"action\" value=\"receivedyes\" />";
echo "<input type=submit value=\"".i18n("Yes, this is the right form")."\" style=\"width: 400px;\"/>";
echo "<input type=submit value=\"".i18n("Yes, this is the right form")."\" style=\"width: 400px; height: 40px; margin: 10px;\"/>";
echo "</form>";
@ -172,8 +168,7 @@ echo mysql_Error();
echo "</table>";
$showformatbottom=false;
}
else
{
else {
echo i18n("This form has already been received. Registration is complete");
echo "<br />";
echo "<a href=\"registration_receivedforms.php?action=unregister&registration_number=$reg_num\">".i18n("Click here to unregister this project")."</a>";
@ -183,9 +178,16 @@ echo mysql_Error();
}
else
{
else {
echo error(i18n("All registration sections are not complete. Cannot register incomplete form"));
$reg=getRegistration($reg_id);
echo "<table class=\"tableview\">";
echo "<b>Registration Number: {$reg['registration_number']}</b><br />\n";
foreach($reg['status'] AS $k=>$v) {
echo "<tr><th>$k</td><td>".outputStatus($v)."</td></tr>\n";
}
echo "</table>\n";
echo "<br /><br />\n";
}
}
}
@ -204,11 +206,11 @@ echo mysql_Error();
FROM projects, registrations
WHERE projects.registrations_id = registrations.id
AND num='$regnum'
AND registrations.year='{$config['FAIRYEAR']}'");
AND registrations.conferences_id='{$conference['id']}'");
$checkNumResults=mysql_fetch_object($checkNumQuery);
$projectnum=$checkNumResults->projectnumber;
$q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
$q=mysql_query("SELECT id FROM registrations WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
$r=mysql_fetch_object($q);
$reg_id = $r->id;
@ -217,7 +219,7 @@ echo mysql_Error();
list($projectnumber,$ps,$pns,$pss) = generateProjectNumber($reg_id);
mysql_query("UPDATE projects SET projectnumber='$projectnumber',
projectsort='$ps',projectnumber_seq='$pns',projectsort_seq='$pss'
WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'");
echo happy(i18n("Assigned Project Number: %1",array($projectnumber)));
}
else
@ -226,24 +228,22 @@ echo mysql_Error();
//get all students with this registration number
$recipients=getEmailRecipientsForRegistration($reg_id);
if($_POST['action']=="receivedyes")
{
if($_POST['action']=="receivedyes") {
//actually set it to 'complete'
mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='complete' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) {
$to=$recip['to'];
$subsub=array();
$subbod=array(
"TO"=>$recip['to'],
"EMAIL"=>$recip['email'],
"FIRSTNAME"=>$recip['firstname'],
"LASTNAME"=>$recip['lastname'],
"USERNAME"=>$recip['username'],
"NAME"=>$recip['firstname']." ".$recip['lastname'],
"REGNUM"=>$regnum,
"PROJECTNUMBER"=>$projectnumber,
);
email_send("register_participants_received",$to,$subsub,$subbod);
$res=email_send("register_participants_received",$recip['email'],$subsub,$subbod);
}
echo happy(i18n("Registration of form %1 successfully completed",array($regnum)));
@ -251,43 +251,40 @@ echo mysql_Error();
else if($_POST['action']=="receivedyesnocash")
{
//actually set it to 'paymentpending'
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='$regnum' AND conferences_id='{$conference['id']}'");
foreach($recipients AS $recip) {
$to=$recip['to'];
$subsub=array();
$subbod=array(
"TO"=>$recip['to'],
"EMAIL"=>$recip['email'],
"FIRSTNAME"=>$recip['firstname'],
"LASTNAME"=>$recip['lastname'],
"USERNAME"=>$recip['username'],
"NAME"=>$recip['firstname']." ".$recip['lastname'],
"REGNUM"=>$regnum,
"PROJECTNUMBER"=>$projectnumber,
);
email_send("register_participants_paymentpending",$to,$subsub,$subbod);
email_send("register_participants_paymentpending",$recip['email'],$subsub,$subbod);
}
echo happy(i18n("Registration of form %1 marked as payment pending",array($regnum)));
}
}
else if($_POST['action']=="receivedno" && $_POST['registration_number'])
{
else if($_POST['action']=="receivedno" && $_POST['registration_number']) {
echo notice(i18n("Registration of form %1 cancelled",array($_POST['registration_number'])));
}
else if($_GET['action']=="unregister" && $_GET['registration_number']) {
$reg_num=intval(trim($_GET['registration_number']));
$q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.year='{$config['FAIRYEAR']}' AND registrations.num='$reg_num'");
$q=mysql_query("SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.conferences_id='{$conference['id']}' AND registrations.num='$reg_num'");
$r=mysql_fetch_object($q);
mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id='$r->proj_id' AND conferences_id='{$conference['id']}'");
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->reg_id' AND conferences_id='{$conference['id']}'");
echo happy(i18n("Successfully unregistered project"));
}
if($showformatbottom)
{
if($showformatbottom) {
echo "<form id=\"inputform\" method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"received\" />";
echo i18n("Enter the registration number from the signature form: ")."<br />";

View File

@ -22,13 +22,13 @@
*/
?>
<?
require("../common.inc.php");
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require("../register_participants.inc.php");
user_auth_required('admin');
require_once("../register_participants.inc.php");
if($_GET['year']) $year=$_GET['year'];
else $year=$config['FAIRYEAR'];
if($_GET['conferences_id']) $conferences_id=$_GET['conferences_id'];
else $conferences_id=$conference['id'];
send_header("Registration Statistics",
array('Committee Main' => 'committee_main.php',
@ -61,11 +61,11 @@
echo "</select>";
echo "</form>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$cats[$r->id]=$r->category;
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id' ORDER BY id");
while($r=mysql_fetch_object($q))
$divs[$r->id]=$r->division;
@ -97,13 +97,14 @@ else $wherestatus="";
projects.title,
projects.projectnumber,
projects.projectcategories_id,
projects.projectdivisions_id
projects.projectdivisions_id,
projects.language
FROM
registrations
left outer join projects on projects.registrations_id=registrations.id
WHERE
1
AND registrations.year='$year'
AND registrations.conferences_id='$conferences_id'
$wherestatus
ORDER BY
$ORDERBY
@ -118,7 +119,9 @@ else $wherestatus="";
$stats_projects_catdiv=array();
$stats_students_schools=array();
$stats_projects_schools=array();
$stats_projects_lang=array();
$schools_names=array();
$languages=array();
while($r=mysql_fetch_object($q))
{
@ -126,6 +129,8 @@ else $wherestatus="";
$stats_divisions[$r->projectdivisions_id]++;
$stats_categories[$r->projectcategories_id]++;
$stats_projects_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++;
$stats_projects_lang[$r->projectcategories_id][$r->projectdivisions_id][$r->language]++;
$languages[$r->language]++;
switch($r->status)
{
@ -137,18 +142,18 @@ else $wherestatus="";
$status_text=i18n($status_text);
$sq=mysql_query("SELECT students.firstname,
students.lastname,
students.id,
$sq=mysql_query("SELECT users.firstname,
users.lastname,
users.id,
schools.school,
schools.board,
schools.id AS schools_id
FROM
students,schools
users,schools
WHERE
students.registrations_id='$r->reg_id'
users.registrations_id='$r->reg_id'
AND
students.schools_id=schools.id
users.schools_id=schools.id
");
echo mysql_error();
@ -178,6 +183,7 @@ else $wherestatus="";
}
echo "<th>".i18n("Total")."<br /><nobr>".i18n("Stud | Proj")."</th>";
echo "</tr></thead>";
echo "<tbody>";
foreach($divs AS $d=>$dn) {
echo "<tr><td>$dn</td>";
$tstud=0;
@ -220,7 +226,7 @@ else $wherestatus="";
echo ($tproj);
echo "</b></td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</td></tr>";
@ -234,10 +240,10 @@ else $wherestatus="";
}
echo "<th>".i18n("Total")."<br /><nobr>".i18n("Stud | Proj")."</nobr></th>";
echo "</tr></thead>";
echo "<tbody>";
asort($schools_names);
foreach($schools_names AS $id=>$sn)
{
foreach($schools_names AS $id=>$sn) {
echo "<tr><td>$sn</td>";
$tstud=0;
$tproj=0;
@ -253,10 +259,75 @@ else $wherestatus="";
echo ($tproj?$tproj:0)."</b></td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo i18n("%1 schools total",array(count($schools_names)));
echo "</td></tr>";
echo "<tr><td colspan=\"2\"><br /></td></tr>";
echo "<tr><td colspan=\"2\"><h3>{$status_str[$showstatus]} - ".i18n("Projects per age category / division / language")."</h3></td></tr>";
echo "<tr><td colspan=\"2\">";
echo "<table class=\"tableview\" width=\"100%\">";
echo "<thead><tr><th rowspan='2' width=\"50%\"></th>";
foreach($cats AS $c=>$cn) {
echo "<th colspan='".count($languages)."'>$cn</th>";
}
echo "<th colspan='".count($languages)."'>".i18n("Total")."</nobr></th>";
echo "</tr><tr>";
ksort($languages);
$tprojcat = array();
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<th>$l</th>";
}
}
foreach($languages AS $l=>$ln) {
echo "<th>$l</th>";
}
echo "</tr></thead>";
echo "<tbody>";
foreach($divs AS $d=>$dn) {
echo "<tr><td>$dn</td>";
$tproj=array();
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<td align=\"center\">";
echo ($stats_projects_lang[$c][$d][$l]?$stats_projects_lang[$c][$d][$l]:0);
echo "</td>";
$tproj[$l]+=$stats_projects_lang[$c][$d][$l];
$tprojcat[$c][$l]+=$stats_projects_lang[$c][$d][$l];
}
}
foreach($tproj AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($ln?$ln:0);
echo "</b></td>";
}
echo "</tr>";
}
echo "<tr><td><b>".i18n("Total")."</b></td>";
$tproj=array();
foreach($cats AS $c=>$cn) {
foreach($languages AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($tprojcat[$c][$l]?$tprojcat[$c][$l]:0);
echo "</b></td>";
$tproj[$l]+=$tprojcat[$c][$l];
}
}
foreach($tproj AS $l=>$ln) {
echo "<td align=\"center\"><b>";
echo ($ln);
echo "</b></td>";
}
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</td></tr>";
echo "</table>";
echo "<br />";

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Web Consent",
array('Committee Main' => 'committee_main.php',
@ -34,18 +34,15 @@
echo "<br />";
if(is_array($_POST['changed']))
{
if(is_array($_POST['changed'])) {
$numchanged=0;
foreach($_POST['changed'] AS $id=>$val)
{
if($val==1)
{
foreach($_POST['changed'] AS $id=>$val) {
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";
mysql_query("UPDATE students SET
mysql_query("UPDATE users SET
webfirst='$webfirst',
weblast='$weblast',
webphoto='$webphoto'
@ -71,24 +68,24 @@
<?
$sq=mysql_query("SELECT students.firstname,
students.lastname,
students.id,
$sq=mysql_query("SELECT users.firstname,
users.lastname,
users.id,
projects.projectnumber,
students.webfirst,
students.weblast,
students.webphoto
users.webfirst,
users.weblast,
users.webphoto
FROM
students,
users,
registrations,
projects
WHERE
students.registrations_id=registrations.id
users.registrations_id=registrations.id
AND ( registrations.status = 'complete' OR registrations.status='paymentpending' )
AND projects.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'
AND projects.year='".$config['FAIRYEAR']."'
AND students.year='".$config['FAIRYEAR']."'
AND registrations.conferences_id='".$conference['id']."'
AND projects.conferences_id='".$conference['id']."'
AND users.conferences_id='".$conference['id']."'
ORDER BY projectnumber
");
echo mysql_error();
@ -102,6 +99,7 @@
echo " <th>".i18n("Last")."</th>";
echo " <th>".i18n("Photo")."</th>";
echo "</tr></thead>";
echo "<tbody>";
while($r=mysql_fetch_object($sq))
{
echo "<tr>";
@ -115,6 +113,7 @@
echo "<td><input $ch type=\"checkbox\" name=\"webphoto[$r->id]\" value=\"yes\" onchange=\"changed($r->id)\"></td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Changes")."\">";
echo "</form>";

View File

@ -49,7 +49,7 @@
$report_options = array();
$report_options['type'] = array('desc' => 'Report Format',
'values' => array('pdf'=>'PDF', 'csv'=>'CSV', 'label'=>'Label', 'tcpdf_label'=>'TCPDF Label (experimental)')
'values' => array('pdf' => 'PDF', 'label'=>'Label', 'csv'=>'CSV (for Excel)', 'text'=>'Coming Soon: Text (Plain text in columns)', 'html'=>'Coming Soon: HTML (Browser Renderable)' )
);
$report_options['group_new_page'] = array('desc' => 'Start each new grouping on a new page',
'values' => array('no'=>'No', 'yes'=>'Yes')
@ -66,12 +66,6 @@
$report_options['field_box'] = array('desc' => 'Draw a box around each text field on the label',
'values' => array('no'=>'No', 'yes'=>'Yes')
);
$report_options['label_fairname'] = array('desc' => 'Print the fair name at the top of each label',
'values' => array('no'=>'No', 'yes'=>'Yes')
);
$report_options['label_logo'] = array('desc' => 'Print the fair logo at the top of each label',
'values' => array('no'=>'No', 'yes'=>'Yes')
);
$report_options['default_font_size'] = array('desc' => 'Default font size to use in the report',
'values' => array(
'10'=>'10',
@ -96,175 +90,138 @@ LRP 180 99765 5967 4 1 3/4 x 1/2 80 */
/* FIXME: put these in a databse */
/* All dimensions are in millimeters */
$report_stock = array();
$report_stock['fullpage'] = array('name' => 'Letter 8.5 x 11 (3/4" margin)',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 7,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 9.5,
'y_spacing' => 0,
'rows' => 1,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 177.8,
'label_height' => 241.3,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_landscape'] = array('name' => 'Letter 8.5 x 11 Landscape (3/4" margin)',
'page_width' => 11,
'page_height' => 8.5,
'label_width' => 9.5,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 7,
'y_spacing' => 0,
'rows' => 1,
'page_format' => 'LETTER',
'page_orientation' => 'L',
'label_width' => 241.3,
'label_height' => 177.8,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_full'] = array('name' => 'Letter 8.5 x 11 (no margin)',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 8.5,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 11,
'y_spacing' => 0,
'rows' => 1,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 215.9,
'label_height' => 279.4,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['fullpage_landscape_full'] = array('name' => 'Letter 8.5 x 11 Landscape (no margin)',
'page_width' => 11,
'page_height' => 8.5,
'label_width' => 11,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 8.5,
'y_spacing' => 0,
'rows' => 1,
'page_format' => 'LETTER',
'page_orientation' => 'L',
'label_width' => 279.4,
'label_height' => 215.9,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['5161'] = array('name' => 'Avery 5161/5261/5961/8161, G&T 99189 (1"x4")',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 0.15,
'cols' => 2,
'label_height' => 1,
'y_spacing' => 0.00,
'y_padding' => 0.05,
'rows' => 10,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 25.4,
'x_spacing' => 3.81,
'y_spacing' => 0.00,
'cols' => 2,
'rows' => 10,
);
$report_stock['5162'] = array('name' => 'Avery 5162/5262/5962/8162/8462, G&T 99190 (1 1/3"x4")',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 3.99,
'x_spacing' => 0.187,
'cols' => 2,
'label_height' => 1.326,
'y_spacing' => 0.00,
'y_padding' => 0.30,
'rows' => 7,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.35,
'label_height' => 33.6804,
'x_spacing' => 4.7498,
'y_spacing' => 0.00,
'cols' => 2,
'rows' => 7,
);
$report_stock['5163'] = array('name' => 'Avery 5163/5263/5963/8163/8463, G&T 99181 (2"x4")',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 0.1719,
'cols' => 2,
'label_height' => 2,
'y_spacing' => 0.00,
'rows' => 5,
'page_format' => 'LETTER',
'page_orientation' => 'P',
);
/* This is combined with 5161
$report_stock['5961'] = array('name' => 'Avery 5961, G&T 99189 (1"x4")',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 0.08,
'label_width' => 101.6,
'label_height' => 50.8,
'x_spacing' => 4.3663,
'y_spacing' => 0.00,
'cols' => 2,
'label_height' => 1,
'y_spacing' => 0.08,
'rows' => 10,
'rows' => 5,
);
*/
$report_stock['5164'] = array('name' => 'Avery 5164/5264/5964/8164, G&T 99763 (4"x3 1/3")',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 3/16,
'cols' => 2,
'label_height' => 3 + 1/3,
'y_spacing' => 0,
'rows' => 3,
'page_format' => 'LETTER', /* tcpdf format */
'page_orientation' => 'P', /* tcpdf orientation */
'label_width' => 101.6,
'label_height' => 84.6667,
'x_spacing' => 4.7625,
'y_spacing' => 0,
'cols' => 2,
'rows' => 3,
);
$report_stock['nametag'] = array('name' => 'Cards 4"x3"',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 0,
'cols' => 2,
'label_height' => 3,
'y_spacing' => 0,
'rows' => 3,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 76.2,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 2,
'rows' => 3,
);
$report_stock['letter_4up'] = array('name' => 'Fullpage, 4up',
'page_width' => 8.5,
'page_height' => 11,
'label_width' => 4,
'x_spacing' => 0.25,
'cols' => 2,
'label_height' => 5,
'y_spacing' => 0.25,
'rows' => 2,
'page_format' => 'LETTER',
'page_orientation' => 'P',
'label_width' => 101.6,
'label_height' => 127.0,
'x_spacing' => 0.25,
'y_spacing' => 0.25,
'cols' => 2,
'rows' => 2,
);
$report_stock['ledger'] = array('name' => 'Ledger/Tabloid 11 x 17',
'page_width' => 11,
'page_height' => 17,
'label_width' => 11,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 17,
'y_spacing' => 0,
'rows' => 1,
'page_format' => 'LETTER',
'page_format' => 'TABLOID',
'page_orientation' => 'P',
'label_width' => 279.4,
'label_height' => 431.8,
'x_spacing' => 0,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
);
$report_stock['ledger_landscape'] = array('name' => 'Ledger/Tabloid 11 x 17 Landscape',
'page_width' => 17,
'page_height' => 11,
'label_width' => 17,
'page_format' => 'TABLOID',
'page_orientation' => 'L',
'label_width' => 431.8,
'label_height' => 279.4,
'x_spacing' => 0,
'cols' => 1,
'label_height' => 11,
'y_spacing' => 0,
'cols' => 1,
'rows' => 1,
'page_format' => 'LETTER',
'page_orientation' => 'P',
);
@ -299,6 +256,11 @@ foreach($report_stock as $n=>$v) {
'custom_url' => 'admin/reports_judges.php?type=csv',
'creator' => 'The Grant Brothers');
$x++;
$report_custom[$x] = array('id' => $x, 'name' => 'Custom -- Judges List (CSV) -- ALL YEARS',
'desc' => 'Judges List - All Years',
'custom_url' => 'admin/reports_judges_allyears.php?type=csv',
'creator' => 'The Grant Brothers');
$x++;
$report_custom[$x] = array('id' => $x, 'name' => 'Custom -- Judging Teams Project Assignments (PDF)',
'desc' => 'Judging Teams Project Assignments',
'custom_url' => 'admin/reports_judges_teams_projects.php?type=pdf',
@ -348,16 +310,13 @@ foreach($report_stock as $n=>$v) {
$x = 0;
foreach($report[$type] as $k=>$v) {
if($type == 'option') {
/* field, value, x, y, w, h, lines, face, align, valign, fn, fs, fsize, overflow */
$vals = "'$k','$v','0','0','0','0','0','','','','','','0','truncate'";
/* field, value, x, y, w, h, align, valign, fn, fs, fsize, overflow */
$vals = "'$k','$v','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['x']}','{$v['y']}','{$v['w']}','{$v['h']}',
'{$v['align']}','{$v['valign']}',
'{$v['fontname']}','$fs','{$v['fontsize']}',
'{$v['on_overflow']}'";
}
@ -368,7 +327,7 @@ foreach($report_stock as $n=>$v) {
mysql_query("INSERT INTO reports_items(`reports_id`,`type`,`ord`,
`field`,`value`,`x`, `y`, `w`, `h`,
`lines`, `face`, `align`,`valign`,
`align`,`valign`,
`fontname`,`fontstyle`,`fontsize`,`on_overflow`)
VALUES $q;");
@ -436,22 +395,10 @@ foreach($report_stock as $n=>$v) {
}
/* Pull out all the data */
$val = array();
$col_fields = array('field', 'x', 'y', 'w', 'h', 'lines', 'face', 'align', 'valign', 'value', 'fontname','fontsize','on_overflow');
$col_fields = array('field', 'x', 'y', 'w', 'h', 'align', 'valign', 'value', 'fontname','fontsize','on_overflow');
foreach($col_fields as $lf) $val[$lf] = $a[$lf];
$val['fontstyle'] = explode(',', $a['fontstyle']);
/* valign, fontname, fontsize,fontstyle are unused, except in tcpdf reports
(i.e. nothign has changed, only adding on */
if($val['lines'] == 0) $val['lines'] = 1;
$opts = explode(" ", $val['align']);
$align_opts = array ('left', 'right', 'center');
$valign_opts = array ('vtop', 'vbottom', 'vcenter');
$style_opts = array ('bold');
foreach($opts as $o) {
if(in_array($o, $align_opts)) $val['align'] = $o;
if(in_array($o, $valign_opts)) $val['valign'] = $o;
if(in_array($o, $valign_opts)) $val['face'] = $o;
}
$val['fontstyle'] = explode(',', $a['fontstyle']);
$report[$t][$a['ord']] = $val;
break;
@ -550,6 +497,7 @@ foreach($report_stock as $n=>$v) {
global $report_tours_fields, $report_fairs_fields;
global $report_fundraisings_fields;
global $filter_ops;
global $conference;
//print_r($report);
$fieldvar = "report_{$report['type']}s_fields";
@ -559,9 +507,7 @@ foreach($report_stock as $n=>$v) {
$fieldname = array();
$thead = array();
$table['header']=array();
$table['widths']=array();
$table['dataalign']=array();
$table['col']=array();
$table['option']=array();
$table['total']=0;
@ -578,53 +524,40 @@ foreach($report_stock as $n=>$v) {
$rep=new lcsv(i18n($report['name']));
$gen_mode = 'table';
break;
case 'label':
/* Label */
$label_stock = $report_stock[$report['option']['stock']];
$rep=new lpdf( i18n($config['fairname']),
i18n($report['name']),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo.gif");
$rep->setPageStyle("labels");
$rep->newPage($label_stock['page_width'], $label_stock['page_height']);
$rep->setFontSize(11);
$rep->setLabelDimensions($label_stock['label_width'], $label_stock['label_height'],
$label_stock['x_spacing'], $label_stock['y_spacing'],11,$label_stock['y_padding']);
$gen_mode = 'label';
break;
case 'pdf': case '':
/* FIXME: handle landscape pages in here */
$label_stock = $report_stock[$report['option']['stock']];
$rep=new lpdf( i18n($config['fairname']),
i18n($report['name']),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo.gif");
$rep->newPage($label_stock['page_width'], $label_stock['page_height']);
if($report['option']['default_font_size']) {
$rep->setDefaultFontSize($report['option']['default_font_size']);
$rep->setFontSize($report['option']['default_font_size']);
}
else {
$rep->setDefaultFontSize(11);
$rep->setFontSize(11);
}
$gen_mode = 'table';
if($report['option']['allow_multiline'] == 'yes')
$table['option']['allow_multiline'] = true;
break;
case 'tcpdf_label':
case 'label':
$label_stock = $report_stock[$report['option']['stock']];
$show_box = ($report['option']['label_box'] == 'yes') ? true : false;
$show_fair = ($report['option']['label_fairname'] == 'yes') ? true : false;
$show_logo = ($report['option']['label_logo'] == 'yes') ? true : false;
$rep=new pdf($report['name'], $label_stock['page_format'], $label_stock['page_orientation']);
$rep->setup_for_labels($show_box, $show_fair, $show_logo,
$label_stock['label_width'] * 25.4, $label_stock['label_height'] * 25.4,
$label_stock['x_spacing'] * 25.4, $label_stock['y_spacing'] * 25.4,
$label_stock['label_width'], $label_stock['label_height'],
$label_stock['x_spacing'], $label_stock['y_spacing'],
$label_stock['rows'], $label_stock['cols']);
$gen_mode = 'tcpdf_label';
$gen_mode = 'label';
break;
case 'pdf': case '':
$label_stock = $report_stock[$report['option']['stock']];
if($report['option']['allow_multiline'] == 'yes')
$on_overflow = 'nothing';
else
$on_overflow = '...';
$rep=new pdf($report['name'], $label_stock['page_format'], $label_stock['page_orientation']);
$rep->setup_for_tables($show_box, $show_fair, $show_logo,
$label_stock['label_width'], $label_stock['label_height'],
$label_stock['x_spacing'], $label_stock['y_spacing'],
$label_stock['rows'], $label_stock['cols']);
$gen_mode = 'table';
break;
case 'text':
echo "Not implemented [{$report['option']['type']}]";
exit;
default:
echo "Invalid type [{$report['option']['type']}]";
exit;
@ -643,30 +576,47 @@ foreach($report_stock as $n=>$v) {
* ones are scalable, just in case */
foreach($report['col'] as $o=>$d) {
$f = $d['field'];
$total_width += $fields[$f]['width'];
if($fields[$f]['scalable'] == true)
$scale_width += $fields[$f]['width'];
if($d['w'] != 0) {
/* Always 0 on old reports, so we never get in here */
$total_width += $d['w'];
/* For the rest of the computation, this field is
* not scalable */
/* FIXME! */
} else {
$total_width += $fields[$f]['width'];
if($fields[$f]['scalable'] == true)
$scale_width += $fields[$f]['width'];
}
}
/* Determine the scale factor (use the label width so
* we can enforce margins) */
if($report['option']['fit_columns'] == 'yes') { // && $total_width > $label_stock['label_width']) {
$static_width = $total_width - $scale_width;
if($scale_width)
$scale_factor = ($label_stock['label_width'] - $static_width) / $scale_width;
else
$scale_factor = 1.0;
if($scale_width)
$scale_factor = ($label_stock['label_width'] - $static_width) / $scale_width;
else
$scale_factor = 1.0;
} else {
$scale_factor = 1.0;
}
/* Select columns to display */
foreach($report['col'] as $o=>$d) {
$f = $d['field'];
$table['header'][] = i18n($fields[$f]['header']);
$sf = ($fields[$f]['scalable'] == true) ? $scale_factor : 1.0;
$table['widths'][] = $fields[$f]['width'] * $sf;
$table['dataalign'][] = 'left';
/* If width is specificed, use that, else compute based on default field width */
if($d['w'] == 0)
$width = $fields[$f]['width'] * (($fields[$f]['scalable'] == true) ? $scale_factor : 1.0);
else
$width = $d['w'];
$col = array( 'header' => i18n($fields[$f]['header']),
'width' => $width,
'align' => 'left',
'on_overflow' => $on_overflow);
$table['col'][] = $col;
$sel[] = "{$fields[$f]['table']} AS C$x";
$fieldname[$f] = "C$x";
/* We want to add these to group by, but AFTER all the other group bys */
@ -688,7 +638,7 @@ foreach($report_stock as $n=>$v) {
$fieldname[$f] = "G$o";
}
if(isset($fields[$f]['table_sort']))
if(isset($fields[$f]['able_sort']))
$order[] = $fields[$f]['table_sort'];
else
$order[] = $fieldname[$f];
@ -742,8 +692,8 @@ foreach($report_stock as $n=>$v) {
$order = implode(",", $order);
if(!isset($report['year'])) {
$report['year'] = $config['FAIRYEAR'];
if(!isset($report['conferences_id'])){
$report['conferences_id'] = $conference['id'];
}
$group_by = array_merge($group_by, $post_group_by);
@ -811,35 +761,27 @@ foreach($report_stock as $n=>$v) {
if(count($table['data'])) {
// print_r($table);
$rep->addTable($table);
$rep->nextLine();
$table['data'] = array();
$table['total'] = 0;
/* Start a new page AFTER a table is
* dumped, so the first page doesn't
* end up blank */
if($report['option']['group_new_page'] == 'yes') {
$rep->newPage();
$rep->addpage();
} else {
$rep->hr();
$rep->vspace(-0.1);
}
}
/* Construct a new header */
$h = implode(" -- ", $last_group_data);
$rep->heading($h);
$rep->nextLine();
}
}
$data = array();
if($gen_mode == 'label') {
$show_box = ($report['option']['label_box'] == 'yes') ? true : false;
$show_fair = ($report['option']['label_fairname'] == 'yes') ? true : false;
$show_logo = ($report['option']['label_logo'] == 'yes') ? true : false;
$rep->newLabel($show_box, $show_fair, $show_logo);
} else if($gen_mode == 'tcpdf_label') {
$rep->label_new();
}
@ -858,44 +800,41 @@ foreach($report_stock as $n=>$v) {
if($gen_mode == 'table') {
$data[] = $v;
} else if($gen_mode == 'label') {
$opt = array();
if($d['face'] == 'bold') $opt[] = 'bold';
$opt[] = $d['align'];
$opt[] = $d['valign'];
if($report['option']['field_box'] == 'yes')
$opt[] = 'field_box';
/* Special column, draw a box */
if($f == 'static_box') {
$rep->addLabelBox($d['x'], $d['y'], $d['w'],
$d['h']);
} else {
/* Special column, override result with static text */
if($f == 'static_text') $v = $d['value'];
$lh = ($d['lines'] == 0) ? 0 : $d['h']/$d['lines'];
$rep->addLabelText2($d['x'], $d['y'], $d['w'],
$d['h'], $lh,
$v, $opt);
}
} else if($gen_mode == 'tcpdf_label') {
/* Setup additional options */
$show_box = ($report['option']['field_box'] == 'yes') ? true : false;
// echo "<pre>"; print_r($d);
if($f == 'static_box') {
switch($f) {
case 'static_box':
$rep->label_rect($d['x'], $d['y'], $d['w'], $d['h']);
} else {
if($f == 'static_text') $v = $d['value'];
$v = iconv("ISO-8859-1//TRANSLIT", "UTF-8", $v);
break;
case 'conference_logo':
$rep->label_fair_logo($d['x'], $d['y'], $d['w'], $d['h'], $show_box);
break;
case "projectbarcode":
$style = array(
'border' => 2,
'vpadding' => 'auto',
'hpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false, //array(255,255,255)
'module_width' => 3, // width of a single module in points
'module_height' => 3 // height of a single module in points
);
$rep->label_barcode($v, 'QRCODE,H', $d['x'], $d['y'], $d['w'], $d['h'], $style, 'N');
break;
default:
if($f == 'static_text')
$v = $d['value'];
$rep->label_text($d['x'], $d['y'], $d['w'], $d['h'],
$v, $show_box, $d['align'], $d['valign'],
$d['fontname'],$d['fontstyle'],$d['fontsize'],
$d['on_overflow']);
$v, $show_box, $d['align'], $d['valign'],
$d['fontname'],$d['fontstyle'],$d['fontsize'],
$d['on_overflow']);
break;
}
}

View File

@ -36,7 +36,7 @@ switch($_GET['action']) {
case 'remove_report':
$id = intval($_GET['id']);
mysql_query("DELETE FROM reports_committee WHERE
users_id='{$_SESSION['users_uid']}' AND id='$id'");
users_id='{$_SESSION['accounts_id']}' AND id='$id'");
happy_('Report successfully removed');
exit;
case 'reload':
@ -67,7 +67,7 @@ case 'load_report':
/* Load available categories */
$q = mysql_query("SELECT DISTINCT category FROM reports_committee
WHERE users_id='{$_SESSION['users_uid']}'
WHERE users_id='{$_SESSION['accounts_id']}'
ORDER BY category");
while($i = mysql_fetch_object($q))
$ret['cat'][] = $i->category;
@ -82,7 +82,7 @@ case 'save':
if($id == -1) {
/* New entry */
mysql_query("INSERT INTO `reports_committee` (`users_id`,`reports_id`)
VALUES('{$_SESSION['users_uid']}','$reports_id');");
VALUES('{$_SESSION['accounts_id']}','$reports_id');");
echo mysql_error();
$id = mysql_insert_id();
}
@ -240,7 +240,7 @@ $(document).ready(function() {
$q = mysql_query("SELECT reports_committee.*,reports.name
FROM reports_committee
LEFT JOIN reports ON reports.id=reports_committee.reports_id
WHERE users_id='{$_SESSION['users_uid']}'
WHERE users_id='{$_SESSION['accounts_id']}'
ORDER BY category,id");
echo mysql_error();
if(mysql_num_rows($q) == 0) {
@ -283,18 +283,6 @@ $(document).ready(function() {
</td>
</tr>
<?
/*
if($i->reports_id > 0) {
echo '<tr><td width=\"20px\"></td><td>';
echo '<span style=\"font-size: 0.75em;\">';
echo i18n('Format').": {$i->format}, ";
echo i18n('Paper').": {$report_stock[$i->stock]['name']}, ";
echo i18n('Year').": {$config['FAIRYEAR']}";
echo '</span>';
echo '</td></tr>';
}
*/
}
echo "</table>";

View File

@ -1,12 +1,21 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
if($_GET['year']) $foryear=$_GET['year'];
else $foryear=$config['FAIRYEAR'];
if($_GET['foryear']){
// backwards compatability
$r = mysql_fetch_assoc(mysql_query("SELECT id FROM conferences WHERE year = " . $_GET['foryear']));
if(is_array($r)){
$forconference = $r['id'];
}else{
$forconference = $conference['id'];
}
}
if($_GET['conference']) $forconference=$_GET['conference'];
else $forconference=$conference['id'];
if($_GET['awardtype']=="All") $awardtype="";
else if($_GET['awardtype']) $awardtype=" AND award_types.type='".mysql_escape_string($_GET['awardtype'])."'";
@ -42,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();
@ -67,8 +76,8 @@ if(!$scriptformat) $scriptformat="default";
sponsors,
award_awards_projectcategories
WHERE
award_awards.year='$foryear'
AND award_types.year='$foryear'
award_awards.conferences_id='$forconference'
AND award_types.conferences_id='$forconference'
AND award_awards.award_types_id=award_types.id
AND award_awards.sponsors_id=sponsors.id
AND award_awards.id=award_awards_projectcategories.award_awards_id
@ -105,7 +114,7 @@ if(!$scriptformat) $scriptformat="default";
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
award_awards_id='{$r->id}'
AND award_prizes.year='$foryear'
AND award_prizes.conferences_id='$forconference'
AND award_prizes.excludefromac='0'
ORDER BY
`order`,
@ -228,17 +237,17 @@ if(!$scriptformat) $scriptformat="default";
if($scriptformat=="default")
$rep->addText( " ($pr->projectnumber) $pr->title");
$sq=mysql_query("SELECT students.firstname,
students.lastname,
students.pronunciation,
students.schools_id,
$sq=mysql_query("SELECT users.firstname,
users.lastname,
users.pronunciation,
users.schools_id,
schools.school
FROM
students,
users,
schools
WHERE
students.registrations_id='$pr->reg_id'
AND students.schools_id=schools.id
users.registrations_id='$pr->reg_id'
AND users.schools_id=schools.id
");
$students=" Students: ";
@ -249,9 +258,9 @@ if(!$scriptformat) $scriptformat="default";
if($studnum>0) $students.=", ";
$students.="$studentinfo->firstname $studentinfo->lastname";
if($studnum>0) $pronounce .= ", ";
$pronounce .= "\"{$studentinfo->pronunciation}\"";
$rawpronounce .= "{$studentinfo->pronunciation}";
if($studentinfo->pronunciation) {
$students .= " (Pronounced \"{$studentinfo->pronunciation}\")";
}
$student_winner[$studnum] = "$studentinfo->firstname $studentinfo->lastname";
$student_win_pronunc[$studnum] = "$studentinfo->pronunciation";
@ -261,8 +270,6 @@ if(!$scriptformat) $scriptformat="default";
if($scriptformat=="default") {
$rep->addText($students);
if(trim($rawpronounce) != "" && $show_pronunciation == TRUE)
$rep->addText(" Pronunciation: $pronounce");
$rep->addText(" School: {$student_school[0]}");
}
if($scriptformat=="formatted") {

View File

@ -24,7 +24,7 @@
<?
require_once('../common.inc.php');
require_once('../user.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('../tcpdf/tcpdf_sfiab_config.php');
require_once('../tcpdf/tcpdf.php');

View File

@ -20,105 +20,104 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
$report_awards_fields = array(
'name' => array(
'start_option_group' => 'Award Information',
'name' => 'Award -- Name',
'header' => 'Award Name',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => 'award_awards.name' ),
'criteria' => array(
'name' => 'Award -- Criteria',
'header' => 'Award Criteria',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => 'award_awards.criteria' ),
'presenter' => array(
'name' => 'Award -- Presenter',
'header' => 'Award Presenter',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'award_awards.presenter' ),
'order' => array(
'name' => 'Award -- Order',
'header' => 'Award Order',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'award_awards.order' ),
'cwsfaward' => array(
'name' => 'Award -- CWSF Award',
'header' => 'CWSF',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'award_awards.cwsfaward',
'value_map' => array ('0' => 'No', '1' => 'Yes')),
'type' => array(
'name' => 'Award -- Type',
'header' => 'Award Type',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'award_types.type' ),
'empty_winner_box' => array(
'name' => 'Award -- Empty Winner Box (for hand entry on printed reports)',
'header' => 'Winner',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => "CONCAT('')" ),
'sponsor_organization' => array(
'start_option_group' => 'Sponsor Information',
'name' => 'Sponsor -- Organization',
'header' => 'Sponsor Organization',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'sponsors.organization' ),
'sponsor_phone' => array(
'name' => 'Sponsor -- Phone',
'header' => 'Sp. Phone',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'sponsors.phone' ),
'sponsor_fax' => array(
'name' => 'Sponsor -- Fax',
'header' => 'Sp. Fax',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'sponsors.fax' ),
'sponsor_address' => array(
'name' => 'Sponsor -- Street Address',
'header' => 'Sponsor Address',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'sponsors.address'),
'sponsor_city' => array(
'name' => 'Sponsor -- City',
'header' => 'Sp. City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'sponsors.city' ),
'sponsor_province' => array(
'name' => 'Sponsor -- '.$config['provincestate'],
'header' => 'Sp. '.$config['provincestate'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'sponsors.province_code' ),
'sponsor_postal' => array(
'name' => 'Sponsor -- '.$config['postalzip'],
'header' => 'Sp. '.$config['postalzip'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'sponsors.postalcode' ),
'sponsor_notes' => array(
'name' => 'Sponsor -- Notes',
'header' => 'Sponsor Notes',
'width' => 3,
'width' => 76.2 /*mm*/,
'table' => 'sponsors.notes' ),
'sponsorship_status' => array(
'name' => 'Sponsorship -- Status',
'header' => 'Sp. Status',
'width' => .5,
'width' => 12.7 /*mm*/,
'table' => 'sponsorships.status',
'value_map' => array ('pending' => 'Pending', 'confirmed' => 'Confirmed'), "received"=>"Received"),
@ -126,104 +125,134 @@ $report_awards_fields = array(
'start_option_group' => 'Sponsor Primary Contact',
'name' => 'Primary Contact -- Salutation',
'header' => 'Cnct. Salutation',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.salutation' ),
'pcontact_last_name' => array(
'name' => 'Primary Contact -- Last Name',
'header' => 'Cnct. Last Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.lastname' ),
'pcontact_first_name' => array(
'name' => 'Primary Contact -- First Name',
'header' => 'Cnct. First Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.firstname' ),
'pcontact_name' => array(
'name' => 'Primary Contact -- Full Name (last, first)',
'header' => 'Contact Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(PRIMARYCONTACTUSER.lastname, ', ', PRIMARYCONTACTUSER.firstname)",
'table_sort'=> 'PRIMARYCONTACTUSER.lastname' ),
'pcontact_namefl' => array(
'name' => 'Primary Contact -- Full Name (salutation first last)',
'header' => 'Contact Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(PRIMARYCONTACTUSER.salutation, ' ', PRIMARYCONTACTUSER.firstname, ' ', PRIMARYCONTACTUSER.lastname)",
'table_sort'=> 'PRIMARYCONTACTUSER.lastname' ),
'pcontact_position' => array(
'name' => 'Primary Contact -- Position',
'header' => 'Cnct. Position',
'width' => 1.25,
'width' => 31.75 /*mm*/,
'table' => 'PRIMARYCONTACT.position'),
'pcontact_email' => array(
'name' => 'Primary Contact -- Email',
'header' => 'Cnct. Email',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.email'),
'pcontact_hphone' => array(
'name' => 'Primary Contact -- Home Phone',
'header' => 'Cnct. Home',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.phonehome' ),
'pcontact_wphone' => array(
'name' => 'Primary Contact -- Work Phone',
'header' => 'Cnct. Work',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.phonework' ),
'pcontact_cphone' => array(
'name' => 'Primary Contact -- Cell Phone',
'header' => 'Cnct. Cell',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.phonecell' ),
'pcontact_fax' => array(
'name' => 'Primary Contact -- Fax',
'header' => 'Cnct. Fax',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.fax' ),
'pcontact_notes' => array(
'name' => 'Primary Contact -- Notes',
'header' => 'Contact Notes',
'width' => 3,
'width' => 76.2 /*mm*/,
'table' => 'PRIMARYCONTACT.notes' ),
'pcontact_address' => array(
'name' => 'Primary Contact Address -- Street',
'header' => 'Address',
'width' => 50.8 /*mm*/,
'table' => "CONCAT(PRIMARYCONTACTUSER.address, ' ', PRIMARYCONTACTUSER.address2)"),
'pcontact_city' => array(
'name' => 'Primary Contact Address -- City',
'header' => 'City',
'width' => 38.1 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.city'),
'pcontact_province' => array(
'name' => 'Primary Contact Address -- '.$config['provincestate'],
'header' => $config['provincestate'],
'width' => 19.05 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.province'),
'pcontact_postal' => array(
'name' => 'Primary Contact Address -- '.$config['postalzip'],
'header' => $config['postalzip'],
'width' => 19.05 /*mm*/,
'table' => 'PRIMARYCONTACTUSER.postalcode' ),
'pcontact_city_prov' => array(
'name' => 'Primary Contact Address -- City, '.$config['provincestate'].' (for mailing)',
'header' => 'City',
'width' => 38.1 /*mm*/,
'table' => "CONCAT(PRIMARYCONTACTUSER.city, ', ', PRIMARYCONTACTUSER.province)"),
'judgeteamname' => array(
'start_option_group' => 'Judging Team',
'components' => array('judgingteam'),
'name' => 'Judging Team -- Name',
'header' => 'Judging Team',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => 'judges_teams.name'),
'judgeteamnum' => array(
'components' => array('judgingteam'),
'name' => 'Judging Team -- Number',
'header' => 'Team',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'judges_teams.num'),
'judgeteammembers_name' => array(
'components' => array('judgingteam', 'judgingteammembers'),
'name' => 'Judging Team -- Judge Name',
'header' => 'Judge Name',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => "CONCAT(judges.firstname, ' ', judges.lastname)"),
'judgeteammembers' => array(
'components' => array('judgingteam', 'judgingteammembers'),
'name' => 'Judging Team -- Members (REQUIRES MySQL 5.0)',
'header' => 'Team Members',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => "GROUP_CONCAT(judges.firstname, ' ', judges.lastname ORDER BY judges.lastname SEPARATOR ', ')",
'group_by' => array('award_awards.id', 'judges_teams.num') ),
@ -231,28 +260,28 @@ $report_awards_fields = array(
'start_option_group' => 'Prize Info (Duplicates award data for each prize, omits awards with no prizes)',
'name' => 'Prize -- Name',
'header' => 'Prize Name',
'width' => 2,
'width' => 50.8 /*mm*/,
'table' => 'award_prizes.prize',
'components' => array('prizes')),
'prize_cash' => array(
'name' => 'Prize -- Cash Amount',
'header' => 'Cash',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'award_prizes.cash',
'components' => array('prizes')),
'prize_scholarship' => array(
'name' => 'Prize -- Scholarship Amount',
'header' => 'Scholarship',
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'award_prizes.scholarship',
'components' => array('prizes')),
'prize_value' => array(
'name' => 'Prize -- Value Amount',
'header' => 'Value',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'award_prizes.value',
'components' => array('prizes')),
@ -260,7 +289,7 @@ $report_awards_fields = array(
'prize_fullname' => array(
'name' => 'Prize -- Name, Category, Division',
'header' => 'Prize Name',
'width' => 4,
'width' => 101.6 /*mm,
'table' => "CONCAT(award_prizes.prize,' in ',projectcategories.category,' ', projectdivisions.division)",
'table_sort' => 'award_prizes.order',
'components' => array('prizes')),
@ -268,7 +297,7 @@ $report_awards_fields = array(
'prize_trophy_any' => array(
'name' => 'Prize -- Trophy (\'Yes\' if the award has a trophy)',
'header' => 'Trophy',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => "IF ( award_prizes.trophystudentkeeper=1
OR award_prizes.trophystudentreturn=1
OR award_prizes.trophyschoolkeeper=1
@ -278,7 +307,7 @@ $report_awards_fields = array(
'prize_trophy_return' => array(
'name' => 'Prize -- Annual Trophy (\'Yes\' if the award has a school or student trophy that isn\'t a keeper)',
'header' => 'Trophy',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => "IF ( award_prizes.trophystudentreturn=1
OR award_prizes.trophyschoolreturn=1, 'Yes', 'No')",
'components' => array('prizes')),
@ -286,21 +315,21 @@ $report_awards_fields = array(
'prize_trophy_return_student' => array(
'name' => 'Prize -- Annual Student Trophy (\'Yes\' if the award has astudent trophy that isn\'t a keeper)',
'header' => 'Ind.',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => "IF ( award_prizes.trophystudentreturn=1, 'Yes', 'No')",
'components' => array('prizes')),
'prize_trophy_return_school' => array(
'name' => 'Prize -- Annual School Trophy (\'Yes\' if the award has a school trophy that isn\'t a keeper)',
'header' => 'Sch.',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => "IF ( award_prizes.trophyschoolreturn=1, 'Yes', 'No')",
'components' => array('prizes')),
'prize_all' => array(
'name' => 'Prize -- Lists all prize data (name, cash, scholarship, value, trophies)',
'header' => 'Prize',
'width' => 2,
'width' => 50.8 /*mm*/,
'table' => "CONCAT(
IF(award_prizes.prize != '', CONCAT(award_prizes.prize,'\n', ''),''),
IF(award_prizes.cash != '', CONCAT('$',award_prizes.cash,'\n'), ''),
@ -313,6 +342,19 @@ $report_awards_fields = array(
)",
'components' => array('prizes')),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
);
@ -321,15 +363,15 @@ $report_awards_fields = array(
global $config, $report_awards_fields;
$fields = $report_awards_fields;
$year = $report['year'];
$conferenceId = $report['conference_id'];
$judges_join = '';
$judges_where = '';
if(in_array('judgingteam', $components)) {
$judges_join = 'LEFT JOIN judges_teams_awards_link ON judges_teams_awards_link.award_awards_id=award_awards.id
LEFT JOIN judges_teams ON judges_teams.id=judges_teams_awards_link.judges_teams_id';
$judges_where = "AND judges_teams_awards_link.year='$year'
AND judges_teams.year='$year'";
$judges_where = "AND judges_teams_awards_link.conferences_id='$conferenceId'
AND judges_teams.conferences_id='$conferenceId'";
}
$judges_members_join = '';
@ -338,14 +380,14 @@ $report_awards_fields = array(
$judges_members_join = 'LEFT JOIN judges_teams_link ON judges_teams_link.judges_teams_id=judges_teams.id
LEFT JOIN judges ON judges.id=judges_teams_link.judges_id';
$judges_members_where = "AND judges_teams_link.year='$year'";
$judges_members_where = "AND judges_teams_link.conferences_id='$conferenceId'";
}
$prizes_join = '';
if(in_array('prizes', $components)) {
$prizes_join = 'LEFT JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id';
/* Don't need a where filter, the prize is attached by unique ID to an award
* that is already from the correct year. */
* that is already from the correct conference. */
}
@ -362,13 +404,12 @@ $report_awards_fields = array(
$judges_members_join
$prizes_join
WHERE
award_awards.year='$year'
AND award_types.year='$year'
award_awards.conferences_id='$conferenceId'
AND award_types.conferences_id='$conferenceId'
$judges_where
$judges_members_where
";
return $q;
}
?>

View File

@ -25,9 +25,9 @@
require("../common.inc.php");
require_once("../user.inc.php");
require_once('reports.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Award Ceremony Scripts",
array('Committee Main' => 'committee_main.php',
array('Main' => 'user_main.php',
'Administration' => 'admin/index.php'),
"print_awards_ceremony_scripts"
);
@ -38,7 +38,12 @@
echo "<tr><td><b>".i18n("Year").":</b></td><td>";
//get the year information, use fairname since it should be there for all years[right?]
$results = mysql_query("SELECT year FROM config WHERE var='fairname' AND year > 0 ORDER BY year DESC");
/* Find our conference oid */
$q = mysql_query("SELECT oid FROM conferences WHERE id='{$_SESSION['conferences_id']}'");
$c = mysql_fetch_assoc($q);
$conferences_oid = $c['oid'];
$results = mysql_query("SELECT year FROM conferences WHERE oid='$conferences_oid' AND year > 0 ORDER BY year DESC");
echo "<select name=\"year\" size=1>";
while($r=mysql_fetch_object($results)) {
@ -60,7 +65,7 @@
echo "<tr>";
//list award subsets to output
echo "<td><b>".i18n("Award Type").":</b></td> <td> <select name=\"awardtype\" size=1>";
$results = mysql_query("SELECT type FROM award_types WHERE year=".$config['FAIRYEAR']." ORDER BY type");
$results = mysql_query("SELECT type FROM award_types WHERE conferences_id=".$conference['id']." ORDER BY type");
echo "<option value=\"All\">".i18n("All")."</option>";
while($r=mysql_fetch_object($results)) {
echo "<option value=\"$r->type\">".i18n("$r->type")."</option>";
@ -92,7 +97,7 @@
echo "<tr><td><b>".i18n("Include the following age categories").":</b></td>";
echo "<td>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='{$conference['id']}' ORDER BY id");
while($r=mysql_fetch_object($q)) {
echo "<input name=\"show_category[{$r->id}]\" type=\"checkbox\" checked=\"checked\" />";
echo "".i18n($r->category)."<br />";

View File

@ -23,97 +23,117 @@
$report_committees_fields = array(
'name' => array(
'start_option_group' => 'Committee Member Name',
'name' => 'Committee Member -- Full Name ',
'header' => 'Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(users.firstname, ' ', users.lastname)",
'table_sort' => 'users.lastname'),
'last_name' => array(
'name' => 'Committee Member -- Last Name',
'header' => 'Last Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.lastname' ),
'first_name' => array(
'name' => 'Committee Member -- First Name',
'header' => 'First Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.firstname' ),
'email' => array(
'start_option_group' => 'Committee Member Contact Information',
'name' => 'Committee Member -- Email',
'header' => 'Email',
'width' => 2.0,
'table' => 'users.email'),
'width' => 50.8 /*mm*/,
'table' => 'accounts.email'),
'phone_home' => array(
'name' => 'Committee Member -- Phone (Home)',
'header' => 'Phone(Home)',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'users.phonehome'),
'phone_work' => array(
'name' => 'Committee Member -- Phone (Work)',
'header' => 'Phone(Work)',
'width' => 1.25,
'width' => 31.75 /*mm*/,
'table' => 'users.phonework'),
'phone_cel' => array(
'name' => 'Committee Member -- Phone (Cel)',
'header' => 'Phone(Cel)',
'width' => 1,
'name' => 'Committee Member -- Phone (Cell)',
'header' => 'Phone(Cell)',
'width' => 25.4 /*mm*/,
'table' => 'users.phonecell'),
'address' => array(
'name' => 'Committee Member -- Address Street',
'header' => 'Address',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => "CONCAT(users.address, ' ', users.address2)"),
'city' => array(
'name' => 'Committee Member -- Address City',
'header' => 'City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'users.city' ),
'province' => array(
'name' => 'Committee Member -- Address '.$config['provincestate'],
'header' => $config['provincestate'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'users.province' ),
'postal' => array(
'name' => 'Committee Member -- Address '.$config['postalzip'],
'header' => $config['postalzip'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'users.postalcode' ),
'organization' => array(
'start_option_group' => 'Committee Member Misc.',
'name' => 'Committee Member -- Organization',
'header' => 'Organization',
'width' => 2,
'width' => 50.8 /*mm*/,
'table' => 'users.organization'),
'firstaid' => array(
'name' => 'Committee Member -- First Aid Training',
'header' => 'F.Aid',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'users.firstaid',
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
'cpr' => array(
'name' => 'Committee Member -- CPR Training',
'header' => 'CPR',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'users.cpr',
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array(
'start_option_group' => 'Special Fields',
'name' => 'Static Text (useful for labels)',
'header' => '',
'width' => 0.1,
'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"),
);
function report_committees_fromwhere($report, $components)
@ -121,9 +141,10 @@ $report_committees_fields = array(
global $config, $report_committees_fields;
$fields = $report_committees_fields;
/*
// if this gets unremarked for future use, then the year references will need to be updated to use conferences instead
$year = $report['year'];
/*
$teams_from = '';
$teams_where = '';
if(in_array('teams', $components)) {
@ -134,10 +155,11 @@ $report_committees_fields = array(
AND committees_teams.year='$year'";
}
*/
$q = " FROM
users
$q = " FROM users
LEFT JOIN user_roles on user_roles.users_id=users.id
LEFT JOIN accounts ON accounts.id=users.accounts_id
WHERE
users.types LIKE '%committee%'
user_role.type='committee'
";
return $q;

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require_once('reports_students.inc.php');
require_once('reports_judges.inc.php');
@ -39,7 +39,7 @@
require_once('../tcpdf.inc.php');
$fields = array();
$locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h', 'Lines' => 'lines');
$locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h');
function field_selector($name, $id, $selected)
{
@ -175,7 +175,7 @@
}
send_header("Reports Editor",
send_header("Report Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
"report_management"
@ -203,53 +203,7 @@ function initCanvas(w,h,lw,lh) {
labelHeight=lh;
}
function createData(x,y,w,h,l,face,align,valign,value) {
var canvas=document.getElementById('layoutcanvas');
var newdiv=document.createElement('div');
if(valign=="vcenter") verticalAlign="middle";
else if(valign=="vtop") verticalAlign="top";
else if(valign=="vbottom") verticalAlign="bottom";
else verticalAlign="top";
// alert(verticalAlign);
//convert x,y,w,h from % to absolute
var dx=Math.round(x*canvasWidth/100);
var dy=Math.round(y*canvasHeight/100);
var dw=Math.round(w*canvasWidth/100);
var dh=Math.round(h*canvasHeight/100);
// alert(dx+','+dy+','+dw+','+dh);
var fontheight=Math.round(dh/l);
newdiv.setAttribute('id','o_'+canvasObjectIndex);
newdiv.style.display="table-cell";
newdiv.style.position="absolute";
newdiv.style.width=dw+"px";
newdiv.style.height=dh+"px";
newdiv.style.left=dx+"px";
newdiv.style.top=dy+"px";
newdiv.style.textAlign=align;
newdiv.style.verticalAlign=verticalAlign;
newdiv.style.padding="0 0 0 0";
newdiv.style.margin="0 0 0 0";
// newdiv.style.vertical-align=valign;
newdiv.style.border="1px solid blue";
newdiv.style.fontSize=fontheight+"px";
newdiv.style.lineHeight=fontheight+"px";
newdiv.style.fontFamily="Verdana";
newdiv.style.fontSizeAdjust=0.65;
var maxlength=Math.floor(dw/(fontheight*0.7))*l;
if(value.length>maxlength) value=value.substring(0,maxlength);
newdiv.innerHTML=value; //"Maple Test xxxx"; //value;
canvas.appendChild(newdiv);
canvasObjectIndex++;
}
function createDataTCPDF(x,y,w,h,align,valign,fontname,fontstyle,fontsize,value) {
function createData(x,y,w,h,align,valign,fontname,fontstyle,fontsize,value) {
var canvas=document.getElementById('layoutcanvas');
var newdiv=document.createElement('div');
@ -451,10 +405,10 @@ function createDataTCPDF(x,y,w,h,align,valign,fontname,fontstyle,fontsize,value)
echo "</table>\n";
$doCanvasSample = false;
$doCanvasSampletcpdf = false;
$l_w=$report_stock[$report['option']['stock']]['label_width'];
$l_h=$report_stock[$report['option']['stock']]['label_height'];
if($l_w && $l_h && $report['option']['type']=="label") {
if($l_w && $l_h && $report['option']['type']=='label') {
echo "<h4>Label Data Locations</h4>";
$doCanvasSample=true;
@ -466,26 +420,10 @@ $doCanvasSampletcpdf = false;
echo "<script type=\"text/javascript\">initCanvas($canvaswidth,$canvasheight,$l_w,$l_h)</script>\n";
}
if($l_w && $l_h && $report['option']['type']=="tcpdf_label") {
echo "<h4>Label Data Locations - TCPDF</h4>";
$l_w *= 25.4;
$l_h *= 25.4;
$doCanvasSampletcpdf=true;
$ratio=$l_h/$l_w;
$canvaswidth=600;
$canvasheight=round($canvaswidth*$ratio);
echo "<div id=\"layoutcanvas\" style=\"border: 1px solid red; position: relative; width: {$canvaswidth}px; height: {$canvasheight}px;\">";
echo "</div>\n";
echo "<script type=\"text/javascript\">initCanvas($canvaswidth,$canvasheight,$l_w,$l_h)</script>\n";
}
echo "<table>";
$x=0;
if($report['option']['type'] == 'label' || $report['option']['type'] == 'tcpdf_label') {
if($report['option']['type'] == 'label') {
$fontlist = array('' => 'Default');
$fl = PDF::getFontList();
foreach($fl as $f) $fontlist[$f] = $f;
@ -493,38 +431,27 @@ $doCanvasSampletcpdf = false;
foreach($report['col'] as $o=>$d) {
$f = $d['field'];
echo "<tr><td align=\"right\">Loc ".($o+1).": </td>";
echo "<td>";
echo "<b>{$fields[$d['field']]['name']}: </b><br/>";
$script="";
foreach($locs as $k=>$v) {
if($k=='Lines' && $report['option']['type'] != 'label') continue;
echo "$k=<input type=\"text\" size=\"3\" name=\"col[$x][$v]\" value=\"{$d[$v]}\">";
echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"{$d[$v]}\">";
$script.="{$d[$v]},";
}
if($report['option']['type'] == 'label') {
echo 'Face=';
selector("col[$x][face]", array('' => '', 'bold' => 'Bold'), $d['face']);
}
echo 'Align';
selector("col[$x][align]", array('center' => 'Center', 'left' => 'Left', 'right' => 'Right'),
$d['align']);
echo 'vAlign';
if($report['option']['type'] == 'label') {
selector("col[$x][valign]", array('vcenter' => 'Center', 'vtop' => 'Top', 'vbottom' => 'Bottom'),
$d['valign']);
} else {
selector("col[$x][valign]", array('middle' => 'Middle', 'top' => 'Top', 'bottom' => 'Bottom'),
$d['valign']);
echo 'Font=';
selector("col[$x][fontname]", $fontlist, $d['fontname']);
selector("col[$x][fontstyle]", array('' => '', 'bold' => 'Bold'), $d['fontstyle']);
echo "<input type=\"text\" size=\"3\" name=\"col[$x][fontsize]\" value=\"{$d['fontsize']}\">";
echo 'pt ';
echo 'OnOverflow=';
selector("col[$x][on_overflow]", array('tuncate'=>'Truncate','...'=>'Add ...', 'scale'=>'Scale'), $d['on_overflow']);
}
selector("col[$x][valign]", array('middle' => 'Middle', 'top' => 'Top', 'bottom' => 'Bottom'),
$d['valign']);
echo '<br/>';
echo 'Font=';
selector("col[$x][fontname]", $fontlist, $d['fontname']);
selector("col[$x][fontstyle]", array('' => '', 'bold' => 'Bold'), $d['fontstyle']);
echo "<input type=\"text\" size=\"3\" name=\"col[$x][fontsize]\" value=\"{$d['fontsize']}\">";
echo 'pt ';
echo 'OnOverflow=';
selector("col[$x][on_overflow]", array('nothing'=>'Nothing (overflow the box)', 'truncate'=>'Truncate','...'=>'Truncate and add ellipses (...)', 'scale'=>'Scale'), $d['on_overflow']);
if($f == 'static_text') {
echo "<br />Text=<input type=\"text\" size=\"40\" name=\"col[$x][value]\" value=\"{$d['value']}\">";
@ -532,47 +459,36 @@ $doCanvasSampletcpdf = false;
echo "<input type=\"hidden\" name=\"col[$x][value]\" value=\"\">";
}
if($doCanvasSample)
echo "<script type=\"text/javascript\">createData({$script}'{$d['face']}','{$d['align']}','{$d['valign']}','{$canvasLabels[$x]}')</script>\n";
if($doCanvasSampletcpdf)
echo "<script type=\"text/javascript\">createDataTCPDF({$script}'{$d['align']}','{$d['valign']}','{$d['fontname']}','{$d['fontstyle']}','{$d['fontsize']}','{$canvasLabels[$x]}')</script>\n";
echo "<script type=\"text/javascript\">createData({$script}'{$d['align']}','{$d['valign']}','{$d['fontname']}','{$d['fontstyle']}','{$d['fontsize']}','{$canvasLabels[$x]}')</script>\n";
$x++;
echo '<br/><br/>';
}
for(;$x<$n_columns;$x++) {
echo "<tr><td align=\"right\">Loc ".($x+1).": </td>";
echo "<td>";
echo "<b>New Column ".($x+1).": </b><br/> ";
foreach($locs as $k=>$v) {
if($k=='Lines' && $report['option']['type'] != 'label') continue;
echo "$k=<input type=\"text\" size=\"3\" name=\"col[$x][$v]\" value=\"0\">";
}
if($report['option']['type'] == 'label') {
echo 'Face=';
selector("col[$x][face]", array('' => '', 'bold' => 'Bold'), '');
echo "$k=<input type=\"text\" size=\"5\" name=\"col[$x][$v]\" value=\"0\">";
}
echo 'Align';
selector("col[$x][align]", array('center' => 'Center', 'left' => 'Left', 'right' => 'Right'),
'center');
echo 'vAlign';
if($report['option']['type'] == 'label') {
selector("col[$x][valign]", array('vcenter' => 'Center', 'vtop' => 'Top', 'vbottom' => 'Bottom'),
'top');
} else {
selector("col[$x][valign]", array('middle' => 'Middle', 'top' => 'Top', 'bottom' => 'Bottom'), 'middle');
selector("col[$x][valign]", array('middle' => 'Middle', 'top' => 'Top', 'bottom' => 'Bottom'), 'middle');
echo 'Font=';
selector("col[$x][fontname]", $fontlist, '');
selector("col[$x][fontstyle]", array('' => '', 'bold' => 'Bold'), '');
echo "<input type=\"text\" size=\"3\" name=\"col[$x][fontsize]\" value=\"\">";
echo 'pt ';
echo 'OnOverflow=';
selector("col[$x][on_overflow]", array('Truncate'=>'truncate','Add ...'=>'...', 'Scale'=>'scale'),'');
}
echo '<br/>';
echo 'Font=';
selector("col[$x][fontname]", $fontlist, '');
selector("col[$x][fontstyle]", array('' => '', 'bold' => 'Bold'), '');
echo "<input type=\"text\" size=\"3\" name=\"col[$x][fontsize]\" value=\"\">";
echo 'pt ';
echo 'OnOverflow=';
selector("col[$x][on_overflow]", array('nothing'=>'Nothing (overflow the box)', 'truncate'=>'Truncate','...'=>'Truncate and add ellipses (...)', 'scale'=>'Scale'),'truncate');
echo "<input type=\"hidden\" name=\"col[$x][value]\" value=\"\">";
echo "</td></tr>";
echo "<br/><br/>";
}
}
echo "</table>\n";
echo "<h4>Grouping</h4>";
for($x=0;$x<2;$x++) {
echo "Group By".($x + 1).": ";

View File

@ -20,379 +20,396 @@
Boston, MA 02111-1307, USA.
*/
$parts = explode('-', $config['dates']['fairdate']);
$fairYear = $parts[0];
$report_fairs_fields = array(
'fair_name' => array(
'fairinfo_name' => array(
'start_option_group' => 'Fair Information',
'name' => 'Fair -- Fair Name',
'header' => 'Name',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'fairs.name'),
'fairstats_year' => array (
'start_option_group' => 'Fair Statistics',
'name' => 'Fair Stats -- Year',
'header' => 'Year',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.year',
'components' => array('fairs_stats')),
'fairstats_year' => array (
'name' => 'Fair Stats -- Year',
'header' => 'Year',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.year',
'components' => array('fairs_stats')),
'fairstats_start_date' => array (
'name' => 'Fair Stats -- Fair Start',
'header' => 'Fair Start',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.start_date',
'components' => array('fairs_stats')),
'fairstats_end_date' => array (
'name' => 'Fair Stats -- Fair End',
'header' => 'Fair End',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.end_date',
'components' => array('fairs_stats')),
'fairstats_budget' => array (
'name' => 'Fair Stats -- Budget',
'header' => 'Budget',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.budget',
'components' => array('fairs_stats')),
'fairstats_address' => array (
'name' => 'Fair Stats -- Fair Location',
'header' => 'Fair Location',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.address',
'components' => array('fairs_stats')),
'fairstats_ysf_affiliation_complete' => array (
'name' => 'Fair Stats -- YSC Affilitation Complete',
'header' => 'YSC Affilitation Complete',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.ysf_affiliation_complete',
'components' => array('fairs_stats')),
'fairstats_charity' => array (
'name' => 'Fair Stats -- Charity Number/Info',
'header' => 'Charity Number/Info',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.charity',
'components' => array('fairs_stats')),
'fairstats_scholarships' => array (
'name' => 'Fair Stats -- Scholarship Info',
'header' => 'Scholarship Info',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.scholarships',
'components' => array('fairs_stats')),
'fairstats_male_1' => array (
'name' => 'Fair Stats -- Males Grade 1-3',
'header' => 'Males Grade 1-3',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.male_1',
'components' => array('fairs_stats')),
'fairstats_male_4' => array (
'name' => 'Fair Stats -- Males Grade 4-6',
'header' => 'Males Grade 4-6',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.male_4',
'components' => array('fairs_stats')),
'fairstats_male_7' => array (
'name' => 'Fair Stats -- Males Grade 7-8',
'header' => 'Males Grade 7-8',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.male_7',
'components' => array('fairs_stats')),
'fairstats_male_9' => array (
'name' => 'Fair Stats -- Males Grade 9-10',
'header' => 'Males Grade 9-10',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.male_9',
'components' => array('fairs_stats')),
'fairstats_male_11' => array (
'name' => 'Fair Stats -- Males Grade 11-12',
'header' => 'Males Grade 11-12',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.male_11',
'components' => array('fairs_stats')),
'fairstats_female_1' => array (
'name' => 'Fair Stats -- Females Grade 1-3',
'header' => 'Females Grade 1-3',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.female_1',
'components' => array('fairs_stats')),
'fairstats_female_4' => array (
'name' => 'Fair Stats -- Females Grade 4-6',
'header' => 'Females Grade 4-6',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.female_4',
'components' => array('fairs_stats')),
'fairstats_female_7' => array (
'name' => 'Fair Stats -- Females Grade 7-8',
'header' => 'Females Grade 7-8',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.female_7',
'components' => array('fairs_stats')),
'fairstats_female_9' => array (
'name' => 'Fair Stats -- Females Grade 9-10',
'header' => 'Females Grade 9-10',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.female_9',
'components' => array('fairs_stats')),
'fairstats_female_11' => array (
'name' => 'Fair Stats -- Females Grade 11-12',
'header' => 'Females Grade 11-12',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.female_11',
'components' => array('fairs_stats')),
'fairstats_projects_1' => array (
'name' => 'Fair Stats -- Projects Grade 1-3',
'header' => 'Projects Grade 1-3',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.projects_1',
'components' => array('fairs_stats')),
'fairstats_projects_4' => array (
'name' => 'Fair Stats -- Projects Grade 4-6',
'header' => 'Projects Grade 4-6',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.projects_4',
'components' => array('fairs_stats')),
'fairstats_projects_7' => array (
'name' => 'Fair Stats -- Projects Grade 7-8',
'header' => 'Projects Grade 7-8',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.projects_7',
'components' => array('fairs_stats')),
'fairstats_projects_9' => array (
'name' => 'Fair Stats -- Projects Grade 9-10',
'header' => 'Projects Grade 9-10',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.projects_9',
'components' => array('fairs_stats')),
'fairstats_projects_11' => array (
'name' => 'Fair Stats -- Projects Grade 11-12',
'header' => 'Projects Grade 11-12',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.projects_11',
'components' => array('fairs_stats')),
'fairstats_firstnations' => array (
'name' => 'Fair Stats -- First Nations Students',
'header' => 'First Nations Students',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.firstnations',
'components' => array('fairs_stats')),
'fairstats_students_atrisk' => array (
'name' => 'Fair Stats -- Inner City Students',
'header' => 'Inner City Students',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.students_atrisk',
'components' => array('fairs_stats')),
'fairstats_schools_atrisk' => array (
'name' => 'Fair Stats -- Inner City Schools',
'header' => 'Inner City Schools',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_atrisk',
'components' => array('fairs_stats')),
'fairstats_students_total' => array (
'name' => 'Fair Stats -- Total Participants',
'header' => 'Total Participants',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.students_total',
'components' => array('fairs_stats')),
'fairstats_schools_total' => array (
'name' => 'Fair Stats -- Total Schools',
'header' => 'Total Schools',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_total',
'components' => array('fairs_stats')),
'fairstats_schools_active' => array (
'name' => 'Fair Stats -- Active Schools',
'header' => 'Active Schools',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_active',
'components' => array('fairs_stats')),
'fairstats_students_public' => array (
'name' => 'Fair Stats -- Participants from Public',
'header' => 'Participants from Public',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.students_public',
'components' => array('fairs_stats')),
'fairstats_schools_public' => array (
'name' => 'Fair Stats -- Public Schools',
'header' => 'Public Schools',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_public',
'components' => array('fairs_stats')),
'fairstats_students_private' => array (
'name' => 'Fair Stats -- Participants from Independent',
'header' => 'Participants from Independent',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.students_private',
'components' => array('fairs_stats')),
'fairstats_schools_private' => array (
'name' => 'Fair Stats -- Independent Schools',
'header' => 'Independent Schools',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_private',
'components' => array('fairs_stats')),
'fairstats_schools_districts' => array (
'name' => 'Fair Stats -- School Districts',
'header' => 'School Districts',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.schools_districts',
'components' => array('fairs_stats')),
'fairstats_studentsvisiting' => array (
'name' => 'Fair Stats -- Students Visiting',
'header' => 'Students Visiting',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.studentsvisiting',
'components' => array('fairs_stats')),
'fairstats_publicvisiting' => array (
'name' => 'Fair Stats -- Public Guests Visting',
'header' => 'Public Guests Visting',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.publicvisiting',
'components' => array('fairs_stats')),
'fairstats_teacherssupporting' => array (
'name' => 'Fair Stats -- Teachers Supporting Projects',
'header' => 'Teachers Supporting Projects',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.teacherssupporting',
'components' => array('fairs_stats')),
'fairstats_increasedinterest' => array (
'name' => 'Fair Stats -- Students Increased Interest in Science',
'header' => 'Students Increased Interest in Science',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.increasedinterest',
'components' => array('fairs_stats')),
'fairstats_consideringcareer' => array (
'name' => 'Fair Stats -- Students Considering Career in Science',
'header' => 'Students Considering Career in Science',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.consideringcareer',
'components' => array('fairs_stats')),
'fairstats_committee_members' => array (
'name' => 'Fair Stats -- Committee Members',
'header' => 'Committee Members',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.committee_members',
'components' => array('fairs_stats')),
'fairstats_judges' => array (
'name' => 'Fair Stats -- Judges',
'header' => 'Judges',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.judges',
'components' => array('fairs_stats')),
'fairstats_next_chair_name' => array (
'name' => 'Fair Stats -- Regional Chairperson Name',
'header' => 'Regional Chairperson Name',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.next_chair_name',
'components' => array('fairs_stats')),
'fairstats_next_chair_email' => array (
'name' => 'Fair Stats -- Email',
'header' => 'Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.next_chair_email',
'components' => array('fairs_stats')),
'fairstats_next_chair_hphone' => array (
'name' => 'Fair Stats -- Home Phone',
'header' => 'Home Phone',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.next_chair_hphone',
'components' => array('fairs_stats')),
'fairstats_next_chair_bphone' => array (
'name' => 'Fair Stats -- Business Phone',
'header' => 'Business Phone',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.next_chair_bphone',
'components' => array('fairs_stats')),
'fairstats_next_chair_fax' => array (
'name' => 'Fair Stats -- Fax',
'header' => 'Fax',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.next_chair_fax',
'components' => array('fairs_stats')),
'fairstats_delegate1' => array (
'name' => 'Fair Stats -- Delegate 1',
'header' => 'Delegate 1',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate1',
'components' => array('fairs_stats')),
'fairstats_delegate2' => array (
'name' => 'Fair Stats -- Delegate 2',
'header' => 'Delegate 2',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate2',
'components' => array('fairs_stats')),
'fairstats_delegate3' => array (
'name' => 'Fair Stats -- Delegate 3',
'header' => 'Delegate 3',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate3',
'components' => array('fairs_stats')),
'fairstats_delegate4' => array (
'name' => 'Fair Stats -- Delegate 4',
'header' => 'Delegate 4',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate4',
'components' => array('fairs_stats')),
'fairstats_delegate1_email' => array (
'name' => 'Fair Stats -- Delegate 1 Email',
'header' => 'Delegate 1 Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate1_email',
'components' => array('fairs_stats')),
'fairstats_delegate2_email' => array (
'name' => 'Fair Stats -- Delegate 2 Email',
'header' => 'Delegate 2 Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate2_email',
'components' => array('fairs_stats')),
'fairstats_delegate3_email' => array (
'name' => 'Fair Stats -- Delegate 3 Email',
'header' => 'Delegate 3 Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate3_email',
'components' => array('fairs_stats')),
'fairstats_delegate4_email' => array (
'name' => 'Fair Stats -- Delegate 4 Email',
'header' => 'Delegate 4 Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate4_email',
'components' => array('fairs_stats')),
'fairstats_delegate1_size' => array (
'name' => 'Fair Stats -- Delegate 1 Jacket Size',
'header' => 'Delegate 1 Jacket Size',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate1_size',
'components' => array('fairs_stats')),
'fairstats_delegate2_size' => array (
'name' => 'Fair Stats -- Delegate 2 Jacket Size',
'header' => 'Delegate 2 Jacket Size',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate2_size',
'components' => array('fairs_stats')),
'fairstats_delegate3_size' => array (
'name' => 'Fair Stats -- Delegate 3 Jacket Size',
'header' => 'Delegate 3 Jacket Size',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate3_size',
'components' => array('fairs_stats')),
'fairstats_delegate4_size' => array (
'name' => 'Fair Stats -- Delegate 4 Jacket Size',
'header' => 'Delegate 4 Jacket Size',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'fairs_stats.delegate4_size',
'components' => array('fairs_stats')),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Local Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array (
'name' => 'Static Text (useful for labels)',
'header' => '',
'width' => 0.1,
'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"),
);
@ -402,19 +419,19 @@ $report_fairs_fields = array(
global $config, $report_fairs_fields;
$fields = $report_fairs_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
if(in_array('fairs_stats', $components)) {
$fs_from = 'LEFT JOIN fairs_stats ON fairs_stats.fairs_id=fairs.id';
$fs_where = "fairs_stats.year='$year'";
$fs_where = "fairs_stats.conferences_id='$conferences_id' AND";
}
$q = " FROM fairs
$fs_from
WHERE
1 AND
$fs_where
1
";
return $q;

View File

@ -30,8 +30,6 @@ function report_fundraisings_languages(&$report, $field, $text)
return join(' ', $l);
}
/* Components: */
/* Yes, fundraisings, the generator takes the report type (also the user.type in many cases) and
* just adds an 's' to find the fields and the functions. */
@ -40,21 +38,21 @@ $report_fundraisings_fields = array(
'start_option_group' => 'Campaign ID',
'name' => 'Fundraising Campaign numerical ID',
'header' => 'ID',
'width' => 0.25,
'width' => 6.35 /*mm*/,
'table' => "fundraising_campaigns.id"),
'salutation' => array(
'start_option_group' => 'Contact Information',
'name' => 'Contact -- Salutation (Mr., Mrs., etc.)',
'header' => 'Sal',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => "users.salutation",
'components' => array('users') ),
'namefl' => array(
'name' => 'Contact -- Full Name (first last)',
'header' => 'Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(users.firstname, ' ', users.lastname)",
'table_sort'=> 'users.lastname',
'components' => array('users') ),
@ -62,35 +60,35 @@ $report_fundraisings_fields = array(
'email' => array(
'name' => 'Contact -- Email',
'header' => 'Email',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'users.email',
'components' => array('users') ),
'phone_home' => array(
'name' => 'Contact -- Phone (Home)',
'header' => 'Phone(Home)',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'users.phonehome',
'components' => array('users') ),
'phone_work' => array(
'name' => 'Contact -- Phone (Work)',
'header' => 'Phone(Work)',
'width' => 1.25,
'width' => 31.75 /*mm*/,
'table' => "users.phonework",
'components' => array('users') ),
'organization' => array(
'name' => 'Contact -- Organization',
'header' => 'Organization',
'width' => 2,
'width' => 50.8 /*mm*/,
'table' => 'users.organization',
'components' => array('users') ),
'position' => array(
'name' => 'Contact -- Position',
'header' => 'Position',
'width' => 2,
'width' => 50.8 /*mm*/,
'table' => 'users_sponsor.position',
'components' => array('users') ),
@ -98,58 +96,72 @@ $report_fundraisings_fields = array(
'start_option_group' => 'Contact Address',
'name' => 'Contact Address -- Street',
'header' => 'Address',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => "CONCAT(users.address, ' ', users.address2)",
'components' => array('users') ),
'city' => array(
'name' => 'Contact Address -- City',
'header' => 'City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'users.city',
'components' => array('users') ),
'province' => array(
'name' => 'Contact Address -- '.$config['provincestate'],
'header' => $config['provincestate'],
'width' => 0.75,
'header' => $config['provincestate'],
'width' => 19.05 /*mm*/,
'table' => 'users.province',
'components' => array('users') ),
'postal' => array(
'name' => 'Contact Address -- '.$config['postalzip'],
'header' => $config['postalzip'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'users.postalcode' ,
'components' => array('users') ),
'city_prov' => array(
'name' => 'Contact Address -- City, '.$config['provincestate'].' (for mailing)',
'header' => 'City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => "CONCAT(users.city, ', ', users.province)",
'components' => array('users') ),
/* // FIXME - not sure what to do with these options, converting from years to conferences
'year' => array(
'start_option_group' => 'Miscellaneous',
'name' => 'Contact -- Year',
'header' => 'Year',
'width' => 0.5,
'width' => 12.7 //mm,
'table' => 'users.year',
'components' => array('users') ),
'user_filter' => array(
'name' => 'User Filter by MAX(year)',
'header' => '',
'width' => 0.1,
'width' => 2.54 //mm,
'table' => 'MAX(users.year)',
'group_by' => array('users.uid'),
'group_by' => array('users.accounts_id'),
'components' => array('users') ),
*/
'static_text' => array(
'name' => 'Static Text (useful for labels)',
'header' => '',
'width' => 0.1,
'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
);
@ -159,16 +171,21 @@ $report_fundraisings_fields = array(
global $config, $report_fundraisings_fields;
$fields = $report_fundraisings_fields;
$year = $report['year'];
// $conferences_id = $report['conferences_id'];
if(in_array('users', $components)) {
$users_from = 'LEFT JOIN fundraising_campaigns_users_link ON fundraising_campaigns.id=fundraising_campaigns_users_link.fundraising_campaigns_id
LEFT JOIN users ON users.uid=fundraising_campaigns_users_link.users_uid
LEFT JOIN users ON users.accounts_id=fundraising_campaigns_users_link.users_uid
LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id';
$users_where = "users.deleted!='yes' AND";
}
/*
// this chunk of code was already remarked when updating the system to use conferences
// instead of fair years. If it gets re-used however, then it will need to be updated
// accordingly. Not sure as I write this comment how the fundraising years will link
// to the conferences, rather than to the fair years that were previously used.
$teams_from = '';
$teams_where = '';
if(in_array('teams', $components)) {

View File

@ -22,28 +22,33 @@
*/
?>
<?
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require_once('reports.inc.php');
require_once("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('admin');
require_once('reports.inc.php');
$id = intval($_GET['id']);
$type = stripslashes($_GET['type']);
$stock = stripslashes($_GET['stock']);
$year = intval($_GET['year']);
$include_incomplete_registrations = ($_GET['include_incomplete_registrations'] == 'yes') ? 'yes' : '';
$show_options = array_key_exists('show_options', $_GET);
if($year < 1000) $year = $config['FAIRYEAR'];
/* If it's a system report, turn that into the actual report id */
if(array_key_exists('sid', $_GET)) {
$sid = intval($_GET['sid']);
$q = mysql_query("SELECT id FROM reports WHERE system_report_id='$sid'");
$id = intval($_GET['id']);
$type = $_GET['type'];
$stock = $_GET['stock'];
if(array_key_exists('conferences_id', $_GET)){
$conferences_id = intval($_GET['conferences_id']);
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM conferences WHERE id = $conferences_id"), 0);
if($result != 1) $conferences_id = $conference['id'];
}else{
$conferences_id = $conference['id'];
}
$include_incomplete_registrations = ($_GET['include_incomplete_registrations'] == 'yes') ? 'yes' : '';
$show_options = array_key_exists('show_options', $_GET);
/* If it's a system report, turn that into the actual report id */
if(array_key_exists('sid', $_GET)) {
$sid = intval($_GET['sid']);
$q = mysql_query("SELECT id FROM reports WHERE system_report_id='$sid'");
$r = mysql_fetch_assoc($q);
$id = $r['id'];
}
}
$report = report_load($id);
/* Add a custom filter if specified */
$filter_args = '';
@ -55,7 +60,7 @@ if(is_array($_GET['filter'])) {
}
switch($_GET['action']) {
case 'dialog_gen':
case 'dialog_gen':
if($id < 0) {
$u = "{$config['SFIABDIRECTORY']}/{$report_custom[-$id]['custom_url']}";
?>
@ -89,7 +94,7 @@ case 'dialog_gen':
<?
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['users_uid']}'
WHERE users_id='{$_SESSION['accounts_id']}'
AND reports_id='{$report['id']}'");
if(mysql_num_rows($q) > 0) {
$i = mysql_fetch_assoc($q);
@ -109,12 +114,12 @@ case 'dialog_gen':
<?
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$year = $config['FAIRYEAR'];
$conferences_id = $conference['id'];
/* Out of all the report optins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td class=\"label\"><b>{$o['desc']}</b>:</td>";
echo "<td class=\"input\"><select name=\"$ok\" id=\"$ok\">";
@ -124,14 +129,16 @@ case 'dialog_gen':
}
echo "</select></td></tr>\n";
}
/* Find all the years */
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
echo "<tr><td class=\"label\"><b>".i18n('Year')."</b>:</td>";
echo "<td class=\"input\"><select name=\"year\" id=\"year\">";
while($i = mysql_fetch_assoc($q)) {
$y = $i['year'];
$sel = ($config['FAIRYEAR'] == $y) ? 'selected="selected"' : '';
echo "<option value=\"$y\" $sel>$y</option>";
// Find all conferences
$q = mysql_query("SELECT conferences.name, conferences.id, dates.date FROM conferences JOIN dates on dates.conferences_id = conferences.id WHERE dates.name='fairdate' ORDER BY dates.date DESC");
echo "<tr><td class=\"label\"><b>".i18n('Conference')."</b>:</td>";
echo "<td class=\"input\"><select name=\"conferences_id\" id=\"conferences_id\">";
while($row = mysql_fetch_assoc($q)){
$parts = explode(' ', $row['date']);
$date = $parts[0];
$sel = ($row['id'] == $conferences_id) ? 'selected="selected"' : '';
echo "<option value=\"{$row['id']}\" $sel>{$row['name']} ($date)</option>";
}
echo "</select></td></tr>\n";
?>
@ -180,93 +187,95 @@ case 'dialog_gen':
</script>
<?
exit;
}
}
if($show_options == false) {
if($id && $year) {
$report['year'] = $year;
if($show_options == false) {
if($id && $conferences_id) {
$report['conferences_id'] = $conferences_id;
if($type != '') $report['option']['type'] = $type;
if($stock != '') $report['option']['stock'] = $stock;
if($include_incomplete_registrations != '') $report['option']['include_incomplete_registrations'] = 'yes';
report_gen($report);
} else {
exit;
header("Location: reports.php");
header("Location: reports.php");
}
exit;
}
}
send_header('Report Options', array(
'Committee Main' => 'committee_main.php',
send_header('Report Options', array(
'Committee Main' => 'committee_main.php',
'My Reports' => 'admin/reports.php'));
echo '<form method=\"get\" action="reports_gen.php">';
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo '<form method=\"get\" action="reports_gen.php">';
echo "<input type=\"hidden\" name=\"id\" value=\"$id\">";
echo '<table class="tableedit">';
echo "<tr><td><b>".i18n('Report&nbsp;Name')."</b>:</td>";
echo "<td>{$report['name']}</td></tr>";
echo "<tr><td><b>".i18n('Description')."</b>:</td>";
echo "<td>{$report['desc']}</td></tr>";
echo "<tr><td><b>".i18n('Created By')."</b>:</td>";
echo "<td>{$report['creator']}</td></tr>";
echo '<table class="tableedit">';
echo "<tr><td><b>".i18n('Report&nbsp;Name')."</b>:</td>";
echo "<td>{$report['name']}</td></tr>";
echo "<tr><td><b>".i18n('Description')."</b>:</td>";
echo "<td>{$report['desc']}</td></tr>";
echo "<tr><td><b>".i18n('Created By')."</b>:</td>";
echo "<td>{$report['creator']}</td></tr>";
echo '<tr><td colspan="2"><hr /></td></tr>';
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['users_uid']}'
echo '<tr><td colspan="2"><hr /></td></tr>';
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['accounts_id']}'
AND reports_id='{$report['id']}'");
echo "<tr><td colspan=\"2\"><h3>".i18n('My Reports Info')."</h3></td></tr>";
if(mysql_num_rows($q) > 0) {
/* Yes, it is */
echo "<tr><td colspan=\"2\"><h3>".i18n('My Reports Info')."</h3></td></tr>";
if(mysql_num_rows($q) > 0) {
/* Yes, it is */
$i = mysql_fetch_object($q);
echo "<tr><td><b>".i18n('Category')."</b>:</td>";
echo "<td>{$i->category}</td></tr>";
echo "<tr><td><b>".i18n('Comment')."</b>:</td>";
echo "<td>{$i->comment}</td></tr>";
} else {
echo "<tr><td></td><td>".i18n('This report is NOT in your \'My Reports\' list.')."</td></tr>";
}
echo '<tr><td colspan="2"><hr /></td></tr>';
echo "<tr><td colspan=\"2\"><h3>".i18n('Report Options')."</h3></td></tr>";
} else {
echo "<tr><td></td><td>".i18n('This report is NOT in your \'My Reports\' list.')."</td></tr>";
}
echo '<tr><td colspan="2"><hr /></td></tr>';
echo "<tr><td colspan=\"2\"><h3>".i18n('Report Options')."</h3></td></tr>";
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$year = $config['FAIRYEAR'];
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$conferences_id = $conference['id'];
/* Out of all the report optoins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td><b>{$o['desc']}</b>:</td>";
/* Out of all the report optoins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td><b>{$o['desc']}</b>:</td>";
echo "<td><select name=\"$ok\" id=\"$ok\">";
foreach($o['values'] as $k=>$v) {
$sel = ($report['option'][$ok] == $k) ? 'selected="selected"' : '';
echo "<option value=\"$k\" $sel>$v</option>";
}
echo "</select></td></tr>";
}
/* Find all the years */
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
echo "<tr><td><b>".i18n('Year')."</b>:</td>";
echo "<td><select name=\"year\" id=\"year\">";
while($i = mysql_fetch_assoc($q)) {
$y = $i['year'];
$sel = ($config['FAIRYEAR'] == $y) ? 'selected="selected"' : '';
echo "<option value=\"$y\" $sel>$y</option>";
}
echo "</select></td></tr>";
}
echo "</table>";
// Find all conferences
$q = mysql_query("SELECT conferences.name, conferences.id, dates.date FROM conferences JOIN dates on dates.conferences_id = conferences.id WHERE dates.name='fairdate' ORDER BY dates.date DESC");
echo "<tr><td class=\"label\"><b>".i18n('Conference')."</b>:</td>";
echo "<td class=\"input\"><select name=\"conferences_id\" id=\"conferences_id\">";
while($row = mysql_fetch_assoc($q)){
$parts = explode(' ', $row['date']);
$date = $parts[0];
$sel = ($row['id'] == $conferences_id) ? 'selected="selected"' : '';
echo "<option value=\"{$row['id']}\" $sel>{$row['name']} ($date)</option>";
}
echo "</select></td></tr>\n";
echo '<br />';
echo "<input type=\"submit\" value=\"".i18n('Generate Report')."\" />";
echo '</form>';
echo "</table>";
echo '<br />';
echo "<input type=\"submit\" value=\"".i18n('Generate Report')."\" />";
echo '</form>';
send_footer();
send_footer();
?>

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
require("../questions.inc.php");
@ -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();
@ -70,7 +70,7 @@ $table['header']=array(
i18n("Expertise Other"));
/* Append headers for all the custom questions */
$qs=questions_load_questions('judgereg', $config['FAIRYEAR']);
$qs=questions_load_questions('judgereg', $conference['id']);
$keys = array_keys($qs);
foreach($keys as $qid) {
$table['header'][] = i18n($qs[$qid]['db_heading']);
@ -78,7 +78,7 @@ foreach($keys as $qid) {
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
$numcats=mysql_num_rows($q);
$catheadings=array();
while($r=mysql_fetch_object($q))
@ -87,7 +87,7 @@ while($r=mysql_fetch_object($q))
$catheadings[]="$r->category (out of 5)";
}
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id");
$divheadings=array();
while($r=mysql_fetch_object($q))
{
@ -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.year='".$config['FAIRYEAR']."'
AND users.types LIKE '%judge%'
users.conferences_id='".$conference['id']."'
ORDER BY
lastname,
firstname");
@ -145,7 +144,7 @@ while($r=mysql_fetch_object($q)) {
$languages=substr($languages,0,-1);
$qarray = array();
$qans = questions_load_answers('judgereg', $r->id, $config['FAIRYEAR']);
$qans = questions_load_answers('judgereg', $r->id, $conference['id']);
$keys = array_keys($qans);
foreach($keys as $qid) {
$qarray[] = $qans[$qid];

View File

@ -0,0 +1,185 @@
<?
/*
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 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");
user_auth_required('committee', 'admin');
require("../lpdf.php");
require("../lcsv.php");
require("../questions.inc.php");
if(!$_GET['type']) $type="csv";
else $type=$_GET['type'];
if($type=="pdf")
{
$rep=new lpdf( i18n($config['fairname']),
i18n("Judge List"),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
$rep->newPage();
$rep->setFontSize(11);
}
else if($type=="csv")
{
$rep=new lcsv(i18n("Judge List"));
}
$table=array();
$table['header']=array(
i18n("ID"),
i18n("Unique ID"),
i18n("Year"),
i18n("Last Name"),
i18n("First Name"),
i18n("Email"),
i18n("Phone Home"),
i18n("Phone Work"),
i18n("Phone Work Ext"),
i18n("Phone Cell"),
i18n("Languages"),
i18n("Organization"),
i18n("Address 1"),
i18n("Address 2"),
i18n("City"),
i18n($config['provincestate']),
i18n($config['postalzip']),
i18n("Highest PostSecDeg"),
i18n("Professional Quals"),
i18n("Expertise Other"));
/* Append headers for all the custom questions */
$qs=questions_load_questions('judgereg', $config['FAIRYEAR']);
$keys = array_keys($qs);
foreach($keys as $qid) {
$table['header'][] = i18n($qs[$qid]['db_heading']);
}
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$numcats=mysql_num_rows($q);
$catheadings=array();
while($r=mysql_fetch_object($q))
{
$cats[]=$r->id;
$catheadings[]="$r->category (out of 5)";
}
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
$divheadings=array();
while($r=mysql_fetch_object($q))
{
$divs[]=$r->id;
$divheadings[]="$r->division (out of 5)";
$divheadings[]="$r->division subdivisions";
}
//now append the arrays together
$table['header']=array_merge($table['header'],array_merge($catheadings,$divheadings));
//fill these in if we ever make this PDFable
$table['widths']=array();
$table['dataalign']=array();
$q=mysql_query("SELECT
users.*,
users_judge.*
FROM
users
JOIN users_judge ON users.id=users_judge.users_id
WHERE
users.deleted='no'
AND users.types LIKE '%judge%'
ORDER BY
lastname,
firstname,
year");
echo mysql_error();
while($r=mysql_fetch_object($q)) {
$u=user_load($r->id);
$expertise_other=str_replace("\n"," ",$r->expertise_other);
$expertise_other=str_replace("\r","",$expertise_other);
if(isset($divdata)) unset($divdata); $divdata=array();
if(isset($catdata)) unset($catdata); $catdata=array();
$languages="";
foreach($u['cat_prefs'] AS $c) {
$catdata[]=$c+2;
}
foreach($u['div_prefs'] AS $d) {
$divdata[]=$d;
//FIXME: 2010-01-22 - James - get the sub divisions for now we use a placeholder
$divdata[]="";
}
foreach($u['languages'] AS $k=>$v) {
$languages.="$v/";
}
$languages=substr($languages,0,-1);
$qarray = array();
$qans = questions_load_answers('judgereg', $r->id, $config['FAIRYEAR']);
$keys = array_keys($qans);
foreach($keys as $qid) {
$qarray[] = $qans[$qid];
}
$tmp=array(
$r->id,
$r->uid,
$r->year,
$r->lastname,
$r->firstname,
$r->email,
$r->phonehome,
$r->phonework,
$r->phoneworkext,
$r->phonecell,
$languages,
$r->organization,
$r->address,
$r->address2,
$r->city,
$r->province,
$r->postalcode,
$r->highest_psd,
$r->professional_quals,
$expertise_other
);
$tmp = array_merge($tmp, $qarray);
$extradata=array_merge($catdata,$divdata);
$table['data'][]=array_merge($tmp,$extradata);
}
$rep->addTable($table);
$rep->output();
?>

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
require("judges.inc.php");
@ -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();
@ -49,7 +49,7 @@
$teams=getJudgingTeams();
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
@ -91,7 +91,7 @@
$rep->addText(i18n("Criteria").": ".$award['criteria']);
//get category eligibility
$q=mysql_query("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE award_awards_projectcategories.projectcategories_id=projectcategories.id AND award_awards_projectcategories.award_awards_id='{$award['id']}' AND award_awards_projectcategories.year='{$config['FAIRYEAR']}' AND projectcategories.year='{$config['FAIRYEAR']}' ORDER BY category");
$q=mysql_query("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE award_awards_projectcategories.projectcategories_id=projectcategories.id AND award_awards_projectcategories.award_awards_id='{$award['id']}' AND award_awards_projectcategories.conferences_id='{$conference['id']}' AND projectcategories.conferences_id='{$conference['id']}' ORDER BY category");
echo mysql_error();
$cats="";
while($r=mysql_fetch_object($q))
@ -103,7 +103,7 @@
//get division eligibility
$q=mysql_query("SELECT projectdivisions.division_shortform FROM projectdivisions, award_awards_projectdivisions WHERE award_awards_projectdivisions.projectdivisions_id=projectdivisions.id AND award_awards_projectdivisions.award_awards_id='{$award['id']}' AND award_awards_projectdivisions.year='{$config['FAIRYEAR']}' AND projectdivisions.year='{$config['FAIRYEAR']}' ORDER BY division_shortform");
$q=mysql_query("SELECT projectdivisions.division_shortform FROM projectdivisions, award_awards_projectdivisions WHERE award_awards_projectdivisions.projectdivisions_id=projectdivisions.id AND award_awards_projectdivisions.award_awards_id='{$award['id']}' AND award_awards_projectdivisions.conferences_id='{$conference['id']}' AND projectdivisions.conferences_id='{$conference['id']}' ORDER BY division_shortform");
echo mysql_error();
$divs="";
while($r=mysql_fetch_object($q))
@ -156,7 +156,7 @@
judges_teams_timeslots_projects_link.judges_timeslots_id='$r->id' AND
judges_teams_timeslots_projects_link.judges_teams_id='".$team['id']."' AND
judges_teams_timeslots_projects_link.projects_id=projects.id AND
judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
projectnumber
");

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Mailing Label Generator",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
@ -49,9 +49,9 @@ if($report)
if($_GET['fontsize']) $fontsize=$_GET['fontsize'];
if($_GET['toppadding']) $toppadding=$_GET['toppadding'];
$rep=new lpdf( i18n($config['fairname']),
$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");
@ -77,7 +77,7 @@ if($report)
FROM
schools
WHERE
year='{$config['FAIRYEAR']}'
conferences_id='{$conference['id']}'
ORDER BY
school
");
@ -107,25 +107,26 @@ if($report)
break;
case "judges":
$q=mysql_query("SELECT
CONCAT(judges.firstname,' ',judges.lastname) AS name,
IF(judges.address2=\"\",
judges.address,
CONCAT(judges.address,' ',judges.address2)
) AS address,
'' AS co,
judges.city AS city,
judges.province AS province,
judges.postalcode AS postalcode
FROM
judges,
judges_years
WHERE
judges_years.judges_id=judges.id
AND judges_years.year='{$config['FAIRYEAR']}'
ORDER BY
lastname,firstname
");
$q = mysql_query("
SELECT
CONCAT(users.firstname, ' ', users.lastname) AS name,
IF(users.address2=\"\",
users.address,
CONCAT(users.address,' ',users.address2)
) AS address,
'' AS co,
users.city AS city,
users.province AS province,
users.postalcode AS postalcode
FROM users
JOIN user_roles ON users.id = user_roles.users_id
JOIN roles ON roles.id = user_roles.roles_id
WHERE
roles.type = 'judge'
AND users.conferences_id='{$conference['id']}'
ORDER BY
firstname, lastname
");
break;
}

View File

@ -25,7 +25,7 @@
require("../common.inc.php");
require_once("../user.inc.php");
require_once('reports.inc.php');
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Reports",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php')

View File

@ -1,7 +1,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
@ -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();
@ -34,8 +34,8 @@
award_awards,
award_types
WHERE
award_awards.year='".$config['FAIRYEAR']."'
AND award_types.year='".$config['FAIRYEAR']."'
award_awards.conferences_id='".$conference['id']."'
AND award_types.conferences_id='".$conference['id']."'
AND award_awards.award_types_id=award_types.id
AND award_awards.excludefromac='0'
AND (award_types.type='special' OR award_types.type='grand')
@ -50,7 +50,7 @@
$rep->heading(i18n($r->name));
//get teh age categories
$acq=mysql_query("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE projectcategories.year='".$config['FAIRYEAR']."' AND award_awards_projectcategories.year='".$config['FAIRYEAR']."' AND award_awards_projectcategories.award_awards_id='$r->id' AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id");
$acq=mysql_query("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE projectcategories.conferences_id='".$conference['id']."' AND award_awards_projectcategories.conferences_id='".$conference['id']."' AND award_awards_projectcategories.award_awards_id='$r->id' AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id");
echo mysql_error();
$cats="";
while($acr=mysql_fetch_object($acq))
@ -70,7 +70,7 @@
award_prizes
WHERE
award_awards_id='$r->id'
AND award_prizes.year='".$config['FAIRYEAR']."'
AND award_prizes.conferences_id='".$conference['id']."'
AND award_prizes.excludefromac='0'
ORDER BY
`order`");

View File

@ -24,19 +24,18 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
require("judges.inc.php");
$type=$_GET['type'];
if($type=="pdf")
{
if($type=="pdf") {
$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();
@ -47,6 +46,9 @@
$rep=new lcsv(i18n("Project Details"));
}
// $regstatus=" AND ( registrations.status='complete' OR registrations.status='paymentpending' ) ";
$regstatus="";
$projq=mysql_query("SELECT
registrations.id AS reg_id,
registrations.num AS reg_num,
@ -69,11 +71,10 @@
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
WHERE
projects.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."'
AND ( registrations.status='complete'
OR registrations.status='paymentpending' )
projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
$regstatus
ORDER BY
projects.projectnumber
");
@ -85,12 +86,12 @@
while($proj=mysql_fetch_object($projq))
{
$projectcount++;
$sq=mysql_query("SELECT students.firstname,
students.lastname
$sq=mysql_query("SELECT users.firstname,
users.lastname
FROM
students
users
WHERE
students.registrations_id='$proj->reg_id'
users.registrations_id='$proj->reg_id'
");
$students="";
@ -102,7 +103,6 @@
$studnum++;
}
$rep->heading(i18n("Project Information"));
$rep->nextline();
$table=array();
// $table['header']=array(i18n("Timeslot"),i18n("Judging Team"));
@ -121,28 +121,44 @@
unset($table);
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'");
$rep->nextline();
$rep->heading(i18n("Mentor Information"));
$rep->nextline();
if(mysql_num_rows($q))
{
while($r=mysql_fetch_object($q))
{
$rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization)));
$rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email)));
if(mysql_num_rows($q)) {
while($r=mysql_fetch_object($q))
{
$rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization)));
$rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email)));
}
}
}
else
{
else {
$rep->addText(i18n("No mentors"));
}
$rep->nextline();
$rep->heading(i18n("Project Summary"));
$rep->nextline();
$rep->addText($proj->summary);
$q=mysql_query("SELECT safetyquestions.question,
safety.answer
FROM safetyquestions
JOIN safety ON safetyquestions.id=safety.safetyquestions_id
WHERE safety.registrations_id='".$proj->reg_id."'
ORDER BY safetyquestions.ord");
$rep->nextline();
$rep->heading(i18n("Safety Questions"));
$table=array();
// $table['header']=array(i18n("Timeslot"),i18n("Judging Team"));
$table['widths']=array( 6.25, 0.5);
$table['dataalign']=array("left","left");
while($r=mysql_fetch_object($q)) {
$table['data'][]=array(i18n($r->question),$r->answer);
}
$rep->addTable($table);
unset($table);
if($projectcount!=$totalprojects)
$rep->newPage();
}

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
require("judges.inc.php");
@ -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();
@ -49,7 +49,7 @@
$teams=getJudgingTeams();
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE conferences_id='".$conference['id']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
@ -73,9 +73,9 @@
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
WHERE
projects.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."'
projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
AND ( registrations.status='complete'
OR registrations.status='paymentpending' )
ORDER BY
@ -128,7 +128,7 @@
LEFT JOIN judges_teams ON judges_teams_timeslots_projects_link.judges_teams_id=judges_teams.id
WHERE
judges_teams_timeslots_projects_link.projects_id='$proj->id'
AND judges_teams_timeslots_projects_link.year='".$config['FAIRYEAR']."'
AND judges_teams_timeslots_projects_link.conferences_id='".$conference['id']."'
ORDER BY
date,starttime
");

View File

@ -24,18 +24,16 @@
function reports_schools_principal(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['name'];
}
return '';
}
function reports_schools_sciencehead(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['name'];
}
return '';
@ -43,9 +41,8 @@ function reports_schools_sciencehead(&$report, $field, $text)
function reports_schools_shphone(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['phonework'];
}
return '';
@ -53,9 +50,8 @@ function reports_schools_shphone(&$report, $field, $text)
function reports_schools_shemail(&$report, $field, $text)
{
$year = $report['year'];
if($text > 0) { /* text is the uid */
$u = user_load_by_uid_year($text, $year);
$u = user_load($text);
return $u['email'];
}
return '';
@ -63,141 +59,159 @@ function reports_schools_shemail(&$report, $field, $text)
$report_schools_fields = array(
'school' => array(
'start_option_group' => 'School Information',
'name' => 'School -- Name',
'header' => 'School Name',
'width' => 2.25,
'width' => 57.15 /*mm*/,
'table' => 'schools.school' ),
'schooladdr' => array(
'name' => 'School -- Full Address',
'header' => 'School Address',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => "CONCAT(schools.address, ', ', schools.city, ', ', schools.province_code, ', ', schools.postalcode)" ),
'school_phone' => array(
'name' => 'School -- Phone',
'header' => 'School Phone',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'schools.phone' ),
'school_fax' => array(
'name' => 'School -- Fax',
'header' => 'School Fax',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'schools.fax' ),
'school_email' => array(
'name' => 'School -- Email',
'header' => 'School Email',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'schools.schoolemail' ),
'school_address' => array(
'name' => 'School Address -- Street Address',
'header' => 'Address',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'schools.address'),
'school_city' => array(
'name' => 'School Address -- City',
'header' => 'City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'schools.city' ),
'school_province' => array(
'name' => 'School Address -- '.$config['provincestate'],
'header' => $config['provincestate'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'schools.province_code' ),
'school_city_prov' => array(
'name' => 'School Address -- City, '.$config['provincestate'].' (for mailing)',
'header' => 'City',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => "CONCAT(schools.city, ', ', schools.province_code)" ),
'school_postal' => array(
'name' => 'School Address -- '.$config['postalzip'],
'header' => $config['postalzip'],
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'schools.postalcode' ),
'school_lang' => array(
'name' => 'School -- Language Code',
'header' => 'Lang',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'schools.schoollang' ),
'school_level' => array(
'name' => 'School -- Grade Levels',
'header' => 'Level',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'schools.schoollevel' ),
'school_board' => array(
'name' => 'School -- Board',
'header' => 'Board',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'schools.board' ),
'school_district' => array(
'name' => 'School -- District',
'header' => 'District',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'schools.district' ),
'school_principal' => array(
'name' => 'School -- Principal',
'header' => 'Principal',
'width' => 1.25,
'width' => 31.75 /*mm*/,
'table' => 'schools.principal_uid',
'exec_function' => 'reports_schools_principal'),
'school_sh' => array(
'name' => 'School -- Science Head',
'header' => 'Science Head',
'width' => 1.25,
'width' => 31.75 /*mm*/,
'table' => 'schools.sciencehead_uid',
'exec_function' => 'reports_schools_sciencehead'),
'school_shphone' => array(
'name' => 'School -- Science Head Phone',
'header' => 'Science Hd Phone',
'width' => 1,
'width' => 25.4 /*mm*/,
'table' => 'schools.sciencehead_uid',
'exec_function' => 'reports_schools_shphone'),
'school_shemail' => array(
'name' => 'School -- Science Head Email',
'header' => 'Science Head Email',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'schools.sciencehead_uid',
'exec_function' => 'reports_schools_shemail'),
'school_accesscode' => array(
'start_option_group' => 'Access Codes',
'name' => 'School -- Access Code',
'header' => 'Access Code',
'width' => 1.1,
'width' => 27.94 /*mm*/,
'table' => 'schools.accesscode' ),
'school_registration_password' => array(
'name' => 'School -- Registration Password',
'header' => 'Reg Pass',
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'schools.registration_password' ),
'school_project_limit' => array(
'start_option_group' => 'Project Limits',
'name' => 'School -- Project Limit',
'header' => 'Limit',
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'schools.projectlimit' ),
'school_project_limit_per' => array(
'name' => 'School -- Project Limit Per',
'header' => 'Limit Per',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'schools.projectlimitper' ),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
);
function report_schools_fromwhere($report, $components)
@ -205,12 +219,12 @@ $report_schools_fields = array(
global $config, $report_schools_fields;
$fields = $report_schools_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = " FROM
schools
WHERE
schools.year='$year'
schools.conferences_id='$conferences_id'
";
return $q;

File diff suppressed because it is too large Load Diff

View File

@ -23,59 +23,75 @@
$report_tours_fields = array(
'tour_name' => array(
'start_option_group' => 'Tour Information',
'name' => 'Tour -- Name',
'header' => 'Tour Name',
'width' => 3,
'width' => 76.2 /*mm*/,
'table' => 'tours.name' ),
'tour_num' => array(
'name' => 'Tour -- Number',
'header' => 'Num',
'width' => 0.75,
'width' => 19.05 /*mm*/,
'table' => 'tours.num' ),
'tour_desc' => array(
'name' => 'Tour -- Description',
'header' => 'Tour Description',
'width' => 3.0,
'width' => 76.2 /*mm*/,
'table' => 'tours.description'),
'tour_capacity' => array(
'name' => 'Tour -- Capacity',
'header' => 'Cap',
'width' => 0.4,
'width' => 10.16 /*mm*/,
'table' => 'tours.capacity' ),
'tour_mingrade' => array(
'name' => 'Tour -- Minimum Grade',
'header' => 'Min Gr.',
'width' => 0.4,
'width' => 10.16 /*mm*/,
'table' => 'tours.grade_min' ),
'tour_maxgrade' => array(
'name' => 'Tour -- Maximum Grade',
'header' => 'Max Gr.',
'width' => 0.4,
'width' => 10.16 /*mm*/,
'table' => 'tours.grade_max' ),
'tour_location' => array(
'name' => 'Tour -- Location',
'header' => 'Tour Location',
'width' => 2.0,
'width' => 50.8 /*mm*/,
'table' => 'tours.location'),
'tour_contact' => array(
'name' => 'Tour -- Contact',
'header' => 'Contact',
'width' => 1.5,
'width' => 38.1 /*mm*/,
'table' => 'tours.contact' ),
'tour_id' => array(
'name' => 'Tour -- Database ID',
'header' => '#',
'width' => 0.4,
'width' => 10.16 /*mm*/,
'table' => 'tours.id' ),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_real_escape_string($conference['name'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
);
function report_tours_fromwhere($report, $components)
@ -83,12 +99,12 @@ $report_tours_fields = array(
global $config, $report_tours_fields;
$fields = $report_tours_fields;
$year = $report['year'];
$conferences_id = $report['conferences_id'];
$q = " FROM
tours
WHERE
tours.year='$year'
tours.conferences_id='$conferences_id'
";
return $q;

View File

@ -24,114 +24,114 @@
$report_volunteers_fields = array(
'last_name' => array(
'start_option_group' => 'Volunteer Name Information',
'name' => 'Volunteer -- Last Name',
'header' => 'Last Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.lastname' ),
'first_name' => array(
'name' => 'Volunteer -- First Name',
'header' => 'First Name',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.firstname' ),
'name' => array(
'name' => 'Volunteer -- Full Name (last, first)',
'header' => 'Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(users.lastname, ', ', users.firstname)",
'table_sort'=> 'users.lastname' ),
'namefl' => array(
'name' => 'Volunteer -- Full Name (first last)',
'header' => 'Name',
'width' => 1.75,
'width' => 44.45 /*mm*/,
'table' => "CONCAT(users.firstname, ' ', users.lastname)",
'table_sort'=> 'users.lastname' ),
'email' => array(
'start_option_group' => 'Volunteer Contact Information',
'name' => 'Volunteer -- Email',
'header' => 'Email',
'width' => 1.75,
'table' => 'users.email'),
'width' => 44.45 /*mm*/,
'table' => 'accounts.email'),
'phone' => array(
'name' => 'Volunteer -- Phone',
'header' => 'Phone',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.phonehome'),
'cell' => array(
'name' => 'Volunteer -- Cell',
'header' => 'Cell',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.phonecell'),
'organization' => array(
'name' => 'Volunteer -- Phone',
'header' => 'Organziation',
'width' => 1.0,
'width' => 25.4 /*mm*/,
'table' => 'users.organization'),
'firstaid' => array(
'start_option_group' => 'Volunteer Miscellaneous',
'name' => 'Volunteer -- First Aid Training',
'header' => 'F.Aid',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'users.firstaid',
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
'cpr' => array(
'name' => 'Volunteer -- CPR Training',
'header' => 'CPR',
'width' => 0.5,
'width' => 12.7 /*mm*/,
'table' => 'users.cpr',
'value_map' =>array ('no' => 'no', 'yes' => 'YES')),
'complete' => array(
'name' => 'Volunteer -- Registration Complete',
'header' => 'Cmpl',
'width' => 0.4,
'table' => 'users_volunteer.volunteer_complete',
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
'components' => array('users_volunteer')),
'width' => 10.16 /*mm*/,
'table' => 'user_roles.complete',
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
'position_name' => array (
'name' => 'Volunteer Position -- Name',
'header' => 'Position',
'width' => 3,
'width' => 76.2 /*mm*/,
'table' => 'volunteer_positions.name',
'components' => array('signup')),
'fair_year' => array (
'name' => 'Fair -- Year',
'header' => 'Year',
'width' => 0.5,
'table' => "{$config['FAIRYEAR']}"),
/* The label system depends on each report type having conference_name and conference_logo */
'conference_name' => array(
'start_option_group' => 'Conference Information',
'name' => 'Conference -- Name',
'header' => 'Conference Name',
'width' => 76.2 /*mm*/,
'table' => "'".mysql_real_escape_string($conference['name'])."'"),
'fair_name' => array (
'name' => 'Fair -- Name',
'header' => 'Fair Name',
'width' => 3,
'table' => "'".mysql_escape_string($config['fairname'])."'"),
'conference_logo' => array(
'name' => 'Conference -- Logo (for Labels only)',
'header' => '',
'width' => 1 /*mm*/,
'table' => "CONCAT(' ')"),
'static_text' => array (
'start_option_group' => 'Special Fields',
'name' => 'Static Text (useful for labels)',
'header' => '',
'width' => 0.1,
'width' => 2.54 /*mm*/,
'table' => "CONCAT(' ')"),
);
function report_volunteers_fromwhere($report, $components)
{
global $config, $report_volutneers_fields;
global $config;
$fields = $report_volutneers_fields;
$year = $report['year'];
if(in_array('users_volunteer', $components)) {
$uv_from = 'LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id';
}
$conferences_id = $report['conferences_id'];
$signup_join = '';
$signup_where = '';
@ -141,16 +141,17 @@ $report_volunteers_fields = array(
ON (users.id=volunteer_positions_signup.users_id)
LEFT JOIN volunteer_positions
ON (volunteer_positions_signup.volunteer_positions_id=volunteer_positions.id)";
$signup_where = "AND (volunteer_positions_signup.year = '$year' OR volunteer_positions_signup.year IS NULL)";
$signup_where = "AND (volunteer_positions_signup.conferences_id = '$conferences_id' OR volunteer_positions_signup.conferences_id IS NULL)";
}
$q = " FROM
users
$q = " FROM users
LEFT JOIN user_roles on user_roles.users_id=users.id
LEFT JOIN accounts ON accounts.id=users.accounts_id
$signup_join
$uv_from
WHERE
users.types LIKE '%volunteer%'
AND users.year='$year'
WHEE
user_roles.type='volunteer'
AND users.conferences_id='$conferences_id'
$signup_where
";

429
admin/schedule.php Normal file
View File

@ -0,0 +1,429 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2010 Youth Science Ontario <info@scitechontario.org>
Copyright (C) 2010 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("../schedule.inc.php");
user_auth_required('admin');
if($_GET['action']=="loadschedule") {
$date=$_POST['date'];
$starthour=$_POST['starthour'];
$endhour=$_POST['endhour'];
//do some sanity checks
if($starthour<0 || $starthour>24) $starthour=8;
if($endhour<$starthour)
$endhour=$starthour+10;
if($endhour<0 || $endhour>24) $endhour=15;
//minute increment
$increment=15;
if(!eregi("[0-9]{4}-[0-9]{2}-[0-9]{2}",$date)) {
echo "Invalid date";
exit;
}
echo "<h3>".i18n("Schedule for %1",array(format_date($date)))."</h3>";
$q=mysql_query("SELECT * FROM locations WHERE conferences_id='{$conference['id']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
$locations[$r->id]=$r->name;
}
if(!count($locations)) {
echo error(i18n("There are no locations defined. Please set up your locations first"));
echo "<a href=\"locations.php\">".i18n("Location Editor")."</a>\n";
exit;
}
echo "<table class=\"schedule\" id=\"schedule\">\n";
echo "<tr>";
echo "<th style=\"width: 50px;\">&nbsp;</th>";
foreach($locations AS $id=>$name) {
echo " <th>$name</th>\n";
}
for($h=$starthour;$h<$endhour;$h++) {
for($m=0;$m<60;$m+=$increment) {
echo "<tr>";
echo " <td class=\"scheduletime\">";
if($m==0) {
echo format_time("$h:$m");
}
echo "</td>";
foreach($locations AS $id=>$name) {
echo "<td id=\"{$h}_{$m}_{$id}\" onclick=\"clickTableCell(this)\"><div>";
echo "</div></td>";
}
echo "</tr>";
}
}
echo "</table>\n";
$js="var eventdivs=new Array();\n";
//now make all our DIV's for the events that are scheduled in the database
$x=0;
//they will be moved by javascript after the fact
$q=mysql_query("SELECT schedule.*, events.name, events.eventtype FROM schedule JOIN events ON schedule.events_id=events.id WHERE schedule.conferences_id='{$conference['id']}' AND date='{$date}'");
echo mysql_error();
while($r=mysql_fetch_object($q)) {
echo "<div class=\"scheduleevent scheduleevent_{$r->eventtype}\" id=\"event_{$r->id}\" onclick=\"editEvent($r->id)\">";
echo "<div style=\"width: 99%; text-align: right;\"><a href=\"#\" onclick=\"return deleteEvent(event,$r->id)\"><img style=\"border: 0px;\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.{$config['icon_extension']}\"></a></div>\n";
echo "<span class=\"scheduleevent_title\">";
echo $r->title;
echo "</span>";
echo "<br />";
$starttime=strtotime($r->hour.":".$r->minute);
$endtime=$starttime+$r->duration*60;
echo format_time($starttime);
echo " to ";
echo format_time($endtime);
echo "<br />";
if($r->eventtype=="scienceolympic") {
$regteams=getNumRegistrations($r->id);
$minteams=$r->sominteams;
$maxteams=$r->somaxteams;
if($regteams<$minteams || $regteams >$maxteams)
$cl="class=\"error\"";
else $cl="";
echo "<span $cl>";
echo i18n("Teams")." : ";
echo i18n("%1 of %2-%3",array($regteams,$minteams,$maxteams));
echo "</span>";
echo "<br />";
$regjudges=getNumJudges($r->id);
$minjudges=$r->sominjudges;
$maxjudges=$r->somaxjudges;
if($regjudges<$minjudges || $regjudges >$maxjudges)
$cl="class=\"error\"";
else $cl="";
echo "<span $cl>";
echo i18n("Judges")." : ";
echo i18n("%1 of %2-%3",array($regjudges,$minjudges,$maxjudges));
echo "</span>";
echo "<br />";
$regvolunteers=getNumVolunteers($r->id);
$minvolunteers=$r->sominvolunteers;
$maxvolunteers=$r->somaxvolunteers;
if($regvolunteers<$minvolunteers || $regvolunteers>$maxvolunteers)
$cl="class=\"error\"";
else $cl="";
echo "<span $cl>";
echo i18n("Volunteers")." : ";
echo i18n("%1 of %2-%3",array($regvolunteers,$minvolunteers,$maxvolunteers));
echo "</span>";
}
echo "</div>";
$js.="eventdivs[$r->id]={hour:$r->hour,minute:$r->minute,location:$r->locations_id,duration:$r->duration};\n";
$x++;
}
$js.="\n\nvar eventdefaults=new Array();\n";
$q=mysql_query("SELECT events.* FROM events WHERE conferences_id='{$conference['id']}'");
while($r=mysql_fetch_array($q)) {
$js.="eventdefaults[{$r['id']}]=".json_encode($r)."\n";
}
echo "<script type=\"text/javascript\">\n";
echo $js;
echo "</script>";
}
else if($_GET['action']=="loadevent") {
$id=intval($_GET['id']);
$q=mysql_query("SELECT schedule.*, events.name, events.eventtype FROM schedule, events WHERE schedule.id='$id' AND schedule.conferences_id='{$conference['id']}' AND schedule.events_id=events.id");
echo mysql_error();
if($r=mysql_fetch_assoc($q)) {
$r['idtype']=$r['events_id'].":".$r['eventtype'];
$teams=array();
$teamq=mysql_query("SELECT so_teams.id,
so_teams.name AS teamname,
schools.school AS schoolname
FROM
so_teams
JOIN schedule_registrations ON so_teams.id=schedule_registrations.so_teams_id
JOIN schools ON so_teams.schools_id=schools.id
WHERE
schedule_registrations.conferences_id='{$conference['id']}'
AND so_teams.conferences_id='{$conference['id']}'
AND schedule_registrations.schedule_id='$id'");
echo mysql_error();
while($teamr=mysql_fetch_assoc($teamq)) {
$teams[]=$teamr;
}
$r['teams']=$teams;
echo json_encode($r);
}
else
echo json_encode(array("id"=>0));
exit;
}
else if($_GET['action']=="saveevent") {
$id=intval($_POST['id']);
list($event_id,$event_type)=explode(":",$_POST['event_id']);
if($event_id>0) {
if(!$id) {
mysql_query("INSERT INTO schedule (conferences_id) VALUES ('{$conference['id']}')");
$id=mysql_insert_id();
}
mysql_query("UPDATE schedule SET
title='".mysql_real_escape_string($_POST['title'])."',
date='".mysql_real_escape_string($_POST['date'])."',
hour='".mysql_real_escape_string($_POST['hour'])."',
minute='".mysql_real_escape_string($_POST['minute'])."',
duration='".mysql_real_escape_string($_POST['duration'])."',
events_id='$event_id',
locations_id='".mysql_real_escape_string($_POST['location_id'])."',
sominteams='".mysql_real_escape_string($_POST['sominteams'])."',
somaxteams='".mysql_real_escape_string($_POST['somaxteams'])."',
sominjudges='".mysql_real_escape_string($_POST['sominjudges'])."',
somaxjudges='".mysql_real_escape_string($_POST['somaxjudges'])."',
sominvolunteers='".mysql_real_escape_string($_POST['sominvolunteers'])."',
somaxvolunteers='".mysql_real_escape_string($_POST['somaxvolunteers'])."',
sominteamsize='".mysql_real_escape_string($_POST['sominteamsize'])."',
somaxteamsize='".mysql_real_escape_string($_POST['somaxteamsize'])."'
WHERE id='$id' AND conferences_id='{$conference['id']}'");
echo mysql_error();
happy_("Event successfully saved");
} else {
error_("Error saving event - You must select an event");
}
exit;
}
else if($_GET['action']=="deleteevent") {
$id=intval($_POST['id']);
$q=mysql_query("SELECT * FROM schedule_registrations WHERE schedule_id='{$id}' AND conferences_id='{$conference['id']}'");
if(mysql_num_rows($q)) {
error_("Cannot remove an event that has teams registered for it. Remove the teams first");
}
else {
mysql_query("DELETE FROM schedule WHERE conferences_id='{$conference['id']}' AND id='{$id}'");
happy_("Event successfully removed from the schedule");
}
exit;
}
else {
send_header("Schedule Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Events & Scheduling' => 'admin/eventsscheduling.php'),
"events_scheduling" );
echo "<br />";
?>
<script type="text/javascript">
$(document).ready(function() {
$(".date").datepicker({ dateFormat: 'yy-mm-dd' });
changeDate();
/* Setup the editor dialog */
$("#event_editor_dialog").dialog({
bgiframe: true, autoOpen: false,
modal: true, resizable: false,
draggable: false,
buttons: {
"<?=i18n('Cancel')?>": function() {
$(this).dialog("close");
},
"<?=i18n('Save')?>": function() {
saveEvent();
$(this).dialog("close");
}
}
});
$(window).resize(function() {
placeEvents();
}
);
});
function changeDate() {
$("#schedulediv").load("schedule.php?action=loadschedule",{date:$("#date").val(),starthour:$("#starthour").val(),endhour:$("#endhour").val()},function() {
placeEvents();
});
}
function clickTableCell(t) {
var p=$("#"+t.id).offset();
editEvent(null,t.id);
}
function placeEvents() {
$('.scheduleevent').each(function(idx,item) {
var eventid=item.id.substr(6);
var eventobj=eventdivs[eventid];
var tablecellid=eventobj.hour+'_'+eventobj.minute+'_'+eventobj.location;
if($("#"+tablecellid).length) {
var eheight=((eventobj.duration/15)*<?=$ROWHEIGHT?>)-<? echo $BORDERSIZE*2; ?>;
var ewidth=$("#"+tablecellid).width()-<? echo $BORDERSIZE*2; ?>;
var p=$("#"+tablecellid).offset();
$("#"+item.id).css(p);
$("#"+item.id).show();
$("#"+item.id).height(eheight);
$("#"+item.id).width(ewidth);
}
else {
$("#"+item.id).hide();
}
}
);
}
function editEvent(id,cell) {
if(id) {
var eventobj=eventdivs[id];
$("#event_editor_dialog").dialog('option','title','Edit Event');
$.getJSON("schedule.php?action=loadevent&id="+id,function(json) {
$("#edit_event").val(json.idtype);
event_change();
//general tab
$("#edit_schedule_id").val(json.id);
$("#edit_title").val(json.title);
$("#edit_date").val(json.date);
$("#edit_hour").val(json.hour);
$("#edit_minute").val(json.minute);
$("#edit_duration").val(json.duration);
$("#edit_location").val(json.locations_id);
//we do this here to set the tabs properly, becuase it also sets the defaults, then we'll override the defaults wth
//teh real values below
if(json.eventtype=="scienceolympic") {
//science olympics tab
$("#edit_sominteams").val(json.sominteams);
$("#edit_somaxteams").val(json.somaxteams);
$("#edit_sominjudges").val(json.sominjudges);
$("#edit_somaxjudges").val(json.somaxjudges);
$("#edit_sominvolunteers").val(json.sominvolunteers);
$("#edit_somaxvolunteers").val(json.somaxvolunteers);
$("#edit_sominteamsize").val(json.sominteamsize);
$("#edit_somaxteamsize").val(json.somaxteamsize);
var s='<table class="summarytable"><tr><th><?=i18n("Team Name")?></th><th><?=i18n("School Name")?></th></tr>';
for(var i=0;i<json.teams.length;i++) {
var t=json.teams[i];
s+='<tr><td>'+t.teamname+'</td><td>'+t.schoolname+'</td></tr>';
}
s+='</table>';
$("#event_editor_tab_scienceolympics_registeredteams").html(s);
}
$("#schedule_tabs").tabs('select',0);
});
}
else {
$("#event_editor_dialog").dialog('option','title','Create Event');
var a=cell.split("_");
$("#edit_event").val("");
event_change();
$("#edit_schedule_id").val(0);
$("#edit_title").val("");
$("#edit_date").val($("#date").val());
$("#edit_hour").val(a[0]);
$("#edit_minute").val(a[1]);
$("#edit_duration").val(60);
$("#edit_location").val(a[2]);
//science olympics tab
$("#edit_somaxteams").val("");
$("#edit_sominteams").val("");
$("#edit_somaxjudges").val("");
$("#edit_sominjudges").val("");
$("#edit_somaxvolunteers").val("");
$("#edit_sominvolunteers").val("");
$("#edit_sominteamsize").val("");
$("#edit_somaxteamsize").val("");
$("#schedule_tabs").tabs('select',0);
$("#event_editor_tab_scienceolympics_registeredteams").html("");
}
$("#event_editor_dialog").dialog('option','width',600);
$("#event_editor_dialog").dialog('option','height',400);
$("#event_editor_dialog").dialog('open');
}
function saveEvent() {
var o=$("#edit_event_form").serializeArray();
//alert(o);
$("#debug").load("schedule.php?action=saveevent",o,function() {
changeDate();
});
}
function deleteEvent(event,id) {
event.stopPropagation();
if(confirmClick('Are you sure you want to remove this event from the schedule?')) {
$("#debug").load('schedule.php?action=deleteevent',{id:id},function() {
changeDate();
});
}
return false;
}
</script>
<?
if(!$editdate) {
list($editdate,$bla)=explode(" ",$config['dates']['fairdate']);
}
?>
<form method="post">
<? echo i18n("Schedule date"); ?>
<input id="date" class="date" type="text" name="date" value="<?=$editdate?>" size="15" onchange="changeDate()">
<? echo i18n("Start hour")." ";
emit_hour_selector("starthour",8,"id=\"starthour\" onchange=\"changeDate()\"");
echo i18n("End hour")." ";
emit_hour_selector("endhour",15,"id=\"endhour\" onchange=\"changeDate()\"");
?>
</form>
<hr />
<div id="schedulediv">
</div>
<div id="event_editor_dialog">
<? include "schedule_edit_dialog.php"; ?>
</div>
<?
send_footer();
}
?>

View File

@ -0,0 +1,209 @@
<script type="text/javascript">
$(document).ready(function() {
$("#schedule_tabs").tabs({
show: function(event, ui) {
switch(ui.panel.id) {
case 'schedule_tab_general':
update_tab_general();
break;
case 'schedule_tab_scienceolympics':
update_tab_scienceolympics();
break;
}
},
selected: 0
});
event_change();
});
function update_tab_general() {
}
function update_tab_scienceolympics() {
}
function event_change() {
var ea=$("#edit_event").val().split(":");
//if its not set, we must be on "choose" still, so disable the other tabs until they choose something
//then get the heck out of here
if(!ea[1]) {
$("#schedule_tabs").tabs("option","disabled",[1,2,3]);
return;
}
//ea[1] is the type
switch(ea[1]) {
case "":
case "general":
$("#schedule_tabs").tabs("option","disabled",[1,2,3]);
break;
case "scienceolympic":
$("#schedule_tabs").tabs("option","disabled",[2,3]);
break;
case "sciencefairjudging":
$("#schedule_tabs").tabs("option","disabled",[1,3]);
break;
case "tour":
$("#schedule_tabs").tabs("option","disabled",[1,2]);
break;
default:
return;
}
/*
if($("#edit_title").val().length) {
//umm if it already exists, dont change it
//no, screw it, change it anyways
}
else
{
*/
if($("#edit_event").val())
$("#edit_title").val($("#edit_event option:selected").text());
//}
var ed=eventdefaults[ea[0]];
$("#edit_sominteams").val(ed.default_min_teams);
$("#edit_somaxteams").val(ed.default_max_teams);
$("#edit_sominjudges").val(ed.default_min_judges);
$("#edit_somaxjudges").val(ed.default_max_judges);
$("#edit_sominvolunteers").val(ed.default_min_volunteers);
$("#edit_somaxvolunteers").val(ed.default_max_volunteers);
$("#edit_somaxteamsize").val(ed.default_max_team_size);
$("#edit_sominteamsize").val(ed.default_min_team_size);
}
</script>
<div id="schedule_tabs">
<ul>
<li><a href="#schedule_tab_general"><span><?=i18n('General')?></span></a></li>
<li><a href="#schedule_tab_scienceolympics"><span><?=i18n('Science Olympics')?></span></a></li>
<li><a href="#schedule_tab_sciencefairjudging"><span><?=i18n('Science Fair Judging')?></span></a></li>
<li><a href="#schedule_tab_tour"><span><?=i18n('Tour')?></span></a></li>
</ul>
<form method="post" id="edit_event_form">
<div id="schedule_tab_general">
<?
echo "<input type=\"hidden\" name=\"id\" id=\"edit_schedule_id\">";
echo "<table style=\"width: 95%;\">";
echo "<tr><td>";
echo i18n("Event").": ";
echo "</td><td>";
echo "<select name=\"event_id\" id=\"edit_event\" onchange=\"event_change()\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
$q=mysql_query("SELECT * FROM events WHERE conferences_id='{$conference['id']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->id:$r->eventtype\">$r->name</option>\n";
}
echo "</select>\n";
echo "</td><td>";
echo i18n("Location").": ";
echo "</td><td>";
echo "<select name=\"location_id\" id=\"edit_location\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
$q=mysql_query("SELECT * FROM locations WHERE conferences_id='{$conference['id']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->id\">$r->name</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td>";
echo i18n("Title").": ";
echo "</td><td>";
echo "<input id=\"edit_title\" type=\"text\" name=\"title\" size=\"20\">";
echo "</td><td>";
echo i18n("Date").": ";
echo "</td><td>";
echo "<input id=\"edit_date\" type=\"text\" name=\"date\" class=\"date\" size=\"12\">";
echo "</td><td>";
echo "</td><td>";
echo "</td></tr>\n";
echo "<tr><td>";
echo i18n("Start at").": ";
echo "</td><td>";
emit_hour_selector('hour',"","id=\"edit_hour\"");
echo ":";
emit_minute_selector('minute',"","id=\"edit_minute\"",15);
echo "</td><td>";
echo i18n("Duration").": ";
echo "</td><td>";
echo "<input id=\"edit_duration\" type=\"text\" name=\"duration\" size=\"4\">";
echo "minutes";
echo "</td></tr>\n";
echo "</table>";
?>
</div>
<div id="schedule_tab_scienceolympics">
<table>
<tr>
<th></th>
<th><?=i18n("Minimum")?></th>
<th><?=i18n("Maximum")?></th>
</tr>
<tr>
<td><?=i18n("Number of Teams")?></td>
<td><input type="text" name="sominteams" id="edit_sominteams" size="4"></td>
<td><input type="text" name="somaxteams" id="edit_somaxteams" size="4"></td>
</tr>
<tr>
<td><?=i18n("Team Member Size")?></td>
<td><input type="text" name="sominteamsize" id="edit_sominteamsize" size="4"></td>
<td><input type="text" name="somaxteamsize" id="edit_somaxteamsize" size="4"></td>
</tr>
<tr>
<td><?=i18n("Number of Judges")?></td>
<td><input type="text" name="sominjudges" id="edit_sominjudges" size="4"></td>
<td><input type="text" name="somaxjudges" id="edit_somaxjudges" size="4"></td>
</tr>
<tr>
<td><?=i18n("Number of Volunteers")?></td>
<td><input type="text" name="sominvolunteers" id="edit_sominvolunteers" size="4"></td>
<td><input type="text" name="somaxvolunteers" id="edit_somaxvolunteers" size="4"></td>
</tr>
</table>
<?
echo "<h4>".i18n("Judges")."</h4>";
echo "<table style=\"width: 95%;\">";
echo "<tr>";
echo "<td>";
echo "</td><td>";
echo "FIXME: show list of registered judges to choose from";
echo "</td></tr>";
echo "</table>";
echo "<h4>".i18n("Registered Teams")."</h4>";
echo "<div id=\"event_editor_tab_scienceolympics_registeredteams\"></div>";
echo "</div>\n";
?>
</div>
<div id="schedule_tab_sciencefairjudging">
</div>
<div id="schedule_tab_tour">
</div>
</form>
</div>

View File

@ -24,14 +24,140 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
function output_user_summary($userid) {
$user = user_load($userid);
$account = account_load($user['accounts_id']);
if(!$user || !$account) {
echo "Invalid User ID ($userid)";
return;
}
echo i18n("Account").": ";
if($account['username']==$account['email']) {
echo $account['username'];
} else {
echo $account['username'];
if($account['email']) echo " / ".$account['email'];
}
echo "<br />";
echo i18n("Name").": ";
echo $user['firstname']." ".$user['lastname']."<br />";
if($user['phonework'] || $user['phonehome'] || $user['phonecell']) {
echo i18n("Phone").": ";
if($user['phonework']) echo "(W)".$user['phonework']." ";
if($user['phonehome']) echo "(H)".$user['phonehome']." ";
if($user['phonecell']) echo "(C)".$user['phonecell']." ";
echo "<br />";
}
}
if($_POST['save']=="edit" || $_POST['save']=="add")
{
if($_POST['save']=="add")
{
$q=mysql_query("INSERT INTO schools (year) VALUES ('".$config['FAIRYEAR']."')");
if($_POST['action']=="removeuser") {
$schoolid=intval($_POST['schoolid']);
if($_POST['role']=="principal") {
$f="principal_uid";
} else if($_POST['role']=="teacher") {
$f="sciencehead_uid";
}
if($f) {
mysql_query("UPDATE schools SET $f=NULL WHERE id='$schoolid'");
}
echo "ok";
exit;
}
else if($_POST['action']=="adduser") {
/* we have the following to work with:
accounts_id, conferenceid, field, role, username, users_id
*/
//if accounts_id is 0, it means its a new user
$accounts_id=intval($_POST['accounts_id']);
$conferenceid=intval($_POST['conferenceid']);
$schoolid=intval($_POST['schoolid']);
if($accounts_id==0) {
$a=account_create($_POST['username']);
if(isEmailAddress($_POST['username']))
account_set_email($a['id'],$_POST['username']);
//and load it again, just so we have the most up-to-date
$a=account_load($a['id']);
}
else
$a=account_load($accounts_id);
//now lets add the role -- this fails gracefully if they already have the role, or if its added, in both cases it returns 'ok'
$ret=account_add_role($a['id'],$_POST['role'],$conferenceid);
//we still need the user id
$u=user_load_by_accounts_id($a['id']);
if($ret=='ok' && $u['id']) {
mysql_query("UPDATE schools SET `".mysql_real_escape_string($_POST['field'])."`='{$u['id']}' WHERE id='$schoolid'");
echo mysql_error();
//and update the users schools_id, yes, maybe we should use the user object and user_save() but the single query here is easier and probably waaaaaay faster
mysql_query("UPDATE users SET schools_id='$schoolid' WHERE id='{$u['id']}'");
echo mysql_error();
echo "ok";
}
else {
echo "error\n";
echo "ret=$ret\n";
echo "u="; print_r($u);
//error ?
}
exit;
}
if($_GET['action']=='loaduser') {
$schoolid=intval($_GET['schoolid']);
$role=$_GET['role'];
if($role=="principal") {
$f="principal_uid";
} else if($role=="teacher") {
$f="sciencehead_uid";
}
$q=mysql_query("SELECT $f AS userid FROM schools WHERE id='$schoolid'");
$r=mysql_fetch_object($q);
if($r->userid > 0) {
//we already have one, so just display teh details, with the option to remove or edit
echo "<td align=\"right\">";
echo "<a onclick=\"return openeditor($r->userid); return false;\" href=\"#\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
echo "&nbsp;";
echo "<a onclick=\"return removeUserFromSchool('$role',$schoolid)\"
href=\"#\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "</td><td>";
output_user_summary($r->userid);
echo "</td>";
echo "</tr>";
}
else {
echo "<td align=\"right\">".i18n("Email/username")." </td>";
echo "<td>";
emit_user_selector($f,$conference['id'],$role);
echo "</td>";
}
exit;
}
function emit_user_selector($name,$conferenceid,$role,$allowcreate=true) {
echo "<!--begin emit_user_selector ($name,$conferenceid,$role,$allowcreate)-->\n";
echo "<input type=\"hidden\" id=\"{$name}_role\" name=\"{$name}_role\" value=\"$role\">";
echo "<input type=\"hidden\" id=\"{$name}_conferenceid\" name=\"{$name}_conferenceid\" value=\"$conferenceid\">";
echo "<input type=\"text\" class=\"user_select_autocomplete\" size=\"45\" id=\"{$name}\" name=\"{$name}\">";
echo "<!--end emit_user_selector-->\n";
}
if($_POST['save']=="edit" || $_POST['save']=="add") {
if($_POST['save']=="add") {
$q=mysql_query("INSERT INTO schools (conferences_id) VALUES ('".$conference['id']."')");
$id=mysql_insert_id();
}
else
@ -39,83 +165,6 @@
$atrisk = $_POST['atrisk'] == 'yes' ? 'yes' : 'no';
/*
"sciencehead='".mysql_escape_string(stripslashes($_POST['sciencehead']))."', ".
"scienceheadphone='".mysql_escape_string(stripslashes($_POST['scienceheadphone']))."', ".
"scienceheademail='".mysql_escape_string(stripslashes($_POST['scienceheademail']))."', ".
"principal='".mysql_escape_string(stripslashes($_POST['principal']))."', ".
*/
/* Get the uids for principal/science head */
$q = mysql_query("SELECT principal_uid,sciencehead_uid FROM schools WHERE id='$id'");
$i = mysql_fetch_assoc($q);
$principal_update = '';
$sciencehead_update = '';
list($first, $last) = split(' ', $_POST['principal'], 2);
/* Load existing entry if it exists, else make an entry if
* there is data, else, do nothing */
if($i['principal_uid'] > 0)
$pl = user_load_by_uid($i['principal_uid']);
else if($first != '' && $last != '') {
$pl = user_create('principal', "*$first$last".user_generate_password());
$principal_update = "principal_uid='{$pl['uid']}',";
} else
$pl = false;
/* If we loaded or created an entry, either
* update and save, or purge it */
if(is_array($pl)) {
if($first == '' && $last == '') {
user_purge($pl, 'principal');
$principal_update = 'principal_uid=NULL,';
} else {
$pl['firstname'] = $first;
$pl['lastname'] = $last;
user_save($pl);
}
}
/* Get info about science head */
list($first, $last) = split(' ', $_POST['sciencehead'], 2);
$em = $_POST['scienceheademail'];
if($em == '' && ($first != '' || $last != '')) $em = "*$first$last".user_generate_password();
/* Load existing record, or create new if there's something
* to insert */
$sh = false;
if($i['sciencehead_uid'] > 0) {
$sh = user_load_by_uid($i['sciencehead_uid']);
/* It's possile for sh to be false now, happens when the user is
* deleted outside the school editor, this condition needs to be
* fixed. If we let it go, the saving the teacher info will
* silently fail. So let's just create a new teacher */
if(is_array($sh) && ($em != $sh['email'] || $em=='')) {
/* If the emails don't match we have no way of knowing if we're creating a different
* user, or doing a correction, assume it's a different user */
user_purge($sh, 'teacher');
$sh = false;
}
}
/* If there was no teacher loaded, or if we just purged it, create a new one
* if there's an email address */
if($sh == false && $em != '') {
$sh = user_create('teacher', $em);
$sciencehead_update = "sciencehead_uid='{$sh['uid']}',";
}
/* If we have a record update it */
if(is_array($sh)) {
$sh['firstname'] = $first;
$sh['lastname'] = $last;
$sh['phonework'] = $_POST['scienceheadphone'];
$sh['email'] = $em;
$sh['username'] = $em;
user_save($sh);
}
$exec="UPDATE schools SET ".
"school='".mysql_escape_string(stripslashes($_POST['school']))."', ".
"schoollang='".mysql_escape_string(stripslashes($_POST['schoollang']))."', ".
@ -135,7 +184,6 @@
"projectlimit='".mysql_escape_string(stripslashes($_POST['projectlimit']))."', ".
"projectlimitper='".mysql_escape_string(stripslashes($_POST['projectlimitper']))."', ".
"accesscode='".mysql_escape_string(stripslashes($_POST['accesscode']))."', ".
$sciencehead_update.$principal_update.
"atrisk='$atrisk' ".
"WHERE id='$id'";
mysql_query($exec);
@ -146,44 +194,148 @@
else
$notice = 'saved';
}
else if($_POST['action'] == "save_participation") {
// update the schools' participation in fairs an olympics to reflect the settings submitted
$olympicSet = array();
$fairSet = array();
foreach($_POST as $idx => $value){
if(preg_match('/_olympics$/', $idx)){
$parts = explode('_', $idx);
$olympicSet[] = $parts[0];
}else if(preg_match('/_fairs$/', $idx)){
$parts = explode('_', $idx);
$fairSet[] = $parts[0];
}
}
$fairString = '(' . implode(',', $fairSet) . ')';
$olympicString = '(' . implode(',', $olympicSet) . ')';
mysql_query("UPDATE schools SET include_fairs = TRUE WHERE id IN $fairString");
mysql_query("UPDATE schools SET include_fairs = FALSE WHERE id NOT IN $fairString");
mysql_query("UPDATE schools SET include_olympics = TRUE WHERE id IN $olympicString");
mysql_query("UPDATE schools SET include_olympics = FALSE WHERE id NOT IN $olympicString");
}
else if($_POST['action']=="copy") {
$oldConfId=intval($_POST['copyconference']);
$newConfId=intval($conference['id']);
if($oldConfId && $newConfId) {
if($_GET['action']=="delete" && $_GET['delete'])
{
$q=mysql_query("SELECT * FROM schools WHERE conferences_id=$oldConfId");
while($r=mysql_fetch_object($q)) {
//FIXME: we need to roll the userid's to new ones for the new conference, if we use the same ones its not gonna work
//nobody should be copying for now, so we should be safe for a few months
//2011-02-22
$puid = ($r->principal_uid == null) ? 'NULL' : ("'".intval($r->principal_uid)."'");
$shuid = ($r->sciencehead_uid == null) ? 'NULL' : ("'".intval($r->sciencehead_uid)."'");
mysql_query("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,conferences_id) VALUES (
'".mysql_real_escape_string($r->school)."',
'".mysql_real_escape_string($r->schoollang)."',
'".mysql_real_escape_string($r->schoollevel)."',
'".mysql_real_escape_string($r->board)."',
'".mysql_real_escape_string($r->district)."',
'".mysql_real_escape_string($r->phone)."',
'".mysql_real_escape_string($r->fax)."',
'".mysql_real_escape_string($r->address)."',
'".mysql_real_escape_string($r->city)."',
'".mysql_real_escape_string($r->province_code)."',
'".mysql_real_escape_string($r->postalcode)."',$puid,
'".mysql_real_escape_string($r->schoolemail)."',$shuid,
'".mysql_real_escape_string($r->accesscode)."',
NULL,
'".mysql_real_escape_string($r->junior)."',
'".mysql_real_escape_string($r->intermediate)."',
'".mysql_real_escape_string($r->senior)."',
'".mysql_real_escape_string($r->registration_password)."',
'".mysql_real_escape_string($r->projectlimit)."',
'".mysql_real_escape_string($r->projectlimitper)."',
'".mysql_real_escape_string($newConfId)."')");
}
$notice="copied";
}
}
if($_GET['action']=="delete" && $_GET['delete']) {
mysql_query("DELETE FROM schools WHERE id='".$_GET['delete']."'");
$notice = 'deleted';
}
if($_GET['action']=="clearaccesscodes")
{
mysql_query("UPDATE schools SET accesscode=NULL WHERE year='{$config['FAIRYEAR']}'");
if($_GET['action']=="clearaccesscodes") {
mysql_query("UPDATE schools SET accesscode=NULL WHERE conferences_id='{$conference['id']}'");
$notice = 'clearaccess';
}
if($_GET['action']=="makeaccesscodes")
{
$q=mysql_query("SELECT id FROM schools WHERE year='{$config['FAIRYEAR']}' AND (accesscode IS NULL OR accesscode='')");
while($r=mysql_fetch_object($q))
{
if($_GET['action']=="makeaccesscodes") {
$q=mysql_query("SELECT id FROM schools WHERE conferences_id='{$conference['id']}' AND (accesscode IS NULL OR accesscode='')");
while($r=mysql_fetch_object($q)) {
$ac=generatePassword(5);
mysql_query("UPDATE schools SET accesscode='$ac' WHERE id='$r->id' AND year='{$config['FAIRYEAR']}'");
mysql_query("UPDATE schools SET accesscode='$ac' WHERE id='$r->id' AND conferences_id='{$conference['id']}'");
}
$notice = 'makeaccess';
}
if($_GET['action']=="edit" || $_GET['action']=="add")
{
if($_GET['action']=="edit" || $_GET['action']=="add") {
send_header(($_GET['action']=='edit') ? "Edit School" : "Add New School",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'School Management' => 'admin/schools.php'),
"schools_management"
);
if($_GET['action']=="edit")
{
$schoolid=intval($_GET['edit']);
?>
<script type="text/javascript">
function removeUserFromSchool(role,schoolid) {
if(!confirmClick('Are you sure you want to remove this '+role+' from the school?'))
return false;
else {
$.post('schools.php',{action: 'removeuser', role: role, schoolid: schoolid},function() { updateUser(role,schoolid); });
return false;
}
}
var global_schoolid;
function updateUser(role,schoolid) {
global_schoolid=schoolid;
$("#"+role+"_row").load('schools.php?action=loaduser&role='+role+'&schoolid='+schoolid,null,function() {
$(".user_select_autocomplete").autocomplete({
source: "user_select_autocomplete.php",
select: function(event,ui) {
var accounts_id=ui.item.accounts_id;
var users_id=ui.item.users_id;
var username=$(this).val();
var field=$(this).attr("name");
var conferenceid=$("#"+field+'_conferenceid').val();
var role=$("#"+field+'_role').val();
var options={action: 'adduser', accounts_id: accounts_id, users_id: users_id, username: username, field: field, conferenceid: conferenceid, schoolid: global_schoolid, role: role };
$.post("schools.php",options,function() {
updateUser(role,global_schoolid);
});
}
});
});
}
$(document).ready(function() {
updateUser('principal',<?=$schoolid?>);
updateUser('teacher',<?=$schoolid?>);
});
</script>
<?
if($_GET['action']=="edit") {
$buttontext="Save School";
$q=mysql_query("SELECT * FROM schools WHERE id='".$_GET['edit']."'");
$q=mysql_query("SELECT * FROM schools WHERE id='$schoolid'");
$r=mysql_fetch_object($q);
}
else if($_GET['action']=="add")
@ -196,7 +348,7 @@
echo "<input type=\"hidden\" name=\"save\" value=\"".$_GET['action']."\">\n";
if($_GET['action']=="edit")
echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET['edit']."\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"".$schoolid."\">\n";
echo "<table>\n";
echo "<tr><td>".i18n("School Name")."</td><td><input type=\"text\" name=\"school\" value=\"".htmlspecialchars($r->school)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
@ -233,32 +385,25 @@
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";
if($r->principal_uid > 0)
$pl = user_load_by_uid($r->principal_uid);
else
$pl = array();
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("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 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);
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";
if($config['participant_registration_type']=="schoolpassword")
{
echo "<tr><td colspan=2><br /><b>".i18n("Principal")."</b></td></tr>";
echo "<tr id=\"principal_row\">";
//this gets filled in by javascript/jquery
echo "</tr>";
echo "<tr><td colspan=2><br /><b>".i18n("Science head/teacher or science fair contact at school")."</b></td></tr>";
echo "<tr id=\"teacher_row\">";
//this gets filled in by javascript/jquery
echo "</tr>";
if($config['participant_registration_type']=="schoolpassword") {
echo "<tr><td colspan=2><br /><b>".i18n("Participant Registration Password")."</b></td></tr>";
echo "<tr><td>".i18n("Password")."</td><td><input type=\"text\" name=\"registration_password\" value=\"".htmlspecialchars($r->registration_password)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
}
echo "<tr><td colspan=2><br /><b>".i18n("Participant Registration Limits")."</b></td></tr>";
if($config['participant_registration_type']=="invite")
{
if($config['participant_registration_type']=="invite") {
echo "<tr><td colspan=2>".i18n("Set to 0 to have no registration limit")."</td></tr>";
echo "<tr><td colspan=2>".i18n("Maximum of")."&nbsp;";
echo "<input type=\"text\" name=\"projectlimit\" value=\"".htmlspecialchars($r->projectlimit)."\" size=\"4\" maxlength=\"4\" />";
@ -292,8 +437,71 @@
}
else
else if($_GET['action'] == 'participation')
{
send_header(
"Conference Participation",
array(
'Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'School Management' => 'admin/schools.php'
),
"participation"
);
echo "<form method=\"post\" action=\"schools.php\">\n";
echo "<table class=\"tableview\">";
echo "<thead><tr>";
echo " <th>".i18n("School")."</th>";
echo " <th>".i18n("Participation")."</th>";
echo "</tr></thead>\n";
$query = mysql_query("SELECT id, school, include_fairs, include_olympics FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
while($record = mysql_fetch_array($query)){
echo "<tr><td>" . $record['school'] . "</td>";
echo "<td><label style=\"margin-right: 2em\">";
echo '<input type="checkbox" name="' . $record['id'] . '_fairs' . '"';
if($record['include_fairs'] == true) echo " CHECKED";
echo "> " . i18n("fairs") . "</label>";
echo "<label>";
echo '<input type="checkbox" name="' . $record['id'] . '_olympics' . '"';
if($record['include_olympics'] == true) echo " CHECKED";
echo "> " . i18n("olympics") . "</label>";
echo "</td></tr>";
}
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . i18n('Save') . "\" /></td></tr>\n";
echo "</table>\n";
echo '<input type="hidden" name="action" value="save_participation"></input>' . "\n";
echo "</form>\n";
}
else if($_GET['action']=="copy") {
send_header("School Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
"schools_management"
);
echo "<form method=\"post\" action=\"schools.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"copy\">\n";
echo i18n("Choose a conference to copy schools from");
echo "<br />";
$q=mysql_query("SELECT * FROM conferences WHERE id!='{$conference['id']}' ORDER BY id DESC");
echo mysql_error();
echo "<select name=\"copyconference\">";
echo "<option value=\"\">".i18n("Choose a Conference")."</option>\n";
while($r=mysql_fetch_object($q)) {
$numq=mysql_query("SELECT COUNT(*) AS c FROM schools WHERE conferences_id='{$r->id}'");
$numr=mysql_fetch_object($numq);
echo "<option value=\"{$r->id}\">{$r->name} ($numr->c schools)</option>\n";
}
echo "</select>\n";
echo "<input type=\"submit\" value=\"".i18n("Copy Schools")."\">";
echo "</form>\n";
}
else {
send_header("School Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php'),
@ -302,57 +510,82 @@
switch($notice) {
case 'added':
echo happy("School successfully added");
echo happy(i18n("School successfully added"));
break;
case 'saved':
echo happy("Successfully saved changes to school");
echo happy(i18n("Successfully saved changes to school"));
break;
case 'deleted':
echo happy("School successfully deleted");
echo happy(i18n("School successfully deleted"));
break;
case 'clearaccess':
echo happy("Access Codes successfully cleared from all schools");
echo happy(i18n("Access Codes successfully cleared from all schools"));
break;
case 'makeaccess':
echo happy("Access Codes successfully set for schools that didn't have one");
echo happy(i18n("Access Codes successfully set for schools that didn't have one"));
break;
case 'copied':
echo happy(i18n("Schools successfully copied from other conference"));
break;
}
echo "<br />";
echo "<a href=\"schools.php?action=add\">".i18n("Add new school")."</a>\n";
echo "<br />";
echo "<a href=\"schools.php?action=copy\">".i18n("Copy schools from a difference conference")."</a>\n";
echo "<br />";
echo "<a href=\"schoolsimport.php?action=add\">".i18n("Import schools from CSV")."</a>\n";
echo "<br />";
echo "<a href=\"schools.php?action=makeaccesscodes\">".i18n("Create Access Code for any school without one")."</a>\n";
echo "<br />";
echo "<a onclick=\"return confirmClick('".i18n("Are you sure you want to remove all access codes from all schools?")."')\" href=\"schools.php?action=clearaccesscodes\">".i18n("Remove Access Codes from all schools")."</a>\n";
echo "<br />";
// we only need to see this option if we are managing both types of conferences
$q = mysql_fetch_array(mysql_query('SELECT COUNT(DISTINCT(`type`)) as taly FROM conferences'));
if($q['tally'] > 1){
echo "<a href=\"schools.php?action=participation\">".i18n("Set SFIAB/SOIAB participation")."</a>\n";
echo "<br />";
}
echo "<table class=\"tableview\">";
echo "<thead><tr>";
echo " <th>".i18n("School")."</th>";
echo " <th>".i18n("Address")."</th>";
echo " <th>".i18n("Phone")."</th>";
echo " <th>".i18n("Contact")."</th>";
echo " <th>".i18n("Science Head")."</th>";
echo " <th>".i18n("Science Head Email")."</th>";
if($config['participant_registration_type']=="schoolpassword")
echo " <th>".i18n("Reg Pass")."</th>";
echo " <th>".i18n("Access Code")."</th>";
echo " <th>".i18n("Action")."</th>";
echo "</tr></thead>\n";
$q=mysql_query("SELECT * FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
$q=mysql_query("SELECT * FROM schools WHERE conferences_id='".$conference['id']."' ORDER BY school");
while($r=mysql_fetch_object($q))
{
echo "<tr>\n";
echo " <td>$r->school</td>\n";
echo " <td>$r->address, $r->city, $r->postalcode</td>\n";
echo " <td>$r->phone</td>\n";
$sciencehead = '';
$scienceheademail = '';
if($r->sciencehead_uid > 0) {
$sh = user_load_by_uid($r->sciencehead_uid);
$sh = user_load($r->sciencehead_uid);
$sciencehead = $sh['name'];
if(!$sciencehead) $sciencehead="<i>no name set</i>";
// print_r($sh);
$sha=account_load($sh['accounts_id']);
if($sha['email']) {
$scienceheademail=$sha['email'];
$pending="";
}
else {
$scienceheademail=$sha['pendingemail'];
$pending="(unconfirmed)";
}
}
echo " <td>$sciencehead</td>\n";
echo " <td><a href=\"mailto:$scienceheademail\">$scienceheademail</a> $pending</td>\n";
if($config['participant_registration_type']=="schoolpassword")
echo " <td>$r->registration_password</td>\n";
echo " <td>$r->accesscode</td>\n";

View File

@ -26,7 +26,7 @@
require_once("../user.inc.php");
require("../csvimport.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Schools Import",
array('Committee Main' => 'committee_main.php',
@ -49,13 +49,13 @@
if($_POST['emptycurrent']==1)
{
echo happy(i18n("Old school data erased"));
mysql_query("DELETE FROM schools WHERE year='".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM schools WHERE conferences_id='".$conference['id']."'");
}
$loaded=0;
foreach($CSVP->data AS $row)
{
mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal,schoolemail,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,year) VALUES (
mysql_query("INSERT INTO schools (school,schoollang,schoollevel,board,district,phone,fax,address,city,province_code,postalcode,principal,schoolemail,sciencehead,scienceheademail,scienceheadphone,accesscode,registration_password,projectlimit,projectlimitper,conferences_id) VALUES (
'".mysql_escape_string(stripslashes($row[0]))."',
'".mysql_escape_string(stripslashes($row[1]))."',
'".mysql_escape_string(stripslashes($row[2]))."',
@ -76,7 +76,7 @@
'".mysql_escape_string(stripslashes($row[17]))."',
'".mysql_escape_string(stripslashes($row[18]))."',
'".mysql_escape_string(stripslashes($row[19]))."',
'".$config['FAIRYEAR']."')");
'".$conference['id']."')");
if(!mysql_Error())
$loaded++;
else

View File

@ -24,7 +24,7 @@
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
send_header("Science Fair Management",
array('Committee Main' => 'committee_main.php',

View File

@ -24,7 +24,7 @@
<?
include "../common.inc.php";
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
user_auth_required('admin');
foreach($config['languages'] AS $l=>$ln) {
if($l==$config['default_language']) continue;
@ -34,9 +34,9 @@ foreach($config['languages'] AS $l=>$ln) {
if($_POST['translate_'.$l]) {
$q=mysql_query("SELECT * FROM translations WHERE lang='$l' AND strmd5='$m'");
if(mysql_num_rows($q))
mysql_query("UPDATE translations SET val='".mysql_real_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_'.$l])))."' WHERE lang='$l' AND strmd5='$m'");
mysql_query("UPDATE translations SET val='".mysql_real_escape_string(stripslashes($_POST['translate_'.$l]))."' WHERE lang='$l' AND strmd5='$m'");
else
mysql_query("INSERT INTO translations (lang,strmd5,str,val) VALUES ('$l','$m','".mysql_real_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_str_hidden'])))."','".mysql_escape_string(iconv("UTF-8","ISO-8859-1",stripslashes($_POST['translate_'.$l])))."')");
mysql_query("INSERT INTO translations (lang,strmd5,str,val) VALUES ('$l','$m','".mysql_real_escape_string(stripslashes($_POST['translate_str_hidden']))."','".mysql_escape_string(stripslashes($_POST['translate_'.$l]))."')");
}
else {
mysql_query("DELETE FROM translations WHERE lang='$l' AND strmd5='$m'");

Some files were not shown because too many files have changed in this diff Show More