Commit 4ad13f39 by Manoj

essay questions

parent 1296d54b
......@@ -572,13 +572,6 @@ class ApplicationController extends CI_Controller
redirect('ApplicationController/faculty');
}
public function deleteQuestion($id)
{
$delete = $this->mcommon->common_delete('question', array('id' => $id));
$this->session->set_flashdata('alert_danger', 'Record Deleted successfully!');
redirect('ApplicationController/viewQuestion');
}
public function draftformdetails()
......
......@@ -35,6 +35,19 @@ class QuestionController extends CI_Controller
$option_d = $this->input->post('option_d');
$answer = $this->input->post('answer');
$record = $this->mcommon->specific_row('exam_type', array('id' => $exam_type));
$totalQuestions = isset($record['total_questions']) ? $record['total_questions'] : 0;
$count = $this->mcommon->getQuestionCount($exam_type,$category);
if($totalQuestions == $count)
{
$this->session->set_flashdata('alert_danger', 'Question Limit Exceeded successfully!');
redirect('QuestionController/viewQuestion');
exit();
}
$insert_array = array(
'academic' => $academic,
'exam_type' => $exam_type,
......@@ -135,6 +148,15 @@ class QuestionController extends CI_Controller
}
public function deleteQuestion($id)
{
$delete = $this->mcommon->common_delete('question', array('id' => $id));
$this->session->set_flashdata('alert_danger', 'Record Deleted successfully!');
redirect('ApplicationController/viewQuestion');
}
......@@ -183,7 +205,7 @@ class QuestionController extends CI_Controller
if ($insert) {
$this->session->set_flashdata('alert_success', 'Question added successfully!');
redirect('ApplicationController/viewQuestion');
redirect('QuestionController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Add Question!');
......@@ -199,7 +221,7 @@ class QuestionController extends CI_Controller
$data = array(
'title' => 'Add Question',
'page' => 'Add Question',
'content' => $this->load->view('questions/add', $view_data, true),
'content' => $this->load->view('essay_question/add', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
......@@ -233,7 +255,7 @@ class QuestionController extends CI_Controller
if ($update) {
$this->session->set_flashdata('alert_success', 'Question Updated successfully!');
redirect('ApplicationController/viewQuestion');
redirect('QuestionController/viewQuestion');
} else {
$this->session->set_flashdata('alert_danger', 'Error in Updated Question!');
......@@ -249,7 +271,7 @@ class QuestionController extends CI_Controller
$data = array(
'title' => 'Edit Question',
'page' => 'Edit Question',
'content' => $this->load->view('questions/edit', $view_data, true),
'content' => $this->load->view('essay_question/edit', $view_data, true),
);
$this->load->view('base/base_template', $data);
}
......
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from akademi.dexignlab.com/codeigniter/demo/student by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Mar 2024 10:51:33 GMT -->
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<!-- Title -->
<title>Question</title>
<!-- Meta -->
<style>
.custom-card {
margin-top: 120px;
}
</style>
</head>
<body>
<div class="row p-5 custom-card">
<div class="col-lg-12">
<div class="card ">
<div class="card-body">
<h2 class="card-title">Add Question</h2><bR>
<form action="<?php echo base_url(); ?>QuestionController/essayquestionAdd" method="post" enctype="multipart/form-data" id="registration_form">
<div class="row">
<div class="form-group col-md-3">
<label class="tx-medium">Academic Year<span class="text-danger">*</span> </label>
<select name="academic" id="academic" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($academic_year as $row) { ?>
<option value="<?php echo $row->id ?>"> <?php echo $row->year ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label class="tx-medium">Exam Type<span class="text-danger">*</span> </label>
<select name="exam_type" id="exam_type" 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-3">
<label class="tx-medium">Category<span class="text-danger">*</span> </label>
<select name="category" id="category" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($category as $row) { ?>
<option value="<?php echo $row->id ?>"> <?php echo $row->category ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label class="tx-medium">Schedule <span class="text-danger">*</span> </label>
<select name="schedule" id="schedule" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($schedule as $row) { ?>
<option value="<?php echo $row->id ?>"> <?php echo $row->exam_schedule ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-12 mt-3">
<label>Question</label>
<!-- <textarea name="email_content" id="email_content" rows="5" autocomplete="off" class="form-control" placeholder=""></textarea> -->
<textarea name="question" id="summernote" autocomplete="off" class="form-control" placeholder=" Question"></textarea>
<?php if (form_error('question')) { ?>
<div class="text-danger alert-dismissible fade show mt-1" role="alert">
<?php echo form_error('question'); ?>
</div>
<?php } ?>
</div>
</div>
<div class="form-group mt-3 col-md-4">
<div class="">
<button name="submit" type="submit" class="btn btn-primary waves-effect waves-light mr-1">
Submit
</button>
<a href="<?php echo base_url('QuestionController/viewEssayQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
function edit(id, name) {
$('#tution_name_err').text(' ')
$('#id').val(id)
$('#tution_name').val(name)
$('#formTitle').text('Edit Tution')
$("#tutionModal").modal('show');
}
function deletetution(id, status) {
$('#tutionId').val(id)
$('#tutionStatus').val(status)
$("#statusModal").show();
}
$('#open-modal').on('click', function() {
$("#tutionModal").modal('show');
});
$('.closemodel').on('click', function() {
$("#statusModal").hide();
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from akademi.dexignlab.com/codeigniter/demo/student by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Mar 2024 10:51:33 GMT -->
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<!-- Title -->
<title>Edit Question</title>
<!-- Meta -->
<style>
.custom-card {
margin-top: 120px;
}
</style>
</head>
<body>
<div class="row p-5 custom-card">
<div class="col-lg-12">
<div class="card ">
<div class="card-body">
<h2 class="card-title">Edit Question</h2><bR>
<form action="<?php echo base_url(); ?>QuestionController/essayquestionEdit/<?= $default['id'] ?>" method="post" enctype="multipart/form-data" id="registration_form">
<div class="row">
<div class="form-group col-md-3">
<label class="tx-medium">Academic Year<span class="text-danger">*</span> </label>
<select name="academic" id="academic" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($academic_year as $row) { ?>
<option <?= $default['academic'] == $row->id ? 'selected ' : '' ?> value="<?php echo $row->id ?>"> <?php echo $row->year ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label class="tx-medium">Exam Type<span class="text-danger">*</span> </label>
<select name="exam_type" id="exam_type" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($exam_type as $row) { ?>
<option <?= $default['exam_type'] == $row->id ? 'selected ' : '' ?> value="<?php echo $row->id ?>"> <?php echo $row->exam_type_name ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label class="tx-medium">Category<span class="text-danger">*</span> </label>
<select name="category" id="category" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($category as $row) { ?>
<option <?= $default['category'] == $row->id ? 'selected ' : '' ?> value="<?php echo $row->id ?>"> <?php echo $row->category ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-3">
<label class="tx-medium">Schedule <span class="text-danger">*</span> </label>
<select name="schedule" id="schedule" class="form-control select2 modal-select">
<option value="">--Select--</option>
<?php foreach ($schedule as $row) { ?>
<option <?= $default['schedule_id'] == $row->id ? 'selected ' : '' ?> value="<?php echo $row->id ?>"> <?php echo $row->exam_schedule ?></option>
<?php } ?>
</select>
</div>
<div class="form-group col-md-12 mt-3">
<label>Question</label>
<!-- <textarea name="email_content" id="email_content" rows="5" autocomplete="off" class="form-control" placeholder=""></textarea> -->
<textarea name="question" id="summernote" autocomplete="off" class="form-control" placeholder="Question"> <?= (isset($_POST['question'])) ? $_POST['question'] : $default['question']; ?></textarea>
<?php if (form_error('question')) { ?>
<div class="text-danger alert-dismissible fade show mt-1" role="alert">
<?php echo form_error('question'); ?>
</div>
<?php } ?>
</div>
</div>
<div class="form-group mt-3 col-md-4">
<div class="">
<button name="submit" type="submit" class="btn btn-primary waves-effect waves-light mr-1">
Submit
</button>
<a href="<?php echo base_url('QuestionController/viewQuestion'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
function edit(id, name) {
$('#tution_name_err').text(' ')
$('#id').val(id)
$('#tution_name').val(name)
$('#formTitle').text('Edit Tution')
$("#tutionModal").modal('show');
}
function deletetution(id, status) {
$('#tutionId').val(id)
$('#tutionStatus').val(status)
$("#statusModal").show();
}
$('#open-modal').on('click', function() {
$("#tutionModal").modal('show');
});
$('.closemodel').on('click', function() {
$("#statusModal").hide();
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from akademi.dexignlab.com/codeigniter/demo/student by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Mar 2024 10:51:33 GMT -->
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<!-- Title -->
<title>List</title>
<!-- Meta -->
</head>
<body>
<?php $segment = $this->uri->segment(2) ?>
<div class="content-body">
<!-- row -->
<div class="container-fluid">
<!-- Row -->
<div class="row">
<div class="col-xl-12">
<div class="row">
<div class="col-xl-12">
<div class="page-title flex-wrap">
<div class="input-group search-area mb-md-0 mb-3">
<input type="text" class="form-control" placeholder="Search here...">
<span class="input-group-text"><a href="javascript:void(0)">
<svg width="15" height="15" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.5605 15.4395L13.7527 11.6317C14.5395 10.446 15 9.02625 15 7.5C15 3.3645 11.6355 0 7.5 0C3.3645 0 0 3.3645 0 7.5C0 11.6355 3.3645 15 7.5 15C9.02625 15 10.446 14.5395 11.6317 13.7527L15.4395 17.5605C16.0245 18.1462 16.9755 18.1462 17.5605 17.5605C18.1462 16.9747 18.1462 16.0252 17.5605 15.4395V15.4395ZM2.25 7.5C2.25 4.605 4.605 2.25 7.5 2.25C10.395 2.25 12.75 4.605 12.75 7.5C12.75 10.395 10.395 12.75 7.5 12.75C4.605 12.75 2.25 10.395 2.25 7.5V7.5Z" fill="#01A3FF" />
</svg>
</a></span>
</div>
<div>
<!-- Button trigger modal -->
<a href="<?php echo base_url(); ?>QuestionController/essayquestionAdd" type="button" class="btn btn-primary" id="open-modal">
+ New Question
</a>
</div>
</div>
</div>
<!--column-->
<div class="col-xl-12 wow fadeInUp" data-wow-delay="1.5s">
<div class="table-responsive full-data">
<table class="table-responsive-lg table display dataTablesCard student-tab dataTable no-footer" id="example-student">
<thead>
<tr>
<th class="wd-20p">S.No</th>
<th class="wd-25p">Academic Year</th>
<th class="wd-15p">Exam Type</th>
<th class="wd-15p">Category</th>
<th class="wd-15p"> Question</th>
<th class="wd-15p">Action</th>
</tr>
</thead>
<tbody>
<?php
foreach ($records as $row) { ?>
<tr>
<td><?= $row->id; ?></td>
<td><?php foreach ($academic_year as $year) { ?>
<?= ($row->academic == $year->id) ? $year->year : '' ?>
<?php } ?></td>
<td> <?php foreach ($exam_type as $exam) { ?>
<?= ($row->exam_type == $exam->id) ? $exam->exam_type_name : '' ?>
<?php } ?></td>
<td>
<?php foreach ($category as $cat) { ?>
<?= ($row->category == $cat->id) ? $cat->category : '' ?>
<?php } ?></td>
<td><?= $row->question; ?></td>
<td>
<a href="<?= base_url('QuestionController/essayquestionEdit/' . $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>
<?php }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
</script>
\ No newline at end of file
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