/**
  * @covers Mods34SchemaSubmissionAdapter
  */
 public function testMods34SchemaSubmissionAdapter()
 {
     // Test constructor.
     $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)', 'class::lib.pkp.classes.submission.Submission'));
     self::assertEquals(ASSOC_TYPE_CITATION, $adapter->getAssocType());
     self::assertType('Mods34Schema', $adapter->getMetadataSchema());
     self::assertEquals('Submission', $adapter->getDataObjectClass());
     // Instantiate a test description.
     $submissionDescription =& $this->getMods34Description();
     // Instantiate test submission.
     $submission = new Submission();
     $submission->setTitle('previous submission title', 'en_US');
     $submission->setAbstract('previous abstract', 'en_US');
     // Remove the abstract to test whether the injection into existing data works.
     // (The abstract should not be deleted.)
     $submissionDescription->removeStatement('abstract');
     // Test metadata injection (no replace).
     $resultSubmission =& $adapter->injectMetadataIntoDataObject($submissionDescription, $submission, 'lib.pkp.tests.plugins.metadata.mods34.filter.Author');
     $expectedResult = array('cleanTitle' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'title' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'abstract' => array('en_US' => 'previous abstract'), 'sponsor' => array('en_US' => 'Some Sponsor'), 'dateSubmitted' => '2010-07-07', 'language' => 'en', 'pages' => 215, 'coverageGeo' => array('en_US' => 'some geography'), 'mods34:titleInfo/nonSort' => array('en_US' => 'the', 'de_DE' => 'ein'), 'mods34:titleInfo/subTitle' => array('en_US' => 'subtitle', 'de_DE' => 'Subtitel'), 'mods34:titleInfo/partNumber' => array('en_US' => 'part I', 'de_DE' => 'Teil I'), 'mods34:titleInfo/partName' => array('en_US' => 'introduction', 'de_DE' => 'Einführung'), 'mods34:note' => array('en_US' => array('0' => 'some note', '1' => 'another note'), 'de_DE' => array('0' => 'übersetzte Anmerkung')), 'mods34:subject/temporal[@encoding="w3cdtf" @point="start"]' => '1950', 'mods34:subject/temporal[@encoding="w3cdtf" @point="end"]' => '1954');
     self::assertEquals($expectedResult, $resultSubmission->getAllData());
     // Test meta-data extraction.
     $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('class::lib.pkp.classes.submission.Submission', 'metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)'));
     $extractedDescription =& $adapter->extractMetadataFromDataObject($submission);
     $submissionDescription->removeStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]');
     self::assertTrue($submissionDescription->addStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]', date('Y-m-d')));
     self::assertTrue($submissionDescription->addStatement('abstract', $abstract = 'previous abstract'));
     $missingMappings = array('genre[@authority="marcgt"]', 'originInfo/place/placeTerm[@type="text"]', 'originInfo/place/placeTerm[@type="code" @authority="iso3166"]', 'originInfo/publisher', 'originInfo/dateIssued[@keyDate="yes" @encoding="w3cdtf"]', 'originInfo/edition', 'physicalDescription/form[@authority="marcform"]', 'physicalDescription/internetMediaType', 'identifier[@type="isbn"]', 'identifier[@type="doi"]', 'identifier[@type="uri"]', 'location/url[@usage="primary display"]', 'recordInfo/recordIdentifier[@source="pkp"]', 'subject/topic');
     foreach ($missingMappings as $missingMapping) {
         $submissionDescription->removeStatement($missingMapping);
     }
     self::assertEquals($submissionDescription, $extractedDescription);
 }
예제 #2
0
파일: user_work.php 프로젝트: rhertzog/lcs
         // delete the database data of this work
         $sqlDelete = "DELETE FROM `" . $tbl_wrk_submission . "`\n                              WHERE `id` = " . (int) $fileToDelete['id'];
         claro_sql_query($sqlDelete);
     }
 }
 /*--------------------------------------------------------------------
                       CORRECTION OF A WORK
   --------------------------------------------------------------------*/
 /*-----------------------------------
           STEP 2 : check & query
   -------------------------------------*/
 if ($cmd == "exGradeWrk" && isset($_REQUEST['gradedWrkId'])) {
     if (isset($formCorrectlySent) && $formCorrectlySent) {
         $submission->setAssignmentId($assignmentId);
         $submission->setUserId(claro_get_current_user_id());
         $submission->setTitle($wrkForm['wrkTitle']);
         $submission->setAuthor($wrkForm['wrkAuthors']);
         $submission->setVisibility($assignment->getDefaultSubmissionVisibility());
         $submission->setSubmittedText($wrkForm['wrkTxt']);
         $submission->setSubmittedFilename($wrkForm['filename']);
         $submission->setParentId($_REQUEST['gradedWrkId']);
         $submission->setPrivateFeedback($wrkForm['wrkPrivFbk']);
         $submission->setOriginalId($_REQUEST['authId']);
         $submission->setScore($wrkForm['wrkScore']);
         $submission->save();
         $dialogBox->success(get_lang('Feedback added'));
         // notify eventmanager that a new correction has been posted
         $eventNotifier->notifyCourseEvent('work_correction_posted', claro_get_current_course_id(), claro_get_current_tool_id(), $_REQUEST['gradedWrkId'], '0', '0');
         // mail notification if required by configuration
         if (get_conf('mail_notification') && (claro_get_current_course_data('notify_feedbacks') || get_conf('automatic_mail_notification', false))) {
             // get owner(s) email