Ejemplo n.º 1
0
 public function getInstructor_assignments()
 {
     return InstructorAssignment::model()->findAllBySql('select instructor_assignment.*
           from instructor_assignment
           left join class_info
            on instructor_assignment.class_id = class_info.id
           where instructor_assignment.instructor_id = :iid
             and class_info.session_id = :sid', array('sid' => ClassSession::savedSessionId(), 'iid' => $this->id));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['instructor_id']) && isset($_GET['class_id'])) {
             // XXX this is stupid and tedious. fix.
             $this->_model = InstructorAssignment::model()->findbyPk(array('instructor_id' => $_GET['instructor_id'], 'class_id' => $_GET['class_id']));
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }