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


PHP Answer::getId方法代码示例

本文整理汇总了PHP中Answer::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::getId方法的具体用法?PHP Answer::getId怎么用?PHP Answer::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Answer的用法示例。


在下文中一共展示了Answer::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Answer

 function test_findById()
 {
     //Arrange
     $test_field = "Joe FindById";
     $test_quest_id = 1;
     $test_answer = new Answer($test_field, $test_quest_id);
     $test_answer->save();
     $test_field2 = "Red FindById";
     $test_quest_id2 = 2;
     $test_answer2 = new Answer($test_field2, $test_quest_id2);
     $test_answer2->save();
     //Act
     $result = Answer::findById($test_answer->getId());
     //Assert
     $this->assertEquals($test_answer, $result);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:16,代码来源:AnswerTest.php

示例2: flush

 /**
  * 
  * @param Answer $answer
  * @return int id of the Answer inserted in base. False if it didn't work.
  */
 public static function flush($answer)
 {
     $answerId = $answer->getId();
     $answerVar = $answer->getAnswer();
     $answerDate = $answer->getAnswerDate();
     $likert = $answer->getLikert()->getId();
     $user = $answer->getUser()->getId();
     $question = $answer->getQuestion()->getId();
     if ($answerId > 0) {
         $sql = 'UPDATE answer a SET ' . 'a.answer = ?, ' . 'a.answer_date = ?, ' . 'a.LIKERT_id_likert = ?, ' . 'a.USER_id_user = ?, ' . 'a.QUESTION_id_question = ? ' . 'WHERE a.id_answer = ?';
         $params = array('ssiiii', &$answerVar, &$answerDate, &$likert, &$user, &$question, &$answerId);
     } else {
         $sql = 'INSERT INTO answer ' . '(answer, answer_date, LIKERT_id_likert, USER_id_user, QUESTION_id_question) ' . 'VALUES(?, ?, ?, ?, ?)';
         $params = array('ssiii', &$answerVar, &$answerDate, &$likert, &$user, &$question);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $answerId > 0) {
         $idInsert = $answerId;
     }
     return $idInsert;
 }
开发者ID:Eurymone,项目名称:Student-Exam-Report-System,代码行数:26,代码来源:AnswerDAL.php

示例3: Answer

                    $answer = new Answer();
                    $answer->get_from_db($answer_id);
                    $vote = new Vote();
                    $vote_id = 0;
                    $user_vote_by_answer = array();
                    $user_vote_by_answer = get_user_vote_by_answer($user_id, $answer_id);
                    if (!empty($user_vote_by_answer)) {
                        $vote_id = $user_vote_by_answer[0];
                        $vote->get_from_db($vote_id);
                    }
                    ?>
                                            <label for = "formSurvey<?php 
                    print_r($question->getId());
                    ?>
Answer<?php 
                    print_r($answer->getId());
                    ?>
"><?php 
                    print_r($answer->getValue());
                    ?>
                                                <small><?php 
                    print_r($answer->getDescription());
                    ?>
</small>
                                            </label>
                                            <input 
                                                id="formSurvey<?php 
                    print_r($question->getId());
                    ?>
Answer<?php 
                    print_r($answer->getId());
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey.php

示例4: Question

 function test_getAnswers()
 {
     //Arrange
     $test_field = "What is their name?";
     $test_description = "What you want to call your character.";
     $test_question = new Question($test_field, $test_description);
     $test_question->save();
     $test_field = "Joe GetAll";
     $test_quest_id = $test_question->getId();
     $test_answer = new Answer($test_field, $test_quest_id);
     $test_answer->save();
     //Act
     $test_question->addAnswer($test_answer->getId());
     //Assert
     $result = $test_question->getAnswers($test_answer->getId());
     $this->assertEquals($test_answer, $result[0]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:17,代码来源:QuestionTest.php

示例5: function

    }
});
// QUESTION.HTML.TWIG -- needs fixed -- if a question has been deleted, id # is skipped and
// end_flag = true. Need to somehow loop through just the questions in promptr->getQuestions
// the following pages of promptr run -- adding more answers
$app->post("/promptr/{id}/question/{quid}", function ($id, $quid) use($app) {
    $promptr = Promptr::find($id);
    $end_flag = false;
    $answer_field = $_POST['answer'];
    $new_answer = new Answer($answer_field, $quid);
    $new_answer->save();
    ++$quid;
    $question = Question::findTempById($quid);
    $questions = Question::getTempQuestions();
    if ($question != null) {
        $question->addAnswer($new_answer->getId());
        $last_question = end($questions);
        if ($question == $last_question) {
            $end_flag = true;
        }
    }
    return $app['twig']->render('question.html.twig', array('question' => $question, 'end' => $end_flag, 'promptr' => $promptr, 'questions' => $questions));
});
// DISPLAY.HTML.TWIG
// DISPLAY FINISHED answers to promptr run
//will show the concatted together display of the list
$app->get("/promptr/{id}/display", function ($id) use($app) {
    $promptr = Promptr::find($id);
    $questions = Question::getTempQuestions();
    Question::deleteTempQuestions();
    return $app['twig']->render('display.html.twig', array('promptr' => $promptr, 'questions' => $questions));
开发者ID:umamiMike,项目名称:promptr,代码行数:31,代码来源:questionsController.php

示例6: foreach

                              method="POST">
                            <div class="ac">
                                <section class="clearfix prefix_2">
                                    <?php 
            $answers = get_survey_answers($question->getId());
            if (!empty($answers)) {
                foreach ($answers as $answer_id) {
                    $answer = new Answer();
                    $answer->get_from_db($answer_id);
                    if ($answer->getType() == "text" || $answer->getType() == "radio" || $answer->getType() == "checkbox") {
                        ?>
                                                <label for = "formSurvey<?php 
                        print_r($session_survey->getId());
                        ?>
Answer<?php 
                        print_r($answer->getId());
                        ?>
"><?php 
                        print_r($answer->getValue());
                        ?>
                                                    <small><?php 
                        print_r($answer->getDescription());
                        ?>
</small>
                                                </label>
                                                <input id="formSurvey<?php 
                        print_r($session_survey->getId());
                        ?>
Answer<?php 
                        print_r($answer->getId());
                        ?>
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey_edit.php

示例7: Answer

        $group_votes += $group_answer_votes;
        $txt = $group_answer_votes;
        $pdf->MultiCell($result_field_width, '', $txt, 1, 'C', 1, 0, '', '', true, 0, false, true, 8, 'M');
        $number_answer++;
    }
    $pdf->MultiCell(20, '', "{$group_votes}", 1, 'C', 1, 1, '', '', true, 0, false, true, 8, 'M');
    $number_group++;
}
// set color for background
$pdf->SetFillColor(225, 225, 225);
$pdf->MultiCell(20, '', "Всички", 1, 'C', 1, 0, '', '', true, 0, false, true, 8, 'M');
// set color for background
$pdf->SetFillColor(255, 255, 255);
foreach ($answers as $answer_id) {
    $answer = new Answer();
    $answer->get_from_db($answer_id);
    $txt = count(get_votes_by_answer($answer->getId()));
    $pdf->MultiCell($result_field_width, '', $txt, 1, 'C', 1, 0, '', '', true, 0, false, true, 8, 'M');
}
// set color for background
$pdf->SetFillColor(240, 240, 240);
$pdf->MultiCell(20, '', 'Общо', 1, 'C', 1, 1, '', '', true, 0, false, true, 8, 'M');
// ---------------------------------------------------------
ob_end_clean();
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('survey_print.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
unset($_SESSION['survey_id']);
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey_print.php


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