Files
HotLunches/school-reseller.php
T
2026-10-19 15:22:52 -07:00

1043 lines
43 KiB
PHP

<?php
exit();
$school_num = 481;
// Create other entries for a new school
if (!isset($school_num)) {
echo("No School Number\n");
exit();
}
include "db.php";
include "include/table.php";
// Get school name
$results = db_query("select * from schools where record_num = $school_num");
$school = db_fetch_array($results);
$school_name = trim($school['school_name']);
$country = $school['country'];
$pac_name = trim($school['pac_name']);
$url = $school['url'];
$orgType = $school['type'];
$reseller = $school['reseller'];
$siteType = "hotlunch";
if (strpos($url,'fundraiserorders.com') !== false) $siteType = 'fundraising';
if (strpos($url,'payschoolfees.net') !== false) $siteType = 'schoolfees';
if (strpos($url,'registrationnow.net') !== false) $siteType = 'registration';
if ($siteType == "hotlunch" && strpos($url, "hotlunches.net") === false) $url = "www.$url";
echo("$school_name\n");
echo("$pac_name\n");
$date_added = date("Y-m-d",time());
$date_modified = $date_added;
// Check for colour scheme and other values
$school['default_language'] = 'English';
// if ($school['status'] == 'Trial') $school['status'] = 'Active';
// if ($school['status'] == 'Pending') $school['status'] = 'Active';
if ($school['system_configuration'] == 'Full') $other_modules_flag = 'Y';
else $other_modules_flag = 'N';
if ($school['status'] == 'Linked') {
$other_modules_flag = 'N';
}
$school['site_active'] = 'Y';
$school['display'] = 'Y';
$school['display_linked_sites'] = 'Y';
$school['login_form_location'] = 'Default';
$school['email_system'] = $other_modules_flag;
$school['other_modules'] = $other_modules_flag;
$school['event_calendar'] = $other_modules_flag;
$school['classified_ads'] = $other_modules_flag;
$school['photo_gallery'] = $other_modules_flag;
$school['document_admin'] = 'Y';
$school['email_processing'] = 'N';
$school['email_aliases_file'] = '';
$school['max_email_aliases'] = 20;
$school['maillist_pop_account'] = '';
$school['use_access_code'] = 'Y';
$school['date_format'] = 'F j, Y';
$school['orders_for'] = 'Participants';
$school['registrants_are'] = 'Parents';
$school['participants_are'] = 'Students';
$school['participant_grouping'] = 'Class';
$school['group_leaders'] = 'Teachers';
$school['template'] = 'default.html';
$school['menu_color'] = '000000';
$school['menu_text_color'] = 'FFFFFF';
$school['menu_hover'] = '808080';
$school['hover_text_color'] = 'FFFFFF';
$school['data_odd'] = 'EEEEEE';
$school['data_odd_text'] = 'Black';
$school['data_even'] = 'CCCCCC';
$school['data_even_text'] = 'Black';
$school['small_school_discount'] = 'N';
$school['logo_image'] = 'HotLunchLogo.jpg';
$school['logo_url'] = 'www.hotlunches.net';
$school['enable_parent_registration'] = 'Y';
$school['registrations_permitted'] = 'Parent';
$school['enable_customers'] = 'N';
$school['allow_parent_login'] = 'Y';
$school['allow_guest_login'] = 'Y';
$school['enable_participant_registration'] = 'N';
$school['enable_customer_registration'] = 'N';
$school['registration_userid'] = 'UserID';
$school['registration_second_parent'] = 'No';
$school['registration_phone'] = 'Required';
$school['registration_email'] = 'Required';
$school['registration_daytime_phone'] = 'No';
$school['registration_cell_phone'] = 'No';
$school['registration_address'] = 'No';
$school['school_directory_permission'] = 'N';
$school['email_list_permission'] = 'N';
$school['collect_student_number'] = 'N';
$school['collect_student_birthdate'] = 'N';
$school['collect_student_age'] = 'N';
$school['collect_student_sex'] = 'N';
$school['collect_student_grade'] = 'N';
$school['collect_permission'] = 'N';
$school['division_class_num_text'] = "Div";
$school['user_defined_values'] = 'N';
$school['max_schedules'] = 3;
$school['max_teachers_per_class'] = 2;
$school['staff_titles'] = 'N';
$school['default_staff_language'] = 'English';
$school['staff_meals_to_classroom'] = 'Y';
$school['display_staff_list'] = 'Y';
$school['display_class_lists'] = 'Y';
$school['display_pac_info'] = 'Y';
$school['allow_userid_change'] = 'N';
$school['display_user_account_balance'] = 'Y';
$school['minimum_display_balance'] = 5;
$school['maximum_order_balance'] = 0.00;
$school['balance_calculation_days_ago'] = 30;
$school['allow_ordering_with_balance_owing'] = 'Y';
$school['previous_balances_post'] = "Post Automatically";
$school['previous_balances_post_message'] = "Previous Year Balance Posted";
$school['no_ordering_message'] = 'You will not be able to place orders at this time. Please contact the lunch team to correct the problem with your account.';
$school['allow_edit_of_paid_orders'] = 'N';
$school['allow_edit_of_complimentary_orders'] = 'N';
$school['products_per_menu_item'] = 10;
$school['display_bc_food_guidelines'] = 'N';
$school['enable_volunteer_signup'] = 'N';
$school['enable_volunteer_management'] = 'Y';
$school['include_volunteer_details'] = 'N';
$school['max_volunteers'] = 8;
$school['default_volunteer_message'] = "If you are able to assist as a volunteer on this lunch day please check this box";
if ($school['province'] == 'BC') $school['display_bc_food_guidelines'] = 'Y';
$school['menu_item_font_size'] = '14px';
$school['menu_item_color'] = '000000';
$school['group_a_color'] = "10D010";
$school['group_b_color'] = "1010D0";
$school['group_c_color'] = "D01010";
$school['group_d_color'] = "D0D010";
$school['group_e_color'] = "10D0D0";
$school['group_f_color'] = "FFAE78";
$school['group_g_color'] = "A7FFA1";
$school['group_h_color'] = "0F8FFF";
$school['group_i_color'] = "E875FF";
$school['group_j_color'] = "F7FF8C";
$school['group_k_color'] = "D9EBFF";
$school['group_l_color'] = "A70FFF";
$school['group_m_color'] = "75BFFF";
$school['schedule_required_on_post'] = 'Y';
$school['post_with_recent_schedule'] = 'N';
$school['display_group_letters'] = 'Y';
$school['delivery_report_students'] = 'With Orders';
$school['delivery_report_staff'] = 'Y';
$school['delivery_report_row_height'] = 'Normal';
$school['paper_order_form_size'] = 'Letter';
$school['paper_order_form_name_fields'] = 'First';
$school['include_revenue_in_details_csv'] = 'Y';
$school['schedule_team_access_reports'] = 'Y';
$school['label_print_school_name'] = 'N';
$school['paypal_enabled'] = 'N';
$school['paypal_minimum_amount'] = 0.00;
$school['paypal_code'] = '';
$school['paypal_mode'] = 'Live';
$school['paypal_currency'] = 'CAD';
$school['paypal_button_text'] = 'Pay With PayPal';
$school['paypal_fee'] = 0;
$school['paypal_percentage'] = 0;
$school['paypal_fee_message'] = '';
$school['paypal_donation'] = 'N';
$school['paypal_donation_message'] = '';
$school['exact_enabled'] = 'N';
$school['exact_code'] = '';
$school['exact_currency'] = 'CAD';
$school['exact_button_text'] = 'Pay With PayPal';
$school['currency_symbol'] = '$';
$school['check_register_sort'] = 'Date';
$school['display_remittance_button'] = 'Y';
$school['remittance_button_text'] = 'Print Remittance Form';
$school['accept_check'] = 'Y';
$school['accept_cash'] = 'Y';
$school['display_remittance_msg_with_button'] = 'N';
$school['remittance_form_fee'] = 0.00;
$school['display_print_order_button'] = 'Y';
$school['default_event_status'] = 'Approved';
$school['num_reminder_events'] = 5;
$school['public_event_calendar'] = 'N';
$school['default_classified_status'] = 'Approved';
$school['classified_duration'] = 28;
$school['calculate_supplier_costs'] = 'Y';
$school['supplier_costs_decimals'] = 2;
$school['verified_only_class_list'] = 'Y';
$school['support_email'] = $school['contact_email'];
$school['reply_email'] = $school['contact_email'];
$school['reply_description'] = $school['pac_name'];
$school['email_title'] = $school['pac_name'] . " E-News";
$school['schedule_sort'] = 'desc';
$school['special_item_prices'] = 'N';
$school['registration_form_message'] = "By registering for an account you agree that your name may be published on the " .
"class lists for your students. You can edit your contact information once you " .
"have completed your registration.";
$school['email_reminder_optional'] = 'Y';
$school['email_reminder_title'] = "Weekly Lunch Email Reminder";
$school['email_reminder_day'] = "Sun";
if ($siteType != "hotlunch") $school['email_reminder_day'] = "None";
$school['email_reminder_weeks'] = 1;
$school['volunteer_reminder_title'] = "Weekly Volunteer Reminder";
$school['volunteer_reminder_day'] = "None";
switch ($country) {
case 'Canada':
$paypal_currency = 'CAD';
break;
case 'USA':
$paypal_currency = 'USD';
break;
case 'UK':
$paypal_currency = 'GBP';
break;
}
if ($school['status'] == 'Linked') {
$school['enable_parent_registration'] = 'N';
$school['registrations_permitted'] = 'None';
}
else {
$school['bg_color'] = '#67A4FE';
$school['background'] = 'back038.jpg';
$school['colour_scheme'] = 'black.css';
$school['application_title'] = "Welcome to the " . $school['school_name'] . " Lunch Web Site";
$school['p_display_teachers'] = 'Y';
$school['p_display_program'] = 'Y';
$school['p_display_grade'] = 'Y';
$school['p_display_division'] = 'Y';
$school['p_display_description'] = 'N';
$school['i_display_teachers'] = 'Y';
$school['i_display_program'] = 'Y';
$school['i_display_grade'] = 'Y';
$school['i_display_division'] = 'Y';
$school['i_display_description'] = 'N';
$school['c_display_name'] = 'Y';
$school['c_display_home_phone'] = 'Y';
$school['c_display_work_phone'] = 'Y';
$school['c_display_cell_phone'] = 'Y';
$school['c_display_home_email'] = 'Y';
$school['default_order_status'] = 'Unpaid';
}
if ($siteType == 'schoolfees' || $siteType == 'registration') {
$kword = "Registration";
if ($siteType == 'schoolfees') $kword = "Fees";
$school['application_title'] = "Welcome to the " . $school['school_name'] . " $kword Site";
$school['default_order_status'] = 'Inactive';
$school['use_access_code'] = 'N';
$school['delivery_report_students'] = 'All Students';
$school['delivery_report_staff'] = 'N';
$school['enable_volunteer_signup'] = 'N';
$school['enable_volunteer_management'] = 'N';
$school['include_volunteer_details'] = 'N';
$school['max_volunteers'] = 0;
}
$month = date("m",time());
$school['expiry_date'] = date("Y-07-31",time());
if ($month >= '07') {
$school['expiry_date'] = date("Y-m-d",time() + 60 * 60 * 24 * 31);
}
//
// Handle reseller overrides
//
if ($reseller != "hotlunch") {
$results = db_query("SELECT * FROM resellers WHERE reseller_code = '$reseller'");
if (db_num_rows($results)) {
$overrides = db_fetch_assoc($results);
$reseller_source_school_num = $overrides['source_school_num'];
$src_school = array();
if ($reseller_source_school_num > 0) {
echo("Reseller Source School: $reseller_source_school_num\n");
$results = db_query("SELECT * FROM schools WHERE record_num = $reseller_source_school_num");
if (db_num_rows($results)) $src_school = db_fetch_assoc($results);
// Get any additional pages and copy them
db_query("DELETE FROM formatted_content WHERE school_num = $school_num && content_type = 'A'");
$results = db_query("SELECT * FROM formatted_content WHERE school_num = $reseller_source_school_num && content_type = 'A'");
if (db_num_rows($results)) {
$formatted_content = new Table('formatted_content');
$date_added = date("Y-m-d",time());
while ($additional = db_fetch_array($results)) {
$content_id = $additional['content_id'];
$content_type = $additional['content_type'];
$sequence = $additional['sequence'];
$content = $additional['content'];
$query = $formatted_content->BuildInsert();
db_query($query);
}
}
}
$Fields = array(
"bill_to_address",
"bill_to_city",
"bill_to_province",
"bill_to_country",
"bill_to_postal",
"bill_to_phone",
"registrants_are",
"participants_are",
"participant_grouping",
"group_leaders",
"template",
"bg_color",
"colour_scheme",
"background",
"menu_color",
"menu_text_color",
"menu_hover",
"hover_text_color",
"data_odd",
"data_odd_text",
"data_even",
"data_even_text",
"menu_dates_on_holidays",
"system_configuration",
"email_system",
"other_modules",
"event_calendar",
"classified_ads",
"photo_gallery",
"use_access_code",
"login_form_location",
"enable_parent_registration",
"registrations_permitted",
"enable_customers",
"customer_address",
"customer_phone",
"customer_email",
"allow_parent_login",
"allow_guest_login",
"enable_participant_registration",
"enable_customer_registration",
"registration_userid",
"registration_second_parent",
"registration_phone",
"registration_email",
"registration_daytime_phone",
"registration_cell_phone",
"registration_address",
"additional_registration_data_field1",
"additional_registration_data_field2",
"email_list_permission",
"email_list_text",
"collect_student_birthdate",
"collect_student_age",
"collect_student_sex",
"collect_student_grade",
"collect_student_number",
"collect_permission",
"permission_prompt",
"permission_description",
"p_display_teachers",
"p_display_program",
"p_display_grade",
"p_display_division",
"p_display_description",
"i_display_teachers",
"i_display_program",
"i_display_grade",
"i_display_division",
"i_display_description",
"c_display_name",
"c_display_home_phone",
"c_display_work_phone",
"c_display_cell_phone",
"c_display_home_email",
"student_button_text",
"student_class_text",
"division_class_num_text",
"user_defined_values",
"user_defined_title",
"user_defined_values2",
"user_defined_title2",
"class_sort",
"max_schedules",
"menu_dates_on_holidays",
"max_teachers_per_class",
"staff_meals_to_classroom",
"display_staff_list",
"display_class_lists",
"display_pac_info",
"allow_userid_change",
"display_user_account_balance",
"minimum_display_balance",
"maximum_order_balance",
"balance_calculation_days_ago",
"allow_ordering_with_balance_owing",
"previous_balances_post",
"previous_balances_post_message",
"no_ordering_message",
"verified_only_class_list",
"allow_edit_of_paid_orders",
"allow_edit_of_complimentary_orders",
"order_entered_message",
"schedule_sort",
"special_item_prices",
"taxable_items",
"display_bc_food_guidelines",
"label_print_school_name",
"enable_volunteer_signup",
"enable_volunteer_management",
"include_volunteer_details",
"max_volunteers",
"default_volunteer_message",
"group_a_color",
"group_b_color",
"group_c_color",
"group_d_color",
"group_e_color",
"group_f_color",
"group_g_color",
"group_h_color",
"group_i_color",
"group_j_color",
"group_k_color",
"group_l_color",
"group_m_color",
"display_group_colors",
"display_group_letters",
"implement_meal_locations",
"logo_image",
"logo_url",
"receipt_image",
"receipt_title",
"display_staff_list",
"display_class_lists",
"display_pac_info",
"menu_item_font_size",
"menu_item_color",
"check_register_sort",
"display_user_account_balance",
"minimum_display_balance",
"maximum_order_balance",
"balance_calculation_days_ago",
"allow_ordering_with_balance_owing",
"previous_balances_post",
"previous_balances_post_message",
"exact_enabled",
"exact_code",
"exact_currency",
"exact_button_text",
"display_remittance_button",
"remittance_button_text",
"accept_check",
"accept_cash",
"display_remittance_msg_with_button",
"remittance_form_fee",
"display_print_order_button",
"calculate_supplier_costs",
"supplier_costs_decimals",
"default_student_status",
"default_order_status",
"default_event_status",
"num_reminder_events",
"public_event_calendar",
"default_classified_status",
"classified_duration",
"additional_pages_title",
"support_email",
"reply_email",
"reply_description",
"email_title",
"email_footer",
"email_reminder_optional",
"email_reminder_title",
"email_reminder_day",
"volunteer_reminder_title",
"volunteer_reminder_day"
);
for ($i = 0; $i < count($Fields); $i++) {
$field = $Fields[$i];
if (in_array($field,$overrides) && strlen($overrides[$field])) {
if ($overrides[$field] == "none") $school[$field] = '';
else $school[$field] = $overrides[$field];
}
if (is_array($src_school) && array_key_exists($field,$src_school)) {
$school[$field] = $src_school[$field];
echo("$field: " . $src_school[$field] . "\n");
}
}
}
$school['expiry_date'] = date("Y-07-31",time() + 60 * 60 * 24 * 200);
}
extract($school);
echo($order_entered_message . "\n\n");
echo("$expiry_date\n");
echo("$url\n");
$record_num = $school_num;
if ($school['status'] != 'Linked') {
$document_path = sprintf("%08d",$record_num);
mkdir("files/$document_path",0777);
$subdirs = array("attachments","documents","galleries","image","product_images","orders","admin","admin/lists","admin/aliases",".thumbs");
for ($i = 0; $i < count($subdirs); $i++) {
$sdir = $subdirs[$i];
mkdir("files/$document_path/$sdir",0777);
}
// Copy images from source if required
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
$source_path = sprintf("%08d",$reseller_source_school_num);
for ($i = 0; $i < count($subdirs); $i++) {
$sdir = $subdirs[$i];
$dir = opendir("files/$source_path/$sdir");
while ($file = readdir($dir)) {
if ($file == ".") continue;
if ($file == "..") continue;
copy("files/$source_path/$sdir/$file","files/$document_path/$sdir/$file");
}
closedir($dir);
}
}
}
$schools = new Table("schools");
$query = $schools->BuildUpdate();
db_query($query);
// Check if there is an admin user
if ($school['status'] != 'Linked') {
$query = "select * from users where school_num = $base_school_num and userid = 'admin'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
// Create an admin user
$userid = "admin";
$password = "admin";
$type = "System Administrator";
$status = "Active";
$first_name = "Administrator";
$users = new Table("users");
$query = $users->BuildInsert();
db_query($query);
}
// // Insert staff categories
$staff_categories = array('Principal','Vice Principal','Administration','Teacher','Support Staff','SEA','Librarian','Other Staff');
for ($i = 0; $i < count($staff_categories); $i++) {
$scat = $staff_categories[$i];
$seq = $i + 1;
// Check if this category exists
$query = "select * from staff_categories " .
"where school_num = $school_num " .
"and category_title = '$scat'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$query = "insert into staff_categories (school_num,category_title,sequence) " .
"values ($school_num,'$scat',$seq)";
db_query($query);
if ($scat == 'Teacher') {
$dnum = db_insert_id();
db_query("update schools set default_staff_category = $dnum where record_num = $school_num");
}
}
}
}
// Setup default content
$formatted_content = new Table("formatted_content");
// Create login screen message
$content_type = 'C';
$content_id = "Login Page";
$query = "delete from formatted_content where school_num = $school_num and content_id = '$content_id'";
db_query($query);
$content = "";
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
$content = db_getVal("SELECT content FROM formatted_content WHERE school_num = $reseller_source_school_num AND content_id = '$content_id'");
}
if (strlen($content) == 0) {
switch ($siteType) {
case 'hotlunch':
$content = "<p>Welcome to the $pac_name and Lunch web site. On this site parents will be " .
"able to place lunch orders for their children.</p>\n" .
"<p>We believe that by involving and informing parents we will have a more supportive and effective school " .
"environment for our children. It is up to us to work together to ensure our children have the best " .
"possible school experience.</p>\n";
break;
case 'fundraising':
$content = "<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
"place fund raising orders for our $orgType.</p>\n";
break;
case 'schoolfees':
$content = "<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
"register children for fieldtrips.</p>\n";
break;
case 'registration':
$content = "<p>Welcome to the $pac_name registration web site.</p>\n";
break;
}
}
$query = $formatted_content->BuildInsert();
db_query($query);
// Create login screen message
$content_type = 'C';
$content_id = "Welcome Page";
$query = "delete from formatted_content where school_num = $school_num and content_id = '$content_id'";
db_query($query);
$content = "";
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
$content = db_getVal("SELECT content FROM formatted_content WHERE school_num = $reseller_source_school_num AND content_id = '$content_id'");
}
if (strlen($content) == 0) {
switch ($siteType) {
case 'hotlunch':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the lunch on-line system. This application is meant to " .
"facilitate the ordering and management of school lunch orders for both " .
"parents and the $pac_name. Please feel free to contact us with any suggestions " .
"or problems you have with the system.</p>\n";
break;
case 'fundraising':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
"place fund raising orders for our $orgType.</p>\n";
break;
case 'schoolfees':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
"register children for fieldtrips.</p>\n";
break;
case 'registration':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name registration web site.</p>\n";
break;
}
}
$query = $formatted_content->BuildInsert();
db_query($query);
if ($school['status'] != 'Linked') {
if ($reseller == 'hotlunch') {
// Setup page content entries
if ($siteType == 'hotlunch') {
$pages = array('Council Information');
for ($i = 0; $i < count($pages); $i++) {
$page = $pages[$i];
// Check if this page has already been created
$query = "select * from formatted_content " .
"where school_num = $school_num " .
"and content_type = 'C' " .
"and content_id = '$page'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$query = "insert into formatted_content (school_num,content_id,content_type) " .
"values ($school_num,'$page','C')";
db_query($query);
}
}
}
// Create no access to class list message
if ($siteType == 'hotlunch') {
$content_type = 'C';
$content_id = "Access to Class List Denied";
$query = "select * from formatted_content where school_num = $school_num and content_id = '$content_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$content = "<p>You have accessed the contact list for your child's class, but your child " .
"has not yet been verified in the system. In order to protect our children " .
"we only allow access to the class lists once your child has been verified. " .
"As parents we are sure you understand our caution.</p>\n" .
"<p>Please bear with us as we are processing the registrations and verifying " .
"the students as fast as possible.</p>\n" .
"<p>$pac_name</p>";
$query = $formatted_content->BuildInsert();
db_query($query);
}
}
// Create the default events email message
if ($siteType == 'hotlunch') {
$content_type = 'Events';
$content_id = db_escape_string("$pac_name Event Calendar");
$query = "select * from formatted_content where school_num = $school_num and content_type = '$content_type'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$content_id = "$pac_name Event Calendar";
$content = "<p>Dear Parent,</p>\n<p>The following are the upcoming school and community events from the on-line event calendar on " .
"our $pac_name web site. We invite you to visit the site and post any child and family friendly events to our event calendar " .
"to share with the other parents at $school_name.</p>\n<p>We will send a list of events to all parents monthly.</p>\n<br>\n";
$query = $formatted_content->BuildInsert();
db_query($query);
}
}
// Create the reminder email
if ($siteType == 'hotlunch') {
$content_type = 'Reminder';
$content_id = db_escape_string("$pac_name Web Password Reminder");
$query = "select * from formatted_content where school_num = $school_num and content_type = '$content_type'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$content_id = "$pac_name Web Password Reminder";
$content = "<p>Dear Parent,</p>\n<p>The following is your user id and password to access our $pac_name web site.</p>\n" .
"<p>User ID: <b>{userid}</b><br>\n" .
"Password: <b>{password}</b></p>\n" .
"<p>You will need this information to access the web site, place lunch orders, view the event calendar, " .
"post free classified ads and view the on-line bulletin boards.</p>\n" .
"<p>$pac_name</p>\n";
$query = $formatted_content->BuildInsert();
db_query($query);
}
}
// Create document type records
if ($siteType == 'hotlunch') {
$fp = fopen("document_types.txt","r");
$sequence = 1;
while (!feof($fp)) {
$cat = trim(fgets($fp,1000));
if (strlen($cat) > 0) {
$results = db_query("select * from document_categories where school_num = $school_num and category = '$cat'");
if (db_num_rows($results) == 0) {
db_query("insert into document_categories (school_num,category,sequence) values($school_num,'$cat',$sequence)");
$sequence++;
}
}
}
}
}
}
// Create default email messages
if ($siteType == 'hotlunch') {
$content_type = 'E';
$content_id = db_escape_string("$school_name Lunch Money Due");
$query = "select * from formatted_content " .
"where school_num = $school_num " .
"and content_type = '$content_type' " .
"and content_id = '$content_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$content_id = "$school_name Lunch Money Due";
$content = "<p>Dear Parent,</p>\n<p>We want to thank you for placing an order with the $pac_name Lunch Program. " .
"This is a reminder that payment is now due for the lunch orders.</p>\n" .
"<p>According to our records you have an outstanding balance at this time. If this is incorrect " .
"please notify us so that we can correct our records.</p>\n" .
"<p>System User ID: <b>{userid}</b></p>\n" .
"Balance Owing: <b>" . '$' . "{account_balance}</b></p>\n" .
"<p>Payment should be sent with your child to the school for processing.</p>\n" .
"<p><b>Thank You $pac_name</b></p>\n";
$query = $formatted_content->BuildInsert();
db_query($query);
}
}
// Create text data entries
$text_data_tbl = new Table("text_data");
$date_added = date("Y-m-d",time());
$date_modified = date("Y-m-d",time());
$text_id = "Remittance Form";
$data_code = "Remittance";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
if ($siteType == 'registration') {
$text_data = "When submitting payment please provide a single payment for all outstanding orders and please pay the full balance that is outstanding.\n\n" .
"Payment can be made at the office.";
}
else {
$text_data = "When submitting payment please provide a single payment for all outstanding orders and please pay the full balance that is outstanding.\n\n" .
"Payment can be given to any teacher or handed in at the school office.";
}
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
if ($siteType == 'hotlunch') {
$text_id = "Lunch Reminder";
$data_code = "Lunch Reminder";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Note: This is a reminder of your lunch order for the coming week.\n" .
"\n" .
"If you do not wish to receive the weekly lunch email reminder,\n" .
"please login into your account at our site: https://$url\n" .
"and edit your profile to disable the email message.\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Lunch Reminder - No Service This Week";
$data_code = "Lunch Reminder";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Note: There is no lunch service offered at school for the coming week.\n" .
"\n" .
"If you do not wish to receive the weekly lunch email reminder,\n" .
"please login into your account at our site: https://$url\n" .
"and edit your profile to disable the email message.\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Parent Reminder";
$data_code = "Parent Reminder";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Welcome to the $school_name Lunch Web Site. We have created a user account and password for you " .
"when we entered your child's lunch order that you submitted as a paper order. If you wish to place " .
"your lunch order using our on-line system for the upcoming session you will need the following user " .
"id and password information.\n" .
"\n" .
"Once you login you will be able to change your user id, update your password, place lunch orders, " .
"edit your contact information and view the on-line class list for your children's class. The contact " .
"information you enter will only be available to other parents with children in the same class as your children.\n" .
"\n" .
"To access the Lunch web site:\n\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Volunteer Reminder";
$data_code = "Volunteer Reminder";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Just reminder that you are scheduled as a lunch volunteer this week. We look forward to seeing you.";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Registration Message";
$data_code = "Registration";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Thank you for registering for a user account at the $school_name lunch web site. " .
"You can now login to the web site. You will be able to update your contact information and register your students in the system for lunch ordering. " .
"Registered users will be able to place lunch orders for their children and will receive email notices from the $pac_name.";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Staff Notice";
$data_code = "Staff";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Welcome to the $pac_name Lunch Web Site. As a teacher on our site you will " .
"be able to login and change your user id, update your password, place lunch orders " .
"and view the on-line class list for your class.\n\n" .
"The on-line class list will be generated from the set of students who participate in the " .
"Lunch Program and may not be complete.\n\n" .
"To access the Lunch web site:\n\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
}
else {
$text_id = "Registration Message";
$data_code = "Registration";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Thank you for registering for a user account at the $school_name web site. " .
"You can now login to the web site.";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Parent Reminder";
$data_code = "Parent Reminder";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Welcome to the $school_name Fees Web Site. We have created a user account and password for you. " .
"If you wish to access our on-line system for the upcoming session you will need the following user " .
"id and password information.\n" .
"\n" .
"Once you login you will be able to change your password, place orders, and make payments.\n" .
"\n" .
"To access the web site:\n\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
$text_id = "Staff Notice";
$data_code = "Staff";
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
$results = db_query($query);
if (db_num_rows($results) == 0) {
$text_data = "Welcome to the $school_name Fees Web Site. As a teacher on our site you will " .
"be able to login and update your password, place lunch orders " .
"and view the on-line class list for your class.\n\n" .
"The on-line class list will be generated from the set of students who participate in the " .
"on-line program and may not be complete.\n\n" .
"To access the web site:\n\n";
$query = $text_data_tbl->BuildInsert();
db_query($query);
}
}
if ($event_calendar == 'Y') {
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Holiday','N','Y','Y','FFFFFF','FF0000')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Special Event','Y','Y','N','FF0000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Council Event','Y','Y','N','FF0000','DDDDDD')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Other','Y','Y','N','000000','FFFFFF')");
if ($orgType == 'School' || $orgType == 'Elementary' || $orgType == 'Private') {
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Lunch','Y','Y','N','000000','F0D060')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'School Event','Y','Y','N','000000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Early Dismissal','Y','Y','N','000000','FF8000')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Professional Day','N','Y','Y','FF0000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Family Fun','Y','Y','N','FFFFFF','00A000')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Kid Friendly Activity','N','Y','N','FFFFFF','00A000')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Dance Event','Y','Y','N','000000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Musical Event','Y','Y','N','000000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Sporting Event','Y','Y','N','000000','FFFFFF')");
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
"VALUES ($school_num,'Theatrical Event','Y','Y','N','000000','FFFFFF')");
}
}
?>