관리-도구
편집 파일: CFCourse_lecture.php
<?php if(!class_exists('CFCourse_lecture')) { class CFCourse_lecture { public $loader; function __construct($arr) { $this->loader=$arr['loader']; } public function deleteContent($content_data=null) { global $mysqli; global $dbpref; $table = $dbpref."content_options"; $action_param = $mysqli->real_escape_string( trim( $content_data['action_param'] ) ); if($action_param=="delete") { $content_id = $mysqli->real_escape_string( trim( $content_data['content_id'] ) ); $delete_row = "DELETE FROM `".$table."` WHERE `id`=".$content_id; $this->deleteMemberProgress( $content_id ); $l_delete = $mysqli->query( $delete_row )?1:1; if( $mysqli->affected_rows == 1 ){ echo json_encode( array( "status" => 1 , "message"=>"course content deleted succesfull") ); die(); }else{ echo json_encode( array( "status" => 0, "message"=>"course content not deleted succesfull") ); die(); } }else{ echo json_encode( array( "status" => 0, "message"=>"course content not deleted succesfull") ); die(); } } public function addLectureContent( $lcont = null ){ global $mysqli; global $dbpref; $part = $mysqli->real_escape_string( trim( $lcont['part'] ) ); if( $part=="save" ){ $table = $dbpref."content_options"; $action = $mysqli->real_escape_string( trim( $lcont['cfcourse_lecture_action'] ) ); $title = $mysqli->real_escape_string( trim( $lcont['cfcourse_l_t'] ) ); $description = $mysqli->real_escape_string( trim( $lcont['cfcourse_l_des'] ) ); $position = $mysqli->real_escape_string( trim( $lcont['position'] ) ); $positions = explode(",",$position); if( empty( $title ) ){ echo json_encode( array( "status"=>0, "type"=>"lecture_title","message"=>"Please fill this field" ) ); die(); } $title = !empty( $title ) ? $title:""; $dtitle = $title; $description = !empty( $description ) ? $description:""; $ddes = $description; $time = date("Y-m-d H:i:s"); $option_type = 'lecture'; if( $action=="add_lecture" ) { $course_id = (int)$mysqli->real_escape_string( trim( $lcont['cfcourse_course_id'] ) ); $section_id = (int)$mysqli->real_escape_string( trim( $lcont['cfcourse_section_id'] ) ); $total_count = getTotalCount($table); $site_token_for_dashboard=get_option('site_token'); if($_SESSION['user_plan_type' . $site_token_for_dashboard] ==2 && $total_count >= 1) { $affected_rows = 0; } else { $sql = "INSERT INTO `".$table."` (`course_id`, `section_id`, `title`, `description`,`option_type`, `created_at`, `updated_at`,`updates`) VALUES ($course_id,$section_id,'".$dtitle."','".$ddes."','".$option_type."','".$time."','".$time."','1')"; $mysqli->query( $sql ); $affected_rows = $mysqli->affected_rows; } if( $affected_rows == 1){ $last_id = $mysqli->insert_id; $result = $mysqli->query("SELECT * FROM `".$table."` Where `id`=".$last_id); if( $result->num_rows > 0 ) { foreach($positions as $posit ) { if($posit=="new") { $pos[]=$last_id; }else{ $pos[]=$posit; } } $section_ob = $this->loader->load("section"); $section_ob->addPosition($pos,"l",$course_id); $l_data = $result->fetch_assoc(); $htmlCon = $this->getLectureBasic( $l_data,"add" ); echo json_encode( array("status"=>1, "type"=> "lecture_add", "cls"=>".cfcourse_s_t_i_des","data"=> $htmlCon, "lecture_id" => $last_id, "message"=>"course lecture added succesfull") ); die(); } }else{ echo json_encode( array("status" => 0, "type" => "lecture_add", "message" => "Course lecture cannot be added successsfully") ); die(); } }else if($action="update_lecture") { $lecture_id = $mysqli->real_escape_string( trim( $lcont['cfcourse_lecture_id'] ) ); $course_id = $mysqli->real_escape_string( trim( $lcont['course_id'] ) ); $sql1 = "UPDATE `".$table."` SET `title`='".$dtitle."', `description`='".$ddes."', `updated_at`='".$time."' WHERE `id`=".$lecture_id; $return_update = $mysqli->query( $sql1 )?1:1; if( $return_update ){ $last_id=$mysqli->insert_id; foreach($positions as $posit ) { if($posit=="new") { $pos[]=$last_id; }else{ $pos[]=$posit; } } $section_ob = $this->loader->load("section"); $section_ob->addPosition($pos,"l",$course_id); $result = $mysqli->query("SELECT `id` FROM `".$table."` Where `id`=".$lecture_id ); if( $result->num_rows > 0 ) { echo json_encode( array( "status"=>1, "cls"=>".cfcourse_s_t_i_des", "type"=> "lecture_update","title"=>stripslashes($title),"des"=>stripslashes($description),"desed"=>htmlentities($description), "lastId" => $lecture_id, "message"=>"course lecture updated succesfull") ); die(); } }else{ echo json_encode( array( "status"=>0, "type"=> "lecutre_update", "message"=>"course lecture not updated succesfull") ); die(); } } } else if($part=="content") { $table = $dbpref."content_options"; $l_content = $lcont['cfcourse_l_cont']; $content_data = []; $type = $mysqli->real_escape_string( trim( $lcont['cfcourse_l_con_type'] ) ); $lid = $mysqli->real_escape_string( trim( $lcont['lid'] ) ); if( !empty( $type ) ) { if( is_array($l_content) ) { $contents = $this->validateContent( $l_content, $type ); foreach ( $contents as $c_k => $c_v ) { $c_k = $mysqli->real_escape_string( trim( $c_k ) ); $c_v = $mysqli->real_escape_string( trim( $c_v ) ); $content_data[$c_k] = $c_v; } } } else{ echo json_encode( array( "status"=>0, "type"=>"content_type","message"=>"Please choose content type" ) ); die(); } $content_data = (count( $content_data ) >0 ) ? $content_data:[]; $content_data = $mysqli->real_escape_string( json_encode( $content_data ) ); $lecture_content= $content_data; $time = date("Y-m-d H:i:s"); $update_row = "UPDATE `".$table."` SET `content`='".$lecture_content."', `content_type`='".$type."', `updated_at`='".$time."' WHERE `id`=".$lid; $returnl_update = $mysqli->query( $update_row )?1:-1; if( $returnl_update ){ $result = $mysqli->query("SELECT * FROM `".$table."` Where `id`=".$lid ); $l_data =$result->fetch_assoc(); $last_id = $l_data['id']; $l_title = htmlspecialchars( stripslashes( $l_data['title'])); $l_desc = stripslashes( $l_data['description']); $l_type = $l_data['content_type']; $l_type = $l_data['content_type']; $l_cont = json_decode( $l_data['content'] ,true); $data = $this->getLectureContent( $last_id,$l_type,$l_title,$l_cont,$l_desc ); echo json_encode( array( "status"=>1, "message"=>"course content updated succesfull","data"=>$data )); die(); }else{ echo json_encode( array( "status"=>0, "type"=> "lecutre_update", "message"=>"course content not updated succesfull") ); die(); } } else if( $part =="resource" ) { $table = $dbpref."content_resource"; $type = $mysqli->real_escape_string( trim($lcont['cfcourse_r_type'] ) ); $linkv = $type.'link'; $textv = $type.'text'; $link = $mysqli->real_escape_string( trim( $lcont[$linkv] ) ); $text = $mysqli->real_escape_string( trim( $lcont[$textv] ) ); $lid = $mysqli->real_escape_string( trim( $lcont['lid'] ) ); $update_row = "INSERT INTO `".$table."` (`content_id`, `resource_type`, `text`,`link`) VALUES($lid,'".$type."','".$text."','".$link."')"; $total_count = getTotalCount($table); $site_token_for_dashboard=get_option('site_token'); if($_SESSION['user_plan_type' . $site_token_for_dashboard] ==2 && $total_count >= 1) { $returnl_update = -1; } else { $returnl_update = $mysqli->query( $update_row )?1:-1; } if( $returnl_update ){ $last_id = $mysqli->insert_id; $data = $this->getHelpContent(false, $last_id); echo json_encode( array( "status"=>1, "message"=>"course content updated succesfull","data"=>$data) ); die(); }else{ echo json_encode( array( "status"=>0, "message"=>"resource not updated succesfull") ); die(); } }else if( $part =="manage" ) { $table = $dbpref."content_options"; $like_status = (isset( $lcont['cf-show-like']) && $lcont['cf-show-like']=="on") ? "1":"0"; $comment_status= (isset( $lcont['cf-show-comment']) && $lcont['cf-show-comment']=="on") ? "1":"0"; $comment_approve= (isset( $lcont['cf-comemnt-approve']) && $lcont['cf-comemnt-approve']=="on") ? "1":"-1"; $lid = $mysqli->real_escape_string( trim( $lcont['lid'] ) ); $time = date("Y-m-d H:i:s"); $update_row = "UPDATE `".$table."` SET `like_status`=$like_status, `comment_status`=$comment_status,`comment_approve`=$comment_approve, `updated_at`='".$time."' WHERE `id`=".$lid; $returnl_update = $mysqli->query( $update_row )?1:-1; if( $returnl_update ){ echo json_encode( array( "status"=>1, "message"=>"manage updated succesfull") ); die(); }else{ echo json_encode( array( "status"=>0, "message"=>"manage not updated succesfull") ); die(); } } else if($part=="rs_delete") { $table = $dbpref."content_resource"; $r_id = $mysqli->real_escape_string( trim( $lcont['resource_id'] ) ); $delete_row = "DELETE FROM `".$table."` WHERE `id`=".$r_id; $mysqli->query( $delete_row ); if( $mysqli->affected_rows == 1 ){ echo json_encode( array( "status" => 1 , "message"=>"resource deleted succesfull") ); die(); }else{ echo json_encode( array( "status" => 0, "message"=>"resource not deleted succesfull") ); die(); } } } /* @param working: this function add lecture for a cousrse */ public function editContent($edata){ global $mysqli; global $dbpref; $table = $dbpref."content_options"; $lid = $mysqli->real_escape_string($edata['id']); $result = $mysqli->query("SELECT `content_type`, `content` FROM `".$table."` Where `id`=".$lid ); $htmlCon=""; if( $result->num_rows >0 ) { $l_data =$result->fetch_assoc(); $l_type = $l_data['content_type']; $l_cont = json_decode( $l_data['content'] ,true); // print_r($l_cont); ob_start(); echo' <div class="mb-3 cfourse-l-type mb-3 "> <label class="font-weight-bold text-primary">'.t('Content Type').'</label> <select name="cfcourse_l_con_type" class="form-control form-select cfcourse-l-con-t" required> <option value="-1" >'.t('Select Content').'</option> <option value="d" '.( $l_type=="d"?"selected":"" ).'>'.t('Document').'</option> <option value="cfcourselat" '.( $l_type=="cfcourselat"?"selected":"" ).'>'.t('Article').'</option> <option value="y" '.( $l_type=="y"?"selected":"" ).'>'.t('Youtube Video').'</option> <option value="vm" '.( $l_type=="vm"?"selected":"" ).'>'.t('Vimeo Video').'</option> <option value="vu" '.( $l_type=="vu"?"selected":"" ).'>'.t('Video').' (mp4)</option> <option value="au" '.( $l_type=="au"?"selected":"" ).'>'.t('Audio').' (mp3)</option> <option value="i" '.( $l_type=="i"?"selected":"" ).'>'.t('Image').'</option> <option value="if" '.( $l_type=="if"?"selected":"" ).'>'.t('Iframe').'</option> </select> <div class="cfcourse-contType-e cfcourse-error" tabindex="-1"></div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-art mb-3 '.( ( isset($l_type) && $l_type=="cfcourselat") ? "d-block" :"" ).'" > <div class="cfcourse-l-a"> <label class="font-weight-bold text-primary">'.t('Write Article').'</label> <textarea name="cfcourse_l_cont[art][txt]" class="cfcourselat form-control">'.(isset( $l_cont['txt'] ) && !empty( $l_cont['txt'] ) ? stripcslashes(trim(stripcslashes( $l_cont['txt']),"\r\n") ) : "" ).'</textarea> <div class="cfcourse-art-e cfcourse-error" tabindex="-1"></div> </div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-you mb-3 border p-4 '.( ( isset($l_type) && $l_type=="y") ? "d-block" :"" ).' "> <label class="text-primary cf-course-label-6">'.t('Enter Youtube Video id/URL').'</label> <div class="input-group "> <input type="text" class="form-control cfcourse_l_you_id" value="'.( isset( $l_cont['y_id'] ) && !empty( $l_cont['y_id'] ) ? $l_cont["y_id"] : "" ).'" name="cfcourse_l_cont[you][y_id]" placeholder="'.t('Enter youtube video id/url').'"> </div> <div class="cfcourse-you-e cfcourse-error" tabindex="-1"></div> <div class="mb-3 p-3"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">'.t('Video Length').'</span> </div> <input type="number" min="0" placeholder="Hour" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['y_h'] ) && !empty( $l_cont['y_h'] ) ? (int)$l_cont["y_h"] : "" ).'" name="cfcourse_l_cont[you][y_h]" class="form-control" /> <input type="number" min="0" placeholder="Minute" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['y_m'] ) && !empty( $l_cont['y_m'] ) ? (int)$l_cont["y_m"] : "" ).'" name="cfcourse_l_cont[you][y_m]" class="form-control" /> <input type="number" min="0" placeholder="Second" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['y_s'] ) && !empty( $l_cont['y_s'] ) ? (int)$l_cont["y_s"] : "" ).'" name="cfcourse_l_cont[you][y_s]" class="form-control" /> </div> </div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-vm mb-3 border '.( ( isset($l_type) && $l_type=="vm") ? "d-block" :"" ).' p-4 "> <label class="text-primary cf-course-label-6">'.t('Enter Vimeo Video id/URL').'</label> <div class="input-group "> <input type="text" class="form-control cfcourse_l_vm_id" value="'.( isset( $l_cont['vm_id'] ) && !empty( $l_cont['vm_id'] ) ? $l_cont["vm_id"] : "" ).'" name="cfcourse_l_cont[vm][vm_id]" placeholder="'.t('Enter vimeo video id/url').'"> </div> <div class="cfcourse-vm-e cfcourse-error" tabindex="-1"></div> <div class="mb-3 p-3"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">'.t('Video Length').'</span> </div> <input type="number" min="0" placeholder="Hour" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['vm_h'] ) && !empty( $l_cont['vm_h'] ) ? (int)$l_cont["vm_h"] : "" ).'" name="cfcourse_l_cont[vm][vm_h]" class="form-control" /> <input type="number" min="0" placeholder="Minute" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['vm_m'] ) && !empty( $l_cont['vm_m'] ) ? (int)$l_cont["vm_m"] : "" ).'" name="cfcourse_l_cont[vm][vm_m]" class="form-control" /> <input type="number" min="0" placeholder="Second" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['vm_s'] ) && !empty( $l_cont['vm_s'] ) ? (int)$l_cont["vm_s"] : "" ).'" name="cfcourse_l_cont[vm][vm_s]" class="form-control" /> </div> </div> </div> <div class="form-gourp cfcourse-l-ctype-s mb-3 cfcourse-l-v border '.( ( isset($l_type) && $l_type=="vu") ? "d-block" :"" ).' p-4 "> <label class="font-weight-bold text-primary">'.t('Upload Your Video').'</label> <div class="input-group "> <input type="url" name="cfcourse_l_cont[v][v_url]" value="'.( isset( $l_cont['v_url'] ) && !empty( $l_cont['v_url'] ) ? $l_cont["v_url"] : "" ).'" class="form-control cfcourse-l-v-i" id="cfcourse-l-vurl" placeholder="Enter URL or upload from media" /> <div class="input-group-append"> <button class="btn btn-success cfcourse-open-video" type="button"><i class="fas fa-upload"></i> '.t('Upload').'</button> </div> </div> <div class="cfcourse-vURL-e cfcourse-error" tabindex="-1"></div> <div class="cfcourse-vid-err" class="cfcourse-front-error"></div> <br /> <label class="font-weight-bold text-primary">'.t('Upload Video Thumbnail').'</label> <div class="input-group cfcourse-l-thumbnail "> <input type="url" name="cfcourse_l_cont[v][v_thumbnail]" value="'.( isset( $l_cont['v_thumbnail'] ) && !empty( $l_cont['v_thumbnail'] ) ? $l_cont["v_thumbnail"] : "" ).'" class="form-control cfcourse-l-v-thmb" placeholder="Enter URL or upload from media" /> <div class="input-group-append"> <button class="btn btn-success cfcourse-open-thumbnail" type="button"><i class="fas fa-upload"></i> '.t('Upload').'</button> </div> </div> <div class="mb-3 p-3"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text ">'.t('Video Length').'</span> </div> <input type="number" min="0" placeholder="Hour" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['v_h'] ) && !empty( $l_cont['v_h'] ) ? (int)$l_cont["v_h"] : "" ).'" name="cfcourse_l_cont[v][v_h]" class="form-control" /> <input type="number" min="0" placeholder="Minute" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['v_m'] ) && !empty( $l_cont['v_m'] ) ? (int)$l_cont["v_m"] : "" ).'" name="cfcourse_l_cont[v][v_m]" class="form-control" /> <input type="number" min="0" placeholder="Seconds" title="Only two digit allowed" maxlength="2" min="0" max="60" pattern="[0-9]{0,2}" value="'.( isset( $l_cont['v_s'] ) && !empty( $l_cont['v_s'] ) ? (int)$l_cont["v_s"] : "" ).'" name="cfcourse_l_cont[v][v_s]" class="form-control" /> </div> </div> </div> <div class="form-gourp cfcourse-l-ctype-s mb-3 cfcourse-l-a border '.( ( isset($l_type) && $l_type=="au") ? "d-block" :"" ).' p-4 "> <label class="font-weight-bold text-primary">'.t('Upload Your Audio').'</label> <div class="input-group "> <input type="url" name="cfcourse_l_cont[a][a_url]" value="'.( isset( $l_cont['a_url'] ) && !empty( $l_cont['a_url'] ) ? $l_cont["a_url"] : "" ).'" class="form-control cfcourse-l-a-i" placeholder="Enter URL or upload from media" /> <div class="input-group-append"> <button class="btn btn-success cfcourse-open-audio" type="button"><i class="fas fa-upload"></i> '.t('Upload').'</button> </div> </div> <div class="cfcourse-auURL-e cfcourse-error" tabindex="-1"></div> <div class="cfcourse-auid-err" class="cfcourse-front-error"></div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-doc mb-3 '.( ( isset($l_type) && $l_type=="d") ? "d-block" :"" ).' border p-4 "> <div class="mb-3"> <label class="font-weight-bold text-primary">'.t('Select Document Type').'</label> <select name="cfcourse_l_cont[doc][doc_type]" class="form-control form-select cfcourse_doc_type"> <option value="pdf" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="pdf" ? "selected":"" ).'> PDF</option> <option value="word" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="word" ? "selected":"" ).'> DOCS/DOCX</option> <option value="excel" '. ( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="excel" ? "selected":"" ).'>XLSX, XLS</option> <option value="csv" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="csv" ? "selected":"" ).'>CSV</option> <option value="alt" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="alt" ? "selected":"" ).' >TXT</option> <option value="ppt" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="ppt" ? "selected":"" ).'> PPT/PPTS</option> <option value="odt" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="odt" ? "selected":"" ).'>ODT</option> <option value="ods" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="ods" ? "selected":"" ).'> ODS</option> <option value="html" '.( isset( $l_cont["doc_type"] ) && $l_cont["doc_type"] =="html" ? "selected":"" ).'> HTML/HTM</option> </select> <div class="cfcourse-docType-e cfcourse-error" tabindex="-1"></div> </div> <label class="text-primary cf-course-label-6" >'.t('Upload Document from media').'</label> <div class="input-group "> <input type="url" name="cfcourse_l_cont[doc][doc_url]" value="'.( isset( $l_cont['doc_url'] ) && !empty( $l_cont['doc_url'] ) ? $l_cont["doc_url"] : "" ).'" class="form-control cfcourse-l-doc-i" placeholder="'.t('Enter URL or upload from media').'" /> <div class="input-group-append"> <button class="btn btn-success cfcourse-open-doc" type="button"><i class="fas fa-upload"></i> '.t('Upload').'</button> </div> </div> <div class="cfcourse-docurl-e cfcourse-error" tabindex="-1"></div> <div class="cfcourse-doc-err" class="cfcourse-front-error" tabindex="-1"></div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-img mb-3 '.( ( isset($l_type) && $l_type=="i") ? "d-block" :"" ).' border p-4"> <label class="font-weight-bold text-primary ">'.t('Upload Image').'</label> <div class="input-group"> <input type="url" class="form-control cfcourse-l-img-i" value="'.( isset( $l_cont['i_url'] ) && !empty( $l_cont['i_url'] ) ? $l_cont["i_url"] : "" ).'" name="cfcourse_l_cont[img][i_url]" placeholder="'.t('Enter URL or upload from media').'" > <div class="input-group-append"> <button class="btn btn-success cfcourse-l-o-img" type="button"><i class="fas fa-upload"></i> '.t('Upload').'</button> </div> </div> <div class="cfcourse-img-e cfcourse-error" tabindex="-1"></div> <div class="cfcourse-img-err" tabindex="-1"></div> </div> <div class="form-gourp cfcourse-l-ctype-s cfcourse-l-iframe mb-3 '.( ( isset($l_type) && $l_type=="if") ? "d-block" :"" ).' border p-4"> <label class="font-weight-bold text-primary ">'.t('Enter Iframe Code').'</label> <div class="input-group"> <textarea rows="6" class="form-control cfcourse-l-iframe-if" name="cfcourse_l_cont[iframe][iframe_code]" placeholder="'.t('Enter Iframe Code').'" >'.(isset( $l_cont['iframe_code'] ) && !empty( $l_cont['iframe_code'] ) ? htmlentities(stripcslashes($l_cont["iframe_code"])) : "").'</textarea> </div> <div class="cfcourse-iframe-e cfcourse-error" tabindex="-1"></div> <div class="cfcourse-iframe-err" tabindex="-1"></div> </div> <div class="text-center d-flex justify-content-center"> <div class="mx-1"> <button type="button" class="btn btn-sm btn-danger cf-can-l-cont">'.t('Cancel').'</button> </div> <div class="mx-1"> <button type="submit" class="btn btn-sm btn-primary cf-add-l-cont">'.t('Save Changes').'</button> </div> </div> '; $htmlCon.=ob_get_clean(); } echo json_encode(array("status"=>1,"data"=>$htmlCon,"cls"=>"cfcourselat")); die(); } public function deleteMemberProgress( $option_id ) { global $mysqli; global $dbpref; $table = $dbpref."member_progress"; $run = $mysqli->query("DELETE FROM `".$table."` WHERE `option_id` =".$option_id); } function getProperTimes( $h1,$m1,$s1) { $html = ""; $h = ltrim($h1,0); $m = ltrim($m1,0); $s = ltrim($s1,0); if( $h >= 10 ) { $html .='<span>'.( isset( $h ) && !empty( $h ) ? $h.":" : "00:").'</span>'; }else{ $html .='<span>'.( isset( $h ) && !empty( $h ) ? "0".$h.":" : "00:").'</span>'; } if( $m >= 10 ) { $html .='<span>'.( isset( $m ) && !empty( $m ) ? $m.":" : "00:").'</span>'; }else{ $html .='<span>'.( isset( $m ) && !empty( $m ) ? "0".$m.":" : "00:").'</span>'; } if( $s >= 10 ) { $html .='<span>'.( isset( $s ) && !empty( $s ) ? $s : "00").'</span>'; }else{ $html .='<span>'.( isset( $s ) && !empty( $s ) ? "0".$s : "00").'</span>'; } return $html; } public function getLectureBasic( $l_data,$updown_ang="" ) { $last_id = $l_data['id']; $l_title = htmlspecialchars( stripslashes( $l_data['title'])); $l_tle = ( ( strlen( $l_title ) > 80) ? substr( $l_title,0, 80 ).'...' : $l_title ); $l_desc = stripslashes( $l_data['description']); $course_id = $l_data["course_id"]; $section_id = $l_data["section_id"]; $l_type = $l_data['content_type']; $help_resource = $l_data['help_resource']; $like_status = $l_data['like_status']; $comment_status = $l_data['comment_status']; $comment_approve = $l_data['comment_approve']; if( $updown_ang=="add" ) { $i= "fa-angle-up"; }else{ $i= "fa-angle-down"; } if( $l_type == "vu" ) { $lec_type= '<i class="fas fa-play-circle cf-courseI"></i>'; } else if( $l_type == "d" ) { $lec_type= '<i class="fas fa-file-alt"></i>'; } else if( $l_type == "y" ) { $lec_type= '<i class="fab fa-youtube cf-courseI"></i> '; } else if( $l_type == "vm" ) { $lec_type= '<i class="fab fa-vimeo cf-courseI"></i>'; } else if( $l_type == "i" ) { $lec_type= ' <i class="fas fas fa-image cf-courseI"></i>'; } else if( $l_type == "cfcourselat" ) { $lec_type= '<i class="fas fa-book-open" aria-hidden="true" ></i>'; } else { $lec_type= '<i class="fas fa-book-open" aria-hidden="true" ></i>'; } $l_cont = json_decode( base64_decode($l_data['content']) ,true); $htmlCon = ""; ob_start(); echo'<div id="cfcourse-o-t-cont-'.$last_id.'" class="cfcourse-o-t-c cf--open-lectab cf--c--opsrtab cfcourse-l bg-white" tabindex="-1" data-posid="'.$last_id.'" > <div class="cfcourse-o-content cf--c--opsrtab"> <div class="d-flex cf--c--opsrtab cf--open-lectuer p-2 justify-content-between justify-content-md-between align-items-center flex-column flex-sm-row"> <div class="cf--course-stitle"> '.$lec_type.' <span style="font-weight:bold" >'.t('Lecture').'. <span class="cfcourse-l-count"></span>: </span> <span class="cfcourse-section-title" > '.$l_tle.' <span> </div> <div class="cfcourse-action cfcourse-action-show p-sm-0 pt-1"> <div class="d-flex"> <div class="p-1 cfcourse-open-c-b" data-bs-toggle="collapse" data-bs-target="#cf-course-optop-'.$last_id.'"><button class=" cfcourse-open-c-b d-inline-block btn btn-primary" title="'.t('Open Lecture').'"> <i class="fas '.$i.' cfcourse-o-d-arr d-inline-block cfcourse-open-c-b" ></i></button></div> <div class="p-1 cfcourse-edit-content-btn"> <button class="cfcourse-edit-content-btn d-inline-block btn btn-success" title="'.t('Edit Lecture').'"> <i class="fas fa-edit d-inline-block cfcourse-edit-content-btn"></i> </button></div> <div class="p-1 cfcourse-del-cont-btn cfcourse-del-content" data-cont-id="'.$last_id.'"><button class="cfcourse-del-content-btn btn btn-danger" title="'.t('Delete Section').'"> <i class="fas fa-trash cfcourse-del-content-btn"></i> </button></div> </div> </div> </div> <div class="cfcourse-o-o-c collapse show" id="cf-course-optop-'.$last_id.'" > <div class="p-2 cf-course-add-all cf-course-cont-container "> <button class="btn btn-primary cf--cf-ad-c btn-sm">'.t('Add Content').' + </button> <form class="cf-course-add-cont-form"> <input type="hidden" name="param" value="save"> <input type="hidden" name="lid" value="'.$last_id.'"> <div class="cf-course-cont-type"> </div> </form> </div> <div class="p-2 cf-course-add-all cf-course-chbtn cf-course-res-container"> <div class="cf-course-res-cont "></div> <div class="cf-course-res-btn"> <button class="btn-primary btn cf--cf-ad-r btn-sm" data-id="'.$last_id.'">'.t('Add Resources').' + </button> </div> </div> <div class="p-2 cf-course-add-all cf-course-act-container"> <button data-bs-toggle="collapse" data-bs-target="#cf-course-add-res-form-'.$last_id.'" class="btn btn-primary cf--cf-ad-ac btn-sm">'.t('Manage Student Action').' </button> <form class="cf-course-manage-form collapse" id="cf-course-add-res-form-'.$last_id.'"> <input type="hidden" name="param" value="save"> <input type="hidden" name="lid" value="'.$last_id.'"> <div class="cf-course-act-type"> <div class=" mb-3"> <div class="p-2 border cf-coruse-man-user d-block"> <div class="row"> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchlc_15" name="cf-show-comment" switch="none"> <label for="switchlc_15" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Disable Comments').'</p> </div> </div> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchll_15" name="cf-show-like" switch="none"> <label for="switchll_15" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Disable Likes').'</p> </div> </div> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchla_15" name="cf-comemnt-approve" switch="none"> <label for="switchla_15" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Show Comments After Approval').'</p> </div> </div> </div> </div> </div> <div class="text-center d-flex justify-content-center"> <div class="mx-1"> <button type="button" class="btn btn-danger" data-bs-toggle="collapse" data-bs-target="#cf-course-add-res-form-'.$last_id.'" >'.t('Hide').'</button> </div> <div class="mx-1"> <button type="submit" class="btn btn-primary cf-add-l-act">'.t('Save Changes').'</button> </div> </div> </div> </form> </div> </div> </div> <div class="cfcourse-o-update p-3 my-2" style="cursor: initial;"> <form action="" class="cfcourse-add-lecture" method="" autocomplete="off"> <input type="hidden" name="part" value="save" /> <input type="hidden" name="cfcourse_lecture_action" value="update_lecture" /> <input type="hidden" name="cfcourse_lecture_id" value="'.$last_id.'" /> <input type="hidden" name="course_id" value="'.$course_id.'" /> <p class="p-1 text-primary text-center font-weight-bold">'.t('Update Lecture').'</p> <div class="mb-3 "> <label class="text-primary font-weight-bold">'.t('Title').'*</label> <div > <input type="text" required placeholder="'.t('Enter title').'" id="cf-cc-ti-edi-'.$last_id.'" value="'.$l_title.'" name="cfcourse_l_t" class="flex-2 form-control cfcourse_a_t_i" /> </div> <div class="cfcourse-title-e cfcourse-error"> </div> </div> <div class="mb-3 "> <label class="text-primary font-weight-bold">'.t('Description').'</label><span class="text-primary">('.t('optional').')</span> <textarea name="cfcourse_l_des" id="cf-cc-desc-edi-'.$last_id.'" class="cfcourse_s_t_i_des">'.( !empty( $l_desc ) ? $l_desc :"" ).'</textarea> </div> <div class="py-2 cf-course-all-error text-danger text-center"></div> <div class="text-center d-flex justify-content-center"> <div class="mx-1"> <button type="button" class="btn btn-danger btn-sm cfcourse-cancel-l-update">'.t('Cancel').'</button> </div> <div class="mx-1"> <button type="submit" class="btn btn-primary btn-sm cf-course-add-l-btn">'.t('Update Lecture').'</button> </div> </div> </form> </div> </div> <div class="cfcourse-o-a-o text-center mt-4" data-c-id="'.$course_id.'" data-s-id="'.$section_id.'"> <div class="cfcourse-a-o cfcourse-a-o-c " title="'.t('Add Content').'"><button class="btn btn-primary cfcourse-a-o cfcourse-a-o-btn"><span class="cfcourse-a-o cfcourse-a-o-text">+</span></button></div> </div>'; $htmlCon.=ob_get_clean(); return $htmlCon; } public function getLectureHtml( $l_data, $next_count = 1 ) { $last_id = $l_data['id']; $l_title = htmlspecialchars( stripslashes( $l_data['title'] ) ); $l_tle = ( ( strlen( $l_title ) > 80) ? substr( $l_title,0, 80 ).'...' : $l_title ); $l_desc = stripslashes( $l_data['description'] ) ; $course_id = $l_data["course_id"]; $section_id = $l_data["section_id"]; $l_type = $l_data['content_type']; $like_status = $l_data['like_status']; $comment_status = $l_data['comment_status']; $comment_approve = $l_data['comment_approve']; $l_cont = $l_data['content'] === null ? [] : json_decode( $l_data['content'] ,true); if( $l_type == "vu" ) { $lec_type= '<i class="fas fa-play-circle cf-courseI"></i>'; } else if( $l_type == "d" ) { $lec_type= '<i class="fas fa-file-alt"></i>'; } else if( $l_type == "y" ) { $lec_type= '<i class="fab fa-youtube cf-courseI"></i> '; } else if( $l_type == "vm" ) { $lec_type= '<i class="fab fa-vimeo cf-courseI"></i>'; } else if( $l_type == "i" ) { $lec_type= ' <i class="fas fas fa-image cf-courseI"></i>'; } else if( $l_type == "cfcourselat" ) { $lec_type= '<i class="fas fa-book-open" aria-hidden="true" ></i>'; } else { $lec_type= '<i class="fas fa-book-open" aria-hidden="true" ></i>'; } $htmlCon = ""; ob_start(); echo'<div id="cfcourse-o-t-cont-'.$last_id.'" class="cfcourse-o-t-c cf--open-lectab cfcourse-l bg-white" data-posid="'.$last_id.'" > <div class="cfcourse-o-content"> <div class="d-flex cf--c--opsrtab cf--open-lectuer p-2 justify-content-between justify-content-md-between align-items-center flex-column flex-sm-row" style="cursor: all-scroll;"> <div style="cursor: initial;" class="cf--course-stitle"> '.$lec_type.' <span style="font-weight:bold" >'.t('Lecture').'. <span class="cfcourse-l-count"></span>: </span> <span class="cfcourse-section-title" id="cf-course-content-title-'.$last_id.'"> '.$l_tle.' <span> </div> <div class="cfcourse-action p-sm-0 pt-1" style="cursor: initial;"> <div class="d-flex"> <div class="p-1 cfcourse-open-c-b" data-bs-toggle="collapse" data-bs-target="#cf-course-optop-'.$last_id.'"><button class=" cfcourse-open-c-b d-inline-block btn btn-primary" title="'.t('Open Lecture').'"> <i class="fas fa-angle-down cfcourse-o-d-arr d-inline-block cfcourse-open-c-b" ></i></button></div> <div class="p-1 cfcourse-edit-content-btn"> <button class="cfcourse-edit-content-btn d-inline-block btn btn-success" title="'.t('Edit Lecture').'"> <i class="fas fa-edit d-inline-block cfcourse-edit-content-btn"></i> </button></div> <div class="p-1 cfcourse-del-cont-btn cfcourse-del-content" data-cont-id="'.$last_id.'"><button class="cfcourse-del-content-btn btn btn-danger" title="'.t('Delete Section').'"> <i class="fas fa-trash cfcourse-del-content-btn"></i> </button></div> </div> </div> </div> <div class="cfcourse-o-o-c collapse" id="cf-course-optop-'.$last_id.'" >'; echo $this->getLectureContent( $last_id,$l_type, $l_title, $l_cont,$l_desc ); echo '<div class="p-2 cf-course-add-all cf-course-chbtn cf-course-res-container"> <div class="cf-course-res-cont ">'; echo $this->getHelpContent( $last_id,false ); echo'</div> <div class="cf-course-res-btn"> <button class="btn btn-primary cf--cf-ad-r btn-sm" data-id="'.$last_id.'" >'.t('Add Resources').' +</button> </div> </div> <div class="p-2 cf-course-add-all cf-course-act-container">'; echo $this->getContentManageAction( $last_id,$comment_status,$like_status,$comment_approve ); echo '</div> </div> </div> <div class="cfcourse-o-update p-3 my-2" style="cursor: initial;"> <form action="" class="cfcourse-add-lecture" method="" autocomplete="off"> <input type="hidden" name="part" value="save" /> <input type="hidden" name="cfcourse_lecture_action" value="update_lecture" /> <input type="hidden" name="cfcourse_lecture_id" value="'.$last_id.'" /> <input type="hidden" name="course_id" value="'.$course_id.'" /> <p class="p-1 text-primary text-center font-weight-bold">'.t('Update Lecture').' </p> <div class="mb-3 "> <label class="text-primary font-weight-bold">'.t('Title').'*</label> <div > <input type="text" required placeholder="'.t('Enter title').'" id="cf-cc-ti-edi-'.$last_id.'" value="'.$l_title.'" name="cfcourse_l_t" class="flex-2 form-control cfcourse_a_t_i" /> </div> <div class="cfcourse-title-e cfcourse-error"> </div> </div> <div class="mb-3 "> <label class="text-primary font-weight-bold">'.t('Description').'</label><span class="text-primary">('.t('optional').')</span> <textarea name="cfcourse_l_des" id="cf-cc-desc-edi-'.$last_id.'" class="cfcourse_s_t_i_des">'.( !empty( $l_desc ) ? $l_desc :"" ).'</textarea> </div> <div class="py-2 cf-course-all-error text-danger text-center"></div> <div class="text-center d-flex justify-content-center"> <div class="mx-1"> <button type="button" class="btn btn-sm btn-danger cfcourse-cancel-l-update">'.t('Cancel').'</button> </div> <div class="mx-1"> <button type="submit" class="btn btn-sm btn-primary cf-course-add-l-btn">'.t('Update Lecture').'</button> </div> </div> </form> </div> </div> <div class="cfcourse-o-a-o text-center mt-4" data-c-id="'.$course_id.'" data-s-id="'.$section_id.'"> <div class="cfcourse-a-o cfcourse-a-o-c " title="'.t('Add Content').'"><button class="btn btn-primary cfcourse-a-o cfcourse-a-o-btn"><span class="cfcourse-a-o cfcourse-a-o-text">+</span></button></div> </div>'; $htmlCon.=ob_get_clean(); return $htmlCon; } public function getLectureContent( $last_id,$l_type, $l_title, $l_cont,$l_desc ){ $des = strip_tags($l_desc ); if( strlen( $des ) + strlen( $l_title ) > 300 ) { $class="cf-course-assign-ada-ans-h cf-course-lecture-h"; $button='<a href="javascript:void(0)" class="d-inline-block pe-3 text-end cf-course-que-des-read-btn">'.t('Read More').'</a>'; }else{ $class = ''; $button = ''; } $htmlCon=''; ob_start(); echo '<div class="p-2 cf-course-add-all cf-course-cont-container " id="cf-course-cont-container-'.$last_id.'">'; if(!empty($l_type)) { echo '<div class="cf-course-show-cont"> <div class="border m-2 p-2 cf-course-show-c text-center text-sm-left">'; if( $l_type == "vu" ) { $ext = $this->getExtension( $l_cont['v_url'] ); $extension = ['mp4',"webm","ogg"]; $video_type = in_array($ext,$extension )?$ext:"mp4"; echo' <div class="row"> <div class="col-sm-3"> <div class="p-0" > <video src="'.( isset( $l_cont['v_url'] ) && !empty( $l_cont['v_url'] ) ? $l_cont["v_url"] : "").'" poster="'.( isset( $l_cont['v_thumbnail'] ) && !empty( $l_cont['v_thumbnail'] ) ? $l_cont["v_thumbnail"] : "").'" class="img-fluid img-thumbnail" style="width:100%; height:100%" type="video/'.$video_type.'" ></video> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fa-play-circle "></i> '.t('Video').' </span> <span class="cf-course-msrs-lcount">'.$this->getProperTimes($l_cont['v_h'],$l_cont['v_m'],$l_cont['v_s']).'</span> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').' </button> </div> </div>'; } else if( $l_type == "au" ) { $ext = $this->getExtension( $l_cont['a_url'] ); $extension = ['mpeg',"wav","ogg"]; $audio_type = in_array($ext,$extension )?$ext:"mpeg"; echo' <div class="row"> <div class="col-sm-3"> <div class="p-0" > <audio style="width:190px; height:69px" class="img-fluid img-thumbnail" controls="controls"> <source src="'.( isset( $l_cont['a_url'] ) && !empty( $l_cont['a_url'] ) ? $l_cont["a_url"] : "").'" type="audio/'.$audio_type.'"> </audio> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fa-headphones cf-courseI" ></i> '.t('Audio').' </span> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').' </button> </div> </div>'; } else if( $l_type == "d" ) { echo'<div class="row"> <div class="col-sm-3"> <div class="p-0 " >'; if( isset( $l_cont["doc_type"] ) && !empty( $l_cont["doc_type"] ) ): $doc_type = $l_cont['doc_type']; $doc_arr = ['ODT','ODS','HTM','HTML']; if( $doc_type =="ppt" ): echo' <div class="img-fluid img-thumbnail mb-1 p-3"> <center><i class="fas fa-file-powerpoint" style="font-size: 105px; opacity: 0.8;"></i></center> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fa-file-powerpoint cf-courseI"></i> Powerpoint '.t('File').' </span> </div>'; elseif( in_array(strtoupper( $doc_type ), $doc_arr ) ): echo' <div class="img-fluid img-thumbnail mb-1 p-3"> <center><i class="fas fa-file" style="font-size: 105px; opacity: 0.8;"></i></center> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fa-file cf-courseI"></i> '.ucfirst($doc_type).' '.t('File').' </span> </div>'; else: echo ' <div class="img-fluid img-thumbnail mb-1 p-3"> <center><i class="fa fa-file-'.$doc_type.'" aria-hidden="true" style="font-size: 105px; opacity: 0.8;"></i></center> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fa fa-file-'.$doc_type.' cf-courseI"></i> '.ucfirst($doc_type).' '.t('File').' </span> </div>'; endif; endif; echo '</div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').'</button> </div> </div>'; } else if( $l_type == "y" ) { $y_id = isset( $l_cont['y_id'] ) && !empty( $l_cont['y_id'] ) ? $l_cont["y_id"] : "Cs8k4NPoBk"; $y_thumnail = "https://i.ytimg.com/vi_webp/".$y_id."/mqdefault.webp"; echo'<div class="row"> <div class="col-sm-3"> <div class="p-0" > <div class="img-fluid img-thumbnail mb-1" style="height:113px;"> <img src="'.$y_thumnail.'" style="height: 100%; width:100%;"/> <!--<iframe src="https://www.youtube.com/embed/" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>--> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fab fa-youtube cf-courseI"></i> '.t('Youtube').' </span> <span class="cf-course-msrs-lcount">'.$this->getProperTimes($l_cont['y_h'],$l_cont['y_m'],$l_cont['y_s']).'</span> </div> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').' </button> </div> </div>'; } else if( $l_type == "vm" ) { $v_id = ( isset( $l_cont['vm_id'] ) && !empty( $l_cont['vm_id'] ) ? $l_cont["vm_id"] : "6363388"); $v_thumnail = "https://vumbnail.com/".$v_id.".jpg"; echo'<div class="row"> <div class="col-sm-3"> <div class="p-0 "> <div class="img-fluid img-thumbnail mb-1" style="height:113px;"> <img src="'.$v_thumnail.'" style="height: 100%; width:100%;"/> <!--<iframe src="https://player.vimeo.com/video/" style="height: 100%; width:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>--> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fab fa-vimeo cf-courseI"></i> '.t('Vimeo').' </span> <span class="cf-course-msrs-lcount">'.$this->getProperTimes($l_cont['vm_h'],$l_cont['vm_m'],$l_cont['vm_s']).'</span> </div> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').'</button> </div> </div>'; } else if( $l_type == "i" ) { echo'<div class="row"> <div class="col-sm-3"> <div class="p-0"> <div class="img-fluid img-thumbnail mb-1" style="height:127x; overflow:hidden"> <center><i class="fas fa-image" aria-hidden="true" style="font-size: 105px; opacity: 0.8;"></i></center> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fas fa-image cf-courseI"></i> '.t('Image File').' </span> </div> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').' </button> </div> </div>'; }else if( $l_type == "cfcourselat" ) { echo'<div class="row"> <div class="col-sm-3"> <div class="p-0"> <div class="img-fluid mb-1 img-thumbnail p-3"> <center><i class="fa fa-file-alt" aria-hidden="true" style="font-size: 105px; opacity: 0.8;"></i></center> </div> <div class="cf-course-change-size border p-1 rounded"> <span class="cf-course-msrs-lcount text-primary"> <i class="fas fas fa-file-alt cf-courseI"></i> '.t('Article').' </span> </div> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Edit Content').' </button> </div> </div>'; }else { echo'<div class="row"> <div class="col-sm-3"> <div class="p-0 "> <div class="img-fluid img-thumbnail p-3"> <center><i class="fas fa-book-open" aria-hidden="true" style="font-size: 5em; opacity: 0.8;"></i></center> </div> </div> </div> <div class="col-sm-9"> <div class="p-0 cfcourse-f-f mb-2" > <div class="position-relative cfcourse-f-lec-desc"> <div class="'.$class.' "> <span class="cfcourse-f-f-title" id="cf-course-conbot-title-'.$last_id.'">'.$l_title.'</span> <div class="cfcourse-f-f-t " id="cf-course-content-des-'.$last_id.'">'; if( !empty($l_desc) ){echo $l_desc;} echo'</div> </div>'; echo $button.' </div> </div> <button class="btn cf--cf-ad-c-e cf--cf-ad-c btn-primary btn-sm" data-id="'.$last_id.'">'.t('Add Content').' </button> </div> </div>'; } echo '</div></div> <form class="cf-course-add-cont-form"> <input type="hidden" name="param" value="update"> <input type="hidden" name="lid" value="'.$last_id.'"> <div class="cf-course-cont-type"> </div> </form> <hr />'; }else{ echo '<button class="btn-primary btn cf--cf-ad-c btn-sm">'.t('Add Content').' + </button> <form class="cf-course-add-cont-form"> <input type="hidden" name="param" value="save"> <input type="hidden" name="lid" value="'.$last_id.'"> <div class="cf-course-cont-type"> </div> </form>'; } echo'</div>'; $htmlCon.=ob_get_clean(); return $htmlCon; } public function getContentManageAction( $last_id,$comment_status,$like_status,$comment_approve ){ $htmlCon=""; ob_start(); echo '<button data-bs-toggle="collapse" data-bs-target="#cf-course-add-res-form-'.$last_id.'" class="btn btn-primary cf--cf-ad-ac btn-sm">'.t('Manage Student Action').' +</button> <form class="cf-course-manage-form collapse" id="cf-course-add-res-form-'.$last_id.'"> <input type="hidden" name="param" value="save"> <input type="hidden" name="lid" value="'.$last_id.'"> <div class="cf-course-act-type"> <div class=" mb-3"> <div class="p-2 border cf-coruse-man-user d-block"> <div class="row"> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchlc_'.$last_id.'" name="cf-show-comment" '.( ($comment_status==1) ? "checked":"" ).' switch="none" /> <label for="switchlc_'.$last_id.'" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Disable Comments').'</p> </div> </div> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchll_'.$last_id.'" name="cf-show-like" '.( ($like_status==1) ? "checked":"" ).' switch="none" /> <label for="switchll_'.$last_id.'" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Disable Likes').'</p> </div> </div> <div class="col-sm-12"> <div class="d-flex justify-content-start"> <p class="cf-course--disbale pt-1"> <input type="checkbox" id="switchla_'.$last_id.'" name="cf-comemnt-approve" '.( ($comment_approve==1) ? "checked":"" ).' switch="none" /> <label for="switchla_'.$last_id.'" data-on-label="'.t('ON').'" data-off-label="'.t('OFF').'"></label> </p> <p class="pt-1 ps-2 text-primary" style="font-weight:500; font-size:16px !important">'.t('Show Comments After Approval').'</p> </div> </div> </div> </div> </div> <div class="text-center d-flex justify-content-center"> <div class="mx-1 "> <button type="button" class="btn btn-danger btn-sm cf--cf-can-ac" data-bs-toggle="collapse" data-bs-target="#cf-course-add-res-form-'.$last_id.'" >'.t('Hide').'</button> </div> <div class="mx-1"> <button type="submit" class="btn btn-primary btn-sm cf-add-l-act">'.t('Save Changes').'</button> </div> </div> </div> </form>'; $htmlCon.=ob_get_clean(); return $htmlCon; } public function validateContent( $contents = null, $type=0 ){ global $mysqli; foreach ( $contents as $key => $content ) { $key = $mysqli->real_escape_string( $key ); if( $type == "cfcourselat") { if( $key == "art" ) { if( !empty( $content['txt'] ) ) { return $contents['art']; }else{ echo json_encode( array( "status"=>0, "type"=>"art_txt","message"=>"Please fill this field" ) ); die(); } } } else if( $type == "y" ) { if( $key =="you" ) { if( empty( $content['y_id'] ) ) { echo json_encode( array( "status"=>0, "type"=>"you_id","message"=>"Please enter video Id/URL" ) ); die(); }else{ if(preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $content['y_id'], $match)) { $contents['you']['y_id']=$match[1]; } return $contents['you']; } } }else if( $type == "vm" ) { if( $key =="vm" ) { if( empty( $content['vm_id'] ) ) { echo json_encode( array( "status"=>0, "type"=>"vm_id","message"=>"Please enter video Id/URL" ) ); die(); }else{ $regs = array(); $id = ''; if (preg_match('%^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)(?:[?]?.*)$%im', $content['vm_id'], $regs)) { $contents['vm']['vm_id']=$regs[3]; } return $contents['vm']; } } }else if( $type == "vu" ) { if( $key =="v" ) { if( empty ( $content['v_url'] ) ) { echo json_encode( array( "status"=>0, "type"=>"v_url","message"=>"Please enter url" ) ); die(); }else{ return $contents['v']; } } } else if( $type == "au" ) { if( $key =="a" ) { if( empty ( $content['a_url'] ) ) { echo json_encode( array( "status"=>0, "type"=>"v_url","message"=>"Please enter url" ) ); die(); }else{ return $contents['a']; } } }else if( $type == "i" ) { if( $key =="img" ) { if( empty ( $content['i_url'] ) ) { echo json_encode( array( "status"=>0, "type"=>"i_url","message"=>"Please enter url" ) ); die(); }else{ return $contents['img']; } } } else if( $type == "if" ) { if( $key =="iframe" ) { if( empty ( $content['iframe_code'] ) ) { echo json_encode( array( "status"=>0, "type"=>"iframe_code","message"=>"Please enter iframe code" ) ); die(); }else{ return $contents['iframe']; } } } else if( $type == "d" ) { if( $key == "doc"){ if( empty( $content['doc_type'] ) ) { echo json_encode( array( "status"=>0, "type"=>"d_type","message"=>"Please choose document type" ) ); die(); }else if( empty( $content['doc_url'] )) { echo json_encode( array( "status"=>0, "type"=>"d_url","message"=>"Please enter url" ) ); die(); }else{ return $contents['doc']; } } } } die(); } public function getHelpContent( $content_id=false,$res_id =false){ global $mysqli; global $dbpref; $table = $dbpref."content_resource"; if($res_id){ $sql = "SELECT * FROM `".$table."` WHERE `id`=".$res_id; } if($content_id){ $sql = "SELECT * FROM `".$table."` WHERE `content_id`=".$content_id; } $h_r = $mysqli->query($sql); $htmlCon=""; if( $h_r->num_rows > 0 ): ob_start(); while( $h_ds = $h_r->fetch_assoc() ): echo '<div id="cf-course-resource-con-'.$h_ds['id'].'">'; if( $h_ds['resource_type']=="d" ) {echo'<div class="cf-course-lextr d-flex justify-content-between p-1" > <div><i class="fas fa-download text-primary"></i> <span>'.htmlentities($h_ds["text"]).' </span></div> <div><button class="btn btn-danger text-white cf-course-del-res-t" data-id="'.$h_ds['id'].'"><i class="fas fa-trash cf-course-del-res-t" data-id="'.$h_ds['id'].'"></i></button></div> </div>'; } if( $h_ds['resource_type']=="v" ) {echo'<div class="cf-course-lextr d-flex justify-content-between p-1" id="cf-course-resource-con-'.$h_ds['id'].'"> <div><i class="fas fa-eye text-primary"></i> <span>'.htmlentities($h_ds["text"]).' </span></div> <div><button class="btn btn-danger text-white cf-course-del-res-t" data-id="'.$h_ds['id'].'"><i class="fas fa-trash cf-course-del-res-t" data-id="'.$h_ds['id'].'"></i></button></div> </div>'; } if( $h_ds['resource_type']=="l" ) {echo'<div class="cf-course-lextr d-flex justify-content-between p-1" id="cf-course-resource-con-'.$h_ds['id'].'"> <div><i class="fas fa-link text-primary"></i> <span>'.htmlentities($h_ds["text"]).' </span> </div> <div><button class="btn btn-danger text-white cf-course-del-res-t" data-id="'.$h_ds['id'].'"><i class="fas fa-trash cf-course-del-res-t" data-id="'.$h_ds['id'].'"></i></button></div> </div> '; } echo "<hr class='my-1' /></div>"; endwhile; $htmlCon.=ob_get_clean(); endif; return $htmlCon; } public function getContentData( $course_id = null, $section_id = null, $option_id=null ) { global $mysqli; global $dbpref; $table = $dbpref."content_options"; if( !empty( $option_id ) || $option_id != null ) { $op_id = $mysqli->real_escape_string( $option_id ); $sql="SELECT * FROM `".$table."` WHERE `course_id`=$course_id AND `section_id`=$section_id AND `id`=".$option_id; }else{ $sql = "SELECT * FROM `".$table."` WHERE `course_id`=$course_id AND `section_id`=$section_id ORDER BY `display_order` ASC "; } $result = $mysqli->query( $sql ); $r_d = []; if( $result->num_rows > 0 ) { while( $s_data = $result->fetch_assoc()) { $r_d[] = $s_data; } return $r_d; }else{ return []; } } function addWatched( $odata ) { global $mysqli; global $dbpref; $table = $dbpref."member_progress"; $oid = (int)$mysqli->real_escape_string( trim( $odata['op_id'] ) ); $m_id = (int)$mysqli->real_escape_string( trim( $odata['m_id'] ) ); $sid = (int)$mysqli->real_escape_string( trim( $odata['s_id'] ) ); $cid = (int)$mysqli->real_escape_string( trim( $odata['c_id'] ) ); $watch_c = $mysqli->real_escape_string( trim( $odata['watc'] ) ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($m_id); $mid = $mem_data['mid']; if( $watch_c == 0 ) { $stmt1 = $mysqli->query( "UPDATE `".$table."` SET `progress`=$watch_c WHERE `option_id`=$oid AND `member_id`=".$mid ) ? 1 : -1; if( $stmt1 ){ $stmt = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=$oid AND `member_id`=".$mid ); if( $stmt->num_rows > 0 ) { $countss = self::getAllWatched( $cid, $sid, $mid ); if( $countss ) { echo json_encode( array( "status"=>1, "type"=>"up", "counts"=> $countss, "message"=>"count UPDATE successfully") ); }else{ echo json_encode( array( "status"=>1, "type"=>"up", "counts"=> "0", "message"=>"count update successfully") ); } die(); }; } } else if( $watch_c == 1 ) { $stmt = $mysqli->query("SELECT * FROM `".$table."` WHERE `option_id`=$oid AND `member_id`=".$mid ); if( $stmt->num_rows > 0 ) { $stmt1 = $mysqli->query( "UPDATE `".$table."` SET `progress`=$watch_c WHERE `option_id`=$oid AND `member_id`=".$mid ) ? 1 : -1; $countss = self::getAllWatched( $cid, $sid, $mid ); if( $countss ) { echo json_encode( array( "status"=>1, "type"=>"add", "counts"=> $countss, "message"=>"count UPDATE successfully") ); }else{ echo json_encode( array( "status"=>1, "type"=>"add", "counts"=> "0", "message"=>"count update successfully") ); } die(); }else{ $total_count = getTotalCount($table); $site_token_for_dashboard=get_option('site_token'); if($_SESSION['user_plan_type' . $site_token_for_dashboard] ==2 && $total_count >= 5) { $affected_rows = 0; } else { $stmt = $mysqli->query( "INSERT INTO `".$table."`( `course_id`, `section_id`, `option_id`, `member_id`, `progress`) VALUES ( $cid, $sid, $oid, $mid, $watch_c )"); $affected_rows = $mysqli->affected_rows; } if( $affected_rows == 1 ){ $countss = self::getAllWatched( $cid, $sid, $mid ); if( $countss ) { echo json_encode( array( "status"=>1, "type"=>"add", "counts"=> $countss, "message"=>"count added successfully") ); }else{ echo json_encode( array( "status"=>1, "type"=>"add", "counts"=> "0", "message"=>"count added successfully") ); } die(); } } } } function getAllWatched( $c_id , $s_id, $mid ) { global $mysqli; global $dbpref; $table = $dbpref."member_progress"; $watched = 1; $qr1 = "SELECT COUNT(*) as total_watched FROM `".$table."` WHERE `course_id`=$c_id AND `section_id`=$s_id AND `member_id`=$mid AND `progress`=".$watched; $stmt1 = $mysqli->query( $qr1 ); if( $stmt1->num_rows > 0 ) { $counts = $stmt1->fetch_assoc(); return $counts['total_watched']; }else{ return false; } } function addNotes( $ndata ) { global $mysqli; global $dbpref; $table = $dbpref."option_notes"; $m_action = $mysqli->real_escape_string( trim( $ndata['m_action'] ) ); if( $m_action == "save" ) { $nonce = $mysqli->real_escape_string( trim( $ndata['cfc_notes_nonce'] ) ); $mid = (int) cf_enc( $mysqli->real_escape_string( trim( $ndata['cf-course-l-memId'] ) ),"decrypt" ); $ntime = $mysqli->real_escape_string( trim( $ndata['cf-course-l-ntime'] ) ); $notes = $mysqli->real_escape_string( trim( $ndata['cf-course-l-notes'] ) ); $action = $mysqli->real_escape_string( trim( $ndata['a_action'] ) ); $oid = (int)cf_enc( $mysqli->real_escape_string( trim( $ndata['cf-course-oid'] ) ),"decrypt" ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mid); $mid = $mem_data['mid']; $name = $mem_data['name']; $email = $mem_data['email']; $is_ad = $mem_data['is_ad']; $reply = "not"; $readed = $mem_data['readed']; $notess = base64_encode($notes); $time = date("Y-m-d H:i:s"); if( $action == "save" ) { $theme = $mysqli->real_escape_string( trim( $ndata['theme'] ) ); $sid = (int)cf_enc( $mysqli->real_escape_string( trim( $ndata['cf-course-sid'] ) ),"decrypt" ); $cid = (int)cf_enc( $mysqli->real_escape_string( trim( $ndata['cf-course-cid'] ) ),"decrypt" ); $type = $mysqli->real_escape_string( trim( $ndata['type'] ) ); $course_url = $mysqli->real_escape_string( trim( $ndata['url'] ) ); $get_url = base64_encode(json_encode([ "course_id"=>$cid,"section_id"=>$sid,"type"=>$type,"option_id"=>$oid])); $course_url .= "?cf_vid=".$get_url; if( !cf_verify_nonce( $nonce, 'cfc_notes_nonce' ) ){ echo json_encode( array( "status"=>0, "data" => "Resourcedd Not Varified") ); die(); } $add_sql = "INSERT INTO `".$table."`(`member_id`,`course_id`,`section_id`, `url`, `name`, `email`, `notes`, `notes_time`, `is_admin`, `option_id`,`reply`,`readed`,`created_at`) VALUES ($mid,$cid,$sid,'".$course_url."', '".$name."','".$email."','".$notess."','".$ntime."',$is_ad,$oid,'".$reply."', $readed,'".$time."')"; $total_count = getTotalCount($table); $site_token_for_dashboard=get_option('site_token'); if($_SESSION['user_plan_type' . $site_token_for_dashboard] ==2 && $total_count >= 5) { $affected_rows = 0; } else { $r_add = $mysqli->query( $add_sql ); $affected_rows = $mysqli->affected_rows; } if( $affected_rows == 1 ){ $last_id = $mysqli->insert_id; if( $theme=="a" ) { $data = self::getContentNotesA( $oid, $mid ,$last_id, "one" ); }elseif( $theme=="b" || $theme=="c" ) { $data = self::getContentNotesB( $oid, $mid ,$last_id, "one" ); } echo json_encode( array( "status"=>1, 'type'=>"add", "data" => $data ) ); if( get_option('reply_note_email') && get_option('reply_note_email')==1 ) { self::sendNoteEmail( $last_id ); } die(); }else{ echo json_encode( array( "status"=>0, "data" => "data not fetched") ); die(); } die(); }else if( $action == "update" ) { $nid = (int)$mysqli->real_escape_string( trim( $ndata['cf-course-l-nid'] ) ); $nonced = $mysqli->real_escape_string( trim( $ndata['cfc_notes_nonce'] ) ); if( !cf_verify_nonce($nonced, 'cfc_notes_e_nonce'.$nid) ){ echo json_encode( array( "status"=>0, "data" => "Resource Not Varified") ); die(); } $update_sql ="UPDATE `".$table."` SET `notes`='".$notess."', `notes_time`='".$ntime."' WHERE `id`=".$nid ; $r_update = $mysqli->query($update_sql)?1:-1; if( $r_update ){ $result = $mysqli->query("SELECT * FROM `".$table."` Where `id`=".$nid); if( $result->num_rows > 0 ) { $r = $result->fetch_assoc(); $notes = stripcslashes( trim( stripcslashes( base64_decode( $r['notes'] ) ),"\r\n") ); $notes_edit = htmlentities( stripcslashes( trim( stripcslashes( base64_decode($r['notes'] ) ),"\r\n") )); echo json_encode( array( "status"=>1, 'type'=>"update", "note" =>$notes, "notes_edit"=> $notes_edit ) ); } }else{ echo json_encode( array( "status"=>0, "data" => "data not fetched") ); } die(); } }else if( $m_action == "delete" ) { $nid = (int)cf_enc($mysqli->real_escape_string( trim( $ndata['nid'] ) ),"decrypt"); $del_sql= "DELETE FROM `".$table."` WHERE `id`=".$nid ; $mysqli->query( $del_sql ); if( $mysqli->affected_rows == 1 ){ echo json_encode( array( "status"=>1, "message"=>"noted deleted successfully",'nid'=>$nid) ); }else{ echo json_encode( array( "status"=>0, "message"=>"count deleted successfully",'nid'=>$nid) ); } die(); } } function addComment( $cdata ) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; $action = $mysqli->real_escape_string( trim( $cdata['param'] ) ); $nonce = $mysqli->real_escape_string( trim( $cdata['cfc_comment_nonce'] ) ); if( $action == "save" ) { $reply = $mysqli->real_escape_string( trim( $cdata['reply'] ) ); $theme = $mysqli->real_escape_string( trim( $cdata['theme'] ) ); $from = $mysqli->real_escape_string( trim( $cdata['from'] ) ); $type = $mysqli->real_escape_string( trim( $cdata['type'] ) ); $course_url = $mysqli->real_escape_string( trim( $cdata['url'] ) ); $oid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['oid'] ) ), "decrypt" ); $mid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['mid'] ) ), "decrypt" ); $sid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['cf-course-sid'] ) ),"decrypt" ); $cid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['cf-course-cid'] ) ),"decrypt" ); $comments = $mysqli->real_escape_string( htmlspecialchars(trim( strip_tags($cdata['comment'],"<b>") )) ); $get_url = base64_encode(json_encode([ "course_id"=>$cid,"section_id"=>$sid,"type"=>$type,"option_id"=>$oid])); $course_url .= "?cf_vid=".$get_url; if($reply=="no") { if( !cf_verify_nonce($nonce, 'cfc_comment_nonce') ){ echo json_encode( array( "status"=>0, "data" => "Resource Not Varified") ); die(); } } $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mid); $mid = $mem_data['mid']; $name = $mem_data['name']; $email = $mem_data['email']; $is_ad = $mem_data['is_ad']; $c_app = $mem_data['c_app']; $time = date("Y-m-d H:i:s"); if($c_app==-1) { if( get_option('comment_approve') ==1 ) { $c_app =-1; }else{ $status = self::getStatusOfContent( $oid, "comment" ); if( $status['comment_approve'] ==1 ) { $c_app =-1; }else{ $c_app =1; } } } if( $reply=="yes" ) { $com_id = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['comment_id'] ) ),"decrypt" ); if($from=="u!^rr" || $from=="")// this is come form user area { $add_sql = "INSERT INTO `".$table."`(`member_id`,`course_id`,`section_id`,`url`,`type`, `name`, `email`, `comment`, `option_id`,`is_admin`,`approve`,`reply`,`reply_parent_id`,`readed`,`created_at`) VALUES ($mid, $cid, $sid,'".$course_url."','".$type."','".$name."','".$email."','".$comments."',$oid,$is_ad, $c_app,'yes', $com_id ,0,'".$time."')"; } elseif($from=="a!^dd") // this is come from admin area { $add_sql = "INSERT INTO `".$table."`(`member_id`,`course_id`,`section_id`,`url`,`type`, `name`, `email`, `comment`, `option_id`,`is_admin`,`approve`,`reply`,`reply_parent_id`,`readed`,`created_at`) VALUES ($mid, $cid, $sid,'".$course_url."','".$type."','".$name."','".$email."','".$comments."',$oid,$is_ad, $c_app,'yes', $com_id ,1,'".$time."')"; } }elseif($reply=="no"){ $com_id=0; $add_sql = "INSERT INTO `".$table."`(`member_id`,`course_id`,`section_id`, `url`,`type`,`name`, `email`, `comment`, `option_id`,`is_admin`,`approve`,`reply`,`created_at`) VALUES ($mid, $cid, $sid,'".$course_url."','".$type."','".$name."','".$email."','".$comments."',$oid , $is_ad, $c_app,'no','".$time."')"; } $total_count = getTotalCount($table); $site_token_for_dashboard=get_option('site_token'); if($_SESSION['user_plan_type' . $site_token_for_dashboard] ==2 && $total_count >= 5) { $affected_rows = 0; } else { $r_add = $mysqli->query( $add_sql ); $affected_rows = $mysqli->affected_rows; } if( $affected_rows == 1 ){ $adminT = ($is_ad==1)?"admin":"not"; $last_id = isset($mysqli->insert_id) ? $mysqli->insert_id : 0; if($from=="u!^rr" || $from=="")// this will go back user area { if( $reply=="no" ){ if( $theme=="a" ) { $data = self::getContentCommentA( $oid, $mid ,$last_id, "one","0" ); }elseif( $theme=="b" || $theme=="c" ) { $data = self::getContentCommentB( $oid, $mid ,$last_id, "one","0" ); } }elseif( $reply=="yes" ){ if( $theme=="a" ) { $data = self::getContentCommentReplyA($oid, $com_id, $mid ,$adminT, "one",$last_id ); }elseif( $theme=="b" || $theme=="c" ) { $data = self::getContentCommentReplyB($oid, $com_id, $mid ,$adminT, "one",$last_id ); } } } elseif($from=="a!^dd") // this will go back user admin area { $data = self::getCommentData( $last_id ); } echo json_encode(array( "status"=>1, 'type'=>"add", "reply"=>$reply, "data" => $data,'commId'=>$com_id,"reply_id"=>$last_id )); //if send reply mail is on then send email to student if( get_option('reply_comment_email') && get_option('reply_comment_email')==1 ) { self::sendCommentEmail( $last_id,$adminT,$reply ); } }else{ echo json_encode( array( "status"=>0, "data" => "data not afetchedd") ); } die(); } else if( $action == "update" ) { $comments = $mysqli->real_escape_string( htmlspecialchars(trim( $cdata['comment'] )) ); $from = $mysqli->real_escape_string( trim( $cdata['from'] ) ); $edit = "yes"; $cid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['comment_id'] ) ),"decrypt" ); $update_sql = "UPDATE `".$table."` SET `comment`='".$comments."', `edit`='".$edit."' WHERE `id`=".$cid; $r_update = $mysqli->query( $update_sql ) ? 1:-1; if( $r_update ){ $result = $mysqli->query("SELECT * FROM `".$table."` Where `id`=".$cid); if( $result->num_rows > 0 ) { $r = $result->fetch_assoc(); $fcom = htmlspecialchars_decode(stripcslashes( str_ireplace(array( "\r"), "<br/>", $r['comment'] ) )); $fcom_edit = stripcslashes( str_ireplace(array( "\r"), "<br/>", $r['comment'] ) ); $times = strtotime( $r['created_at'] ); $current_time = time(); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); if($from=="u!^rr")//user side, i take this "u!^rr" data for security { echo json_encode( array( "status"=>1, 'type'=>"update", "comment" =>$fcom, "comid"=>$cid, "comment_edit"=> $fcom, "times" => $times_ago ) ); } elseif($from=="a!^dd")//admin side, i take this "a!^dd" data for security { echo json_encode( array( "status"=>1, 'type'=>"update", "data" => $cdata, ) ); } }else{ echo json_encode( array( "status"=>0, "data" => "data not fetched") ); } }else{ echo json_encode( array( "status"=>0, "data" => "data not fetched") ); } die(); }else if( $action == "delete" ) { $cid = (int)cf_enc( $mysqli->real_escape_string( trim( $cdata['cid'] ) ),"decrypt" ); $del_sql= "DELETE FROM `".$table."` WHERE `id`=".$cid ; $mysqli->query( $del_sql ); if( $mysqli->affected_rows == 1 ){ echo json_encode( array( "status"=>1, "message"=>"comment deleted successfully","cid"=>$cid) ); }else{ echo json_encode( array( "status"=>0, "message"=>"comment not deleted successfully","cid"=>$cid) ); } die(); } } /* Theme a Start*/ public function getContentNotesA( $option_id, $m_id, $last_id=0 , $fetc=0 ) { global $mysqli; global $dbpref; $table = $dbpref."option_notes"; if( $fetc == "all" ) { $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=$option_id ORDER BY `id` DESC" ); } else if( $fetc == "one" ) { $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `id`=".$last_id ); } if( $result->num_rows > 0 ) { $htmlCon = ''; while ( $r = $result->fetch_assoc() ) { $email = $r['email']; $notes = stripcslashes(base64_decode($r['notes'])); $notes_edit = htmlentities( stripcslashes(base64_decode($r['notes']))) ; $notes = $mysqli->real_escape_string($notes); $notes = str_ireplace(array( "\\r\\n"), "<br/>", $notes); $image = self::cfCourse_get_gravatar_image( $email ); $not = strip_tags($notes); if( strlen( $not ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($m_id); $mem_id = $mem_data['mid']; $nonce = cf_create_nonce("cfc_notes_e_nonce".$r["id"]); $option_id = cf_enc( $option_id , "encrypt"); $enn_id = cf_enc( $r['id'] , "encrypt"); $em_id = cf_enc( $mem_id, "encrypt" ); if( $mem_data['is_ad']==1 || $r['member_id']==$mem_id ) { $htmlCon.='<div class="cf-course-com-c" id="cf-course-notes-c-'.$r['id'].'"> <div class="d-flex"> <div class="cf-course-com-i py-2 pt-3"> <div class="cf-course-img"> <img src="'.$image.'"> </div> </div> <div class="cf-cousre-not-con ps-0 ps-sm-2"> <div class="cf-course-ncont p-2"> <div class="cf-course-user-d"> <span class="cf-course-name">'.$r['name'].'</span> <div><time class=" d-inline-block px-2 py-1 badge badge-primary cf-course-notes-ti">'.$r['notes_time'].'</time></div> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-nt-c b--cf--note '.$class.' c--cf--note d--cf--note pt-1"> '.$notes.'</div> '.$button.' </div> <div class="cf-course-user-d d-flex"> <div class="me-2"> <time class="cf-course-time ">'.$times_ago.'</time> </div>'; if( $r['member_id'] == $mem_id ) { $htmlCon .='<div> <span class="cf-course-action-notes cf-course-edit-notes me-1" title="Edit Note"> <i class="fas fa-edit cf-course-edit-notes"></i> </span> <span data-id="'.$enn_id.'" title="Delete Note" class="cf-course-action-notes cf-course-del-notes"> <i data-id="'.$enn_id.'" class="fas fa-trash cf-course-del-notes"></i> </span> </span> <span > </div>'; } $htmlCon.='</div> </div> </div> <div class="cf-course-note-edit py-2"> <form action="" method="post" class="cf-course-notes-form"> <input type="hidden" name="cf-course-l-memId" value="'.$em_id.'" /> <input type="hidden" class="cf-course-l-ntime" name="cf-course-l-ntime" value="'.$r['notes_time'].'" /> <input type="hidden" name="cf-course-oid" value="'.$option_id.'" /> <input type="hidden" name="a_action" value="update" /> <input type="hidden" name="cf-course-l-nid" value="'.$r['id'].'" /> <input type="hidden" name="cfc_notes_nonce" value="'.$nonce.'" /> <div class="mb-3"> <label class="font-weight-bold">Notes</label> <span class=" d-inline-block px-2 py-1 badge badge-primary cf-course-notes-ti">'.$r['notes_time'].'</span> <textarea name="cf-course-l-notes" rows="3" class="form-control cf-course-ed-notes">'.$notes_edit.'</textarea> </div> <div class="mb-3"> <div class="float-right"> <button type="button" class="btn btn-danger cf-course-ed-notes-cancel" >Cancel</button> <button type="submit" class="btn btn-success "> Update Note </button> </div> </div> </form> </div> </div> </div><hr /> </div>'; } } return $htmlCon; } return '<p class="text-center cf--no-notea">Currently There Are No Notes Available</P>'; } public function getContentCommentRow( $option_id) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=".$option_id ); return $result->num_rows; } public function getContentCommentA( $option_id, $mem_id=0, $last_id=0 , $fetc=0 ) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mem_id); $mem_id = $mem_data['mid']; $admin = $mem_data['admin']; if( $fetc == "all" ) { $sql= "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `reply`='no' ORDER BY `id` DESC"; $result = $mysqli->query( $sql ); } else if( $fetc == "one" ) { $sql= "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `reply`='no' AND `id`=$last_id ORDER BY `id` DESC"; $result = $mysqli->query( $sql ); } if( $result->num_rows > 0 ) { $htmlCon = ''; ob_start(); while( $r = $result->fetch_assoc() ) { $total=0; $comid = $r['id']; //get all reply related to parent id $sqlr= "SELECT COUNT(*) `total_reply` FROM `".$table."` WHERE `reply`='yes' AND `approve`=1 AND `reply_parent_id`=".$comid; $resultr = $mysqli->query( $sqlr ); $reply = $resultr->fetch_assoc(); $total = $reply['total_reply']; if( $total == 1 && $total != 0 ) { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'">'.$total.'</span> Reply </a>'; } elseif( $total > 1 ) { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'">'.$total.'</span> Replies </a>'; } else { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" style="display:none" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'"></span> Reply </a>'; } $email = $r['email']; $comment = htmlspecialchars_decode(stripcslashes($mysqli->real_escape_string($r['comment']) ) ); $comment_edit = stripcslashes($r['comment']); $comment = str_ireplace(array( "\r"), "<br/>", $comment); $image = self::cfCourse_get_gravatar_image( $email ); $is_ad = $r['is_admin']; $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); $comm = strip_tags($comment); if( strlen( $comm ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } if($r['approve']==1) { echo $mem_id."=".$r['member_id']; echo' <div class="cf-course-com-c cf-course-cdel-'.$comid.' my-4" id="cf-course-cdel-'.$comid.'"> <div class="d-flex cf-course-com-cbrk " > <div class="cf-course-com-i py-2"> <div class="cf-course-img"> <img src="'.$image.'" classs="img-thumbnail" /> </div> </div> <div class="cf-cousre-com-con c-f--d-did text-start pt-2 pb-1 ps-2"> <div class="cf-course-comment-hide c-f--d-did"> <div class="c-f--d-did cf-course-user-d"> <span class="c-f--d-did cf-course-name">'.$r['name'].'</span>'; if($is_ad==1){ echo '<span class="text-primary" style="font-size:11px;"> <i style="padding-left:1px;" class=" fa fa-check" aria-hidden="true"></i> </span>'; } echo '<time class="cf-course-time ps-1 c-f--d-did"> '.$times_ago.'</time>'; if( $mem_id == $r['member_id'] || $admin=="admin" ) { echo '<span class="c-f--d-did c-f--com-ac-el "><i class="fas ps-2 c-f--com-ac-el c-f--d-did fa-ellipsis-v"></i> <div id="cfCourse-context-menu-'.cf_enc($comid,"encrypt").'" class="cf--cc--ddc"> <input type="hidden" value="'.$comment_edit.'" class="c-f--d-did cf-course-cd-text" id="cf-course-cedit-text'.$comid.'" /> <input type="hidden" value="'.cf_enc($comid,"encrypt").'" class="c-f--d-did cf-course-cd-id" id="cf-course-cedit-id'.$comid.'" /> <a href="javascript:void(0)" class="cf-course-edit-comment" data-id="'.cf_enc($comid,"encrypt").'" data-encid="'.$comid.'" >Edit</a> <a href="javascript:void(0)" class="cf-course-del-comment" data-id="'.cf_enc($comid,"encrypt").'" >Remove</a> </div> </span> <div class="cf-course-cmm-d d-flex c-f--d-did text-start" data-check="comment" data-id="'.cf_enc($comid,"encrypt").'"> </div>'; } echo '</div> <div class="cf-course-comments b--cf--cmnts c--cf--cmnts d--cf--cmnts c-f--d-did w-100"> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-u-c b--cf--ucmnts '.$class.' c--cf--ucmnts d--cf--ucmnts cf-com--change-'.$comid.' c-f--d-did" id="cf-course-cdom-text'.$comid.'">'.$comment.'</div> '.$button.' </div> </div> </div>'; echo self::getCommentLikeDislikeA( $comid,$mem_id,$r['name'],$option_id,$comid ); echo '<div class="cf-coruse-com-reply-con pt-2" id="cf-coruse-com-reply-con-'.$comid.'"> '.$veiws.' <div id="cf-course-expand-reply-'.$comid.'" class="collapse">'; echo self::getContentCommentReplyA($option_id ,$comid,$mem_id,$admin,"all",0); echo '</div> </div> </div> </div> </div> '; } } $htmlCon.=ob_get_clean(); return $htmlCon; } } public function getContentCommentReplyA($option_id, $commentid=0, $mem_id=0,$admin="",$fetch="", $reply_id=0) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; //get all reply related to parent id if($fetch=="all") { $sql= "SELECT * FROM `".$table."` WHERE `reply`='yes' AND `reply_parent_id`=".$commentid; }else if($fetch=="one") { $sql= "SELECT * FROM `".$table."` WHERE `reply`='yes' AND `id`=".$reply_id; } $result = $mysqli->query( $sql ); if( $result->num_rows > 0 ) { $htmlCon = ''; ob_start(); while( $r = $result->fetch_assoc() ) { $email = $r['email']; $comment = htmlspecialchars_decode(stripcslashes($mysqli->real_escape_string($r['comment']) ) ); $comment = str_ireplace(array( "\r"), "<br/>", $comment); $comment_edit = stripcslashes(str_ireplace(array( "\r"), "<br/>", $r['comment'])); $image = self::cfCourse_get_gravatar_image( $email ); $comm = strip_tags($comment); if( strlen( $comm ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } $current_time = time(); $times = self::getTimes(strtotime( $r['created_at'] ) ); $replyId = $r['id']; $is_ad = $r['is_admin']; $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); if($r['approve']==1) { echo' <div class="cf-course-com-c cf-course-cdel-'.$replyId.' my-4" id="cf-course-cdel-'.$replyId.'"> <div class="d-flex cf-course-com-cbrk " > <div class="cf-course-com-i py-2"> <div class="cf-course-img"> <img src="'.$image.'" classs="img-thumbnail" /> </div> </div> <div class="cf-cousre-com-con c-f--d-did text-start pt-2 pb-1 ps-2"> <div class="cf-course-comment-hide c-f--d-did"> <div class="c-f--d-did cf-course-user-d"> <span class="c-f--d-did cf-course-name">'.$r['name'].'</span>'; if($is_ad==1){ echo '<span class="text-primary" style="font-size:11px;"> <i style="padding-left:1px;" class=" fa fa-check" aria-hidden="true"></i> </span>'; } echo '<time class="cf-course-time ps-1 c-f--d-did"> '.$times_ago.'</time>'; if( $mem_id == $r['member_id'] || $admin=="admin" ) { echo '<span class="c-f--d-did c-f--com-ac-el"><i class="fas ps-2 c-f--com-ac-el c-f--d-did fa-ellipsis-v"></i> <div id="cfCourse-context-menu-'.cf_enc($replyId,"encrypt").'" class="cf--cc--ddc"> <input type="hidden" value="'.$comment_edit.'" class="c-f--d-did cf-course-cd-text" id="cf-course-cedit-text'.$replyId.'" /> <input type="hidden" value="'.cf_enc($replyId,"encrypt").'" class="c-f--d-did cf-course-cd-id" id="cf-course-cedit-id'.$replyId.'" /> <a href="javascript:void(0)" class="cf-course-edit-comment" data-check="reply" data-id="'.cf_enc($replyId,"encrypt").'" data-encid="'.$replyId.'" >Edit</a> <a href="javascript:void(0)" class="cf-course-del-comment" data-id="'.cf_enc($replyId,"encrypt").'" >Remove</a> </div> </span> <div class="cf-course-cmm-d d-flex c-f--d-did text-start" data-check="reply" data-id="'.cf_enc($replyId,"encrypt").'"> </div>'; } echo '</div> <div class="cf-course-comments b--cf--cmnts c--cf--cmnts d--cf--cmnts c-f--d-did w-100"> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-u-c b--cf--ucmnts '.$class.' c--cf--ucmnts d--cf--ucmnts cf-com--change-'.$replyId.' c-f--d-did" id="cf-course-cdom-text'.$replyId.'">'.$comment.'</div> '.$button.' </div> </div> </div>'; echo self::getCommentLikeDislikeA( $replyId,$mem_id,$r['name'],$option_id,$commentid ); echo '</div> </div> </div>'; } } echo ''; $htmlCon.=ob_get_clean(); return $htmlCon; } } public function getCommentLikeDislikeA( $comid,$mid,$name,$oid,$parent_comment_id ) { global $mysqli; $mid = $mysqli->real_escape_string( $mid ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mid); $mem_id = $mem_data['mid']; $htmCon=""; ob_start(); echo ' <div class="me-2 c-f--d-did d-flex c-f--com-time c-f--com-time-'.cf_enc($comid,"encrypt").' text-start" id="'.cf_enc($comid,"encrypt").'" data-commentId="'.cf_enc($parent_comment_id,"encrypt").'" data-oid="'.cf_enc($oid,"encrypt").'" data-memid="'.cf_enc($mem_id,"encrypt").'"> <a class="ps-2 c-f--com-reply-c " data-name="'.$name.'" data-afterpress="false"> REPLY </a> </div>'; $htmCon.=ob_get_clean(); return $htmCon; } /*Theme a end */ /* Theme b start */ public function getContentNotesB( $option_id, $m_id, $last_id=0 , $fetc=0 ) { global $mysqli; global $dbpref; $table = $dbpref."option_notes"; if( $fetc == "all" ) { $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=$option_id ORDER BY `id` DESC" ); } else if( $fetc == "one" ) { $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `id`=".$last_id ); } if( $result->num_rows > 0 ) { $htmlCon = ''; while ( $r = $result->fetch_assoc() ) { $email = $r['email']; $notes = stripcslashes(base64_decode($r['notes'])); $notes_edit = htmlentities( stripcslashes(base64_decode($r['notes']))) ; $notes = $mysqli->real_escape_string($notes); $notes = str_ireplace(array( "\\r\\n"), "<br/>", $notes); $image = self::cfCourse_get_gravatar_image( $email ); $not = strip_tags($notes); if( strlen( $not ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($m_id); $mem_id = $mem_data['mid']; $nonce = cf_create_nonce("cfc_notes_e_nonce".$r["id"]); $option_id = cf_enc( $option_id , "encrypt"); $enn_id = cf_enc( $r['id'] , "encrypt"); $em_id = cf_enc( $mem_id, "encrypt" ); if( $mem_data['is_ad']==1 || $r['member_id']==$mem_id ) { $htmlCon.='<div class="cf-course-com-c" id="cf-course-notes-c-'.$r['id'].'"> <div class="d-flex"> <div class="cf-course-com-i py-2 pt-3"> <div class="cf-course-img"> <img src="'.$image.'"> </div> </div> <div class="cf-cousre-not-con ps-0 ps-sm-2"> <div class="cf-course-ncont p-2"> <div class="cf-course-user-d"> <span class="cf-course-name">'.$r['name'].'</span> <div><time class=" d-inline-block px-2 py-1 badge cf-course-notes-ti">'.$r['notes_time'].'</time></div> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-nt-c b--cf--note '.$class.' c--cf--note d--cf--note pt-1"> '.$notes.'</div> '.$button.' </div> <div class="cf-course-user-d d-flex"> <div class="me-2"> <time class="cf-course-time ">'.$times_ago.'</time> </div>'; if( $r['member_id'] == $mem_id ) { $htmlCon .='<div> <span class="cf-course-action-notes cf-course-edit-notes me-1" title="Edit Note"> <i class="fas fa-edit cf-course-edit-notes"></i> </span> <span data-id="'.$enn_id.'" title="Delete Note" class="cf-course-action-notes cf-course-del-notes"> <i data-id="'.$enn_id.'" class="fas fa-trash cf-course-del-notes"></i> </span> </span> <span > </div>'; } $htmlCon.='</div> </div> </div> <div class="cf-course-note-edit py-2"> <form action="" method="post" class="cf-course-notes-form"> <input type="hidden" name="cf-course-l-memId" value="'.$em_id.'" /> <input type="hidden" class="cf-course-l-ntime" name="cf-course-l-ntime" value="'.$r['notes_time'].'" /> <input type="hidden" name="cf-course-oid" value="'.$option_id.'" /> <input type="hidden" name="a_action" value="update" /> <input type="hidden" name="cf-course-l-nid" value="'.$r['id'].'" /> <input type="hidden" name="cfc_notes_nonce" value="'.$nonce.'" /> <div class="mb-3"> <label class="font-weight-bold">Notes</label> <span class=" d-inline-block px-2 py-1 badge cf-course-notes-ti">'.$r['notes_time'].'</span> <textarea name="cf-course-l-notes" rows="3" class="form-control cf-course-ed-notes">'.$notes_edit.'</textarea> </div> <div class="mb-3"> <div class="float-right"> <button type="button" class="btn btn-danger cf-course-ed-notes-cancel" >Cancel</button> <button type="submit" class="btn btn-success "> Update Note </button> </div> </div> </form> </div> </div> </div><hr /> </div>'; } } return $htmlCon; } return '<p class="text-center cf--no-notea">Currently There Are No Notes Available</P>'; } function getContentCommentB( $option_id, $mem_id=0, $last_id=0 , $fetc=0 ) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mem_id); $mem_id = $mem_data['mid']; $admin = $mem_data['admin']; if( $fetc == "all" ) { $sql= "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `reply`='no' ORDER BY `id` DESC"; $result = $mysqli->query( $sql ); } else if( $fetc == "one" ) { $sql= "SELECT * FROM `".$table."` WHERE `option_id`=$option_id AND `reply`='no' AND `id`=$last_id ORDER BY `id` DESC"; $result = $mysqli->query( $sql ); } $htmlCon = ''; if( $result->num_rows > 0 ) { ob_start(); while( $r = $result->fetch_assoc()) { $total=0; $comid = $r['id']; //get all reply related to parent id $sqlr= "SELECT COUNT(*) as `total_reply` FROM `".$table."` WHERE `reply`='yes' AND `approve`=1 AND `reply_parent_id`=".$comid; $resultr = $mysqli->query( $sqlr ); $reply = $resultr->fetch_assoc(); $total = $reply['total_reply']; if( $total == 1 && $total != 0 ) { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'">'.$total.'</span> Reply </a>'; } elseif( $total > 1 ) { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'">'.$total.'</span> Replies </a>'; } else { $veiws = ' <a class="cf-coruse-com-expn-b text-primary" id="cf-coruse-com-expn-b-'.$comid.'" style="display:none" data-bs-toggle="collapse" data-bs-target="#cf-course-expand-reply-'.$comid.'"> <i class="fas cf-coruse-com-expn-b pe-2 fa-caret-down"></i> View <span class="cf-course-total-reply-'.$comid.'"></span> Reply </a>'; } $email = $r['email']; $comment = htmlspecialchars_decode(stripcslashes($mysqli->real_escape_string($r['comment']) ) ); $comment = str_ireplace(array( "\r"), "<br/>", $comment); $image = self::cfCourse_get_gravatar_image( $email,50 ); $comment_edit = stripcslashes(str_ireplace(array( "\r"), "<br/>", $r['comment'])); $is_ad = $r['is_admin']; $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); $comm = strip_tags($comment); if( strlen( $comm ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } if($r['approve']==1) { echo' <div class="d-flex cf-course-com-c cf-course-feed-box-a cf-course-cdel-'.$comid.'" id="cf-course-cdel-'.$comid.'"> <div class="cf-course-com-i py-2 me-3"> <div class="cf-course-img"> <img src="'.$image.'" classs="img-thumbnail"> </div> </div> <div class="text-start cf-cousre-com-con"> <div class="d-flex justify-content-between"> <div><span class="cf-course-label-6">'.$r['name'].'</sapn>'; if($is_ad==1){ echo '<span class="text-primary" > <i class=" fa fa-check" aria-hidden="true"></i> </span>'; } echo '<span class="cf-course-time cf-course-time-a">'. $times_ago.' </span> </div>'; if( $mem_id == $r['member_id'] || $admin=="admin" ) { echo '<div><span class="c-f--d-did c-f--com-ac-el "><i class="fas c-f--com-ac-el c-f--d-did fa-ellipsis-v"></i> <div id="cfCourse-context-menu-'.cf_enc($comid,"encrypt").'" class="cf--cc--ddc"> <input type="hidden" value="'.$comment_edit.'" class="c-f--d-did cf-course-cd-text" id="cf-course-cedit-text'.$comid.'" /> <input type="hidden" value="'.cf_enc($comid,"encrypt").'" class="c-f--d-did cf-course-cd-id" id="cf-course-cedit-id'.$comid.'" /> <a href="javascript:void(0)" class="cf-course-edit-comment" data-id="'.cf_enc($comid,"encrypt").'" data-encid="'.$comid.'" >Edit</a> <a href="javascript:void(0)" class="cf-course-del-comment" data-check="comment" data-id="'.cf_enc($comid,"encrypt").'" >Remove</a> </div> </span> <div class="cf-course-cmm-d d-flex c-f--d-did text-start" data-check="comment" data-id="'.cf_enc($comid,"encrypt").'"></div></div>'; } echo' </div> <div class="cf-course-comments c-f--d-did w-100"> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-u-c '.$class.' c-f--d-did" id="cf-course-cdom-text'.$comid.'">'.$comment.'</div> '.$button.' </div> </div>'; echo self::getCommentLikeDislikeB( $comid,$mem_id,$r['name'],$option_id,$comid ); echo '<div class="cf-coruse-com-reply-con pt-2" id="cf-coruse-com-reply-con-'.$comid.'"> '.$veiws.' <div id="cf-course-expand-reply-'.$comid.'" class="collapse">'; echo self::getContentCommentReplyB($option_id ,$comid,$mem_id,$admin,"all",0); echo '</div> </div> </div> </div>'; } } $htmlCon.=ob_get_clean(); } else{ $htmlCon.='<div class="cf-course-comments-con p-1" id="cf-course-comments-con"> <div id="cf-course-to--comm-"> </div> <div class="p-2 text-center"><p class=" text-center cf--no-comment">Currently There Are No Comments Available</p></div> </div>'; } return $htmlCon; } public function getContentCommentReplyB($option_id, $commentid=0, $mem_id=0,$admin="",$fetch="", $reply_id='') { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; //get all reply related to parent id if($fetch=="all") { $sql= "SELECT * FROM `".$table."` WHERE `reply`='yes' AND `reply_parent_id`=".$commentid; }else if($fetch=="one") { $sql= "SELECT * FROM `".$table."` WHERE `reply`='yes' AND `id`=".$reply_id; } $result = $mysqli->query( $sql ); if( $result->num_rows > 0 ) { $htmlCon = ''; ob_start(); while( $r =$result->fetch_assoc() ) { $email = $r['email']; $comment = htmlspecialchars_decode(stripcslashes($mysqli->real_escape_string($r['comment']) ) ); $comment = str_ireplace(array( "\r"), "<br/>", $comment); $image = self::cfCourse_get_gravatar_image( $email,50 ); $comment_edit = stripcslashes(str_ireplace(array( "\r"), "<br/>", $r['comment'])); $image = self::cfCourse_get_gravatar_image( $email ); $comm = strip_tags($comment); if( strlen( $comm ) > 280 ) { $class="cf-course-assign-ada-ans-h cf-course-assign-ans-h-91px"; $class1="mb-3"; $button='<a href="javascript:void(0)" style="font-size:0.9em" class="d-inline-block cf-course-label-5 cf-course-assign-ada-btn">Read More</a>'; }else{ $class = ''; $button = ''; $class1=""; } $current_time = time(); $times = self::getTimes(strtotime( $r['created_at'] ) ); $replyId = $r['id']; $is_ad = $r['is_admin']; $current_time = time(); $times = strtotime( $r['created_at'] ); $add_time = !empty( $times) ? $times:time()-40; $m_time = $current_time - $add_time; $times_ago = self::getTimes( $m_time ); if($r['approve']==1) { echo ' <div class="d-flex cf-course-com-c cf-course-feed-box-a cf-course-cdel-'.$replyId.'" id="cf-course-cdel-'.$replyId.'"> <div class="cf-course-com-i py-2 me-3"> <div class="cf-course-img"> <img src="'.$image.'" classs="img-thumbnail"> </div> </div> <div class="text-start cf-cousre-com-con"> <div class="d-flex justify-content-between"> <div><span class="cf-course-label-6">'.$r['name'].'</sapn>'; if($is_ad==1){ echo '<span class="text-primary" > <i class=" fa fa-check" aria-hidden="true"></i> </span>'; } echo '<span class="cf-course-time cf-course-time-a">'.$times_ago.' </span> </div>'; if( $mem_id == $r['member_id'] || $admin=="admin" ) { echo '<div><span class="c-f--d-did c-f--com-ac-el "><i class="fas c-f--com-ac-el c-f--d-did fa-ellipsis-v"></i> <div id="cfCourse-context-menu-'.cf_enc($replyId,"encrypt").'" class="cf--cc--ddc" data-id=""> <input type="hidden" value="'.$comment_edit.'" class="c-f--d-did cf-course-cd-text" id="cf-course-cedit-text'.$replyId.'" /> <input type="hidden" value="'.cf_enc($replyId,"encrypt").'" class="c-f--d-did cf-course-cd-id" id="cf-course-cedit-id'.$replyId.'" /> <a href="javascript:void(0)" class="cf-course-edit-comment" data-id="'.cf_enc($replyId,"encrypt").'" data-encid="'.$replyId.'" >Edit</a> <a href="javascript:void(0)" class="cf-course-del-comment" data-check="comment" data-id="'.cf_enc($replyId,"encrypt").'" >Remove</a> </div> </span> <div class="cf-course-cmm-d d-flex c-f--d-did text-start" data-check="reply" data-id="'.cf_enc($replyId,"encrypt").'"></div></div>'; } echo' </div> <div class="cf-course-comments c-f--d-did w-100"> <div class="cf-course-read-more-des position-relative '.$class1.'"> <div class="cf-course-u-c '.$class.' c-f--d-did" id="cf-course-cdom-text'.$replyId.'">'.$comment.'</div> '.$button.' </div> </div>'; echo self::getCommentLikeDislikeB( $replyId,$mem_id,$r['name'],$option_id,$commentid ); echo '</div> </div>'; } } echo ''; $htmlCon.=ob_get_clean(); return $htmlCon; } } public function getCommentLikeDislikeB( $comid,$mid,$name,$oid,$parent_comment_id ) { global $mysqli; $mid = $mysqli->real_escape_string( $mid ); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mid); $mem_id = $mem_data['mid']; $htmCon=""; ob_start(); echo ' <div class="me-2 c-f--d-did w-100 justify-content-end d-flex c-f--com-time c-f--com-time-'.cf_enc($comid,"encrypt").' text-start" id="'.cf_enc($comid,"encrypt").'" data-commentId="'.cf_enc($parent_comment_id,"encrypt").'" data-oid="'.cf_enc($oid,"encrypt").'" data-memid="'.cf_enc($mem_id,"encrypt").'"> <a class="ps-2 c-f--com-reply-c cf-course-reply-link-a " data-name="'.$name.'" data-afterpress="false"> REPLY </a> </div>'; $htmCon.=ob_get_clean(); return $htmCon; } /* Theme b End */ public function getCommentData( $last_id=0 ) { global $mysqli; global $dbpref; $table = $dbpref."option_comment"; $last_id = (int)$last_id; $sql= "SELECT * FROM `".$table."` WHERE `id`=".$last_id; $result = $mysqli->query( $sql ); if( $result->num_rows > 0 ) { $htmlCon = ''; while( $data = $result->fetch_assoc() ) { $email = $data['email']; $comment = htmlspecialchars_decode(stripcslashes($mysqli->real_escape_string($data['comment']) ) ); $comment = str_ireplace(array( "\r"), "<br/>", $comment); $image = self::cfCourse_get_gravatar_image( $email,50 ); $comment_edit = stripcslashes(str_ireplace(array( "\r"), "<br/>", $data['comment'])); $times = strtotime( $data['created_at'] ); $comid = $data['id']; $parent_id =cf_enc( $data['reply_parent_id'],"encrypt"); $is_ad = $data['is_admin']; $id = cf_enc( $data['id'], 'encrypt' ); $oid = cf_enc( $data['option_id'], 'encrypt' ); $cid = cf_enc( $data['course_id'], 'encrypt' ); $sid = cf_enc( $data['section_id'], 'encrypt' ); $date =date( "d-M-Y, h:i a", strtotime($data['created_at'])); $header =self::getLectureHeader( $data['option_id'], "", "one" ); ob_start(); echo '<tr class="cf-course-hover-comemnt" id="cf-course-comment-row-'.$id.'" style="background-color:#c9eeff4a" > <td width="15%"> <span class="cf-course-custom-check"> <input type="checkbox" class="cf-bulk-check" value="'.$id.'" id="cf-bulk-check-'. $id.'"> <label for="cf-bulk-check-'.$id.'">'.$data["name"].' <span class="text-info cf-course-read-check text-sm" style="opacity:1"><i class="fas fa-check"></i></span></label> </span> </td> <td width="30%">'.$header.'</td> <td width="40%"> <div class="cf-course-comment-text"> <div class="p-1">'.t('In reply To').'</div> '.$comment.' </div> <div class="cf-course-actions p-1"> <a href="javascript:void(0)" data-id="'.$id.'" data-appr="'.$data["approve"].'" class="text-primary cf-course-appr-cm text-sm">'.t('unapproved').'</a> | <a href="javascript:void(0)" data-id="'.$id.'" class="text-success cf-course-delete-cm text-sm">'.t('delete').'</a> | <a href="javascript:void(0)" data-id="'.$id.'" data-readed="'.$data["readed"].'" class="text-info cf-course-read-cm text-sm">'.t('mark as unread').'</a> | <a href="javascript:void(0)" data-name="'.$data["name"].'" data-id="'.$parent_id.'" data-reply="'.$id.'" data-cid="'.$cid.'" data-oid="'.$oid.'" data-sid="'.$sid.'" class="text-warning cf-course-reply-cm text-sm" id="cf-course-reply-'.$id.'">'.t('Reply').'</a> | <a href="javascript:void(0)" data-id="'.$id.'" class="text-info cf-course-edit-cm text-sm" id="cf-course-edit-'.$comid.'">'.t('Edit').'</a> <input type="hidden" class="cf-course-com-edit" id="cf-course-com-edit" value="'.$comment_edit.'"> </div> </td> <td width="15%">'.$date.'</td> </tr>'; $htmlCon = ob_get_clean(); } return $htmlCon; } } // this function will return description of content function getComment( $id, $type ) { global $mysqli; global $dbpref; $type = $mysqli->real_escape_string( $type ); $id = $mysqli->real_escape_string( $id); $table = $dbpref."option_comment"; $qr = "SELECT `name`, `email`,`url`,`option_id`,`course_id`,`section_id`,`reply_parent_id`,`type` FROM `".$table."` WHERE `id`=".$id; $cresult = $mysqli->query( $qr ); if( $cresult->num_rows > 0 ) { $c_data = $cresult->fetch_assoc(); return $c_data; }else{ return false; } } function sendCommentEmail( $last_id ,$from="",$reply='' ) { $load = $this->loader->load("course_control"); $data = self::getComment( $last_id,"comment" ); $t = $load->getContentTitle ($data['option_id'], $data['course_id'] ); $email_body="<p>Hello,</p>"; $bottom_line = "<p>Thanks </p><p>CourseFunnels</p>"; $com_email = get_option("communication_email"); $install_url = get_option("install_url"); $subject = "(CourseFunnels) Comment Notification"; $email_body=""; if( $reply=="yes" ) { $datap = self::getComment( $data['reply_parent_id'],"comment" ); $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=comment&id=".$data['reply_parent_id']."#cf-course-cdel-".$data['reply_parent_id']; $newurl2 = $datap['url']."&type=comment&id=".$data['reply_parent_id']."#cf-course-cdel-".$data['reply_parent_id']; if( $from=="admin" ) { $email_body.="<p>Hello,</p><p>I hope you’re having a great week. <strong>The Teacher</strong> has replied to your comment.</p>"; $email_body.="<p><a target='_blank' href='".$newurl."'>See reply</a> </p>"; $email_body.= "<p>Thanks </p><p>CourseFunnels</p>"; $email_data=[ "", "name"=>$datap['name'], "email"=>$datap['email'], "subject"=>$subject, "body"=>$email_body ]; $sends_email =cf_mail($email_data); }else{ $email_body.="<p>Hello,</p><p>I hope you’re having a great week. <strong>".$data['name']."</strong> has replied to your comment.</p>"; $email_body.="<p><a target='_blank' href='".$newurl2."'>See reply</a> </p>"; $email_body.= "<p>Thanks </p><p>CourseFunnels</p>"; $admin_body="<p>Hello</p><p>I hope you’re having a great week. <strong>".$data['name']."</strong> has replied to ".$datap['name']."'s comment.</p><p><a target='_blank' href='".$newurl."'>See reply</a> </p><p>Thanks </p><p>CourseFunnels</p>"; $email_data=[ "", "name"=>$data['name'], "email"=>$data['email'], "subject"=>$subject, "body"=>$email_body ]; $email_data1=[ "", "name"=>"", "email"=>$com_email, "subject"=>$subject, "body"=>$admin_body ]; $sends_email =cf_mail($email_data); $sends_email =cf_mail($email_data1); } }else{ if( $from !="admin" && $reply=="no" ) { $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=comment&id=".$last_id."#cf-course-cdel-".$last_id; $email_body.="<p>Hello,</p><p>I hope you’re having a great week. <strong>".$data['name']."</strong> has commented on the <strong>".$t."</strong>.</p>"; $email_body.="<p><a target='_blank' href='".$newurl."'>See comment</a> </p>"; $email_body.= "<p>Thanks </p><p>CourseFunnels</p>"; $email_data=[ "", "name"=>"", "email"=>$com_email, "subject"=>$subject, "body"=>$email_body ]; $sends_email =cf_mail($email_data); } } } function getNote( $id ) { global $mysqli; global $dbpref; $id = $mysqli->real_escape_string( $id); $table = $dbpref."option_notes"; $qr = "SELECT `name`, `email`,`url`,`option_id`,`section_id`,`course_id`,`type`,`is_admin` FROM `".$table."` WHERE `id`=".$id; $cresult = $mysqli->query( $qr ); if( $cresult->num_rows > 0 ) { $c_data = $cresult->fetch_assoc(); return $c_data; }else{ return false; } } function sendNoteEmail( $last_id ) { $load = $this->loader->load("course_control"); $data = self::getNote( $last_id ); $t = $load->getContentTitle ($data['option_id'], $data['course_id'] ); $email_body="<p>Hello,</p>"; $bottom_line = "<p>Thanks </p><p>CourseFunnels</p>"; $com_email = get_option("communication_email"); $subject = "(CourseFunnels) Note Notification"; $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=".$last_id."#cf-course-notes-c-".$last_id; $email_body.="<p>I hope you’re having a great week. <strong>".$data['name']."</strong> has created a note on the <strong>".$t."</strong>.</p>"; $email_body.="<p><a target='_blank' href='".$newurl."'>See note</a> </p>"; $email_body.= "<p>Thanks </p><p>CourseFunnels</p>"; $email_data=[ "", "name"=>"", "email"=>$com_email, "subject"=>$subject, "body"=>$email_body ]; if($data['is_admin']==0) { $sends_email =cf_mail($email_data); } } function getLectureHeader( $oid, $count,$take ) { global $mysqli; global $dbpref; $opid = $mysqli->real_escape_string( $oid ); $c = $mysqli->real_escape_string( $count ); $table = $dbpref."content_options"; $qr = "SELECT * FROM `".$table."` WHERE `id`=".$oid; $oresult = $mysqli->query( $qr ); $htmCon =''; if( $oresult->num_rows > 0 ) { $o_data = $oresult->fetch_assoc(); $op_id = $o_data['id']; $s_id = $o_data['section_id']; $c_id = $o_data['course_id']; $o_title = stripcslashes( trim( stripcslashes( base64_decode($o_data['title'])),"\r\n") ) ; $o_des = stripcslashes( trim(stripcslashes(base64_decode($o_data['description'])),"\r\n") ) ; $o_type = $o_data['option_type']; $c_type = $o_data['content_type']; if($take=="all") { if( $o_type == "quiz" ) { $title = '<span class="cf-course-sltcou b--cf-sltcou c--cf-sltcou d--cf-sltcou e--cf-sltcou"> Quiz '.$c.': </span>'; $action ='<div class="cf-course-opact"> 2 participated </div>'; } else if( $o_type == "assign" ) { $title = '<span class="cf-course-sltcou b--cf-sltcou c--cf-sltcou d--cf-sltcou e--cf-sltcou"> Assignment '.$c.': </span>'; $action ='<div class="cf-course-opact"> 2 participated </div>'; } else if( $o_type == "lecture" ) { $title = '<span class="cf-course-sltcou b--cf--sltcou c--cf-sltcou d--cf-sltcou e--cf-sltcou"> Lecture '.$c.': </span>'; $action ='<div class="cf-course-opact"> 2000 views </div>'; } else if( $o_type == "test" ) { $title = '<span class="cf-course-sltcou b--cf--sltcou c--cf-sltcou d--cf-sltcou e--cf-sltcou"> Test '.$c.': </span>'; $action ='<div class="cf-course-opact"> 2 participated </div>'; } $htmCon .=' <div class="cf-course-slti px-1 px-sm-0"> '.$title.'<span class="cf-course-clttext b--cf--clttext c--cf--clttext d--cf--clttext e--cf--clttext"> '.$o_title.' <span> </div>'; }elseif( $take =="one" ){ if( $o_type == "quiz" ) { $title = '<span class="font-weight-bold text-primary" >Quiz: </span>'; } else if( $o_type == "assign" ) { $title = '<span class="font-weight-bold text-primary" > Assignment: </span>'; } else if( $o_type == "lecture" ) { $title = '<span class="font-weight-bold text-primary" > Lecture: </span>'; } else if( $o_type == "test" ) { $title = '<span class="font-weight-bold text-primary" > Test: </span>'; } $htmCon .=' <div class=""> '.$title.'<span > '.$o_title.' <span> </div>'; } } return $htmCon; }//end of function function cfCourse_get_gravatar_image( $email = null,$size=40 ){ $email = $email; $default = 'mp'; $size = $size; $grav_url = "https://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $default ) . "&s=" . $size; return $grav_url; } function getTimes( $m_time ) { $times_ago=null; if( is_numeric( $m_time ) ){ $value = array( "years" => 0, "days" => 0, "hours" => 0, "minutes" => 0, "seconds" => 0, ); if( $m_time >= 31556926 ){ $value["years"] = floor( $m_time/31556926 ); $m_time = ( $m_time%31556926 ); if( $value['years']==1 ){ $times_ago = $value['years']." year ago"; }else{ $times_ago = $value['years']." years ago"; } } elseif( $m_time >= 86400){ $value["days"] = floor($m_time/86400); $m_time = ($m_time%86400); if( $value['days']==1 ){ $times_ago = $value['days']." day ago"; }else{ $times_ago = $value['days']." days ago"; } } elseif( $m_time >= 3600 ){ $value["hours"] = floor( $m_time/3600 ); $m_time = ($m_time%3600); if( $value['hours'] == 1 ){ $times_ago = $value['hours']." hour ago"; }else{ $times_ago = $value['hours']." hours ago"; } } elseif( $m_time >= 60 ){ $value["minutes"] = floor( $m_time/60 ); $m_time = ($m_time%60); if( $value['minutes']==1 ){ $times_ago = $value['minutes']." minute ago"; }else{ $times_ago = $value['minutes']." minutes ago"; } } else{ // $value['seconds'] = $m_time; // if($value['seconds'] <= 5){ // $times_ago = "Just Now"; // }else{ $times_ago = "Just Now"; // } } } return $times_ago; } public function getDuration( $mem_id,$lecture_id ) { global $mysqli; global $dbpref; $l_id = $mysqli->real_escape_string($lecture_id); $mem_id = $mysqli->real_escape_string($mem_id); $quiz_ob= $this->loader->load("quiz_stud_control"); $mem_data = $quiz_ob->checkIfIsAdmin($mem_id); $mid = $mem_data['mid']; $table = $dbpref."video_start"; $result = $mysqli->query( "SELECT * FROM `".$table."` WHERE `member_id`=$mid AND `option_id`= $lecture_id" ); if( $result->num_rows > 0 ) { $r = $result->fetch_assoc(); return $r['duration']; die(); }else{ return 0; } } public function getStatusOfContent( $option_id, $action ) { global $mysqli; global $dbpref; $table = $dbpref."content_options"; if( $action == "like" ) { $sql= "SELECT `like_status` as 'status',`comment_approve` FROM `".$table."` WHERE `id`=".$option_id; } elseif( $action == "comment" ) { $sql ="SELECT `comment_status` as 'status',`comment_approve` FROM `".$table."` WHERE `id`=".$option_id; } $result = $mysqli->query($sql ); if( $result->num_rows > 0 ) { $r = $result->fetch_assoc(); return $r; }else{ return 1; } } public function getExtension($file) { $ext = pathinfo($file, PATHINFO_EXTENSION); return $ext; } }//class ends }//if exist class ends