public function survey_get($sm_id)
 {
     $this->load->model('tb_all_question');
     $this->load->model('tb_all_answer');
     $this->load->model('tb_survey_mapping');
     $this->load->model('tb_answer_style');
     $survey = $this->tb_survey_mapping->get($sm_id);
     $sm_order_column = explode(",", $survey->sm_order_column);
     if ($survey == NULL) {
         $this->response(array('Error' => 'Survey not found.'));
     }
     $questions = $this->tb_all_question->fetch_by_multiple_id($survey->sm_order_column);
     foreach ($questions as $question) {
         $question->answers = $this->tb_all_answer->get($question->aq_id);
         foreach ($question->answers as $answer) {
             $style = $this->tb_answer_style->get($answer->type);
             $answer->style = $style;
             $answerStyle = AnswerStyle::get($answer->style->as_identifier, $answer->aa_description, $answer->style->as_text_color);
             $answer->style->html = $answerStyle->html;
         }
     }
     ///SOERTING
     $sorted = array();
     foreach ($sm_order_column as $column) {
         foreach ($questions as $question) {
             if ($question->aq_id == $column) {
                 array_push($sorted, $question);
                 break;
             }
         }
     }
     $this->response($sorted);
 }
 public function answers_get($aq_id_ref)
 {
     $this->load->model('tb_all_answer');
     $this->load->model('tb_answer_style');
     $result = $this->tb_all_answer->get($aq_id_ref);
     foreach ($result as $answer) {
         $answer->style = $this->tb_answer_style->get($answer->type);
         $answerStyle = AnswerStyle::get($answer->style->as_identifier, $answer->aa_description, $answer->style->as_text_color);
         $answer->style->html = $answerStyle->html;
     }
     $this->response($result, REST_Controller::HTTP_OK);
 }
Esempio n. 3
0
                <div class="row">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <select class="form-control" id="as_identifier" name="as_identifier" >
                            <?php 
for ($i = 0; $i < AnswerStyle::numberOfcomponent(); $i++) {
    ?>

                                        <option value=<?php 
    echo $i;
    ?>
 <?php 
    echo $answer_style->as_identifier == $i ? "selected" : "";
    ?>
><?php 
    echo AnswerStyle::getName($i);
    ?>
</option>
            
                            <?php 
}
?>
                                  
                            </select>
                        </div>
                    </div>
                </div>
                <label>Style description</label>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="form-group">