本文整理匯總了PHP中Submission::setSubmissionId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Submission::setSubmissionId方法的具體用法?PHP Submission::setSubmissionId怎麽用?PHP Submission::setSubmissionId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Submission
的用法示例。
在下文中一共展示了Submission::setSubmissionId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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']);
}
}
}
示例2: 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");
}
示例3: 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;
}
示例4: 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');
}
示例5: array
<?php
$validSubmission = array("submitterName" => "krobbins", "assignmentNumber" => "1", "submissionFile" => "myText.apl");
$s1 = new Submission($validSubmission);
$s1->setSubmissionId(1);
$submissions = array($s1, $s1);
$_SESSION = array('submissions' => $submissions, 'headerTitle' => "ClassBash Submissions", 'footerTitle' => "<h3>The footer goes here</h3>", 'base' => "mvcdbcrud");
SubmissionView::showall();
?>
<h2>It should show a Submission table without a header and a footer</h2>
<?php
$s1->setSubmissionId(1);
$submissions = array($s1, $s1);
$_SESSION = array('submissions' => $submissions, 'base' => "mvcdbcrud");
SubmissionView::showall();
?>
<h2>It should allow updating when a valid submission is passed</h2>
<?php
$validSubmission = array("submitterName" => "krobbins", "assignmentNumber" => "1", "submissionFile" => "myText.apl");
$s1 = new Submission($validSubmission);
$s1->setSubmissionId(1);
$_SESSION = array('submissions' => array($s1), 'base' => "mvcdbcrud");
echo $s1;
SubmissionView::showUpdate();
?>
</body>
</html>