当前位置: 首页>>代码示例>>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;未经允许,请勿转载。