本文整理汇总了PHP中Submission::getComments方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::getComments方法的具体用法?PHP Submission::getComments怎么用?PHP Submission::getComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submission
的用法示例。
在下文中一共展示了Submission::getComments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: projectFunctions
/**
* Test projectFunctions
* Testing the functions in the project- and submissionclass
* @author Fredrik Andersson
* @small
* @test
*/
public function projectFunctions()
{
// Create new user class
$sub = new Submission(self::$subid);
//Project::
// Create new project class
$pro = new Project(self::$proid);
// Check if the object was created
$this->assertNotNull($pro);
//Here we test if the updateStage() function works!
$this->assertEquals(2, $pro->stage);
$pro->updateStage();
$this->assertEquals(3, $pro->stage);
//Submission::
//Create a submission to the project
$pro->createSubmission();
//Get the latest submission in the project
$sub;
foreach ($pro->getSubmission() as $key => $value) {
$sub = new Submission($value);
}
//Test to see if the grades are saved.
$sub->grade = 2;
$this->assertEquals(2, $sub->grade);
//Comments::
//Write a comment to the submission
$submissionCommentIndex = array();
$comment = "Some comment..";
$commentId = new Comment(null, $comment);
if ($commentId->id != -1) {
$sub->comments[] = $commentId->id;
$submissionCommentIndex[] = $commentId->id;
$submissionCommentIndex = serialize($submissionCommentIndex);
$ssth = self::$dbh->prepare(SQL_UPDATE_SUBMISSION_COMMENTGRADE_WHERE_ID);
$ssth->bindParam(":comments", $submissionCommentIndex, PDO::PARAM_STR);
$ssth->bindParam(":grade", $sub->grade, PDO::PARAM_INT);
$ssth->bindParam(":id", $sub->id, PDO::PARAM_INT);
$ssth->execute();
}
//See if the comment was added
foreach ($sub->getComments() as $key => $value) {
$this->assertEquals('Some comment..', $value->data);
}
}
示例2: getPID
// Get project id
$pid = getPID();
// Get the course
$course = $GLOBALS['user']->getCourse($cid);
// Get project
$project = $course->getProject($pid);
echo '<div class="row">';
echo '<div class="col-md-3">';
echo '<h2> Project overview </h2>';
// List all submissions
foreach (array_reverse($project->getSubmission()) as $key => $value) {
// Get the submission
$submission = new Submission($value);
echo '<h4>' . $stages[$submission->stage] . '</h4>';
echo 'Date: ' . $submission->date->format('Y-m-d H:i');
foreach ($submission->getComments() as $key => $value) {
echo '</br>Comment: ' . $value->data;
}
if ($submission->grade > 0 && $submission->grade < count($grades)) {
echo '</br>Grade: ' . $grades[$submission->grade];
} else {
if ($submission->grade == 0) {
if ($GLOBALS['user']->hasPrivilege("canGradeProjects")) {
echo '<br><a href="?view=examinatorgrading&pid=' . $project->id . '&sid=' . $submission->id . '">Grade this submission</a>';
}
if ($submission->userHasReviewed()) {
echo '<br><a href="?view=projectreviews&sid=' . $submission->id . '">View reviews</a>';
}
if ($stages[$submission->stage] == STAGE_PLAN && $GLOBALS['user']->hasPrivilege("canReview")) {
echo '<br><a href="?view=reviewplan&sid=' . $submission->id . '">Review this submission</a>';
} else {