Created
July 25, 2012 16:12
-
-
Save CashWilliams/3177002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function grades_gsc_block_contents() { | |
include "grades.template.inc"; | |
global $user, $base_url; | |
drupal_add_js(drupal_get_path('module', 'ntlp_blocks') . '/grades.contents.js'); | |
$user_id = $user->uid; | |
if ($courseid == 0) { | |
//Getting Query String From URL | |
$courseid = 0; | |
$url = $_GET['q']; | |
$args = explode('/', $url); | |
for ($i = 0; $i < count($args); $i++) { | |
if (is_numeric($args[$i])) | |
$courseid = $args[$i]; | |
} | |
} | |
if (isset($user->roles[NTLP_ROLEID_PARENT])) { // if parent come here show their student record | |
$user_role = NTLP_ROLEID_PARENT; | |
$user_id = $_SESSION['PARENT_STUDENT_UID']; | |
if (!check_user_exist_in_course($user_id, $courseid, true)) { | |
drupal_goto("ntlp/courses/my"); | |
} | |
} else { | |
$user_role = check_user_permission($courseid); | |
} | |
[...] | |
if (isset($user_role)) { | |
if ($user_role == NTLP_ROLEID_NTNSTAFF || $user_role == NTLP_ROLEID_NTNTEMP | |
|| $user_role == NTLP_ROLEID_TEACHER || $user_role == NTLP_ROLEID_SITEGUEST) { | |
$tab_student = (isset($_GET['tab'])) ? ($_GET['tab'] == 'students') : true; | |
if ($tab_student) { | |
//Run cron, but first clear the dw table | |
dw_setall_student_course_grade_toupdate($courseid, $term_tid, $school_nid); | |
cron_course_student_grades_dw($courseid, $term_tid); | |
$view_activities = render_course_student_grades($courseid, $term_tid, $filters = array()); | |
} | |
else | |
$view_activities = get_gradebook_activities_view($courseid, $term_tid); | |
} else { | |
$gradebook_filter = ''; | |
$outcome_box = showStudentGrades($courseid, $user_id, 'G', $view_activities, $outcome_box, $student_box, $templinks_box); | |
} | |
} | |
$output = $outcome_box; | |
$output = str_replace('<!-- @FILTER_PLACEHOLDER -->', $gradebook_filter, $output); | |
$output = str_replace('@GRADES_VIEW', $view_activities, $output); | |
$output = str_replace('@OUTCOME_BOX', $outcome_box, $output); | |
$output = str_replace('@STUDENT_BOX', '', $output); | |
$output = str_replace('@BACK_LINK', url("ntlp/courses/grade/$courseid"), $output); | |
$output = str_replace('@TAB_STUDENTS', '<a href="' . url('ntlp/courses/grade/') . $courseid . '&tab=students" id="grades_tab_students" ' . (($tab_student) ? 'class="GradesTabActive"' : '') . '>Students</a>', $output); | |
$output = str_replace('@TAB_SEPARATOR', '|', $output); | |
$output = str_replace('@TAB_ACTIVITIES', '<a href="' . url('ntlp/courses/grade/') . $courseid . '&tab=activities" id="grades_tab_activities" ' . (($tab_student) ? '' : 'class="GradesTabActive"') . '>Activities</a>', $output); | |
if ($user_role == NTLP_ROLEID_NTNSTAFF || $user_role == NTLP_ROLEID_NTNTEMP | |
|| $user_role == NTLP_ROLEID_TEACHER || $user_role == NTLP_ROLEID_SITEGUEST) { | |
$output = str_replace('@DOWNLOAD_COURSE_PDF', '<a href="' . url('ntlp/report/course_progress/' . $school_nid . '/' . $school_year . '/' . $term_tid . '/' . $courseid) . | |
'" target="_blank" class="SubmitBtnVeryLong">Course Progress Reports for All Students</a>', $output); | |
} else { | |
$output = str_replace('@DOWNLOAD_COURSE_PDF', '', $output); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment