Example #1
0
$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) {
    $increment_count_taken = false;
    $crumb = false;
    $isValidForm = true;
    // Check for result for given student on form
    $crumb = $asset->url;
    $title = $asset->title;
    $url = Route::url($this->base . '&asset=' . $asset->id);
    $unit = isset($asset->unit_id) ? $this->course->offering()->unit($asset->unit_id) : null;
    if (!$crumb || strlen($crumb) != 20) {
        $score = isset($grades[$this->member->get('id')]['assets'][$asset->id]['score']) ? $grades[$this->member->get('id')]['assets'][$asset->id]['score'] : '--';
Example #2
0
 /**
  * Delete a gradebook item
  *
  * @return void
  **/
 private function deletegradebookitem()
 {
     // Only allow for instructors
     if (!$this->course->offering()->section()->access('manage')) {
         echo json_encode(array('success' => false));
         exit;
     }
     // 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')) {
         echo json_encode(array('success' => false));
         exit;
     }
     $asset = new \Components\Courses\Tables\Asset(App::get('db'));
     // Get request variables
     if ($asset_id = Request::getInt('asset_id', false)) {
         $asset->load($asset_id);
         $asset->set('graded', 0);
         if ($asset->get('type') == 'gradebook') {
             $asset->set('state', 2);
         }
     } else {
         echo json_encode(array('success' => false));
         exit;
     }
     if (!$asset->store()) {
         echo json_encode(array('success' => false));
         exit;
     }
     echo json_encode(array('success' => true));
     exit;
 }