This commit is contained in:
RameshT 2024-07-24 18:42:00 +05:30
parent a6c68f3598
commit 7156b3e8d2
21 changed files with 401 additions and 336 deletions

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own. | a PHP script and you can easily do that on your own.
| |
*/ */
$config['base_url'] = 'http://localhost/google_forms'; $config['base_url'] = 'http://192.168.2.110/google_forms';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -10,7 +10,6 @@ $route['default_controller'] = 'Form_controller/index_forms';
$route['404_override'] = ''; $route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE; $route['translate_uri_dashes'] = FALSE;
$route['start'] = 'Form_controller/index_forms'; $route['start'] = 'Form_controller/index_forms';
// $route['new_form'] = 'home/create_form';
$route['title_desc'] = 'homepage/title'; $route['title_desc'] = 'homepage/title';
$route['forms/delete/(:any)'] = 'Form_controller/delete/$1'; $route['forms/delete/(:any)'] = 'Form_controller/delete/$1';
$route['home'] = 'Form_controller/index_forms'; $route['home'] = 'Form_controller/index_forms';
@ -26,4 +25,3 @@ $route['response_preview/(:num)'] = 'forms/response_preview/$1';
$route['title'] = 'homepage/title'; $route['title'] = 'homepage/title';
// $route['designform'] = 'homepage/design_form';

View File

@ -1,7 +1,8 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
class Form_controller extends CI_Controller { class Form_controller extends CI_Controller
{
public function index_forms($form_id = null) public function index_forms($form_id = null)
{ {
@ -41,13 +42,15 @@ $this->Frontend_model->deleteForm($id);
$this->session->set_flashdata('status', 'Form data deleted successfully'); $this->session->set_flashdata('status', 'Form data deleted successfully');
redirect('home'); redirect('home');
} }
public function __construct() { public function __construct()
{
parent::__construct(); parent::__construct();
$this->load->model('Updation_model'); $this->load->model('Updation_model');
} }
// Load the form for editing // Load the form for editing
public function edit_form($form_id) { public function edit_form($form_id)
{
$data['form'] = $this->Updation_model->get_form($form_id); $data['form'] = $this->Updation_model->get_form($form_id);
$data['questions'] = $this->Updation_model->get_questions($form_id); $data['questions'] = $this->Updation_model->get_questions($form_id);
$data['options'] = $this->Updation_model->get_options(); $data['options'] = $this->Updation_model->get_options();
@ -59,7 +62,8 @@ redirect('home');
} }
// Save the edited form // Save the edited form
public function update_form() { public function update_form()
{
$formData = $this->input->post('formData'); $formData = $this->input->post('formData');
if (!$formData) { if (!$formData) {
@ -82,12 +86,8 @@ redirect('home');
} }
} }
public function index_forms_draft($form_id = null)
{
public function index_forms_draft($form_id = null) {
$this->load->model('Frontend_model'); $this->load->model('Frontend_model');
// Check if the user is logged in // Check if the user is logged in

View File

@ -10,12 +10,12 @@ class Frontend_model extends CI_Model {
// Ensure user_id is set // Ensure user_id is set
if (!$user_id) { if (!$user_id) {
return []; // Return an empty array if user_id is not available return [];
} }
// Filter forms by user_id and order by created_at in descending order // Filter forms by user_id and order by created_at in descending order
$this->db->where('user_id', $user_id); // Assuming 'user_id' is the column name in the 'forms' table $this->db->where('user_id', $user_id);
$this->db->order_by('created_at', 'DESC'); // Order by created_at column, most recent first $this->db->order_by('created_at', 'DESC');
$query = $this->db->get('forms'); $query = $this->db->get('forms');
return $query->result(); // Return the result as an array of objects return $query->result(); // Return the result as an array of objects
@ -30,9 +30,9 @@ class Frontend_model extends CI_Model {
return $query->row_array(); return $query->row_array();
} }
public function getforms_draft($user_id) { public function getforms_draft($user_id) {
$this->db->where('is_published', 0); // Filter by unpublished forms $this->db->where('is_published', 0);
$this->db->where('user_id', $user_id); // Filter by user_id $this->db->where('user_id', $user_id);
$this->db->order_by('created_at', 'DESC'); // Sort by creation date, newest first $this->db->order_by('created_at', 'DESC');
$query = $this->db->get('forms'); $query = $this->db->get('forms');
return $query->result(); return $query->result();
} }

View File

@ -25,7 +25,7 @@ class New_form_model extends CI_Model {
if (!empty($option)) { // Avoid inserting empty options if (!empty($option)) { // Avoid inserting empty options
$optionData = [ $optionData = [
'question_id' => $questionId, 'question_id' => $questionId,
'option_text' => $option // Ensure column name matches database schema 'option_text' => $option
]; ];
// Insert option into options table // Insert option into options table
$this->db->insert('options', $optionData); $this->db->insert('options', $optionData);

View File

@ -1,39 +1,45 @@
<?php <?php
class Response_model extends CI_Model { class Response_model extends CI_Model
{
// 888888888888888888888 // 888888888888888888888
public function insert_response($data) { public function insert_response($data)
{
$this->db->insert('responses', $data); $this->db->insert('responses', $data);
return $this->db->insert_id(); return $this->db->insert_id();
} }
public function insert_response_answer($data) { public function insert_response_answer($data)
{
$this->db->insert('response_answers', $data); $this->db->insert('response_answers', $data);
} }
public function get_form($form_id) { public function get_form($form_id)
{
$this->db->where('id', $form_id); $this->db->where('id', $form_id);
$query = $this->db->get('forms'); $query = $this->db->get('forms');
return $query->row(); return $query->row();
} }
// 888888888888888888888
public function get_questions($form_id) {
public function get_questions($form_id)
{
$this->db->where('form_id', $form_id); $this->db->where('form_id', $form_id);
$query = $this->db->get('questions'); $query = $this->db->get('questions');
return $query->result(); return $query->result();
} }
public function get_options($question_id) { public function get_options($question_id)
{
$this->db->where('question_id', $question_id); $this->db->where('question_id', $question_id);
$query = $this->db->get('options'); $query = $this->db->get('options');
return $query->result(); return $query->result();
} }
// 888888888888888888888
public function get_responses_by_form($form_id) { public function get_responses_by_form($form_id)
{
$this->db->select('responses.id as response_id, responses.submitted_at, users.username'); $this->db->select('responses.id as response_id, responses.submitted_at, users.username');
$this->db->from('responses'); $this->db->from('responses');
$this->db->join('users', 'responses.user_id = users.id'); $this->db->join('users', 'responses.user_id = users.id');
@ -48,16 +54,17 @@ class Response_model extends CI_Model {
return $responses; return $responses;
} }
public function get_answers_by_response_id($response_id) { public function get_answers_by_response_id($response_id)
{
$this->db->select('response_answers.question_id, response_answers.answered_text'); $this->db->select('response_answers.question_id, response_answers.answered_text');
$this->db->from('response_answers'); $this->db->from('response_answers');
$this->db->where('response_answers.response_id', $response_id); $this->db->where('response_answers.response_id', $response_id);
$query = $this->db->get(); $query = $this->db->get();
return $query->result(); return $query->result();
} }
// 888888888888888888888
public function get_responses($form_id) { public function get_responses($form_id)
{
$this->db->where('form_id', $form_id); $this->db->where('form_id', $form_id);
$query = $this->db->get('responses'); $query = $this->db->get('responses');
return $query->result(); return $query->result();
@ -65,7 +72,8 @@ class Response_model extends CI_Model {
// Method to get response details // Method to get response details
public function get_response($response_id) { public function get_response($response_id)
{
$this->db->select('responses.*, users.email'); $this->db->select('responses.*, users.email');
$this->db->from('responses'); $this->db->from('responses');
$this->db->join('users', 'responses.user_id = users.id'); // Assuming 'user_id' is the foreign key in 'responses' $this->db->join('users', 'responses.user_id = users.id'); // Assuming 'user_id' is the foreign key in 'responses'
@ -76,7 +84,8 @@ class Response_model extends CI_Model {
// Method to get questions and answers for a response // Method to get questions and answers for a response
public function get_questions_and_answers($response_id) { public function get_questions_and_answers($response_id)
{
$this->db->select('questions.id AS question_id, questions.text AS question_text, response_answers.answered_text, users.email'); $this->db->select('questions.id AS question_id, questions.text AS question_text, response_answers.answered_text, users.email');
$this->db->from('questions'); $this->db->from('questions');
$this->db->join('response_answers', 'questions.id = response_answers.question_id'); $this->db->join('response_answers', 'questions.id = response_answers.question_id');
@ -88,7 +97,8 @@ class Response_model extends CI_Model {
} }
public function get_form_by_response($response_id) { public function get_form_by_response($response_id)
{
$this->db->select('forms.title, forms.description'); $this->db->select('forms.title, forms.description');
$this->db->from('forms'); $this->db->from('forms');
$this->db->join('responses', 'forms.id = responses.form_id'); $this->db->join('responses', 'forms.id = responses.form_id');

View File

@ -1,24 +1,29 @@
<?php <?php
class Updation_model extends CI_Model { class Updation_model extends CI_Model
{
public function get_form($form_id) { public function get_form($form_id)
{
$this->db->where('id', $form_id); $this->db->where('id', $form_id);
$query = $this->db->get('forms'); $query = $this->db->get('forms');
return $query->row_array(); return $query->row_array();
} }
public function get_questions($form_id) { public function get_questions($form_id)
{
$this->db->where('form_id', $form_id); $this->db->where('form_id', $form_id);
$this->db->order_by('id', 'ASC'); $this->db->order_by('id', 'ASC');
$query = $this->db->get('questions'); $query = $this->db->get('questions');
return $query->result_array(); return $query->result_array();
} }
public function get_options() { public function get_options()
{
$query = $this->db->get('options'); $query = $this->db->get('options');
return $query->result_array(); return $query->result_array();
} }
public function update_form_data($form_id, $title, $description, $questions) { public function update_form_data($form_id, $title, $description, $questions)
{
$this->db->trans_start(); $this->db->trans_start();
// Update form title and description // Update form title and description
@ -56,7 +61,8 @@ class Updation_model extends CI_Model {
} }
private function update_question_options($question_id, $options) { private function update_question_options($question_id, $options)
{
// Fetch existing options for this question // Fetch existing options for this question
$existing_options = $this->db->where('question_id', $question_id)->get('options')->result_array(); $existing_options = $this->db->where('question_id', $question_id)->get('options')->result_array();
$existing_option_texts = array_column($existing_options, 'option_text'); $existing_option_texts = array_column($existing_options, 'option_text');

View File

@ -50,7 +50,7 @@ Drafts
class="btn btn-danger btn-sm" style=" background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;">Delete</a> class="btn btn-danger btn-sm" style=" background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;">Delete</a>
</td> </td>
<td> <td>
<a href="<?php echo base_url('form_preview/' . $row->id); ?>"> <a href="<?php echo base_url('publish/' . $row->id); ?>">
<i class="fas fa-eye"></i> <!-- Eye icon --> <i class="fas fa-eye"></i> <!-- Eye icon -->
</a> </a>
</td> </td>

View File

@ -42,7 +42,7 @@
<th>Description</th> <th>Description</th>
<th>Created On</th> <th>Created On</th>
<th>Status</th> <th>Status</th>
<th>Preview</th> <th>Responses</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -52,13 +52,13 @@
<tr class="<?php echo ($row->is_published ? '' : 'draft-row'); ?>"> <tr class="<?php echo ($row->is_published ? '' : 'draft-row'); ?>">
<td><?php echo $serialNumber++; ?></td> <td><?php echo $serialNumber++; ?></td>
<td class="title-column"> <td class="title-column">
<?php echo $row->title; ?> <a href="<?php echo base_url('publish/' . $row->id); ?>"><?php echo $row->title; ?></a>
</td> </td>
<td><?php echo $row->description; ?></td> <td><?php echo $row->description; ?></td>
<td><?php echo $row->created_at; ?></td> <td><?php echo $row->created_at; ?></td>
<td><?php echo ($row->is_published ? 'Published' : 'Draft'); ?></td> <td><?php echo ($row->is_published ? 'Published' : 'Draft'); ?></td>
<td> <td>
<a href="<?php echo base_url('form_preview/' . $row->id); ?>"> <a href="<?php echo base_url('responses/' . $row->id); ?>">
<i class="fas fa-eye"></i> <!-- Eye icon --> <i class="fas fa-eye"></i> <!-- Eye icon -->
</a> </a>
</td> </td>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -12,6 +13,7 @@
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
</head> </head>
<body> <body>
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-custom"> <nav class="navbar navbar-custom">
@ -22,14 +24,14 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<div id="navbar"> <div id="navbar" class="navbar-collapse">
<ul class="nav navbar-nav left"> <ul class="nav navbar-nav">
<?php if ($this->session->userdata('logged_in')): ?> <?php if ($this->session->userdata('logged_in')): ?>
<li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li> <li><a href="<?php echo base_url(); ?>published_forms">Published Forms</a></li>
<li><a href="<?php echo base_url(); ?>drafts">Drafts</a></li> <li><a href="<?php echo base_url(); ?>drafts">Drafts</a></li>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
<ul class="nav navbar-nav right"> <ul class="nav navbar-nav navbar-right">
<?php if (!$this->session->userdata('logged_in')): ?> <?php if (!$this->session->userdata('logged_in')): ?>
<li><a href="<?php echo base_url(); ?>users/login">Login</a></li> <li><a href="<?php echo base_url(); ?>users/login">Login</a></li>
<li><a href="<?php echo base_url(); ?>users/register">Register</a></li> <li><a href="<?php echo base_url(); ?>users/register">Register</a></li>
@ -43,6 +45,7 @@
</div> </div>
</nav> </nav>
<!-- Alert Messages --> <!-- Alert Messages -->
<div class="container"> <div class="container">
<?php if ($this->session->flashdata('user_registered')): ?> <?php if ($this->session->flashdata('user_registered')): ?>
@ -65,22 +68,28 @@
<!-- Form Editor --> <!-- Form Editor -->
<div class="container"> <div class="container">
<div class="form-header"> <div class="form-header">
<button id="preview-btn" class="btn btn-info"><i class="fas fa-eye"></i></button> <!-- <button id="preview-btn" class="btn btn-info"><i class="fas fa-eye"></i></button> -->
<input type="text" id="form-title" class="form-control" value="<?php echo $form['title']; ?>"> <input type="text" id="form-title" class="form-control" value="<?php echo $form['title']; ?>">
<input type="text" id="form-description" class="form-control" value="<?php echo $form['description']; ?>"> <input type="text" id="form-description" class="form-control" value="<?php echo $form['description']; ?>">
<button id="add-section-btn" class="btn btn-primary">+</button> <button id="add-section-btn" class="btn btn-primary">+</button>
</div> </div>
<div id="form-container"> <div id="form-container">
<?php foreach ($questions as $question): ?> <?php foreach ($questions as $question): ?>
<div class="form-section" data-index="<?php echo $question['id']; ?>" data-type="<?php echo $question['type']; ?>"> <div class="form-section" data-index="<?php echo $question['id']; ?>"
data-type="<?php echo $question['type']; ?>">
<div class="header-row"> <div class="header-row">
<textarea class="form-control untitled-question" placeholder="Untitled Question" rows="1"><?php echo $question['text']; ?></textarea> <input type="text" class="form-control untitled-question" placeholder="Untitled Question" rows="1"
value="<?php echo $question['text']; ?>">
<select class="custom-select"> <select class="custom-select">
<option value="short-answer" <?php echo $question['type'] == 'short-answer' ? 'selected' : ''; ?>>Short Answer</option> <option value="short-answer" <?php echo $question['type'] == 'short-answer' ? 'selected' : ''; ?>>
<option value="paragraph" <?php echo $question['type'] == 'paragraph' ? 'selected' : ''; ?>>Paragraph</option> Short Answer</option>
<option value="paragraph" <?php echo $question['type'] == 'paragraph' ? 'selected' : ''; ?>>
Paragraph</option>
<option value="multiple-choice" <?php echo $question['type'] == 'multiple-choice' ? 'selected' : ''; ?>>Multiple Choice</option> <option value="multiple-choice" <?php echo $question['type'] == 'multiple-choice' ? 'selected' : ''; ?>>Multiple Choice</option>
<option value="checkboxes" <?php echo $question['type'] == 'checkboxes' ? 'selected' : ''; ?>>Checkboxes</option> <option value="checkboxes" <?php echo $question['type'] == 'checkboxes' ? 'selected' : ''; ?>>
<option value="dropdown" <?php echo $question['type'] == 'dropdown' ? 'selected' : ''; ?>>Dropdown</option> Checkboxes</option>
<option value="dropdown" <?php echo $question['type'] == 'dropdown' ? 'selected' : ''; ?>>Dropdown
</option>
</select> </select>
<label class="toggle-switch"> <label class="toggle-switch">
<input type="checkbox" class="required-toggle" <?php echo $question['is_required'] ? 'checked' : ''; ?>> <input type="checkbox" class="required-toggle" <?php echo $question['is_required'] ? 'checked' : ''; ?>>
@ -96,14 +105,15 @@
foreach ($options as $option): foreach ($options as $option):
?> ?>
<div class="option"> <div class="option">
<input type="text" class="form-control option-label" value="<?php echo $option['option_text']; ?>"> <input type="text" class="form-control option-label"
value="<?php echo $option['option_text']; ?>">
<span class="delete-option-icon">&times;</span> <span class="delete-option-icon">&times;</span>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<!-- Show or hide the "Add Option" button based on question type --> <!-- Show or hide the "Add Option" button based on question type -->
<?php if ($question['type'] === 'multiple-choice' || $question['type'] === 'checkboxes' || $question['type'] === 'dropdown'): ?> <?php if ($question['type'] === 'multiple-choice' || $question['type'] === 'checkboxes' || $question['type'] === 'dropdown'): ?>
<button class="btn btn-secondary add-option-btn">Add Option</button> <button class="btn btn-primary add-option-btn">Add Option</button>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
@ -149,7 +159,7 @@ $(document).ready(function() {
var sectionHtml = ` var sectionHtml = `
<div class="form-section" data-type=""> <div class="form-section" data-type="">
<div class="header-row"> <div class="header-row">
<textarea class="form-control untitled-question" placeholder="Untitled Question" rows="1"></textarea> <input type = "text" class="form-control untitled-question" placeholder="Untitled Question" rows="1">
<select class="custom-select"> <select class="custom-select">
<option value="short-answer">Short Answer</option> <option value="short-answer">Short Answer</option>
<option value="paragraph">Paragraph</option> <option value="paragraph">Paragraph</option>
@ -164,10 +174,12 @@ $(document).ready(function() {
<span class="delete-section-icon"><i class="fas fa-trash-alt"></i></span> <span class="delete-section-icon"><i class="fas fa-trash-alt"></i></span>
</div> </div>
<div class="options-container"></div> <div class="options-container"></div>
<button class="btn btn-secondary add-option-btn">Add Option</button> <button class="btn btn-primary add-option-btn">Add Option</button>
</div> </div>
`; `;
$('#form-container').append(sectionHtml); $('#form-container').append(sectionHtml);
positionAddSectionButton();
} }
// Handle option button click // Handle option button click
@ -196,6 +208,19 @@ $(document).ready(function() {
$('#preview-btn').on('click', function () { $('#preview-btn').on('click', function () {
alert('Preview functionality is not implemented.'); alert('Preview functionality is not implemented.');
}); });
$('.form-section').each(function () {
$(this).on('click', function () {
$('.form-section').removeClass('active');
$(this).addClass('active');
activeSection = $(this);
positionAddSectionButton();
});
});
// Handle window resize to reposition button
$(window).on('resize', function () {
positionAddSectionButton();
});
// Handle submit button click // Handle submit button click
$('#submit-btn').on('click', function () { $('#submit-btn').on('click', function () {
@ -272,20 +297,9 @@ $(document).ready(function() {
} }
// Initialize // Initialize
$('.form-section').each(function() {
$(this).on('click', function() {
$('.form-section').removeClass('active');
$(this).addClass('active');
activeSection = $(this);
positionAddSectionButton();
});
});
// Handle window resize to reposition button
$(window).on('resize', function() {
positionAddSectionButton();
});
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -1 +0,0 @@
<h4>This is about page</h4>

View File

@ -1 +0,0 @@
<h4>Welcome to Google Forms !</h4>

View File

@ -1 +0,0 @@
<h4>This is the home page</h4>

View File

@ -28,8 +28,8 @@
<tr> <tr>
<th>Responses</th> <th>Responses</th>
<th>Title</th> <th>Title</th>
<th>Status</th>
<th>Response Link</th> <th>Response Link</th>
<th>Status</th>
<th>Preview</th> <th>Preview</th>
</tr> </tr>
</thead> </thead>
@ -40,14 +40,14 @@
<td class="title-column"> <td class="title-column">
<?php echo $row->title; ?> <?php echo $row->title; ?>
</td> </td>
<td>
<a href="<?php echo base_url('Publish_controller/unpublish_form/' . $row->id); ?>" class="btn btn-danger btn-sm" style=" background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;">Unpublish</a>
</td>
<td> <td>
<a href="<?php echo $row->response_link; ?>" target="_blank"><?php echo $row->response_link; ?></a> <a href="<?php echo $row->response_link; ?>" target="_blank"><?php echo $row->response_link; ?></a>
</td> </td>
<td> <td>
<a href="<?php echo base_url('Publish_controller/unpublish_form/' . $row->id); ?>" class="btn btn-danger btn-sm" style=" background-color: rgb(103, 58, 183); border-color: rgb(103, 58, 183); color: white;">Unpublish</a>
</td>
<td>
<a href="<?php echo base_url('form_preview/' . $row->id); ?>"> <a href="<?php echo base_url('form_preview/' . $row->id); ?>">
<i class="fas fa-eye"></i> <!-- Eye icon --> <i class="fas fa-eye"></i> <!-- Eye icon -->
</a> </a>

View File

@ -7,6 +7,11 @@
<link rel="stylesheet" href="https://bootswatch.com/3/flatly/bootstrap.min.css"> <link rel="stylesheet" href="https://bootswatch.com/3/flatly/bootstrap.min.css">
</head> </head>
<body> <body>
<style>
.username-column {
color: darkblue; /* Dark blue color for title */
}
</style>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-12 mt-4"> <div class="col-md-12 mt-4">
@ -25,21 +30,22 @@
<table id="basetable1" class="table table-bordered"> <table id="basetable1" class="table table-bordered">
<thead> <thead>
<tr> <tr>
<th>Response ID</th>
<th>Username</th> <th>Username</th>
<th>Submitted At</th> <th>Submitted At</th>
<th>View</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($responses as $response): ?> <?php foreach ($responses as $response): ?>
<tr> <tr>
<td class="username-column"><?php echo $response->username; ?></td>
<td><?php echo $response->submitted_at; ?></td>
<td> <td>
<a href="<?php echo base_url('responses/view/' . $response->response_id); ?>"> <a href="<?php echo base_url('responses/view/' . $response->response_id); ?>">
<?php echo $response->response_id; ?> <i class="fas fa-eye"></i> <!-- Eye icon -->
</a> </a>
</td> </td>
<td><?php echo $response->username; ?></td>
<td><?php echo $response->submitted_at; ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>

View File

@ -1,10 +1,3 @@
<!-- <script>
$(document).ready(function(){
$('#basetable1').DataTable({
// "pagingType": "full_numbers"
});
});
</script> -->
<script> <script>
$('#basetable1').DataTable({ $('#basetable1').DataTable({

View File

@ -9,6 +9,8 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/header_styles.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/header_styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery-ui.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery-ui.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10/dist/sweetalert2.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">

View File

@ -1,35 +1,61 @@
.navbar-container {
max-width: 100%;
margin: 0 auto;
padding: 0 15px;
}
/* Navbar styles */ /* Navbar styles */
.navbar-custom { .navbar-custom {
background-color: rgb(103, 58, 183); ; /* Customize this color */ background-color: rgb(103, 58, 183);
border-radius: 0;
height: 70px;
display: flex;
align-items: center;
padding: 0;
} }
/* Button positioning for section addition */ /* Brand styling */
#add-section-btn { .navbar-custom .navbar-brand {
position: absolute; color: #fff;
/* Ensure proper positioning */ font-size: 19px;
margin-right: 20px;
padding: 15px 10px;
} }
.form-section {
margin-bottom: 15px; .navbar-custom .navbar-nav {
padding: 15px; display: flex;
border: 1px solid #ddd; align-items: center;
border-radius: 5px; margin-left: -17px;
padding: 0;
flex: 1;
}
.navbar-custom .navbar-nav li {
margin: 0 10px;
} }
.header-row { .navbar-custom .navbar-nav li a {
color: #fff;
background-color: transparent;
font-size: 15px;
height: 70px;
padding: 15px 10px;
transition: none;
}
.navbar-custom .navbar-nav.navbar-right {
margin-left: auto;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.header-row textarea, .navbar-custom .navbar-nav.navbar-right li {
.header-row select { margin: 0 10px;
margin-right: 10px;
}
.navbar-custom .navbar-brand {
color: #fff; /* Customize brand color */
} }
.navbar-custom .navbar-nav li a {
color: #fff; /* Customize link color */
}
#add-section-btn {
position: absolute;
}

View File

@ -49,13 +49,16 @@ body {
border-radius: 0; border-radius: 0;
} }
.navbar-custom .navbar-brand, .navbar-custom .navbar-brand>li>a {
color: white;
font-size: 16px;
transition: color 0.3s ease;
}
.navbar-custom .navbar-nav>li>a{ .navbar-custom .navbar-nav>li>a{
color: white; color: white;
font-size: 16px; font-size: 16px;
transition: color 0.3s ease; transition: color 0.3s ease;
} }
.navbar-custom .navbar-brand:hover, .navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-nav>li>a:hover { .navbar-custom .navbar-nav>li>a:hover {
color: white; /* Keep text color white on hover */ color: white; /* Keep text color white on hover */

View File

@ -114,8 +114,21 @@ body {
.custom-select { .custom-select {
width: 220px; width: 220px;
height: 45px;
display: block;
/* width: 100%; */
/* height: 45px; */
padding: 10px 15px;
font-size: 15px;
line-height: 1.42857143;
/* color: #2c3e50; */
background-color: #ffffff;
background-image: none;
border: 1px solid #dce4ec;
border-radius: 4px;
} }
.delete-section-icon { .delete-section-icon {
flex: 0.1; flex: 0.1;
cursor: pointer; cursor: pointer;
@ -164,7 +177,7 @@ body {
background-color: rgb(66, 133, 244); background-color: rgb(66, 133, 244);
/* color: rgb(66, 133, 244); */ /* color: rgb(66, 133, 244); */
margin-top: 11px; margin-top: 11px;
font-size: 0.9em; font-size: 0.8em;
} }
@ -177,8 +190,7 @@ body {
width: 56%; width: 56%;
margin-left: 240px; margin-left: 240px;
} }
/* Toggle Switch CSS */
/* Toggle Switch CSS */
.toggle-switch { .toggle-switch {
position: relative; position: relative;
display: inline-block; display: inline-block;

View File

@ -30,8 +30,7 @@ function addOption(type, container) {
<div class="form-section" data-index="${index}"> <div class="form-section" data-index="${index}">
<div class="header-row"> <div class="header-row">
${index === 1 ? '<div class="violet-border"></div>' : ''} ${index === 1 ? '<div class="violet-border"></div>' : ''}
<textarea class="form-control untitled-question" placeholder="Untitled Question" rows="1"></textarea> <input type="text" class="form-control untitled-question" placeholder="Untitled Question" rows="1"> <select class="custom-select">
<select class="custom-select">
<option value="short-answer">Short Answer</option> <option value="short-answer">Short Answer</option>
<option value="paragraph">Paragraph</option> <option value="paragraph">Paragraph</option>
<option value="multiple-choice">Multiple Choice</option> <option value="multiple-choice">Multiple Choice</option>
@ -145,13 +144,13 @@ function addOption(type, container) {
<body> <body>
<div class="container"> <div class="container">
<div class="form-header"> <div class="form-header">
<h2>Untitled Form</h2> <h3>Form Preview</h3>
</div> </div>
`; `;
$('.form-section').each(function() { $('.form-section').each(function() {
previewContent += '<div class="form-section">'; previewContent += '<div class="form-section">';
previewContent += '<div class="question-section">'; previewContent += '<div class="question-section">';
previewContent += '<textarea class="form-control question-label" disabled>' + $(this).find('.untitled-question').val() + '</textarea>'; previewContent += '<div class="question-label">' + $(this).find('.untitled-question').val() + '</div>';
previewContent += '</div>'; previewContent += '</div>';
let type = $(this).find('.custom-select').val(); let type = $(this).find('.custom-select').val();
let optionsContainer = $(this).find('.options-container'); let optionsContainer = $(this).find('.options-container');
@ -189,7 +188,6 @@ function addOption(type, container) {
previewContent += '</div>'; previewContent += '</div>';
}); });
previewContent += ` previewContent += `
<button class="btn btn-success" style="margin-left: 240px; margin-top: 20px">Submit</button>
</div> </div>
</body> </body>
</html> </html>