관리-도구
편집 파일: manage_notes.php
<?php global $mysqli; $total_quizs=0; $training_ob=$this->load('training_control'); $course_control = $this->load("course_control"); $all_course = $training_ob->getCourse(); $page_count=1; if(isset($_GET['page_count']) && is_numeric($_GET['page_count'])) { $page_count=(int)$_GET['page_count']; } $course_id= (int) (isset( $_GET['cfcourse_id'] ) && is_numeric( $_GET['cfcourse_id'] ) ) ?$mysqli->real_escape_string( $_GET['cfcourse_id'] ):false; $content_id= (int) (isset( $_GET['cfcontent_id'] ) && is_numeric( $_GET['cfcontent_id'] ) ) ?$mysqli->real_escape_string( $_GET['cfcontent_id'] ):false; $filter= (int) (isset( $_GET['cfcourse_filter'] ) ) ?$mysqli->real_escape_string( $_GET['cfcourse_filter'] ):false; $all_lecture = $training_ob->getAllContents( $course_id,"all"); ob_start(); echo '<div class="col-lg-2 "> '.createSearchBoxBydate().' </div> <div class="col-lg-2 my-3 my-lg-0 "> <div class="position-relative"> <button class="w-100 btn dropdown-toggle btn-sm btn-block" id="cf-course-filter-btn">'.t('Filter Notes').'</button> <div class="mx-auto " id="cf-course-open-filter"> <div class="mb-3"> <select id="cf-course-selec-course" class="form-control form-control-sm""> <option value="all">'.t('All Courses').'</option>'; foreach($all_course as $course) { if( $course_id == $course['id'] ) { echo '<option value='.$course['id'].' selected>'.$course['title'].'</option>'; }else{ echo '<option value='.$course['id'].' >'.$course['title'].'</option>'; } } echo '</select> </div> <div class="mb-3"> <select id="cf-course-selec-content" class="form-control form-control-sm"> <option value="all">'.t('All Lecture, Quiz, Assignment').'</option>'; foreach( $all_lecture as $lecture ) { if( $content_id == $lecture['id'] ) { echo '<option value="'.$lecture['id'].'" selected>'.base64_decode($lecture['title']).'</option>'; }else{ echo '<option value="'.$lecture['id'].'" >'.base64_decode($lecture['title']).'</option>'; } } echo '</select> </div> <div class="mb-3"> <select id="cf-course-filter-comment" class="form-control form-control-sm"> <option value="all" '. ($filter=="all"?"selected":"") .' >'.t('All Notes').'</option> <option value="r" '. ($filter=="r"?"selected":"") .'>'.t('Read Notes').'</option> <option value="ur" '. ($filter=="ur"?"selected":"") .'>'.t('Unread Notes').'</option> </select> </div> </div> </div> </div> <div class="col-lg-3 "> '.showRecordCountSelection().' </div> <div class="col-lg-3 ">'.arranger(array('id'=>'date')).'</div> <div class="col-lg-2 "> <div class="mb-3"> <div class="input-group input-group-sm"> <div class="input-group-prepend "> <span class="input-group-text"><i class="fas fa-search"></i></span> </div> <input type="text" class="form-control form-control-sm" placeholder="'.t('Search Notes').'" onkeyup="searchPaymentMethods(this.value)"> </div> </div> </div>'; $table_manager=ob_get_clean(); $max_leads_limit=(int)get_option('qfnl_max_records_per_page'); $total_notes=$training_ob->getNotesCount( $course_id,$content_id ); $notes=$training_ob->getAllNotes( $total_notes, $max_leads_limit, $page_count, $course_id,$content_id,$filter ); ?> <div class="container-fluid pb-3"> <div class="row page-titles mb-4"> <div class="col-md-5 align-self-center"> <h4 class="text-themecolor" id="commoncontainerid"><?= t('Manage Notes'); ?></h4> </div> </div> <div class="mx-1 mx-sm-3"> <div class="row"> <?=$table_manager; ?> </div> </div> <div class="pt-3 pb-1"> <div class="row"> <div class="col-md-3 px-1 ps-3 "> <select name="" id="cf-course-bulk-notes-action" class="form-control form-control-sm"> <option value="-1"><?= t('Bulk Action'); ?></option> <option value="del"><?= t('Delete'); ?></option> <option value="re"><?= t('Mark as read'); ?></option> <option value="unre"><?= t('Mark as unread'); ?></option> </select> </div> <div class="col-md-1 px-1 px-sm-1 "> <button class="btn btn-outline-secondary btn-sm" id="cf-course-bulk-notes-btn"><?= t('Apply'); ?></button> </div> <div class="col-md-7 px-1 "> <span class="text text-danger cf-course-bulk-show"> <?= t('Please choose one action.'); ?> </span> </div> </div> </div> <div class="pb-2 border mt-2 bg-white br-rounded " id="cf-course-mcomment"> <div class="pb-2"> <div class="row"> <div class="col-sm-12 "> <div class="table-responsive"> <table class="table table-striped text-center"> <thead> <tr> <th>#</th> <th> <span class="cf-course-custom-check"> <input type="checkbox" id='cf-checkforall' > <label for="cf-checkforall"></label> </span> <?= t('Student Name'); ?> </th> <th><?= t('In Response to'); ?></th> <th><?= t('Note'); ?></th> <th><?= t('Added on'); ?></th> </tr> </thead> <tbody id="notekeywordsearchresult"> <!-- keyword search --> <?php $count=1; if(isset($_GET['page_count'])) { $page_count=(int)$_GET['page_count']; $count=($page_count*$max_leads_limit)-$max_leads_limit; ++$count; } if($notes!=null) { if( count($notes) > 0 ) { $odd_even=0; $counting=0; foreach( $notes as $data ){ $noteid = $data['id']; $counting++; $url = $data['url']; $install_url= get_option("install_url"); $url1 = base64_encode(json_encode([ "admin"=>"is_admin","course_id"=>$data['course_id'] ] )); $url2 = base64_encode(json_encode([ "course_id"=>$data['course_id'],"section_id"=>$data['section_id'],"type"=>$data['type'] ,"option_id"=> $data['option_id'] ] )); $newurl = $install_url."/index.php?page=cfcourse_preview&cfapreview=".$url1.".&cf_vid=".$url2."&type=notes&id=".$noteid."#cf-course-notes-c-".$noteid; $note = stripslashes( $data['notes'] ); $note_edit = htmlspecialchars( stripslashes($data['notes'])); $pnoteid = cf_enc($noteid, "encrypt" ); $not = strip_tags($note); if($odd_even==0){ $trclass="cf-course-odd-tr"; $notesback="cf-course-odd-notes-b"; $btnTrType="cf-course-odd-tr-btn"; $odd_even=1; } else if($odd_even==1){ $trclass="cf-course-even-tr"; $btnTrType="cf-course-even-tr-btn"; $notesback="cf-course-even-notes-b"; $odd_even=0; } if( strlen( $not ) > 280 ) { $class="cf-course-assign-ada-ans-h"; $button='<a href="javascript:void(0)" class="d-inline-block '.$btnTrType.' cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; } ?> <tr class='cf-course-hover-comemnt <?=$trclass; ?> border border-0 cf-course-parent-comments' id='cf-course-comment-row-<?= $pnoteid ?>' > <td width="3%"><?= $counting; ?></td> <td width="15%"> <span class="cf-course-custom-check"> <input type="checkbox" class="cf-bulk-check" value="<?=$pnoteid ?>" id='cf-bulk-check-<?=$pnoteid ?>'> <label class="cf-bulk-check-for" for="cf-bulk-check-<?=$pnoteid ?>"><?php echo $data['name']; ?> <span class="text-info cf-course-read-check text-sm" style="opacity:<?= ( $data['readed']=='1')?'1':'0'; ?>"><i class='fas fa-check'></i></span></label> </span> </td> <td width="30%"> <?php echo $course_control->getLectureHeader( $data['option_id'], "", "one" ); ?> <div class="cf-course-actions p-1"> <a href=" <?=$newurl; ?>" target="_blank" class="text-primary text-sm">Visit Page</a> </div> </td> <td width="37%"> <div class="cf-course-assign-question-ans position-relative"> <div class="cf-course-comment-text <?php echo $class." ".$notesback; ?>"> <?php if($data['reply']=="yes") { echo "<div class='p-1'>In reply to</div>"; } echo $note; ?> </div> <?= $button; ?> </div> <div class="cf-course-actions p-1"> <a href="javascript:void(0)" data-id="<?= $pnoteid ?>" class="text-success cf-course-delete-nt text-sm"><?= t('Delete'); ?></a> | <a href="javascript:void(0)" data-id="<?= $pnoteid ?>" data-readed="<?= $data['readed']; ?>" class="text-info cf-course-read-nt text-sm"><?= t(( $data['readed']=="1")?"Mark as unread":"Mark as read"); ?></a> </div> </td> <td width="15%" class='text-right'><?php echo date( "d-M-Y h:ia", strtotime($data['created_at'])); ?></td> </tr> <?php } } } ?> <!-- /keyword search --> </tbody> <tfoot> <tr> <td colspan="7" class="total-data" ><center> <?= t("Total Notes"); ?>: <?=$total_notes; ?></center></td> </tr> </tfoot> </table> </div> </div> </div> <div class="col-md-12 row nopadding"> <div class="col-sm-6 mt-4"> <?php $next_page_url="index.php?page=cfcourse_manage_comment&page_count"; $page_count=($page_count<2)? 0:$page_count; echo createPager( $total_notes,$next_page_url,$page_count); ?> </div> </div> </div> </div> </div> </div> <!-- The cf_course_drip_model --> <div id="mycf_course_drip_delete_assign" class="cf_course_drip_model" style="border-radius:5px"> <!-- cf_course_drip_model content --> <div class="cf_course_model_w_anim"> <div class="alert alert-info pb-1 mb-0 "> <span class="cf-course-close-drip cf-course-close-drip-btn">×</span> <h5 id="cf-course-delete-he "><?= t('Please Confirm'); ?></h5> </div> <div class="cf_course_drip_model-body py-3 cf_course_drip_model-del-body"> <?= t('Do you really want to delete this note?'); ?> </div> <input type="hidden" id="cf-course-delete-notes" value=""> <input type="hidden" id="cf-course-delete-bulkaction" value=""> <input type="hidden" id="cf-course-delete-bulkval" value=""> <div class="modal-footer"> <button type="button" class="btn btn-primary btn-sm cf-course-close-drip-btn"><?= t('Cancel'); ?></button> <button type="button" class="btn btn-danger btn-sm cf-course-remove-notes"><?= t('Delete'); ?></button> </div> </div> </div> <div id="cf-course-snackbar-admin"><?= t('Notes Deleted'); ?>.</div> <input type="hidden" id="cfcourse_ajax" value="<?php echo get_option('install_url')."/index.php?page=ajax"; ?>"> <script> function searchPaymentMethods(search) { var ob=new OnPageSearch(search,"#notekeywordsearchresult"); ob.url=window.location.href; ob.search(); } </script>