Ejemplo n.º 1
0
		
		<form id="response-form" action="<?php 
echo JRoute::_('index.php?option=' . S_APP_NAME . '&view=response&task=save_response&id=' . $this->item->id . ':' . $this->item->alias . $itemid);
?>
" method="post">
			<input type="hidden" name="rid" value="<?php 
echo $this->item->response_id;
?>
">
			
			<?php 
$class = '';
foreach ($this->item->questions as $qid => $question) {
    switch ($question->question_type) {
        case 1:
            echo $formfields->get_page_header_question($question, $class);
            break;
        case 2:
            echo $formfields->get_radio_question($question, $class);
            break;
        case 3:
            echo $formfields->get_checkbox_question($question, $class);
            break;
        case 4:
            echo $formfields->get_select_question($question, $class);
            break;
        case 5:
            echo $formfields->get_grid_radio_question($question, $class);
            break;
        case 6:
            echo $formfields->get_grid_checkbox_question($question, $class);
Ejemplo n.º 2
0
 private function get_survey_form($questions)
 {
     $user = JFactory::getUser();
     $options = JComponentHelper::getParams(S_APP_NAME);
     $wysiwyg = $user->authorise('core.wysiwyg', S_APP_NAME);
     $bbcode = $options->get('default_editor', 'bbcode') == 'bbcode' ? true : false;
     $content = $options->get('process_content_plugins', 0) == 1;
     require_once JPATH_ROOT . DS . 'components' . DS . S_APP_NAME . DS . 'helpers' . DS . 'formfields.php';
     $formfields = new SurveyFormFields($wysiwyg, $bbcode, $content);
     $class = '';
     $content = '';
     foreach ($questions as $qid => $question) {
         switch ($question->question_type) {
             case 1:
                 $content .= $formfields->get_page_header_question($question, $class);
                 break;
             case 2:
                 $content .= $formfields->get_radio_question($question, $class);
                 break;
             case 3:
                 $content .= $formfields->get_checkbox_question($question, $class);
                 break;
             case 4:
                 $content .= $formfields->get_select_question($question, $class);
                 break;
             case 5:
                 $content .= $formfields->get_grid_radio_question($question, $class);
                 break;
             case 6:
                 $content .= $formfields->get_grid_checkbox_question($question, $class);
                 break;
             case 7:
                 $content .= $formfields->get_single_line_textbox_question($question, $class);
                 break;
             case 8:
                 $content .= $formfields->get_multiline_textarea_question($question, $class);
                 break;
             case 9:
                 $content .= $formfields->get_password_textbox_question($question, $class);
                 break;
             case 10:
                 $content .= $formfields->get_rich_textbox_question($question, $class);
                 break;
             case 11:
                 $content .= $formfields->get_image_radio_question($question, $class, S_IMAGES_URI);
                 break;
             case 12:
                 $content .= $formfields->get_image_checkbox_question($question, $class, S_IMAGES_URI);
                 break;
             default:
                 break;
         }
     }
     return $content;
 }