当前位置: 首页>>代码示例>>PHP>>正文


PHP turnitintooltwo_print_error函数代码示例

本文整理汇总了PHP中turnitintooltwo_print_error函数的典型用法代码示例。如果您正苦于以下问题:PHP turnitintooltwo_print_error函数的具体用法?PHP turnitintooltwo_print_error怎么用?PHP turnitintooltwo_print_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了turnitintooltwo_print_error函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_turnitintooltwo

 protected function process_turnitintooltwo($data)
 {
     global $DB;
     $config = turnitintooltwo_admin_config();
     $_SESSION['tii_assignment_reset'] = 1;
     if ($this->get_setting_value('userinfo') == 1) {
         $_SESSION['tii_course_reset'] = 0;
         $_SESSION['tii_assignment_reset'] = 0;
     }
     $data = (object) $data;
     $oldid = $data->id;
     $data->course = $this->get_courseid();
     // Work out whether we are duplicating a module activity or course.
     // If activity then we do not want to reset the course.
     $type = $this->get_task()->get_info()->type;
     if ($type == 'activity') {
         $_SESSION['tii_course_reset'] = 0;
     }
     if ($data->grade < 0) {
         // scale found, get mapping
         $data->grade = -$this->get_mappingid('scale', abs($data->grade));
     }
     if ($config->accountid != $data->tiiaccount) {
         $a = new stdClass();
         $a->backupid = $data->tiiaccount;
         $a->current = $config->accountid;
         turnitintooltwo_print_error('wrongaccountid', 'turnitintooltwo', NULL, $a);
         return false;
     } else {
         // insert the activity record
         $newitemid = $DB->insert_record('turnitintooltwo', $data);
         $_SESSION['assignment_id'] = $newitemid;
         // immediately after inserting "activity" record, call this
         $this->apply_activity_instance($newitemid);
     }
 }
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:36,代码来源:restore_turnitintooltwo_stepslib.php

示例2: turnitintooltwo_print_error

     if (!$istutor) {
         turnitintooltwo_print_error('permissiondeniederror', 'turnitintooltwo');
         exit;
     }
     $introtext = $do == "tutors" ? get_string('turnitintutors_desc', 'turnitintooltwo') : get_string('turnitinstudents_desc', 'turnitintooltwo');
     echo $OUTPUT->box($introtext, 'generalbox boxaligncenter', 'general');
     $memberrole = $do == "tutors" ? 'Instructor' : 'Learner';
     echo $turnitintooltwoview->init_tii_member_by_role_table($cm, $turnitintooltwoassignment, $memberrole);
     if ($do == "tutors") {
         $tutors = $turnitintooltwoassignment->get_tii_users_by_role("Instructor");
         echo $turnitintooltwoview->show_add_tii_tutors_form($cm, $tutors);
     }
     break;
 case "emailnonsubmittersform":
     if (!$istutor) {
         turnitintooltwo_print_error('permissiondeniederror', 'turnitintooltwo');
         exit;
     }
     $output = '';
     if (isset($_SESSION["embeddednotice"])) {
         $output = html_writer::tag("div", $_SESSION["embeddednotice"]["message"], array('class' => 'general_warning'));
         unset($_SESSION["embeddednotice"]);
     }
     $elements = array();
     $elements[] = array('header', 'nonsubmitters_header', get_string('emailnonsubmitters', 'turnitintooltwo'));
     $elements[] = array('static', 'nonsubmittersformdesc', get_string('nonsubmittersformdesc', 'turnitintooltwo'), '', '');
     $elements[] = array('text', 'nonsubmitters_subject', get_string('nonsubmitterssubject', 'turnitintooltwo'), '', '', 'required', get_string('nonsubmitterssubjecterror', 'turnitintooltwo'), PARAM_TEXT);
     $elements[] = array('textarea', 'nonsubmitters_message', get_string('nonsubmittersmessage', 'turnitintooltwo'), '', '', 'required', get_string('nonsubmittersmessageerror', 'turnitintooltwo'), PARAM_TEXT);
     $elements[] = array('advcheckbox', 'nonsubmitters_sendtoself', get_string('nonsubmitterssendtoself', 'turnitintooltwo'), '', array(0, 1));
     $customdata["checkbox_label_after"] = true;
     $elements[] = array('hidden', 'id', $cm->id);
开发者ID:NeillM,项目名称:moodle-mod_turnitintooltwo,代码行数:31,代码来源:view.php

示例3: edit_moodle_assignment

 /**
  * Edit the assignment in Moodle then on Turnitin
  *
  * @global type $USER
  * @global type $DB
  * @param boolean $createevent - setting to determine whether to create a calendar event.
  * @return boolean
  */
 public function edit_moodle_assignment($createevent = true)
 {
     global $USER, $DB, $CFG;
     $config = turnitintooltwo_admin_config();
     $this->turnitintooltwo->id = $this->id;
     $this->turnitintooltwo->timemodified = time();
     // Get Moodle Course Object.
     $course = $this->get_course_data($this->turnitintooltwo->course);
     // Get the Turnitin owner of this this Course or make user the owner if none.
     $ownerid = $this->get_tii_owner($course->id);
     if (!empty($ownerid)) {
         $owner = new turnitintooltwo_user($ownerid, 'Instructor');
     } else {
         $owner = new turnitintooltwo_user($USER->id, 'Instructor');
     }
     // Edit course in Turnitin.
     $this->edit_tii_course($course);
     $course->turnitin_ctl = $course->fullname . " (Moodle TT)";
     // Get Current Moodle Turnitin Tool data (Assignment).
     if (!($turnitintooltwonow = $DB->get_record("turnitintooltwo", array("id" => $this->id)))) {
         turnitintooltwo_print_error('turnitintooltwogeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
         exit;
     }
     // Get Current Moodle Turnitin Tool Parts Object.
     if (!($parts = $DB->get_records_select("turnitintooltwo_parts", " turnitintooltwoid = ? ", array($this->id), 'id ASC'))) {
         turnitintooltwo_print_error('partgeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
         exit;
     }
     $partids = array_keys($parts);
     // Update GradeMark setting depending on config setting.
     $this->turnitintooltwo->usegrademark = $config->usegrademark;
     // Set the checkbox settings for updates.
     $this->turnitintooltwo->erater_spelling = isset($this->turnitintooltwo->erater_spelling) ? $this->turnitintooltwo->erater_spelling : 0;
     $this->turnitintooltwo->erater_grammar = isset($this->turnitintooltwo->erater_grammar) ? $this->turnitintooltwo->erater_grammar : 0;
     $this->turnitintooltwo->erater_usage = isset($this->turnitintooltwo->erater_usage) ? $this->turnitintooltwo->erater_usage : 0;
     $this->turnitintooltwo->erater_mechanics = isset($this->turnitintooltwo->erater_mechanics) ? $this->turnitintooltwo->erater_mechanics : 0;
     $this->turnitintooltwo->erater_style = isset($this->turnitintooltwo->erater_style) ? $this->turnitintooltwo->erater_style : 0;
     $this->turnitintooltwo->transmatch = isset($this->turnitintooltwo->transmatch) ? $this->turnitintooltwo->transmatch : 0;
     $this->turnitintooltwo->institution_check = isset($this->turnitintooltwo->institution_check) ? $this->turnitintooltwo->institution_check : 0;
     // Update each individual part.
     for ($i = 1; $i <= $this->turnitintooltwo->numparts; $i++) {
         // Update Turnitin Assignment.
         $assignment = new TiiAssignment();
         $assignment->setClassId($course->turnitin_cid);
         $assignment->setAuthorOriginalityAccess($this->turnitintooltwo->studentreports);
         $assignment->setRubricId(!empty($this->turnitintooltwo->rubric) ? $this->turnitintooltwo->rubric : '');
         $assignment->setSubmitPapersTo($this->turnitintooltwo->submitpapersto);
         $assignment->setResubmissionRule($this->turnitintooltwo->reportgenspeed);
         $assignment->setBibliographyExcluded($this->turnitintooltwo->excludebiblio);
         $assignment->setQuotedExcluded($this->turnitintooltwo->excludequoted);
         $assignment->setSmallMatchExclusionType($this->turnitintooltwo->excludetype);
         $assignment->setSmallMatchExclusionThreshold((int) $this->turnitintooltwo->excludevalue);
         $assignment->setLateSubmissionsAllowed($this->turnitintooltwo->allowlate);
         if ($config->repositoryoption == 1) {
             $assignment->setInstitutionCheck(isset($this->turnitintooltwo->institution_check) ? $this->turnitintooltwo->institution_check : 0);
         }
         $attribute = "maxmarks" . $i;
         $assignment->setMaxGrade($this->turnitintooltwo->{$attribute});
         $assignment->setSubmittedDocumentsCheck($this->turnitintooltwo->spapercheck);
         $assignment->setInternetCheck($this->turnitintooltwo->internetcheck);
         $assignment->setPublicationsCheck($this->turnitintooltwo->journalcheck);
         $assignment->setTranslatedMatching($this->turnitintooltwo->transmatch);
         $assignment->setAllowNonOrSubmissions($this->turnitintooltwo->allownonor);
         // Erater settings.
         $assignment->setErater(isset($this->turnitintooltwo->erater) ? $this->turnitintooltwo->erater : 0);
         $assignment->setEraterSpelling($this->turnitintooltwo->erater_spelling);
         $assignment->setEraterGrammar($this->turnitintooltwo->erater_grammar);
         $assignment->setEraterUsage($this->turnitintooltwo->erater_usage);
         $assignment->setEraterMechanics($this->turnitintooltwo->erater_mechanics);
         $assignment->setEraterStyle($this->turnitintooltwo->erater_style);
         $assignment->setEraterSpellingDictionary(isset($this->turnitintooltwo->erater_dictionary) ? $this->turnitintooltwo->erater_dictionary : 'en_US');
         $assignment->setEraterHandbook(isset($this->turnitintooltwo->erater_handbook) ? $this->turnitintooltwo->erater_handbook : 0);
         $attribute = "dtstart" . $i;
         $assignment->setStartDate(gmdate("Y-m-d\\TH:i:s\\Z", $this->turnitintooltwo->{$attribute}));
         $attribute = "dtdue" . $i;
         $assignment->setDueDate(gmdate("Y-m-d\\TH:i:s\\Z", $this->turnitintooltwo->{$attribute}));
         $attribute = "dtpost" . $i;
         $assignment->setFeedbackReleaseDate(gmdate("Y-m-d\\TH:i:s\\Z", $this->turnitintooltwo->{$attribute}));
         $attribute = "partname" . $i;
         $assignment->setTitle($this->turnitintooltwo->name . " " . $this->turnitintooltwo->{$attribute} . " (Moodle TT)");
         // Initialise part.
         $part = new stdClass();
         $part->turnitintooltwoid = $this->id;
         $part->partname = $this->turnitintooltwo->{$attribute};
         $part->deleted = 0;
         $part->maxmarks = $assignment->getMaxGrade();
         $part->dtstart = strtotime($assignment->getStartDate());
         $part->dtdue = strtotime($assignment->getDueDate());
         $part->dtpost = strtotime($assignment->getFeedbackReleaseDate());
         $parttiiassignid = 0;
         if ($i <= count($partids) && !empty($partids[$i - 1])) {
             $partdetails = $this->get_part_details($partids[$i - 1]);
//.........这里部分代码省略.........
开发者ID:sk-unikent,项目名称:moodle-mod_turnitintooltwo-1,代码行数:101,代码来源:turnitintooltwo_assignment.class.php

示例4: save_tii_user

 /**
  * Save the link between the moodle user and Turnitin
  *
  * @global type $DB
  * @return void
  */
 private function save_tii_user()
 {
     global $DB;
     $user = new stdClass();
     $user->userid = $this->id;
     $user->turnitin_uid = $this->tii_user_id;
     $user->turnitin_utp = 1;
     if ($this->role == "Instructor") {
         $user->turnitin_utp = 2;
     }
     if ($turnitintooltwouser = $DB->get_record("turnitintooltwo_users", array("userid" => $this->id))) {
         $user->id = $turnitintooltwouser->id;
         $user->turnitin_utp = $turnitintooltwouser->turnitin_utp;
         if (!$DB->update_record('turnitintooltwo_users', $user)) {
             if ($this->workflowcontext != "cron") {
                 turnitintooltwo_print_error('userupdateerror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
                 exit;
             }
         }
     } else {
         if (!($insertid = $DB->insert_record('turnitintooltwo_users', $user))) {
             if ($this->workflowcontext != "cron") {
                 turnitintooltwo_print_error('userupdateerror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
                 exit;
             }
         }
     }
 }
开发者ID:NeillM,项目名称:moodle-mod_turnitintooltwo,代码行数:34,代码来源:turnitintooltwo_user.class.php

示例5: list

if ($id != 0) {
    //Pre 2.8 does not have the function get_course_and_cm_from_cmid.
    if ($CFG->branch >= 28) {
        list($course, $cm) = get_course_and_cm_from_cmid($id, 'turnitintooltwo');
    } else {
        $cm = get_coursemodule_from_id('turnitintooltwo', $id, 0, false, MUST_EXIST);
        $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
    }
    if (!$cm) {
        turnitintooltwo_print_error('coursemodidincorrect', 'turnitintooltwo');
    }
    if (!($course = $DB->get_record("course", array("id" => $cm->course)))) {
        turnitintooltwo_print_error('coursemisconfigured', 'turnitintooltwo');
    }
    if (!($turnitintooltwo = $DB->get_record("turnitintooltwo", array("id" => $cm->instance)))) {
        turnitintooltwo_print_error('coursemodincorrect', 'turnitintooltwo');
    }
    $PAGE->set_context(context_module::instance($cm->id));
    $PAGE->set_pagelayout('base');
    require_login($course->id, true, $cm);
} else {
    $PAGE->set_context(context_system::instance());
    require_login();
}
// Load Javascript and CSS.
$turnitintooltwoview->load_page_components($hidebg);
// Configure URL correctly.
$urlparams = array('cmd' => $cmd, 'view_context' => $viewcontext);
if ($id != 0) {
    $urlparams['id'] = $id;
}
开发者ID:uofr,项目名称:moodle-mod_turnitintooltwo,代码行数:31,代码来源:extras.php

示例6: handle_exceptions

 /**
  * Log API exceptions and print error to screen if required
  *
  * @param object $e
  * @param string $tterrorstr
  * @param boolean $toscreen
  */
 public static function handle_exceptions($e, $tterrorstr = "", $toscreen = true, $embedded = false)
 {
     $errorstr = "";
     if (!empty($tterrorstr)) {
         $errorstr = get_string($tterrorstr, 'turnitintooltwo') . "<br/><br/>";
         if ($embedded == true) {
             $errorstr .= get_string('tii_submission_failure', 'turnitintooltwo') . "<br/><br/>";
         }
     }
     if (is_callable(array($e, 'getFaultCode'))) {
         $errorstr .= get_string('faultcode', 'turnitintooltwo') . ": " . $e->getFaultCode() . " | ";
     }
     if (is_callable(array($e, 'getFile'))) {
         $errorstr .= get_string('file') . ": " . $e->getFile() . " | ";
     }
     if (is_callable(array($e, 'getLine'))) {
         $errorstr .= get_string('line', 'turnitintooltwo') . ": " . $e->getLine() . " | ";
     }
     if (is_callable(array($e, 'getMessage'))) {
         $errorstr .= get_string('message', 'turnitintooltwo') . ": " . $e->getMessage() . " | ";
     }
     if (is_callable(array($e, 'getCode'))) {
         $errorstr .= get_string('code', 'turnitintooltwo') . ": " . $e->getCode();
     }
     turnitintooltwo_activitylog($errorstr, "API_ERROR");
     if ($toscreen) {
         turnitintooltwo_print_error($errorstr, null);
     } else {
         if ($embedded) {
             return $errorstr;
         }
     }
 }
开发者ID:unikent,项目名称:moodle-mod_turnitintooltwo,代码行数:40,代码来源:turnitintooltwo_comms.class.php

示例7: get_submission_details

 /**
  * Get full submission details and work out overall grade
  *
  * @global type $DB
  * @param type $turnitintooltwoassignment
  * @param type $submission_id
  * @param type $id_type
  * @return type
  */
 private function get_submission_details($idtype = "moodle", $turnitintooltwoassignment = "")
 {
     global $DB;
     if ($idtype == "moodle") {
         $condition = array("id" => $this->id);
     } else {
         $condition = array("submission_objectid" => $this->submission_objectid);
     }
     if ($submission = $DB->get_record('turnitintooltwo_submissions', $condition, '*', IGNORE_MULTIPLE)) {
         if (empty($turnitintooltwoassignment)) {
             $turnitintooltwoassignment = new turnitintooltwo_assignment($submission->turnitintooltwoid);
             $this->turnitintooltwoid = $turnitintooltwoassignment->turnitintooltwo->id;
         }
         if (count($turnitintooltwoassignment->get_parts() > 1)) {
             if ($submission->userid != 0) {
                 $usersubmissions = $turnitintooltwoassignment->get_user_submissions($submission->userid, $submission->turnitintooltwoid);
                 $useroverallgrade = $turnitintooltwoassignment->get_overall_grade($usersubmissions);
                 if ($turnitintooltwoassignment->turnitintooltwo->grade == 0 or $useroverallgrade === '--') {
                     $this->overall_grade = '--';
                 } else {
                     if ($turnitintooltwoassignment->turnitintooltwo->grade < 0) {
                         // Scale.
                         $scale = $DB->get_record('scale', array('id' => $turnitintooltwoassignment->turnitintooltwo->grade * -1));
                         $scalearray = explode(",", $scale->scale);
                         // Array is zero indexed, Scale positions are from 1 upward.
                         $index = $useroverallgrade - 1;
                         $this->overall_grade = $scalearray[$index];
                     } else {
                         $this->overall_grade = round($useroverallgrade / $turnitintooltwoassignment->turnitintooltwo->grade * 100, 1) . '%';
                     }
                 }
             } else {
                 $this->overall_grade = '--';
             }
         }
         foreach ($submission as $field => $value) {
             $this->{$field} = $value;
         }
         if ($submission->userid > 0) {
             $user = $DB->get_record('user', array('id' => $submission->userid), 'firstname, lastname');
             $this->firstname = $user->firstname;
             $this->lastname = $user->lastname;
             $this->fullname = fullname($user);
             $this->nmoodle = 0;
         } else {
             $this->firstname = $submission->submission_nmfirstname;
             $this->lastname = $submission->submission_nmlastname;
             $tmpuser = new stdClass();
             $tmpuser->firstname = $submission->submission_nmfirstname;
             $tmpuser->lastname = $submission->submission_nmlastname;
             $this->fullname = fullname($tmpuser);
             $this->nmoodle = 1;
         }
     } else {
         if ($idtype == "moodle") {
             turnitintooltwo_print_error('submissiongeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
         }
     }
 }
开发者ID:uofr,项目名称:moodle-mod_turnitintooltwo,代码行数:68,代码来源:turnitintooltwo_submission.class.php

示例8: turnitintooltwo_duplicate_recycle

/**
 * Function called by course/reset.php when resetting moodle course, this is used to duplicate or reset a courses Turnitin
 * activities. If action specified is 'NEWCLASS' we are creating a new class on Turnitin. For both actions we create new
 * assignments on Turnitin and replace the turnitin ids for those parts in the database.
 *
 * @global object
 * @param var $courseid The course ID for the course to reset
 * @param string $action The action to use OLDCLASS or NEWCLASS
 * @return array The status array to pass to turnitintooltwo_reset_userdata
 */
function turnitintooltwo_duplicate_recycle($courseid, $action)
{
    set_time_limit(0);
    global $DB, $USER;
    $config = turnitintooltwo_admin_config();
    $partsarray = array();
    $error = false;
    $turnitintooltwouser = new turnitintooltwo_user($USER->id, "Instructor");
    $turnitintooltwouser->set_user_values_from_tii();
    $instructorrubrics = $turnitintooltwouser->get_instructor_rubrics();
    if (!($turnitintooltwos = $DB->get_records('turnitintooltwo', array('course' => $courseid)))) {
        turnitintooltwo_print_error('assigngeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
        exit;
    }
    if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
        turnitintooltwo_print_error('coursegeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
        exit;
    }
    foreach ($turnitintooltwos as $turnitintooltwo) {
        if (!($parts = $DB->get_records('turnitintooltwo_parts', array('turnitintooltwoid' => $turnitintooltwo->id, 'deleted' => 0)))) {
            turnitintooltwo_print_error('partgeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
            exit;
        }
        foreach ($parts as $part) {
            $partsarray[$courseid][$turnitintooltwo->id][$part->id]['tiiassignid'] = $part->tiiassignid;
        }
    }
    $currentcourse = turnitintooltwo_assignment::get_course_data($courseid);
    if ($action == "NEWCLASS") {
        // Delete Turnitin class link.
        if (!($delete = $DB->delete_records('turnitintooltwo_courses', array('courseid' => $courseid)))) {
            turnitintooltwo_print_error('coursedeleteerror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
            exit;
        }
        $currentcourse->tii_rel_id = '';
        // Create a new class to use with new parts.
        $tmpassignment = new turnitintooltwo_assignment(0, '', '');
        $newcourse = $tmpassignment->create_tii_course($currentcourse, $USER->id);
        // Join Instructor to class.
        $turnitintooltwouser->join_user_to_class($newcourse->turnitin_cid);
        $currentcourse->turnitin_cid = $newcourse->turnitin_cid;
        $currentcourse->turnitin_ctl = $newcourse->turnitin_ctl;
    }
    // Create array of all the Turnitin assignment ids.
    $assignmentids = array();
    foreach ($partsarray[$courseid] as $tiitoolid => $tiitool) {
        foreach ($tiitool as $partid => $data) {
            $assignmentids[] = $data['tiiassignid'];
        }
    }
    // Update all the assignments and parts from Turnitin.
    $turnitintooltwoassignment = new turnitintooltwo_assignment(0, '', '');
    $turnitintooltwoassignment->update_assignment_from_tii($assignmentids);
    // Loop through Turnitintool instances and re-create assignment on Turnitin then swap over the stored Turnitin ids.
    foreach ($partsarray[$courseid] as $tiitoolid => $tiitool) {
        $turnitintooltwoassignment = new turnitintooltwo_assignment($tiitoolid);
        // Create new Assignment parts on Turnitin.
        $i = 0;
        foreach ($tiitool as $partid => $data) {
            $i++;
            $assignment = new TiiAssignment();
            $assignment->setClassId($currentcourse->turnitin_cid);
            $assignment->setAuthorOriginalityAccess($turnitintooltwoassignment->turnitintooltwo->studentreports);
            $rubric_id = !empty($turnitintooltwoassignment->turnitintooltwo->rubric) ? $turnitintooltwoassignment->turnitintooltwo->rubric : '';
            $rubric_id = !empty($rubric_id) && array_key_exists($rubric_id, $instructorrubrics) ? $rubric_id : '';
            $assignment->setRubricId($rubric_id);
            $assignment->setSubmitPapersTo($turnitintooltwoassignment->turnitintooltwo->submitpapersto);
            $assignment->setResubmissionRule($turnitintooltwoassignment->turnitintooltwo->reportgenspeed);
            $assignment->setBibliographyExcluded($turnitintooltwoassignment->turnitintooltwo->excludebiblio);
            $assignment->setQuotedExcluded($turnitintooltwoassignment->turnitintooltwo->excludequoted);
            $assignment->setSmallMatchExclusionType($turnitintooltwoassignment->turnitintooltwo->excludetype);
            $assignment->setSmallMatchExclusionThreshold((int) $turnitintooltwoassignment->turnitintooltwo->excludevalue);
            if ($config->useanon) {
                $assignment->setAnonymousMarking($turnitintooltwoassignment->turnitintooltwo->anon);
            }
            $assignment->setLateSubmissionsAllowed($turnitintooltwoassignment->turnitintooltwo->allowlate);
            if ($config->repositoryoption == 1) {
                $assignment->setInstitutionCheck(isset($turnitintooltwoassignment->turnitintooltwo->institution_check) ? $turnitintooltwoassignment->turnitintooltwo->institution_check : 0);
            }
            $attribute = "maxmarks" . $i;
            $assignment->setMaxGrade($turnitintooltwoassignment->turnitintooltwo->{$attribute});
            $assignment->setSubmittedDocumentsCheck($turnitintooltwoassignment->turnitintooltwo->spapercheck);
            $assignment->setInternetCheck($turnitintooltwoassignment->turnitintooltwo->internetcheck);
            $assignment->setPublicationsCheck($turnitintooltwoassignment->turnitintooltwo->journalcheck);
            $assignment->setTranslatedMatching($turnitintooltwoassignment->turnitintooltwo->transmatch);
            $assignment->setAllowNonOrSubmissions($turnitintooltwoassignment->turnitintooltwo->allownonor);
            // Erater settings.
            $assignment->setErater(isset($turnitintooltwoassignment->turnitintooltwo->erater) ? $turnitintooltwoassignment->turnitintooltwo->erater : 0);
            $assignment->setEraterSpelling($turnitintooltwoassignment->turnitintooltwo->erater_spelling);
            $assignment->setEraterGrammar($turnitintooltwoassignment->turnitintooltwo->erater_grammar);
//.........这里部分代码省略.........
开发者ID:aolley,项目名称:MoodleDirectV2,代码行数:101,代码来源:lib.php

示例9: tii_submission


//.........这里部分代码省略.........
     } else {
         $instructor = new turnitintooltwo_user($submitter, 'Instructor');
         $instructor->edit_tii_user();
         $submission->setSubmitterUserId($instructor->tii_user_id);
         $submission->setRole('Instructor');
     }
     $submission->setSubmissionDataPath($tempfile);
     // Initialise Comms Object.
     $turnitincomms = new turnitin_comms();
     $turnitincall = $turnitincomms->initialise_api();
     try {
         $response = $turnitincall->{$apimethod}($submission);
         $newsubmission = $response->getSubmission();
         $newsubmissionid = $newsubmission->getSubmissionId();
         $plagiarismfile = new stdClass();
         if ($apimethod == "replaceSubmission" || $submissionid != 0) {
             $plagiarismfile->id = $submissionid;
         }
         $plagiarismfile->cm = $cm->id;
         $plagiarismfile->userid = $user->id;
         $plagiarismfile->submitter = $submitter;
         $plagiarismfile->identifier = $identifier;
         $plagiarismfile->externalid = $newsubmissionid;
         $plagiarismfile->statuscode = 'success';
         $plagiarismfile->similarityscore = null;
         $plagiarismfile->attempt = !empty($previoussubmission) ? $previoussubmission->attempt + 1 : 1;
         $plagiarismfile->transmatch = 0;
         $plagiarismfile->lastmodified = time();
         $plagiarismfile->submissiontype = $submissiontype;
         $plagiarismfile->errorcode = null;
         $plagiarismfile->errormsg = null;
         if ($apimethod == "replaceSubmission" || $submissionid != 0) {
             if (!$DB->update_record('plagiarism_turnitin_files', $plagiarismfile)) {
                 turnitintooltwo_activitylog("Update record failed (CM: " . $cm->id . ", User: " . $user->id . ")", "PP_UPDATE_SUB");
             }
         } else {
             if (!($fileid = $DB->insert_record('plagiarism_turnitin_files', $plagiarismfile))) {
                 turnitintooltwo_activitylog("Insert record failed (CM: " . $cm->id . ", User: " . $user->id . ")", "PP_INSERT_SUB");
             }
         }
         // Delete the tempfile.
         if (!is_null($tempfile)) {
             unlink($tempfile);
         }
         // Add config field to show submissions have been made which we use to lock anonymous marking setting
         $configfield = new stdClass();
         $configfield->cm = $cm->id;
         $configfield->name = 'submitted';
         $configfield->value = 1;
         if (!($currentconfigfield = $DB->get_field('plagiarism_turnitin_config', 'id', array('cm' => $cm->id, 'name' => 'submitted')))) {
             if (!$DB->insert_record('plagiarism_turnitin_config', $configfield)) {
                 turnitintooltwo_print_error('defaultupdateerror', 'plagiarism_turnitin', null, null, __FILE__, __LINE__);
             }
         }
         // Send a message to the user's Moodle inbox with the digital receipt.
         $receipt = new pp_receipt_message();
         $input = array('firstname' => $user->firstname, 'lastname' => $user->lastname, 'submission_title' => $title, 'assignment_name' => $moduledata->name, 'course_fullname' => $coursedata->turnitin_ctl, 'submission_date' => date('d-M-Y h:iA'), 'submission_id' => $newsubmissionid);
         $message = $receipt->build_message($input);
         $receipt->send_message($user->id, $message);
         // Output a message in the cron for successfull submission to Turnitin.
         $outputvars = new stdClass();
         $outputvars->title = $title;
         $outputvars->submissionid = $newsubmissionid;
         $outputvars->assignmentname = $moduledata->name;
         $outputvars->coursename = $coursedata->turnitin_ctl;
         mtrace(get_string('cronsubmittedsuccessfully', 'plagiarism_turnitin', $outputvars));
     } catch (Exception $e) {
         $errorstring = empty($previoussubmission->externalid) ? "pp_createsubmissionerror" : "pp_updatesubmissionerror";
         $plagiarismfile = new stdClass();
         if ($submissionid != 0) {
             $plagiarismfile->id = $submissionid;
         }
         $plagiarismfile->attempt = !empty($previoussubmission) ? $previoussubmission->attempt + 1 : 1;
         $plagiarismfile->cm = $cm->id;
         $plagiarismfile->userid = $user->id;
         $plagiarismfile->submitter = $submitter;
         $plagiarismfile->identifier = $identifier;
         $plagiarismfile->statuscode = 'error';
         $plagiarismfile->lastmodified = time();
         $plagiarismfile->submissiontype = $submissiontype;
         $plagiarismfile->errorcode = 0;
         $plagiarismfile->errormsg = get_string('pp_submission_error', 'plagiarism_turnitin') . ' ' . $e->getMessage();
         if ($submissionid != 0) {
             if (!$DB->update_record('plagiarism_turnitin_files', $plagiarismfile)) {
                 turnitintooltwo_activitylog("Update record failed (CM: " . $cm->id . ", User: " . $user->id . ") - ", "PP_UPDATE_SUB_ERROR");
             }
         } else {
             if (!($fileid = $DB->insert_record('plagiarism_turnitin_files', $plagiarismfile))) {
                 turnitintooltwo_activitylog("Insert record failed (CM: " . $cm->id . ", User: " . $user->id . ") - ", "PP_INSERT_SUB_ERROR");
             }
         }
         $turnitincomms->handle_exceptions($e, $errorstring, false);
         mtrace('-------------------------');
         mtrace(get_string('pp_submission_error', 'plagiarism_turnitin') . ': ' . $e->getMessage());
         mtrace('User:  ' . $user->id . ' - ' . $user->firstname . ' ' . $user->lastname . ' (' . $user->email . ')');
         mtrace('Course Module: ' . $cm->id . '');
         mtrace('-------------------------');
     }
     return true;
 }
开发者ID:jmcgettrick,项目名称:moodle-plagiarism_turnitin,代码行数:101,代码来源:lib.php

示例10: stdClass

                $defaultfield = new stdClass();
                $defaultfield->cm = null;
                $defaultfield->name = $field;
                if ($field == 'plagiarism_locked_message') {
                    $defaultfield->value = optional_param($field, '', PARAM_TEXT);
                } else {
                    $defaultfield->value = optional_param($field, '', PARAM_ALPHANUMEXT);
                }
                if (isset($plugindefaults[$field])) {
                    $defaultfield->id = $DB->get_field('plagiarism_turnitin_config', 'id', array('cm' => null, 'name' => $field));
                    if (!$DB->update_record('plagiarism_turnitin_config', $defaultfield)) {
                        turnitintooltwo_print_error('defaultupdateerror', 'plagiarism_turnitin', null, null, __FILE__, __LINE__);
                    }
                } else {
                    if (!$DB->insert_record('plagiarism_turnitin_config', $defaultfield)) {
                        turnitintooltwo_print_error('defaultinserterror', 'plagiarism_turnitin', null, null, __FILE__, __LINE__);
                    }
                }
            }
            $_SESSION['notice']['message'] = get_string('defaultupdated', 'plagiarism_turnitin');
            redirect(new moodle_url('/plagiarism/turnitin/settings.php', array('do' => 'defaults')));
            exit;
            break;
        case "deletefile":
            $id = optional_param('id', 0, PARAM_INT);
            $DB->update_record('plagiarism_turnitin_files', array('id' => $id, 'statuscode' => "deleted"));
            redirect(new moodle_url('/plagiarism/turnitin/settings.php', array('do' => 'errors')));
            exit;
            break;
    }
}
开发者ID:uofr,项目名称:moodle-plagiarism_turnitin,代码行数:31,代码来源:settings.php

示例11: object

                $defaultfield = new object();
                $defaultfield->cm = 0;
                $defaultfield->name = $field;
                if ($field == 'plagiarism_locked_message') {
                    $defaultfield->value = optional_param($field, '', PARAM_TEXT);
                } else {
                    $defaultfield->value = optional_param($field, '', PARAM_ALPHANUMEXT);
                }
                if (isset($plugindefaults[$field])) {
                    $defaultfield->id = $DB->get_field('plagiarism_turnitin_config', 'id', array('cm' => 0, 'name' => $field));
                    if (!$DB->update_record('plagiarism_turnitin_config', $defaultfield)) {
                        turnitintooltwo_print_error('defaultupdateerror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
                    }
                } else {
                    if (!$DB->insert_record('plagiarism_turnitin_config', $defaultfield)) {
                        turnitintooltwo_print_error('defaultinserterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
                    }
                }
            }
            $_SESSION['notice']['message'] = get_string('defaultupdated', 'turnitintooltwo');
            redirect(new moodle_url('/plagiarism/turnitin/settings.php', array('do' => 'defaults')));
            exit;
            break;
        case "deletefile":
            $id = optional_param('id', 0, PARAM_INT);
            $DB->delete_records('plagiarism_turnitin_files', array('id' => $id));
            redirect(new moodle_url('/plagiarism/turnitin/settings.php', array('do' => 'errors')));
            exit;
            break;
    }
}
开发者ID:amclarty,项目名称:moodle-plagiarism_turnitin,代码行数:31,代码来源:settings.php

示例12: turnitintooltwo_view

// 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   turnitintooltwo
 * @copyright 2010 iParadigms LLC
 */
require_once __DIR__ . "/../../config.php";
require_once __DIR__ . "/lib.php";
require_once __DIR__ . "/turnitintooltwo_view.class.php";
$turnitintooltwoview = new turnitintooltwo_view();
// Load Javascript and CSS.
$turnitintooltwoview->load_page_components();
$id = required_param('id', PARAM_INT);
// Course id.
// Configure URL correctly.
$urlparams = array('id' => $id);
$url = new moodle_url('/mod/turnitintooltwo/index.php', $urlparams);
// Get course data.
if (!($course = $DB->get_record("course", array("id" => $id)))) {
    turnitintooltwo_print_error('courseiderror', 'turnitintooltwo');
}
require_login($course->id);
// Print the header.
$extranavigation = array(array('title' => get_string("modulenameplural", "turnitintooltwo"), 'url' => null));
$turnitintooltwoview->output_header(null, $course, $url, get_string("modulenameplural", "turnitintooltwo"), $SITE->fullname, $extranavigation, '', '', true);
echo $turnitintooltwoview->show_assignments($course);
echo $OUTPUT->footer();
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:31,代码来源:index.php

示例13: tii_submission


//.........这里部分代码省略.........
     $turnitincall = $turnitincomms->initialise_api();
     try {
         $response = $turnitincall->{$apimethod}($submission);
         $newsubmission = $response->getSubmission();
         $newsubmissionid = $newsubmission->getSubmissionId();
         $plagiarismfile = new object();
         if ($apimethod == "replaceSubmission" || $submissionid != 0) {
             $plagiarismfile->id = $submissionid;
         }
         $plagiarismfile->cm = $cm->id;
         $plagiarismfile->userid = $user->id;
         $plagiarismfile->identifier = $identifier;
         $plagiarismfile->externalid = $newsubmissionid;
         $plagiarismfile->statuscode = 'success';
         $plagiarismfile->similarityscore = null;
         $plagiarismfile->attempt = 1;
         $plagiarismfile->transmatch = 0;
         $plagiarismfile->lastmodified = time();
         $plagiarismfile->submissiontype = $submissiontype;
         $plagiarismfile->errorcode = null;
         $plagiarismfile->errormsg = null;
         if ($apimethod == "replaceSubmission" || $submissionid != 0) {
             if (!$DB->update_record('plagiarism_turnitin_files', $plagiarismfile)) {
                 turnitintooltwo_activitylog("Update record failed (CM: " . $cm->id . ", User: " . $user->id . ")", "PP_UPDATE_SUB");
             }
         } else {
             if (!($fileid = $DB->insert_record('plagiarism_turnitin_files', $plagiarismfile))) {
                 turnitintooltwo_activitylog("Insert record failed (CM: " . $cm->id . ", User: " . $user->id . ")", "PP_INSERT_SUB");
             }
         }
         // Delete the tempfile.
         if (!is_null($tempfile)) {
             unlink($tempfile);
         }
         // Add config field to show submissions have been made which we use to lock anonymous marking setting
         $configfield = new object();
         $configfield->cm = $cm->id;
         $configfield->name = 'submitted';
         $configfield->value = 1;
         if (!($currentconfigfield = $DB->get_field('plagiarism_turnitin_config', 'id', array('cm' => $cm->id, 'name' => 'submitted')))) {
             if (!$DB->insert_record('plagiarism_turnitin_config', $configfield)) {
                 turnitintooltwo_print_error('defaultupdateerror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
             }
         }
         $return["success"] = true;
         $return["message"] = get_string('submissionuploadsuccess', 'turnitintooltwo') . '<br/>' . get_string('turnitinsubmissionid', 'turnitintooltwo') . ': ' . $newsubmissionid;
         //Send a message to the user's Moodle inbox with the digital receipt.
         if (!empty($CFG->smtphosts) && !empty($CFG->smtpuser) && !empty($CFG->smtppass)) {
             $receipt = new receipt_message();
             $moduledata = $DB->get_record($cm->modname, array('id' => $cm->instance));
             $coursedata = turnitintooltwo_assignment::get_course_data($cm->course, 'PP', 'cron');
             $input = array('firstname' => $user->firstname, 'lastname' => $user->lastname, 'submission_title' => $title, 'assignment_name' => $moduledata->name, 'course_fullname' => $coursedata->turnitin_ctl, 'submission_date' => date('d-M-Y h:iA'), 'submission_id' => $newsubmissionid);
             $message = $receipt->build_message($input);
             $receipt->send_message($user->id, $message);
         }
         if ($context == 'cron') {
             return true;
         }
     } catch (Exception $e) {
         $errorstring = empty($previoussubmission->externalid) ? "pp_createsubmissionerror" : "pp_updatesubmissionerror";
         $return["success"] = false;
         $return["message"] = get_string('pp_submission_error', 'turnitintooltwo') . ' ' . $e->getMessage();
         $plagiarismfile = new object();
         if ($submissionid != 0) {
             $plagiarismfile->id = $submissionid;
             // Get attempt no
             $current_record = $DB->get_record('plagiarism_turnitin_files', array("id" => $submissionid));
             $plagiarismfile->attempt = $current_record->attempt + 1;
         } else {
             $plagiarismfile->attempt = 1;
         }
         $plagiarismfile->cm = $cm->id;
         $plagiarismfile->userid = $user->id;
         $plagiarismfile->identifier = $identifier;
         $plagiarismfile->statuscode = 'error';
         $plagiarismfile->lastmodified = time();
         $plagiarismfile->submissiontype = $submissiontype;
         $plagiarismfile->errorcode = 0;
         $plagiarismfile->errormsg = $return["message"];
         if ($submissionid != 0) {
             if (!$DB->update_record('plagiarism_turnitin_files', $plagiarismfile)) {
                 turnitintooltwo_activitylog("Update record failed (CM: " . $cm->id . ", User: " . $user->id . ") - ", "PP_UPDATE_SUB_ERROR");
             }
         } else {
             if (!($fileid = $DB->insert_record('plagiarism_turnitin_files', $plagiarismfile))) {
                 turnitintooltwo_activitylog("Insert record failed (CM: " . $cm->id . ", User: " . $user->id . ") - ", "PP_INSERT_SUB_ERROR");
             }
         }
         $turnitincomms->handle_exceptions($e, $errorstring, false);
         if ($context == 'cron') {
             mtrace('-------------------------');
             mtrace(get_string('pp_submission_error', 'turnitintooltwo') . ': ' . $e->getMessage());
             mtrace('User:  ' . $user->id . ' - ' . $user->firstname . ' ' . $user->lastname . ' (' . $user->email . ')');
             mtrace('Course Module: ' . $cm->id . '');
             mtrace('-------------------------');
             return false;
         }
     }
     return $return;
 }
开发者ID:aolley,项目名称:MoodleDirectV2,代码行数:101,代码来源:lib.php


注:本文中的turnitintooltwo_print_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。