function core_user_update_users_object()
{
    //first, gather the necessary variables
    global $_REQUEST;
    //gather the Moodle user ID
    if (User('PROFILE') == 'student') {
        $rosario_id = UserStudentID();
        $moodle_id = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . $rosario_id . "' AND \"column\"='student_id'"));
    } else {
        $rosario_id = User('STAFF_ID');
        $moodle_id = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . $rosario_id . "' AND \"column\"='staff_id'"));
    }
    if (count($moodle_id)) {
        $moodle_id = (double) $moodle_id[1]['MOODLE_ID'];
    } else {
        return '';
    }
    //then, convert variables for the Moodle object:
    /*
    list of ( 
    	object {
    		id double   //ID of the user
    		password string  Optional //Plain text password consisting of any characters
    		//note Francois: the password must respect the Moodle policy: 8 chars min., 1 number, 1 min, 1 maj and 1 non-alphanum at least.
    	} 
    )
    */
    $password = $_REQUEST['values']['new'];
    $users = array(array('id' => $moodle_id, 'password' => $password));
    return array($users);
}
function PortalPollsDisplay($value, $name)
{
    global $THIS_RET;
    static $js_included = false;
    $poll_id = $THIS_RET['ID'];
    //get poll:
    $poll_RET = DBGet(DBQuery("SELECT EXCLUDED_USERS, VOTES_NUMBER, DISPLAY_VOTES FROM PORTAL_POLLS WHERE ID='" . $poll_id . "'"));
    $poll_questions_RET = DBGet(DBQuery("SELECT ID, QUESTION, OPTIONS, TYPE, VOTES FROM PORTAL_POLL_QUESTIONS WHERE PORTAL_POLL_ID='" . $poll_id . "' ORDER BY ID"));
    if (!$poll_RET || !$poll_questions_RET) {
        return ErrorMessage(array('Poll does not exist'));
    }
    //should never be displayed, so do not translate
    //verify if user is in excluded users list (format = '|[profile_id]:[user_id]')
    $profile_id = User('PROFILE_ID');
    if ($profile_id != 0) {
        //modif Francois: call right Student/Staff ID
        $user_id = UserStaffID();
    } else {
        $user_id = UserStudentID();
    }
    $excluded_user = '******' . $profile_id . ':' . $user_id;
    if (mb_strpos($poll_RET[1]['EXCLUDED_USERS'], $excluded_user) !== false) {
        return PortalPollsVotesDisplay($poll_id, $poll_RET[1]['DISPLAY_VOTES'], $poll_questions_RET, $poll_RET[1]['VOTES_NUMBER']);
    }
    //user already voted, display votes
    $PollForm = '';
    if (!$js_included) {
        $PollForm .= includeOnceJquery();
        $PollForm .= '<script type="text/javascript" src="assets/js/jquery.form.js"></script>';
        $PollForm .= '<script type="text/javascript">
			$(document).ready(function() {
				$(\'.formPortalPoll\').ajaxForm({ //send the votes in AJAX
					success: function(data,status,xhr,form) {
						$(form).parent().html(data);
					}
				});
			});
		</script>';
        $js_included = true;
    }
    $PollForm .= '<div id="divPortalPoll' . $poll_id . '" style="max-height:350px; overflow-y:auto;"><form method="POST" class="formPortalPoll" action="ProgramFunctions/PortalPolls.fnc.php"><input type="hidden" name="profile_id" value="' . $profile_id . '" /><input type="hidden" name="user_id" value="' . $user_id . '" /><input type="hidden" name="total_votes_string" value="' . _('Total Participants') . '" /><input type="hidden" name="poll_completed_string" value="' . _('Poll completed') . '" /><TABLE  class="width-100p cellspacing-0">';
    foreach ($poll_questions_RET as $question) {
        $PollForm .= '<TR><TD><b>' . $question['QUESTION'] . '</b></TD><TD><TABLE class="width-100p cellspacing-0">';
        $options_array = explode('<br />', nl2br($question['OPTIONS']));
        $checked = true;
        foreach ($options_array as $option_nb => $option_label) {
            if ($question['TYPE'] == 'multiple_radio') {
                $PollForm .= '<TR><TD><label><input type="radio" name="votes[' . $poll_id . '][' . $question['ID'] . ']" value="' . $option_nb . '" ' . ($checked ? 'checked' : '') . ' /> ' . $option_label . '</label></TD></TR>' . "\n";
            } else {
                //multiple
                $PollForm .= '<TR><TD><label><input type="checkbox" name="votes[' . $poll_id . '][' . $question['ID'] . '][]" value="' . $option_nb . '" /> ' . $option_label . '</label></TD></TR>' . "\n";
            }
            $checked = false;
        }
        $PollForm .= '</TABLE></TD></TR>';
    }
    $PollForm .= '</TD></TR></TABLE><P><input type="submit" value="' . _('Submit') . '" /></P></form></div>';
    return $PollForm;
}
function _makePaymentsRemove($value, $column)
{
    global $THIS_RET, $refunded_payments_RET;
    if (!$refunded_payments_RET) {
        $refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID'));
    }
    if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) {
        $return = button('remove', _('Refund'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=refund&id=' . $THIS_RET['ID'] . '"');
    } elseif ($refunded_payments_RET[$THIS_RET['ID']]) {
        $return = '<span style="color:#00A642; text-align:center">' . _('Refunded') . '</span>';
    }
    return $return . button('remove', _('Delete'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=remove&id=' . $THIS_RET['ID'] . '"');
}
Exemple #4
0
function _makePaymentsRemove($value, $column)
{
    global $THIS_RET, $refunded_payments_RET;
    if (!$refunded_payments_RET) {
        $refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID'));
    }
    if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) {
        $return = button('remove', _('Refund'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=refund&id={$THIS_RET['ID']}");
    } elseif ($refunded_payments_RET[$THIS_RET['ID']]) {
        $return = '<center><font color=#00FF66>' . _('Refunded') . '</font></center>';
    }
    return $return . button('remove', _('Delete'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&id={$THIS_RET['ID']}");
}
Exemple #5
0
function GetUserSchools($staff_id, $str = false)
{
    if (User('PROFILE_ID') != 4) {
        $str_return = '';
        $schools = DBGet(DBQuery('SELECT SCHOOL_ID FROM staff_school_relationship WHERE staff_id=' . $staff_id . ' AND syear=' . UserSyear()));
        foreach ($schools as $school) {
            $return[] = $school['SCHOOL_ID'];
            $str_return .= $school['SCHOOL_ID'] . ',';
        }
        if ($str == true) {
            return substr($str_return, 0, -1);
        } else {
            return $return;
        }
    } else {
        if (User('PROFILE_ID') == 4) {
            $schools = DBGet(DBQuery('SELECT SCHOOL_ID FROM student_enrollment WHERE STUDENT_ID=' . UserStudentID() . ' AND SYEAR=' . UserSyear() . ' ORDER BY ID DESC LIMIT 0,1'));
            return $schools[1]['SCHOOL_ID'];
        }
    }
}
function core_role_unassign_roles_object()
{
    //first, gather the necessary variables
    global $_REQUEST;
    //then, convert variables for the Moodle object:
    /*
    list of ( 
    	object {
    		roleid int   //Role to assign to the user
    		userid int   //The user that is going to be assigned
    		contextid int   //The context to unassign the user role from
    	} 
    )*/
    //gather the Moodle user ID
    $userid = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . $_REQUEST['staff_id'] . "' AND \"column\"='staff_id'"));
    if (count($userid)) {
        $userid = (int) $userid[1]['MOODLE_ID'];
    } else {
        return null;
    }
    //get the contextid
    global $moodle_contextlevel, $moodle_instance;
    $moodle_contextlevel = CONTEXT_USER;
    //gather the Moodle user ID
    $moodle_instance = DBGet(DBQuery("SELECT moodle_id FROM moodlexrosario WHERE rosario_id='" . UserStudentID() . "' AND \"column\"='student_id'"));
    if (count($moodle_instance)) {
        $moodle_instance = (int) $moodle_instance[1]['MOODLE_ID'];
    } else {
        return null;
    }
    $contexts = Moodle('Global/functions.php', 'local_getcontexts_get_contexts');
    $contextid = $contexts[0]['id'];
    $roleid = MOODLE_PARENT_ROLE_ID;
    $unassignments = array(array('roleid' => $roleid, 'userid' => $userid, 'contextid' => $contextid));
    return array($unassignments);
}
function GetStuListAttn(&$extra)
{
    global $contacts_RET, $view_other_RET, $_openSIS;
    if ((!$extra['SELECT_ONLY'] || strpos($extra['SELECT_ONLY'], 'GRADE_ID') !== false) && !$extra['functions']['GRADE_ID']) {
        $functions = array('GRADE_ID' => 'GetGrade');
    } else {
        $functions = array();
    }
    if ($extra['functions']) {
        $functions += $extra['functions'];
    }
    if (!$extra['DATE']) {
        $queryMP = UserMP();
        $extra['DATE'] = DBDate();
    } else {
        $queryMP = UserMP();
    }
    if ($_REQUEST['expanded_view'] == 'true') {
        if (!$extra['columns_after']) {
            $extra['columns_after'] = array();
        }
        #############################################################################################
        //Commented as it crashing for Linux due to  Blank Database tables
        #############################################################################################
        $view_address_RET = DBGet(DBQuery('SELECT VALUE FROM program_user_config WHERE PROGRAM=\'StudentFieldsView\' AND TITLE=\'ADDRESS\' AND USER_ID=\'' . User('STAFF_ID') . '\''));
        $view_address_RET = $view_address_RET[1]['VALUE'];
        $view_other_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE PROGRAM=\'StudentFieldsView\' AND TITLE IN (\'CONTACT_INFO\',\'HOME_PHONE\',\'GUARDIANS\',\'ALL_CONTACTS\') AND USER_ID=\'' . User('STAFF_ID') . '\''), array(), array('TITLE'));
        if (!count($view_fields_RET) && !isset($view_address_RET) && !isset($view_other_RET['CONTACT_INFO'])) {
            $extra['columns_after'] = array('CONTACT_INFO' => '<IMG SRC=assets/down_phone_button.gif border=0>', 'gender' => 'Gender', 'ethnicity' => 'Ethnicity', 'ADDRESS' => 'Mailing Address', 'CITY' => 'City', 'STATE' => 'State', 'ZIPCODE' => 'Zipcode') + $extra['columns_after'];
            $select = ',s.STUDENT_ID AS CONTACT_INFO,s.GENDER,s.ETHNICITY,a.STREET_ADDRESS_1 as ADDRESS,a.CITY,a.STATE,a.ZIPCODE';
            $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID AND a.TYPE=\'Mail\')  ' . $extra['FROM'];
            $functions['CONTACT_INFO'] = 'makeContactInfo';
            // if gender is converted to codeds type
            //$functions['CUSTOM_200000000'] = 'DeCodeds';
            $extra['singular'] = 'Student Address';
            $extra['plural'] = 'Student Addresses';
            $extra2['NoSearchTerms'] = true;
            $extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.STAFF_ID AS PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.RELATIONSHIP as STUDENT_RELATION,p.TITLE,s.PHONE,a.ID AS ADDRESS_ID ';
            $extra2['FROM'] .= ',student_address a LEFT OUTER JOIN students_join_people sjp ON (a.STUDENT_ID=sjp.STUDENT_ID AND (p.CUSTODY=\'Y\' OR sjp.IS_EMERGENCY=\'Y\')) LEFT OUTER JOIN people p ON (p.STAFF_ID=sjp.PERSON_ID) ';
            $extra2['WHERE'] .= ' AND a.STUDENT_ID=sjp.STUDENT_ID AND sjp.STUDENT_ID=ssm.STUDENT_ID ';
            $extra2['ORDER_BY'] .= 'COALESCE(p.CUSTODY,\'N\') DESC';
            $extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
            // EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
            if (!$_REQUEST['_openSIS_PDF']) {
                $expanded_view = $_REQUEST['expanded_view'];
                $_REQUEST['expanded_view'] = false;
                $addr = $_REQUEST['addr'];
                unset($_REQUEST['addr']);
                $contacts_RET = GetStuList($extra2);
                $_REQUEST['expanded_view'] = $expanded_view;
                $_REQUEST['addr'] = $addr;
            } else {
                unset($extra2['columns_after']['CONTACT_INFO']);
            }
        } else {
            if ($view_other_RET['CONTACT_INFO'][1]['VALUE'] == 'Y' && !$_REQUEST['_openSIS_PDF']) {
                $select .= ',NULL AS CONTACT_INFO ';
                $extra['columns_after']['CONTACT_INFO'] = '<IMG SRC=assets/down_phone_button.gif border=0>';
                $functions['CONTACT_INFO'] = 'makeContactInfo';
                $extra2 = $extra;
                $extra2['NoSearchTerms'] = true;
                $extra2['SELECT'] = '';
                $extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.STAFF_ID AS PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.RELATIONSHIP AS STUDENT_RELATION,p.TITLE,s.PHONE,a.ID AS ADDRESS_ID,COALESCE(p.CUSTODY,\'N\') ';
                $extra2['FROM'] .= ',student_address a LEFT OUTER JOIN students_join_people sjp ON (a.STUDENT_ID=sjp.STUDENT_ID AND (p.CUSTODY=\'Y\' OR sjp.IS_EMERGENCY=\'Y\')) LEFT OUTER JOIN people p ON (p.STAFF_ID=sjp.PERSON_ID)  ';
                $extra2['WHERE'] .= ' AND a.STUDENT_ID=sjp.STUDENT_ID AND sjp.STUDENT_ID=ssm.STUDENT_ID ';
                $extra2['ORDER_BY'] .= 'COALESCE(p.CUSTODY,\'N\') DESC';
                $extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
                $extra2['functions'] = array();
                $extra2['link'] = array();
                // EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
                $expanded_view = $_REQUEST['expanded_view'];
                $_REQUEST['expanded_view'] = false;
                $addr = $_REQUEST['addr'];
                unset($_REQUEST['addr']);
                $contacts_RET = GetStuList($extra2);
                $_REQUEST['expanded_view'] = $expanded_view;
                $_REQUEST['addr'] = $addr;
            }
            foreach ($view_fields_RET as $field) {
                $extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
                if ($field['TYPE'] == 'date') {
                    $functions['CUSTOM_' . $field['ID']] = 'ProperDate';
                } elseif ($field['TYPE'] == 'numeric') {
                    $functions['CUSTOM_' . $field['ID']] = 'removeDot00';
                } elseif ($field['TYPE'] == 'codeds') {
                    $functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
                }
                $select .= ',s.CUSTOM_' . $field['ID'];
            }
            if ($view_address_RET) {
                if ($view_address_RET == 'RESIDENCE') {
                    $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID AND a.TYPE=\'Home Address\')  ' . $extra['FROM'];
                } elseif ($view_address_RET == 'MAILING') {
                    $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID AND a.TYPE=\'Mail\') ' . $extra['FROM'];
                } elseif ($view_address_RET == 'BUS_PICKUP') {
                    $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (a.STUDENT_ID=a.STUDENT_ID AND a.BUS_PICKUP=\'Y\') ' . $extra['FROM'];
                } else {
                    $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (a.STUDENT_ID=a.STUDENT_ID AND a.BUS_DROPOFF=\'Y\') ' . $extra['FROM'];
                }
                $extra['columns_after'] += array('ADDRESS' => ucwords(strtolower(str_replace('_', ' ', $view_address_RET))) . ' Address', 'CITY' => 'City', 'STATE' => 'State', 'ZIPCODE' => 'Zipcode');
                $select .= ',a.ID AS ADDRESS_ID,a.STREET_ADDRESS_1 as ADDRESS,a.CITY,a.STATE,a.ZIPCODE,s.PHONE,ssm.STUDENT_ID AS PARENTS';
                $extra['singular'] = 'Student Address';
                $extra['plural'] = 'Student Addresses';
                if ($view_other_RET['HOME_PHONE'][1]['VALUE'] == 'Y') {
                    $functions['PHONE'] = 'makePhone';
                    $extra['columns_after']['PHONE'] = 'Home Phone';
                }
                if ($view_other_RET['GUARDIANS'][1]['VALUE'] == 'Y' || $view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
                    $functions['PARENTS'] = 'makeParents';
                    if ($view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
                        $extra['columns_after']['PARENTS'] = 'Contacts';
                    } else {
                        $extra['columns_after']['PARENTS'] = 'Guardians';
                    }
                }
            } elseif ($_REQUEST['addr'] || $extra['addr']) {
                $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID) ' . $extra['FROM'];
                $distinct = 'DISTINCT ';
            }
        }
        $extra['SELECT'] .= $select;
    } elseif ($_REQUEST['addr'] || $extra['addr']) {
        $extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID) ' . $extra['FROM'];
        $distinct = 'DISTINCT ';
    }
    switch (User('PROFILE')) {
        case 'admin':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',s.FIRST_NAME,\' \',COALESCE(s.MIDDLE_NAME,\' \')) AS FULL_NAME,';
                }
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array('(ssm.SYEAR=\'' . UserSyear() . '\' AND (ssm.START_DATE IS NOT NULL AND (\'' . date('Y-m-d', strtotime($extra['DATE'])) . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE ';
                }
            }
            $sql .= ' FROM students s,student_enrollment ssm ' . $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID ';
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= ' AND ssm.ID=(SELECT ID FROM student_enrollment WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<=\'' . UserSyear() . '\' ORDER BY START_DATE DESC LIMIT 1)';
            } else {
                $sql .= ' AND ssm.SYEAR=\'' . UserSyear() . '\' AND (ssm.START_DATE IS NOT NULL AND (\'' . date('Y-m-d', strtotime($extra['DATE'])) . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL)) ';
            }
            if (UserSchool() && $_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= ' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\'';
            } else {
                //
                $sql .= ' AND ssm.SCHOOL_ID IN (' . GetUserSchools(UserID(), true) . ') ';
                $extra['columns_after']['LIST_SCHOOL_ID'] = 'School';
                $functions['LIST_SCHOOL_ID'] = 'GetSchool';
            }
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = 'Status';
            }
            break;
        case 'teacher':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',s.FIRST_NAME,\' \',COALESCE(s.MIDDLE_NAME,\' \')) AS FULL_NAME,';
                }
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array('(ssm.START_DATE IS NOT NULL AND  (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE';
                    $sql .= ',' . db_case(array('(\'' . $extra['DATE'] . '\'>=ss.START_DATE AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE_SCHEDULE';
                }
            }
            //
            $sql .= ' FROM students s,course_periods cp,schedule ss,student_enrollment ssm,course_period_var cpv ' . $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID AND cpv.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cpv.ID="' . $extra['ID'] . '" AND ssm.STUDENT_ID=ss.STUDENT_ID AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SYEAR=cp.SYEAR AND ssm.SYEAR=ss.SYEAR AND ' . db_case(array(User('STAFF_ID'), 'cp.teacher_id', ' cp.teacher_id=' . User('STAFF_ID'), 'cp.secondary_teacher_id', ' cp.secondary_teacher_id=' . User('STAFF_ID'), 'cp.course_period_id IN(SELECT course_period_id from teacher_reassignment tra WHERE cp.course_period_id=tra.course_period_id AND tra.pre_teacher_id=' . User('STAFF_ID') . ')')) . ' AND cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\' AND cp.COURSE_ID=ss.COURSE_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID';
            if ($extra['cpvdate'] != '') {
                $sql .= $extra['cpvdate'];
            }
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= ' AND ssm.ID=(SELECT ID FROM student_enrollment WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR ORDER BY START_DATE DESC LIMIT 1)';
                $sql .= ' AND ss.START_DATE=(SELECT START_DATE FROM schedule WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR AND MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ') AND COURSE_ID=cp.COURSE_ID AND COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)';
            } else {
                $sql .= ' AND (ssm.START_DATE IS NOT NULL  AND \'' . $extra['DATE'] . '\'>=ssm.START_DATE AND (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))';
                $sql .= ' AND (\'' . $extra['DATE'] . '\'>=ss.START_DATE AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))';
            }
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = 'School Status';
                $extra['columns_after']['ACTIVE_SCHEDULE'] = 'Course Status';
            }
            break;
        case 'parent':
        case 'student':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',s.FIRST_NAME,\' \',COALESCE(s.MIDDLE_NAME,\' \')) AS FULL_NAME,';
                }
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
            }
            $sql .= ' FROM students s,student_enrollment ssm ' . $extra['FROM'] . '
					WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND (\'' . DBDate() . '\' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND \'' . DBDate() . '\'>ssm.START_DATE)) AND ssm.STUDENT_ID' . ($extra['ASSOCIATED'] ? ' IN (SELECT STUDENT_ID FROM students_join_users WHERE STAFF_ID=\'' . $extra['ASSOCIATED'] . '\')' : '=\'' . UserStudentID() . '\'');
            break;
        default:
            exit('Error');
    }
    $sql = appendSQL($sql, $extra);
    $sql .= $extra['WHERE'] . ' ';
    $sql .= CustomFields('where');
    if ($extra['GROUP']) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!$extra['ORDER_BY'] && !$extra['SELECT_ONLY']) {
        if (Preferences('SORT') == 'Grade') {
            $sql .= ' ORDER BY (SELECT SORT_ORDER FROM school_gradelevels WHERE ID=ssm.GRADE_ID),FULL_NAME';
        } else {
            $sql .= ' ORDER BY FULL_NAME';
        }
        $sql .= $extra['ORDER'];
    } elseif ($extra['ORDER_BY']) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    if ($extra['DEBUG'] === true) {
        echo '<!--' . $sql . '-->';
    }
    return DBGet(DBQuery($sql), $functions, $extra['group']);
}
    echo '' . _('Disable User') . '</TD><TD>:</TD><TD>' . CheckboxInput($staff['IS_DISABLE'], 'staff[IS_DISABLE]', '', 'CHECKED', $new, '<IMG SRC=assets/check.gif width=15>', '<IMG SRC=assets/x.gif width=15>');
    echo '</TD></TR>';
    echo '<TR><TD>';
    echo '' . _('Last Login') . '</TD><TD>:</TD><TD>' . NoInput(ProperDate(substr($staff['LAST_LOGIN'], 0, 10)) . substr($staff['LAST_LOGIN'], 10));
    echo '</TD></TR>';
    echo '<TR><TD>';
    echo '' . _('Staff ID') . '</TD><TD>:</TD><TD>' . NoInput($staff['STAFF_ID']);
    echo '</TD></TR>';
}
echo '</TR>';
echo '</table></td>';
echo '<TD>';
$UserPicturesPath = 'assets/UserPhotos/';
$profile = DBGet(DBQuery('SELECT PROFILE FROM staff WHERE STAFF_ID=\'' . UserStaffID() . '\' '));
if ($profile[1]['PROFILE'] != 'parent') {
    if ($_REQUEST['staff_id'] != 'new' && $UserPicturesPath && (($file = @fopen($picture_path = $UserPicturesPath . '/' . UserStudentID() . '.JPG', 'r')) || ($file = @fopen($picture_path = $UserPicturesPath . '/' . UserStaffID() . '.JPG', 'r')))) {
        fclose($file);
        echo '<div width=150 align="center"><IMG SRC="' . $picture_path . '?id=' . rand(6, 100000) . '" width=150 class=pic>';
        if (User('PROFILE') == 'admin' && User('PROFILE') != 'student' && User('PROFILE') != 'parent') {
            echo '<br><a href=Modules.php?modname=Users/UploadUserPhoto.php?modfunc=edit style="text-decoration:none"><b>' . _("Update Staff's Photo") . '</b></a></div>';
        } else {
            echo '';
        }
    } else {
        if ($_REQUEST['staff_id'] != 'new') {
            echo '<div align="center"><IMG SRC="assets/noimage.jpg?id=' . rand(6, 100000) . '" width=144 class=pic>';
            if (User('PROFILE') == 'admin' && User('PROFILE') != 'student' && User('PROFILE') != 'parent') {
                echo '<br><a href=Modules.php?modname=Users/UploadUserPhoto.php style="text-decoration:none"><b>' . _("Upload Staff's Photo") . '</b></a></div>';
            }
        } else {
            echo '';
Exemple #9
0
        $qr .= ' AND \'' . $st_date . '\' BETWEEN ea.start_date AND ea.end_date';
    } else {
        $st_date = date('Y-m-d');
        $qr .= ' AND \'' . $st_date . '\' BETWEEN ea.start_date AND ea.end_date';
    }
    $qr .= ' AND em.SYEAR=ea.SYEAR AND em.ACTIVITY_ID=ea.ID ORDER BY ea.START_DATE';
    $RET = DBGet(DBQuery($qr), array('START_DATE' => 'ProperDate', 'END_DATE' => 'ProperDate'));
    $activities_RET = DBGet(DBQuery('SELECT ID,TITLE FROM eligibility_activities WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
    if (count($activities_RET)) {
        foreach ($activities_RET as $value) {
            $activities[$value['ID']] = $value['TITLE'];
        }
    }
    $link['remove']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&start_date={$_REQUEST['start_date']}";
    $link['remove']['variables'] = array('activity_id' => 'ACTIVITY_ID');
    $link['add']['html']['TITLE'] = '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD>' . SelectInput('', 'new_activity', '', $activities) . ' </TD><TD>&nbsp;<INPUT type=submit value=Add class=btn_medium onclick=\'formload_ajax("elig_stud");\'></TD></TR></TABLE>';
    $link['add']['html']['remove'] = button('add');
    echo "<FORM action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&modfunc=add&start_date=" . strip_tags(trim($_REQUEST[start_date])) . " method=POST>";
    $columns = array('TITLE' => 'Activity', 'START_DATE' => 'Starts', 'END_DATE' => 'Ends');
    ListOutput($RET, $columns, 'Activity', 'Activities', $link);
    echo '</FORM>';
    echo '</TD><TD width=50% valign=top>';
    $RET = DBGet(DBQuery('SELECT e.ELIGIBILITY_CODE,c.TITLE as COURSE_TITLE FROM eligibility e,courses c,course_periods cp WHERE e.STUDENT_ID=\'' . UserStudentID() . '\' AND e.SYEAR=\'' . UserSyear() . '\' AND e.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cp.COURSE_ID=c.COURSE_ID AND e.SCHOOL_DATE BETWEEN \'' . date('Y-m-d', strtotime($start_date)) . '\' AND \'' . date('Y-m-d', strtotime($end_date)) . '\''), array('ELIGIBILITY_CODE' => '_makeLower'));
    $columns = array('COURSE_TITLE' => 'Course', 'ELIGIBILITY_CODE' => 'Grade');
    ListOutputNew($RET, $columns, 'Course', 'Courses');
    echo '</TD></TR></TABLE>';
}
function _makeLower($word)
{
    return ucwords(strtolower($word));
}
        $extra['functions']['PERIOD_' . $period['PERIOD_ID']] = '_makeCodePulldown';
        $extra['columns_after']['PERIOD_' . $period['PERIOD_ID']] = $period['SHORT_NAME'];
    }
    echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
    DrawHeader(ProgramTitle(), '<INPUT type=submit value=' . _('Update') . '>');
    if ($REQ_codes) {
        foreach ($REQ_codes as $code) {
            $code_pulldowns .= _makeCodeSearch($code);
        }
    } elseif ($abs) {
        $code_pulldowns = _makeCodeSearch('A');
    } else {
        $code_pulldowns = _makeCodeSearch();
    }
    if (UserStudentID()) {
        $current_student_link = "<A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=student&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}&year_date={$_REQUEST['year_date']}&student_id=" . UserStudentID() . ">Current Student</A></TD><TD>";
    }
    DrawHeader(PrepareDate($date, '_date'), '<TABLE><TR><TD>' . $current_student_link . button('add', '', "# onclick='javascript:addHTML(\"" . str_replace('"', '\\"', _makeCodeSearch()) . "\",\"code_pulldowns\"); return false;'") . '</TD><TD><DIV id=code_pulldowns>' . $code_pulldowns . '</DIV></TD></TR></TABLE>');
    $_REQUEST['search_modfunc'] = 'list';
    Search('student_id', $extra);
    echo "</FORM>";
}
function _makePhone($value, $column)
{
    global $THIS_RET, $contacts_RET;
    if (count($contacts_RET[$THIS_RET['STUDENT_ID']])) {
        foreach ($contacts_RET[$THIS_RET['STUDENT_ID']] as $person) {
            if ($person[1]['FIRST_NAME'] || $person[1]['LAST_NAME']) {
                $tipmessage .= '<B>' . $person[1]['STUDENT_RELATION'] . ': ' . $person[1]['FIRST_NAME'] . ' ' . $person[1]['LAST_NAME'] . '</B><BR>';
            }
            $tipmessage .= '<TABLE>';
function GetStuList(&$extra = array())
{
    global $contacts_RET, $view_other_RET, $_ROSARIO;
    if ((empty($extra['SELECT_ONLY']) || mb_strpos($extra['SELECT_ONLY'], 'GRADE_ID') !== false) && !isset($extra['functions']['GRADE_ID'])) {
        $functions = array('GRADE_ID' => 'GetGrade');
    } else {
        $functions = array();
    }
    if (isset($extra['functions'])) {
        $functions += $extra['functions'];
    }
    if (!isset($extra['MP']) && !isset($extra['DATE'])) {
        $extra['MP'] = UserMP();
        $extra['DATE'] = DBDate();
    } elseif (!$extra['MP']) {
        $extra['MP'] = GetCurrentMP('QTR', $extra['DATE'], false);
    } elseif (!$extra['DATE']) {
        $extra['DATE'] = DBDate();
    }
    if (isset($_REQUEST['expanded_view']) && $_REQUEST['expanded_view'] == 'true') {
        if (!$extra['columns_after']) {
            $extra['columns_after'] = array();
        }
        $view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM CUSTOM_FIELDS cf WHERE ((SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE TITLE=cast(cf.ID AS TEXT) AND PROGRAM='StudentFieldsView' AND USER_ID='" . User('STAFF_ID') . "')='Y'" . ($extra['student_fields']['view'] ? " OR cf.ID IN (" . $extra['student_fields']['view'] . ")" : '') . ") ORDER BY cf.SORT_ORDER,cf.TITLE"));
        $view_address_RET = DBGet(DBQuery("SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE='ADDRESS' AND USER_ID='" . User('STAFF_ID') . "'"));
        $view_address_RET = $view_address_RET[1]['VALUE'];
        $view_other_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE PROGRAM='StudentFieldsView' AND TITLE IN ('CONTACT_INFO','HOME_PHONE','GUARDIANS','ALL_CONTACTS') AND USER_ID='" . User('STAFF_ID') . "'"), array(), array('TITLE'));
        if (!count($view_fields_RET) && !isset($view_address_RET) && !isset($view_other_RET['CONTACT_INFO'])) {
            //modif Francois: add translation
            $extra['columns_after'] = array('CONTACT_INFO' => '<IMG SRC="assets/down_phone_button.png" width="24">', 'CUSTOM_200000000' => _('Gender'), 'CUSTOM_200000001' => _('Ethnicity'), 'ADDRESS' => _('Mailing Address'), 'CITY' => _('City'), 'STATE' => _('State'), 'ZIPCODE' => _('Zipcode')) + $extra['columns_after'];
            $select = ',ssm.STUDENT_ID AS CONTACT_INFO,s.CUSTOM_200000000,s.CUSTOM_200000001,coalesce(a.MAIL_ADDRESS,a.ADDRESS) AS ADDRESS,coalesce(a.MAIL_CITY,a.CITY) AS CITY,coalesce(a.MAIL_STATE,a.STATE) AS STATE,coalesce(a.MAIL_ZIPCODE,a.ZIPCODE) AS ZIPCODE ';
            $extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam.RESIDENCE='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
            $functions['CONTACT_INFO'] = 'makeContactInfo';
            $RET = DBGet(DBQuery("SELECT ID,TYPE FROM CUSTOM_FIELDS WHERE ID IN ('200000000','200000001')"), array(), array('ID'));
            // if gender and ethnicity are converted to codeds or exports type
            if ($RET['200000000'][1]['TYPE'] == 'codeds' || $RET['200000000'][1]['TYPE'] == 'exports') {
                $functions['CUSTOM_200000000'] = 'DeCodeds';
            }
            if ($RET['200000001'][1]['TYPE'] == 'codeds' || $RET['200000001'][1]['TYPE'] == 'exports') {
                $functions['CUSTOM_200000001'] = 'DeCodeds';
            }
            $extra['singular'] = 'Student Address';
            $extra['plural'] = 'Student Addresses';
            $extra2['NoSearchTerms'] = true;
            $extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
            $extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
            $extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
            $extra2['ORDER_BY'] .= 'sjp.CUSTODY';
            $extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
            // EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
            if (!isset($_REQUEST['_ROSARIO_PDF'])) {
                $expanded_view = $_REQUEST['expanded_view'];
                $_REQUEST['expanded_view'] = false;
                $addr = $_REQUEST['addr'];
                unset($_REQUEST['addr']);
                $contacts_RET = GetStuList($extra2);
                $_REQUEST['expanded_view'] = $expanded_view;
                $_REQUEST['addr'] = $addr;
            } else {
                unset($extra2['columns_after']['CONTACT_INFO']);
            }
        } else {
            if ($view_other_RET['CONTACT_INFO'][1]['VALUE'] == 'Y' && !isset($_REQUEST['_ROSARIO_PDF'])) {
                $select .= ',ssm.STUDENT_ID AS CONTACT_INFO ';
                $extra['columns_after']['CONTACT_INFO'] = '<IMG SRC="assets/down_phone_button.png" width="24">';
                $functions['CONTACT_INFO'] = 'makeContactInfo';
                $extra2 = $extra;
                $extra2['NoSearchTerms'] = true;
                $extra2['SELECT'] = '';
                $extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
                $extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
                $extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
                $extra2['ORDER_BY'] .= 'sjp.CUSTODY';
                $extra2['group'] = array('STUDENT_ID', 'PERSON_ID');
                $extra2['functions'] = array();
                $extra2['link'] = array();
                // EXPANDED VIEW AND ADDR BREAKS THIS QUERY ... SO, TURN 'EM OFF
                $expanded_view = $_REQUEST['expanded_view'];
                $_REQUEST['expanded_view'] = false;
                $addr = $_REQUEST['addr'];
                unset($_REQUEST['addr']);
                $contacts_RET = GetStuList($extra2);
                $_REQUEST['expanded_view'] = $expanded_view;
                $_REQUEST['addr'] = $addr;
            }
            foreach ($view_fields_RET as $field) {
                $extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
                if ($field['TYPE'] == 'date') {
                    $functions['CUSTOM_' . $field['ID']] = 'ProperDate';
                } elseif ($field['TYPE'] == 'numeric') {
                    $functions['CUSTOM_' . $field['ID']] = 'removeDot00';
                } elseif ($field['TYPE'] == 'codeds') {
                    $functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
                } elseif ($field['TYPE'] == 'exports') {
                    $functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
                }
                $select .= ',s.CUSTOM_' . $field['ID'];
            }
            if ($view_address_RET) {
                $extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID AND sam." . $view_address_RET . "='Y') LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
                $extra['columns_after'] += array('ADDRESS' => _(ucwords(mb_strtolower(str_replace('_', ' ', $view_address_RET)))) . ' ' . _('Address'), 'CITY' => _('City'), 'STATE' => _('State'), 'ZIPCODE' => _('Zipcode'));
                if ($view_address_RET != 'MAILING') {
                    $select .= ",a.ADDRESS_ID,a.ADDRESS,a.CITY,a.STATE,a.ZIPCODE,a.PHONE,ssm.STUDENT_ID AS PARENTS";
                } else {
                    $select .= ",a.ADDRESS_ID,coalesce(a.MAIL_ADDRESS,a.ADDRESS) AS ADDRESS,coalesce(a.MAIL_CITY,a.CITY) AS CITY,coalesce(a.MAIL_STATE,a.STATE) AS STATE,coalesce(a.MAIL_ZIPCODE,a.ZIPCODE) AS ZIPCODE,a.PHONE,ssm.STUDENT_ID AS PARENTS ";
                }
                $extra['singular'] = 'Student Address';
                $extra['plural'] = 'Student Addresses';
                if ($view_other_RET['HOME_PHONE'][1]['VALUE'] == 'Y') {
                    $functions['PHONE'] = 'makePhone';
                    $extra['columns_after']['PHONE'] = _('Home Phone');
                }
                if ($view_other_RET['GUARDIANS'][1]['VALUE'] == 'Y' || $view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
                    $functions['PARENTS'] = 'makeParents';
                    if ($view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
                        $extra['columns_after']['PARENTS'] = _('Contacts');
                    } else {
                        $extra['columns_after']['PARENTS'] = _('Guardians');
                    }
                }
            } elseif ($_REQUEST['addr'] || $extra['addr']) {
                $extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID " . $extra['STUDENTS_JOIN_ADDRESS'] . ") LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
                $distinct = 'DISTINCT ';
            }
        }
        $extra['SELECT'] .= $select;
    } else {
        if (isset($extra['student_fields']['view'])) {
            if (!$extra['columns_after']) {
                $extra['columns_after'] = array();
            }
            $view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM CUSTOM_FIELDS cf WHERE cf.ID IN (" . $extra['student_fields']['view'] . ") ORDER BY cf.SORT_ORDER,cf.TITLE"));
            foreach ($view_fields_RET as $field) {
                $extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
                if ($field['TYPE'] == 'date') {
                    $functions['CUSTOM_' . $field['ID']] = 'ProperDate';
                } elseif ($field['TYPE'] == 'numeric') {
                    $functions['CUSTOM_' . $field['ID']] = 'removeDot00';
                } elseif ($field['TYPE'] == 'codeds') {
                    $functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
                } elseif ($field['TYPE'] == 'exports') {
                    $functions['CUSTOM_' . $field['ID']] = 'DeCodeds';
                }
                $select .= ',s.CUSTOM_' . $field['ID'];
            }
            $extra['SELECT'] .= $select;
        }
        if (!empty($_REQUEST['addr']) || !empty($extra['addr'])) {
            $extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (ssm.STUDENT_ID=sam.STUDENT_ID " . $extra['STUDENTS_JOIN_ADDRESS'] . ") LEFT OUTER JOIN ADDRESS a ON (sam.ADDRESS_ID=a.ADDRESS_ID) " . $extra['FROM'];
            $distinct = 'DISTINCT ';
        }
    }
    switch (User('PROFILE')) {
        case 'admin':
            $sql = 'SELECT ';
            //$sql = 'SELECT '.$distinct;
            if (isset($extra['SELECT_ONLY'])) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if (isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array("(ssm.SYEAR='" . UserSyear() . "' AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND ('" . $extra['DATE'] . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE';
                }
            }
            $sql .= " FROM STUDENTS s JOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID";
            if (isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                //$sql .= " AND ssm.ID=(SELECT max(ID) FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<='".UserSyear()."')";
                $sql .= " AND ssm.ID=(SELECT ID FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<='" . UserSyear() . "' ORDER BY SYEAR DESC,START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ssm.SYEAR='" . UserSyear() . "' AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))";
            }
            if (UserSchool() && $_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= " AND ssm.SCHOOL_ID='" . UserSchool() . "'";
            } else {
                if (User('SCHOOLS')) {
                    $sql .= " AND ssm.SCHOOL_ID IN (" . mb_substr(str_replace(',', "','", User('SCHOOLS')), 2, -2) . ") ";
                }
                $extra['columns_after']['LIST_SCHOOL_ID'] = 'School';
                $functions['LIST_SCHOOL_ID'] = 'GetSchool';
            }
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            if (empty($extra['SELECT_ONLY']) && isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = _('Status');
            }
            break;
        case 'teacher':
            $sql = 'SELECT ';
            //$sql = 'SELECT '.$distinct;
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array("('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE';
                    $sql .= ',' . db_case(array("('" . $extra['DATE'] . "'>=ss.START_DATE AND (ss.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ss.END_DATE)) AND ss.MARKING_PERIOD_ID IN (" . GetAllMP($extra['MPTable'], $extra['MP']) . ")", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE_SCHEDULE';
                }
            }
            $sql .= " FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR='" . UserSyear() . "'";
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= " AND ss.START_DATE=(SELECT START_DATE FROM SCHEDULE WHERE STUDENT_ID=s.STUDENT_ID AND SYEAR=ss.SYEAR AND COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ss.MARKING_PERIOD_ID IN (" . GetAllMP($extra['MPTable'], $extra['MP']) . ") AND ('" . $extra['DATE'] . "'>=ss.START_DATE AND ('" . $extra['DATE'] . "'<=ss.END_DATE OR ss.END_DATE IS NULL))";
            }
            $sql .= ") JOIN COURSE_PERIODS cp ON (cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND " . ($extra['all_courses'] == 'Y' ? "cp.TEACHER_ID='" . User('STAFF_ID') . "'" : "cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "'") . ")\n\t\t\t\tJOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=ss.SYEAR AND ssm.SCHOOL_ID='" . UserSchool() . "'";
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= " AND ssm.ID=(SELECT ID FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))";
            }
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = _('School Status');
                $extra['columns_after']['ACTIVE_SCHEDULE'] = _('Course Status');
            }
            break;
        case 'parent':
        case 'student':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
            }
            $sql .= " FROM STUDENTS s JOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR='" . UserSyear() . "' AND ssm.SCHOOL_ID='" . UserSchool() . "'\n\t\t\t\t\tAND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE)) AND s.STUDENT_ID" . ($extra['ASSOCIATED'] ? " IN (SELECT STUDENT_ID FROM STUDENTS_JOIN_USERS WHERE STAFF_ID='" . $extra['ASSOCIATED'] . "')" : "='" . UserStudentID() . "'");
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            break;
        default:
            exit(_('Error'));
    }
    //$sql = appendSQL($sql,array('NoSearchTerms'=>$extra['NoSearchTerms']));
    $sql .= ' ' . $extra['WHERE'] . ' ';
    if (isset($extra['GROUP'])) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!isset($extra['ORDER_BY']) && !isset($extra['SELECT_ONLY'])) {
        $sql .= ' ORDER BY ';
        if (Preferences('SORT') == 'Grade') {
            $sql .= '(SELECT SORT_ORDER FROM SCHOOL_GRADELEVELS WHERE ID=ssm.GRADE_ID),';
        }
        // it would be easier to sort on full_name but postgres sometimes yields strange results
        $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME';
        $sql .= $extra['ORDER'];
    } elseif (isset($extra['ORDER_BY'])) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    //modif Francois: bugfix if PDF, dont echo SQL
    if (!isset($_REQUEST['_ROSARIO_PDF']) && 0) {
        //activate only for debug purpose
        echo '<!--' . $sql . '-->';
    }
    return DBGet(DBQuery($sql), $functions, $extra['group']);
}
Exemple #12
0
#  See license.txt.
#
#  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.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include '../../../RedirectIncludes.php';
include_once 'modules/students/includes/FunctionsInc.php';
$fields_RET = DBGet(DBQuery('SELECT ID,TITLE,TYPE,SELECT_OPTIONS,DEFAULT_SELECTION,REQUIRED,HIDE FROM custom_fields WHERE SYSTEM_FIELD = \'N\' AND CATEGORY_ID=\'' . $_REQUEST[category_id] . '\' ORDER BY SORT_ORDER,TITLE'));
if (UserStudentID()) {
    $custom_RET = DBGet(DBQuery('SELECT * FROM students WHERE STUDENT_ID=\'' . UserStudentID() . '\''));
    $value = $custom_RET[1];
}
$num_field_gen = true;
if (count($fields_RET)) {
    echo '<TABLE cellpadding=5>';
    $i = 1;
    foreach ($fields_RET as $field) {
        if ($field['HIDE'] == 'Y') {
            continue;
        }
        if ($field['REQUIRED'] == 'Y') {
            $req = '<font color=red>*</font> ';
        } else {
            $req = '';
        }
Exemple #13
0
                $error[] = $courses_RET[$course][1]['TITLE'] . ' does not have a weight of ' . $weight;
                unset($r_courses[$i]);
                continue;
            }
            $sql = "INSERT INTO SCHEDULE_REQUESTS (REQUEST_ID,SYEAR,SCHOOL_ID,STUDENT_ID,SUBJECT_ID,COURSE_ID,COURSE_WEIGHT,MARKING_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID,WITH_PERIOD_ID,NOT_PERIOD_ID)\n\t\t\t\t\t\tvalues(" . db_seq_nextval('SCHEDULE_REQUESTS_SEQ') . ",'" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $courses_RET[$course][1]['SUBJECT_ID'] . "','" . $course . "','" . $weight . "',NULL,'" . $_REQUEST['with_teacher'][$subject][$i] . "','" . $_REQUEST['without_teacher'][$subject][$i] . "','" . $_REQUEST['with_period'][$subject][$i] . "','" . $_REQUEST['without_period'][$subject][$i] . "')";
            DBQuery($sql);
        }
    }
    echo ErrorMessage($error, 'Error');
    $_SCHEDULER['student_id'] = UserStudentID();
    $_SCHEDULER['dont_run'] = true;
    include 'modules/Scheduling/Scheduler.php';
    $_REQUEST['modfunc'] = 'choose';
}
if ($_REQUEST['modfunc'] == 'choose') {
    $QI = DBQuery("SELECT SUBJECT_ID,COURSE_ID,COURSE_WEIGHT,WITH_PERIOD_ID,NOT_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID FROM SCHEDULE_REQUESTS WHERE SYEAR='" . UserSyear() . "' AND STUDENT_ID='" . UserStudentID() . "'");
    $requests_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery("SELECT SUBJECT_ID,TITLE FROM COURSE_SUBJECTS WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY TITLE");
    $subjects_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery("SELECT DISTINCT COURSE_ID,TITLE,SUBJECT_ID FROM COURSES WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'");
    $courses_RET = DBGet($QI, array(), array('SUBJECT_ID', 'COURSE_ID'));
    $QI = DBQuery("SELECT DISTINCT c.SUBJECT_ID,cw.COURSE_WEIGHT FROM COURSE_WEIGHTS cw,COURSES c WHERE c.COURSE_ID=cw.COURSE_ID AND c.SCHOOL_ID='" . UserSchool() . "' AND c.SYEAR='" . UserSyear() . "'");
    $weights_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery("SELECT COURSE_WEIGHT,COURSE_ID FROM COURSE_WEIGHTS WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'");
    $course_weights_RET = DBGet($QI, array(), array('COURSE_ID'));
    $QI = DBQuery("SELECT COURSE_WEIGHT,COURSE_ID,TEACHER_ID,PERIOD_ID FROM COURSE_PERIODS WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'");
    $periods_RET = DBGet($QI, array(), array('COURSE_ID', 'COURSE_WEIGHT'));
    $__DBINC_NO_SQLSHOW = true;
    echo "<script language=javascript>\n";
    foreach ($subjects_RET as $key => $value) {
        $html[$key] = "<TABLE><TR><TD width=10></TD><TD><SELECT name=courses[{$key}][]><OPTION value=''>Not Specified</OPTION>";
Exemple #14
0
     echo "<div class=break></div>";
     if (AllowEdit()) {
         unset($_REQUEST);
         $_REQUEST['modname'] = 'scheduling/Schedule.php';
         $_REQUEST['search_modfunc'] = 'list';
         $extra['link']['FULL_NAME']['link'] = 'Modules.php?modname=scheduling/Requests.php';
         $extra['link']['FULL_NAME']['variables'] = array('subject_id' => 'SUBJECT_ID', 'course_id' => 'COURSE_ID');
         include 'modules/scheduling/UnfilledRequests.php';
     }
 }
 if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'choose_course') {
     if (!isset($_REQUEST['confirm_cid']) || !$_REQUEST['sel_course_period']) {
         include "modules/scheduling/MultiCoursesforWindow.php";
     } else {
         foreach ($_REQUEST['sel_course_period'] as $ses_cpid => $select_cpid) {
             DBQuery("INSERT INTO schedule (SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,MODIFIED_DATE,MODIFIED_BY,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID) values('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $date . "','" . $date . "','" . User('STAFF_ID') . "','" . clean_param($_SESSION['crs_id'][$ses_cpid], PARAM_INT) . "','" . clean_param($select_cpid, PARAM_INT) . "','" . clean_param($_SESSION['mp'][$ses_cpid], PARAM_ALPHA) . "','" . clean_param(GetCpDet($ses_cpid, 'MARKING_PERIOD_ID') != '' ? $_SESSION['marking_period_id'][$ses_cpid] : GetMPId('FY'), PARAM_INT) . "')");
             DBQuery('UPDATE course_periods SET FILLED_SEATS=FILLED_SEATS+1 WHERE COURSE_PERIOD_ID=\'' . clean_param($select_cpid, PARAM_INT) . '\'');
         }
         unset($_SESSION['course_period']);
         unset($_SESSION['crs_id']);
         unset($_SESSION['marking_period_id']);
         unset($_SESSION['mp']);
         echo "<script language=javascript>opener.document.location = 'Modules.php?modname=" . clean_param($_REQUEST['modname'], PARAM_NOTAGS) . "&time=" . time() . "';window.close();</script>";
     }
 }
 if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'more_info') {
     $sql = 'SELECT
                             s.COURSE_ID,s.COURSE_PERIOD_ID,
                             s.MARKING_PERIOD_ID,s.START_DATE,s.END_DATE,s.MODIFIED_DATE,s.MODIFIED_BY,
                             UNIX_TIMESTAMP(s.START_DATE) AS START_EPOCH,UNIX_TIMESTAMP(s.END_DATE) AS END_EPOCH,sp.PERIOD_ID,
                             cpv.PERIOD_ID,cp.MARKING_PERIOD_ID as COURSE_MARKING_PERIOD_ID,cp.MP,sp.SORT_ORDER,
Exemple #15
0
 $b = $cus['ID'];
 if ($_REQUEST['category'][$b]) {
     $custom_RET = DBGet(DBQuery("SELECT * FROM students WHERE STUDENT_ID='" . UserStudentID() . "'"));
     $value = $custom_RET[1];
     echo "<table width=100% >";
     if ($value['CUSTOM_' . $cus['ID1']] != '') {
         echo "<tr><td colspan=2 style=\"border-bottom:1px solid #333;  font-size:14px;  font-weight:bold;\">" . $cus['TITLE1'] . "</td></tr>";
     }
     if (count($fields_RET)) {
         $i = 1;
         foreach ($fields_RET as $field) {
             if ($value['CUSTOM_' . $field['ID']] != '') {
                 $date = DBGet(DBQuery("SELECT type,id FROM custom_fields WHERE ID='" . $field['ID'] . "'"));
                 foreach ($date as $da) {
                     if ($da['TYPE'] == 'date') {
                         $sql = DBGet(DBQuery("SELECT CUSTOM_" . $da['ID'] . " as DATE FROM students WHERE STUDENT_ID='" . UserStudentID() . "'"), array('DATE' => 'ProperDate'));
                         foreach ($sql as $sq) {
                             echo '<TR>';
                             echo '<td width=125px style="font-weight:bold">' . $field['TITLE'] . ':</td>';
                             echo '<td class=cell_medium>' . $sq['DATE'] . '';
                             echo '</TD>';
                             echo '</TR>';
                         }
                     } else {
                         echo '<TR>';
                         echo '<td width=125px style="font-weight:bold">' . $field['TITLE'] . ':</td><td>';
                         echo _makeTextInput('CUSTOM_' . $field['ID'], '', 'class=cell_medium');
                         echo '</TD>';
                         echo '</TR>';
                     }
                 }
Exemple #16
0
     foreach ($profile as $k => $v) {
         $_arr['USERNAME'] = $userlist[$key]['USERNAME'];
         $_arr['LAST_NAME'] = $userlist[$key]['LAST_NAME'];
         $_arr['USER_ID'] = $profile[$k]['STUDENT_ID'];
         $_arr['FIRST_NAME'] = $userlist[$key]['LAST_NAME'] . ' ' . $userlist[$key]['FIRST_NAME'];
         $_arr['PROFILE_ID'] = $profile[$k]['PROFILE'];
         $_arr['IS_DISABLE'] = $userlist[$key]['IS_DISABLE'];
         array_push($final_arr, $_arr);
     }
 } else {
     if ($userlist[$key]['PROFILE_ID'] == 4) {
         //                        $sql = "select student_id from  students_join_people where person_id=".$userlist[$key]['USER_ID'];
         //                        $fetch = DBGet(DBQuery($sql));
         //                        foreach($fetch as $k1=>$v1){
         if (User('PROFILE') == 'student') {
             $select = "SELECT se.*,up.* FROM student_enrollment se,user_profiles up WHERE up.ID=" . $userlist[$key]['PROFILE_ID'] . " and se.school_id=" . UserSchool() . " AND se.student_id=" . UserStudentID() . "";
         }
         if (User('PROFILE') == 'teacher') {
             $select = "SELECT se.*,up.* FROM student_enrollment se,user_profiles up WHERE up.ID=" . $userlist[$key]['PROFILE_ID'] . " and se.school_id=" . UserSchool() . " AND se.student_id in (select schedule.student_id from  schedule,course_periods,students_join_people where course_periods.course_period_id=schedule.course_period_id  and  schedule.student_id=students_join_people.student_id and students_join_people.person_id=" . $userlist[$key]['USER_ID'] . " and teacher_id=" . UserID() . ")";
         } else {
             $select = "SELECT se.*,up.* FROM student_enrollment se,user_profiles up WHERE up.ID=" . $userlist[$key]['PROFILE_ID'] . " and se.school_id=" . UserSchool() . " AND se.student_id in (select student_id from  students_join_people where person_id=" . $userlist[$key]['USER_ID'] . ")";
         }
         $profile = DBGet(DBQuery($select));
         foreach ($profile as $k => $v) {
             $_arr['USERNAME'] = $userlist[$key]['USERNAME'];
             $_arr['LAST_NAME'] = $userlist[$key]['LAST_NAME'];
             $_arr['USER_ID'] = $userlist[$key]['USER_ID'];
             $_arr['FIRST_NAME'] = $userlist[$key]['LAST_NAME'] . ' ' . $userlist[$key]['FIRST_NAME'];
             $_arr['PROFILE_ID'] = $profile[$k]['PROFILE'];
             $_arr['IS_DISABLE'] = $userlist[$key]['IS_DISABLE'];
             array_push($final_arr, $_arr);
function VerifyStudentSchedule($course_RET, $student_id = '')
{
    if ($student_id == '') {
        $student_id = UserStudentID();
    }
    if (!$course_RET) {
        return 'Incomplete course period';
    }
    if ($course_RET[1]['TOTAL_SEATS'] - $course_RET[1]['FILLED_SEATS'] <= 0) {
        return 'Seat not available';
    }
    $student_RET = DBGet(DBQuery("SELECT LEFT(GENDER,1) AS GENDER FROM students WHERE STUDENT_ID='" . $student_id . "'"));
    $student = $student_RET[1];
    if ($course_RET[1]['GENDER_RESTRICTION'] != 'N' && $course_RET[1]['GENDER_RESTRICTION'] != $student['GENDER']) {
        return 'There is gender restriction';
    }
    $do_check = false;
    foreach ($course_RET as $course) {
        if ($course['IGNORE_SCHEDULING'] != 'Y') {
            $do_check = true;
            break;
        }
    }
    if ($do_check == false) {
        return true;
    }
    $teacher = $course_RET[1]['TEACHER_ID'];
    $mp_id = $course_RET[1]['MARKING_PERIOD_ID'];
    //$start_date=$course_RET[1]['BEGIN_DATE'];
    $end_date = $course_RET[1]['END_DATE'];
    $start_date = date('Y-m-d');
    $mp_append_sql = " AND s.start_date<='{$end_date}' AND ('{$start_date}'<=s.end_date OR s.end_date IS NULL)";
    if ($course_RET[1]['SCHEDULE_TYPE'] == 'FIXED') {
        $days = $course_RET[1]['DAYS'];
        $start_time = $course_RET[1]['START_TIME'];
        $end_time = $course_RET[1]['END_TIME'];
        $period_days_append_sql = " AND course_period_id IN(SELECT course_period_id from course_period_var cpv,school_periods sp WHERE cpv.period_id=sp.period_id AND ignore_scheduling IS NULL AND sp.start_time<='{$end_time}' AND '{$start_time}'<=sp.end_time AND (";
        $days_arr = str_split($days);
        foreach ($days_arr as $day) {
            $period_days_append_sql .= "DAYS LIKE '%{$day}%' OR ";
        }
        $period_days_append_sql = substr($period_days_append_sql, 0, -4) . '))';
    } elseif ($course_RET[1]['SCHEDULE_TYPE'] == 'VARIABLE') {
        $period_days_append_sql = " AND course_period_id IN(SELECT course_period_id from course_period_var cpv,school_periods sp WHERE cpv.period_id=sp.period_id AND ignore_scheduling IS NULL AND (";
        foreach ($course_RET as $period_day) {
            $period_days_append_sql .= "(sp.start_time<='{$period_day['END_TIME']}' AND '{$period_day['START_TIME']}'<=sp.end_time AND DAYS LIKE '%{$period_day['DAYS']}%') OR ";
        }
        $period_days_append_sql = substr($period_days_append_sql, 0, -4) . '))';
    } elseif ($course_RET[1]['SCHEDULE_TYPE'] == 'BLOCKED') {
        $period_days_append_sql = " AND course_period_id IN(SELECT course_period_id from course_period_var cpv,school_periods sp WHERE cpv.period_id=sp.period_id AND ignore_scheduling IS NULL AND (";
        foreach ($course_RET as $period_date) {
            $period_days_append_sql .= "(sp.start_time<='{$period_date['END_TIME']}' AND '{$period_date['START_TIME']}'<=sp.end_time AND IF(course_period_date IS NULL, DAYS LIKE '%{$period_date['DAYS']}%',course_period_date='{$period_date['COURSE_PERIOD_DATE']}')) OR ";
        }
        $period_days_append_sql = substr($period_days_append_sql, 0, -4) . '))';
    }
    $exist_RET = DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=" . $student_id . "{$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=" . $student_id . "{$mp_append_sql}{$period_days_append_sql}"));
    if ($exist_RET) {
        return 'There is a Period Conflict (' . $course_RET[1]['CP_TITLE'] . ')';
    } else {
        return true;
    }
}
			FROM
				schedule s,courses c,course_periods cp,course_period_var cpv,school_periods sp
			WHERE
				s.COURSE_ID = c.COURSE_ID AND s.COURSE_ID = cp.COURSE_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
				AND s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cpv.PERIOD_ID = sp.PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\'
				AND s.SYEAR = c.SYEAR AND cp.MARKING_PERIOD_ID IN (' . GetAllMP('QTR', UserMP()) . ')
				AND s.STUDENT_ID=\'' . UserStudentID() . '\' AND s.SYEAR=\'' . UserSyear() . '\'
				AND (\'' . DBDate() . '\' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)
			ORDER BY sp.SORT_ORDER
			';
        $schedule_RET = DBGet(DBQuery($sql));
        $sql = 'SELECT ap.SCHOOL_DATE,ap.PERIOD_ID,ac.SHORT_NAME,ac.STATE_CODE,ac.DEFAULT_CODE FROM attendance_period ap,attendance_codes ac WHERE ap.SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND ap.ATTENDANCE_CODE=ac.ID AND ap.STUDENT_ID=\'' . UserStudentID() . '\'';
        $attendance_RET = DBGet(DBQuery($sql), array(), array('SCHOOL_DATE', 'PERIOD_ID'));
    } else {
        $schedule_RET[1] = array('COURSE_PERIOD' => 'Daily Attendance', 'PERIOD_ID' => '0');
        $attendance_RET = DBGet(DBQuery('SELECT ad.SCHOOL_DATE,\'0\' AS PERIOD_ID,ad.STATE_VALUE AS STATE_CODE,' . db_case(array('ad.STATE_VALUE', "'0.0'", "'A'", "'1.0'", "'P'", "'H'")) . ' AS SHORT_NAME FROM attendance_day ad WHERE ad.SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND ad.STUDENT_ID=\'' . UserStudentID() . '\''), array(), array('SCHOOL_DATE', 'PERIOD_ID'));
    }
    $i = 0;
    if (count($schedule_RET)) {
        foreach ($schedule_RET as $course) {
            $i++;
            $student_RET[$i]['TITLE'] = $course['COURSE_PERIOD'];
            foreach ($cal_RET as $value) {
                $student_RET[$i][$value['SHORT_DATE']] = _makePeriodColor($attendance_RET[$value['SCHOOL_DATE']][$course['PERIOD_ID']][1]['SHORT_NAME'], $attendance_RET[$value['SCHOOL_DATE']][$course['PERIOD_ID']][1]['STATE_CODE'], $attendance_RET[$value['SCHOOL_DATE']][$course['PERIOD_ID']][1]['DEFAULT_CODE']);
            }
        }
    }
    $columns = array('TITLE' => 'Course');
    if (count($cal_RET)) {
        foreach ($cal_RET as $value) {
            $columns[$value['SHORT_DATE']] = ShortDate($value['SCHOOL_DATE']);
Exemple #19
0
$grades_RET = DBGet($QI);
unset($options);
if (count($grades_RET)) {
    foreach ($grades_RET as $value) {
        $options[$value['ID']] = $value['TITLE'];
    }
}
if ($_REQUEST['student_id'] != 'new' && $student['SCHOOL_ID'] != UserSchool()) {
    $allow_edit = $_openSIS['allow_edit'];
    $AllowEdit = $_openSIS['AllowEdit'][$_REQUEST['modname']];
    $_openSIS['AllowEdit'][$_REQUEST['modname']] = $_openSIS['allow_edit'] = false;
}
if ($_REQUEST['student_id'] == 'new') {
    $student_id = 'new';
} else {
    $student_id = UserStudentID();
}
if ($student_id == 'new' && !VerifyDate($_REQUEST['day_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['month_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['year_values']['student_enrollment']['new']['START_DATE'])) {
    unset($student['GRADE_ID']);
}
echo SelectInput($student['GRADE_ID'], 'values[student_enrollment][' . $student_id . '][GRADE_ID]', (!$student['GRADE_ID'] ? '<FONT color=red>' : '') . '' . (!$student['GRADE_ID'] ? '</FONT>' : ''), $options, '', '');
echo '</td></tr>';
echo '</table>';
echo '</td></TR>';
echo '<TR><td height="30px" colspan=2 class=hseparator><b>Access Information</b></td></tr><tr><td colspan="2">';
echo '<TABLE border=0>';
echo '<tr><td style=width:120px>Username</td><td>:</td><td>';
echo TextInput($student['USERNAME'], 'students[USERNAME]', '', 'class=cell_medium onkeyup="usercheck_init_student(this)"');
echo '<span id="ajax_output_st"></span>';
echo '</td></tr>';
echo '<tr><td>Password</td><td>:</td><td>';
Exemple #20
0
 if (is_array($extra['columns_before'])) {
     $columns = $extra['columns_before'] + $LO_columns;
     $LO_columns = $columns;
 }
 if (is_array($extra['columns_after'])) {
     $columns = $LO_columns + $extra['columns_after'];
 }
 if (!$extra['columns_before'] && !$extra['columns_after']) {
     $columns = $LO_columns;
 }
 if (count($students_RET) > 1 || $link['add'] || !$link['FULL_NAME'] || $extra['columns_before'] || $extra['columns_after'] || $extra['BackPrompt'] == false && count($students_RET) == 0 || $extra['Redirect'] === false && count($students_RET) == 1) {
     $tmp_REQUEST = $_REQUEST;
     unset($tmp_REQUEST['expanded_view']);
     if ($_REQUEST['expanded_view'] != 'true' && !UserStudentID() && count($students_RET) != 0) {
         DrawHeader("<div><A HREF=" . PreparePHP_SELF($tmp_REQUEST) . "&expanded_view=true class=big_font ><img src=\"themes/Blue/expanded_view.png\" />Expanded View</A></div><div class=break ></div>", $extra['header_right']);
     } elseif (!UserStudentID() && count($students_RET) != 0) {
         DrawHeader("<div><A HREF=" . PreparePHP_SELF($tmp_REQUEST) . "&expanded_view=false class=big_font><img src=\"themes/Blue/expanded_view.png\" />Original View</A></div><div class=break ></div>", $extra['header_right']);
     }
     DrawHeader($extra['extra_header_left'], $extra['extra_header_right']);
     DrawHeader(str_replace('<BR>', '<BR> &nbsp;', substr($_CENTRE['SearchTerms'], 0, -4)));
     if ($_REQUEST['LO_save'] != '1' && !$extra['suppress_save']) {
         $_SESSION['List_PHP_SELF'] = PreparePHP_SELF($_SESSION['_REQUEST_vars']);
         echo '<script language=JavaScript>parent.help.location.reload();</script>';
     }
     if (!$extra['singular'] || !$extra['plural']) {
         if ($_REQUEST['address_group']) {
             $extra['singular'] = 'Family';
             $extra['plural'] = 'Families';
         } else {
             $extra['singular'] = 'Student';
             $extra['plural'] = 'Students';
        $RET[$in]['START_DATE'] = $get_SEC == 'TrnD' ? date('M/d/Y', strtotime($RET[$in]['START_DATE'])) : _makeEnrollmentDates('START_DATE', $date_counter, $value);
        $date_counter = $date_counter + 1;
        $RET[$in]['END_DATE'] = $get_SEC == 'TrnD' ? date('M/d/Y', strtotime($RET[$in]['END_DATE'])) : _makeEnrollmentDates('END_DATE', $date_counter, $value);
        $date_counter = $date_counter + 1;
    }
}
$columns = array('START_DATE' => 'Start Date ', 'ENROLLMENT_CODE' => 'Enrollment Code', 'END_DATE' => 'Drop Date', 'DROP_CODE' => 'Drop Code', 'SCHOOL_ID' => 'School');
$schools_RET = DBGet(DBQuery('SELECT ID,TITLE FROM schools WHERE ID!=\'' . UserSchool() . '\''));
$next_school_options = array(UserSchool() => 'Next grade at current school', '0' => 'Retain', '-1' => 'Do not enroll after this school year');
if (count($schools_RET)) {
    foreach ($schools_RET as $school) {
        $next_school_options[$school['ID']] = $school['TITLE'];
    }
}
if (!UserSchool()) {
    $user_school_RET = DBGet(DBQuery('SELECT SCHOOL_ID FROM student_enrollment WHERE STUDENT_ID=\'' . UserStudentID() . '\' LIMIT 1'));
    $_SESSION['UserSchool'] = $user_school_RET[1]['SCHOOL_ID'];
}
$calendars_RET = DBGet(DBQuery('SELECT CALENDAR_ID,DEFAULT_CALENDAR,TITLE FROM school_calendars WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY DEFAULT_CALENDAR DESC'));
if (count($calendars_RET)) {
    foreach ($calendars_RET as $calendar) {
        $calendar_options[$calendar['CALENDAR_ID']] = $calendar['TITLE'];
    }
}
if ($_REQUEST['student_id'] != 'new') {
    if (count($RET)) {
        $id = $RET[count($RET)]['ID'];
    } else {
        $id = 'new';
    }
    if ($id != 'new') {
Exemple #22
0
            echo '<table><TR><td style=width:120px>' . _('Address Line 1') . '</td><td>:</td><TD>' . TextInput($this_address['ADDN_ADDRESS'], 'values[students_join_people][ADDN_ADDRESS]', '', 'class=cell_medium') . '</TD></td>';
            #echo '<table><TR><td style=width:120px>Address Line 1</td><td>:</td><TD><table cellspacing=0 cellpadding=0><tr><td>'.TextInput($this_address['SEC_ADDRESS'],'values[address][SEC_ADDRESS]','','class=cell_medium').'</TD><td>';
            echo '<TR><td>' . _('Address Line 2') . '</td><td>:</td><TD>' . TextInput($this_contact['ADDN_STREET'], 'values[students_join_people][ADDN_STREET]', '', 'class=cell_medium') . '</TD></tr>';
            echo '<TR><td>' . _('City') . '</td><td>:</td><TD>' . TextInput($this_contact['ADDN_CITY'], 'values[students_join_people][ADDN_CITY]', '', 'class=cell_medium') . '</TD></tr>';
            echo '<TR><td>' . _('State') . '</td><td>:</td><TD>' . TextInput($this_contact['ADDN_STATE'], 'values[students_join_people][ADDN_STATE]', '', 'class=cell_medium') . '</TD></tr>';
            echo '<TR><td>' . _('Zip/Postal Code') . '</td><td>:</td><TD>' . TextInput($this_contact['ADDN_ZIPCODE'], 'values[students_join_people][ADDN_ZIPCODE]', '', 'class=cell_medium') . '</TD></tr>';
            echo '<TR><TD>' . _('School Bus Pick-up') . '</TD><td>:</td><TD>' . CheckboxInput($this_contact['ADDN_BUS_PICKUP'], 'values[students_join_people][ADDN_BUS_PICKUP]', '', 'CHECKED', $new, '<IMG SRC=assets/check.gif width=15>', '<IMG SRC=assets/x.gif width=15>') . '</TD></tr>';
            echo '<TR><TD>' . _('School Bus Drop-off') . '</TD><td>:</td><TD>' . CheckboxInput($this_contact['ADDN_BUS_DROPOFF'], 'values[students_join_people][ADDN_BUS_DROPOFF]', '', 'CHECKED', $new, '<IMG SRC=assets/check.gif width=15>', '<IMG SRC=assets/x.gif width=15>') . '</TD></tr>';
            echo '<TR><td>' . _('Bus No') . '</TD><td>:</td><td>' . TextInput($this_contact['ADDN_BUSNO'], 'values[students_join_people][ADDN_BUSNO]', '', 'class=cell_small') . '</TD></tr>';
            echo '</table></div></td></tr></table>';
            echo '</FIELDSET>';
            echo '</TD></TR>';
            echo '</TABLE>';
        }
    } elseif ($_REQUEST['person_id'] == 'old') {
        $people_RET = DBGet(DBQuery('SELECT PERSON_ID,FIRST_NAME,LAST_NAME FROM people WHERE PERSON_ID NOT IN (SELECT PERSON_ID FROM students_join_people WHERE STUDENT_ID=\'' . UserStudentID() . '\') ORDER BY LAST_NAME,FIRST_NAME'));
        foreach ($people_RET as $people) {
            $people_select[$people['PERSON_ID']] = $people['LAST_NAME'] . ', ' . $people['FIRST_NAME'];
        }
        echo SelectInput('', 'values[EXISTING][person_id]', $title = 'Select Person', $people_select);
    }
    if ($_REQUEST['person_id'] == 'new') {
        echo '</TD></TR>';
        echo '</TABLE>';
        // end of table 2
    }
    unset($_REQUEST['address_id']);
    unset($_REQUEST['person_id']);
}
echo '</TD></TR>';
echo '</TABLE>';
 $b = $cus['ID'];
 if ($_REQUEST['category'][$b]) {
     $custom_RET = DBGet(DBQuery("SELECT * FROM STUDENTS WHERE STUDENT_ID='" . UserStudentID() . "'"));
     $value = $custom_RET[1];
     echo "<table width=100% >";
     if ($value['CUSTOM_' . $cus['ID1']] != '') {
         echo "<tr><td colspan=2 style=\"border-bottom:1px solid #333;  font-size:14px;  font-weight:bold;\">" . $cus['TITLE1'] . "</td></tr>";
     }
     if (count($fields_RET)) {
         $i = 1;
         foreach ($fields_RET as $field) {
             if ($value['CUSTOM_' . $field['ID']] != '') {
                 $date = DBGet(DBQuery("SELECT type,id FROM CUSTOM_FIELDS WHERE ID='" . $field['ID'] . "'"));
                 foreach ($date as $da) {
                     if ($da['TYPE'] == 'date') {
                         $sql = DBGet(DBQuery("SELECT DATE_FORMAT(CUSTOM_" . $da['ID'] . ",'%b-%d-%Y') as DATE FROM STUDENTS WHERE STUDENT_ID='" . UserStudentID() . "'"));
                         foreach ($sql as $sq) {
                             // echo $sq['DATE'];
                             echo '<TR>';
                             echo '<td width=125px style="font-weight:bold">' . $field['TITLE'] . ':</td>';
                             echo '<td class=cell_medium>' . $sq['DATE'] . '';
                             echo '</TD>';
                             echo '</TR>';
                         }
                     } else {
                         echo '<TR>';
                         echo '<td width=125px style="font-weight:bold">' . $field['TITLE'] . ':</td><td>';
                         echo _makeTextInput('CUSTOM_' . $field['ID'], '', 'class=cell_medium');
                         echo '</TD>';
                         echo '</TR>';
                     }
 $dir = dir($dir);
 echo '<tbody>';
 $found = false;
 $gridClass = "odd";
 while ($filename = $dir->read()) {
     if ($gridClass == "even") {
         $gridClass = "odd";
     } else {
         $gridClass = "even";
     }
     if ($filename) {
         if ($filename == '.' || $filename == '..') {
             continue;
         }
         $student_id_up = explode('-', $filename);
         if ($student_id_up[0] == UserStudentID()) {
             $found = true;
             echo "<br>";
             echo "<br>";
             $sub = substr($filename, strpos($filename, '-') + 1);
             if (strstr($sub, '-_')) {
                 $file_display = substr($sub, 0, strrpos($sub, '-_'));
             } else {
                 $file_display = $sub;
             }
             echo '<tr class="' . $gridClass . '">
                   <td><a target="new" href="assets/studentfiles/' . $filename . '">' . str_replace("opensis_space_here", " ", $file_display) . '</a></td>
                   ';
             if (AllowEdit()) {
                 echo '<td><input type="hidden" name="del" value="assets/studentfiles/' . $filename . '"/>
                   <a href=Modules.php?modname=' . $_REQUEST[modname] . '&include=FilesInc&file=assets/studentfiles/' . urlencode($filename) . '&modfunc=delete><img src="assets/remove_button.gif" border=0 vspace=0></a>
#
#  This program is released under the terms of the GNU General Public License as
#  published by the Free Software Foundation, version 2 of the License.
#  See license.txt.
#
#  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.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include '../../Redirect_modules.php';
$requests_RET = DBGet(DBQuery("SELECT concat(r.COURSE_ID, '_', r.COURSE_WEIGHT) AS CRS,\r\n\t\t\t\t\tr.COURSE_ID,r.COURSE_WEIGHT,cp.COURSE_PERIOD_ID,\r\n\t\t\t\t\tc.TITLE AS COURSE_TITLE,cp.PERIOD_ID,\r\n\t\t\t\t\t(cp.TOTAL_SEATS-cp.FILLED_SEATS) AS OPEN_SEATS,s.STUDENT_ID AS SCHEDULED\r\n\t\t\t\tFROM SCHEDULE_REQUESTS r,\r\n\t\t\t\tCOURSES c,SCHOOL_PERIODS sp,\r\n\t\t\t\tCOURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON \r\n\t\t\t\t\t(s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='" . UserStudentID() . "')\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tr.SYEAR='" . UserSyear() . "' AND r.SCHOOL_ID='" . UserSchool() . "'\r\n\t\t\t\t\tAND r.COURSE_ID=cp.COURSE_ID AND c.COURSE_ID=cp.COURSE_ID\r\n\t\t\t\t\tAND r.STUDENT_ID='" . UserStudentID() . "'\r\n\t\t\t\t\tAND sp.PERIOD_ID=cp.PERIOD_ID\r\n\t\t\t\t\tORDER BY " . db_case(array('s.STUDENT_ID', "''", "NULL", 'sp.SORT_ORDER')) . "\r\n\t\t\t\t"), array(), array('CRS', 'PERIOD_ID'));
$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,SHORT_NAME FROM SCHOOL_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER"));
echo '<CENTER><TABLE style="border: 1px solid;">';
echo '<TR><TD></TD>';
foreach ($periods_RET as $period) {
    echo '<TD><small><b>' . $period['SHORT_NAME'] . '</b></small></TD>';
}
foreach ($requests_RET as $course => $periods) {
    echo '<TR><TD><small><b>' . $periods[key($periods)][1]['COURSE_TITLE'] . '</b><small></TD>';
    foreach ($periods_RET as $period) {
        if ($periods[$period['PERIOD_ID']][1]['SCHEDULED']) {
            $color = '0000FF';
        } elseif ($periods[$period['PERIOD_ID']]) {
            if ($periods[$period['PERIOD_ID']][1]['OPEN_SEATS'] == 0) {
                $color = 'FFFF00';
            } else {
function _makeEndInputCode($value, $column)
{
    global $THIS_RET;
    $drop_codes = array();
    if ($THIS_RET['ID']) {
        $id = $THIS_RET['ID'];
    } else {
        $id = 'new';
    }
    $options_RET = DBGet(DBQuery('SELECT ID,TITLE AS TITLE,TYPE FROM student_enrollment_codes WHERE SYEAR=\'' . ($THIS_RET['SYEAR'] != '' ? $THIS_RET['SYEAR'] : UserSyear()) . '\'  AND (TYPE=\'Drop\' OR TYPE=\'Roll\' OR TYPE=\'TrnD\')'));
    if ($options_RET) {
        foreach ($options_RET as $option) {
            $drop_codes[$option['ID']] = $option['TITLE'];
        }
    }
    $type_RET = DBGet(DBQuery('SELECT ID, TYPE FROM student_enrollment_codes WHERE SYEAR=\'' . ($THIS_RET['SYEAR'] != '' ? $THIS_RET['SYEAR'] : UserSyear()) . '\' AND TYPE=\'TrnD\''));
    if (count($type_RET) > 0) {
        $type_id = $type_RET[1]['ID'];
    }
    // student_enrollment select create here
    $maxyear = DBGet(DBQuery('SELECT max(syear) AS SYEAR FROM student_enrollment WHERE STUDENT_ID=\'' . UserStudentID() . '\''));
    if ($THIS_RET['SYEAR'] == $maxyear[1]['SYEAR']) {
        return '<TABLE class=LO_field><TR><TD>' . SelectInput_for_EndInput($THIS_RET['DROP_CODE'], 'values[student_enrollment][' . $id . '][DROP_CODE]', '', $drop_codes, $type_id, 'N/A', 'style="max-width:150;"') . '</TD></TR></TABLE>';
    } else {
        $CODE_RET = DBGet(DBQuery('SELECT ID,TITLE AS TITLE FROM student_enrollment_codes WHERE ID=\'' . $THIS_RET['DROP_CODE'] . '\' '));
        return '<TABLE class=LO_field><TR><TD>' . $CODE_RET[1]['TITLE'] . '</TD></TR></TABLE>';
    }
}
Exemple #27
0
    if (!UserMP()) {
        $_SESSION['UserMP'] = $RET[1]['MARKING_PERIOD_ID'];
    }
    foreach ($RET as $quarter) {
        echo "<OPTION value={$quarter['MARKING_PERIOD_ID']}" . (UserMP() == $quarter['MARKING_PERIOD_ID'] ? ' SELECTED' : '') . ">" . $quarter['TITLE'] . "</OPTION>";
    }
}
echo "</SELECT>";
echo '</FORM>';
if (UserStudentID() && User('PROFILE') != 'parent' && User('PROFILE') != 'student') {
    $RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME,MIDDLE_NAME,NAME_SUFFIX FROM students WHERE STUDENT_ID='" . UserStudentID() . "'"));
    //echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD width=19 valign=middle><A HREF=Side.php?student_id=new&modcat='.$_REQUEST['modcat'].'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD ><B><A HREF=Modules.php?modname=Students/Student.php&student_id='.UserStudentID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].'&nbsp;'.($RET[1]['MIDDLE_NAME']?$RET[1]['MIDDLE_NAME'].' ':'').$RET[1]['LAST_NAME'].'&nbsp;'.$RET[1]['NAME_SUFFIX'].'</font></A></B></TD></TR></TABLE>';
    echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD width=19 valign=middle><A HREF=Side.php?student_id=new&modcat=' . optional_param('modcat', '', PARAM_SPCL) . '><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD ><B><A HREF=Modules.php?modname=Students/Student.php&student_id=' . UserStudentID() . ' target=body><font color=#FFFFFF size=-2>' . $RET[1]['FIRST_NAME'] . '&nbsp;' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . '&nbsp;' . $RET[1]['NAME_SUFFIX'] . '</font></A></B></TD></TR></TABLE>';
}
if (UserStaffID() && User('PROFILE') == 'admin') {
    if (UserStudentID()) {
        echo '<IMG SRC=assets/pixel_trans.gif height=2>';
    }
    $RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME FROM staff WHERE STAFF_ID='" . UserStaffID() . "'"));
    //echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD bgcolor=#336633 width=19 valign=middle><A HREF=Side.php?staff_id=new&modcat='.$_REQUEST['modcat'].'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD bgcolor=#336633><B><A HREF=Modules.php?modname=Users/User.php&staff_id='.UserStaffID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].'&nbsp;'.$RET[1]['LAST_NAME'].'</font></A></B></TD></TR></TABLE>';
    echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD bgcolor=#336633 width=19 valign=middle><A HREF=Side.php?staff_id=new&modcat=' . optional_param('modcat', '', PARAM_SPCL) . '><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD bgcolor=#336633><B><A HREF=Modules.php?modname=Users/User.php&staff_id=' . UserStaffID() . ' target=body><font color=#FFFFFF size=-2>' . $RET[1]['FIRST_NAME'] . '&nbsp;' . $RET[1]['LAST_NAME'] . '</font></A></B></TD></TR></TABLE>';
}
echo '<BR>';
// Program Information
require 'Menu.php';
foreach ($_openSIS['Menu'] as $modcat => $programs) {
    if (count($_openSIS['Menu'][$modcat])) {
        $keys = array_keys($_openSIS['Menu'][$modcat]);
        $menu = false;
        foreach ($keys as $key_index => $file) {
            if (!is_numeric($file)) {
Exemple #28
0
                unset($r_courses[$i]);
                continue;
            }
            $sql = 'INSERT INTO schedule_requests (SYEAR,SCHOOL_ID,STUDENT_ID,SUBJECT_ID,COURSE_ID,COURSE_WEIGHT,MARKING_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID,WITH_PERIOD_ID,NOT_PERIOD_ID)
						values(\'' . UserSyear() . '\',\'' . UserSchool() . '\',\'' . UserStudentID() . '\',\'' . $courses_RET[$course][1]['SUBJECT_ID'] . '\',\'' . $course . '\',\'' . $weight . '\',\'' . 'NULL' . '\',\'' . $_REQUEST['with_teacher'][$subject][$i] . '\',\'' . $_REQUEST['without_teacher'][$subject][$i] . '\',\'' . $_REQUEST['with_period'][$subject][$i] . '\',\'' . $_REQUEST['without_period'][$subject][$i] . '\')';
            DBQuery($sql);
        }
    }
    echo ErrorMessage($error, 'Error');
    $_SCHEDULER['student_id'] = UserStudentID();
    $_SCHEDULER['dont_run'] = true;
    include 'modules/Scheduling/Scheduler.php';
    $_REQUEST['modfunc'] = 'choose';
}
if ($_REQUEST['modfunc'] == 'choose') {
    $QI = DBQuery('SELECT SUBJECT_ID,COURSE_ID,COURSE_WEIGHT,WITH_PERIOD_ID,NOT_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID FROM schedule_requests WHERE SYEAR=\'' . UserSyear() . '\' AND STUDENT_ID=\'' . UserStudentID() . '\'');
    $requests_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery('SELECT SUBJECT_ID,TITLE FROM course_subjects WHERE SCHOOL_ID=\'' . UserSchool() . '\' AND SYEAR=\'' . UserSyear() . '\' ORDER BY TITLE');
    $subjects_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery('SELECT DISTINCT COURSE_ID,TITLE,SUBJECT_ID FROM courses WHERE SCHOOL_ID=\'' . UserSchool() . '\' AND SYEAR=\'' . UserSyear() . '\'');
    $courses_RET = DBGet($QI, array(), array('SUBJECT_ID', 'COURSE_ID'));
    $QI = DBQuery('SELECT DISTINCT c.SUBJECT_ID,cw.COURSE_WEIGHT FROM COURSE_WEIGHTS cw,courses c WHERE c.COURSE_ID=cw.COURSE_ID AND c.SCHOOL_ID=\'' . UserSchool() . '\' AND c.SYEAR=\'' . UserSyear() . '\'');
    $weights_RET = DBGet($QI, array(), array('SUBJECT_ID'));
    $QI = DBQuery('SELECT COURSE_WEIGHT,COURSE_ID FROM COURSE_WEIGHTS WHERE SCHOOL_ID=\'' . UserSchool() . '\' AND SYEAR=\'' . UserSyear() . '\'');
    $course_weights_RET = DBGet($QI, array(), array('COURSE_ID'));
    $QI = DBQuery('SELECT cp.COURSE_WEIGHT,cp.COURSE_ID,cp.TEACHER_ID,cpv.PERIOD_ID FROM course_periods cp,course_period_var cpv WHERE cp.SCHOOL_ID=\'' . UserSchool() . '\' AND cp.SYEAR=\'' . UserSyear() . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID');
    $periods_RET = DBGet($QI, array(), array('COURSE_ID', 'COURSE_WEIGHT'));
    $__DBINC_NO_SQLSHOW = true;
    echo "<script language=javascript>\n";
    foreach ($subjects_RET as $key => $value) {
        $html[$key] = "<TABLE><TR><TD width=10></TD><TD><SELECT name=courses[{$key}][]><OPTION value=''>Not Specified</OPTION>";
            }
            //			if(!$weight)
            //			{
            //				$error[] = "No weight was selectd for ".$courses_RET[$course][1]['TITLE'];
            //				continue;
            //			}
            //			if(!$weights_RET[$course][$weight])
            //			{
            //				$error[] = $courses_RET[$course][1]['TITLE'].' does not have a weight of '.$weight;
            //				unset($courses[$i]);
            //				continue;
            //			}
            $sql = "INSERT INTO SCHEDULE_REQUESTS (SYEAR,SCHOOL_ID,STUDENT_ID,SUBJECT_ID,COURSE_ID,MARKING_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID,WITH_PERIOD_ID,NOT_PERIOD_ID)\r\n\t\t\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $courses_RET[$course][1]['SUBJECT_ID'] . "','" . $course . "',NULL,'" . $_REQUEST['with_teacher'][$subject][$i] . "','" . $_REQUEST['without_teacher'][$subject][$i] . "','" . $_REQUEST['with_period'][$subject][$i] . "','" . $_REQUEST['without_period'][$subject][$i] . "')";
            DBQuery($sql);
        }
    }
    echo ErrorMessage($error, 'Error');
    $_SCHEDULER['student_id'] = UserStudentID();
    $_SCHEDULER['dont_run'] = true;
    include 'modules/Scheduling/Scheduler.php';
    $_REQUEST['modfunc'] = 'choose';
}
if ($_REQUEST['modfunc'] == 'choose') {
    $functions = array('WITH_PERIOD_ID' => '_makeWithSelects', 'NOT_PERIOD_ID' => '_makeWithoutSelects');
    $requests_RET = DBGet(DBQuery("SELECT sr.COURSE_ID,c.COURSE_TITLE,sr.WITH_PERIOD_ID,sr.NOT_PERIOD_ID,sr.WITH_TEACHER_ID,\r\n\t\t\t\t\t\t\t\t\t\tsr.NOT_TEACHER_ID FROM SCHEDULE_REQUESTS sr,COURSES c\r\n\t\t\t\t\t\t\t\t\tWHERE sr.SYEAR='" . UserSyear() . "' AND sr.STUDENT_ID='" . UserStudentID() . "' AND sr.COURSE_ID=c.COURSE_ID"), $functions);
    echo "<FORM name=vary id=vary action=Modules.php?modname={$_REQUEST['modname']}&modfunc=verify method=POST>";
    DrawHeader('', SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\''));
    $columns = array('');
    ListOutput($requests_RET, $columns, 'Request', 'Requests');
    echo '<CENTER>' . SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\'') . '</CENTER></FORM>';
}
				AND s.SYEAR=\'' . UserSyear() . '\' AND s.SCHOOL_ID = \'' . UserSchool() . '\' AND (cpv.COURSE_PERIOD_DATE=\'' . date('Y-m-d', strtotime($date)) . '\' OR cpv.COURSE_PERIOD_DATE IS NULL) 
                                                                        AND (\'' . date('Y-m-d', strtotime($date)) . '\' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND s.START_DATE<=\'' . date('Y-m-d', strtotime($date)) . '\'))
                                                                        AND s.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($mp_id, 'TABLE')), $mp_id) . ') 
                                                                        ORDER BY sp.SORT_ORDER,s.MARKING_PERIOD_ID';
        $QI = DBQuery($sql);
        $schedule_RET = DBGet($QI, array('TIME_PERIOD' => '_makeTimePeriod', 'TITLE' => '_makeTitle', 'PERIOD_PULLDOWN' => '_makePeriodSelect', 'COURSE_MARKING_PERIOD_ID' => '_makeMPSelect'));
        $columns = array('TIME_PERIOD' => 'Period', 'TITLE' => 'Course', 'PERIOD_PULLDOWN' => 'Period - Teacher', 'ROOM' => 'Room', 'DAYS' => 'Days of Week', 'COURSE_MARKING_PERIOD_ID' => 'Term');
    }
    if ($_REQUEST['view_mode'] != 'month_view') {
        ListOutput($schedule_RET, $columns, 'Course', 'Courses', $link);
        if ($_REQUEST['modfunc'] == 'detail') {
            echo '<br /><div align="center"><input type="button" class=btn_medium value="Close" onclick="window.close();"></div>';
        }
    }
    if ($schedule_RET && $_REQUEST['view_mode'] == 'day_view') {
        DrawHeader("<table><tr><td>&nbsp;&nbsp;</td><td>" . ProgramLinkforExport('scheduling/PrintSchedules.php', '<img src=assets/print.png>', '&modfunc=save&st_arr[]=' . UserStudentID() . '&mp_id=' . $mp_id . '&date1=' . $date1 . '&include_inactive=' . $_REQUEST['include_inactive'] . '&_openSIS_PDF=true target=_blank') . "</td><td>" . ProgramLinkforExport('scheduling/PrintSchedules.php', 'Print Schedule', '&modfunc=save&st_arr[]=' . UserStudentID() . '&mp_id=' . $mp_id . '&include_inactive=' . $_REQUEST['include_inactive'] . '&date1=' . $date1 . '&_openSIS_PDF=true target=_blank') . "</td></tr></table>");
    }
    echo '</FORM>';
    unset($_REQUEST['view_mode']);
}
//==============================================Function start============================================
function _makeTitle($value, $column = '')
{
    global $_openSIS, $THIS_RET;
    return $value;
}
function _makeLock($value, $column)
{
    global $THIS_RET;
    if ($value == 'Y') {
        $img = 'locked';