예제 #1
0
 * @package   hubzero-cms
 * @author    Sam Wilson <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
$this->course->offering()->gradebook()->refresh($this->member->get('id'));
$grades = $this->course->offering()->gradebook()->grades(null, $this->member->get('id'));
$progress = $this->course->offering()->gradebook()->progress($this->member->get('id'));
$passing = $this->course->offering()->gradebook()->passing(true, $this->member->get('id'));
$passing = isset($passing[$this->member->get('id')]) ? $passing[$this->member->get('id')] : null;
// See if the student has qualified for the badge
$this->course->offering()->gradebook()->hasEarnedBadge($this->member->get('id'));
$student = $this->member;
$gradePolicy = new \Components\Courses\Models\GradePolicies($this->course->offering()->section()->get('grade_policy_id'), $this->course->offering()->section()->get('id'));
$details = array();
$details['quizzes_total'] = 0;
$details['homeworks_total'] = 0;
$details['exams_total'] = 0;
$details['quizzes_taken'] = 0;
$details['homeworks_submitted'] = 0;
$details['exams_taken'] = 0;
$details['forms'] = array();
// Get the assets
$asset = new \Components\Courses\Tables\Asset(App::get('db'));
$assets = $asset->find(array('w' => array('course_id' => $this->course->get('id'), 'section_id' => $this->course->offering()->section()->get('id'), 'offering_id' => $this->course->offering()->get('id'), 'graded' => true, 'state' => 1, 'asset_scope' => 'asset_group')));
// Get gradebook auxiliary assets
$auxiliary = $asset->findByScope('offering', $this->course->offering()->get('id'), array('asset_type' => 'gradebook', 'asset_subtype' => 'auxiliary', 'graded' => true, 'state' => 1));
$assets = array_merge($assets, $auxiliary);
foreach ($assets as $asset) {
예제 #2
0
 /**
  * Restore grading policy back to default
  *
  * @return void
  **/
 private function restoredefaults()
 {
     // Only allow for instructors
     if (!$this->course->offering()->section()->access('manage')) {
         // Redirect with message
         App::redirect(Route::url($this->base, false), 'You don\'t have permission to do this!', 'warning');
         return;
     }
     // Now, also make sure either section managers can edit, or user is a course manager
     if (!$this->course->config()->get('section_grade_policy', true) && !$this->course->offering()->access('manage')) {
         // Redirect with message
         App::redirect(Route::url($this->base . '&active=progress', false), 'You don\'t have permission to do this!', 'warning');
         return;
     }
     $section = $this->course->offering()->section();
     // Now set them back to the default
     $section->set('grade_policy_id', 1);
     $section->store();
     // If section managers can't edit, then also make the above change for all sections of this course
     if (!$this->course->config()->get('section_grade_policy', true)) {
         $sections = $this->course->offering()->sections();
         foreach ($sections as $s) {
             $s->set('grade_policy_id', 1);
             $s->store();
         }
     }
     if (Request::getInt('no_html', false)) {
         $gp = new \Components\Courses\Models\GradePolicies(1);
         $policy->description = $gp->get('description');
         $policy->exam_weight = $gp->get('exam_weight') * 100;
         $policy->quiz_weight = $gp->get('quiz_weight') * 100;
         $policy->homework_weight = $gp->get('homework_weight') * 100;
         $policy->threshold = $gp->get('threshold') * 100;
         echo json_encode(array('success' => true, 'message' => 'Scoring policy successfully restored to the default configuration!', 'gradepolicy' => $policy));
         exit;
     } else {
         // Redirect with message
         App::redirect(Route::url($this->base . '&active=progress', false), 'Scoring policy successfully restored to the default configuration!', 'passed');
         return;
     }
 }