当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::getLastRevision方法代码示例

本文整理汇总了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;
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:21,代码来源:Test.php

示例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;
    }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:61,代码来源:Slide.php

示例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;
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:13,代码来源:Question.php


注:本文中的Question::getLastRevision方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。