本文整理汇总了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>