本文整理汇总了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();
示例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
示例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
示例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