public function get_explore_courses() { ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // $this->form_validation->set_rules('mem_id', 'Member ID', 'trim|required|xss_clean'); // $this->form_validation->set_rules('app_language', 'App Language ID ', 'trim|required|xss_clean'); $this->form_validation->set_rules('cat_id', 'App Language ID ', 'trim|xss_clean'); // $this->form_validation->set_rules('lang_id', 'App Language ID ', 'trim|xss_clean'); // $this->form_validation->set_rules('type', 'App Language ID ', 'trim|required|xss_clean'); // $this->form_validation->set_rules('page', 'App Language ID ', 'trim|required|xss_clean'); // code here $this->load->helper('category_content_helper'); try{ if($this->form_validation->run() !== false) { $mem_id = $this->input->post('mem_id'); $app_language = $this->input->post('app_language'); $cat_id = $this->input->post('cat_id'); $lang_id = $this->input->post('lang_id') ?? 24; $type = $this->input->post('type') ?? 1; // 1 - Language based courses | 2 - Category based courses // always $type = 1 dependant on course $page = $this->input->post('page'); $is_paid = 0; $content_new = recommended_courses_content($app_language); $cat_content = common_content_for_category($app_language); $commonContete = common_content($app_language); $nudgeContent = get_subscription_nudges_contents($app_language); $mem_details = ''; // $mem_details = $this->get_mem_details_from_redis_new($mem_id); $memcourseLangauges = array(); $pclLanguage = ""; if(!empty($mem_details) && isset($mem_details[0])) { $mem_details = (array)$mem_details[0]; if(isset($mem_details['course_languages']) && !empty($mem_details['course_languages'])) { $memcourseLangauges = $mem_details['course_languages']; } if(isset($mem_details['mem_primary_lang_id']) && !empty($mem_details['mem_primary_lang_id'])) { $pclLanguage = $mem_details['mem_primary_lang_id']; if(empty($lang_id)) { $lang_id = $pclLanguage; } } } if(empty($lang_id)) { $this->load->model('Ldt_ffw_customers_model'); $cusPclLang = $this->Ldt_ffw_customers_model->fetch_customer_pcl_for_mc($mem_id); if(!empty($cusPclLang)) { $lang_id = $cusPclLang['cus_language_id']; } } if($type == 1) { if(empty($cat_id)) { $cat_id = "1000"; } $response['category_list'] = array(); $order = "10,4,1,2,8,9,6,5,7,3"; $this->load->model('Mdt_goal_categories_model'); $mainCateg = $this->Mdt_goal_categories_model->fetch_categories($order,0,10); if(!empty($mainCateg)) { $mainCatArr[] = array( "cat_id" => "1000", "cat_name" => "All", "cat_icon" => base_url().'assets/images/icons/all-category.png', "is_selected" => ($cat_id === "1000") ? true : false ); foreach($mainCateg as $ct) { $CatData = $this->category_icons($ct['mgc_id']); $catNane = $ct['mgc_category_name_english']; if($app_language == 21){ $catNane = $ct['mgc_category_name_telugu']; }else if($app_language == 20){ $catNane = $ct['mgc_category_name_tamil']; }else if($app_language == 11){ $catNane = $ct['mgc_category_name_malayalam']; }else if($app_language == 7){ $catNane = $ct['mgc_category_name_kannada']; }else if($app_language == 6){ $catNane = $ct['mgc_category_name_hindi']; } $mainCatArr[] = array( "cat_id" => $ct['mgc_id'], "cat_name" => $catNane, "cat_icon" => base_url().'assets/images/category/'.$CatData['icon'], "is_selected" => ($cat_id == $ct['mgc_id']) ? true : false ); } if(!empty($mainCatArr)) { $response['category_list'] = $mainCatArr; } } } else { if(!empty($memcourseLangauges) && count($memcourseLangauges) == 1) { $lang_id = $memcourseLangauges[0]; } $response['languages_list'] = array(); $langArray = array(); if(!empty($memcourseLangauges) & count($memcourseLangauges) > 1) { $desiredOrder = array(24,7,21,6,20,11); if(!empty($pclLanguage)) { if(($key = array_search($pclLanguage, $desiredOrder)) !== false) { unset($desiredOrder[$key]); } array_unshift($desiredOrder, $pclLanguage); $desiredOrder = array_values($desiredOrder); } $memcourseLangauges = array_intersect($desiredOrder, $memcourseLangauges); $langArray[] = array( 'lang_id' => "1000", 'lang_name' => $this->fetch_language_names(0), 'is_selected' => ($lang_id == "1000") ? true : false ); foreach($memcourseLangauges as $lng) { $langArray[] = array( 'lang_id' => (string)$lng, 'lang_name' => $this->fetch_language_names($lng), 'is_selected' => ($lang_id == $lng) ? true : false ); } } if(!empty($langArray)) { $response['languages_list'] = $langArray; } } $catIcons = $this->category_icons($cat_id); $this->load->model('Mdt_goal_categories_model'); $catDetails = $this->Mdt_goal_categories_model->fetch_cat_details($cat_id); $catName = $catDetails['mgc_category_name_english']; if($app_language == 21){ $catName = $catDetails['mgc_category_name_telugu']; }else if($app_language == 20){ $catName = $catDetails['mgc_category_name_tamil']; }else if($app_language == 11){ $catName = $catDetails['mgc_category_name_malayalam']; }else if($app_language == 7){ $catName = $catDetails['mgc_category_name_kannada']; }else if($app_language == 6){ $catName = $catDetails['mgc_category_name_hindi']; } $mainIcon = ""; $mainColour = ""; if(!empty($cat_id) && $cat_id != 1000) { $mainIcon = base_url().'assets/images/category/'.$catIcons['icon']; $mainColour = $catIcons['colour']; } // else // { // $mainIcon = base_url().'assets/images/icons/'.$catIcons['icon']; // $mainColour = $catIcons['colour']; // } $response['main_header'] = $catName; $response['cat_icon'] = $mainIcon; $response['bg_colour'] = $mainColour; $response['show_inbound_banner'] = true; $response['show_mentors_list'] = ($page ==1)?true:false; $response['show_success_stories'] = ($page ==1)?true:false; $response['show_categories'] = true; $response['show_subscription_nudge'] = false; $response['show_subscription_no_close_nudge'] = false; $response['subscription_nudge_logo'] = ""; $response['subscription_nudge_title'] = ""; $response['subscription_nudge_desc'] = ""; $response['category_sub_tootltip'] = ""; $response['monthly_sub_tooltip'] = ""; $response['subscription_nudge_price_txt'] = ""; $response['subscription_nudge_btn_txt'] = ""; $response['subscription_nudge_btn_img'] = ""; $response['show_subscription_no_close_nudge'] = false; $response['subscription_no_close_nudge_logo'] = ""; $response['subscription_no_close_nudge_title'] = ""; $response['subscription_no_close_nudge_desc_1'] = ""; $response['subscription_no_close_nudge_desc_2'] = ""; $response['subscription_no_close_nudge_desc_3'] = ""; $response['subscription_no_close_nudge_desc_4'] = ""; $response['subscription_no_close_nudge_desc_5'] = ""; $response['nudge_desc_logo_1'] = ""; $response['nudge_desc_logo_2'] = ""; $response['nudge_desc_logo_3'] = ""; $response['nudge_desc_logo_4'] = ""; $response['nudge_desc_logo_5'] = ""; $response['subscription_no_close_nudge_price_txt'] = ""; $response['subscription_no_close_nudge_btn_txt'] = ""; $mobile_number = $this->input->post('mobile_number'); if(!$is_paid && $type == 2 && $mobile_number != '9942309787') { $price = $this->config->item('subscription_nudge_package_price'); $month = $this->config->item('subscription_nudge_package_month'); $price_txt = str_replace('|price|',$price,$nudgeContent['subscription_nudge_price_txt']); $price_txt_month = str_replace('|months|',$month,$price_txt); $response['show_subscription_nudge'] = false; $this->load->model('ldt_subscription_nudges_removed_log_model'); $removedInfo = $this->ldt_subscription_nudges_removed_log_model->get_removed_subscription($mem_id); if(empty($removedInfo)) { $response['show_subscription_nudge'] = true; } $response['subscription_nudge_logo'] = base_url('assets/images/sub_nudges_icon.png'); $response['subscription_nudge_title'] = $nudgeContent['subscription_nudge_title']; $response['subscription_nudge_desc'] = $nudgeContent['subscription_nudge_desc']; $response['subscription_nudge_price_txt'] = !empty($price_txt_month)?$price_txt_month:""; $response['subscription_nudge_btn_txt'] = $nudgeContent['subscription_nudge_unlock_btn_txt']; $response['subscription_nudge_btn_img'] = base_url('assets/images/lock.png'); $response['show_subscription_no_close_nudge'] = true; $response['subscription_no_close_nudge_logo'] = base_url('assets/images/subscription_nudge_icon.png'); $response['subscription_no_close_nudge_title'] = $nudgeContent['subscription_no_close_nudge_title']; $response['subscription_no_close_nudge_desc_1'] = $nudgeContent['subscription_no_close_nudge_desc_1']; $response['subscription_no_close_nudge_desc_2'] = $nudgeContent['subscription_no_close_nudge_desc_2']; $response['subscription_no_close_nudge_desc_3'] = $nudgeContent['subscription_no_close_nudge_desc_3']; $response['subscription_no_close_nudge_desc_4'] = $nudgeContent['subscription_no_close_nudge_desc_4']; $response['subscription_no_close_nudge_desc_5'] = $nudgeContent['subscription_no_close_nudge_desc_5']; $response['nudge_desc_logo_1'] = base_url('assets/images/nudges_desc_1.png'); $response['nudge_desc_logo_2'] = base_url('assets/images/nudge_desc_2_new.png'); $response['nudge_desc_logo_3'] = base_url('assets/images/nudges_desc_3.png'); $response['nudge_desc_logo_4'] = base_url('assets/images/nudges_desc_4.png'); $response['nudge_desc_logo_5'] = base_url('assets/images/nudges_desc_5.png'); $response['subscription_no_close_nudge_price_txt'] = !empty($price_txt_month)?$price_txt_month:""; $response['subscription_no_close_nudge_btn_txt'] = $nudgeContent['subscription_nudge_btn_txt']; if($response['show_subscription_nudge'] == true) { $insArr = array( 'lsnr_mem_id' => $mem_id, 'lsnr_cat_id' => $cat_id, 'lsnr_type' => 1, 'lsnr_added_on' => date('Y-m-d H:i:s') ); $this->ldt_subscription_nudges_removed_log_model->insert($insArr); } } if($type == 2) { $response['inbound_title'] = str_replace('|cat|',$catName,$cat_content['exploring_txt']); } else { $langName = "English"; if($lang_id == 21){ $langName = "Telugu"; }else if($lang_id == 20){ $langName = "Tamil"; }else if($lang_id == 11){ $langName = "Malayalam"; }else if($lang_id == 7){ $langName = "Kannada"; }else if($lang_id == 6){ $langName = "Hindi"; } $response['inbound_title'] = str_replace('|lang|',$langName,$cat_content['exploring_lang_txt']); } $response['inbound_subtitle'] = $cat_content['get_personalized_txt']; $response['inbound_btn'] = $cat_content['get_help_txt']; $response['inbound_response_txt'] = $cat_content['awesome_txt']; if(!$is_paid && $mobile_number != '9942309787') { $response['show_subscription_nudge'] = true; $response['show_subscription_no_close_nudge'] = true; $response['subscription_no_close_nudge_logo'] = base_url('assets/images/subscription_nudge_icon.png'); $get_active_subscription_details = $this->check_category_package_subscription($mem_id); $check_category_subscription = 0; if(!empty($get_active_subscription_details)) { $check_category_subscription = 1; } if($check_category_subscription == 1) //available category subscription { $package_price = $this->config->item('default_package_price'); $package_id = $this->config->item('default_package_id'); if($cat_id == $get_active_subscription_details['lfp_category_id']) { $response['show_subscription_nudge'] = false; $response['show_subscription_no_close_nudge'] = false; } $course_content = fetch_course_benifit_strip_content($app_language); $sticky_strip_text = str_replace('__',$package_price,$course_content['course_strip_text']); $course_benifit_1 = $cat_content['category_benifit_11']; $cp_body_content[] = [ "id"=>1, "title"=>str_replace('__',$this->config->item('default_package_price'),$cat_content['cp_body_title_1']), "desc"=>$cat_content['cp_body_desc_1'], "badge"=>$cat_content['cp_body_badge_1'], "package_id"=>$this->config->item('default_package_id'), "cp_type"=>"2", //subscription "cat_id"=>"", "cat_name"=>"", ]; $category_subscription_type = '2'; //subscription } else // not available category subscription { $this->load->model('mdt_ffw_packages_model'); $package_array = $this->mdt_ffw_packages_model->get_package_category_details($cat_id); $package_price = $this->config->item('default_package_price'); $package_id = $this->config->item('default_package_id'); if(!empty($package_array)) { $package_price = $package_array['package_price']; $package_id = $package_array['package_id']; } $sticky_strip_text = str_replace('|cat_name|',$catName,$cat_content['sticky_strip_text']); $sticky_strip_text = str_replace('|cat_package_price|',$package_price,$sticky_strip_text); $course_benifit_1 = str_replace('|cat_name|',$catName,$cat_content['category_benifit_1']); $category_subscription_type = '1'; //category if($cat_id == 1000) { $course_content = fetch_course_benifit_strip_content($app_language); $sticky_strip_text = str_replace('__',$package_price,$course_content['course_strip_text']); $course_benifit_1 = $cat_content['category_benifit_11']; $category_subscription_type = '2'; //subscription } $cp_body_content[] = [ "id"=>1, "title"=>str_replace('__',$this->config->item('default_package_price'),$cat_content['cp_body_title_1']), "desc"=>$cat_content['cp_body_desc_1'], "badge"=>$cat_content['cp_body_badge_1'], "package_id"=>$this->config->item('default_package_id'), "cp_type"=>"2", //subscription "cat_id"=>"", "cat_name"=>"", ]; if($cat_id <> 1000) { $cp_body_content[] = [ "id"=>2, "title"=>str_replace('__',$package_price,$cat_content['cp_body_title_1']), "desc"=>str_replace('|cat_name|',$catName,$cat_content['cp_body_desc_2']), "badge"=>"", "package_id"=>$package_id, "cp_type"=>"1", //category "cat_id"=>$cat_id, "cat_name"=>$catName, ]; } } $cp_body = $cp_body_content; $response['sticky_strip_text'] = $sticky_strip_text; $response['category_package_id'] = $package_id; $response['category_subscription_type'] = $category_subscription_type; //$catName. $response['category_sub_tootltip'] = str_replace('||',$catName,$nudgeContent['category_sub_tootltip']); $response['monthly_sub_tooltip'] = $nudgeContent['monthly_sub_tooltip']; $response['category_benifit']['desc'] = [ [ "id"=>1, "title"=>$course_benifit_1, "image"=>base_url('assets/images/subscription_benifit/subscription_image_1.png'), ], // [ // "id"=>2, // "title"=>$cat_content['category_benifit_2'], // "image"=>base_url('assets/images/subscription_benifit/subscription_image_2.png'), // ], [ "id"=>3, "title"=>$cat_content['category_benifit_3'], "image"=>base_url('assets/images/subscription_benifit/subscription_image_3.png'), ], [ "id"=>4, "title"=>$cat_content['category_benifit_4'], "image"=>base_url('assets/images/prime/prime-access-6.png'), ] ]; $response['category_benifit']['price_text'] = str_replace('__',$package_price,$cat_content['cat_benifit_price_text']); $response['category_benifit']['cta_text'] = $cat_content['cat_benifit_cta_text']; $response['category_benifit']['package_id'] = $package_id; $response['choose_plan']['cp_title'] = $cat_content['choose_plan_title']; $response['choose_plan']['cp_body'] = $cp_body; $response['choose_plan']['cp_cta_text'] =$cat_content['cp_cta_text']; } $active_subscription = 2; $mobile_number = $this->input->post('mobile_number'); try{ $user_redis_cache = $this->redis->hgetall($mobile_number); }catch(Exception $e){ $user_redis_cache = ""; } if(!empty($user_redis_cache)) { $user_redis_cache_keys = json_decode($user_redis_cache['user_keys'],true); $cached_secret_key = $user_redis_cache['secret_key']; $active_subscription_data = isset($user_redis_cache_keys['active_subscription'])?$user_redis_cache_keys['active_subscription']:''; if($active_subscription_data) { $active_subscription = 1; $response['show_inbound_banner'] = false; } } $this->load->model('Sdt_ffw_courses_model'); $limit = 20; $start = ($page - 1) * $limit; if($type == 1) // always happens in this function { // 1 - Language based courses if($cat_id == 1000) { $cat_id = ""; } $coursesList = $this->Sdt_ffw_courses_model->fetch_language_based_courses($lang_id,$start,$limit,$cat_id); } else { // 2 - Category based if($lang_id == 1000) { $lang_id = ""; } $coursesList = $this->Sdt_ffw_courses_model->fetch_category_based_courses($cat_id,$start,$limit,$lang_id); //print_r($coursesList);die; } //print_r($coursesList);die; if(!empty($coursesList)) { $FilteredcoursesList = array_column($coursesList,'course_id'); $this->load->model('Ldt_bookmarked_courses_model'); if(!empty($lang_id)) { $fetchWatchListData = $this->Ldt_bookmarked_courses_model->fetch_watchlist_based_on_lang($mem_id,$FilteredcoursesList,$lang_id); if(!empty($fetchWatchListData)) { $watchListCourses = array_column($fetchWatchListData,'lbc_course_id'); } } else { $watchListCourses = $this->Ldt_bookmarked_courses_model->fetch_watchlist_based_on_courses($mem_id,$FilteredcoursesList,$lang_id); } if(!empty($FilteredcoursesList)) { $recommendedLangCrs = $FilteredcoursesList; $img_url = $this->config->item('profile_pic_display_url'); try{ $this->redis = $this->predis->config($this->config->item('redis_host'), $this->config->item('redis_pass'),$this->config->item('redis_port')); $pipline_response_v2 = $this->redis->pipeline(); $pipline_course_rate_v1 = $this->redis->pipeline(); $pipline_course_dur_v1 = $this->redis->pipeline(); $pipline_crs_learners = $this->redis->pipeline(); $pipline_course_mem_images = $this->redis->pipeline(); $pipeline_for_learners = $this->redis->pipeline(); foreach($recommendedLangCrs as $dis) { if($dis != 30) { // course details list $pipline_response_v2 = $pipline_response_v2->get('CRSDET_'.$dis); // course rating details $pipline_course_rate_v1 = $pipline_course_rate_v1->get('CRSRATE_'.$dis); // course duration and modules details $pipline_course_dur_v1 = $pipline_course_dur_v1->get('CRSMAINDUR_'.$dis); $pipline_course_mem_images = $pipline_course_mem_images->smembers('CRSMEMPRO_'.$dis); $pipeline_for_learners = $pipeline_for_learners->get('CRSLEARNERS_'.$dis); } } $course_main_details = $this->execute_redis_pipeline_v2($pipline_response_v2); $course_rating_details = $this->execute_redis_pipeline_v2($pipline_course_rate_v1); $course_durating_details = $this->execute_redis_pipeline_v2($pipline_course_dur_v1); $course_member_images = $this->execute_redis_pipeline_v2($pipline_course_mem_images); $course_learners_count_data = $this->execute_redis_pipeline_v2($pipeline_for_learners); $ttl_crs_dtls = array(); $bookmarkedCourses = array(); if(!empty($course_main_details)) { $courses_trailer_path = $this->config->item('courses_trailer_path'); $mainCourseListArr = array(); foreach($course_main_details as $k => $del) { $course_id = $course_title = $course_description = $total_hours = $course_rating = $course_thumbnail = ''; $course_lock_flag = false; if(isset($course_main_details[$k])) { $displayselectedList = true; $single_course_data = json_decode($course_main_details[$k]); if($type == 1) { $crlng = $lang_id; } else { if(!empty($lang_id)) { $crlng = $lang_id; } else { $selectedCourseLanguages = $single_course_data->course_released_languages; $explodedcrdLang = explode(',',$selectedCourseLanguages); $intersectedCrs = array_intersect($explodedcrdLang,$memcourseLangauges); $crlng = $intersectedCrs[0]; } } $course_id = $single_course_data->course_id; $displayselectedList = false; $language_text = $this->getCourseIndexv1($crlng); if(isset($single_course_data->{$language_text['courseTitle']})){ $course_title = $single_course_data->{$language_text['courseTitle']}; } if(isset($single_course_data->{$language_text['courseDesc']})){ $course_description = $single_course_data->{$language_text['courseDesc']}; } $course_thumbnail = array(); if(isset($single_course_data->course_thumbnail_image) && !empty($single_course_data->course_thumbnail_image)){ $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->course_thumbnail_image; } if(isset($course_durating_details[$k])) { $course_duration_data = json_decode($course_durating_details[$k]); try{ $newCrsLangData = $this->redis->get('CRSLANGDUR_'.$course_id.'_'.$crlng); if(!empty($newCrsLangData)) { $course_duration_data = json_decode($newCrsLangData); } }catch(Exception $e){ //error } if(isset($course_duration_data->total_hours) && !empty($course_duration_data->total_hours) && $course_duration_data->total_hours != '00:00:00'){ $total_hours = $course_duration_data->total_hours; $th_arr = explode(":", $total_hours); if($th_arr){ $hours = ((int)$th_arr[0])?(int)$th_arr[0]."h":''; $min = ((int)$th_arr[1])?(int)$th_arr[1]."m":''; } $total_hours = trim($hours." ".$min); } } $rating = 0; $user_count = 0; if(isset($course_rating_details[$k])){ $course_rating_data = json_decode($course_rating_details[$k]); if(isset($course_rating_data->rating) && !empty($course_rating_data->rating)){ $rating = $course_rating_data->rating; } if(isset($course_rating_data->user_count) && !empty($course_rating_data->user_count)){ $user_count = $course_rating_data->user_count; } } $courseRatingText = ''; if($user_count >= 2) { $user_count = $this->shortNumber($user_count); $course_rating = number_format($rating,1); } $crsbookmarked = false; if(in_array($course_id,$bookmarkedCourses)){ $crsbookmarked = true; } $learnersCount = ""; if(isset($course_learners_details[$k])) { $learnersCount = $course_learners_details[$k]; } $courseMemprofiles = array(); if(isset($course_member_images[$k]) && !empty($course_member_images[$k])) { $crsMimages = $course_member_images[$k]; shuffle($crsMimages); foreach($crsMimages as $img) { if(count($courseMemprofiles) <= 2) { $memimg = $img_url.$img; array_push($courseMemprofiles,$memimg); } } } if(empty($courseMemprofiles) || count($courseMemprofiles) < 2) { $courseMemprofiles = array( '', '' ); } $bookamrkedcrs = false; if(!empty($bookmarkedCourses)) { if(in_array($course_id,$bookmarkedCourses)){ $bookamrkedcrs = true; } } $learnersData = ""; if(isset($course_learners_count_data[$k]) && !empty($course_learners_count_data[$k])) { $learnersCount = $course_learners_count_data[$k]; } if(!empty($learnersCount)) { if($learnersCount > 1000) { $learnersCount = $this->shortNumber($learnersCount); }else{ $countArr = array(3000,3500,4000,3600,4600,3400); shuffle($countArr); $learnersCount = $countArr[0]; $learnersCount = $this->shortNumber($learnersCount); } $learnersData = $learnersCount.' '.$commonContete['Learners']; }else{ $countArr = array(3000,3500,4000,3600,4600,3400); shuffle($countArr); $learnersCount = $countArr[0]; $learnersCount = $this->shortNumber($learnersCount); $learnersData = $learnersCount.' '.$commonContete['Learners']; } $watch_text = ''; //if($active_subscription != 1){ $watch_text = $content_new['watch_trailer_text']; //} $video_url = ""; if($crlng == 24){ $video_url = isset($single_course_data->trailer_in_english) && !empty($single_course_data->trailer_in_english) ? $courses_trailer_path.$single_course_data->trailer_in_english : ''; if(isset($single_course_data->img_in_english) && !empty($single_course_data->img_in_english)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_english; } }else if($crlng == 21){ $video_url = isset($single_course_data->trailer_in_telugu) && !empty($single_course_data->trailer_in_telugu) ? $courses_trailer_path.$single_course_data->trailer_in_telugu : ''; if(isset($single_course_data->img_in_telugu) && !empty($single_course_data->img_in_telugu)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_telugu; } }else if($crlng == 20){ $video_url = isset($single_course_data->trailer_in_tamil) && !empty($single_course_data->trailer_in_tamil) ? $courses_trailer_path.$single_course_data->trailer_in_tamil : ''; if(isset($single_course_data->img_in_tamil) && !empty($single_course_data->img_in_tamil)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_tamil; } }else if($crlng == 11){ $video_url = isset($single_course_data->trailer_in_malayalam) && !empty($single_course_data->trailer_in_malayalam) ? $courses_trailer_path.$single_course_data->trailer_in_malayalam : ''; if(isset($single_course_data->img_in_malayalam) && !empty($single_course_data->img_in_malayalam)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_malayalam; } }else if($crlng == 7){ $video_url = isset($single_course_data->trailer_in_kannada) && !empty($single_course_data->trailer_in_kannada) ? $courses_trailer_path.$single_course_data->trailer_in_kannada : ''; if(isset($single_course_data->img_in_kannada) && !empty($single_course_data->img_in_kannada)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_kannada; } }else if($crlng == 6){ $video_url = isset($single_course_data->trailer_in_hindi) && !empty($single_course_data->trailer_in_hindi) ? $courses_trailer_path.$single_course_data->trailer_in_hindi : ''; if(isset($single_course_data->img_in_hindi) && !empty($single_course_data->img_in_hindi)) { $course_thumbnail = array(); $course_thumbnail[] = $this->config->item('course_thumbnail_path').$single_course_data->img_in_hindi; } } $lang_name_lower_case = fetch_course_lang_lowercase($crlng); $addedToWatchList = false; if(!empty($lang_id)) { if(!empty($watchListCourses)) { if(in_array($course_id,$watchListCourses)) { $addedToWatchList = true; } } } else { if(!empty($watchListCourses)) { foreach($watchListCourses as $k) { if($k['lbc_course_id'] == $course_id && $k['lbc_lang_id'] == $crlng) { $addedToWatchList = true; } } } } $sendingcourses[] = array( 'course_id' => $course_id, 'course_title' => $course_title, 'course_name_english' => $single_course_data->course_title, 'lang_name' => $lang_name_lower_case, 'course_description' => $course_description, 'total_hours' => $total_hours, 'course_rating' => $course_rating, 'rating_value' => $course_rating . " (".$user_count.")", 'course_lock_flag' => $course_lock_flag, 'course_thumbnail' => $course_thumbnail, 'from_redis' => '1', 'members_count' => $learnersData, 'is_bookmarked' => $bookamrkedcrs, 'members' => $courseMemprofiles, 'lang_id' => $crlng, 'watch_trailer_text' => $watch_text, 'video_url' => $video_url, 'add_watch_list' => $addedToWatchList, 'add_watch_list_txt' => "Add to Watchlist", 'added_watch_list_txt' => "Added to Watchlist", 'total_hours_txt' => 'Watch '.$total_hours, 'learners_txt' => $learnersData, 'watchlist_txt' => "Watchlist", 'added_watchlist_txt' => "Added" ); } } } else { $response['message'] = "Data not found"; $this->error($response); } }catch(Exception $e){ //error } if(!empty($sendingcourses)) { $response['courseList'] = $sendingcourses; $this->success($response); }else{ $this->error(array('message'=>'No Data Found!')); } } else { $response['message'] = "Data not found"; $this->error($response); } } else { $response['message'] = "Data not found"; $this->error($response); } } else { $res = array(); $res['message'] = "invalid params"; $this->error($res); } }catch(Exception $e){ $res = array(); $res['message'] = "failed"; $this->error($res); } }