當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Submission::setSubmissionId方法代碼示例

本文整理匯總了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']);
         }
     }
 }
開發者ID:bennilyn,項目名稱:examples,代碼行數:25,代碼來源:SubmissionController.class.php

示例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");
 }
開發者ID:bennilyn,項目名稱:examples,代碼行數:11,代碼來源:SubmissionViewTest.php

示例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;
 }
開發者ID:bennilyn,項目名稱:examples,代碼行數:11,代碼來源:SubmissionsDB.class.php

示例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');
 }
開發者ID:bennilyn,項目名稱:examples,代碼行數:17,代碼來源:SubmissionsDBTest.php

示例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>
開發者ID:bennilyn,項目名稱:examples,代碼行數:30,代碼來源:SubmissionView_tests.php


注:本文中的Submission::setSubmissionId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。