public function get_all_submissions($userid) {
        global $DB, $USER;

        // If the userid is not null then use userid.
        if (!$userid) {
            $userid = $USER->id;
        }

        $params = array();

        if ($this->get_instance()->teamsubmission) {
            $groupid = 0;
            $group = $this->get_submission_group($userid);
            if ($group) {
                $groupid = $group->id;
            }

            // Params to get the group submissions.
            $params = array('assignment'=>$this->get_instance()->id, 'groupid'=>$groupid, 'userid'=>0);
        } else {
            // Params to get the user submissions.
            $params = array('assignment'=>$this->get_instance()->id, 'userid'=>$userid);
        }

        // Return the submissions ordered by attempt.
        $submissions = $DB->get_records('assign_submission', $params, 'attemptnumber ASC');

        return $submissions;
    }
public function get_all_submissions($userid) {
        global $DB, $USER;

        // If the userid is not null then use userid.
        if (!$userid) {
            $userid = $USER->id;
        }

        $params = array();

        if ($this->get_instance()->teamsubmission) {
            $groupid = 0;
            $group = $this->get_submission_group($userid);
            if ($group) {
                $groupid = $group->id;
            }

            // Params to get the group submissions.
            $params = array('assignment'=>$this->get_instance()->id, 'groupid'=>$groupid, 'userid'=>0);
        } else {
            // Params to get the user submissions.
            $params = array('assignment'=>$this->get_instance()->id, 'userid'=>$userid);
        }

        // Return the submissions ordered by attempt.
        $submissions = $DB->get_records('assign_submission', $params, 'attemptnumber ASC');

        return $submissions;
    }
public function get_all_submissions ( $ userid ) { global $ DB , $ USER ; // If the userid is not null then use userid. if ( ! $ userid ) { $ userid = $ USER -> id ; } $ params = array ( ) ; if ( $ this -> get_instance ( ) -> teamsubmission ) { $ groupid = 0 ; $ group = $ this -> get_submission_group ( $ userid ) ; if ( $ group ) { $ groupid = $ group -> id ; } // Params to get the group submissions. $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'groupid' => $ groupid , 'userid' => 0 ) ; } else { // Params to get the user submissions. $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'userid' => $ userid ) ; } // Return the submissions ordered by attempt. $ submissions = $ DB -> get_records ( 'assign_submission' , $ params , 'attemptnumber ASC' ) ; return $ submissions ; }
Get the submissions for all previous attempts.

@param int $userid If not set, $USER->id will be used.
@return array $submissions All submission records for this user (or group).
Get the submissions for all previous attempts .