Test Husky pre-commit hook.

This commit is contained in:
RameshT 2024-08-02 17:51:50 +05:30
parent 819dc9e876
commit 303350ea0a
1 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
defined('BASEPATH') or exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
class Forms extends CI_Controller class Forms extends CI_Controller
@ -27,26 +28,25 @@ class Forms extends CI_Controller
$data['form'] = $form; $data['form'] = $form;
$data['questions'] = $questions; $data['questions'] = $questions;
$this->load->view('templates/header'); $this->load->view('templates/header');
$this->load->view('form_preview', $data); $this->load->view('form_preview', $data);
$this->load->view('templates/footer'); $this->load->view('templates/footer');
} }
public function response_preview($form_id) public function response_preview($form_id)
{ {
if (!$this->session->userdata('logged_in')) { if (!$this->session->userdata('logged_in')) {
// If not logged in, redirect to login page with form_id as a parameter // If not logged in, redirect to login page with form_id as a parameter
redirect('users/login/' . $form_id); redirect('users/login/' . $form_id);
} }
// Load the model that handles the form data // Load the model that handles the form data
$this->load->model('preview_model'); $this->load->model('preview_model');
// Fetch the form details // Fetch the form details
$form = $this->preview_model->get_form($form_id); $form = $this->preview_model->get_form($form_id);
// Check if the form is responsive // Check if the form is responsive
if ($form->is_responsive == 0) { if ($form->is_responsive == 0) {
// Pass a message to the view // Pass a message to the view
@ -54,49 +54,49 @@ class Forms extends CI_Controller
$this->load->view('response_submit', $data); $this->load->view('response_submit', $data);
return; return;
} }
// Fetch the questions for the form // Fetch the questions for the form
$questions = $this->preview_model->get_questions($form_id); $questions = $this->preview_model->get_questions($form_id);
// Fetch the options for each question // Fetch the options for each question
foreach ($questions as &$question) { foreach ($questions as &$question) {
$question->options = $this->preview_model->get_options($question->id); $question->options = $this->preview_model->get_options($question->id);
} }
// Pass the data to the view // Pass the data to the view
$data['form'] = $form; $data['form'] = $form;
$data['questions'] = $questions; $data['questions'] = $questions;
$this->load->view('response_submit', $data); $this->load->view('response_submit', $data);
} }
public function preview_back($form_id) { public function preview_back($form_id)
{
if (!$this->session->userdata('logged_in')) { if (!$this->session->userdata('logged_in')) {
// If not logged in, redirect to login page // If not logged in, redirect to login page
redirect('users/login'); redirect('users/login');
} }
// Load the model that handles the form data // Load the model that handles the form data
$this->load->model('preview_model'); $this->load->model('preview_model');
// Fetch the form details // Fetch the form details
$form = $this->preview_model->get_form($form_id); $form = $this->preview_model->get_form($form_id);
// Fetch the questions for the form including 'is_required' // Fetch the questions for the form including 'is_required'
$questions = $this->preview_model->get_questions($form_id); $questions = $this->preview_model->get_questions($form_id);
// Fetch the options for each question // Fetch the options for each question
foreach ($questions as &$question) { foreach ($questions as &$question) {
$question->options = $this->preview_model->get_options($question->id); $question->options = $this->preview_model->get_options($question->id);
} }
// / Pass the data to the view
// Pass the data to the view
$data['form'] = $form; $data['form'] = $form;
$data['questions'] = $questions; $data['questions'] = $questions;
$this->load->view('templates/header'); $this->load->view('templates/header');
$this->load->view('form_preview_back', $data); $this->load->view('form_preview_back', $data);
$this->load->view('templates/footer'); $this->load->view('templates/footer');
// $this->load->view('templates/footer');
} }
} }