관리-도구
편집 파일: manage_comment.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"); // echo "<pre>"; // print_r($all_lecture[0]['title']); // die(); ob_start(); echo '<div class="col-lg-2 "> '.createSearchBoxBydate().' </div> <div class="col-lg-3 my-3 my-lg-0 "> <div class="position-relative"> <button class="w-100 btn dropdown-toggle btn-block btn-outline-secondary " id="cf-course-filter-btn">'.t('Filter comments').'</button> <div class="mx-auto " id="cf-course-open-filter"> <div class="mb-3"> <select id="cf-course-selec-course" class="form-control form-select 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-select 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>'.$lecture['title'].'</option>'; }else{ echo '<option value="'.$lecture['id'].'" >'.$lecture['title'].'</option>'; } } echo '</select> </div> <div class="mb-3"> <select id="cf-course-filter-comment" class="form-control form-select form-control-sm"> <option value="all" '. ($filter=="all"?"selected":"") .' >'.t('All comments').'</option> <option value="r" '. ($filter=="r"?"selected":"") .'>'.t('Read comments').'</option> <option value="ur" '. ($filter=="ur"?"selected":"") .'>'.t('Unread comments').'</option> <option value="ap" '. ($filter=="ap"?"selected":"") .'>'.t('Approved comments').'</option> <option value="uap" '. ($filter=="uap"?"selected":"") .'>'.t('Unapproved comments').'</option> </select> </div> </div> </div> </div> <div class="col-lg-3 "> '.showRecordCountSelection().' </div> <div class="col-lg-2 ">'.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 Comment').'" onkeyup="searchPaymentMethods(this.value)"> </div> </div> </div> '; $table_manager=ob_get_clean(); $max_leads_limit=(int)get_option('qfnl_max_records_per_page'); $total_comments=$training_ob->getCommentCount( $course_id,$content_id ); $comments=$training_ob->getAllComments( $total_comments, $max_leads_limit, $page_count, $course_id,$content_id, $filter ); ?> <div class="container-fluid pb-3" id=""> <div class="row page-titles mb-4"> <div class="col-md-5 align-self-center"> <h4 class="text-themecolor" id="commoncontainerid"><?= t('Manage Comment'); ?></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-action" class="form-control form-select form-control-sm"> <option value="-1"><?= t('Bulk Action'); ?></option> <option value="del"><?= t('Delete'); ?></option> <option value="uap"><?= t('Unapproved'); ?></option> <option value="ap"><?= t('Approved'); ?></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-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><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('Comment'); ?></th> <th><?= t('Added on'); ?></th> </tr> </thead> <tbody id="keywordsearchresult"> <!-- 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($comments!=null) { if( count($comments) > 0 ) { $odd_even=0; foreach( $comments as $data ){ if($data['approve']==1){ if($odd_even==0){ $trclass="cf-course-odd-tr"; $trtype="odd"; $btnTrType="cf-course-odd-tr-btn"; $odd_even=1; } else if($odd_even==1){ $trclass="cf-course-even-tr"; $odd_even=0; $trtype="even"; $btnTrType="cf-course-even-tr-btn"; } } else{ if($odd_even==0){ $trtype="odd"; $odd_even=1; } else if($odd_even==1){ $odd_even=0; $trtype="even"; } $trclass=""; $btnTrType="cf-course-un-odd-tr-btn"; } $install_url = get_option("install_url"); $comid = $data['id']; $is_ad = $data['is_admin']; $cDetails = $course_control->getContentDetails( $data['option_id'], $data['course_id'],"option_type" ); if($cDetails['option_type']=="assign"){ $cDetails['option_type']="assignment"; } $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"=>$cDetails['option_type'] ,"option_id"=> $data['option_id'] ] )); $newurl = $install_url."/index.php?page=cfcourse_preview&cfapreview=".$url1.".&cf_vid=".$url2."&type=comment&id=".$comid."#cf-course-cdel-".$comid; $comment = htmlspecialchars_decode(trim( stripcslashes( str_ireplace(array( "\r"), "<br/>",$data['comment'])))); $comm = strip_tags($comment); if( strlen( $comm ) > 280 ) { $class="cf-course-assign-ada-ans-h"; $button='<a href="javascript:void(0)" class="d-inline-block '.$btnTrType.' cf-course-assign-ada-btn">'.t('Read More').'</a>'; }else{ $class = ''; $button = ''; } $curl =$course_control->get_course_by_id( $data['course_id'],"show_url" ); $comment_edit = stripcslashes( trim( stripcslashes( $data['comment'] ),"\r\n") ); $pcomid = cf_enc($comid, "encrypt" ); ?> <tr class='cf-course-hover-comemnt <?=$trclass; ?> cf-course-parent-comments' id='cf-course-comment-row-<?= $pcomid ?>' > <td width="15%"> <span class="cf-course-custom-check"> <input type="checkbox" class="cf-bulk-check" value="<?=$pcomid ?>" id='cf-bulk-check-<?=$pcomid ?>'> <label class="cf-bulk-check-for" for="cf-bulk-check-<?=$pcomid ?>"><?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="40%"> <div class="cf-course-assign-question-ans position-relative"> <div class="cf-course-comment-text <?=$class; ?>"> <?php if($data['reply']=="yes") { echo "<div class='p-1'>".t('In reply to')."</div>"; } echo $comment; ?> </div> <?= $button; ?> </div> <div class="cf-course-actions p-1"> <a href="javascript:void(0)" data-id="<?= $pcomid ?>" data-type="<?= $trtype; ?>" data-appr="<?= $data['approve']; ?>" class="text-primary cf-course-appr-cm text-sm"><?= t(( $data['approve']=="1")?"Unapproved":"Approved"); ?></a> | <a href="javascript:void(0)" data-id="<?= $pcomid ?>" class="text-success cf-course-delete-cm text-sm"><?= t('Delete'); ?></a> | <a href="javascript:void(0)" data-id="<?= $pcomid ?>" data-readed="<?= $data['readed']; ?>" class="text-info cf-course-read-cm text-sm"><?= t(( $data['readed']=="1")?"Mark as unread":"Mark as read"); ?></a> | <a href="javascript:void(0)" data-name="<?= $data['name']; ?>" data-ctype="<?= $cDetails['option_type']; ?>" data-url="<?= $curl['show_url']; ?>" data-id="<?= $pcomid ?>" data-reply="<?= $pcomid ?>" data-cid="<?=cf_enc( $data['course_id'], "encrypt" ); ?>" data-oid="<?= cf_enc( $data['option_id'], "encrypt" ); ?>" data-sid="<?= cf_enc( $data['section_id'], "encrypt" ); ?>" class="text-warning cf-course-reply-cm text-sm" id="cf-course-reply-<?= $pcomid ?>"><?= t('Reply'); ?></a> <?php if($data['is_admin']==1): ?> | <a href="javascript:void(0)" data-id="<?= $pcomid ?>" class="text-info cf-course-edit-cm text-sm" id="cf-course-edit-<?= $data['id']; ?>"><?= t('Edit')?></a> <input type="hidden" class="cf-course-com-edit" id="cf-course-com-edit-<?= $data['id']; ?>" value="<?= $comment_edit; ?>"> <?php endif;?> </div> </td> <td width="15%" class='text-end'><?php echo date( "d-M-Y h:ia", strtotime($data['created_at'])); ?></td> <?php echo $training_ob->getAllCommentsReply( $data['id'],$course_control,$odd_even,$filter ); ?> </tr> <?php } } } ?> <!-- /keyword search --> </tbody> <tfoot> <tr> <td colspan="7" class="total-data" ><center> <?= t('Total Comments'); ?>: <?=$total_comments; ?></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_comments,$next_page_url,$page_count); ?> </div> </div> </div> </div> </div> </div> <!-- Modal --> <!-- The cf_course_drip_model --> <div id="mycf_course_drip_model" class="cf_course_drip_model" style="border-radius:5px"> <form id="cf-course-add-comment" > <!-- cf_course_drip_model content --> <div class="cf_course_drip_model-content cf_course_drip_reply_content"> <div class="alert text-white bg-primary"> <span class="cf-course-close-drip cf-course-close-btn">×</span> <h5><?= t('Reply'); ?></h5> </div> <div class="cf_course_drip_model-body p-4"> <div class="cf-course-dis-form "> <input type="hidden" name="oid" id="cf-course-oid" value="" /> <input type="hidden" name="mid" value="<?= cf_enc(1) ?>" /> <input type="hidden" name="param" id="cf-course-cparam" value="save" /> <input type="hidden" name="comment_id" id="cf-course-com-id" value="" /> <input type="hidden" name="cf-course-sid" id="cf-course-sid" value="" /> <input type="hidden" name="cf-course-cid" id="cf-course-cid" value="" /> <input type="hidden" name="cf-course-reply-id" id="cf-course-replyid" value="" /> <input type="hidden" name="reply" value="yes" /> <input type="hidden" name="theme" value="a" /> <input type="hidden" name="from" value="a!^dd" /> <input type="hidden" name="type" value="" id="cf-course-type" /> <input type="hidden" name="url" value="a" id="cf-course-url" /> <input type="hidden" name="cfc_comment_nonce" id="cf-course--nonce" value="<?=cf_create_nonce('cfc_comment_nonce'); ?>" > <div class="d-flex"> <div class="cf--c--c" style="width:100% !important"> <div id="cf-course-comment-text" tabindex="0" data-placeholder="<?= t('Reply Comment'); ?>" contenteditable class="cf-course-com-text cf-course-text-input p-4" ></div> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary cf-course-close-btn btn-sm "> <?= t('Close'); ?></button> <button type="submit" class="btn btn-success btn-sm" id="cf-course-sub-com"><?= t('Reply'); ?></button> </div> </div> </form> </div> <!--Model end --> <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 comment?'); ?> </div> <input type="hidden" id="cf-course-delete-comment" 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-comment"><?= t('Delete'); ?></button> </div> </div> </div> <div id="cf-course-snackbar-admin"><?= t('Comment 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,"#keywordsearchresult"); ob.url=window.location.href; ob.search(); } </script>