| Server IP : 188.114.96.2 / Your IP : 104.23.243.201 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/git/sms.edl.codes.solutions/application/views/nsdt/ |
Upload File : |
<hr />
<script type="text/javascript">
var teachers = {
'dataTable':{}
,'config':{
'tabsList':'tabs'
,'dataTable':{
'dataID':'table_export'
,'columns':[{'sortable':false},{'name':'name','sorted':'asc'},{'name':'email'},{'sortable':false}]
,'URL':'<?php echo NS_BASE_URL; ?>teacher/filtered'
,'parser':function(e){
var template=document.querySelector('#teacherActionTemplate').innerHTML;
return [
e['teacher_id']
,'<a target="_blank" href="<?php echo NS_BASE_URL; ?>teacher/view/'+e['teacher_id']+'">'+e['name']+'</a>'
,e['email']
,template.replace(/_X_/g,e['teacher_id'])
];
}
}
}
,'load': function (clickNeeded) {
var _this=this;
_this.reset();
//if (clickNeeded){
//document.querySelectorAll('ul.nav-tabs a')[0].click();
//}
if (document.querySelector('#'+_this.config.dataTable.dataID).dataset['datatable']!='true'){
_this.dataTable=jQuery('#'+_this.config.dataTable.dataID).DataTable({
"processing": true
,"serverSide": true
,'columns':_this.config.dataTable.columns
,'ajax':function (data, callback, settings) {
var callback=callback,data=data;
_NS.post(_this.config.dataTable.URL,JSON.stringify(data),{
'success':function(reply){
var e=0,finalData={'data':[]};
finalData['recordsTotal']=reply.data['total'];
finalData['recordsFiltered']=reply.data['filtered'];
reply.data.entries.forEach(function(e){
finalData.data.push(_this.config.dataTable.parser(e));
});
callback(finalData);
}
},1);
}
});
document.querySelector('#'+_this.config.dataTable.dataID).dataset['datatable']='true';
}
else {
_this.dataTable.ajax.reload();
}
}
,'remove':function(ID){
_this=this;
_NS.runRequest('POST','<?php echo NS_BASE_URL; ?>teacher/remove','teacher_id='+ID,{
'success':function(reply){
jQuery('#removalConfirmation').modal('hide');
document.querySelectorAll('ul.nav-tabs a')[0].click();
}
},1);
}
};
</script>
<div class="row">
<div class="col-md-12">
<!------CONTROL TABS START------>
<ul id="tabs" class="nav nav-tabs bordered">
<li class="active">
<a href="#list" data-toggle="tab" onclick="teachers.load();"><i class="entypo-menu"></i>
<?php echo get_phrase('teacher_list'); ?>
</a></li>
<li class="edit">
<a href="#save" data-toggle="tab">
<span class="add"><i class="entypo-plus-circled add"></i>
<?php echo get_phrase('add_teacher'); ?></span>
<span class="edit hidden"><i class="entypo-pencil edit"></i>
<?php echo get_phrase('edit_teacher'); ?></span>
</a></li>
</ul>
<!------CONTROL TABS END------>
<div class="tab-content">
<br>
<!----TABLE LISTING STARTS-->
<div class="tab-pane box active" id="list">
<table class="table table-bordered datatable" id="table_export">
<thead>
<tr>
<th width="80"><div>#</div></th>
<th><div><?php echo get_phrase('name');?></div></th>
<th><div><?php echo get_phrase('email');?></div></th>
<th><div><?php echo get_phrase('options');?></div></th>
</tr>
</thead>
</table>
</div>
<!----TABLE LISTING ENDS--->
<!----FORM STARTS---->
<div class="tab-pane box" id="save" style="padding: 5px">
<div class="box-content">
<?php include(APPPATH.'views/teacher/form.php'); ?>
</div>
</div>
<!----CREATION FORM ENDS-->
<div style="display:none;" id="teacherActionTemplate">
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-default pull-right" role="menu">
<!-- EDITING LINK -->
<li>
<a onclick="teachers.edit(_X_);">
<i class="entypo-pencil"></i><?php echo get_phrase('edit'); ?>
</a>
</li>
<li class="divider"></li>
<!-- DELETION LINK -->
<li>
<a onclick="confirmRemoval('teachers.remove(_X_);');">
<i class="entypo-trash"></i><?php echo get_phrase('delete'); ?>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!----- DATA TABLE EXPORT CONFIGURATIONS ---->
<script type="text/javascript">
<?php /** / ?>
var teachers = {
'dataTable':{}
,'config.dataTable':{
'dataID':'table_export'
,'columns':[{'sortable':false},{'name':'name','sorted':'asc'},{'name':'email'},{'sortable':false}]
,'URL':'<?php echo NS_BASE_URL; ?>teacher/filtered'
,'parser':function(e){
var template=document.querySelector('#teacherActionTemplate').innerHTML;
return [
e['teacher_id']
,'<a target="_blank" href="<?php echo NS_BASE_URL; ?>teacher/view/'+e['teacher_id']+'">'+e['name']+'</a>'
,e['email']
,template.replace(/_X_/g,e['teacher_id'])
];
}
}
,'load': function (clickNeeded) {
var _this=this;
_this.reset();
//if (clickNeeded){
//document.querySelectorAll('ul.nav-tabs a')[0].click();
//}
if (document.querySelector('#'+_this.config.dataTable.dataID).dataset['datatable']!='true'){
_this.dataTable=jQuery('#'+_this.config.dataTable.dataID).DataTable({
"processing": true
,"serverSide": true
,'columns':_this.config.dataTable.columns
,'ajax':function (data, callback, settings) {
var callback=callback,data=data;
_NS.post(_this.config.dataTable.URL,JSON.stringify(data),{
'success':function(reply){
var e=0,finalData={'data':[]};
finalData['recordsTotal']=reply.data['total'];
finalData['recordsFiltered']=reply.data['filtered'];
reply.data.entries.forEach(function(e){
finalData.data.push(_this.config.dataTable.parser(e));
});
callback(finalData);
}
},1);
}
});
document.querySelector('#'+_this.config.dataTable.dataID).dataset['datatable']='true';
}
else {
_this.dataTable.ajax.reload();
}
}
,'reset':function (){
var _this=this, timestamp=(new Date()).getTime();
$('ul.nav-tabs li.edit .edit').addClass('hidden');
$('ul.nav-tabs li.edit .add').removeClass('hidden');
_NS.DOM.enable('#teacherForm .disabled');
_this.updatePhoto();
_NS.resetFields('#teacherForm');
addresses.load('#teacherForm','address');
document.querySelector('#teacherForm input[name="photo_file"]').dataset['hash']='photo_file_hash_'+timestamp;
document.querySelector('#teacherForm input[name="photo_file_hash"]').value=timestamp;
document.querySelector('#teacherForm input[name="cv_file"]').dataset['hash']='cv_file_hash_'+timestamp;
document.querySelector('#teacherForm input[name="cv_file_hash"]').value=timestamp;
document.querySelector('#teacherForm .teacherCVFiles').innerHTML='';
}
,'updatePhoto':function(data){
var base=document.querySelector('base').href;
document.querySelector('#teacherForm .photo img').src='<?php echo NS_BASE_URL; ?>'+((data!=null)?('uploads/'+data.folder+'/'+data.name):'assets/images/admin.png');
}
,'uploadPhoto':function(){
_NS.upload(document.querySelector('#<?php echo $photoFile; ?>'),teachers.updatePhoto);
}
,'appendCVFile':function(data){
var base=document.querySelector('base').href;
document.querySelector('#teacherForm .teacherCVFiles').insertAdjacentHTML('beforeend',document.querySelector('#teacherForm .teacherCVFileTemplate').innerHTML.replace(/_X_/g,data['file_id']).replace('_NAME_',data['name']).replace('_URL_',base+'uploads/'+data.folder+'/'+data.name));
//console.log('appernd CV file:');
//console.dir(data);
}
,'uploadCVFile':function(){
_NS.upload(document.querySelector('#<?php echo $CVFile; ?>'),teachers.appendCVFile);
}
,'edit': function (ID){
var _this=this;
_NS.runRequest('POST','<?php echo base_url(); ?>teacher/edit','teacher_id='+ID,{
'success':function(reply){
_NS.fillFields('#teacherForm',reply.data);
reply.data['cv_files'].forEach(function(f){
_this.appendCVFile(f);
});
_this.updatePhoto(reply.data.photo);
$('ul.nav-tabs li.edit .add').addClass('hidden');
$('ul.nav-tabs li.edit .edit').removeClass('hidden');
_NS.DOM.disable('#teacherForm input[name="email"]');
document.querySelectorAll('ul.nav-tabs a')[1].click();
if (typeof(reply.data['address'])!='undefined'){
addresses.load('#teacherForm','address',reply.data['address']);
}
}
},1);
}
, 'save': function () {
var _this=this,params=_NS.getFormData('#teacherForm');
_NS.post('<?php echo base_url(); ?>teacher/save',params,{
'success':function(reply){
document.querySelectorAll('ul.nav-tabs a')[0].click();
}
},1);
}
,'remove':function(ID){
_this=this;
_NS.runRequest('POST','<?php echo base_url(); ?>teacher/remove','teacher_id='+ID,{
'success':function(reply){
jQuery('#removalConfirmation').modal('hide');
document.querySelectorAll('ul.nav-tabs a')[0].click();
}
},1);
}
};
<?php /**/ ?>
<?php if ($this->userInfo['role']=='teacher'){ echo 'teachers.edit('.$this->userInfo['user_id'].');'; } else { ?>
teachers.load();
jQuery(document).ready(function ($) {
$(".dataTables_wrapper select").select2({
minimumResultsForSearch: -1
});
});
<?php } ?>
</script>
<?php /** / ?>
<a href="javascript:;" onclick="showAjaxModal('<?php echo base_url();?>index.php?modal/popup/modal_teacher_add/');"
class="btn btn-primary pull-right">
<i class="entypo-plus-circled"></i>
<?php echo get_phrase('add_new_teacher');?>
</a>
<br><br>
<table class="table table-bordered datatable" id="table_export">
<thead>
<tr>
<th width="80"><div><?php echo get_phrase('photo');?></div></th>
<th><div><?php echo get_phrase('name');?></div></th>
<th><div><?php echo get_phrase('email');?></div></th>
<th><div><?php echo get_phrase('options');?></div></th>
</tr>
</thead>
<tbody>
<?php
$teachers = $this->db->get('teacher' )->result_array();
foreach($teachers as $row):?>
<tr>
<td><img src="<?php echo $this->crud_model->get_image_url('teacher',$row['teacher_id']);?>" class="img-circle" width="30" /></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['email'];?></td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-default pull-right" role="menu">
<!-- teacher EDITING LINK -->
<li>
<a href="#" onclick="showAjaxModal('<?php echo base_url();?>index.php?modal/popup/modal_teacher_edit/<?php echo $row['teacher_id'];?>');">
<i class="entypo-pencil"></i>
<?php echo get_phrase('edit');?>
</a>
</li>
<li class="divider"></li>
<!-- teacher DELETION LINK -->
<li>
<a href="#" onclick="confirm_modal('<?php echo base_url();?>index.php?admin/teacher/delete/<?php echo $row['teacher_id'];?>');">
<i class="entypo-trash"></i>
<?php echo get_phrase('delete');?>
</a>
</li>
</ul>
</div>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!----- DATA TABLE EXPORT CONFIGURATIONS ---->
<script type="text/javascript">
jQuery(document).ready(function($)
{
var datatable = $("#table_export").dataTable({
"sPaginationType": "bootstrap",
"sDom": "<'row'<'col-xs-3 col-left'l><'col-xs-9 col-right'<'export-data'T>f>r>t<'row'<'col-xs-3 col-left'i><'col-xs-9 col-right'p>>",
"oTableTools": {
"aButtons": [
{
"sExtends": "xls",
"mColumns": [1,2]
},
{
"sExtends": "pdf",
"mColumns": [1,2]
},
{
"sExtends": "print",
"fnSetText" : "Press 'esc' to return",
"fnClick": function (nButton, oConfig) {
datatable.fnSetColumnVis(0, false);
datatable.fnSetColumnVis(3, false);
this.fnPrint( true, oConfig );
window.print();
$(window).keyup(function(e) {
if (e.which == 27) {
datatable.fnSetColumnVis(0, true);
datatable.fnSetColumnVis(3, true);
}
});
},
},
]
},
});
$(".dataTables_wrapper select").select2({
minimumResultsForSearch: -1
});
});
</script>
<?php /**/ ?>