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.
|
||||
|
|
||||
*/
|
||||
$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['translate_uri_dashes'] = FALSE;
|
||||
$route['start'] = 'Form_controller/index_forms';
|
||||
// $route['new_form'] = 'home/create_form';
|
||||
$route['title_desc'] = 'homepage/title';
|
||||
$route['forms/delete/(:any)'] = 'Form_controller/delete/$1';
|
||||
$route['home'] = 'Form_controller/index_forms';
|
||||
|
@ -26,4 +25,3 @@ $route['response_preview/(:num)'] = 'forms/response_preview/$1';
|
|||
|
||||
$route['title'] = 'homepage/title';
|
||||
|
||||
// $route['designform'] = 'homepage/design_form';
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?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)
|
||||
{
|
||||
|
@ -36,18 +37,20 @@ class Form_controller extends CI_Controller {
|
|||
// If not logged in, redirect to login page
|
||||
redirect('users/login');
|
||||
}
|
||||
$this->load->model('Frontend_model');
|
||||
$this->Frontend_model->deleteForm($id);
|
||||
$this->session->set_flashdata('status','Form data deleted successfully');
|
||||
redirect('home');
|
||||
$this->load->model('Frontend_model');
|
||||
$this->Frontend_model->deleteForm($id);
|
||||
$this->session->set_flashdata('status', 'Form data deleted successfully');
|
||||
redirect('home');
|
||||
}
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('Updation_model');
|
||||
}
|
||||
|
||||
// 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['questions'] = $this->Updation_model->get_questions($form_id);
|
||||
$data['options'] = $this->Updation_model->get_options();
|
||||
|
@ -59,7 +62,8 @@ redirect('home');
|
|||
}
|
||||
|
||||
// Save the edited form
|
||||
public function update_form() {
|
||||
public function update_form()
|
||||
{
|
||||
$formData = $this->input->post('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');
|
||||
|
||||
// Check if the user is logged in
|
||||
|
|
|
@ -10,12 +10,12 @@ class Frontend_model extends CI_Model {
|
|||
|
||||
// Ensure user_id is set
|
||||
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
|
||||
$this->db->where('user_id', $user_id); // Assuming 'user_id' is the column name in the 'forms' table
|
||||
$this->db->order_by('created_at', 'DESC'); // Order by created_at column, most recent first
|
||||
$this->db->where('user_id', $user_id);
|
||||
$this->db->order_by('created_at', 'DESC');
|
||||
$query = $this->db->get('forms');
|
||||
|
||||
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();
|
||||
}
|
||||
public function getforms_draft($user_id) {
|
||||
$this->db->where('is_published', 0); // Filter by unpublished forms
|
||||
$this->db->where('user_id', $user_id); // Filter by user_id
|
||||
$this->db->order_by('created_at', 'DESC'); // Sort by creation date, newest first
|
||||
$this->db->where('is_published', 0);
|
||||
$this->db->where('user_id', $user_id);
|
||||
$this->db->order_by('created_at', 'DESC');
|
||||
$query = $this->db->get('forms');
|
||||
return $query->result();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class New_form_model extends CI_Model {
|
|||
if (!empty($option)) { // Avoid inserting empty options
|
||||
$optionData = [
|
||||
'question_id' => $questionId,
|
||||
'option_text' => $option // Ensure column name matches database schema
|
||||
'option_text' => $option
|
||||
];
|
||||
// Insert option into options table
|
||||
$this->db->insert('options', $optionData);
|
||||
|
|
|
@ -1,39 +1,45 @@
|
|||
<?php
|
||||
class Response_model extends CI_Model {
|
||||
// 888888888888888888888
|
||||
class Response_model extends CI_Model
|
||||
{
|
||||
// 888888888888888888888
|
||||
|
||||
public function insert_response($data) {
|
||||
public function insert_response($data)
|
||||
{
|
||||
$this->db->insert('responses', $data);
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function insert_response_answer($data) {
|
||||
public function insert_response_answer($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);
|
||||
$query = $this->db->get('forms');
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
// 888888888888888888888
|
||||
|
||||
|
||||
public function get_questions($form_id) {
|
||||
|
||||
public function get_questions($form_id)
|
||||
{
|
||||
$this->db->where('form_id', $form_id);
|
||||
$query = $this->db->get('questions');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_options($question_id) {
|
||||
public function get_options($question_id)
|
||||
{
|
||||
$this->db->where('question_id', $question_id);
|
||||
$query = $this->db->get('options');
|
||||
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->from('responses');
|
||||
$this->db->join('users', 'responses.user_id = users.id');
|
||||
|
@ -48,16 +54,17 @@ class Response_model extends CI_Model {
|
|||
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->from('response_answers');
|
||||
$this->db->where('response_answers.response_id', $response_id);
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
// 888888888888888888888
|
||||
|
||||
public function get_responses($form_id) {
|
||||
public function get_responses($form_id)
|
||||
{
|
||||
$this->db->where('form_id', $form_id);
|
||||
$query = $this->db->get('responses');
|
||||
return $query->result();
|
||||
|
@ -65,7 +72,8 @@ class Response_model extends CI_Model {
|
|||
|
||||
|
||||
// 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->from('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
|
||||
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->from('questions');
|
||||
$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->from('forms');
|
||||
$this->db->join('responses', 'forms.id = responses.form_id');
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
<?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);
|
||||
$query = $this->db->get('forms');
|
||||
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->order_by('id', 'ASC');
|
||||
$query = $this->db->get('questions');
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
public function get_options() {
|
||||
public function get_options()
|
||||
{
|
||||
$query = $this->db->get('options');
|
||||
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();
|
||||
|
||||
// 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
|
||||
$existing_options = $this->db->where('question_id', $question_id)->get('options')->result_array();
|
||||
$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>
|
||||
</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 -->
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<th>Description</th>
|
||||
<th>Created On</th>
|
||||
<th>Status</th>
|
||||
<th>Preview</th>
|
||||
<th>Responses</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -52,13 +52,13 @@
|
|||
<tr class="<?php echo ($row->is_published ? '' : 'draft-row'); ?>">
|
||||
<td><?php echo $serialNumber++; ?></td>
|
||||
<td class="title-column">
|
||||
<?php echo $row->title; ?>
|
||||
<a href="<?php echo base_url('publish/' . $row->id); ?>"><?php echo $row->title; ?></a>
|
||||
</td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo $row->created_at; ?></td>
|
||||
<td><?php echo ($row->is_published ? 'Published' : 'Draft'); ?></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 -->
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<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://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-custom">
|
||||
|
@ -22,14 +24,14 @@
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="navbar">
|
||||
<ul class="nav navbar-nav left">
|
||||
<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 right">
|
||||
<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>
|
||||
|
@ -41,7 +43,8 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
|
||||
|
||||
<!-- Alert Messages -->
|
||||
<div class="container">
|
||||
|
@ -65,22 +68,28 @@
|
|||
<!-- Form Editor -->
|
||||
<div class="container">
|
||||
<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-description" class="form-control" value="<?php echo $form['description']; ?>">
|
||||
<button id="add-section-btn" class="btn btn-primary">+</button>
|
||||
</div>
|
||||
<div id="form-container">
|
||||
<?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">
|
||||
<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">
|
||||
<option value="short-answer" <?php echo $question['type'] == 'short-answer' ? 'selected' : ''; ?>>Short Answer</option>
|
||||
<option value="paragraph" <?php echo $question['type'] == 'paragraph' ? 'selected' : ''; ?>>Paragraph</option>
|
||||
<option value="short-answer" <?php echo $question['type'] == 'short-answer' ? 'selected' : ''; ?>>
|
||||
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="checkboxes" <?php echo $question['type'] == 'checkboxes' ? 'selected' : ''; ?>>Checkboxes</option>
|
||||
<option value="dropdown" <?php echo $question['type'] == 'dropdown' ? 'selected' : ''; ?>>Dropdown</option>
|
||||
<option value="checkboxes" <?php echo $question['type'] == 'checkboxes' ? 'selected' : ''; ?>>
|
||||
Checkboxes</option>
|
||||
<option value="dropdown" <?php echo $question['type'] == 'dropdown' ? 'selected' : ''; ?>>Dropdown
|
||||
</option>
|
||||
</select>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" class="required-toggle" <?php echo $question['is_required'] ? 'checked' : ''; ?>>
|
||||
|
@ -96,14 +105,15 @@
|
|||
foreach ($options as $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>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!-- Show or hide the "Add Option" button based on question type -->
|
||||
<?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; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
@ -117,7 +127,7 @@
|
|||
<!-- <script src="<?php echo base_url('assets/js/scripts.js'); ?>"></script> -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
var base_url = '<?php echo base_url(); ?>';
|
||||
var index = 1;
|
||||
var activeSection = null;
|
||||
|
@ -137,7 +147,7 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
// Add section button functionality
|
||||
$('#add-section-btn').on('click', function() {
|
||||
$('#add-section-btn').on('click', function () {
|
||||
createFormSection();
|
||||
$('.form-section').removeClass('active');
|
||||
activeSection = $('.form-section').last();
|
||||
|
@ -149,7 +159,7 @@ $(document).ready(function() {
|
|||
var sectionHtml = `
|
||||
<div class="form-section" data-type="">
|
||||
<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">
|
||||
<option value="short-answer">Short Answer</option>
|
||||
<option value="paragraph">Paragraph</option>
|
||||
|
@ -164,14 +174,16 @@ $(document).ready(function() {
|
|||
<span class="delete-section-icon"><i class="fas fa-trash-alt"></i></span>
|
||||
</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>
|
||||
`;
|
||||
$('#form-container').append(sectionHtml);
|
||||
positionAddSectionButton();
|
||||
|
||||
}
|
||||
|
||||
// Handle option button click
|
||||
$(document).on('click', '.add-option-btn', function() {
|
||||
$(document).on('click', '.add-option-btn', function () {
|
||||
var $section = $(this).closest('.form-section');
|
||||
var optionHtml = `
|
||||
<div class="option">
|
||||
|
@ -183,22 +195,35 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
// Handle delete section button click
|
||||
$(document).on('click', '.delete-section-icon', function() {
|
||||
$(document).on('click', '.delete-section-icon', function () {
|
||||
$(this).closest('.form-section').remove();
|
||||
});
|
||||
|
||||
// Handle delete option button click
|
||||
$(document).on('click', '.delete-option-icon', function() {
|
||||
$(document).on('click', '.delete-option-icon', function () {
|
||||
$(this).closest('.option').remove();
|
||||
});
|
||||
|
||||
// Handle preview button click
|
||||
$('#preview-btn').on('click', function() {
|
||||
$('#preview-btn').on('click', function () {
|
||||
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
|
||||
$('#submit-btn').on('click', function() {
|
||||
$('#submit-btn').on('click', function () {
|
||||
var formData = collectFormData();
|
||||
formData['form_id'] = <?php echo $form['id']; ?>;
|
||||
|
||||
|
@ -213,7 +238,7 @@ $(document).ready(function() {
|
|||
type: 'POST',
|
||||
data: { formData: formData },
|
||||
dataType: 'JSON',
|
||||
success: function(response) {
|
||||
success: function (response) {
|
||||
if (response.status === 'success') {
|
||||
alert('Form updated successfully!');
|
||||
window.location.href = base_url + 'drafts';
|
||||
|
@ -221,7 +246,7 @@ $(document).ready(function() {
|
|||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
error: function (error) {
|
||||
alert('Error updating form!');
|
||||
console.log(error);
|
||||
}
|
||||
|
@ -236,7 +261,7 @@ $(document).ready(function() {
|
|||
questions: []
|
||||
};
|
||||
|
||||
$('.form-section').each(function() {
|
||||
$('.form-section').each(function () {
|
||||
var questionData = {
|
||||
id: $(this).data('index'),
|
||||
text: $(this).find('.untitled-question').val(),
|
||||
|
@ -245,7 +270,7 @@ $(document).ready(function() {
|
|||
options: []
|
||||
};
|
||||
|
||||
$(this).find('.option-label').each(function() {
|
||||
$(this).find('.option-label').each(function () {
|
||||
questionData.options.push($(this).val());
|
||||
});
|
||||
|
||||
|
@ -272,20 +297,9 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
// 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>
|
||||
</body>
|
||||
|
||||
</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>
|
||||
<th>Responses</th>
|
||||
<th>Title</th>
|
||||
<th>Status</th>
|
||||
<th>Response Link</th>
|
||||
<th>Status</th>
|
||||
<th>Preview</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -40,14 +40,14 @@
|
|||
<td class="title-column">
|
||||
<?php echo $row->title; ?>
|
||||
</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 $row->response_link; ?>" target="_blank"><?php echo $row->response_link; ?></a>
|
||||
</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); ?>">
|
||||
<i class="fas fa-eye"></i> <!-- Eye icon -->
|
||||
</a>
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
<link rel="stylesheet" href="https://bootswatch.com/3/flatly/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
.username-column {
|
||||
color: darkblue; /* Dark blue color for title */
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mt-4">
|
||||
|
@ -25,21 +30,22 @@
|
|||
<table id="basetable1" class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Response ID</th>
|
||||
<th>Username</th>
|
||||
<th>Submitted At</th>
|
||||
<th>View</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($responses as $response): ?>
|
||||
<tr>
|
||||
|
||||
<td class="username-column"><?php echo $response->username; ?></td>
|
||||
<td><?php echo $response->submitted_at; ?></td>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
<td><?php echo $response->username; ?></td>
|
||||
<td><?php echo $response->submitted_at; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
<!-- <script>
|
||||
$(document).ready(function(){
|
||||
$('#basetable1').DataTable({
|
||||
// "pagingType": "full_numbers"
|
||||
});
|
||||
});
|
||||
</script> -->
|
||||
|
||||
<script>
|
||||
$('#basetable1').DataTable({
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
<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="<?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>
|
||||
<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-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 */
|
||||
#add-section-btn {
|
||||
position: absolute;
|
||||
/* Ensure proper positioning */
|
||||
/* Brand styling */
|
||||
.navbar-custom .navbar-brand {
|
||||
color: #fff;
|
||||
font-size: 19px;
|
||||
margin-right: 20px;
|
||||
padding: 15px 10px;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
margin-bottom: 15px;
|
||||
padding: 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
|
||||
.navbar-custom .navbar-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
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;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-row textarea,
|
||||
.header-row select {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.navbar-custom .navbar-brand {
|
||||
color: #fff; /* Customize brand color */
|
||||
.navbar-custom .navbar-nav.navbar-right li {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.navbar-custom .navbar-nav li a {
|
||||
color: #fff; /* Customize link color */
|
||||
}
|
||||
|
||||
#add-section-btn {
|
||||
position: absolute;
|
||||
|
||||
}
|
||||
|
|
|
@ -49,13 +49,16 @@ body {
|
|||
border-radius: 0;
|
||||
}
|
||||
|
||||
.navbar-custom .navbar-brand,
|
||||
.navbar-custom .navbar-nav>li>a {
|
||||
.navbar-custom .navbar-brand>li>a {
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
.navbar-custom .navbar-nav>li>a{
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.navbar-custom .navbar-brand:hover,
|
||||
.navbar-custom .navbar-nav>li>a:hover {
|
||||
color: white; /* Keep text color white on hover */
|
||||
|
|
|
@ -114,8 +114,21 @@ body {
|
|||
|
||||
.custom-select {
|
||||
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 {
|
||||
flex: 0.1;
|
||||
cursor: pointer;
|
||||
|
@ -164,7 +177,7 @@ body {
|
|||
background-color: rgb(66, 133, 244);
|
||||
/* color: rgb(66, 133, 244); */
|
||||
margin-top: 11px;
|
||||
font-size: 0.9em;
|
||||
font-size: 0.8em;
|
||||
|
||||
}
|
||||
|
||||
|
@ -177,8 +190,7 @@ body {
|
|||
width: 56%;
|
||||
margin-left: 240px;
|
||||
}
|
||||
/* Toggle Switch CSS */
|
||||
/* Toggle Switch CSS */
|
||||
|
||||
.toggle-switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
|
|
@ -30,8 +30,7 @@ function addOption(type, container) {
|
|||
<div class="form-section" data-index="${index}">
|
||||
<div class="header-row">
|
||||
${index === 1 ? '<div class="violet-border"></div>' : ''}
|
||||
<textarea class="form-control untitled-question" placeholder="Untitled Question" rows="1"></textarea>
|
||||
<select class="custom-select">
|
||||
<input type="text" class="form-control untitled-question" placeholder="Untitled Question" rows="1"> <select class="custom-select">
|
||||
<option value="short-answer">Short Answer</option>
|
||||
<option value="paragraph">Paragraph</option>
|
||||
<option value="multiple-choice">Multiple Choice</option>
|
||||
|
@ -145,13 +144,13 @@ function addOption(type, container) {
|
|||
<body>
|
||||
<div class="container">
|
||||
<div class="form-header">
|
||||
<h2>Untitled Form</h2>
|
||||
<h3>Form Preview</h3>
|
||||
</div>
|
||||
`;
|
||||
$('.form-section').each(function() {
|
||||
previewContent += '<div class="form-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>';
|
||||
let type = $(this).find('.custom-select').val();
|
||||
let optionsContainer = $(this).find('.options-container');
|
||||
|
@ -189,7 +188,6 @@ function addOption(type, container) {
|
|||
previewContent += '</div>';
|
||||
});
|
||||
previewContent += `
|
||||
<button class="btn btn-success" style="margin-left: 240px; margin-top: 20px">Submit</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue