EVOLUTION-NINJA
Edit File: material_list.php
<?php echo view('includes/admin_header.php') ?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <!--<link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/website_assets/css/innerpage.css'); ?>"/>--> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/jqgrid/css/ui.jqgrid-bootstrap-ui.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('public/assets/datatables/jquery.dataTables.css'); ?>"> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('public/assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script src="<?php echo base_url('public/assets/sweet_alert/sweet-alert.js'); ?>"></script> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1 style="padding-bottom:10px;border-bottom:2px dashed #468662;margin-bottom:20px; font-weight: bold;"> FACULTY CONTENTS LIST <small></small> </h1> </section> <!-- Main content --> <a href="javascript:history.back()" class="btn btn-primary" style="float:right; margin-right:15px;">Back</a> <!-- Button trigger modal --> <section class="content"> <div id="" class="table-responsive"> <div id="jaytab" style="margin-top:3%" class="grid table-responsive"> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </section> <div class="modal fade" id="session_return" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Comment</h4> </div> <div class="modal-body"> <form id="session_return_comment" class="comment_form"> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-12"> <label class="col-sm-4">Comment</label> <input type="hidden" name="training_plan_id" class="training_plan_id"> <textarea row="3" cols="40" name="return_comment" required="required" style="border-radius: 5px;"></textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Comment</h4> </div> <div class="modal-body"> <form id="add_comment" class="comment_form"> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-12"> <label class="col-sm-4">Comment</label> <input type="hidden" name="faculty_id" class="faculty_id"> <input type="hidden" name="faculty_ids" class="faculty_ids"> <textarea row="3" cols="40" name="comment" required="required" style="border-radius: 5px;"></textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="uploads_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close close_material" data-dismiss="modal">×</button> <h4 class="modal-title">Content Uploads</h4> </div> <div class="modal-body"> <ul class="nav nav-pills" style="background:white; padding:15px;"> <li class="active"><a data-toggle="pill" href="#video">Video File</a></li> <li><a data-toggle="pill" href="#pdf">PDF File</a></li> <li><a data-toggle="pill" href="#images">Images</a></li> <!--<li><a data-toggle="pill" href="#questions" onclick="CallQuestionGrid()">Question Bank</a></li>--> </ul> <div class="tab-content" style="background:white; padding:15px;"> <div id="video" class="tab-pane fade in active"> <div class="row" id="video_uploads_div"> </div><!-- row ----> </div><!-- video ----> <div id="pdf" class="tab-pane fade"> <div class="row" id="pdf_uploads_div"> </div><!-- row ----> </div><!-- pdf ----> <div id="images" class="tab-pane fade"> <div class="row" id="image_uploads_div"> </div><!-- row ----> </div><!-- images ----> <input type="hidden" id="faculty_id" /> <input type="hidden" id="chapter_id" /> <!--<div id="questions" class="tab-pane fade"> <div class="row" id="question_uploads_div"> <div id="" class="table-responsive"> <div id ="questiontab" style="margin-top:3%" class="grid table-responsive"> <table id="list3"></table> <div id="pager3"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div><!-- row ----> </div><!-- images ----> </div> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="sessions_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Session Details</h4> </div> <div class="modal-body"> <div class="row table-responsive" style="margin:0 !important;"> <table class="table table-bordered list_table" border="1"> <thead> <tr> <th scope="col">#</th> <th scope="col">Subject</th> <th scope="col">Chapters</th> <th scope="col">Session Time</th> <th scope="col">Status</th> </tr> </thead> <tbody id="course_tbody"> </tbody> </table> </div><!-- row1 ----> </div> </div> </div> </div> </div> <!--- col-sm-8 --> <!-- Modal --> <div id="questions_data" class="modal fade" role="dialog"> <div class="modal-dialog" style="width: 80%; margin: 30px auto;"> <!-- Modal content--> <div class="modal-content" style="border-radius: 10px;"> <div class="modal-header"> <h4 class="modal-title">Questions</h4> </div> <div class="modal-body"> <input type="hidden" id="faculty_id1" /> <input type="hidden" id="chapter_id1" /> <div class="table1 table-responsive"> <table class="table table-striped table-hover list_table" id="myTable"> <thead> <tr> <th>SI</th> <th>Chapter Name</th> <th>Question</th> <th>Number Of Options</th> <th>Option 1</th> <th>Option 2</th> <th>Option 3</th> <th>Option 4</th> <th>Correct Answer</th> <th>Explanation</th> </tr> </thead> <tbody id="table_body"> </tbody> </table> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default close_questions" data-dismiss="modal">Close</button> </div> </div> </div> </div> <script src="<?php echo base_url('public/assets/datatables/jquery.dataTables.js'); ?>"></script> <script type="text/javascript"> $(document).ready(function() { CallGrid(); //CallQuestionGrid(); // function CallGrid(access_rights_global,access_result_global) // { // jQuery("#list2").jqGrid({ // url:"<?php //echo site_url('get_material_list_admin') ?>", // mtype : "get", // datatype: "json", // colNames:['mapping_id','login_id','sub_domain_id','Faculty Name','Category','Subjects','Training Plan'], // colModel:[ // {name:'mapping_id',index:'mapping_id', width:10, hidden:true,editable:false}, // {name:'login_id',index:'login_id', width:10, hidden:true,editable:false}, // {name:'sub_domain_id',index:'sub_domain_id', width:10, hidden:true,editable:false}, // {name:'username',index:'username',editable:false, width:8}, // {name:'domain_name',index:'domain_name',editable:false, width:10}, // {name:'subjects',index:'subjects',editable:false, width:20}, // {name:'',index:'', // width:20, search:false,editable:false,formatter: function (cellvalue, options, rowObject) { // var retVal = ""; // var retVal = '<b><a onclick="call_sessions('+rowObject.sub_domain_id+','+rowObject.login_id+')"; href="javascript:void(0);">View Training Plan</a></b>'; // return retVal; // }}, // ], // rowNum:20, // rowTotal: 2000, // rowList : [20,30], // rownumbers: true, // rownumWidth: 60, // pager:"#pager2", // sortname:'id', // viewrecords: true, // gridview: true, // autowidth: true, // sortorder:"asc", // shrinkToFit: true, // loadonce:true, // caption:"Material List", // subGrid: true, // subGridRowExpanded: function(subgrid_id, row_id) { // var sub_domain_ids = $('#list2').jqGrid('getCell',row_id,'sub_domain_id'); // var login_ids = $('#list2').jqGrid('getCell',row_id,'login_id'); // var subgrid_table_id; // var subgrid_table_id2; // subgrid_table_id = subgrid_id+"_t"; // subgrid_table_id2 = subgrid_id+"_t2"; // jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); // // CallQuestionGrid(row_id); // jQuery("#"+subgrid_table_id).jqGrid({ // url:"<?php //echo site_url('get_material_details_admin'); ?>/"+login_ids+'/'+sub_domain_ids, // datatype: "json", // colNames: ['SI','faculty','chapter_id','Chapter','Questions','Approval Status','Action'], // colModel: [ // {name:'material_id',index:'material_id', width:50, hidden:true,editable:false,key:true}, // {name:'created_by',index:'created_by',hidden:true,editable:false, width:50}, // {name:'chapter_id',index:'chapter_id',hidden:true,editable:false, width:50}, // {name:'chapter_name',index:'chapter_name',editable:false, width:50}, // {name:'',index:'', // width:30, editable:false,formatter: function (cellvalue, options, rowObject) { // var retVal = ""; // var retVal = '<a onclick="call_question_uploads('+rowObject.material_id+','+rowObject.created_by+','+rowObject.chapter_id+')"; href="javascript:void(0);">Download</a>'; // return retVal; // }}, // {name:'approval_status',index:'approval_status', // width:50, editable:false,formatter: function (cellvalue, options, rowObject) { // if(rowObject.approval_status=='APPROVED'){ // var retVal = ''; // if(rowObject.return_status == 'NOT_RETURNED'){ // retVal +='<b>APPROVED/</b><input type="button" id="sub_approve'+rowObject.chapter_id+'" value="Return" onclick="fun_return('+rowObject.chapter_id+','+rowObject.created_by+')"; />'; // } // return retVal; // } // else // { // var retVal = ''; // if(rowObject.return_status == 'NOT_RETURNED'){ // retVal +='<input type="button" value="Approve" id="sub_approve'+rowObject.chapter_id+'" onclick="fun_approve('+rowObject.chapter_id+','+rowObject.created_by+')"; /><b>/</b><input type="button" value="Return" onclick="fun_return('+rowObject.material_id+')"; />'; // } // else // { // retVal +='<input type="button" value="Approve" id="sub_approve'+rowObject.chapter_id+'" onclick="fun_approve('+rowObject.chapter_id+','+rowObject.created_by+')"; /><b>/ RETURNED</b>'; // } // return retVal; // } // }}, // {name:'',index:'', // width:15, editable:false,formatter: function (cellvalue, options, rowObject) { // var retVal = ""; // var retVal = '<a data-toggle="tooltip" title="Delete" onclick="fun_del('+rowObject.material_id+','+'\''+subgrid_id+'\')"; class="delete" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; // return retVal; // }}, // ], // subGrid: true, // subGridRowExpanded: function(subgrid_id, row_id) { // var sub_domain_ids = $('#list2').jqGrid('getCell',row_id,'sub_domain_id'); // var login_ids = $('#list2').jqGrid('getCell',row_id,'login_id'); // var subgrid_table_id; // var subgrid_table_id2; // subgrid_table_id = subgrid_id+"_t"; // subgrid_table_id2 = subgrid_id+"_t2"; // jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); // // CallQuestionGrid(row_id); // jQuery("#"+subgrid_table_id).jqGrid({ // url:"<?php //echo site_url('get_material_details_admin'); ?>/"+login_ids+'/'+sub_domain_ids, // datatype: "json", // colNames: ['SI','faculty','chapter_id','Chapter','Questions','Approval Status','Action'], // colModel: [ // {name:'material_id',index:'material_id', width:50, hidden:true,editable:false,key:true}, // {name:'created_by',index:'created_by',hidden:true,editable:false, width:50}, // {name:'chapter_id',index:'chapter_id',hidden:true,editable:false, width:50}, // {name:'chapter_name',index:'chapter_name',editable:false, width:50}, // {name:'',index:'', // width:30, editable:false,formatter: function (cellvalue, options, rowObject) { // var retVal = ""; // var retVal = '<a onclick="call_question_uploads('+rowObject.material_id+','+rowObject.created_by+','+rowObject.chapter_id+')"; href="javascript:void(0);">Download</a>'; // return retVal; // }}, // {name:'approval_status',index:'approval_status', // width:50, editable:false,formatter: function (cellvalue, options, rowObject) { // if(rowObject.approval_status=='APPROVED'){ // var retVal = ''; // if(rowObject.return_status == 'NOT_RETURNED'){ // retVal +='<b>APPROVED/</b><input type="button" id="sub_approve'+rowObject.chapter_id+'" value="Return" onclick="fun_return('+rowObject.chapter_id+','+rowObject.created_by+')"; />'; // } // return retVal; // } // else // { // var retVal = ''; // if(rowObject.return_status == 'NOT_RETURNED'){ // retVal +='<input type="button" value="Approve" id="sub_approve'+rowObject.chapter_id+'" onclick="fun_approve('+rowObject.chapter_id+','+rowObject.created_by+')"; /><b>/</b><input type="button" value="Return" onclick="fun_return('+rowObject.material_id+')"; />'; // } // else // { // retVal +='<input type="button" value="Approve" id="sub_approve'+rowObject.chapter_id+'" onclick="fun_approve('+rowObject.chapter_id+','+rowObject.created_by+')"; /><b>/ RETURNED</b>'; // } // return retVal; // } // }}, // {name:'',index:'', // width:15, editable:false,formatter: function (cellvalue, options, rowObject) { // var retVal = ""; // var retVal = '<a data-toggle="tooltip" title="Delete" onclick="fun_del('+rowObject.material_id+','+'\''+subgrid_id+'\')"; class="delete" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; // return retVal; // }}, // ], // }).navGrid('#'+subgrid_table_id+'', { edit: false, add: false, del: false, search:false }); // // CallQuestionGrid(row_id); // } // }); // $("#list2").jqGrid("setLabel", "rn", "SL"); // $("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required // $("#list2").jqGrid('navGrid','#pager2', // {edit:false,add:false,del:false,search:false,refreshstate:"current"}, // { }, // { }, // { }, // { // sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], // closeOnEscape: true, // multipleSearch: true, // closeAfterSearch: true, // closeAfterDelete:true, // closeAfterEdit:true // }, // ); // } function CallGrid(access_rights_global, access_result_global) { jQuery("#list2").jqGrid({ url: "<?php echo site_url('get_material_list_admin') ?>", mtype: "get", datatype: "json", colNames: ['login_id', 'sub_domain_id', 'chapter_id', 'Faculty Name', 'Category', 'Subjects', 'Duration', 'Training Plan'], colModel: [ //{name:'mapping_id',index:'mapping_id', width:100, hidden:true,editable:false}, { name: 'login_id', index: 'login_id', width: 100, hidden: true, editable: false }, { name: 'sub_domain_id', index: 'sub_domain_id', width: 100, hidden: true, editable: false }, { name: 'chapter_id', index: 'chapter_id', width: 100, hidden: true, editable: false }, { name: 'username', index: 'username', editable: false, width: 80 }, { name: 'domain_name', index: 'domain_name', editable: false, width: 100 }, { name: 'sub_domain', index: 'sub_domain', editable: false, width: 200 }, { name: 'total_duration', index: 'total_duration', editable: false, width: 200 }, { name: '', index: '', width: 200, search: false, editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; var retVal = '<b><a onclick="call_sessions(' + rowObject.sub_domain_id + ',' + rowObject.login_id + ')"; href="javascript:void(0);">View Training Plan</a></b>'; return retVal; } }, ], rowNum: 20, rowTotal: 2000, rowList: [20, 30], rownumbers: true, //rownumWidth: 60, pager: "#pager2", sortname: 'id', viewrecords: true, gridview: true, autowidth: true, sortorder: "asc", shrinkToFit: true, loadonce: true, autoencode: true, caption: "Content List", //Subgrid1... subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var sub_domain_ids = $('#list2').jqGrid('getCell', row_id, 'sub_domain_id'); var login_ids = $('#list2').jqGrid('getCell', row_id, 'login_id'); var subgrid_table_id; subgrid_table_id = subgrid_id + "_t"; jQuery("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table>"); jQuery("#" + subgrid_table_id).jqGrid({ url: "<?php echo site_url('get_material_details_admin'); ?>/" + login_ids + '/' + sub_domain_ids, datatype: "json", colNames: ['SI', 'login_id', 'sub_domain_id', 'faculty', 'chapter_id', 'Action', 'Chapter', 'Questions', 'Approval Status'], colModel: [{ name: 'material_id', index: 'material_id', width: 100, hidden: true, editable: false }, { name: 'login_id', index: 'login_id', width: 100, hidden: true, editable: false }, { name: 'sub_domain_id', index: 'sub_domain_id', width: 100, hidden: true, editable: false }, { name: 'created_by', index: 'created_by', hidden: true, editable: false, width: 100 }, { name: 'chapter_id', index: 'chapter_id', width: 100, hidden: true, editable: false }, { name: '', index: '', align: "center", width: 50, editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; //var retVal = '<a data-toggle="tooltip" title="Delete" onclick="fun_del('+rowObject.material_id+','+'\''+subgrid_id+'\')"; class="delete" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; var retVal = ' <a data-toggle="tooltip" title="Delete" class="delete" onclick="fun_del(' + rowObject.chapter_id + ')"; class="delete' + rowObject.chapter_id + '" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; return retVal; } }, { name: 'chapter_name', index: 'chapter_name', editable: false, width: 150 }, /* {name:'',index:'', width:100, editable:false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; var retVal = '<a onclick="call_question_uploads('+rowObject.material_id+','+rowObject.created_by+','+rowObject.chapter_id+')"; href="javascript:void(0);">Download</a>'; return retVal; }},*/ { name: '', index: '', width: 100, align: "center", editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; var retVal = '<input type="button" value="View Questions" onclick="CallQuestionGrid(' + rowObject.material_id + ',' + rowObject.created_by + ',' + rowObject.chapter_id + ')";></button>'; return retVal; } }, { name: 'approval_status', index: 'approval_status', align: "center", width: 120, editable: false, formatter: function(cellvalue, options, rowObject) { if (rowObject.approval_status == 'APPROVED') { var retVal = ''; if (rowObject.return_status == 'NOT_RETURNED') { retVal += '<b>APPROVED/</b><input type="button" id="sub_approve' + rowObject.chapter_id + '" value="Return" onclick="fun_return(' + rowObject.chapter_id + ',' + rowObject.created_by + ')"; />'; } return retVal; } else { var retVal = ''; if (rowObject.return_status == 'NOT_RETURNED') { retVal += '<input type="button" value="Approve" id="sub_approve' + rowObject.chapter_id + '" onclick="fun_approve(' + rowObject.chapter_id + ',' + rowObject.created_by + ')"; /><b>/</b><input type="button" value="Return" onclick="fun_return(' + rowObject.material_id + ')"; />'; } else { retVal += '<input type="button" value="Approve" id="sub_approve' + rowObject.chapter_id + '" onclick="fun_approve(' + rowObject.chapter_id + ',' + rowObject.created_by + ')"; /><b>/ RETURNED</b>'; } return retVal; } } }, /* {name:'',index:'', align: "center", width:50, editable:false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; //var retVal = '<a data-toggle="tooltip" title="Delete" onclick="fun_del('+rowObject.material_id+','+'\''+subgrid_id+'\')"; class="delete" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; var retVal = '<a data-toggle="tooltip" title="Delete" onclick="fun_del('+rowObject.chapter_id+','+rowObject.login_id+')"; class="delete'+chapter_id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; return retVal; }},*/ ], sortname: 'id', viewrecords: true, gridview: true, autowidth: true, sortorder: "asc", //shrinkToFit: true, loadonce: true, subGrid: true, autoencode: true, subGridRowExpanded: function(subgrid_idss, row_ids) { var subgrid_table_id2; subgrid_table_id2 = subgrid_idss + "_t2"; jQuery("#" + subgrid_idss).html("<table id='" + subgrid_table_id2 + "' class='scroll'></table>"); var sub_domain_id = $(this).jqGrid('getCell', row_ids, 'sub_domain_id'); var login_id = $(this).jqGrid('getCell', row_ids, 'login_id'); var chapter_id = $(this).jqGrid('getCell', row_ids, 'chapter_id'); jQuery("#" + subgrid_table_id2).jqGrid({ url: "<?php echo site_url('get_topic_material_details_admin'); ?>/" + login_id + '/' + sub_domain_id + '/' + chapter_id, datatype: "json", colNames: ['SI', 'faculty', 'Topic', 'Added Date', 'Contents'], colModel: [{ name: 'material_id', index: 'material_id', width: 150, hidden: true, editable: false }, { name: 'created_by', index: 'created_by', hidden: true, editable: false, width: 150 }, { name: 'topic_name', index: 'topic_name', editable: false, width: 20 }, { name: "created_at", index: "created_at", formatter: 'date', width: 20, formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'd-m-Y H:i:s' } }, { name: '', index: '', align: "center", width: 20, editable: false, formatter: function(cellvalue, options, rowObject) { var retVal = ""; var retVal = '<input type="button" value="View Contents" onclick="call_uploads(' + rowObject.material_id + ',' + rowObject.created_by + ',' + rowObject.chapter_id + ')";></button>'; return retVal; } }, ], sortname: 'id', viewrecords: true, gridview: true, autowidth: true, sortorder: "asc", shrinkToFit: true, loadonce: true, autoencode: true, }); } }); } }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar', { searchOperators: false }); //for multisearch code,remove if not required $("#list2").jqGrid('navGrid', '#pager2', { edit: false, add: false, del: false, search: false, refreshstate: "current" }, {}, {}, {}, { sopt: ['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete: true, closeAfterEdit: true }, ); } }); $('.ui-sghref').click(function(e) { toggleSubgrid(); }) function toggleSubgrid() { alert(); if ($('#subgrid_id td').hasClass('sgexpanded')) { $('.ui-icon-minus').trigger('click'); } else if ($('#subgrid_id td').hasClass('sgcollapsed')) { $('.ui-icon-plus').trigger('click'); } } function call_uploads(material_id, faculty_id, chapter_id) { //CallQuestionGrid(faculty_id,chapter_id); var material_id = material_id; //$('#questions').empty(); $("#faculty_id").val(faculty_id); $("#chapter_id").val(chapter_id); $.ajax({ type: 'post', url: "<?php echo site_url('get_where_material_details_admin'); ?>", data: { 'material_id': material_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var video_fields = ''; var pdf_fields = ''; var image_fields = ''; if (response.message.video != "") { var videos = jQuery.parseJSON(response.message.video); $.each(videos, function(key, val) { video_fields += '<div class="col-sm-4 video">'; //video_fields += '<iframe class="embed-responsive-item" width="100%" height="250" src="<?php echo base_url('subject_videos'); ?>/'+val+'" allowfullscreen></iframe>'; video_fields += '<video width="300%" height="350" controls>'; video_fields += '<source src="<?php echo base_url('subject_videos'); ?>/' + val + '" type="video/mp4">'; video_fields += '</video>'; video_fields += '</div>'; video_fields += '<div class="col-sm-12 video_content">'; video_fields += '<p style="text-align:center"><b>Content Name:</b> ' + val.substr(10) + '<br><b>Subject Name:</b> ' + response.message.sub_domain + '<br><b>Added Date:</b>' + response.created_at; if (response.message.return_status == 'RETURNED') { video_fields += '<br><b>Approval Status:</b> ' + response.message.return_status + '</p>'; } else { video_fields += '<br><b>Approval Status:</b> ' + response.message.approval_status + '</p>'; } video_fields += '</div>'; }); } else { video_fields += '<div class="col-sm-4 video">'; video_fields += '<p>No video available</p>'; video_fields += '</div>'; } if (response.message.pdf != "") { var pdf = jQuery.parseJSON(response.message.pdf); $.each(pdf, function(key, val) { pdf_fields += '<div class="col-sm-4 pdf_file">'; pdf_fields += '<a href="<?php echo base_url('subject_pdf'); ?>/' + val + '" target="_blank" ><img src="<?php echo base_url('public/assets/images/pdf_file.png'); ?>" class="img-responsive center-block"></a>'; pdf_fields += '<p style="text-align:center"><b>Content Name:</b> ' + val.substr(10) + '<br><b>Subject Name:</b> ' + response.message.sub_domain + '<br><b>Added Date:</b>' + response.created_at; if (response.message.return_status == 'RETURNED') { pdf_fields += '<br><b>Approval Status:</b> ' + response.message.return_status + '</p>'; } else { pdf_fields += '<br><b>Approval Status:</b> ' + response.message.approval_status + '</p>'; } pdf_fields += '</div>'; }); } else { pdf_fields += '<div class="col-sm-4 video">'; pdf_fields += '<p>No pdf available</p>'; pdf_fields += '</div>'; } if (response.message.image != "") { var image = jQuery.parseJSON(response.message.image); $.each(image, function(key, val) { image_fields += '<div class="col-sm-4 images_file">'; image_fields += '<a href="<?php echo base_url('subject_images'); ?>/' + val + '" target="_blank" ><img src="<?php echo base_url('subject_images'); ?>/' + val + '" class="img-responsive center-block"></a>'; image_fields += '<p style="text-align:center"><b>Content Name:</b> ' + val.substr(10) + '<br><b>Subject Name:</b> ' + response.message.sub_domain + '<br><b>Added Date:</b>' + response.created_at; if (response.message.return_status == 'RETURNED') { image_fields += '<br><b>Approval Status:</b> ' + response.message.return_status + '</p>'; } else { image_fields += '<br><b>Approval Status:</b> ' + response.message.approval_status + '</p>'; } image_fields += '</div>'; }); } else { image_fields += '<div class="col-sm-4 video">'; image_fields += '<p>No image available</p>'; image_fields += '</div>'; } $("#video_uploads_div").html(video_fields); $("#pdf_uploads_div").html(pdf_fields); $("#image_uploads_div").html(image_fields); $("#uploads_modal").modal('show'); } else { } } }); } function CallQuestionGrid(material_id, faculty_id, chapter_id) { var faculty_ids = faculty_id; var chapter_ids = chapter_id; /* $("#faculty_id1").val(faculty_id); $("#chapter_id1").val(chapter_id); */ //var faculty_id=$("#faculty_id").val(); //var chapter_id=$("#chapter_id").val(); $.ajax({ type: "POST", url: "<?php echo site_url('question_details') ?>", data: { 'id': faculty_ids, 'chapter_id': chapter_ids }, success: function(response) { // var res = jQuery.parseJSON(response); console.log(response); var content = ''; if (response.result == 1) { var i = 1; $.each(response.data_result, function(idx, vx) { content += '<tr>'; content += '<td><pre><code>' + i + '</code></pre></td>'; content += '<td><pre><code>' + vx.chapter_name + '</code></pre></td>'; content += '<td><pre><code>' + vx.questions + '</code></pre></td>'; content += '<td><pre><code>' + vx.no_of_options + '</code></pre></td>'; content += '<td><pre><code>' + vx.ans1 + '</code></pre></td>'; content += '<td><pre><code>' + vx.ans2 + '</code></pre></td>'; content += '<td><pre><code>' + vx.ans3 + '</code></pre></td>'; content += '<td><pre><code>' + vx.ans4 + '</code></pre></td>'; content += '<td><pre><code>' + vx.ans + '</code></pre></td>'; content += '<td><pre><code>' + vx.explanation + '</code></pre></td>'; content += '</tr>'; $("#table_body").html(content); i++; }); $("#questions_data").modal('show'); $('#myTable').DataTable().destroy(); $('#myTable').DataTable({ //"scrollX": true }); } else if (res.result == 0) { //alert("Date not found"); $("#table_body").empty(); } } }); } /*function fun_del(id,faculty_id) { //var subgrid_table_id = subgrid_table_id+'_t'; var type="post"; swal({ title: "Are you sure?", text: "You will not be able to recover this content!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $('.delete'+id).text('Deleting..'); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : type, url : "<?php //echo site_url('delete_subject_material'); ?>", data : {'material_id':id, 'faculty_id':faculty_id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1){ toastr["success"](response.message); //$("#"+subgrid_table_id).setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); $("#list2").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); } else{ toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }*/ function fun_del(material_id, id, faculty_id, sub_domain_id) { //var subgrid_table_id = subgrid_table_id+'_t'; var type = "post"; $.ajax({ type: type, url: "<?php echo site_url('check_test_status'); ?>", data: { 'material_id': material_id, 'faculty_id': faculty_id, sub_domain_id: sub_domain_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { //swal("Mock Test going on!", "You clicked the button!", "success") swal({ title: "Test going on!", //text: "You will not be able to recover this imaginary file!", type: "warning", }) } else if (response.result == 2) { //swal("User has been enrolled!", "You clicked the button!", "success") swal({ title: "User has been enrolled!", //text: "You will not be able to recover this imaginary file!", type: "warning", }) } else if (response.result == 3) { swal({ title: "Are you sure?", text: "You will not be able to recover this content!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.delete' + id).text('Deleting..'); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type: type, url: "<?php echo site_url('delete_subject_material'); ?>", data: { 'material_id': id, 'faculty_id': faculty_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); //$("#"+subgrid_table_id).setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } }); } function fun_approve(id, faculty_id) { $('#sub_approve' + id).text('Approving..') var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Approve!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, approve it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#sub_approve" + id).val("Approving.."); $.ajax({ type: type, url: "<?php echo site_url('approve_materials'); ?>", data: { 'id': id, 'faculty_id': faculty_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_return(id, faculty_id) { var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Return!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Return it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.faculty_id').val(id); $('.faculty_ids').val(faculty_id); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#myModal").modal("show"); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function call_sessions(id, login_id) { $.ajax({ type: 'post', url: "<?php echo site_url('get_where_subject_syllabus'); ?>", data: { 'sub_domain_id': id, 'login_id': login_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var table_fields = ""; var i = 1; var sr_no = 'Session ' + i; $.each(response.message, function(key, val) { var training_plan_id = val.training_plan_id; table_fields += '<tr>'; table_fields += '<th scope="row">' + sr_no + '</th>'; table_fields += '<td>' + val.sub_domain + '</td>'; table_fields += '<td>' + val.chapters + '</td>'; table_fields += '<td>' + val.session_time + ' Hours</td>'; if (val.approval_status == 'NOT_APPROVED') { if (val.return_status == 'NOT_RETURNED') { table_fields += '<td><button class="approve' + training_plan_id + '" onclick="fun_approve_training_plan(' + training_plan_id + ');">Approve</button><b> / </b><button class="return' + training_plan_id + '" onclick="fun_return_training_plan(' + training_plan_id + ');">Return</button></td>'; } else { table_fields += '<td><button class="approve' + training_plan_id + '" onclick="fun_approve_training_plan(' + training_plan_id + ');">Approve</button><b> / RETURNED</b></td>'; } } else { table_fields += '<td><b>APPROVED / </b><button class="return' + training_plan_id + '" onclick="fun_return_training_plan(' + training_plan_id + ');">Return</button></td>'; } table_fields += '</tr>'; i = i + 1; sr_no = 'Session ' + i; }); $("#course_tbody").html(table_fields); $("#sessions_modal").modal('show'); } else { $("#course_tbody").empty(); $("#sessions_modal").modal('show'); } } }); } $('#add_comment').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("returned_material_comment") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#myModal").modal("hide"); toastr["success"](response.message); $('.comment_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { $("#myModal").modal("hide"); toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); function question_approve(rowId) { var id = rowId.closest('tr').attr('id'); //alert(id); var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Approve!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, approve it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#sub_approve" + id).val("Approving.."); $.ajax({ type: type, url: "<?php echo site_url('approve_questions'); ?>", data: { 'id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); $("#list3").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function question_disapprove(rowId) { var id = rowId.closest('tr').attr('id'); //alert(id); var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Dispprove!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, approve it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#sub_approve" + id).val("Approving.."); $.ajax({ type: type, url: "<?php echo site_url('disapprove_questions'); ?>", data: { 'id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"](response.message); $("#list3").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_approve_training_plan(id) { swal({ title: "Are you sure?", text: "Do You Want to Approve!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Approve it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.approve' + id + '').text('Approving..'); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type: 'post', url: "<?php echo site_url('approve_training_plan'); ?>", data: { 'training_plan_id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#sessions_modal").modal('hide'); $('.approve' + id + '').text('Approve'); toastr["success"](response.message); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { $("#sessions_modal").modal('hide'); $('.approve' + id + '').text('Approve'); toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_return_training_plan(id) { var type = "post"; swal({ title: "Are you sure?", text: "Do You Want to Return!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Return it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $('.training_plan_id').val(id); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $("#sessions_modal").modal('hide'); $("#session_return").modal("show"); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('#session_return_comment').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("return_training_plan") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#session_return").modal("hide"); $("#sessions_modal").modal('hide'); toastr["success"](response.message); $('.session_return_comment')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); $("#list2").setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid'); } else { $("#session_return").modal("hide"); $("#sessions_modal").modal('hide'); toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); $('.close_questions').click(function() { //alert(); //("#list2").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); // $("#list2").trigger("reloadGrid"); location.reload(); }); function fun_edit(id, syllabus_id) { $('.edit_multiple_fields').empty(); var type = "post"; $(".chapter_id").val(id); $(".syllabus_id").val(syllabus_id); $.ajax({ type: type, url: "<?php echo site_url('edit_faculty_details'); ?>", data: { 'id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $(".sub_category").val(response.message.syllabus.sub_domain_id); var chapter = ""; var i = 0; chapter += '<div class="form-group col-xs-12 col-sm-12 col-md-12 chapter" style="margin-top:1%">'; chapter += '<label class="col-sm-3 col-xs-12">Chapter Name</label>'; chapter += '<input type="text" class="form-control col-xs-10 col-sm-7" pattern="^[^\\s]+.*$" Placeholder="Chapter Name" name="chapter_name[]" value="' + response.message.syllabus.chapter_name + '" required="required" pattern="^[^\s]+.*$">'; chapter += '</div>'; chapter += '</div>'; $('.chapter_names').html(chapter); $(".remove_fields").click(function() { $(this).closest('.chapter').remove(); var id = $(this).attr('id'); swal({ title: "Are you sure?", text: "You will not be able to recover this chapter !", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type: type, url: "<?php echo site_url('delete_chapter'); ?>", data: { 'id': id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) {} } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); $("#edit_modal").modal('show'); } else { toastr["error"](response.message); } } }); } </script> <?php echo view('includes/admin_footer') ?> <style type="text/css"> .content-wrapper{ background-image: url(public/assets/website_assets/images/banner.png); background-size:cover; } pre { background-color: transparent; border: 1px solid transparent; line-height: 1.6; text-align: justify; } #pager2_left { display: none !important; } #pager2_center { padding-left: 350px !important; } .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #FrmGrid_list2 { width: 100% !important; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color: #001a00; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 43%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; /*background:#1e7ad7 !important;*/ color: white !important; } .ui-jqgrid-bdiv { height: auto !important; } .ui-widget-overlay { z-index: 0 !important; } .ui-jqgrid-hdiv ui-state-default { cursor: default !important } ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { font-weight: bold; color: black; } @media only screen and (min-width:320px) and (max-width:640px) { #jaytab { width: 1100px !important; overflow-x: scroll !important; } .ui-jqgrid-htable { width: 900px !important; } .ui-jqgrid-bdiv { width: 900px !important; } #list2 { width: 900px !important; } #pager2 { width: 900px !important; } .subgrid-data { width: 1100px !important; overflow-x: scroll !important; } .table-responsive { border: transparent; } .ui-jqgrid { background-color: #ecf0f5; border: 1px solid #ecf0f5 !important; border-radius: 0px !important; } #myTable { overflow-x: scroll; width: 1200px; } } @media only screen and (min-width:641px) and (max-width:991px) { #jaytab { width: 1100px !important; overflow-x: scroll !important; } .ui-jqgrid-view { width: 900px !important; } .ui-jqgrid-hdiv { width: 900px !important; } .ui-jqgrid-htable { width: 900px !important; } .ui-jqgrid-bdiv { width: 900px !important; } #list2 { width: 900px !important; } #pager2 { width: 900px !important; } .subgrid-data { width: 1100px !important; overflow-x: scroll !important; } .table-responsive { border: transparent; } .ui-jqgrid { background-color: #ecf0f5; border: 1px solid #ecf0f5 !important; border-radius: 0px !important; } } /*@media only screen and (min-width:992px) and (max-width:1258px) { #jaytab { width: 1100px !important; overflow-x: scroll !important; } .ui-jqgrid ui-widget ui-widget-content ui-corner-all { //width: 900px !important; } .ui-jqgrid-view { width: 900px !important; } .ui-jqgrid-hdiv { width: 900px !important; } .ui-jqgrid-htable { width: 900px !important; } .ui-jqgrid-bdiv { width: 900px !important; } #list2 { width: 900px !important; } #pager2 { width: 900px !important; } .subgrid-data { width: 1100px !important; overflow-x: scroll !important; } .table-responsive { border: transparent; } .ui-jqgrid { background-color: #ecf0f5; border: 1px solid #ecf0f5 !important; border-radius: 0px !important; } }*/ .table-bordered>thead>tr>th, .table-bordered>tbody>tr>td, .table-bordered>tbody>tr>th { border: 1px solid #555; } .table>thead:first-child>tr:first-child>th { border-top: 1px solid #555; } table.table-bordered th:last-child, table.table-bordered td:last-child { border-right: 1px solid #555; } </style>