Example #1
0
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package mod
 * @subpackage emarking
 * @copyright 2012 Jorge Villalón {@link http://www.uai.cl}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
/** General feedback to include in the marking **/
$generalfeedback = required_param('feedback', PARAM_RAW_TRIMMED);
// Firstly create the response pdf
if (emarking_create_response_pdf($draft, $user, $context, $cm->id)) {
    // If the pdf was created successfully then update the final grade and feedback
    list($finalgrade, $previouslvlid, $previouscomment) = emarking_set_finalgrade($submission->student, 0, null, $submission, $draft, $emarking, $context, $generalfeedback, false, $cm->id);
    // It is only publish if there just one draft
    if ($DB->count_records('emarking_draft', array('emarkingid' => $submission->emarking, 'submissionid' => $submission->id, 'qualitycontrol' => 0)) == 1) {
        emarking_publish_grade($draft);
    }
    $nextsubmission = emarking_get_next_submission($emarking, $draft, $context, $user, $issupervisor);
    // Send the output
    $output = array('error' => '', 'message' => 'Feedback created successfully', 'finalgrade' => $finalgrade, 'previouslvlid' => $previouslvlid, 'previouscomment' => $previouscomment, 'nextsubmission' => $nextsubmission);
} else {
    // Response couldn't be created
    $output = array('error' => 'Could not create response from eMarking.');
}
Example #2
0
function emarking_publish_all_grades($emarking)
{
    global $DB, $USER, $CFG;
    if ($emarking->type != EMARKING_TYPE_NORMAL) {
        return;
    }
    $studentdrafts = $DB->get_records_sql("SELECT d.* \n\t\t\tFROM {emarking_draft} as d\n\t\t\tINNER JOIN {emarking_submission} as s ON (d.submissionid = s.id AND s.emarking = :emarking AND d.qualitycontrol = 0)", array('emarking' => $emarking->id));
    foreach ($studentdrafts as $draft) {
        if ($draft->status >= EMARKING_STATUS_PUBLISHED) {
            emarking_publish_grade($draft);
        }
    }
    return true;
}
Example #3
0
/**
 * Marks a draft as finished
 *
 * @param unknown $emarking
 * @param unknown $submission
 * @param unknown $draft
 * @param unknown $user
 * @param unknown $context
 * @param unknown $cm
 * @param unknown $issupervisor
 * @return Ambigous <multitype:string , multitype:string unknown Ambigous <multitype:boolean , NULL, multitype:number NULL Ambigous
 *         > >
 */
function emarking_finish_marking($emarking, $submission, $draft, $user, $context, $cm, $issupervisor)
{
    global $DB;
    // General feedback to include in the marking.
    $generalfeedback = required_param('feedback', PARAM_RAW_TRIMMED);
    // Firstly create the response pdf.
    // If the pdf was created successfully then update the final grade and feedback.
    list($finalgrade, $previouslvlid, $previouscomment) = emarking_set_finalgrade(0, null, $submission, $draft, $emarking, $context, $generalfeedback, false, $cm->id);
    // It is only publish if there just one draft.
    if ($DB->count_records('emarking_draft', array('emarkingid' => $submission->emarking, 'submissionid' => $submission->id, 'qualitycontrol' => 0)) == 1) {
        emarking_publish_grade($draft);
    }
    $nextsubmission = emarking_get_next_submission($emarking, $draft, $context, $user, $issupervisor);
    // Send the output.
    $output = array('error' => '', 'message' => 'Feedback created successfully', 'finalgrade' => $finalgrade, 'previouslvlid' => $previouslvlid, 'previouscomment' => $previouscomment, 'nextsubmission' => $nextsubmission);
    return $output;
}
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package mod
 * @subpackage emarking
 * @copyright 2012 Jorge Villalón {@link http://www.uai.cl}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
/** General feedback to include in the marking **/
$generalfeedback = required_param('feedback', PARAM_RAW_TRIMMED);
// Firstly create the response pdf
if (emarking_create_response_pdf($submission, $user, $context, $cm->id)) {
    // If the pdf was created successfully then update the final grade and feedback
    list($finalgrade, $previouslvlid, $previouscomment) = emarking_set_finalgrade($submission->student, 0, null, $submission, $emarking, $context, $generalfeedback, false, $cm->id);
    // It is only publish if there just one draft
    if ($DB->count_records("emarking_draft", array("emarkingid" => $submission->emarkingid, "submissionid" => $submission->submissionid)) == 1) {
        emarking_publish_grade($submission);
    }
    $nextsubmission = emarking_get_next_submission($emarking, $submission);
    // Send the output
    $output = array('error' => '', 'message' => 'Feedback created successfully', 'finalgrade' => $finalgrade, 'previouslvlid' => $previouslvlid, 'previouscomment' => $previouscomment, 'nextsubmission' => $nextsubmission);
} else {
    // Response couldn't be created
    $output = array('error' => 'Could not create response from eMarking.');
}
Example #5
0
function emarking_publish_all_grades($emarking)
{
    global $DB, $USER, $CFG;
    $studentsubmissions = $DB->get_records("emarking_submission", array('emarking' => $emarking->id));
    foreach ($studentsubmissions as $submission) {
        if ($submission->status >= EMARKING_STATUS_RESPONDED) {
            emarking_publish_grade($submission);
        }
    }
    return true;
}