Ejemplo n.º 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.');
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
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, $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.');
}
Ejemplo n.º 4
0
      * $item = array (
      * 'context' => context_module::instance ( $cm->id ),
      * 'objectid' => $cm->id,
      * );
      * \mod_emarking\event\deletecomment_deleted::create ( $item )->trigger ();
      */
     // include "act/actCheckGradePermissions.php";
     include "act/actDeleteComment.php";
     // emarking_json_array ( $output );
     break;
 case 'getsimilaranswers':
     include "qry/getSimilarAnswers.php";
     emarking_json_error('Invalid parameters');
     break;
 case 'getnextsubmission':
     $nextsubmission = emarking_get_next_submission($emarking, $submission, $context, $user);
     emarking_json_array(array('nextsubmission' => $nextsubmission));
     break;
 case 'addmark':
     // Add to Moodle log so some auditing can be done
     $item = array('context' => context_module::instance($cm->id), 'objectid' => $cm->id);
     \mod_emarking\event\addmark_added::create($item)->trigger();
     include "act/actCheckGradePermissions.php";
     include "act/actAddMark.php";
     emarking_json_array($output);
     break;
 case 'regrade':
     // Add to Moodle log so some auditing can be done
     $item = array('context' => context_module::instance($cm->id), 'objectid' => $cm->id);
     \mod_emarking\event\regrade_graded::create($item)->trigger();
     include "act/actRegrade.php";