本文整理汇总了PHP中Answer::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::getType方法的具体用法?PHP Answer::getType怎么用?PHP Answer::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_survey_answer
function add_survey_answer()
{
// get global user object
global $user;
// protect from unauthorized access
if (!isset($user) or !isset($_POST['formSurveyAddAnswerSubmit']) or !isset($_POST['formSurveyAddAnswer']) or !isset($_POST['formSurveyAddAnswerType'])) {
if ($_POST['formSurveyAddAnswerNew'] != 'formSurveyAddAnswerNew') {
logout();
die;
}
}
// set empty answer obj
$session_answers = get_session_answers();
$answer = new Answer();
$answer->setValue($_POST['formSurveyAddAnswer']);
$answer->setDescription($_POST['formSurveyAddAnswerDescription']);
$answer->setType($_POST['formSurveyAddAnswerType']);
if ($answer->getType() == 'null') {
$cookie_key = 'msg';
$cookie_value = 'Моля, изберете тип на отговора за анкетната, за да го добавите!';
setcookie($cookie_key, $cookie_value, time() + 1);
header('Location: ' . ROOT_DIR . '?page=survey_add_answer');
die;
}
array_push($session_answers, $answer);
$_SESSION['session_answers'] = serialize($session_answers);
$cookie_key = 'msg';
$cookie_value = 'Вие добавихте поделемент в анкетата!';
setcookie($cookie_key, $cookie_value, time() + 1);
header('Location: ' . ROOT_DIR . '?page=survey_add_answer');
}
示例2: elseif
?>
<small><?php
print_r($answer->getDescription());
?>
</small>
</label>
<input
id="formSurvey<?php
print_r($question->getId());
?>
Answer<?php
print_r($answer->getId());
?>
"
<?php
if ($answer->getType() == "radio") {
print 'name="formSurvey' . $question->getId() . 'Answer" ';
} else {
print 'name="formSurvey' . $question->getId() . 'Answer' . $answer->getId() . 'Type' . $answer->getType() . '" ';
}
?>
type="<?php
print $answer->getType();
?>
"
value="<?php
if ($answer->getType() == "radio" || $answer->getType() == "checkbox") {
print_r($answer_id);
} elseif ($answer->getType() == "text" && $has_answered == TRUE) {
print_r($vote->getValue());
}
示例3: foreach
"
class="form ac"
action="<?php
echo ROOT_DIR . '?page=survey_edit&funct=elementFunction';
?>
"
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>
示例4: foreach
$user_number = $row_id - 2;
$cell_value = 'User' . $user_number;
// Add some data
$objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value);
// list votes by user
$columnId = 2;
foreach ($question_answers as $question_answer_id) {
$vote = new Vote();
$vote_id_array = $vote->get_by_user_and_answer($voted_user_id, $question_answer_id);
$cell_value = "";
$answer = new Answer();
$answer->get_from_db($question_answer_id);
if (!empty($vote_id_array)) {
$vote_id = $vote_id_array[0];
$vote->get_from_db($vote_id);
if ($answer->getType() == "radio" || $answer->getType() == "checkbox") {
$cell_value = 1;
} elseif ($answer->getType() == "text") {
$cell_value = $vote->getValue();
}
}
// fill in cell
$cell = divideBy26($columnId) . $row_id;
// Add some data
$objPHPExcel->setActiveSheetIndex($sheetId)->setCellValue($cell, $cell_value);
$objPHPExcel->getActiveSheet()->getStyle($cell)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// increase column number
$columnId++;
}
// increase row number
$row_id++;
示例5: Answer
$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
$txt = '№';
$pdf->MultiCell(10, '', $txt, 1, 'C', 1, 0, '', '', true);