commit
This commit is contained in:
parent
a6c68f3598
commit
7156b3e8d2
|
@ -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';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -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';
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?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)
|
||||||
{
|
{
|
||||||
$this->load->model('Frontend_model');
|
$this->load->model('Frontend_model');
|
||||||
// Check if the user is logged in
|
// Check if the user is logged in
|
||||||
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
|
||||||
|
@ -30,36 +31,39 @@ class Form_controller extends CI_Controller {
|
||||||
$this->load->view('templates/footer');
|
$this->load->view('templates/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($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');
|
||||||
}
|
}
|
||||||
$this->load->model('Frontend_model');
|
$this->load->model('Frontend_model');
|
||||||
$this->Frontend_model->deleteForm($id);
|
$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();
|
||||||
|
|
||||||
// $this->load->view('templates/header');
|
// $this->load->view('templates/header');
|
||||||
$this->load->view('edit_form_view', $data);
|
$this->load->view('edit_form_view', $data);
|
||||||
// $this->load->view('templates/footer');
|
// $this->load->view('templates/footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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,40 +86,36 @@ redirect('home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function index_forms_draft($form_id = null)
|
||||||
|
{
|
||||||
|
$this->load->model('Frontend_model');
|
||||||
|
|
||||||
|
// Check if the user is logged in
|
||||||
|
if (!$this->session->userdata('logged_in')) {
|
||||||
|
// If not logged in, redirect to login page
|
||||||
|
redirect('users/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve form title from the forms table using form_id
|
||||||
|
$form_title = 'Untitled Form'; // Default title
|
||||||
|
if ($form_id) {
|
||||||
|
$form = $this->Frontend_model->getFormById($form_id);
|
||||||
|
if ($form) {
|
||||||
|
$form_title = $form['title'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the user_id from session
|
||||||
|
$user_id = $this->session->userdata('user_id');
|
||||||
|
|
||||||
|
// Load views and data if user is logged in
|
||||||
|
$this->load->view('templates/header');
|
||||||
|
|
||||||
public function index_forms_draft($form_id = null) {
|
// Get the forms created by the user
|
||||||
$this->load->model('Frontend_model');
|
$data = $this->Frontend_model->getforms_draft($user_id);
|
||||||
|
$this->load->view('Tables/draft', ['forms' => $data, 'form_title' => $form_title]);
|
||||||
|
|
||||||
// Check if the user is logged in
|
$this->load->view('templates/footer');
|
||||||
if (!$this->session->userdata('logged_in')) {
|
}
|
||||||
// If not logged in, redirect to login page
|
|
||||||
redirect('users/login');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve form title from the forms table using form_id
|
|
||||||
$form_title = 'Untitled Form'; // Default title
|
|
||||||
if ($form_id) {
|
|
||||||
$form = $this->Frontend_model->getFormById($form_id);
|
|
||||||
if ($form) {
|
|
||||||
$form_title = $form['title'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the user_id from session
|
|
||||||
$user_id = $this->session->userdata('user_id');
|
|
||||||
|
|
||||||
// Load views and data if user is logged in
|
|
||||||
$this->load->view('templates/header');
|
|
||||||
|
|
||||||
// Get the forms created by the user
|
|
||||||
$data = $this->Frontend_model->getforms_draft($user_id);
|
|
||||||
$this->load->view('Tables/draft', ['forms' => $data, 'form_title' => $form_title]);
|
|
||||||
|
|
||||||
$this->load->view('templates/footer');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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,36 +13,38 @@
|
||||||
<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">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php if ($this->session->userdata('logged_in')): ?>
|
<?php if ($this->session->userdata('logged_in')): ?>
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<a class="navbar-brand" href="<?php echo base_url(); ?>">Google Forms</a>
|
<a class="navbar-brand" href="<?php echo base_url(); ?>">Google Forms</a>
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div id="navbar">
|
|
||||||
<ul class="nav navbar-nav left">
|
|
||||||
<?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(); ?>drafts">Drafts</a></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
</ul>
|
|
||||||
<ul class="nav navbar-nav right">
|
|
||||||
<?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/register">Register</a></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($this->session->userdata('logged_in')): ?>
|
|
||||||
<li><a href="<?php echo base_url(); ?>homepage/title">Create Form</a></li>
|
|
||||||
<li><a href="<?php echo base_url(); ?>users/logout">Logout</a></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div id="navbar" class="navbar-collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<?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(); ?>drafts">Drafts</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<?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/register">Register</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->session->userdata('logged_in')): ?>
|
||||||
|
<li><a href="<?php echo base_url(); ?>homepage/title">Create Form</a></li>
|
||||||
|
<li><a href="<?php echo base_url(); ?>users/logout">Logout</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
<!-- Alert Messages -->
|
<!-- Alert Messages -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -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' : ''; ?>>
|
||||||
|
@ -94,16 +103,17 @@
|
||||||
$this->db->where('question_id', $question['id']);
|
$this->db->where('question_id', $question['id']);
|
||||||
$options = $this->db->get('options')->result_array();
|
$options = $this->db->get('options')->result_array();
|
||||||
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">×</span>
|
<span class="delete-option-icon">×</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; ?>
|
||||||
|
@ -117,39 +127,39 @@
|
||||||
<!-- <script src="<?php echo base_url('assets/js/scripts.js'); ?>"></script> -->
|
<!-- <script src="<?php echo base_url('assets/js/scripts.js'); ?>"></script> -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
var base_url = '<?php echo base_url(); ?>';
|
var base_url = '<?php echo base_url(); ?>';
|
||||||
var index = 1;
|
var index = 1;
|
||||||
var activeSection = null;
|
var activeSection = null;
|
||||||
|
|
||||||
function positionAddSectionButton() {
|
function positionAddSectionButton() {
|
||||||
if (activeSection) {
|
if (activeSection) {
|
||||||
var position = activeSection.position();
|
var position = activeSection.position();
|
||||||
var buttonWidth = $('#add-section-btn').outerWidth();
|
var buttonWidth = $('#add-section-btn').outerWidth();
|
||||||
var buttonHeight = $('#add-section-btn').outerHeight();
|
var buttonHeight = $('#add-section-btn').outerHeight();
|
||||||
|
|
||||||
$('#add-section-btn').css({
|
$('#add-section-btn').css({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: position.left - buttonWidth - 47 + 'px',
|
left: position.left - buttonWidth - 47 + 'px',
|
||||||
top: position.top + activeSection.height() / 2 - buttonHeight / 2 + 'px'
|
top: position.top + activeSection.height() / 2 - buttonHeight / 2 + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add section button functionality
|
||||||
|
$('#add-section-btn').on('click', function () {
|
||||||
|
createFormSection();
|
||||||
|
$('.form-section').removeClass('active');
|
||||||
|
activeSection = $('.form-section').last();
|
||||||
|
activeSection.addClass('active');
|
||||||
|
positionAddSectionButton();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add section button functionality
|
function createFormSection() {
|
||||||
$('#add-section-btn').on('click', function() {
|
var sectionHtml = `
|
||||||
createFormSection();
|
|
||||||
$('.form-section').removeClass('active');
|
|
||||||
activeSection = $('.form-section').last();
|
|
||||||
activeSection.addClass('active');
|
|
||||||
positionAddSectionButton();
|
|
||||||
});
|
|
||||||
|
|
||||||
function createFormSection() {
|
|
||||||
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,128 +174,132 @@ $(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
|
}
|
||||||
$(document).on('click', '.add-option-btn', function() {
|
|
||||||
var $section = $(this).closest('.form-section');
|
// Handle option button click
|
||||||
var optionHtml = `
|
$(document).on('click', '.add-option-btn', function () {
|
||||||
|
var $section = $(this).closest('.form-section');
|
||||||
|
var optionHtml = `
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<input type="text" class="form-control option-label" value="">
|
<input type="text" class="form-control option-label" value="">
|
||||||
<span class="delete-option-icon">×</span>
|
<span class="delete-option-icon">×</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
$section.find('.options-container').append(optionHtml);
|
$section.find('.options-container').append(optionHtml);
|
||||||
});
|
|
||||||
|
|
||||||
// Handle delete section button click
|
|
||||||
$(document).on('click', '.delete-section-icon', function() {
|
|
||||||
$(this).closest('.form-section').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle delete option button click
|
|
||||||
$(document).on('click', '.delete-option-icon', function() {
|
|
||||||
$(this).closest('.option').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle preview button click
|
|
||||||
$('#preview-btn').on('click', function() {
|
|
||||||
alert('Preview functionality is not implemented.');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle submit button click
|
|
||||||
$('#submit-btn').on('click', function() {
|
|
||||||
var formData = collectFormData();
|
|
||||||
formData['form_id'] = <?php echo $form['id']; ?>;
|
|
||||||
|
|
||||||
let validation = validateFormData(formData);
|
|
||||||
if (!validation.isValid) {
|
|
||||||
alert(validation.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: base_url + 'Form_controller/update_form',
|
|
||||||
type: 'POST',
|
|
||||||
data: { formData: formData },
|
|
||||||
dataType: 'JSON',
|
|
||||||
success: function(response) {
|
|
||||||
if (response.status === 'success') {
|
|
||||||
alert('Form updated successfully!');
|
|
||||||
window.location.href = base_url + 'drafts';
|
|
||||||
} else {
|
|
||||||
alert(response.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(error) {
|
|
||||||
alert('Error updating form!');
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Collect form data function
|
|
||||||
function collectFormData() {
|
|
||||||
var formData = {
|
|
||||||
title: $('#form-title').val(),
|
|
||||||
description: $('#form-description').val(),
|
|
||||||
questions: []
|
|
||||||
};
|
|
||||||
|
|
||||||
$('.form-section').each(function() {
|
|
||||||
var questionData = {
|
|
||||||
id: $(this).data('index'),
|
|
||||||
text: $(this).find('.untitled-question').val(),
|
|
||||||
type: $(this).find('.custom-select').val(),
|
|
||||||
required: $(this).find('.required-toggle').is(':checked') ? 1 : 0, // Correctly capture the required value
|
|
||||||
options: []
|
|
||||||
};
|
|
||||||
|
|
||||||
$(this).find('.option-label').each(function() {
|
|
||||||
questionData.options.push($(this).val());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
formData.questions.push(questionData);
|
// Handle delete section button click
|
||||||
});
|
$(document).on('click', '.delete-section-icon', function () {
|
||||||
|
$(this).closest('.form-section').remove();
|
||||||
|
});
|
||||||
|
|
||||||
return formData;
|
// Handle delete option button click
|
||||||
}
|
$(document).on('click', '.delete-option-icon', function () {
|
||||||
function validateFormData(formData) {
|
$(this).closest('.option').remove();
|
||||||
for (let question of formData.questions) {
|
});
|
||||||
if (!question.text.trim()) {
|
|
||||||
return { isValid: false, message: 'All questions must have text.' };
|
// Handle preview button click
|
||||||
}
|
$('#preview-btn').on('click', function () {
|
||||||
if ((question.type === 'multiple-choice' || question.type === 'checkboxes' || question.type === 'dropdown') && question.options.length === 0) {
|
alert('Preview functionality is not implemented.');
|
||||||
return { isValid: false, message: 'All options-based questions must have at least one option.' };
|
});
|
||||||
}
|
$('.form-section').each(function () {
|
||||||
for (let option of question.options) {
|
$(this).on('click', function () {
|
||||||
if (!option.trim()) {
|
$('.form-section').removeClass('active');
|
||||||
return { isValid: false, message: 'All options must have text.' };
|
$(this).addClass('active');
|
||||||
|
activeSection = $(this);
|
||||||
|
positionAddSectionButton();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle window resize to reposition button
|
||||||
|
$(window).on('resize', function () {
|
||||||
|
positionAddSectionButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle submit button click
|
||||||
|
$('#submit-btn').on('click', function () {
|
||||||
|
var formData = collectFormData();
|
||||||
|
formData['form_id'] = <?php echo $form['id']; ?>;
|
||||||
|
|
||||||
|
let validation = validateFormData(formData);
|
||||||
|
if (!validation.isValid) {
|
||||||
|
alert(validation.message);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + 'Form_controller/update_form',
|
||||||
|
type: 'POST',
|
||||||
|
data: { formData: formData },
|
||||||
|
dataType: 'JSON',
|
||||||
|
success: function (response) {
|
||||||
|
if (response.status === 'success') {
|
||||||
|
alert('Form updated successfully!');
|
||||||
|
window.location.href = base_url + 'drafts';
|
||||||
|
} else {
|
||||||
|
alert(response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (error) {
|
||||||
|
alert('Error updating form!');
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Collect form data function
|
||||||
|
function collectFormData() {
|
||||||
|
var formData = {
|
||||||
|
title: $('#form-title').val(),
|
||||||
|
description: $('#form-description').val(),
|
||||||
|
questions: []
|
||||||
|
};
|
||||||
|
|
||||||
|
$('.form-section').each(function () {
|
||||||
|
var questionData = {
|
||||||
|
id: $(this).data('index'),
|
||||||
|
text: $(this).find('.untitled-question').val(),
|
||||||
|
type: $(this).find('.custom-select').val(),
|
||||||
|
required: $(this).find('.required-toggle').is(':checked') ? 1 : 0, // Correctly capture the required value
|
||||||
|
options: []
|
||||||
|
};
|
||||||
|
|
||||||
|
$(this).find('.option-label').each(function () {
|
||||||
|
questionData.options.push($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
formData.questions.push(questionData);
|
||||||
|
});
|
||||||
|
|
||||||
|
return formData;
|
||||||
|
}
|
||||||
|
function validateFormData(formData) {
|
||||||
|
for (let question of formData.questions) {
|
||||||
|
if (!question.text.trim()) {
|
||||||
|
return { isValid: false, message: 'All questions must have text.' };
|
||||||
|
}
|
||||||
|
if ((question.type === 'multiple-choice' || question.type === 'checkboxes' || question.type === 'dropdown') && question.options.length === 0) {
|
||||||
|
return { isValid: false, message: 'All options-based questions must have at least one option.' };
|
||||||
|
}
|
||||||
|
for (let option of question.options) {
|
||||||
|
if (!option.trim()) {
|
||||||
|
return { isValid: false, message: 'All options must have text.' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { isValid: true };
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return { isValid: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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>
|
|
@ -1 +0,0 @@
|
||||||
<h4>This is about page</h4>
|
|
|
@ -1 +0,0 @@
|
||||||
<h4>Welcome to Google Forms !</h4>
|
|
|
@ -1 +0,0 @@
|
||||||
<h4>This is the home page</h4>
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
<!-- <script>
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('#basetable1').DataTable({
|
|
||||||
// "pagingType": "full_numbers"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script> -->
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('#basetable1').DataTable({
|
$('#basetable1').DataTable({
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -49,13 +49,16 @@ body {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-custom .navbar-brand,
|
.navbar-custom .navbar-brand>li>a {
|
||||||
.navbar-custom .navbar-nav>li>a {
|
color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
.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 */
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue