本文整理汇总了PHP中Submission类的典型用法代码示例。如果您正苦于以下问题:PHP Submission类的具体用法?PHP Submission怎么用?PHP Submission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Submission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMods34SchemaSubmissionAdapter
/**
* @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: updateSubmission
public static function updateSubmission()
{
// Process updating submissions
$submissions = SubmissionsDB::getSubmissionsBy('submissionId', $_SESSION['arguments']);
if (empty($submissions)) {
HomeView::show();
header('Location: /' . $_SESSION['base']);
} elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
$_SESSION['submissions'] = $submissions;
SubmissionView::showUpdate();
} else {
$parms = $submissions[0]->getParameters();
$parms['submissionFile'] = array_key_exists('submissionFile', $_POST) ? $_POST['submissionFile'] : "";
$newSubmission = new Submission($parms);
$newSubmission->setSubmissionId($submissions[0]->getSubmissionId());
$submission = SubmissionsDB::updateSubmission($newSubmission);
if ($submission->getErrorCount() != 0) {
$_SESSION['submissions'] = array($newSubmission);
SubmissionView::showUpdate();
} else {
HomeView::show();
header('Location: /' . $_SESSION['base']);
}
}
}
示例3: testExecute_PlainSystemCommand
public function testExecute_PlainSystemCommand()
{
$submission = new Submission();
$submission->setWorkDir('/home/guilherme/Documentos/PHP_Projeto/');
$gcccompiler = new GccCompiler();
$runner = new Runner();
$judge = new Judge($gcccompiler, $runner);
$judge->judge('/home/guilherme/Documentos/PHP_Projeto/', $submission, 'Prime');
}
示例4: create_submission
/**
* @response - array
*
* Inserts the user submissions into the database
*/
public static function create_submission($response)
{
$submission = new Submission();
foreach ($response as $key => $val) {
$submission->{$key} = $val;
}
if ($submission->save()) {
return true;
}
return false;
}
示例5: getSubmissionsArray
public static function getSubmissionsArray($rowSets)
{
// Return an array of Submission objects extracted from $rowSets
$submissions = array();
foreach ($rowSets as $submissionRow) {
$submission = new Submission($submissionRow);
$submission->setSubmissionId($submissionRow['submissionId']);
array_push($submissions, $submission);
}
return $submissions;
}
示例6: testUpdateSubmission
public function testUpdateSubmission()
{
ob_start();
$validSubmission = array("submitterName" => "krobbins", "assignmentNumber" => "1", "submissionFile" => "myText.apl");
$s1 = new Submission($validSubmission);
$s1->setSubmissionId(1);
$_SESSION = array('submission' => $s1, 'base' => "mvcdbcrud");
SubmissionView::showUpdate();
$output = ob_get_clean();
$this->assertFalse(empty($output), "It should show an update form");
}
示例7: checkoutWithPaypal
function checkoutWithPaypal($total, $cart)
{
try {
$paypal = new PayPal(true);
} catch (Exception $e) {
Logger::i()->writeLog("Caught Exception: " . $e->getMessage(), 'dev');
die;
}
$params = array('RETURNURL' => createURLForScript("process.php"), 'CANCELURL' => createURLForScript("cancel.php"), 'PAYMENTREQUEST_0_AMT' => floatval(number_format(floatval($total), 2)), 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR');
$params['SOLUTIONTYPE'] = "Sole";
$params['LANDINGPAGE'] = "Billing";
$k = 0;
foreach ($cart as $key => $value) {
$info = (array) $value;
$params['L_PAYMENTREQUEST_0_NAME' . $k] = $info["name"];
$params['L_PAYMENTREQUEST_0_DESCR' . $k] = $info["description"];
$params['L_PAYMENTREQUEST_0_AMT' . $k] = floatval(number_format(floatval($info['price']), 2));
$params['L_PAYMENTREQUEST_0_QTY' . $k] = intval($info['quantity']);
$k++;
}
$response = $paypal->doRequest("SetExpressCheckout", $params);
if ($response) {
Logger::i()->writeLog("Starting PayPal checkout");
return $paypal->generateURL($response['TOKEN']);
} else {
Logger::i()->writeLog("Could not get token, error = " . $paypal->error, 'dev');
die(Submission::createResult("Can not checkout at the moment. Please try again later."));
}
}
示例8: _getAccessibleStageRoles
/**
* Check for roles that give access to the passed workflow stage.
* @param int $userId
* @param int $contextId
* @param Submission $submission
* @param int $stageId
* @return array
*/
function _getAccessibleStageRoles($userId, $contextId, &$submission, $stageId)
{
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
/* @var $stageAssignmentDao StageAssignmentDAO */
$userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
$accessibleStageRoles = array();
foreach ($userRoles as $roleId) {
switch ($roleId) {
case ROLE_ID_MANAGER:
// Context managers have access to all submission stages.
$accessibleStageRoles[] = $roleId;
break;
case ROLE_ID_ASSISTANT:
case ROLE_ID_SUB_EDITOR:
case ROLE_ID_AUTHOR:
// The requested workflow stage has been assigned to them
// in the requested submission.
$stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), $roleId, $stageId, $userId);
if (!$stageAssignments->wasEmpty()) {
$accessibleStageRoles[] = $roleId;
}
break;
default:
break;
}
}
return $accessibleStageRoles;
}
示例9: addAuthor
/**
* Add an author.
* @param $author Author
*/
function addAuthor($author)
{
if ($author->getSubmissionId() == null) {
$author->setSubmissionId($this->getId());
}
parent::addAuthor($author);
}
示例10: listNotes
/**
* List signoff notes.
* @param $args array
* @param $request PKPRequest
* @return string Serialized JSON object
*/
function listNotes($args, $request)
{
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$noteDao = DAORegistry::getDAO('NoteDAO');
$notesFactory = $noteDao->getByAssoc(ASSOC_TYPE_SIGNOFF, $this->_signoff->getId());
$notes = $notesFactory->toAssociativeArray();
// Get any note files.
$noteFilesDownloadLink = array();
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/** @var $submissionFileDao SubmissionFileDAO */
import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
foreach ($notes as $noteId => $note) {
$file = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $noteId, $this->_submission->getId(), SUBMISSION_FILE_NOTE);
// We don't expect more than one file per note
$file = current($file);
// Get the download file link action.
if ($file) {
$noteFilesDownloadLink[$noteId] = new DownloadFileLinkAction($request, $file, $this->_stageId);
}
}
$user = $request->getUser();
import('lib.pkp.classes.core.ArrayItemIterator');
$templateMgr->assign('notes', new ArrayItemIterator($notes));
$templateMgr->assign('noteFilesDownloadLink', $noteFilesDownloadLink);
$templateMgr->assign('notesListId', 'notesList');
$templateMgr->assign('currentUserId', $user->getId());
$templateMgr->assign('notesDeletable', false);
$json = new JSONMessage(true, $templateMgr->fetch('controllers/informationCenter/notesList.tpl'));
$json->setEvent('dataChanged');
return $json->getString();
}
示例11: getCellActions
/**
* @copydoc GridCellProvider::getCellActions()
*/
function getCellActions($request, $row, $column)
{
switch ($column->getId()) {
case 'contents':
$element = $row->getData();
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
$submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_NOTE, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_QUERY);
import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
$actions = array();
foreach ($submissionFiles as $submissionFile) {
$actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId'));
}
return $actions;
}
return parent::getCellActions($request, $row, $column);
}
示例12: testUpdateSubmission
public function testUpdateSubmission()
{
$myDb = DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$beforeCount = count(SubmissionsDB::getSubmissionsBy());
$submissions = SubmissionsDB::getSubmissionsBy('submissionId', 1);
$currentSubmission = $submissions[0];
$parms = $currentSubmission->getParameters();
$parms['submissionFile'] = 'newFile.txt';
$newSubmission = new Submission($parms);
$newSubmission->setSubmissionId($currentSubmission->getSubmissionId());
$updatedSubmission = SubmissionsDB::updateSubmission($newSubmission);
$afterCount = count(SubmissionsDB::getSubmissionsBy());
$this->assertEquals($beforeCount, $afterCount, 'The number of submission in the database should not change after update');
$this->assertEquals($updatedSubmission->getSubmissionId(), $newSubmission->getSubmissionId(), 'The id of the updated submission should remain the same');
}
示例13: deleteCustomer
function deleteCustomer($c)
{
$delete = DbManager::i()->delete("sf_members", array("userid" => intval($c)));
if (!$delete) {
Logger::i()->writeLog("Deleting customer {$c} failed, error = " . DbManager::i()->error, 'dev');
return Submission::createResult("Could not delete customer");
}
return Submission::createResult("Customer deleted", true);
}
示例14: testIdNumbering
public function testIdNumbering()
{
/* try to see if the dirs are being created */
$this->assertEquals(get_file_name("data/uploads/0/020"), Submission::getPathToCodeFromId(20));
$this->assertEquals(get_file_name("data/uploads/1/000"), Submission::getPathToCodeFromId(1000));
$this->assertEquals(get_file_name("data/uploads/1/999"), Submission::getPathToCodeFromId(1999));
$this->assertEquals(get_file_name("data/uploads/178/456"), Submission::getPathToCodeFromId(178456));
assert(is_dir(get_file_name("data/uploads/1")));
assert(is_dir(get_file_name("data/uploads/178")));
}
示例15: getCellActions
/**
* @copydoc GridCellProvider::getCellActions()
*/
function getCellActions($request, $row, $column)
{
switch ($column->getId()) {
case 'label':
$element = $row->getData();
if ($element->getRemoteUrl() != '' || !$element->getFileId()) {
break;
}
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
$submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_REPRESENTATION, $element->getId(), $this->_submission->getId(), SUBMISSION_FILE_PROOF);
import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
$actions = array();
foreach ($submissionFiles as $submissionFile) {
$actions[] = new DownloadFileLinkAction($request, $submissionFile, $request->getUserVar('stageId'), $element->getLabel());
}
return $actions;
}
return parent::getCellActions($request, $row, $column);
}