1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<table class="table table-bordered" id="active_courses_table">
<thead>
<tr>
<th><?php echo get_phrase('title'); ?></th>
<th><?php echo get_phrase('category'); ?></th>
<th><?php echo get_phrase('instructor'); ?></th>
<th><?php echo get_phrase('number_of_sections'); ?></th>
<th><?php echo get_phrase('number_of_lessons'); ?></th>
<th><?php echo get_phrase('number_of_enrolled_users'); ?></th>
<th><?php echo get_phrase('action'); ?></th>
</tr>
</thead>
<tbody>
<?php
$active_courses = 0;
foreach ($courses->result_array() as $course):
if ($course['status'] != 'active')
continue;
else
$active_courses++;
?>
<tr>
<td><?php echo $course['title']; ?></td>
<td>
<?php
$category_details = $this->crud_model->get_categories($course['category_id'])->row_array();
echo $category_details['name'];
?>
</td>
<td>
<?php
if ($course['user_id'] > 0) {
$instructor_details = $this->user_model->get_all_user($course['user_id'])->row_array();
echo $instructor_details['first_name'].' '.$instructor_details['last_name'];
}else {
$admin_details = $this->user_model->get_admin_details();
echo $admin_details['first_name'].' '.$admin_details['last_name'];
}
?>
</td>
<td hidden>
<ul style="list-style-type:square">
<?php
$lessons = $this->crud_model->get_lessons('course', $course['id'])->result_array();
foreach ($lessons as $lesson):?>
<a href="<?php echo site_url('admin/watch_video/'.slugify($lesson['title']).'/'.$lesson['id']); ?>"><li><?php echo $lesson['title']; ?></li></a>
<?php endforeach; ?>
</ul>
</td>
<td>
<?php
$sections = $this->crud_model->get_section('course', $course['id']);
echo $sections->num_rows();
?>
</td>
<td>
<?php
$lessons = $this->crud_model->get_lessons('course', $course['id']);
echo $lessons->num_rows();
?>
</td>
<td>
<?php
$enrol_history = $this->crud_model->enrol_history($course['id']);
echo $enrol_history->num_rows();
?>
</td>
<td>
<div class="btn-group">
<button class="btn btn-small btn-default btn-demo-space" data-toggle="dropdown"> <i class = "fa fa-ellipsis-v"></i> </button>
<ul class="dropdown-menu">
<li>
<a href="<?php echo site_url('home/course/'.slugify($course['title']).'/'.$course['id']); ?>" target="_blank">
<?php echo get_phrase('view_course_on_frontend');?>
</a>
</li>
<li>
<a href="<?php echo site_url('admin/sections/'.$course['id']); ?>">
<?php echo get_phrase('manage_section');?>
</a>
</li>
<li>
<a href="<?php echo site_url('admin/lessons/'.$course['id']); ?>">
<?php echo get_phrase('manage_lesson');?>
</a>
</li>
<li>
<?php if ($course['user_id'] != $this->session->userdata('user_id')): ?>
<a href="#" onclick="showAjaxModal('<?php echo base_url();?>modal/popup/mail_on_course_status_changing_modal/pending/<?php echo $course['id'].'/'.$default_category_id.'/'.$default_sub_category_id;?>');">
<?php echo get_phrase('mark_as_pending');?>
</a>
<?php else: ?>
<a href="#" onclick="confirm_modal('<?php echo site_url();?>admin/change_course_status_for_admin/pending/<?php echo $course['id'];?>', 'generic_confirmation');">
<?php echo get_phrase('mark_as_pending');?>
</a>
<?php endif; ?>
</li>
<li>
<a href="<?php echo site_url('admin/course_form/course_edit/'.$course['id']) ?>">
<?php echo get_phrase('edit');?>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#" onclick="confirm_modal('<?php echo site_url('admin/course_actions/delete/'.$course['id']); ?>');">
<?php echo get_phrase('delete');?>
</a>
</li>
</ul>
</div>
</td>
</tr>
<?php endforeach; ?>
<?php if ($active_courses == 0): ?>
<tr>
<td colspan="7"><?php echo get_phrase('no_data_found'); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
<!--
<script type="text/javascript">
var responsiveHelper;
var breakpointDefinition = {
tablet: 1024,
phone : 480
};
var tableContainer;
jQuery(document).ready(function($)
{
tableContainer = $("#active_courses_table");
tableContainer.dataTable({
"sPaginationType": "bootstrap",
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"bStateSave": true,
// Responsive Settings
bAutoWidth : false,
fnPreDrawCallback: function () {
// Initialize the responsive datatables helper once.
if (!responsiveHelper) {
responsiveHelper = new ResponsiveDatatablesHelper(tableContainer, breakpointDefinition);
}
},
fnRowCallback : function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
responsiveHelper.createExpandIcon(nRow);
},
fnDrawCallback : function (oSettings) {
responsiveHelper.respond();
}
});
$(".dataTables_wrapper select").select2({
minimumResultsForSearch: -1
});
});
</script> -->