Commit c1a1c5e5 by Hussain Mohamed

changes

parents d919f886 252e5c44
......@@ -2371,9 +2371,9 @@ class ApplicationController extends CI_Controller
if($totalQuestions == $count)
{
$this->session->set_flashdata('alert_danger', 'Question Limit Exceeded !');
$this->session->set_flashdata('alert_danger', 'Question Limit Exceeded successfully!');
redirect('ApplicationController/viewQuestion');
//return exit();
exit();
}
$insert_array = array(
......
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class QuestionController extends CI_Controller
{
public function viewQuestion()
{
$view_data['records'] = $this->mcommon->records_all('question');
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$data = array(
'title' => 'View Question ',
'page' => 'View Question',
'content' => $this->load->view('questions/view', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
public function questionAdd()
{
if(isset($_POST['submit'])){
$academic = $this->input->post('academic');
$exam_type = $this->input->post('exam_type');
$category = $this->input->post('category');
$schedule = $this->input->post('schedule');
$question = $this->input->post('question');
$option_a = $this->input->post('option_a');
$option_b = $this->input->post('option_b');
$option_c = $this->input->post('option_c');
$option_d = $this->input->post('option_d');
$answer = $this->input->post('answer');
$insert_array = array(
'academic' => $academic,
'exam_type' => $exam_type,
'category' => $category,
'schedule_id' => $schedule,
'question' => $question,
'option_a' => $option_a,
'option_b' => $option_b,
'option_c' => $option_c,
'option_d' => $option_d,
'answer' => $answer,
);
$insert = $this->mcommon->common_insert('question', $insert_array);
if ($insert) {
$this->session->set_flashdata('alert_success', 'Question added successfully!');
redirect('QuestionController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Add Question!');
}
}else{
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$data = array(
'title' => 'Add Question',
'page' => 'Add Question',
'content' => $this->load->view('questions/add', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
}
public function questionEdit($id){
if(isset($_POST['submit'])){
$academic = $this->input->post('academic');
$exam_type = $this->input->post('exam_type');
$category = $this->input->post('category');
$schedule = $this->input->post('schedule');
$question = $this->input->post('question');
$option_a = $this->input->post('option_a');
$option_b = $this->input->post('option_b');
$option_c = $this->input->post('option_c');
$option_d = $this->input->post('option_d');
$answer = $this->input->post('answer');
$update_array = array(
'academic' => $academic,
'exam_type' => $exam_type,
'category' => $category,
'schedule_id' => $schedule,
'question' => $question,
'option_a' => $option_a,
'option_b' => $option_b,
'option_c' => $option_c,
'option_d' => $option_d,
'answer' => $answer,
);
$update = $this->mcommon->common_edit('question',$update_array,array('id' => $id));
if ($update) {
$this->session->set_flashdata('alert_success', 'Question Updated successfully!');
redirect('QuestionController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Updated Question!');
}
}else{
$view_data['default'] = $this->mcommon->specific_row('question', array('id' => $id));
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$data = array(
'title' => 'Edit Question',
'page' => 'Edit Question',
'content' => $this->load->view('questions/edit', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
}
public function viewEssayQuestion()
{
$view_data['records'] = $this->mcommon->records_all('question');
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$data = array(
'title' => 'View Question ',
'page' => 'View Question',
'content' => $this->load->view('essay_question/view', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
public function essayquestionAdd()
{
if(isset($_POST['submit'])){
$academic = $this->input->post('academic');
$exam_type = $this->input->post('exam_type');
$category = $this->input->post('category');
$schedule = $this->input->post('schedule');
$question = $this->input->post('question');
$insert_array = array(
'academic' => $academic,
'exam_type' => $exam_type,
'category' => $category,
'schedule_id' => $schedule,
'question' => $question,
);
$insert = $this->mcommon->common_insert('question', $insert_array);
if ($insert) {
$this->session->set_flashdata('alert_success', 'Question added successfully!');
redirect('ApplicationController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Add Question!');
}
}else{
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$data = array(
'title' => 'Add Question',
'page' => 'Add Question',
'content' => $this->load->view('questions/add', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
}
public function essayquestionEdit($id){
if(isset($_POST['submit'])){
$academic = $this->input->post('academic');
$exam_type = $this->input->post('exam_type');
$category = $this->input->post('category');
$schedule = $this->input->post('schedule');
$question = $this->input->post('question');
$update_array = array(
'academic' => $academic,
'exam_type' => $exam_type,
'category' => $category,
'schedule_id' => $schedule,
'question' => $question,
);
$update = $this->mcommon->common_edit('question',$update_array,array('id' => $id));
if ($update) {
$this->session->set_flashdata('alert_success', 'Question Updated successfully!');
redirect('ApplicationController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Updated Question!');
}
}else{
$view_data['default'] = $this->mcommon->specific_row('question', array('id' => $id));
$view_data['exam_type'] = $this->mcommon->records_all('exam_type',array('status',1));
$view_data['academic_year'] = $this->mcommon->records_all('accadamic_year',array('status',1));
$view_data['category'] = $this->mcommon->records_all('section_category',array('status',1));
$view_data['schedule'] = $this->mcommon->records_all('exam_schedule',array('status',1));
$data = array(
'title' => 'Edit Question',
'page' => 'Edit Question',
'content' => $this->load->view('questions/edit', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
}
}
......@@ -59,12 +59,25 @@
</a>
</li>
<li><a href="<?php echo base_url(); ?>ApplicationController/viewQuestion/" aria-expanded="false">
<!-- <li><a href="<?php echo base_url(); ?>ApplicationController/viewQuestion/" aria-expanded="false">
<i class="material-symbols-outlined">note</i>
<span class="nav-text">Create Question</span>
</a>
</li> -->
<li><a class="has-arrow " href="javascript:void(0);" aria-expanded="false">
<i class="material-icons"> note </i>
<span class="nav-text">Create Question</span>
</a>
<ul aria-expanded="false">
<li><a href="<?php echo base_url(); ?>QuestionController/viewQuestion/">Objective Question</a></li>
<li><a href="<?php echo base_url(); ?>QuestionController/viewEssayQuestion/">Essay Question</a></li>
</ul>
</li>
<li><a class="has-arrow " href="javascript:void(0);" aria-expanded="false">
<i class="material-symbols-outlined">list</i>
<span class="nav-text"> Application list</span>
......
......@@ -53,8 +53,10 @@
<th class="wd-20p">S.No</th>
<th class="wd-20p">Academic</th>
<th class="wd-25p"> Exam Schedule </th>
<th class="wd-25p">Date</th>
<th class="wd-25p">Time</th>
<th class="wd-25p">Objective Date</th>
<th class="wd-25p">Objective Time</th>
<th class="wd-25p">Essay Date</th>
<th class="wd-25p">Essay Time</th>
<th class="wd-15p">Action</th>
</tr>
</thead>
......@@ -67,10 +69,12 @@
<td><?= $i ?></td>
<td><?= $row->academic ?></td>
<td><?= $row->exam_schedule ?></td>
<td><?= date($row->date) ?></td>
<td><?= $row->time ?></td>
<td><?= date($row->objective_date) ?></td>
<td><?= $row->objective_time ?></td>
<td><?= date($row->essay_date) ?></td>
<td><?= $row->essay_time ?></td>
<td>
<a data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" onclick="edit('<?php echo $row->id; ?>', '<?php echo $row->academic; ?>', '<?php echo $row->exam_schedule; ?>','<?php echo $row->date; ?>','<?php echo $row->time; ?>')" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>
<a data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" onclick="edit('<?php echo $row->id; ?>', '<?php echo $row->academic; ?>', '<?php echo $row->exam_schedule; ?>','<?php echo $row->objective_date; ?>','<?php echo $row->objective_time; ?>','<?php echo $row->essay_date; ?>','<?php echo $row->essay_time; ?>')" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>
<a data-toggle="tooltip" data-placement="top" title="Delete" data-original-title="Delete" onclick="deleteCourse('<?php echo $row->id; ?>','<?php echo $row->status; ?>')" class="btn btn-sm <?php echo $row->status == 1 ? 'btn-primary' : 'btn-danger' ?> text-white"><?php echo $row->status == 1 ? 'Active' : 'In-Active' ?></a>
</td>
</tr>
......@@ -111,7 +115,6 @@
<?php } ?>
</select>
</div>
......@@ -121,15 +124,53 @@
<!-- <p class="text-danger mt-2" id="fees_err"></p> -->
</div>
<div class="form-group col-md-6">
<label class="tx-medium">Date <span class="text-danger">*</span> </label>
<input type="date" class="form-control" id="date" name="date" placeholder="Date" required>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium">Exam Type<span class="text-danger">*</span> </label>
<select name="exam_type1" id="exam_type1" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($exam_type as $row) { ?>
<option value="<?php echo $row->id ?>"> <?php echo $row->exam_type_name ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium">Objective Date <span class="text-danger">*</span> </label>
<input type="date" class="form-control" id="objective_date" name="objective_date" placeholder="Date" required>
<!-- <p class="text-danger mt-2" id="fees_err"></p> -->
</div>
<div class="form-group col-md-6">
<label class="tx-medium">Time <span class="text-danger">*</span> </label>
<input type="time" class="form-control" id="time" name="time" placeholder="Time" required>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium"> Objective Time <span class="text-danger">*</span> </label>
<input type="time" class="form-control" id="objective_time" name="objective_time" placeholder="Time" required>
<!-- <p class="text-danger mt-2" id="fees_err"></p> -->
</div>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium">Exam Type<span class="text-danger">*</span> </label>
<select name="exam_type2" id="exam_type2" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($exam_type as $row) { ?>
<option value="<?php echo $row->id ?>"> <?php echo $row->exam_type_name ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium">Essay Date <span class="text-danger">*</span> </label>
<input type="date" class="form-control" id="essay_date" name="essay_date" placeholder="Date" required>
<!-- <p class="text-danger mt-2" id="fees_err"></p> -->
</div>
<div class="form-group col-md-4 mt-3">
<label class="tx-medium"> Essay Time <span class="text-danger">*</span> </label>
<input type="time" class="form-control" id="essay_time" name="essay_time" placeholder="Time" required>
<!-- <p class="text-danger mt-2" id="fees_err"></p> -->
</div>
</div>
......@@ -176,15 +217,17 @@
</html>
<script>
function edit(id, academic, schedule,date,time) {
function edit(id, academic,schedule,objective_date,objective_time,essay_date,essay_time) {
$('#id').val(id)
$('#academic').val(academic)
$('#schedule').val(schedule )
$('#date').val(date)
$('#time').val(time)
$('#objective_date').val(objective_date)
$('#objective_time').val(objective_time)
$('#essay_date').val(essay_date)
$('#essay_time').val(essay_time)
$('#formTitle').text('Edit Exam Schedule')
$(".select").trigger("change");
$("#applicationModal").modal('show');
$("#courseId").select2({
width: '100%',
......
......@@ -26,7 +26,7 @@
<div class="card ">
<div class="card-body">
<h2 class="card-title">Add Question</h2><bR>
<form action="<?php echo base_url(); ?>ApplicationController/questionAdd" method="post" enctype="multipart/form-data" id="registration_form">
<form action="<?php echo base_url(); ?>QuestionController/questionAdd" method="post" enctype="multipart/form-data" id="registration_form">
<div class="row">
<div class="form-group col-md-3">
......@@ -161,7 +161,7 @@
<button name="submit" type="submit" class="btn btn-primary waves-effect waves-light mr-1">
Submit
</button>
<a href="<?php echo base_url('ApplicationController/viewQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
<a href="<?php echo base_url('QuestionController/viewQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
</div>
</div>
</div>
......
......@@ -26,7 +26,7 @@
<div class="card ">
<div class="card-body">
<h2 class="card-title">Edit Question</h2><bR>
<form action="<?php echo base_url(); ?>ApplicationController/questionEdit/<?=$default['id']?>" method="post" enctype="multipart/form-data" id="registration_form">
<form action="<?php echo base_url(); ?>QuestionController/questionEdit/<?=$default['id']?>" method="post" enctype="multipart/form-data" id="registration_form">
<div class="row">
<div class="form-group col-md-3">
......@@ -159,7 +159,7 @@
<button name="submit" type="submit" class="btn btn-primary waves-effect waves-light mr-1">
Submit
</button>
<a href="<?php echo base_url('ApplicationController/viewQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
<a href="<?php echo base_url('QuestionController/viewQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
</div>
</div>
</div>
......
......@@ -48,7 +48,7 @@
</div>
<div>
<!-- Button trigger modal -->
<a href="<?php echo base_url(); ?>ApplicationController/questionAdd" type="button" class="btn btn-primary" id="open-modal">
<a href="<?php echo base_url(); ?>QuestionController/questionAdd" type="button" class="btn btn-primary" id="open-modal">
+ New Question
</a>
......@@ -90,8 +90,8 @@
<?php } ?></td>
<td><?= $row->question; ?></td>
<td>
<a href="<?= base_url('ApplicationController/questionEdit/' . $row->id) ?>" data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>
<a href="<?= base_url('ApplicationController/deleteQuestion/' . $row->id) ?>" data-toggle="tooltip" id="delete" data-placement="top" title="Delete" data-original-title="Edit" class="btn btn-sm btn-danger"><i class="ti ti-trash"></i></a>
<a href="<?= base_url('QuestionController/questionEdit/' . $row->id) ?>" data-toggle="tooltip" id="edit" data-placement="top" title="Edit" data-original-title="Edit" class="btn btn-sm btn-info"><i class="ti ti-pencil"></i></a>
<a href="<?= base_url('QuestionController/deleteQuestion/' . $row->id) ?>" data-toggle="tooltip" id="delete" data-placement="top" title="Delete" data-original-title="Edit" class="btn btn-sm btn-danger"><i class="ti ti-trash"></i></a>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment