/** * Return data on a course view (this will be some form of HTML) * * @param object $course Current course * @param object $offering Name of the component * @param boolean $describe Return plugin description only? * @return object */ public function onCourse($course, $offering, $describe = false) { $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', 'f012'); if ($describe) { return $response; } if (!($active = Request::getVar('active'))) { Request::setVar('active', $active = $this->_name); } if ($response->get('name') != $active) { return $response; } // Check to see if user is member and plugin access requires members if (!$course->offering()->section()->access('view')) { $view = new \Hubzero\Plugin\View(array('folder' => 'courses', 'element' => 'outline', 'name' => 'shared', 'layout' => '_not_enrolled')); $view->set('course', $course)->set('option', 'com_courses')->set('message', 'You must be enrolled to utilize the progress feature.'); $response->set('html', $view->__toString()); return $response; } $this->member = $course->offering()->section()->member(User::get('id')); $this->course = $course; $this->base = $course->offering()->link(); $this->db = App::get('db'); // Instantiate a vew $this->view = $this->view('student', 'report'); $this->view->course = $course; $this->view->member = $this->member; $this->view->option = 'com_courses'; $this->view->base = $this->base; switch (Request::getWord('action')) { case 'assessmentdetails': $this->assessmentdetails(); break; case 'getprogressrows': $this->getprogressrows(); break; case 'getprogressdata': $this->getprogressdata(); break; case 'getgradebookdata': $this->getgradebookdata(); break; case 'getreportsdata': $this->getreportsdata(); break; case 'exportcsv': $this->exportcsv(); break; case 'downloadresponses': $this->downloadresponses(); break; case 'savegradebookitem': $this->savegradebookitem(); break; case 'deletegradebookitem': $this->deletegradebookitem(); break; case 'savegradebookentry': $this->savegradebookentry(); break; case 'resetgradebookentry': $this->resetgradebookentry(); break; case 'policysave': $this->policysave(); break; case 'restoredefaults': $this->restoredefaults(); break; default: $this->progress(); break; } $response->set('html', $this->view->loadTemplate()); // Return the output return $response; }