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


PHP Answer::getValue方法代码示例

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


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

示例1: array

<?php

require_once 'models/Answer.php';
use RedBean_Facade as R;
$payload = $app->request()->getBody();
$params = array('userid' => 'userid', 'questionid' => 'questionid', 'answer' => 'answer');
$payload = array_intersect_key($payload, $params);
if (empty($payload['questionid'])) {
    throw new \Exception('questionid is required!', 412);
}
$quetion = R::findOne('question', '`id` = ?', array($payload['questionid']));
if (!$quetion) {
    throw new \Exception('Question not found', 404);
}
$answer = new Answer($payload, $quetion);
$answer->validateAnswer();
R::exec('INSERT INTO `answer` (`userid`, `questionid`, `answer`) VALUES (:userid, :questionid, :answer)', array(':userid' => $answer->getValue('userid'), ':questionid' => $answer->getValue('questionid'), ':answer' => $answer->getValue('answer')));
$app->result = $answer->getValues();
开发者ID:sauliusmiklas,项目名称:survey,代码行数:18,代码来源:answers-create.php

示例2: Question

foreach ($survey_questions as $survey_question_id) {
    $question = new Question();
    $question->get_from_db($survey_question_id);
    $question_title = $question->getTitle();
    $question_answers = $question->get_answers();
    // Add question title
    $objPHPExcel->setActiveSheetIndex($sheetId)->mergeCells('A1:N1');
    $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue('A1', $question_title);
    // list answers
    $columnId = 2;
    $alphabetIteration = 0;
    foreach ($question_answers as $question_answer_id) {
        $answer = new Answer();
        $answer->get_from_db($question_answer_id);
        $cell = divideBy26($columnId) . "2";
        $cell_value = $answer->getValue();
        // Add some data
        $objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value);
        $objPHPExcel->getActiveSheet()->getColumnDimension(divideBy26($columnId))->setWidth(15);
        $objPHPExcel->getActiveSheet()->getStyle($cell)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
        $columnId++;
    }
    // list users by question
    $row_id = 3;
    foreach ($voted_users as $voted_user_id) {
        $user = new User();
        $user->get_from_db($voted_user_id);
        $cell = 'A' . $row_id;
        $user_number = $row_id - 2;
        $cell_value = 'User' . $user_number;
        // Add some data
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:surveyReport.php

示例3: array

                    $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());
                    ?>
" 
                                                <?php 
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey.php

示例4: Answer

// Multicell test
$txt = '№';
$pdf->MultiCell(10, '', $txt, 1, 'C', 1, 0, '', '', true);
$txt = 'Отговор';
$pdf->MultiCell(140, '', $txt, 1, 'C', 1, 0, '', '', true);
$txt = 'Тип';
$pdf->MultiCell(30, '', $txt, 1, 'C', 1, 1, '', '', true);
// set color for background
$pdf->SetFillColor(255, 255, 255);
$number_answer = 1;
foreach ($answers as $answer_id) {
    $answer = new Answer();
    $answer->get_from_db($answer_id);
    $txt = $number_answer;
    $pdf->MultiCell(10, '', $txt, 1, 'C', 1, 0, '', '', true);
    $txt = $answer->getValue();
    $pdf->MultiCell(140, '', $txt, 1, 'C', 1, 0, '', '', true);
    $txt = $answer->getType();
    $pdf->MultiCell(30, '', $txt, 1, 'C', 1, 1, '', '', true);
    $number_answer++;
}
$pdf->Ln(5);
// set font
$pdf->SetFont('freeserif', 'B', 14);
$txt = 'Групи';
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0);
// set color for background
$pdf->SetFillColor(225, 225, 225);
// set font
$pdf->SetFont('freeserif', '', 12);
// Multicell test
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey_print.php


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