本文整理汇总了PHP中Question::getLastRevision方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::getLastRevision方法的具体用法?PHP Question::getLastRevision怎么用?PHP Question::getLastRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::getLastRevision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDirectQuestions
public function getDirectQuestions()
{
$this->initConnection();
$questions = array();
$result = array();
$result = $this->dbQuery('SELECT q.id AS id, q.mark AS mark FROM `questions` AS q
JOIN `slide_revision` AS s ON q.item_id = s.slide
JOIN `deck_content` AS d ON s.id = d.item_id
WHERE d.deck_revision_id=:id AND q.mark="accepted" AND d.item_type="slide" AND q.based_on IS NULL', array('id' => $this->item_id));
if (count($result)) {
foreach ($result as $question_row) {
$question = new Question();
$question->createFromID($question_row['id']);
$lastId = $question->getLastRevision();
$lastRevision = new Question();
$lastRevision->createFromID($lastId);
$questions[] = $lastRevision;
}
}
return $questions;
}
示例2: getQuestions
public function getQuestions()
{
$questions = array();
$suggested = array();
$accepted = array();
$doubtful = array();
$basic_id = $this->getBasicId();
if ($basic_id == NULL) {
return array("accepted" => array(), "suggested" => array(), "doubtful" => array());
}
$array = array();
$owner_id = $this->getOwnerID();
$array = $this->dbQuery('SELECT *
FROM questions INNER JOIN users on questions.user_id = users.id
WHERE questions.based_on IS NULL AND questions.mark = "suggested" AND questions.item_id=' . $basic_id);
if (count($array)) {
foreach ($array as $row) {
$question = new Question();
$question->createFromID($row['0']);
$lastId = $question->getLastRevision();
$lastRevision = new Question();
$lastRevision->createFromID($lastId);
$lastRevision->slide_revision = $this->id;
$lastRevision->item_owner = $owner_id;
$suggested[] = $lastRevision;
}
}
$array = $this->dbQuery('SELECT *
FROM questions INNER JOIN users on questions.user_id = users.id
WHERE questions.based_on IS NULL AND questions.mark = "accepted" AND questions.item_id=' . $basic_id);
if (count($array)) {
foreach ($array as $row) {
$question = new Question();
$question->createFromID($row['0']);
$lastId = $question->getLastRevision();
$lastRevision = new Question();
$lastRevision->createFromID($lastId);
$lastRevision->slide_revision = $this->id;
$lastRevision->item_owner = $owner_id;
$accepted[] = $lastRevision;
}
}
$array = $this->dbQuery('SELECT *
FROM questions INNER JOIN users on questions.user_id = users.id
WHERE questions.based_on IS NULL AND questions.mark = "doubtful" AND questions.item_id=' . $basic_id);
if (count($array)) {
foreach ($array as $row) {
$question = new Question();
$question->createFromID($row['0']);
$lastId = $question->getLastRevision();
$lastRevision = new Question();
$lastRevision->createFromID($lastId);
${$lastRevision}->item_owner = $owner_id;
$doubtful[] = $lastRevision;
}
}
$questions['suggested'] = $suggested;
$questions['accepted'] = $accepted;
$questions['doubtful'] = $doubtful;
return $questions;
}
示例3: getLastRevision
public function getLastRevision()
{
$timestamp = $this->timestamp;
$last_id = $this->id;
foreach ($this->dbQuery('SELECT * FROM questions WHERE based_on=:id', array('id' => $last_id)) as $question_row) {
if ($timestamp < $question_row['timestamp']) {
$question = new Question();
$question->createFromID($question_row['id']);
$last_id = $question->getLastRevision();
}
}
return $last_id;
}