コード例 #1
0
 /**
  * Constructor
  *
  * @param      integer $id  Resource ID
  * @param      integer $sid Section ID
  * @return     void
  */
 public function __construct($oid, $sid = null)
 {
     $this->_db = \App::get('db');
     $this->_tbl = new $this->_tbl_name($this->_db);
     if (is_numeric($oid)) {
         // Check if this is the default section
         if (!is_null($sid)) {
             $section = new Section($sid);
             if (!$section->get('is_default')) {
                 $config = Component::params('com_courses');
                 $canEdit = $config->get('section_grade_policy', true);
                 if (!$canEdit) {
                     // We need to find the default section and use that grade policy
                     $offering = new Offering($section->get('offering_id'));
                     $default = $offering->section('!!default!!');
                     $oid = $default->get('grade_policy_id');
                 }
             }
         }
         $this->_tbl->load($oid);
     }
 }