本文整理汇总了PHP中Submission类的典型用法代码示例。如果您正苦于以下问题:PHP Submission类的具体用法?PHP Submission怎么用?PHP Submission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Submission类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:35,代码来源:Mods34SchemaSubmissionAdapterTest.inc.php
示例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']);
}
}
}
开发者ID:bennilyn,项目名称:examples,代码行数:25,代码来源:SubmissionController.class.php
示例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');
}
开发者ID:guirighetto,项目名称:BOCA_PROTEUM,代码行数:9,代码来源:ExecutableRunnerTeste.php
示例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;
}
开发者ID:jbibbs,项目名称:decisiontree,代码行数:16,代码来源:Submission.php
示例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;
}
开发者ID:bennilyn,项目名称:examples,代码行数:11,代码来源:SubmissionsDB.class.php
示例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");
}
开发者ID:bennilyn,项目名称:examples,代码行数:11,代码来源:SubmissionViewTest.php
示例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."));
}
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:29,代码来源:checkout.php
示例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;
}
开发者ID:pkp,项目名称:pkp-lib,代码行数:36,代码来源:UserAccessibleWorkflowStageRequiredPolicy.inc.php
示例9: addAuthor
/**
* Add an author.
* @param $author Author
*/
function addAuthor($author)
{
if ($author->getSubmissionId() == null) {
$author->setSubmissionId($this->getId());
}
parent::addAuthor($author);
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:11,代码来源:Article.inc.php
示例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();
}
开发者ID:doana,项目名称:pkp-lib,代码行数:38,代码来源:SignoffInformationCenterHandler.inc.php
示例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);
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:20,代码来源:QueryNotesGridCellProvider.inc.php
示例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');
}
开发者ID:bennilyn,项目名称:examples,代码行数:17,代码来源:SubmissionsDBTest.php
示例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);
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:9,代码来源:update_customer.php
示例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")));
}
开发者ID:rajatkhanduja,项目名称:opc,代码行数:10,代码来源:SubmissionsTest.php
示例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);
}
开发者ID:selwyntcy,项目名称:ojs,代码行数:23,代码来源:ArticleGalleyGridCellProvider.inc.php
示例16: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$new_post = $_POST;
if (isset($_FILES["submissionFile"])) {
$new_post["submissionFile"] = $_FILES["submissionFile"];
}
$submission = new Submission($new_post);
if ($submission->getErrorCount() != 0) {
SubmissionView::show($submission);
} else {
$user = UsersDB::getUserBy('userName', $submission->getUserName());
if ($user != null) {
HomeView::show($user);
} else {
$submission->setError('userName', 'USER_NAME_DOES_NOT_EXIST');
SubmissionView::show($submission);
}
}
} else {
// Initial link
SubmissionView::show(null);
}
}
开发者ID:bennilyn,项目名称:examples,代码行数:24,代码来源:SubmissionController.class.php
示例17: judge_a_single_submission
function judge_a_single_submission()
{
// Clear all caches, otherwise we would use old data!
Entity::clear_cache();
// Retrieve a submission
global $self;
$subm = Submission::get_pending_submission($self->name . micro_nonce());
if (!$subm) {
// no submissions right now
sleep(DAEMON_SLEEP_TIME);
return;
}
// Some information on this submission
if (VERBOSE) {
echo "\n";
echo "Submission id: ", $subm->submissionid, "\n";
echo "Submission to: ", $subm->entity_path, "\n";
echo "Submited on: ", format_date($subm->time), "\n";
echo "Submission by: ", User::names_text($subm->users()), "\n";
// this slows things down
}
// Let's judge it
try {
$judgement = new SubmissionJudgement($subm);
$judgement->judge();
} catch (Exception $e) {
Log::error($e, $subm->entity_path, $self->name);
echo "Error during judging!\n", $e;
}
if (VERBOSE) {
echo "Result: ", Status::to_text($subm), "\n";
}
// free up some memory
unset($judgement);
unset($subm);
if (function_exists('gc_collect_cycles')) {
// this doesn't exist in PHP < 5.3.0 :(
gc_collect_cycles();
}
if (VERBOSE) {
echo "Memory usage: ", memory_get_usage(), "\n";
}
}
开发者ID:jlsa,项目名称:justitia,代码行数:43,代码来源:judge_daemon.php
示例18: get
public function get($functionName, $linkName, $params = array(), $checkSession = true)
{
$positive = function ($input) {
//$input = $input[count($input)-1];
$result = Model::isEmpty();
$result['content'] = array();
foreach ($input as $inp) {
if ($inp->getNumRows() > 0) {
// extract Submission data from db answer
$res = Submission::ExtractSubmission($inp->getResponse(), false);
$result['content'] = array_merge($result['content'], is_array($res) ? $res : array($res));
$result['status'] = 200;
}
}
return $result;
};
$params = DBJson::mysql_real_escape_string($params);
return $this->_component->call($linkName, $params, '', 200, $positive, array(), 'Model::isProblem', array(), 'Query');
}
开发者ID:sawh,项目名称:ostepu-system,代码行数:19,代码来源:DBSubmission.php
示例19: __construct
function __construct()
{
Authentication::require_admin();
$this->is_admin_page = true;
// find submission
if (!isset($_REQUEST['submissionid'])) {
throw new NotFoundException("Missing parameter: submissionid");
}
$this->subm = Submission::by_id(intval($_REQUEST['submissionid']));
$this->entity = $this->subm->entity();
// rejudge?
if (isset($_REQUEST['rejudge'])) {
$this->subm->rejudge();
// redirect to this page, so a refresh doesn't rejudge again
Util::redirect('admin_view_submission.php?submissionid=' . $_REQUEST['submissionid']);
}
// delete?
if (isset($_REQUEST['delete'], $_POST['confirm']) && $_POST['confirm'] == sha1('confirmed' . $this->subm->submissionid)) {
$this->subm->delete();
Util::redirect('index.php' . $this->entity->path());
}
}
开发者ID:jlsa,项目名称:justitia,代码行数:22,代码来源:admin_view_submission.php
示例20: get_results
/**
* This function is responsible for displaying the results page.
*
* It first sends data to the model for insertion into database.
* If inserted correctly, displays the results page.
*/
public function get_results()
{
if (!($id = Route::input('id'))) {
Log::error('Unable to display results. Route ID not found.');
return Redirect::to('error');
}
if (!($answers = Session::get('answers'))) {
Log::error('Unable to display results. Unable to retreive answers from session.');
return Redirect::to('error');
}
if (!($restart = route('home'))) {
Log::error('Unable to assign the restart button to a route.');
return Redirect::to('error');
}
$responses = self::clean_results($answers);
$submission = self::prepare_submission($id, $answers);
if (Submission::create_submission($submission)) {
return View::make('results', array('heading' => 'Thank you! Your outcome is provided below', 'outcome' => self::$outcomes[$id], 'responses' => $responses, 'restart' => $restart));
}
Log::error('Unable to create submission. Database insertion failed');
return Redirect::to('error');
}
开发者ID:jbibbs,项目名称:decisiontree,代码行数:28,代码来源:ResultsController.php
注:本文中的Submission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论