home - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of home.php
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Home extends CI_Controller {
- ############################################ FUNCTION CONSTRUCTOR #################################
- function __construct()
- {
- parent::__construct();
- if(!$this->session->userdata('logged_in'))
- {
- redirect('login','refresh');
- }
- if($this->session->userdata('logged_in')['first_login_status']==0 && $this->uri->segment(1)!='update-password')
- {
- redirect('update-password');
- }
- if($this->session->userdata('logged_in')['first_login_status']==1 && $this->uri->segment(1)!='profile')
- {
- redirect('profile');
- }
- $this->load->model('Common_model');
- $this->load->model('Manage_model');
- if($this->session->userdata('logged_in')['privilege_id']==4)
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- date_default_timezone_set($OD['timezone']);
- }
- else
- {
- date_default_timezone_set('Asia/Qatar');
- }
- }
- ############################################ END OF FUNCTION CONSTRUCTOR ##########################
- ############################################ COMMON VIEW PAGE #####################################
- public function CommonPage($page,$data,$PageName='')
- {
- $SD['side_menu'] = $this->Common_model->get_side_menu();
- $CurrentUrlId = $this->Common_model->get_current_url_id();
- $AllowedMenu = $this->Common_model->allowed_menus_by_privilege();
- $AllowedMainMenu = json_decode($AllowedMenu['main_menu']);
- $AllowedSubMenu = json_decode($AllowedMenu['sub_menu']);
- if($CurrentUrlId['MainMenu']!='0')
- {
- if(!in_array($CurrentUrlId['MainMenu'],$AllowedMainMenu))
- {
- redirect('dashboard','refresh');
- }
- }
- if($CurrentUrlId['SubMenu']!='0')
- {
- if(!in_array($CurrentUrlId['SubMenu'],$AllowedSubMenu))
- {
- redirect('dashboard','refresh');
- }
- }
- if($this->uri->segment(1)=='meeting-details'){ $SD['MD'] = $data['MD']; } // setup side menu
- $HeadData['PageName'] = $PageName;
- $this->load->view('include/header',$HeadData);
- $this->load->view('include/head',$HeadData);
- $this->load->view('include/sidemenu',$SD);
- $this->load->view($page,$data);
- $this->load->view('include/footer');
- }
- ############################################ END OF COMMON VIEW PAGE ##############################
- ############################################ LOGOUT ###############################################
- public function logout()
- {
- // Activity Log Record
- $user_data = $this->session->userdata('logged_in');
- $head = 'Logged Out';
- $description = $user_data['name'].' ('.$user_data['username'].') Has been Logged Out';
- $this->Common_model->create_activity_log($head,$description,'',array(),array(),'1');
- // Activity Log Record
- session_destroy();
- redirect('home','refresh');
- }
- ############################################ END OF LOGOUT ########################################
- ############################################ CHANGE PASSWORD ######################################
- public function change_password()
- {
- if(isset($_POST['ChangePassword']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('current_url','current_url','trim|required|xss_clean');
- $this->form_validation->set_rules('current_password','current_password','trim|required|xss_clean');
- $this->form_validation->set_rules('new_password','new_password','trim|required|xss_clean|min_length[8]');
- $this->form_validation->set_rules('confirm_password','confirm_password','trim|required|xss_clean|min_length[8]');
- $current_url = $this->input->post('current_url');
- if($this->form_validation->run())
- {
- $current_password = $this->input->post('current_password');
- $new_password = $this->input->post('new_password');
- $confirm_password = $this->input->post('confirm_password');
- $users_id = $this->session->userdata('logged_in')['users_id'];
- $UD = $this->Common_model->get_user_details($users_id);
- if($UD['password']==MD5($current_password))
- {
- if($new_password==$confirm_password)
- {
- $value = array('password'=>MD5($new_password));
- $where = array('users_id'=>$users_id);
- $this->Common_model->common_update('users',$value,$where);
- $this->Common_model->Set_Message('1','Password changed successfully');
- // sent Mail - password change
- if($UD['privilege_id']=='4' || $UD['privilege_id']=='5')
- {
- $this->SentMail('8',$UD['username'],'');
- }
- // sent Mail - password change
- }
- else
- {
- $this->Common_model->Set_Message('2','Password not matching');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','Current password is incorrect');
- }
- redirect($current_url);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect($current_url);
- }
- }
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('dashboard');
- }
- ############################################ END OF CHANGE PASSWORD ###############################
- ############################################ INDEX ################################################
- public function index()
- {
- redirect('dashboard','refresh');
- }
- ############################################ END OF INDEX #########################################
- ############################################ UPDATE PASSWORD ######################################
- public function update_password()
- {
- $user_data = $this->session->userdata('logged_in');
- if(isset($_POST['ChangePassword']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('password','Password','trim|required|xss_clean|min_length[8]');
- $this->form_validation->set_rules('c_password','Confirm Password','trim|required|xss_clean|min_length[8]|matches[password]');
- if($this->form_validation->run())
- {
- $password = $this->input->post('password');
- $value = array('password'=>MD5($password),'first_login_status'=>'1');
- $where = array('users_id'=>$user_data['users_id']);
- $this->Common_model->common_update('users',$value,$where);
- $UD = $this->Common_model->get_user_details($user_data['users_id']);
- // sent Mail - password change
- if($UD['privilege_id']=='4' || $UD['privilege_id']=='5')
- {
- $this->SentMail('8',$UD['username'],'');
- }
- // sent Mail - password change
- // reset session
- $sess_data = $user_data;
- $sess_data['first_login_status'] = '1';
- $this->session->set_userdata('logged_in', $sess_data);
- $this->Common_model->Set_message('1','Password changed successfully');
- redirect('dashboard');
- }
- }
- $this->load->view('dashboard/update_password','');
- }
- ############################################ END OF UPDATE PASSWORD ###############################
- ############################################ DASHBOARDD ###########################################
- public function dashboard()
- {
- $data = array();
- if($this->session->userdata('logged_in')['privilege_id']==4)
- {
- // dashboard statistics
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- // $data['TotalMeetings'] = $this->Manage_model->get_meetings_total_count($organizations_id);
- // $data['CancelledMeetings'] = $this->Manage_model->get_meetings_cancelled_count($organizations_id);
- // $data['UpcomingMeetings'] = $this->Manage_model->get_meetings_upcoming_count($organizations_id);
- // $data['CompletedMeetings'] = $this->Manage_model->get_meetings_completed_count($organizations_id);
- $data['TotalCompanies'] = $this->Manage_model->get_total_companies($organizations_id);
- $data['TotalCompanyMembers'] = $this->Manage_model->get_total_company_members($organizations_id);
- $data['TotalOrgMembers'] = $this->Manage_model->get_total_org_members($organizations_id);
- $data['TotalOrgSecurities'] = $this->Manage_model->get_total_org_securities($organizations_id);
- $data['PendingRequests'] = $this->Manage_model->get_total_org_pending_requests($organizations_id);
- // dashboard statistics
- // org details
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['BalanceMeetings'] = $OD['meetings_count'];
- $data['MembersPerMeeting'] = $OD['members_count'];
- // List
- // $data['UpcomingMeetingsList'] = $this->Manage_model->view_upcoming_meetings();
- // $data['LatestMeetingsList'] = $this->Manage_model->view_latest_meetings();
- $data['OD'] = $OD;
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==5)
- {
- // dashboard statistics
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $data['TotalMeetings'] = $this->Manage_model->get_meetings_total_count($organizations_id);
- $data['CancelledMeetings'] = $this->Manage_model->get_meetings_cancelled_count($organizations_id);
- $data['UpcomingMeetings'] = $this->Manage_model->get_meetings_upcoming_count($organizations_id);
- $data['CompletedMeetings'] = $this->Manage_model->get_meetings_completed_count($organizations_id);
- $data['TotalOrgMembers'] = $this->Manage_model->get_total_org_members($organizations_id);
- $data['TotalOrgSecurities'] = $this->Manage_model->get_total_org_securities($organizations_id);
- // dashboard statistics
- // org details
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['BalanceMeetings'] = $OD['meetings_count'];
- $data['MembersPerMeeting'] = $OD['members_count'];
- // List
- $data['OD'] = $OD;
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==1 || $this->session->userdata('logged_in')['privilege_id']==2)
- {
- // $data['TotalMeetings'] = $this->Manage_model->get_meetings_total_count('');
- // $data['CancelledMeetings'] = $this->Manage_model->get_meetings_cancelled_count('');
- // $data['UpcomingMeetings'] = $this->Manage_model->get_meetings_upcoming_count('');
- // $data['CompletedMeetings'] = $this->Manage_model->get_meetings_completed_count('');
- // $data['TotalMembers'] = $this->Manage_model->get_total_members();
- $data['TotalCompanies'] = $this->Manage_model->get_total_companies('');
- $data['TotalOrganization'] = $this->Manage_model->get_total_organizations();
- $data['TotalRegistrations'] = $this->Manage_model->get_total_registrations();
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $country_id = $this->session->userdata('logged_in')['table_id']; // for country admin only
- $data['TotalMeetings'] = $this->Manage_model->get_meetings_total_count('',$country_id);
- $data['CancelledMeetings'] = $this->Manage_model->get_meetings_cancelled_count('',$country_id);
- $data['UpcomingMeetings'] = $this->Manage_model->get_meetings_upcoming_count('',$country_id);
- $data['CompletedMeetings'] = $this->Manage_model->get_meetings_completed_count('',$country_id);
- $data['TotalMembers'] = $this->Manage_model->get_total_members($country_id);
- $data['TotalCompanies'] = $this->Manage_model->get_total_companies('',$country_id);
- $data['TotalOrganization'] = $this->Manage_model->get_total_organizations($country_id);
- $data['TotalRegistrations'] = $this->Manage_model->get_total_registrations($country_id);
- $data['OD'] = $this->Manage_model->get_country_admin_details($country_id);
- $FD = array('country_id'=>$country_id,'start_date'=>'','end_date'=>'');
- $data['GrandTotal'] = $this->Manage_model->subscription_report_grand_total($FD,'','','0');
- $data['TotalSubscription'] = $this->Manage_model->get_total_subscription($FD,'','','0');
- }
- if($this->session->userdata('logged_in')['privilege_id']==4)
- {
- $MenuName = 'Organization Dashboard';
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==5)
- {
- $MenuName = 'Residential Dashboard';
- }
- else
- {
- $MenuName = 'Meet Pass Dashboard';
- }
- $this->CommonPage('dashboard/dashboard',$data,$MenuName);
- }
- ############################################ END OF DASHBOARDD ####################################
- ############################################ COMMON AJAX REQUESTS #################################
- public function get_places_select()
- {
- $Data = '<option value="">Select Place</option>';
- if(isset($_POST['data_id']))
- {
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $country_id = $this->input->post('data_id');
- $DT = $this->Manage_model->select_view_places($country_id);
- foreach($DT as $DT1)
- {
- $Data .= '<option value="'.$DT1->places_id.'">'.$DT1->places.'</option>';
- }
- }
- }
- $data['result'] = $Data;
- echo json_encode($data);
- }
- public function get_members_autocomplete_type()
- {
- $data['response'] = 'false';
- $data['message'] = array();
- if(isset($_POST['keyword']))
- {
- $this->form_validation->set_rules('keyword','keyword','trim|required|xss_clean');
- $this->form_validation->set_rules('type_id','type_id','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $keyword = $this->input->post('keyword');
- $type_id = $this->input->post('type_id');
- if($type_id==0)
- {
- $CD = $this->Manage_model->get_organization_members_autocomplete($keyword);
- }
- else
- {
- $CD = $this->Manage_model->get_company_members_autocomplete($keyword);
- }
- $data['response'] = 'true';
- $data['message'] = $CD;
- }
- }
- echo json_encode($data);
- }
- public function get_members_autocomplete_meetings()
- {
- $CD = array();
- if(isset($_POST['member_type']))
- {
- $this->form_validation->set_rules('member_type','member_type','trim|required|xss_clean');
- $this->form_validation->set_rules('company_id','company_id','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $member_type = $this->input->post('member_type');
- $company_id = $this->input->post('company_id');
- if($member_type==0)
- {
- $CD = $this->Manage_model->view_members_select();
- }
- else
- {
- $CD = $this->Manage_model->view_company_members_select($company_id);
- }
- }
- }
- $Message = '<input type="text" class="form-control mb10 form-control-sm" id="SearchMember" onkeyup="search_member_list()" placeholder="Search"><li class="SelectAll"><label class="CheckBoxLabel" for="MainCheckBox"><input type="checkbox" name="MainCheckBox" id="MainCheckBox"> Select All</label></li>';
- foreach($CD as $DT1)
- {
- $Message .= '<li><label class="CheckBoxLabel" for="CHK'.$DT1->members_id.'"><input type="checkbox" class="SubCheckBox" name="members_id['.$DT1->members_sub_id.']" id="CHK'.$DT1->members_id.'" value="'.$DT1->members_id.'"> '.$DT1->name.' - '.$DT1->phone.' - '.$DT1->designation.'</label></li>';
- }
- echo json_encode($Message);
- }
- ############################################ END OF COMMON AJAX REQUESTS ##########################
- ############################################ ASSIGN PRIVILEGE MENU ################################
- public function assign_menu()
- {
- if(isset($_POST['save_menu']))
- {
- $created_by = $this->session->userdata('logged_in')['users_id'];
- $privilege_id = trim($this->input->post('privilege_id'));
- if($privilege_id!='' && $privilege_id!='0')
- {
- $main_menu = $sub_menu = array();
- if(isset($_POST['main_menu']))
- {
- $main_menu = $this->input->post('main_menu');
- }
- if(isset($_POST['sub_menu']))
- {
- $sub_menu = $this->input->post('sub_menu');
- }
- $main_menu[] = '1';
- $main_menu = array_unique($main_menu);
- $main_menu = json_encode($main_menu);
- $sub_menu = json_encode($sub_menu);
- $AP_menu = $this->Manage_model->get_privilege_menu($privilege_id);
- if(!empty($AP_menu))
- {
- $where = array('privilege_id'=>$privilege_id);
- $value = array('main_menu'=>$main_menu,'sub_menu'=>$sub_menu);
- $this->Common_model->common_update('crm_menu_user',$value,$where);
- }
- else
- {
- $value = array('created_by'=>$created_by,'privilege_id'=>$privilege_id,'main_menu'=>$main_menu,'sub_menu'=>$sub_menu);
- $this->Common_model->common_insert('crm_menu_user',$value);
- }
- $this->Common_model->Set_Message('1',"<strong>Success!</strong> User Menu Re-arranged Successfully");
- $_SESSION['AM_privilege_id'] = $privilege_id;
- // Activity Log Record
- $head = 'CRM Menu Updated';
- $description = 'User Menu Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array(),'2');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Oops something went wrong. Please try again.");
- }
- redirect(current_url());
- }
- if(isset($_POST['submit']))
- {
- $privilege_id = trim($this->input->post('privilege_id'));
- if($privilege_id!='' && $privilege_id!='0')
- {
- $_SESSION['AM_privilege_id'] = $privilege_id;
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Oops something went wrong. Please try again.");
- }
- redirect(current_url());
- }
- elseif(isset($_SESSION['AM_privilege_id']) && $_SESSION['AM_privilege_id']!='')
- {
- $privilege_id = $_SESSION['AM_privilege_id'];
- $_SESSION['AM_privilege_id'] = '';
- }
- else
- {
- $privilege_id = $_SESSION['AM_privilege_id'] = '';
- }
- if($privilege_id!='')
- {
- $data['menu'] = $this->Manage_model->get_side_menu();
- $data['AP_menu'] = $this->Manage_model->get_privilege_menu($privilege_id);
- }
- $data['privilege_id'] = $privilege_id;
- $data['privilege'] = $this->Manage_model->get_privilege_select();
- $this->CommonPage('manage/assign_menu',$data,'Menu Assign');
- }
- ############################################ END OF ASSIGN PRIVILEGE MENU #########################
- ############################################ VIEW ORGANIZATIONS ###################################
- public function view_organizations()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('privilege_id','Privilege','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('places_id','Place','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('organization_type_id','Type','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('email','Email','trim|required|xss_clean|valid_email|is_unique[organizations.email]');
- $this->form_validation->set_rules('location','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('latitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('longitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('building_name','Building Name','trim|required|xss_clean');
- $this->form_validation->set_rules('building_number','Building Number','trim|required|xss_clean');
- $this->form_validation->set_rules('floor_number','Floor Number','trim|required|xss_clean');
- $this->form_validation->set_rules('office_number','Office Number','trim|required|xss_clean');
- $this->form_validation->set_rules('near_landmark','Near Landmark','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_name','CP Name','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_phone','CP Pphone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('cp_email','CP Email','trim|required|xss_clean|valid_email');
- $this->form_validation->set_rules('cp_designation','CP Designation','trim|required|xss_clean');
- if($this->input->post('submit')=='Save')
- {
- $this->form_validation->set_rules('organizations_id','Organizations ID','trim|xss_clean');
- }
- else
- {
- $this->form_validation->set_rules('organizations_id','Organizations ID','trim|xss_clean|numeric|required');
- }
- if($this->form_validation->run())
- {
- $privilege_id = $this->input->post('privilege_id');
- $country_id = $this->input->post('country_id');
- $places_id = $this->input->post('places_id');
- $organization_type_id = $this->input->post('organization_type_id');
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $location = $this->input->post('location');
- $latitude = $this->input->post('latitude');
- $longitude = $this->input->post('longitude');
- $building_name = $this->input->post('building_name');
- $building_number = $this->input->post('building_number');
- $floor_number = $this->input->post('floor_number');
- $office_number = $this->input->post('office_number');
- $near_landmark = $this->input->post('near_landmark');
- $cp_name = $this->input->post('cp_name');
- $cp_phone = $this->input->post('cp_phone');
- $cp_email = $this->input->post('cp_email');
- $cp_designation = $this->input->post('cp_designation');
- $organizations_id = $this->input->post('organizations_id');
- $submit = $this->input->post('submit');
- $ValidityDate = date('Y-m-d', strtotime('+14 days'));
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'privilege_id'=>$privilege_id,
- 'country_id'=>$country_id,
- 'places_id'=>$places_id,
- 'organization_type_id'=>$organization_type_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'building_name'=>$building_name,
- 'building_number'=>$building_number,
- 'floor_number'=>$floor_number,
- 'office_number'=>$office_number,
- 'near_landmark'=>$near_landmark,
- 'cp_name'=>ucwords($cp_name),
- 'cp_phone'=>$cp_phone,
- 'cp_email'=>strtolower($cp_email),
- 'cp_designation'=>$cp_designation,
- 'meetings_count'=>'10',
- 'members_count'=>'10',
- 'events_count'=>'2',
- 'events_members_count'=>'25',
- 'dedicated_link_availability'=>'1',
- 'app_create_meeting_status'=>'1',
- 'multiple_locations_status'=>'0',
- 'follow_up_meeting_status'=>'0',
- 'advanced_security_level'=>'0',
- 'packge_validity_upto'=>$ValidityDate,
- 'trial_start_date'=>date('Y-m-d'));
- $user_values = array('username'=>strtolower($email),
- 'password'=>MD5($phone),
- 'name'=>ucwords($name),
- 'privilege_id'=>$privilege_id,
- 'table_id'=>'0',
- 'image'=>'dummy-icon.jpg');
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/organizations/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- $image_name = $this->Common_model->image_upload('./uploads/users/','image');
- if($image_name!='')
- {
- $user_values['image'] = $image_name;
- }
- }
- if($submit=='Save')
- {
- $organizations_id = $this->Common_model->common_insert('organizations',$values);
- $this->Common_model->Set_Message('1',"Organization details entered successfully");
- // Activity Log Record
- $head = 'Add Organization';
- $description = 'Organization Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_id'=>$organizations_id),'3');
- // Activity Log Record
- $user_values['table_id'] = $organizations_id;
- $this->Common_model->common_insert('users',$user_values);
- // sent Mail - login credential
- $data['LoginDetails'] = array('username'=>strtolower($email),'password'=>$phone);
- $this->SentMail('6',$email,$data);
- // sent Mail - login credential
- // sent Mail - trial period
- $this->SentMail('7',$email,'');
- // sent Mail - trial period
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- // BLOCK ORG USER
- if(isset($_POST['block']) && $this->session->userdata('logged_in')['privilege_id']!=4)
- {
- $this->form_validation->set_rules('block_id','Block ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $block_id = $this->input->post('block_id');
- $where = array('table_id'=>$block_id);
- $value = array('users_status'=>'2');
- $this->Common_model->common_update('users',$value,$where);
- $this->Common_model->Set_Message('1','User blocked successfully.');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- // BLOCK ORG USER
- // BLOCK ORG USER
- if(isset($_POST['unblock']) && $this->session->userdata('logged_in')['privilege_id']!=4)
- {
- $this->form_validation->set_rules('unblock_id','Block ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $unblock_id = $this->input->post('unblock_id');
- $OD = $this->Manage_model->get_organization_details($unblock_id);
- if(!empty($OD))
- {
- // update table users
- $where = array('table_id'=>$unblock_id);
- $value = array('users_status'=>'0');
- $this->Common_model->common_update('users',$value,$where);
- // update table users_login_ip
- $where = array('username'=>$OD['email']);
- $value = array('users_login_ip_status'=>'1');
- $this->Common_model->common_update('users_login_ip',$value,$where);
- $this->Common_model->Set_Message('1','User unblocked successfully.');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- // BLOCK ORG USER
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'email','default'=>'');
- $param[] = array('key'=>'country_id','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_organizations($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['TypeData'] = $this->Manage_model->select_view_type();
- $data['OD'] = $this->Manage_model->view_organizations($FD,$start,$limit,'0');
- $this->CommonPage('organizations/view_organizations',$data,'View Organizations');
- }
- ############################################ END OF VIEW ORGANIZATIONS ############################
- ############################################ ORGANIZATION DETAILS #################################
- public function organizations_details_edit($organizations_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('privilege_id','Privilege','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('places_id','Place','trim|xss_clean|numeric');
- $this->form_validation->set_rules('organization_type_id','Type','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('email','Email','trim|required|xss_clean|valid_email');
- $this->form_validation->set_rules('location','Location','trim|xss_clean');
- $this->form_validation->set_rules('latitude','Location','trim|xss_clean');
- $this->form_validation->set_rules('longitude','Location','trim|xss_clean');
- $this->form_validation->set_rules('building_name','Building Name','trim|xss_clean');
- $this->form_validation->set_rules('building_number','Building Number','trim|xss_clean');
- $this->form_validation->set_rules('floor_number','Floor Number','trim|xss_clean');
- $this->form_validation->set_rules('office_number','Office Number','trim|xss_clean');
- $this->form_validation->set_rules('near_landmark','Near Landmark','trim|xss_clean');
- $this->form_validation->set_rules('cp_name','CP Name','trim|xss_clean');
- $this->form_validation->set_rules('cp_phone','CP Pphone','trim|xss_clean|numeric');
- $this->form_validation->set_rules('cp_email','CP Email','trim|xss_clean|valid_email');
- $this->form_validation->set_rules('cp_designation','CP Designation','trim|xss_clean');
- $this->form_validation->set_rules('organizations_id','Organizations ID','trim|xss_clean|numeric|required');
- if($this->form_validation->run())
- {
- $privilege_id = $this->input->post('privilege_id');
- $country_id = $this->input->post('country_id');
- $places_id = $this->input->post('places_id');
- $organization_type_id = $this->input->post('organization_type_id');
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $location = $this->input->post('location');
- $latitude = $this->input->post('latitude');
- $longitude = $this->input->post('longitude');
- $building_name = $this->input->post('building_name');
- $building_number = $this->input->post('building_number');
- $floor_number = $this->input->post('floor_number');
- $office_number = $this->input->post('office_number');
- $near_landmark = $this->input->post('near_landmark');
- $cp_name = $this->input->post('cp_name');
- $cp_phone = $this->input->post('cp_phone');
- $cp_email = $this->input->post('cp_email');
- $cp_designation = $this->input->post('cp_designation');
- $organizations_id = $this->input->post('organizations_id');
- $submit = $this->input->post('submit');
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'privilege_id'=>$privilege_id,
- 'country_id'=>$country_id,
- 'places_id'=>$places_id,
- 'organization_type_id'=>$organization_type_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'building_name'=>$building_name,
- 'building_number'=>$building_number,
- 'floor_number'=>$floor_number,
- 'office_number'=>$office_number,
- 'near_landmark'=>$near_landmark,
- 'cp_name'=>ucwords($cp_name),
- 'cp_phone'=>$cp_phone,
- 'cp_email'=>strtolower($cp_email),
- 'cp_designation'=>$cp_designation);
- $user_values = array('username'=>strtolower($email),'name'=>ucwords($name),'privilege_id'=>$privilege_id);
- if($this->session->userdata('logged_in')['privilege_id']==4)
- {
- unset($values['email']);
- unset($user_values['username']);
- unset($user_values['privilege_id']);
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==5)
- {
- unset($values['email']);
- unset($user_values['username']);
- unset($user_values['privilege_id']);
- }
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/organizations/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- $image_name = $this->Common_model->image_upload('./uploads/users/','image');
- if($image_name!='')
- {
- $user_values['image'] = $image_name;
- }
- }
- $EXIST = $this->Manage_model->check_organizations_email_exist($email,$organizations_id);
- if(empty($EXIST))
- {
- if($submit=='Update')
- {
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$values,$where);
- $this->Common_model->Set_Message('1',"Organization details updated successfully.");
- // Activity Log Record
- $head = 'Update Organization';
- $description = 'Organization Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_id'=>$organizations_id),'3');
- // Activity Log Record
- $where = array('table_id'=>$organizations_id);
- $this->Common_model->common_update('users',$user_values,$where);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Organization email already exist.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- if($this->session->userdata('logged_in')['privilege_id']==4)
- {
- redirect('profile');
- }
- elseif($this->session->userdata('logged_in')['privilege_id']==5)
- {
- redirect('profile');
- }
- else
- {
- redirect('organizations-details/'.$organizations_id.'/edit');
- }
- }
- ############################################ END OF ORGANIZATION DETAILS ##########################
- ############################################ ASSIGN SUBSCRIPTION PACKAGES #########################
- public function assign_subscription_packages($organizations_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['AssignPackage']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('organizations_id','organizations','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('subscription_packages_id','subscription package','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_id = $this->input->post('organizations_id');
- $subscription_packages_id = $this->input->post('subscription_packages_id');
- $EXIST = $this->Manage_model->check_organizations_package_exist($subscription_packages_id,$organizations_id);
- if(empty($EXIST))
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),'organizations_id'=>$organizations_id,'subscription_packages_id'=>$subscription_packages_id);
- $this->Common_model->common_insert('packages_dedicated',$values);
- $this->Common_model->Set_Message('1',"Organization package updated successfully.");
- // Activity Log Record
- $head = 'Assign Organization Package';
- $description = 'Organization Package Details Has Been Assignd By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_id'=>$organizations_id),'3');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Organization package already exist.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('organizations-details/'.$organizations_id.'/assigned-packages');
- }
- ############################################ END OF ASSIGN SUBSCRIPTION PACKAGES ##################
- ############################################ ORGANIZATION DETAILS #################################
- public function organizations_details($organizations_id,$tab)
- {
- // set active tab details
- $data['Details'] = $data['Edit'] = $data['AssignedPackages'] = $data['Subscriptions'] = $data['FreePackages'] = '';
- if($tab=='details'){ $data['Details'] = 'show active'; }
- elseif($tab=='edit'){ $data['Edit'] = 'show active'; }
- elseif($tab=='assigned-packages'){ $data['AssignedPackages'] = 'show active'; }
- elseif($tab=='free-packages'){ $data['FreePackages'] = 'show active'; }
- elseif($tab=='subscriptions'){ $data['Subscriptions'] = 'show active'; }
- else{ $data['Details'] = 'show active'; }
- // set active tab details
- // remove package
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('packages_dedicated_id'=>$delete_id);
- $value = array('packages_dedicated_status'=>'1');
- $this->Common_model->common_update('packages_dedicated',$value,$where);
- $this->Common_model->Set_Message('1','Package details removed successfully.');
- // Activity Log Record
- $head = 'Remove Package';
- $description = 'Package Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('packages_dedicated_id'=>$delete_id),'3');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- // remove package
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if(empty($OD)){ redirect('organizations'); }
- $data['OD'] = $OD;
- $data['SD'] = $this->Manage_model->organizations_packages_history($organizations_id,'0','100','0');
- $data['SDFree'] = $this->Manage_model->organizations_packages_history_free($organizations_id,'0','100','0');
- $data['PackageData'] = $this->Manage_model->organizations_dedicated_packages_list($OD['country_id']);
- $data['PackageDataFree'] = $this->Manage_model->organizations_dedicated_packages_list_free($OD['country_id']);
- $data['DedicatedPackage'] = $this->Manage_model->organizations_dedicated_packages_data($organizations_id);
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['TypeData'] = $this->Manage_model->select_view_type();
- $data['PlaceData'] = $this->Manage_model->select_view_places($OD['country_id']);
- // organizations_details
- $this->CommonPage('organizations/organizations_details',$data,$OD['name']);
- }
- ############################################ END OF ORGANIZATION DETAILS ##########################
- ############################################ VIEW MEMBERS #########################################
- public function get_members_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_members_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_member_details($organizations_members_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_members()
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_data($organizations_id);
- # UPLOAD FILE IMPORT
- if(isset($_POST['UploadFile']))
- {
- if(isset($_FILES['import_file']) && $_FILES['import_file']['name']!='')
- {
- $FileName = $this->Common_model->excel_upload('./uploads/members_excel/','import_file');
- if($FileName!='')
- {
- $Result = $this->members_excel_import($FileName);
- if(!empty($Result))
- {
- $this->Common_model->Set_Message('1',"Members imported successfully. <strong>(Total Rows: ".$Result['Total'].", Imported Rows: ".$Result['Uploaded'].")</strong>");
- redirect(current_url());
- }
- }
- }
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- # UPLOAD FILE IMPORT
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('email','Email','trim|required|xss_clean|valid_email');
- if($this->session->userdata('logged_in')['privilege_id']=='4')
- {
- $this->form_validation->set_rules('designation','Designation','trim|required|xss_clean');
- }
- else
- {
- $this->form_validation->set_rules('designation','House Number','trim|required|xss_clean');
- }
- $this->form_validation->set_rules('verification_id','ID/Passport','trim|xss_clean');
- $this->form_validation->set_rules('meeting_privilege','Meeting Privilege','trim|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $country_id = $OD['country_id'];
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $designation = $this->input->post('designation');
- $verification_id = $this->input->post('verification_id');
- $meeting_privilege = $this->input->post('meeting_privilege');
- $reporting_privilege = $this->input->post('reporting_privilege');
- $submit = $this->input->post('submit');
- if($OD['app_create_meeting_status']=='0')
- {
- $meeting_privilege = $reporting_privilege = '0';
- }
- $Image = '';
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$phone);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- if($this->input->post('submit')=='Save')
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_id'=>$country_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- $values = array('organizations_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($name),
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id,
- 'meeting_privilege'=>$meeting_privilege,
- 'reporting_privilege'=>$reporting_privilege);
- $CheckTblOrgMember = $this->Manage_model->organizations_members_exist($organizations_id,$members_id);
- if(!empty($CheckTblOrgMember))
- {
- if($this->input->post('submit')=='Update')
- {
- $where = array('organizations_id'=>$organizations_id,'members_id'=>$members_id,'organizations_members_id'=>$CheckTblOrgMember['organizations_members_id']);
- $this->Common_model->common_update('organizations_members',$values,$where);
- $this->Common_model->Set_Message('1',"Member Details Updated Successfully");
- // Activity Log Record
- $head = 'Update Member';
- $description = 'Member Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Member already exist.");
- }
- }
- else
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $this->Common_model->common_insert('organizations_members',$values);
- $this->Common_model->Set_Message('1',"New member added successfully.");
- // Activity Log Record
- $head = 'Add Member';
- $description = 'Member Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('organizations_members_id'=>$delete_id,'organizations_id'=>$organizations_id);
- $value = array('organizations_members_status'=>'1');
- $this->Common_model->common_update('organizations_members',$value,$where);
- $this->Common_model->Set_Message('1','Member details removed successfully.');
- // Activity Log Record
- $head = 'Remove Member';
- $description = 'Member Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_members_id'=>$delete_id),'4');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'email','default'=>'');
- $param[] = array('key'=>'phone','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_members($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['OD'] = $OD;
- $data['FD'] = $FD;
- $data['MD'] = $this->Manage_model->view_members($FD,$start,$limit,'0');
- $this->CommonPage('organizations/view_members',$data,'List of members in your organization');
- }
- ############################################ END OF VIEW MEMBERS ##################################
- ############################################ VIEW COMPANY #########################################
- public function get_company_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $data_id = $this->input->post('data_id');
- $select = array('company_id,name,phone,email,company_category_id');
- $where = array('company_id'=>$data_id);
- $Result = $this->Common_model->globalfetch('company',$select,$where);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_company()
- {
- # UPLOAD FILE IMPORT
- if(isset($_POST['UploadFile']))
- {
- if(isset($_FILES['import_file']) && $_FILES['import_file']['name']!='')
- {
- $FileName = $this->Common_model->excel_upload('./uploads/members_excel/','import_file');
- if($FileName!='')
- {
- $Result = $this->company_excel_import($FileName);
- if(!empty($Result))
- {
- $this->Common_model->Set_Message('1',"Organization details imported successfully. <strong>(Total Rows: ".$Result['Total'].", Imported Rows: ".$Result['Uploaded'].")</strong>");
- redirect(current_url());
- }
- }
- }
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- # UPLOAD FILE IMPORT
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('company_category_id','Category ID','trim|required|xss_clean');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('email','Email','trim|required|xss_clean|valid_email');
- if($this->input->post('submit')=='Save')
- {
- $this->form_validation->set_rules('company_id','Company ID','trim|xss_clean');
- }
- else
- {
- $this->form_validation->set_rules('company_id','Company ID','trim|xss_clean|numeric|required');
- }
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $company_category_id = $this->input->post('company_category_id');
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $company_id = $this->input->post('company_id');
- $submit = $this->input->post('submit');
- $values = array('organizations_id'=>$organizations_id,
- 'company_category_id'=>$company_category_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email));
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/company/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- }
- if($submit=='Save')
- {
- $CheckComapy = $this->Manage_model->check_company_exist($organizations_id,$email);
- if(empty($CheckComapy))
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $company_id = $this->Common_model->common_insert('company',$values);
- $this->Common_model->Set_Message('1',"Company added successfully.");
- // Activity Log Record
- $head = 'Add Company';
- $description = 'Company Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('company_id'=>$company_id),'5');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Selected Email already exist.');
- }
- }
- else
- {
- $CheckComapyOwner = $this->Manage_model->check_company_owner_details($organizations_id,$company_id);
- if(!empty($CheckComapyOwner))
- {
- $where = array('company_id'=>$company_id);
- $this->Common_model->common_update('company',$values,$where);
- $this->Common_model->Set_Message('1',"Company details updated successfully.");
- // Activity Log Record
- $head = 'Update Company';
- $description = 'Company Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('company_id'=>$company_id),'5');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $delete_id = $this->input->post('delete_id');
- $CheckMembers = $this->Manage_model->check_company_members($organizations_id,$delete_id);
- if(empty($CheckMembers))
- {
- $where = array('company_id'=>$delete_id);
- $value = array('company_status'=>'1');
- $this->Common_model->common_update('company',$value,$where);
- $this->Common_model->Set_Message('1','Company details removed successfully.');
- // Activity Log Record
- $head = 'Remove Company';
- $description = 'Company Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('company_id'=>$delete_id),'5');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Company cannot be deleted.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'company_category_id','default'=>'');
- $param[] = array('key'=>'phone','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_company($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['CD'] = $this->Manage_model->view_company($FD,$start,$limit,'0');
- $data['CL'] = $this->Manage_model->select_view_company_category();
- $this->CommonPage('organizations/view_company',$data,'List of registered organizations');
- }
- ############################################ END OF VIEW COMPANY ##################################
- ############################################ VIEW MEMBERS #########################################
- public function get_company_members_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $company_members_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_company_member_details($company_members_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_company_members()
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_data($organizations_id);
- # UPLOAD FILE IMPORT
- if(isset($_POST['UploadFile']))
- {
- $this->form_validation->set_rules('company_id','Company','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $company_id = $this->input->post('company_id');
- $country_id = $this->input->post('country_id');
- if(isset($_FILES['import_file']) && $_FILES['import_file']['name']!='')
- {
- $FileName = $this->Common_model->excel_upload('./uploads/members_excel/','import_file');
- if($FileName!='')
- {
- $Result = $this->company_members_excel_import($FileName,$company_id,$country_id);
- if(!empty($Result))
- {
- $this->Common_model->Set_Message('1',"Members imported successfully. <strong>(Total Rows: ".$Result['Total'].", Imported Rows: ".$Result['Uploaded'].")</strong>");
- redirect(current_url());
- }
- }
- }
- }
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- # UPLOAD FILE IMPORT
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('company_id','Company','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('company_members_id','CM ID','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('Ecompany_id','Company','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('email','Email','trim|required|xss_clean|valid_email');
- $this->form_validation->set_rules('designation','Designation','trim|required|xss_clean');
- $this->form_validation->set_rules('verification_id','ID/Passport','trim|xss_clean');
- $country_id = $this->input->post('country_id');
- $CNTRYMOB = $this->Manage_model->get_country_details_row($country_id)['mobile_number_length'];
- $this->form_validation->set_rules('phone','Phone','trim|required|xss_clean|numeric|exact_length['.$CNTRYMOB.']');
- if($this->form_validation->run())
- {
- $company_members_id = $this->input->post('company_members_id');
- $company_id = $this->input->post('company_id');
- $Ecompany_id = $this->input->post('Ecompany_id');
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $designation = $this->input->post('designation');
- $verification_id = $this->input->post('verification_id');
- $submit = $this->input->post('submit');
- if($submit=='Save')
- {
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$phone);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_id'=>$country_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- $values = array('company_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'company_id'=>$company_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($name),
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist($company_id,$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $this->Common_model->common_insert('company_members',$values);
- $this->Common_model->Set_Message('1',"Member added successfully.");
- redirect(current_url());
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Mobile number already exist.');
- redirect(current_url());
- }
- }
- elseif($submit=='Update')
- {
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$phone);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- $values = array('company_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'company_id'=>$company_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($name),
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- if($company_id!=$Ecompany_id)
- {
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist($company_id,$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $where = array('company_members_id'=>$company_members_id,'members_id'=>$members_id);
- $this->Common_model->common_update('company_members',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>SUCCESS!</strong> Member Details Updated Successfully");
- redirect(current_url());
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Member and organization already exist.');
- redirect(current_url());
- }
- }
- elseif($company_id==$Ecompany_id)
- {
- $where = array('company_members_id'=>$company_members_id,'members_id'=>$members_id);
- $this->Common_model->common_update('company_members',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>SUCCESS!</strong> Member Details Updated Successfully");
- redirect(current_url());
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $delete_id = $this->input->post('delete_id');
- $where = array('company_members_id'=>$delete_id,'organizations_id'=>$organizations_id);
- $value = array('company_members_status'=>'1');
- $this->Common_model->common_update('company_members',$value,$where);
- $this->Common_model->Set_Message('1','Member Details Removed Successfully');
- // Activity Log Record
- $head = 'Remove Member';
- $description = 'Member Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('company_members_id'=>$delete_id),'4');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'company_id','default'=>'');
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'phone','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_company_members($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['OD'] = $OD;
- $data['CountryData'] = $this->Manage_model->select_view_country_member();
- $data['MD'] = $this->Manage_model->view_company_members($FD,$start,$limit,'0');
- $data['CL'] = $this->Manage_model->view_company_list();
- $this->CommonPage('organizations/view_company_members',$data,'List of members from other organizations');
- }
- ############################################ END OF VIEW MEMBERS ##################################
- ############################################ EDIT MEETINGS DETAILS ################################
- public function edit_meeting_details($meetings_id)
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $this->load->view('include/preloader');
- if(isset($_POST['UpdateMeetingDetails']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('meeting_title','Title','trim|required|xss_clean');
- $this->form_validation->set_rules('date','Meeting Date','trim|required|xss_clean|exact_length[10]');
- $this->form_validation->set_rules('time','Meeting Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('end_time','Meeting End Time','trim|required|xss_clean|exact_length[5]');
- // $this->form_validation->set_rules('location','Location','trim|required|xss_clean');
- // $this->form_validation->set_rules('latitude','Location','trim|required|xss_clean');
- // $this->form_validation->set_rules('longitude','Location','trim|required|xss_clean');
- // $this->form_validation->set_rules('address','Address','trim|required|xss_clean');
- $this->form_validation->set_rules('car_pass','Car Pass','trim|required|xss_clean');
- $this->form_validation->set_rules('participant_status','Member Visibility','trim|required|xss_clean');
- $this->form_validation->set_rules('description','Description','trim|xss_clean');
- $this->form_validation->set_rules('meeting_link','Link','trim|xss_clean|valid_url');
- $this->form_validation->set_rules('admit_before','Admit Before','trim|required|numeric');
- $this->form_validation->set_rules('admit_after','Admit After','trim|required|numeric');
- if($OD['multiple_locations_status']=='1')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|required|numeric');
- }
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $meeting_title = $this->input->post('meeting_title');
- $date = $this->input->post('date');
- $time = $this->input->post('time');
- $end_time = $this->input->post('end_time');
- // $location = $this->input->post('location');
- // $latitude = $this->input->post('latitude');
- // $longitude = $this->input->post('longitude');
- // $address = $this->input->post('address');
- $description = $this->input->post('description');
- $meeting_link = $this->input->post('meeting_link');
- $car_pass = $this->input->post('car_pass');
- $participant_status = $this->input->post('participant_status');
- $admit_before = $this->input->post('admit_before');
- $admit_after = $this->input->post('admit_after');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $date = $this->Common_model->date_format_changer($date);
- $meeting_datetime = $date.' '.$time.':00';
- $meeting_end_datetime = $date.' '.$end_time.':00';
- $datetime = date('Y-m-d H:i:s');
- $values = array('meeting_title'=>$meeting_title,
- 'meeting_datetime'=>$meeting_datetime,
- 'meeting_end_datetime'=>$meeting_end_datetime,
- // 'location'=>$location,
- // 'latitude'=>$latitude,
- // 'longitude'=>$longitude,
- // 'address'=>$address,
- 'description'=>$description,
- 'meeting_link'=>$meeting_link,
- 'car_pass'=>$car_pass,
- 'admit_before'=>$admit_before,
- 'admit_after'=>$admit_after);
- // setup address data
- if($OD['multiple_locations_status']=='1')
- {
- $organizations_address_id = $this->input->post('organizations_address_id');
- if($organizations_address_id=='0') // address take from organization table
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = '0';
- $values['location'] = $OD['location'];
- $values['latitude'] = $OD['latitude'];
- $values['longitude'] = $OD['longitude'];
- $values['address'] = $address;
- }
- elseif($organizations_address_id>'0') // address take from address table
- {
- $AddressData = $this->Manage_model->get_organization_contact_details($organizations_address_id,$organizations_id);
- if(!empty($AddressData))
- {
- $address = array('Building Name: '.$AddressData['building_name'],'Building Number: '.$AddressData['building_number'],'Floor Number: '.$AddressData['floor_number'],'Unit Number: '.$AddressData['office_number'],'Near Landmark: '.$AddressData['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = $AddressData['organizations_address_id'];
- $values['location'] = $AddressData['location'];
- $values['latitude'] = $AddressData['latitude'];
- $values['longitude'] = $AddressData['longitude'];
- $values['address'] = $address;
- }
- }
- }
- // setup address data
- if($MD['meeting_type']=='0')
- {
- $values['participant_status'] = $participant_status;
- }
- if($meeting_end_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- if($MD['status']<2)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- // recheduled meeting notification
- if($MD['meeting_datetime']!=$meeting_datetime && $meeting_end_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- $MeetingMembersList = $this->Manage_model->get_meeting_members($meetings_id);
- foreach($MeetingMembersList as $DT1)
- {
- $members_id = $DT1->members_id;
- $status = $DT1->status;
- if($status==0)
- {
- // sent notification
- if($MD['meeting_type']=='0') // meeting
- {
- $Content = array('title'=>'Meeting Rescheduled','description'=>'A Meeting has been rescheduled for some reasons.','message'=>'','meetings_id'=>$meetings_id);
- }
- else // event
- {
- $Content = array('title'=>'Event Rescheduled','description'=>'An Event has been rescheduled for some reasons.','message'=>'','meetings_id'=>$meetings_id);
- }
- $this->SentNotification('5',$members_id,$Content);
- // sent notification
- }
- }
- }
- // recheduled meeting notification
- $where = array('meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1','Meeting details updated successfully.');
- // Activity Log Record
- $head = 'Update Meeting';
- $description = 'Meeting Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid date & time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/edit');
- }
- ############################################ END OF EDIT MEETINGS DETAILS #########################
- ############################################ EDIT MEETINGS DETAILS ################################
- public function save_meeting_mom($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['SaveMOM']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('mom','MOM','trim|xss_clean');
- $this->form_validation->set_rules('meetings_id','meetings_id','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $mom = $this->input->post('mom_info[]');
- $meetings_id = $this->input->post('meetings_id');
- $mom_summary = $this->input->post('mom_summary');
- $members = $this->input->post('members_MOM[]');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- // $values_mom = array('mom'=>$mom);
- $values['mom_summary'] = $mom_summary;
- $values_mom=array();
- for ($i=0; $i < count($mom); $i++) {
- $values_mom["mominfo"][] = array(
- 'mom'=>$mom[$i],
- 'membersmom'=>$members[$i],
- );
- $prms=array("mom"=>json_encode($values_mom));
- }
- // MOM Signature Required Status
- if(isset($_POST['SignatureRequired']) && $MD['meeting_type']=='0')
- {
- $values['mom_signature_status'] = '1';
- }
- else
- {
- $values['mom_signature_status'] = '0';
- }
- // MOM Signature Required Status
- if($MD['status']<2)
- {
- if($MD['meeting_end_datetime']<$datetime)
- {
- $where = array('meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->common_update('meetings',$prms,$where);
- if($MD['meeting_type']==0)
- {
- $this->Common_model->Set_Message('1','Minutes of Meeting updated.');
- }
- else
- {
- $this->Common_model->Set_Message('1','Event report updated.');
- }
- // MOM updated push notification - meeting notification
- if(isset($_POST['NotifyMembers']))
- {
- $MeetingMembersList = $this->Manage_model->get_meeting_members($meetings_id);
- foreach($MeetingMembersList as $DT1)
- {
- $members_id = $DT1->members_id;
- $status = $DT1->status;
- if($status==0)
- {
- // sent notification
- if($MD['meeting_type']==0)
- {
- $Content = array('title'=>'MOM Updated','description'=>'The MOM has been updated.','message'=>'','meetings_id'=>$meetings_id);
- }
- else
- {
- $Content = array('title'=>'Event Report Updated','description'=>'The event report has been updated.','message'=>'','meetings_id'=>$meetings_id);
- }
- $this->SentNotification('5',$members_id,$Content);
- // sent notification
- }
- }
- }
- // MOM updated push notification - meeting notification
- // MOM updated Emal To company Email
- if(isset($_POST['NotifyCompany']))
- {
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- $File = $this->generate_meeting_report($meetings_id); // creating Meeting Report PDF
- $CompanyEmail = array();
- $MeetingCompanyList = $this->Manage_model->get_meeting_members_company($meetings_id);
- foreach($MeetingCompanyList as $DT1)
- {
- if(!in_array($DT1->email, $CompanyEmail))
- {
- $CompanyEmail[] = $DT1->email;
- $data['Subject'] = 'MOM of '.$MD['meeting_title'].' by '.$OD['name'];
- $data['File'] = $File;
- $data['Content'] = 'Thank you for participating '.$MD['meeting_title'].' with '.$OD['name'].' on '.date('d-m-Y', strtotime($MD['meeting_datetime']));
- $this->SentMail('12',$DT1->email,$data); // sent attached email
- }
- }
- // for members
- $MeetingMembersList = $this->Manage_model->get_meeting_members($meetings_id);
- foreach($MeetingMembersList as $DT1)
- {
- $members_id = $DT1->members_id;
- $status = $DT1->status;
- if($status==0 && $DT1->email!='')
- {
- $data['Subject'] = 'MOM of '.$MD['meeting_title'].' by '.$OD['name'];
- $data['File'] = $File;
- $data['Content'] = 'Thank you for participating '.$MD['meeting_title'].' with '.$OD['name'].' on '.date('d-m-Y', strtotime($MD['meeting_datetime']));
- $this->SentMail('12',$DT1->email,$data); // sent attached email
- }
- }
- }
- // MOM updated Emal To company Email
- // Activity Log Record
- $head = 'Update Meeting MOM';
- $description = 'Meeting MOM Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- else
- {
- if($MD['meeting_type']==0)
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> You cannot edit upcoming meeting minutes.");
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> You cannot edit upcoming event report.");
- }
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/mom');
- }
- ############################################ END OF EDIT MEETINGS DETAILS #########################
- ############################################ ASSIGN MEETING MEMBERS DETAILS #######################
- public function add_meeting_members($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['AssignMembers']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('member_type','Type','trim|required|xss_clean');
- $this->form_validation->set_rules('MainCheckBox','Main Check Box','trim|required|xss_clean');
- $this->form_validation->set_rules('members_id[]','Members','trim|required|xss_clean');
- $this->form_validation->set_rules('company_id','Company','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $member_type = $this->input->post('member_type');
- $company_id = $this->input->post('company_id');
- $MembersArray = $this->input->post('members_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if(count($MembersArray)>0)
- {
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- if($MD['meeting_type']==0) // meeting
- {
- $CountMeetingsMembers = $this->Manage_model->check_available_meetings_members_count();
- }
- else // event
- {
- $CountMeetingsMembers = $this->Manage_model->check_available_events_members_count();
- }
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- $CheckMembersLimit = $this->Manage_model->check_meetings_members_count($meetings_id);
- $CheckMembersLimit = $CheckMembersLimit+count($MembersArray);
- if($CheckMembersLimit<=$CountMeetingsMembers)
- {
- $i = 0;
- foreach($MembersArray as $members_sub_id => $members_id)
- {
- $CheckMemberExist = $this->Manage_model->check_meetings_members_exist($meetings_id,$members_id,$member_type);
- if(empty($CheckMemberExist))
- {
- $i++;
- $values = array('datetime'=>$datetime,
- 'meetings_id'=>$meetings_id,
- 'members_sub_id'=>$members_sub_id,
- 'company_id'=>$company_id,
- 'members_id'=>$members_id,
- 'member_type'=>$member_type);
- $meetings_participants_id = $this->Common_model->common_insert('meetings_participants',$values);
- $TicketNumber = 'MPT'.sprintf("%05d", $meetings_participants_id);
- $MD = $this->Manage_model->view_memeber_details($members_id);
- $MD['country_code'] = str_replace('+', '', $MD['country_code']);
- // sent notification
- if($MD['meeting_type']=='0' && $MD['country_code']=="971" && $MD['fcm_token']=="")
- {
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person. OPT-OUT "AD-Events" to 7726','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }elseif($MD['meeting_type']=='0')
- {
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- else
- {
- $Content = array('title'=>'Event Invitation','description'=>'You are invited for a new event with '.$OD['name'].'. ','message'=>'You are invited to a new evevt by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your evevt access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- if($MD['meeting_publish']=="1"){
- $this->SentNotification('1',$members_id,$Content,$members_sub_id,$member_type);
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- }
- if($i==50){ break; }
- }
- if($i>0)
- {
- $this->Common_model->Set_Message('1',"".$i." Member added successfully.");
- }
- else
- {
- if($MD['meeting_type']==0) // meeting
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Selected members already exist for this meeting.');
- }
- else // event
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Selected members already exist for this event.');
- }
- }
- }
- else
- {
- if($MD['meeting_type']==0) // meeting
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> You have exceeded maximum allowed meeting members '.$CountMeetingsMembers.'.');
- }
- else // event
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> You have exceeded maximum allowed event members '.$CountMeetingsMembers.'.');
- }
- }
- }
- else
- {
- if($MD['meeting_type']==0) // meeting
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- else // event
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired event details cannot be edited.");
- }
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- $fmd= $this->Manage_model->get_Folloupmetting_data($meetings_id);
- if(!empty($fmd)){
- $meetings_id= $fmd["meetings_id"];
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF ASSIGN MEETING MEMBERS DETAILS ################
- ############################################ REMOVE MEETING MEMBERS DETAILS #######################
- public function remove_meeting_members($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['DeleteMember']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('delete_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('remark','Remark','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('delete_id');
- $meetings_id = $this->input->post('meetings_id');
- $remark = $this->input->post('remark');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('status'=>'2','cancelled_remark'=>$remark);
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','Member details removed successfully');
- // sent notification
- $members_id = $this->Manage_model->view_meetings_memeber_details($meetings_participants_id)['members_id'];
- if($MD['meeting_type']=='0') // meeting
- {
- $Content = array('title'=>'Meeting Cancelled','description'=>'Unfortunately, the scheduled meeting has been cancelled due to some reason.','message'=>'','meetings_id'=>$meetings_id);
- }
- else // event
- {
- $Content = array('title'=>'Event Cancelled','description'=>'Unfortunately, the scheduled event has been cancelled due to some reason.','message'=>'','meetings_id'=>$meetings_id);
- }
- $this->SentNotification('4',$members_id,$Content);
- // sent notification
- // Activity Log Record
- $head = 'Remove Meeting Members';
- $description = 'Members Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF REMOVE MEETING MEMBERS DETAILS ################
- ############################################ REMOVE MEETING MEMBERS DETAILS #######################
- /*public function remove_meeting_security($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['DeleteSecurity']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('delete_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_security_id = $this->input->post('delete_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_datetime']>$datetime)
- {
- $where = array('meetings_security_id'=>$meetings_security_id);
- $value = array('meetings_security_status'=>'1');
- $this->Common_model->common_update('meetings_security',$value,$where);
- $this->Common_model->Set_Message('1','Security Details Removed Successfully');
- // Activity Log Record
- $head = 'Remove Meeting Security';
- $description = 'Security Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_security_id'=>$meetings_security_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> You Can't Edit Time Expired Meeting Details");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/security');
- }*/
- ############################################ END OF REMOVE MEETING MEMBERS DETAILS ################
- ############################################ CAR PASS #############################################
- public function car_pass_meeting_members($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['AssignPass']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('car_pass_remark','Remark','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $car_pass_remark = $this->input->post('car_pass_remark');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['car_pass']!='2')
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('car_pass'=>'2','car_pass_remark'=>$car_pass_remark);
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','Car Pass Assigned Successfully');
- // sent notification
- $members_id = $this->Manage_model->view_meetings_memeber_details($meetings_participants_id)['members_id'];
- $Content = array('title'=>'Car Pass','description'=>'The request for your car pass is approved.','message'=>'','meetings_id'=>$meetings_id);
- $this->SentNotification('2',$members_id,$Content);
- // sent notification
- // Activity Log Record
- $head = 'Assign Car Pass';
- $description = 'Car Pass Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- elseif(isset($_POST['RejectPass']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('car_pass_remark','Remark','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $car_pass_remark = $this->input->post('car_pass_remark');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['car_pass']<2)
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('car_pass'=>'3','car_pass_remark'=>$car_pass_remark);
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','Car pass rejected successfully.');
- // sent notification
- $members_id = $this->Manage_model->view_meetings_memeber_details($meetings_participants_id)['members_id'];
- $Content = array('title'=>'Car Pass','description'=>'Sorry, car pass is not available at this moment.','message'=>'','meetings_id'=>$meetings_id);
- $this->SentNotification('2',$members_id,$Content);
- // sent notification
- // Activity Log Record
- $head = 'Reject Car Pass';
- $description = 'Car Pass Has Been Rejected By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- elseif(isset($_POST['DeletePass']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['car_pass']=='2')
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('car_pass'=>'0','car_pass_remark'=>'');
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','Car pass deleted successfully.');
- // sent notification
- $members_id = $this->Manage_model->view_meetings_memeber_details($meetings_participants_id)['members_id'];
- $Content = array('title'=>'Car Pass','description'=>'Unfortunately, the car pass has been cancelled due to some reason','message'=>'','meetings_id'=>$meetings_id);
- $this->SentNotification('2',$members_id,$Content);
- // sent notification
- // Activity Log Record
- $head = 'Delete Car Pass';
- $description = 'Car Pass Has Been Deleted By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF CAR PASS ######################################
- ############################################ MARK ATTENDANCE ######################################
- public function mark_attendance_meeting_members($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['AttendancePresent']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_datetime']<$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['attendance']==0)
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('attendance'=>'1','attendance_datetime'=>$datetime);
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','<strong>Attendance marked!</strong>');
- // Activity Log Record
- $head = 'Attendance Marked';
- $description = 'Attendance Marked By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- elseif(isset($_POST['AttendanceAbsent']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_datetime']<$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['attendance']==0)
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('attendance'=>'2');
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','<strong>Attendance marked!</strong>');
- // Activity Log Record
- $head = 'Attendance Marked';
- $description = 'Attendance Marked By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id,'meetings_participants_id'=>$meetings_participants_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF MARK ATTENDANCE ###############################
- ############################################ SIGNATURE ############################################
- public function make_mom_signature_request($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['RequestSignature']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1 && $MD['mom_signature_status']=='1' && $MD['mom']!='')
- {
- if($MD['meeting_datetime']<$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['mom_signature_status']=='0')
- {
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('mom_signature_status'=>'1');
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','<strong>Signature requested </strong>');
- // sent notification
- $Content = array('title'=>'Sign MOM','description'=>'Your signature required for '.$MD['meeting_title'].' MOM','message'=>'','meetings_id'=>$meetings_id,'TicketNumber'=>'','Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- $this->SentNotification('6',$MMD['members_id'],$Content,$MMD['members_id'],'1');
- // sent notification
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- elseif(isset($_POST['RequestSignatureRemove']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_participants_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_participants_id = $this->input->post('meetings_participants_id');
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1 && $MD['mom_signature_status']=='1' && $MD['mom']!='')
- {
- if($MD['meeting_datetime']<$datetime)
- {
- $MMD = $this->Manage_model->get_meeting_members_details($meetings_id,$meetings_participants_id);
- if(!empty($MMD) && $MMD['mom_signature_status']=='1')
- {
- $where = array('meetings_participants_id'=>$meetings_participants_id);
- $value = array('mom_signature_status'=>'0');
- $this->Common_model->common_update('meetings_participants',$value,$where);
- $this->Common_model->Set_Message('1','<strong>Signature request removed </strong>');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF SIGNATURE #####################################
- ############################################ MEETINGS LINK DETAILS ################################
- public function meeting_link_details($meetings_id)
- {
- $this->load->view('include/preloader');
- # Generate Dedicated Link
- if(isset($_POST['GenerateLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting ID','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('registration_limit','Limit','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $registration_limit = $this->input->post('registration_limit');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- if($OD['dedicated_link_availability']=='1' && $MD['form_link']=='')
- {
- $LinkMax = 0;
- if($MD['meeting_type']==0){ $LinkMax = $OD['members_count']; }else{ $LinkMax = $OD['events_members_count']; }
- if($registration_limit>$LinkMax){ $registration_limit = $LinkMax; }
- $values = array('form_link_status'=>'1','form_link'=>'','registration_limit'=>$registration_limit);
- $where = array('organizations_id'=>$MD['organizations_id'],'meetings_id'=>$meetings_id);
- $FormLink = '';
- do {
- $FormLink = $this->Common_model->GenerateRandomString();
- $FormLinkStatus = $this->Manage_model->check_meeting_link_exist($FormLink);
- }while (!empty($FormLinkStatus));
- if($FormLink!='')
- {
- $values['form_link'] = $FormLink;
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Link generated successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- # Turn Off Dedicated Link
- if(isset($_POST['TurnOffLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('TurnOffLink','TurnOffLink','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting ID','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- if($OD['dedicated_link_availability']=='1' && $MD['form_link']!='' && $MD['form_link_status']=='1')
- {
- $values = array('form_link_status'=>'0');
- $where = array('organizations_id'=>$MD['organizations_id'],'meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Link disabled successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- # Turn On Dedicated Link
- if(isset($_POST['TurnOnLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('TurnOnLink','TurnOnLink','trim|required|xss_clean');
- $this->form_validation->set_rules('meetings_id','Meeting ID','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('registration_limit','Limit','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $registration_limit = $this->input->post('registration_limit');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime)
- {
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- if($OD['dedicated_link_availability']=='1' && $MD['form_link']!='' && $MD['form_link_status']=='0')
- {
- $LinkMax = 0;
- if($MD['meeting_type']==0){ $LinkMax = $OD['members_count']; }else{ $LinkMax = $OD['events_members_count']; }
- if($registration_limit>$LinkMax){ $registration_limit = $LinkMax; }
- $values = array('form_link_status'=>'1','registration_limit'=>$registration_limit);
- $where = array('organizations_id'=>$MD['organizations_id'],'meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Link enabled successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- redirect('meeting-details/'.$meetings_id.'/details');
- }
- ############################################ END OF MEETINGS LINK DETAILS #########################
- ############################################ END MEETING ##########################################
- public function end_meeting($meetings_id)
- {
- $this->load->view('include/preloader');
- # Generate Dedicated Link
- if(isset($_POST['EndMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting ID','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime && $MD['meeting_datetime']<$datetime)
- {
- $datetime = date('Y-m-d H:i:s',strtotime('-1 min'));
- $values = array('meeting_end_datetime'=>$datetime);
- $where = array('organizations_id'=>$MD['organizations_id'],'meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Meeting end.");
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- redirect('meeting-details/'.$meetings_id.'/details');
- }
- ############################################ END OF END MEETING ###################################
- ############################################ EXTEND MEETING #######################################
- public function extend_meeting($meetings_id)
- {
- $this->load->view('include/preloader');
- # Generate Dedicated Link
- if(isset($_POST['ExtendMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting ID','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('end_time','End Time','trim|required|xss_clean|exact_length[5]');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('meetings_id');
- $end_time = $this->input->post('end_time');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['status']==1)
- {
- if($MD['meeting_end_datetime']>$datetime && $MD['meeting_datetime']<$datetime)
- {
- $meeting_end_datetime = date('Y-m-d',strtotime($MD['meeting_datetime'])).' '.$end_time.':00';
- if($meeting_end_datetime>$MD['meeting_end_datetime'])
- {
- $values = array('meeting_end_datetime'=>$meeting_end_datetime);
- $where = array('organizations_id'=>$MD['organizations_id'],'meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Meeting extended.");
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Check extended time.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- redirect('meeting-details/'.$meetings_id.'/details');
- }
- ############################################ END OF EXTEND MEETING ################################
- ############################################ MEETINGS DETAILS #####################################
- public function meeting_details($meetings_id,$tab)
- {
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if($MD["flollow_up_status"]==1)
- {
- $meetings_id =$MD["flollow_up_id"];
- redirect("meeting-details/".$meetings_id."/members");
- }
- $FMD = $this->Manage_model->meeting_details_flollwup($meetings_id);
- $FMDLAST = $this->Manage_model->meeting_details_flollwupLAST($meetings_id);
- $data["last_meeting"]=0;
- if(!empty($FMDLAST))
- {
- $data["last_meeting"]=$FMDLAST["meetings_id"];
- }
- if(empty($MD)){ redirect('view-meetings'); }
- // set active tab details
- $data['BasicDetails'] = $data['EditDetails'] = $data['MeetingMembers'] = '';
- $data['MeetingSecurity'] = $data['MOMDetails'] = $data['MeetingFeedback'] = '';
- if($tab=='details'){ $data['BasicDetails'] = 'show active'; }
- elseif($tab=='edit')
- {
- if($MD['status']<2 && $MD['meeting_end_datetime']>date('Y-m-d H:i:s'))
- {
- $data['EditDetails'] = 'show active';
- }
- else
- {
- $data['BasicDetails'] = 'show active';
- }
- }
- elseif($tab=='members'){ $data['MeetingMembers'] = 'show active'; }
- elseif($tab=='security'){ $data['MeetingSecurity'] = 'show active'; }
- elseif($tab=='mom'){ $data['MOMDetails'] = 'show active'; }
- else{ $data['BasicDetails'] = 'show active'; }
- // set active tab details
- $data['MD'] = $MD;
- $data['FMD'] = $FMD;
- $data['FMDLAST'] = $FMDLAST;
- $data['OD'] = $this->Manage_model->get_organization_details($MD['organizations_id']);
- $data['MeetingMembersList'] = $this->Manage_model->get_meeting_members($meetings_id);
- $data['MFeedback'] = $this->Manage_model->get_meeting_members_feedback($meetings_id);
- $data['CL'] = $this->Manage_model->view_company_list();
- $data['AL'] = $this->Manage_model->view_address_list();
- $data['OrgMembers'] = $this->Manage_model->view_members_select();
- $this->CommonPage('meetings/meeting_details',$data,'Meeting Details');
- }
- ############################################ END OF MEETINGS DETAILS ##############################
- ############################################ REGISTRATIONS ########################################
- public function registrations()
- {
- #APPROVE ORG
- if(isset($_POST['Approve']))
- {
- $this->form_validation->set_rules('organizations_registrations_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('remark','Remark','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $organizations_registrations_id = $this->input->post('organizations_registrations_id');
- $remark = $this->input->post('remark');
- $RD = $this->Manage_model->view_organizations_registrations_details($organizations_registrations_id);
- $ValidityDate = date('Y-m-d', strtotime('+14 days'));
- $users_id = $this->session->userdata('logged_in')['users_id'];
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'privilege_id'=>'4',
- 'country_id'=>$RD['country_id'],
- 'places_id'=>'0',
- 'organization_type_id'=>'0',
- 'name'=>ucwords($RD['name']),
- 'phone'=>'',
- 'email'=>strtolower($RD['email']),
- 'location'=>'',
- 'latitude'=>'',
- 'longitude'=>'',
- 'building_name'=>'',
- 'building_number'=>'',
- 'floor_number'=>'',
- 'office_number'=>'',
- 'near_landmark'=>'',
- 'cp_name'=>ucwords($RD['cp_name']),
- 'cp_phone'=>$RD['phone'],
- 'cp_email'=>'',
- 'cp_designation'=>'',
- 'image'=>'',
- 'website'=>$RD['website'],
- 'organizations_registrations_id'=>$RD['organizations_registrations_id'],
- 'meetings_count'=>'10',
- 'members_count'=>'10',
- 'events_count'=>'2',
- 'events_members_count'=>'25',
- 'dedicated_link_availability'=>'1',
- 'app_create_meeting_status'=>'1',
- 'multiple_locations_status'=>'0',
- 'follow_up_meeting_status'=>'0',
- 'advanced_security_level'=>'0',
- 'packge_validity_upto'=>$ValidityDate,
- 'organizations_approved_status'=>1,
- 'organizations_approved_date'=>date('Y-m-d H:i:s'),
- 'organizations_approved_by'=>$users_id);
- $CheckMail = $this->Manage_model->check_organizations_email_exist_new($RD['email']);
- if(empty($CheckMail))
- {
- $organizations_id = $this->Common_model->common_insert('organizations',$values);
- $password = rand(11111111,99999999);
- $user_values = array('username'=>strtolower($RD['email']),
- 'password'=>MD5($password),
- 'name'=>ucwords($RD['name']),
- 'privilege_id'=>'4',
- 'table_id'=>$organizations_id,
- 'image'=>'');
- $this->Common_model->common_insert('users',$user_values);
- $value = array('status'=>'1','organizations_id'=>$organizations_id,'remarks'=>$remark);
- $where = array('organizations_registrations_id'=>$organizations_registrations_id);
- $this->Common_model->common_update('organizations_registrations',$value,$where);
- // Activity Log Record
- $head = 'Approve Organization';
- $description = 'Organization Details Has Been Approved By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_id'=>$organizations_id),'3');
- // Activity Log Record
- // sent Mail - login credential
- $data['LoginDetails'] = array('username'=>strtolower($RD['email']),'password'=>$password);
- $this->SentMail('6',$RD['email'],$data);
- // sent Mail - login credential
- // sent Mail - trial period
- $this->SentMail('7',$RD['email'],'');
- // sent Mail - trial period
- $this->Common_model->Set_Message('1',"Organization details approved successfully.");
- redirect('organizations-details/'.$organizations_id.'/details');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Email already exist.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- #APPROVE ORG
- #APPROVE ORG
- if(isset($_POST['Reject']))
- {
- $this->form_validation->set_rules('organizations_registrations_id','ID','trim|required|xss_clean');
- $this->form_validation->set_rules('remark','remark','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $organizations_registrations_id = $this->input->post('organizations_registrations_id');
- $remark = $this->input->post('remark');
- $value = array('status'=>'2','remarks'=>$remark);
- $where = array('organizations_registrations_id'=>$organizations_registrations_id);
- $this->Common_model->common_update('organizations_registrations',$value,$where);
- $this->Common_model->Set_Message('1','Registration details rejected.');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- #APPROVE ORG
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'email','default'=>'');
- $param[] = array('key'=>'country_id','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_organizations_registrations($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['TypeData'] = $this->Manage_model->select_view_type();
- $data['OD'] = $this->Manage_model->view_organizations_registrations($FD,$start,$limit,'0');
- $this->CommonPage('organizations/view_organizations_registrations',$data,'View Registrations');
- }
- public function Ajax_meeting_details($meetings_id)
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $MD = $this->Manage_model->meeting_details($_POST["data_id"]);
- $MD["response"][]="success";
- echo json_encode($MD);
- exit;
- }
- ############################################ END OF REGISTRATIONS #################################
- ############################################ ORGANIZATION DETAILS #################################
- public function profile($tab='')
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if(empty($OD)){ redirect('dashboard'); }
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','Landline','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('location','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('latitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('longitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('building_name','Building Name','trim|required|xss_clean');
- $this->form_validation->set_rules('building_number','Building Number','trim|xss_clean');
- $this->form_validation->set_rules('floor_number','Floor Number','trim|xss_clean');
- $this->form_validation->set_rules('office_number','Unit Number','trim|xss_clean');
- $this->form_validation->set_rules('near_landmark','Near Landmark','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_name','CP Name','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_phone','CP Pphone','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('cp_email','CP Email','trim|required|xss_clean|valid_email');
- $this->form_validation->set_rules('cp_designation','CP Designation','trim|required|xss_clean');
- $this->form_validation->set_rules('organizations_id','Organizations ID','trim|xss_clean|numeric|required');
- if($this->form_validation->run())
- {
- $name = $this->input->post('name');
- $phone = $this->input->post('phone');
- $location = $this->input->post('location');
- $latitude = $this->input->post('latitude');
- $longitude = $this->input->post('longitude');
- $building_name = $this->input->post('building_name');
- $building_number = $this->input->post('building_number');
- $floor_number = $this->input->post('floor_number');
- $office_number = $this->input->post('office_number');
- $near_landmark = $this->input->post('near_landmark');
- $cp_name = $this->input->post('cp_name');
- $cp_phone = $this->input->post('cp_phone');
- $cp_email = $this->input->post('cp_email');
- $cp_designation = $this->input->post('cp_designation');
- // $organizations_id = $this->input->post('organizations_id');
- $organizations_id = $OD['organizations_id'];
- $submit = $this->input->post('submit');
- $values = array('name'=>ucwords($name),
- 'phone'=>$phone,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'building_name'=>$building_name,
- 'building_number'=>$building_number,
- 'floor_number'=>$floor_number,
- 'office_number'=>$office_number,
- 'near_landmark'=>$near_landmark,
- 'cp_name'=>ucwords($cp_name),
- 'cp_phone'=>$cp_phone,
- 'cp_email'=>strtolower($cp_email),
- 'cp_designation'=>$cp_designation);
- $user_values = array('name'=>ucwords($name),'first_login_status'=>'2');
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/organizations/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- $image_name = $this->Common_model->image_upload('./uploads/users/','image');
- if($image_name!='')
- {
- $user_values['image'] = $image_name;
- }
- }
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$values,$where);
- $this->Common_model->Set_Message('1',"Profile updated successfully.");
- // update session data
- $user_data = $this->session->userdata('logged_in');
- $sess_data = $user_data;
- $sess_data['first_login_status'] = '2';
- $this->session->set_userdata('logged_in', $sess_data);
- // update session data
- // Activity Log Record
- $head = 'Update Profile';
- $description = 'Profile Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_id'=>$organizations_id),'3');
- // Activity Log Record
- $where = array('table_id'=>$organizations_id);
- $this->Common_model->common_update('users',$user_values,$where);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # Generate Dedicated Link
- if(isset($_POST['GenerateLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('NationalID','National ID','trim|required|xss_clean|numeric|exact_length[1]');
- if($this->form_validation->run())
- {
- $NationalID = $this->input->post('NationalID');
- if($OD['dedicated_link_availability']=='1' && $OD['form_link']=='')
- {
- $values = array('form_status'=>'1','form_link'=>'','reqiured_id'=>$NationalID);
- $where = array('organizations_id'=>$organizations_id);
- $FormLink = '';
- do {
- $FormLink = $this->Common_model->GenerateRandomString();
- $FormLinkStatus = $this->Manage_model->check_dedicated_link_exist($FormLink);
- }while (!empty($FormLinkStatus));
- if($FormLink!='')
- {
- $values['form_link'] = $FormLink;
- $this->Common_model->common_update('organizations',$values,$where);
- // reset session
- $user_data = $this->session->userdata('logged_in');
- $sess_data = $user_data;
- $sess_data['DLA'] = '1';
- $this->session->set_userdata('logged_in', $sess_data);
- // reset session
- $this->Common_model->Set_Message('1',"Link generated successfully");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # Turn Off Dedicated Link
- if(isset($_POST['TurnOffLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('TurnOffLink','TurnOffLink','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- if($OD['dedicated_link_availability']=='1' && $OD['form_link']!='' && $OD['form_status']=='1')
- {
- $values = array('form_status'=>'0');
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$values,$where);
- $this->Common_model->Set_Message('1',"Link disabled successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # Turn On Dedicated Link
- if(isset($_POST['TurnOnLink']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('TurnOnLink','TurnOnLink','trim|required|xss_clean');
- $this->form_validation->set_rules('NationalID','National ID','trim|required|xss_clean|numeric|exact_length[1]');
- if($this->form_validation->run())
- {
- if($OD['dedicated_link_availability']=='1' && $OD['form_link']!='' && $OD['form_status']=='0')
- {
- $NationalID = $this->input->post('NationalID');
- $values = array('form_status'=>'1','reqiured_id'=>$NationalID);
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$values,$where);
- $this->Common_model->Set_Message('1',"Link enabled successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- $data['OD'] = $OD;
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['TypeData'] = $this->Manage_model->select_view_type();
- $data['PlaceData'] = $this->Manage_model->select_view_places($OD['country_id']);
- // organizations_details
- $this->CommonPage('organizations/profile',$data,$OD['name']);
- }
- ############################################ END OF ORGANIZATION DETAILS ##########################
- ############################################ MEMBERS EXCEL IMPORT #################################
- public function members_excel_import($file_name='')
- {
- $this->load->model('Excel_model');
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if(!empty($OD))
- {
- $country_id = $OD['country_id'];
- $mobile_number_length = $OD['mobile_number_length'];
- if($file_name!='')
- {
- $file = FCPATH.'uploads/members_excel/'.$file_name;
- if(file_exists($file))
- {
- $E_data = $this->Excel_model->read_excel_file($file);
- if(!empty($E_data))
- {
- $values = array();
- $i = $j = 0;
- foreach($E_data as $ED1)
- {
- $i++;
- if($i>1)
- {
- if($ED1['B']!='' && $ED1['C']!='' && strlen($ED1['C'])==$mobile_number_length && is_numeric($ED1['C']) && $ED1['D']!='')
- {
- $name = ucwords($ED1['B']);
- $phone = $ED1['C'];
- $email = strtolower($ED1['D']);
- $designation = ucwords($ED1['E']);
- $verification_id = strtoupper($ED1['F']);
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$phone);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_id'=>$country_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- $values = array('organizations_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($name),
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $CheckTblOrgMember = $this->Manage_model->organizations_members_exist($organizations_id,$members_id);
- if(empty($CheckTblOrgMember))
- {
- $j++;
- $values['datetime'] = date('Y-m-d H:i:s');
- $this->Common_model->common_insert('organizations_members',$values);
- // Activity Log Record
- $head = 'Add Member (Excel)';
- $description = 'Member (Excel) Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- }
- }
- if($i == 251){ break; }
- }
- return array('Total'=>$i-1,'Uploaded'=>$j);
- }
- }
- }
- }
- return array();
- }
- ############################################ END OF MEMBERS EXCEL IMPORT ##########################
- ############################################ COMAPNY EXCEL IMPORT #################################
- public function company_excel_import($file_name='')
- {
- $this->load->model('Excel_model');
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $mobile_number_length = $OD['mobile_number_length'];
- if(!empty($OD))
- {
- if($file_name!='')
- {
- $file = FCPATH.'uploads/members_excel/'.$file_name;
- if(file_exists($file))
- {
- $E_data = $this->Excel_model->read_excel_file($file);
- if(!empty($E_data))
- {
- $values = array();
- $i = $j = 0;
- foreach($E_data as $ED1)
- {
- $i++;
- if($i>1)
- {
- if($ED1['B']!='' && $ED1['C']!='' && strlen($ED1['C'])==$mobile_number_length && is_numeric($ED1['C']) && $ED1['D']!='')
- {
- $name = ucwords($ED1['B']);
- $phone = $ED1['C'];
- $email = strtolower($ED1['D']);
- $values = array('organizations_id'=>$organizations_id,
- 'company_category_id'=>'1',
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email));
- $CheckComapy = $this->Manage_model->check_company_exist($organizations_id,$email);
- if(empty($CheckComapy))
- {
- $j++;
- $values['datetime'] = date('Y-m-d H:i:s');
- $company_id = $this->Common_model->common_insert('company',$values);
- $this->Common_model->Set_Message('1',"Company added successfully.");
- // Activity Log Record
- $head = 'Add Company (Excel Import)';
- $description = 'Company Details Has Been Added By (Excel Import) ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('company_id'=>$company_id),'5');
- // Activity Log Record
- }
- }
- }
- if($i == 251){ break; }
- }
- return array('Total'=>$i-1,'Uploaded'=>$j);
- }
- }
- }
- }
- return array();
- }
- ############################################ END OF COMAPNY EXCEL IMPORT ##########################
- ############################################ COMPANY MEMBERS EXCEL IMPORT #########################
- public function company_members_excel_import($file_name='',$company_id='',$country_id='')
- {
- $this->load->model('Excel_model');
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if(!empty($OD))
- {
- if($file_name!='' && $company_id!='' && $country_id!='')
- {
- $mobile_number_length = $this->Manage_model->get_country_details_row($country_id)['mobile_number_length'];
- $file = FCPATH.'uploads/members_excel/'.$file_name;
- if(file_exists($file))
- {
- $E_data = $this->Excel_model->read_excel_file($file);
- if(!empty($E_data))
- {
- $values = array();
- $i = $j = 0;
- foreach($E_data as $ED1)
- {
- $i++;
- if($i>1)
- {
- if($ED1['B']!='' && $ED1['C']!='' && strlen($ED1['C'])==$mobile_number_length && is_numeric($ED1['C']) && $ED1['D']!='' && $ED1['E']!='')
- {
- $name = ucwords($ED1['B']);
- $phone = $ED1['C'];
- $email = strtolower($ED1['D']);
- $designation = ucwords($ED1['E']);
- $verification_id = strtoupper($ED1['F']);
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$phone);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_id'=>$country_id,
- 'name'=>ucwords($name),
- 'phone'=>$phone,
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- $values = array('company_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'company_id'=>$company_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($name),
- 'email'=>strtolower($email),
- 'designation'=>$designation,
- 'verification_id'=>$verification_id);
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist($company_id,$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $j++;
- $values['datetime'] = date('Y-m-d H:i:s');
- $this->Common_model->common_insert('company_members',$values);
- // Activity Log Record
- $head = 'Add Member (Excel)';
- $description = 'Member (Excel) Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- }
- }
- if($i == 251){ break; }
- }
- return array('Total'=>$i-1,'Uploaded'=>$j);
- }
- }
- }
- }
- return array();
- }
- ############################################ END OF COMPANY MEMBERS EXCEL IMPORT ##################
- ############################################ MESSAGES #############################################
- public function enquiry()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'email','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_enquiry($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 50;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['enquiry'] = $this->Manage_model->view_enquiry($FD,$start,$limit,'0');
- $this->CommonPage('manage/enquiry',$data,'View Messages');
- }
- ############################################ END OF MESSAGES ######################################
- ############################################ LINK REQUESTS ########################################
- public function get_link_requests_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $link_requests_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_link_requests_data($link_requests_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function link_requests($LinkStatus='0')
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- # Create New Quick Meeting
- if(isset($_POST['CreateRequestQuickMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('RQ_member_name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('RQ_member_mobile','Mobile','trim|required|xss_clean');
- $this->form_validation->set_rules('RQ_meeting_title','Title','trim|required|xss_clean');
- $this->form_validation->set_rules('RQ_date','Date','trim|required|xss_clean|exact_length[10]');
- $this->form_validation->set_rules('RQ_time','Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('RQ_end_time','End Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('RQ_link_requests_id','ID','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('RQ_request_status','Status','trim|xss_clean');
- if($OD['multiple_locations_status']=='1')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|required|numeric');
- }
- if($this->form_validation->run())
- {
- if(!empty($OD))
- {
- if(date('Y-m-d')>$OD['packge_validity_upto'])
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- $CountAvailableMeetings = $this->Manage_model->check_available_meetings_count();
- $CountMeetingsMembers = $this->Manage_model->check_available_meetings_members_count();
- if($CountAvailableMeetings>0 && $CountMeetingsMembers>1)
- {
- $link_requests_id = $this->input->post('RQ_link_requests_id');
- $LRD = $this->Manage_model->get_link_requests_data($link_requests_id);
- if(!empty($LRD))
- {
- $location = $OD['location'];
- $latitude = $OD['latitude'];
- $longitude = $OD['longitude'];
- $country_id = $OD['country_id'];
- if($location!='' && $latitude!='' && $longitude!='')
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $member_name = $LRD['name'];
- $member_mobile = $LRD['mobile'];
- $member_email = $LRD['email'];
- $member_national_id = $LRD['national_id'];
- $national_id_expiry_date = $LRD['national_id_expiry_date'];
- $meeting_title = $this->input->post('RQ_meeting_title');
- $date = $this->input->post('RQ_date');
- $time = $this->input->post('RQ_time');
- $end_time = $this->input->post('RQ_end_time');
- $request_status = $this->input->post('RQ_request_status');
- $description = $meeting_link = '';
- $meeting_type = $car_pass = '0';
- $date = $this->Common_model->date_format_changer($date);
- $meeting_datetime = $date.' '.$time.':00';
- $meeting_end_datetime = $date.' '.$end_time.':00';
- $datetime = date('Y-m-d H:i:s');
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'meeting_type'=>$meeting_type,
- 'meeting_title'=>$meeting_title,
- 'meeting_datetime'=>$meeting_datetime,
- 'meeting_end_datetime'=>$meeting_end_datetime,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'address'=>$address,
- 'description'=>$description,
- 'meeting_link'=>$meeting_link,
- 'car_pass'=>$car_pass,
- 'admit_before'=>'1',
- 'admit_after'=>'2',
- 'status'=>'1',
- 'link_requests_id'=>$link_requests_id);
- // setup address data
- if($OD['multiple_locations_status']=='1')
- {
- $organizations_address_id = $this->input->post('organizations_address_id');
- if($organizations_address_id=='0') // address take from organization table
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = '0';
- $values['location'] = $OD['location'];
- $values['latitude'] = $OD['latitude'];
- $values['longitude'] = $OD['longitude'];
- $values['address'] = $address;
- }
- elseif($organizations_address_id>'0') // address take from address table
- {
- $AddressData = $this->Manage_model->get_organization_contact_details($organizations_address_id,$organizations_id);
- if(!empty($AddressData))
- {
- $address = array('Building Name: '.$AddressData['building_name'],'Building Number: '.$AddressData['building_number'],'Floor Number: '.$AddressData['floor_number'],'Unit Number: '.$AddressData['office_number'],'Near Landmark: '.$AddressData['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = $AddressData['organizations_address_id'];
- $values['location'] = $AddressData['location'];
- $values['latitude'] = $AddressData['latitude'];
- $values['longitude'] = $AddressData['longitude'];
- $values['address'] = $address;
- }
- }
- }
- // setup address data
- if($meeting_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- $CheckMeeting = array();
- if($request_status!='1')
- {
- $CheckMeeting = $this->Manage_model->check_meetings_available_org($organizations_id,$meeting_datetime,$meeting_end_datetime);
- }
- if(empty($CheckMeeting)) // checking meeting scheduled or not
- {
- // checking meeting duplication
- $NextTime = date('Y-m-d H:i:s', strtotime('-30 seconds'));
- $CheckMeetingDuplication = $this->Manage_model->check_meeting_duplication($organizations_id,$NextTime,$datetime,$meeting_datetime,$meeting_end_datetime);
- if(!empty($CheckMeetingDuplication))
- {
- redirect(current_url());
- }
- // checking meeting duplication
- $meetings_id = $this->Common_model->common_insert('meetings',$values);
- // update meetings count
- $value = array('meetings_count'=>$CountAvailableMeetings-1);
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$value,$where);
- // update meetings count
- // Activity Log Record
- $head = 'Create Meeting (Quick-Link)';
- $description = 'New Meeting (Quick-Link) Has Been Created By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- // checking table members
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$member_mobile);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),'country_id'=>$country_id,'name'=>ucwords($member_name),'phone'=>$member_mobile,'email'=>$member_email,'verification_id'=>$member_national_id,'national_id_expiry_date'=>$national_id_expiry_date);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- // checking table members
- $values = array('company_members_status'=>'0','organizations_id'=>$organizations_id,'company_id'=>'0','members_id'=>$members_id,'name'=>ucwords($member_name),'email'=>$member_email,'verification_id'=>$member_national_id);
- // checking table company_members
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist('0',$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $members_sub_id = $this->Common_model->common_insert('company_members',$values);
- // Activity Log Record
- $head = 'Add Member';
- $description = 'Member Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- else
- {
- if($member_email!='')
- {
- $C_where = array('company_members_id'=>$CheckTblCompanyMember['company_members_id']);
- $C_value = array('email'=>strtolower($member_email));
- $this->Common_model->common_update('company_members',$C_value,$C_where); // update email when the email is not empty
- }
- $members_sub_id = $CheckTblCompanyMember['company_members_id'];
- }
- // checking table company_members
- // assigning to meeting
- $values = array('datetime'=>$datetime,
- 'meetings_id'=>$meetings_id,
- 'members_sub_id'=>$members_sub_id,
- 'company_id'=>'0',
- 'members_id'=>$members_id,
- 'member_type'=>'1');
- $meetings_participants_id = $this->Common_model->common_insert('meetings_participants',$values);
- $TicketNumber = 'MPT'.sprintf("%05d", $meetings_participants_id);
- // sent notification
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$meeting_title);
- $this->SentNotification('1',$members_id,$Content,$members_sub_id,'1');
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- // assigning to meeting
- // updating request
- $R_where = array('organizations_id'=>$organizations_id,'link_requests_id'=>$link_requests_id);
- $R_value = array('meetings_id'=>$meetings_id,'status'=>'1');
- $this->Common_model->common_update('link_requests',$R_value,$R_where);
- // updating request
- $this->Common_model->Set_Message('1','Request approved.');
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- else
- {
- $_POST['RQ_request_status'] = '1';
- $this->Common_model->Set_Message('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- $this->Common_model->Set_Message_Rmeeting('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid date & time.');
- $this->Common_model->Set_Message_Rmeeting('2','<strong>Error!</strong> Please enter a valid date & time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please fill your address details.');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # Create New Quick Meeting
- # Assign To Meeting
- if(isset($_POST['AssignToMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('RQ_link_requests_id','ID','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if(!empty($OD))
- {
- $link_requests_id = $this->input->post('RQ_link_requests_id');
- $meetings_id = $this->input->post('meetings_id');
- $LRD = $this->Manage_model->get_link_requests_data($link_requests_id);
- if(!empty($LRD))
- {
- $country_id = $OD['country_id'];
- $datetime = date('Y-m-d H:i:s');
- $member_name = $LRD['name'];
- $member_mobile = $LRD['mobile'];
- $member_email = $LRD['email'];
- $member_national_id = $LRD['national_id'];
- $national_id_expiry_date = $LRD['national_id_expiry_date'];
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(!empty($MD))
- {
- $meeting_datetime = $MD['meeting_datetime'];
- if($meeting_datetime>$datetime)
- {
- $CountMeetingsMembers = $this->Manage_model->check_available_meetings_members_count();
- $CheckMembersLimit = $this->Manage_model->check_meetings_members_count($meetings_id);
- if($CheckMembersLimit<$CountMeetingsMembers)
- {
- // checking table members
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$member_mobile);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),'country_id'=>$country_id,'name'=>ucwords($member_name),'phone'=>$member_mobile,'email'=>$member_email,'verification_id'=>$member_national_id,'national_id_expiry_date'=>$national_id_expiry_date);
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- // checking table members
- $values = array('company_members_status'=>'0','organizations_id'=>$organizations_id,'company_id'=>'0','members_id'=>$members_id,'name'=>ucwords($member_name),'email'=>$member_email,'verification_id'=>$member_national_id);
- // checking table company_members
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist('0',$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $members_sub_id = $this->Common_model->common_insert('company_members',$values);
- // Activity Log Record
- $head = 'Add Member';
- $description = 'Member Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- else
- {
- $members_sub_id = $CheckTblCompanyMember['company_members_id'];
- }
- // checking table company_members
- $CheckMemberExist = $this->Manage_model->check_meetings_members_exist($meetings_id,$members_id,'');
- if(empty($CheckMemberExist))
- {
- // assigning to meeting
- $values = array('datetime'=>$datetime,
- 'meetings_id'=>$meetings_id,
- 'members_sub_id'=>$members_sub_id,
- 'company_id'=>'0',
- 'members_id'=>$members_id,
- 'member_type'=>'1');
- $meetings_participants_id = $this->Common_model->common_insert('meetings_participants',$values);
- $TicketNumber = 'MPT'.sprintf("%05d", $meetings_participants_id);
- // sent notification
- if($MD['meeting_type']=='0')
- {
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- else
- {
- $Content = array('title'=>'Event Invitation','description'=>'You are invited for a new event with '.$OD['name'].'. ','message'=>'You are invited to a new evevt by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your evevt access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- $this->SentNotification('1',$members_id,$Content,$members_sub_id,'1');
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- // assigning to meeting
- // updating request
- $R_where = array('organizations_id'=>$organizations_id,'link_requests_id'=>$link_requests_id);
- $R_value = array('meetings_id'=>$meetings_id,'status'=>'1');
- $this->Common_model->common_update('link_requests',$R_value,$R_where);
- // updating request
- $this->Common_model->Set_Message('1','Request approved');
- redirect(current_url());
- }
- else
- {
- $this->Common_model->Set_Message('2','Member already an attendee for the selected meeting.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> You have exceeded maximum allowed meeting members '.$CountMeetingsMembers.'.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid date & time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- }
- # Assign To Meeting
- # REJECT REQUEST FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $link_requests_id = $this->input->post('delete_id');
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $value = array('status'=>'2');
- $where = array('link_requests_id'=>$link_requests_id,'organizations_id'=>$organizations_id);
- $this->Common_model->common_update('link_requests',$value,$where);
- $this->Common_model->Set_Message('1','Request rejected');
- // Activity Log Record
- $head = 'Reject Registration';
- $description = 'Registration Has Been Rejected By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('link_requests_id'=>$link_requests_id),'9');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF REJECT REQUEST FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'mobile','default'=>'');
- $param[] = array('key'=>'meeting_date','default'=>'');
- $param[] = array('key'=>'meeting_purpose_id','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $FD['LinkStatus'] = $LinkStatus;
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->link_requests($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['FD'] = $FD;
- $data['RL'] = $this->Manage_model->link_requests($FD,$start,$limit,'0');
- $data['MP'] = $this->Manage_model->view_meeting_purpose_list($OD['organization_type_id']);
- $data['ML'] = $this->Manage_model->upcoming_meeting_list();
- $this->CommonPage('organizations/link_requests',$data,'Meeting request from dedicated link');
- }
- ############################################ END OF LINK REQUESTS #################################
- ############################################ VIEW SECURITY ########################################
- public function get_security_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_security_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_security_details($organizations_security_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_security()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('mobile','Email','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('designation','Designation','trim|required|xss_clean');
- $this->form_validation->set_rules('admit_privilege','Privilege','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('status','status','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_data($organizations_id);
- $country_id = $OD['country_id'];
- $name = ucwords($this->input->post('name'));
- $mobile = $this->input->post('mobile');
- $designation = $this->input->post('designation');
- $admit_privilege = $this->input->post('admit_privilege');
- $status = $this->input->post('status');
- // checking tbl security
- $CheckTblSecurity = $this->Manage_model->check_security_is_exist($country_id,$mobile);
- if(!empty($CheckTblSecurity))
- {
- $security_id = $CheckTblSecurity['security_id'];
- if($CheckTblSecurity['security_status']!=0)
- {
- $S_where = array('security_id'=>$security_id);
- $S_value = array('security_status'=>'0');
- $this->Common_model->common_update('security',$S_value,$S_where); // update status when the security is deleted
- }
- }
- else
- {
- if($this->input->post('submit')=='Save')
- {
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_id'=>$country_id,
- 'name'=>ucwords($name),
- 'mobile'=>$mobile,
- 'designation'=>$designation);
- $security_id = $this->Common_model->common_insert('security',$values);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- // checking tbl security
- $values = array('organizations_id'=>$organizations_id,
- 'security_id'=>$security_id,
- 'name'=>$name,
- 'designation'=>$designation,
- 'admit_privilege'=>$admit_privilege,
- 'status'=>$status);
- $CheckTblOrgSecurity = $this->Manage_model->organizations_security_exist($organizations_id,$security_id);
- if(!empty($CheckTblOrgSecurity))
- {
- if($this->input->post('submit')=='Update')
- {
- $where = array('organizations_id'=>$organizations_id,'security_id'=>$security_id,'organizations_security_id'=>$CheckTblOrgSecurity['organizations_security_id']);
- $this->Common_model->common_update('organizations_security',$values,$where);
- $this->Common_model->Set_Message('1',"Security details updated successfully.");
- // Activity Log Record
- $head = 'Update Security';
- $description = 'Security Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('security_id'=>$security_id),'7');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Security details already exist.');
- }
- }
- else
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $this->Common_model->common_insert('organizations_security',$values);
- $this->Common_model->Set_Message('1',"Security added successfully.");
- // Activity Log Record
- $head = 'Add Security';
- $description = 'Security Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('security_id'=>$security_id),'7');
- // Activity Log Record
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $delete_id = $this->input->post('delete_id');
- $where = array('organizations_security_id'=>$delete_id,'organizations_id'=>$organizations_id);
- $value = array('organizations_security_status'=>'1');
- $this->Common_model->common_update('organizations_security',$value,$where);
- $this->Common_model->Set_Message('1','Secuity details removed successfully.');
- // Activity Log Record
- $head = 'Remove Secuity';
- $description = 'Secuity Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_security_id'=>$delete_id),'7');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'name','default'=>'');
- $param[] = array('key'=>'mobile','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_security($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['MD'] = $this->Manage_model->view_security($FD,$start,$limit,'0');
- $this->CommonPage('organizations/view_security',$data,'List of authorized security staffs');
- }
- ############################################ END OF VIEW SECURITY #################################
- ############################################ MEETINGS #############################################
- public function view_meetings($MeetingStatus)
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- # Create New Quick Meeting
- if(isset($_POST['CreateQuickMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('Q_member_name','Name','trim|required|xss_clean');
- $this->form_validation->set_rules('Q_member_mobile','Mobile','trim|required|xss_clean');
- $this->form_validation->set_rules('Q_email_id','Email','trim|valid_email|xss_clean');
- $this->form_validation->set_rules('Q_meeting_title','Title','trim|required|xss_clean');
- $this->form_validation->set_rules('Q_request_status','Status','trim|xss_clean');
- $this->form_validation->set_rules('Q_date','Date','trim|required|xss_clean|exact_length[10]');
- $this->form_validation->set_rules('Q_time','Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('Q_end_time','End Time','trim|required|xss_clean|exact_length[5]');
- if($OD['multiple_locations_status']=='1')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|required|numeric');
- }
- if($this->form_validation->run())
- {
- if(!empty($OD))
- {
- if(date('Y-m-d')>$OD['packge_validity_upto'])
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- $CountAvailableMeetings = $this->Manage_model->check_available_meetings_count();
- $CountMeetingsMembers = $this->Manage_model->check_available_meetings_members_count();
- if($CountAvailableMeetings>0 && $CountMeetingsMembers>1)
- {
- $location = $OD['location'];
- $latitude = $OD['latitude'];
- $longitude = $OD['longitude'];
- $country_id = $OD['country_id'];
- if($location!='' && $latitude!='' && $longitude!='')
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $member_name = $this->input->post('Q_member_name');
- $member_mobile = $this->input->post('Q_member_mobile');
- $email_id = $this->input->post('Q_email_id');
- $request_status = $this->input->post('Q_request_status');
- $meeting_title = $this->input->post('Q_meeting_title');
- $date = $this->input->post('Q_date');
- $time = $this->input->post('Q_time');
- $end_time = $this->input->post('Q_end_time');
- $description = $meeting_link = '';
- $meeting_type = $car_pass = '0';
- $date = $this->Common_model->date_format_changer($date);
- $meeting_datetime = $date.' '.$time.':00';
- $meeting_end_datetime = $date.' '.$end_time.':00';
- $datetime = date('Y-m-d H:i:s');
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'meeting_type'=>$meeting_type,
- 'meeting_title'=>$meeting_title,
- 'meeting_datetime'=>$meeting_datetime,
- 'meeting_end_datetime'=>$meeting_end_datetime,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'address'=>$address,
- 'description'=>$description,
- 'meeting_link'=>$meeting_link,
- 'car_pass'=>$car_pass,
- 'admit_before'=>'1',
- 'admit_after'=>'2',
- 'status'=>'1');
- // setup address data
- if($OD['multiple_locations_status']=='1')
- {
- $organizations_address_id = $this->input->post('organizations_address_id');
- if($organizations_address_id=='0') // address take from organization table
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = '0';
- $values['location'] = $OD['location'];
- $values['latitude'] = $OD['latitude'];
- $values['longitude'] = $OD['longitude'];
- $values['address'] = $address;
- }
- elseif($organizations_address_id>'0') // address take from address table
- {
- $AddressData = $this->Manage_model->get_organization_contact_details($organizations_address_id,$organizations_id);
- if(!empty($AddressData))
- {
- $address = array('Building Name: '.$AddressData['building_name'],'Building Number: '.$AddressData['building_number'],'Floor Number: '.$AddressData['floor_number'],'Unit Number: '.$AddressData['office_number'],'Near Landmark: '.$AddressData['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = $AddressData['organizations_address_id'];
- $values['location'] = $AddressData['location'];
- $values['latitude'] = $AddressData['latitude'];
- $values['longitude'] = $AddressData['longitude'];
- $values['address'] = $address;
- }
- }
- }
- // setup address data
- if($meeting_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- $CheckMeeting = array();
- if($request_status!='1')
- {
- $CheckMeeting = $this->Manage_model->check_meetings_available_org($organizations_id,$meeting_datetime,$meeting_end_datetime);
- }
- if(empty($CheckMeeting)) // checking meeting scheduled or not
- {
- // checking meeting duplication
- $NextTime = date('Y-m-d H:i:s', strtotime('-30 seconds'));
- $CheckMeetingDuplication = $this->Manage_model->check_meeting_duplication($organizations_id,$NextTime,$datetime,$meeting_datetime,$meeting_end_datetime);
- if(!empty($CheckMeetingDuplication))
- {
- redirect(current_url());
- }
- // checking meeting duplication
- $meetings_id = $this->Common_model->common_insert('meetings',$values);
- // update meetings count
- $value = array('meetings_count'=>$CountAvailableMeetings-1);
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$value,$where);
- // update meetings count
- // Activity Log Record
- $head = 'Create Meeting (Quick)';
- $description = 'New Meeting (Quick) Has Been Created By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- // processing memberdetails
- $ReqData = array('country_id'=>$country_id,
- 'member_mobile'=>$member_mobile,
- 'member_name'=>$member_name,
- 'email_id'=>$email_id,
- 'organizations_id'=>$organizations_id,
- 'company_id'=>'0');
- $ResultData = $this->CheckingMemberDetails($ReqData);
- $members_id = $ResultData['members_id'];
- $members_sub_id = $ResultData['members_sub_id'];
- // processing memberdetails
- // assigning to meeting
- $values = array('datetime'=>$datetime,
- 'meetings_id'=>$meetings_id,
- 'members_sub_id'=>$members_sub_id,
- 'company_id'=>'0',
- 'members_id'=>$members_id,
- 'member_type'=>'1');
- $meetings_participants_id = $this->Common_model->common_insert('meetings_participants',$values);
- $TicketNumber = 'MPT'.sprintf("%05d", $meetings_participants_id);
- // sent notification
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$meeting_title);
- $this->SentNotification('1',$members_id,$Content,$members_sub_id,'1');
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- // assigning to meeting
- $this->Common_model->Set_Message('1','New meeting created successfully.');
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- else
- {
- $_POST['Q_request_status'] = '1';
- $this->Common_model->Set_Message('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- $this->Common_model->Set_Message_Qmeeting('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- $this->Common_model->Set_Message_Qmeeting('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please complete your address.');
- $this->Common_model->Set_Message_Qmeeting('2','<strong>Error!</strong> Please complete your address.');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- $this->Common_model->Set_Message_Qmeeting('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- $this->Common_model->Set_Message_Qmeeting('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # Create New Quick Meeting
- # Create New Meeting
- if(isset($_POST['CreateMeeting']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meeting_type','Type','trim|required|xss_clean');
- $this->form_validation->set_rules('meeting_title','Title','trim|required|xss_clean');
- $this->form_validation->set_rules('date','Date','trim|required|xss_clean|exact_length[10]');
- $this->form_validation->set_rules('time','Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('end_time','End Time','trim|required|xss_clean|exact_length[5]');
- /*$this->form_validation->set_rules('location','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('latitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('longitude','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('address','Address','trim|required|xss_clean');*/
- $this->form_validation->set_rules('car_pass','Car Pass','trim|required|xss_clean');
- $this->form_validation->set_rules('description','Description','trim|xss_clean');
- $this->form_validation->set_rules('request_status','Status','trim|xss_clean');
- $this->form_validation->set_rules('meeting_link','Link','trim|xss_clean|valid_url');
- if($OD['multiple_locations_status']=='1')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|required|numeric');
- }
- if($this->form_validation->run())
- {
- $meeting_type = $this->input->post('meeting_type');
- if(!empty($OD))
- {
- if(date('Y-m-d')>$OD['packge_validity_upto'])
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- if($meeting_type==0) // meeting
- {
- $CountAvailableMeetings = $this->Manage_model->check_available_meetings_count();
- }
- else // event
- {
- $CountAvailableMeetings = $this->Manage_model->check_available_events_count();
- }
- if($CountAvailableMeetings>0)
- {
- $location = $OD['location'];
- $latitude = $OD['latitude'];
- $longitude = $OD['longitude'];
- if($location!='' && $latitude!='' && $longitude!='')
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $meeting_title = $this->input->post('meeting_title');
- $date = $this->input->post('date');
- $time = $this->input->post('time');
- $end_time = $this->input->post('end_time');
- //$description = $this->input->post('description');
- $meeting_link = $this->input->post('meeting_link');
- $car_pass = $this->input->post('car_pass');
- $request_status = $this->input->post('request_status');
- $date = $this->Common_model->date_format_changer($date);
- $meeting_datetime = $date.' '.$time.':00';
- $meeting_end_datetime = $date.' '.$end_time.':00';
- $flollow_up_id = $this->input->post('hfmeeting_id');
- $flollow_up_status = $this->input->post('flollow_up_status');
- $datetime = date('Y-m-d H:i:s');
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'meeting_type'=>$meeting_type,
- 'meeting_title'=>$meeting_title,
- 'meeting_datetime'=>$meeting_datetime,
- 'meeting_end_datetime'=>$meeting_end_datetime,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'address'=>$address,
- 'meeting_link'=>$meeting_link,
- 'car_pass'=>$car_pass,
- 'admit_before'=>'1',
- 'admit_after'=>'2',
- 'status'=>'1');
- // setup address data
- if($OD['multiple_locations_status']=='1')
- {
- $organizations_address_id = $this->input->post('organizations_address_id');
- if($organizations_address_id=='0') // address take from organization table
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = '0';
- $values['location'] = $OD['location'];
- $values['latitude'] = $OD['latitude'];
- $values['longitude'] = $OD['longitude'];
- $values['address'] = $address;
- }
- elseif($organizations_address_id>'0') // address take from address table
- {
- $AddressData = $this->Manage_model->get_organization_contact_details($organizations_address_id,$organizations_id);
- if(!empty($AddressData))
- {
- $address = array('Building Name: '.$AddressData['building_name'],'Building Number: '.$AddressData['building_number'],'Floor Number: '.$AddressData['floor_number'],'Unit Number: '.$AddressData['office_number'],'Near Landmark: '.$AddressData['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = $AddressData['organizations_address_id'];
- $values['location'] = $AddressData['location'];
- $values['latitude'] = $AddressData['latitude'];
- $values['longitude'] = $AddressData['longitude'];
- $values['address'] = $address;
- }
- }
- }
- // setup address data
- if($meeting_type==1) // event
- {
- $values['participant_status'] = '1';
- }
- if($meeting_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- $CheckMeeting = array();
- if($request_status!='1')
- {
- $CheckMeeting = $this->Manage_model->check_meetings_available_org($organizations_id,$meeting_datetime,$meeting_end_datetime);
- }
- if(empty($CheckMeeting)) // checking meeting scheduled or not
- {
- // checking meeting duplication
- $NextTime = date('Y-m-d H:i:s', strtotime('-30 seconds'));
- $CheckMeetingDuplication = $this->Manage_model->check_meeting_duplication($organizations_id,$NextTime,$datetime,$meeting_datetime,$meeting_end_datetime);
- if(!empty($CheckMeetingDuplication))
- {
- redirect(current_url());
- }
- // checking meeting duplication
- $meetings_id = $this->Common_model->common_insert('meetings',$values);
- if($meeting_type==0) // meeting
- {
- $this->Common_model->Set_Message('1','New meeting created successfully.');
- }
- else // event
- {
- $this->Common_model->Set_Message('1','New Event created successfully.');
- }
- // update meetings count
- if($meeting_type==0) // meeting
- {
- $value = array('meetings_count'=>$CountAvailableMeetings-1);
- }
- else // event
- {
- $value = array('events_count'=>$CountAvailableMeetings-1);
- }
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$value,$where);
- // update meetings count
- // Activity Log Record
- $head = 'Create Meeting';
- $description = 'New Meeting Has Been Created By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- else
- {
- $_POST['request_status'] = '1';
- $this->Common_model->Set_Message('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- $this->Common_model->Set_Message_meeting('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please complete your address.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Please complete your address.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- }
- # Create New Meeting
- #follow up New Meeting
- if(isset($_POST['CreateMeetingFollowup']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meeting_type','Type','trim|required|xss_clean');
- $this->form_validation->set_rules('meeting_title','Title','trim|required|xss_clean');
- $this->form_validation->set_rules('date','Date','trim|required|xss_clean|exact_length[10]');
- $this->form_validation->set_rules('time','Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('end_time','End Time','trim|required|xss_clean|exact_length[5]');
- $this->form_validation->set_rules('car_pass','Car Pass','trim|required|xss_clean');
- $this->form_validation->set_rules('description','Description','trim|xss_clean');
- $this->form_validation->set_rules('request_status_Followup','Status','trim|xss_clean');
- $this->form_validation->set_rules('meeting_link','Link','trim|xss_clean|valid_url');
- if($OD['multiple_locations_status']=='1')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|required|numeric');
- }
- if($this->form_validation->run())
- {
- $meeting_type = $this->input->post('meeting_type');
- if(!empty($OD))
- {
- if(date('Y-m-d')>$OD['packge_validity_upto'])
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- if($meeting_type==0) // meeting
- {
- $CountAvailableMeetings = $this->Manage_model->check_available_meetings_count();
- }
- else // event
- {
- $CountAvailableMeetings = $this->Manage_model->check_available_events_count();
- }
- if($CountAvailableMeetings>0)
- {
- $location = $OD['location'];
- $latitude = $OD['latitude'];
- $longitude = $OD['longitude'];
- if($location!='' && $latitude!='' && $longitude!='')
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $meeting_title = $this->input->post('meeting_title');
- $date = $this->input->post('date');
- $time = $this->input->post('time');
- $end_time = $this->input->post('end_time');
- //$description = $this->input->post('description');
- $meeting_link = $this->input->post('meeting_link');
- $car_pass = $this->input->post('car_pass');
- $request_status = $this->input->post('request_status_Followup');
- $date = $this->Common_model->date_format_changer($date);
- $meeting_datetime = $date.' '.$time.':00';
- $meeting_end_datetime = $date.' '.$end_time.':00';
- $flollow_up_id = $this->input->post('hfmeeting_id');
- $flollow_up_status = $this->input->post('flollow_up_status');
- $datetime = date('Y-m-d H:i:s');
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'meeting_type'=>$meeting_type,
- 'meeting_title'=>$meeting_title,
- 'meeting_datetime'=>$meeting_datetime,
- 'flollow_up_id'=>$flollow_up_id,
- 'flollow_up_status'=>$flollow_up_status,
- 'meeting_end_datetime'=>$meeting_end_datetime,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'address'=>$address,
- 'meeting_link'=>$meeting_link,
- 'car_pass'=>$car_pass,
- 'admit_before'=>'1',
- 'admit_after'=>'2',
- 'status'=>'1');
- // setup address data
- if($OD['multiple_locations_status']=='1')
- {
- $organizations_address_id = $this->input->post('organizations_address_id');
- if($organizations_address_id=='0') // address take from organization table
- {
- $address = array('Building Name: '.$OD['building_name'],'Building Number: '.$OD['building_number'],'Floor Number: '.$OD['floor_number'],'Unit Number: '.$OD['office_number'],'Near Landmark: '.$OD['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = '0';
- $values['location'] = $OD['location'];
- $values['latitude'] = $OD['latitude'];
- $values['longitude'] = $OD['longitude'];
- $values['address'] = $address;
- }
- elseif($organizations_address_id>'0') // address take from address table
- {
- $AddressData = $this->Manage_model->get_organization_contact_details($organizations_address_id,$organizations_id);
- if(!empty($AddressData))
- {
- $address = array('Building Name: '.$AddressData['building_name'],'Building Number: '.$AddressData['building_number'],'Floor Number: '.$AddressData['floor_number'],'Unit Number: '.$AddressData['office_number'],'Near Landmark: '.$AddressData['near_landmark']);
- $address = implode(', ', $address);
- $values['organizations_address_id'] = $AddressData['organizations_address_id'];
- $values['location'] = $AddressData['location'];
- $values['latitude'] = $AddressData['latitude'];
- $values['longitude'] = $AddressData['longitude'];
- $values['address'] = $address;
- }
- }
- }
- // setup address data
- if($meeting_type==1) // event
- {
- $values['participant_status'] = '1';
- }
- if($meeting_datetime>$datetime && $meeting_end_datetime>$meeting_datetime)
- {
- $CheckMeeting = array();
- if($request_status!='1')
- {
- $CheckMeeting = $this->Manage_model->check_meetings_available_org($organizations_id,$meeting_datetime,$meeting_end_datetime);
- }
- if(empty($CheckMeeting)) // checking meeting scheduled or not
- {
- // checking meeting duplication
- $NextTime = date('Y-m-d H:i:s', strtotime('-30 seconds'));
- $CheckMeetingDuplication = $this->Manage_model->check_meeting_duplication($organizations_id,$NextTime,$datetime,$meeting_datetime,$meeting_end_datetime);
- if(!empty($CheckMeetingDuplication))
- {
- redirect(current_url());
- }
- // checking meeting duplication
- $meetings_ids = $this->Common_model->common_insert('meetings',$values);
- $participants= $this->Manage_model->get_meeting_members($flollow_up_id);
- foreach($participants as $members)
- {
- $MembersVal=array("meetings_id"=>$meetings_ids,
- "meetings_participants_status"=>0,
- "members_sub_id"=>$members->members_sub_id,
- "member_type"=>$members->member_type,
- "company_id"=>$members->company_id,
- "members_id"=>$members->members_id,
- "car_pass"=>$_POST["car_pass"],
- "car_pass_remark"=>$members->car_pass_remark,
- "laptop_pass"=>0);
- $meetings_id = $this->Common_model->common_insert('meetings_participants',$MembersVal);
- }
- if($participants->meeting_type==0) // meeting
- {
- $this->Common_model->Set_Message('1','Follow meeting created successfully.');
- }
- else // event
- {
- $this->Common_model->Set_Message('1','New Event created successfully.');
- }
- // update meetings count
- if($meeting_type==0) // meeting
- {
- $value = array('meetings_count'=>$CountAvailableMeetings-1);
- }
- else // event
- {
- $value = array('events_count'=>$CountAvailableMeetings-1);
- }
- $where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$value,$where);
- // update meetings count
- // Activity Log Record
- $head = 'Create Meeting';
- $description = 'New Meeting Has Been Created By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- redirect('meeting-details/'.$flollow_up_id.'/members');
- }
- else
- {
- // $flollow_up_id = $this->input->post('hfmeeting_id');
- // $flollow_up_status = $this->input->post('flollow_up_status');
- // $_POST['request_status_Followup'] = '1';
- $data['hfmeeting_id'] = $this->input->post('hfmeeting_id');
- $_POST['request_status_Followup'] = '1';
- $this->Common_model->Set_Message('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- $this->Common_model->Set_Message_meeting('2','<i class=" fas fa-info-circle"></i> Your organization scheduled a meeting at '.$CheckMeeting['date'].' '.$CheckMeeting['time'].' to '.$CheckMeeting['end_time'].'.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Please enter a valid Date & Time.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Please complete your address.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Please complete your address.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Your current package is expired. please upgrade to continue to access Meet Pass');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- $this->Common_model->Set_Message_meeting('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- }
- # Followup New Meeting
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- $this->form_validation->set_rules('remark','Remark','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $meetings_id = $this->input->post('delete_id');
- $remark = $this->input->post('remark');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['meeting_datetime']>$datetime)
- {
- $value = array('status'=>'2','meeting_cancelled_remarks'=>$remark);
- $where = array('meetings_id'=>$meetings_id);
- $this->Common_model->common_update('meetings',$value,$where);
- $this->Common_model->Set_Message('1','Meeting cancelled.');
- $MeetingMembersList = $this->Manage_model->get_meeting_members($meetings_id);
- foreach($MeetingMembersList as $DT1)
- {
- $members_id = $DT1->members_id;
- $status = $DT1->status;
- if($status==0)
- {
- // sent notification
- if($MD['meeting_type']=='0')
- {
- $Content = array('title'=>'Meeting Cancelled','description'=>'Unfortunately, the scheduled meeting has been cancelled due to some reason.','message'=>'','meetings_id'=>$meetings_id);
- }
- else
- {
- $Content = array('title'=>'Event Cancelled','description'=>'Unfortunately, the scheduled event has been cancelled due to some reason.','message'=>'','meetings_id'=>$meetings_id);
- }
- $this->SentNotification('4',$members_id,$Content);
- // sent notification
- }
- }
- // Activity Log Record
- $head = 'Cancel Meeting';
- $description = 'Meeting Has Been Canceled By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'meeting_title','default'=>'');
- $param[] = array('key'=>'meeting_date','default'=>'');
- $param[] = array('key'=>'company_id','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $FD['MeetingStatus'] = $MeetingStatus;
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_meetings_count($FD,$start,$limit,'1');
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['MD'] = $this->Manage_model->view_meetings($FD,$start,$limit,'0');
- $data['CL'] = $this->Manage_model->view_company_list();
- $this->CommonPage('meetings/view_meetings',$data,'List of meetings');
- }
- ############################################ END OF MEETINGS ######################################
- ############################################ CAR PASS REQUESTS ####################################
- public function car_pass_requests()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_car_pass_requests($start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CPRD'] = $this->Manage_model->view_car_pass_requests($start,$limit,'0');
- $this->CommonPage('meetings/car_pass_requests',$data,'Car pass requests');
- }
- ############################################ END OF CAR PASS REQUESTS #############################
- ############################################ CHECKING MEMBER DETAILS ##############################
- public function CheckingMemberDetails($ReqData)
- {
- $DateTime = date('Y-m-d H:i:s');
- $country_id = $ReqData['country_id'];
- $member_mobile = $ReqData['member_mobile'];
- $member_name = $ReqData['member_name'];
- $organizations_id = $ReqData['organizations_id'];
- $company_id = $ReqData['company_id'];
- $email_id = $ReqData['email_id'];
- $CheckTblMember = $this->Manage_model->check_member_is_exist($country_id,$member_mobile);
- if(!empty($CheckTblMember))
- {
- $members_id = $CheckTblMember['members_id'];
- if($CheckTblMember['members_status']!=0)
- {
- $M_where = array('members_id'=>$members_id);
- $M_value = array('members_status'=>'0');
- $this->Common_model->common_update('members',$M_value,$M_where); // update status when the member is deleted
- }
- }
- else
- {
- $values = array('datetime'=>$DateTime,'country_id'=>$country_id,'name'=>ucwords($member_name),'phone'=>$member_mobile,'email'=>strtolower($email_id));
- $members_id = $this->Common_model->common_insert('members',$values);
- }
- // checking table members
- $values = array('company_members_status'=>'0',
- 'organizations_id'=>$organizations_id,
- 'company_id'=>$company_id,
- 'members_id'=>$members_id,
- 'name'=>ucwords($member_name),
- 'email'=>strtolower($email_id));
- // checking table company_members
- $CheckTblCompanyMember = $this->Manage_model->company_members_exist($company_id,$members_id,$organizations_id);
- if(empty($CheckTblCompanyMember))
- {
- $values['datetime'] = $DateTime;
- $members_sub_id = $this->Common_model->common_insert('company_members',$values);
- // Activity Log Record
- $head = 'Add Member';
- $description = 'Member Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('members_id'=>$members_id),'4');
- // Activity Log Record
- }
- else
- {
- if($email_id!='')
- {
- $C_where = array('company_members_id'=>$CheckTblCompanyMember['company_members_id']);
- $C_value = array('email'=>strtolower($email_id));
- $this->Common_model->common_update('company_members',$C_value,$C_where); // update email when the email is not empty
- }
- $members_sub_id = $CheckTblCompanyMember['company_members_id'];
- }
- $ResultArray = array('members_id'=>$members_id,'members_sub_id'=>$members_sub_id);
- return $ResultArray;
- }
- ############################################ END OF CHECKING MEMBER DETAILS #######################
- ############################################ NOTIFICATIONS ########################################
- public function SentNotification($type,$members_id,$Content,$members_sub_id='',$member_type='')
- {
- // member_type: 0- organization member, 1- company member
- $MD = $this->Manage_model->view_memeber_details($members_id);
- if(!empty($MD))
- {
- // insert to notification table
- $values = array('datetime'=>date('Y-m-d H;i:s'),
- 'members_id'=>$members_id,
- 'meetings_id'=>$Content['meetings_id'],
- 'title'=>$Content['title'],
- 'description'=>$Content['description'],
- 'status'=>'1');
- $this->Common_model->common_insert('notifications',$values);
- // insert to notification table
- $meetings_id = $Content['meetings_id'];
- if($type=='1') // assigned to meeting
- {
- // Push Notification / SMS
- if($MD['fcm_token']!='')
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- else // Sent SMS
- {
- $MD['country_code'] = str_replace('+', '', $MD['country_code']);
- $this->Common_model->SentSMS($MD['country_code'].$MD['phone'],$Content['message'],$MD['country_code']);
- }
- // Push Notification / SMS
- // sent Email
- $MDE = array();
- if($member_type==0 && $members_sub_id!='')
- {
- $MDE = $this->Manage_model->get_organization_member_name_designation($members_sub_id)['email'];
- }
- elseif($member_type==1 && $members_sub_id!='')
- {
- $MDE = $this->Manage_model->get_company_member_name_designation($members_sub_id)['email'];
- }
- if($MDE!='')
- {
- $data = array('MemberName'=>$MD['name'],'TicketNumber'=>$Content['TicketNumber'],'Organization'=>$Content['Organization'],'MeetingTitle'=>$Content['MeetingTitle']);
- $this->SentMail('1',$MDE,$data);
- }
- elseif($MD['email']!='')
- {
- $data = array('MemberName'=>$MD['name'],'TicketNumber'=>$Content['TicketNumber'],'Organization'=>$Content['Organization'],'MeetingTitle'=>$Content['MeetingTitle']);
- $this->SentMail('1',$MD['email'],$data);
- }
- // sent Email
- }
- elseif($type=='2' && $MD['fcm_token']!='') // Car Pass
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- elseif($type=='3' && $MD['fcm_token']!='') // Laptop Pass
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- elseif($type=='4' && $MD['fcm_token']!='') // Remove From Meeting
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- elseif($type=='5' && $MD['fcm_token']!='') // reschedule From Meeting
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- elseif($type=='6' && $MD['fcm_token']!='') // mom signature request
- {
- $this->Common_model->SentPushNotification($MD['fcm_token'],'meeting',$meetings_id,$Content['title'],$Content['description']);
- }
- }
- return true;
- }
- ############################################ END OF NOTIFICATIONS #################################
- ############################################ SENT MAIL ############################################
- public function SentMail($type,$to,$data = array())
- {
- $this->load->library('email');
- $this->email->clear(TRUE);
- if($type=='1') // assigned to meeting
- {
- $message = $this->load->view('email_templates/meeting_invitation', $data, true);
- $subject = $data['MeetingTitle'].' - '.$data['Organization'];
- }
- elseif($type=='6') // approve org
- {
- $message = $this->load->view('email_templates/login_credentials', $data, true);
- $subject = 'LOGIN CREDENTIALS';
- }
- elseif($type=='7') // free trial started
- {
- $message = $this->load->view('email_templates/free_trial', '', true);
- $subject = 'FREE TRIAL';
- }
- elseif($type=='8') // password-change
- {
- $message = $this->load->view('email_templates/password_change', '', true);
- $subject = 'PASSWORD CHANGED SUCCESSFULLY';
- }
- elseif($type=='9') // password-change
- {
- $message = $this->load->view('email_templates/thank_you_for_subscribing', '', true);
- $subject = 'FOR YOUR SMART MEETINGS';
- }
- elseif($type=='10') // support ticket email to user
- {
- $message = $this->load->view('email_templates/meetpass_support', $data, true);
- $subject = $data['Subject'];
- }
- elseif($type=='11') // payment receipt
- {
- $message = $this->load->view('email_templates/payment_receipt', $data, true);
- $subject = $data['Subject'];
- }
- elseif($type=='12') // sent mom notification with attachment
- {
- $message = $this->load->view('email_templates/mom_update', $data, true);
- $subject = $data['Subject'];
- if(isset($data['File']) && $data['File']!='')
- {
- $this->email->attach($data['File']);
- }
- }
- $this->email->from('no-reply@meetpass.com', 'MEET PASS');
- $this->email->to($to);
- $this->email->subject($subject);
- $this->email->message($message);
- $this->email->send();
- return true;
- }
- ############################################ END OF SENT MAIL #####################################
- ############################################ EMAIL TEMPLATES ######################################
- public function email_templates($link='')
- {
- if($this->session->userdata('logged_in')['privilege_id']!=4)
- {
- if($link=='')
- {
- ?>
- #. <a href="<?php echo base_url('email-templates/blank-template'); ?>">blank-template</a><br>
- #. <a href="<?php echo base_url('email-templates/successfull-registration'); ?>">successfull-registration</a><br>
- #. <a href="<?php echo base_url('email-templates/demo-request'); ?>">demo-request</a><br>
- #. <a href="<?php echo base_url('email-templates/enterprise-enquiry'); ?>">enterprise-enquiry</a><br>
- #. <a href="<?php echo base_url('email-templates/enquiry'); ?>">enquiry</a><br>
- #. <a href="<?php echo base_url('email-templates/login-credentials'); ?>">login-credentials</a><br>
- #. <a href="<?php echo base_url('email-templates/password-change'); ?>">password-change</a><br>
- #. <a href="<?php echo base_url('email-templates/free-trial'); ?>">free-trial</a><br>
- #. <a href="<?php echo base_url('email-templates/did-you-know'); ?>">did-you-know</a><br>
- <!-- #. <a href="<?php echo base_url('email-templates/pricing'); ?>">pricing</a><br> -->
- #. <a href="<?php echo base_url('email-templates/what-client-says'); ?>">what-client-says</a><br>
- #. <a href="<?php echo base_url('email-templates/trial-expiry-reminder-1'); ?>">trial-expiry-reminder-1</a><br>
- #. <a href="<?php echo base_url('email-templates/trial-expiry-reminder-2'); ?>">trial-expiry-reminder-2</a><br>
- #. <a href="<?php echo base_url('email-templates/trial-expiry-reminder-3'); ?>">trial-expiry-reminder-3</a><br>
- <!-- #. <a href="<?php echo base_url('email-templates/faq'); ?>">faq</a><br> -->
- #. <a href="<?php echo base_url('email-templates/feedback'); ?>">feedback</a><br>
- #. <a href="<?php echo base_url('email-templates/password-reset'); ?>">password-reset</a><br>
- #. <a href="<?php echo base_url('email-templates/thank-you-for-subscribing'); ?>">thank-you-for-subscribing</a><br>
- <!-- #. <a href="<?php echo base_url('email-templates/welcome-package-details'); ?>">welcome-package-details</a><br> -->
- <!-- #. <a href="<?php echo base_url('email-templates/renewal-mail-with-bill'); ?>">renewal-mail-with-bill</a><br> -->
- #. <a href="<?php echo base_url('email-templates/failled-payment-notification'); ?>">failled-payment-notification</a><br>
- #. <a href="<?php echo base_url('email-templates/failled-payment-notification-reminder'); ?>">failled-payment-notification-reminder</a><br>
- #. <a href="<?php echo base_url('email-templates/subscription-expired-notification'); ?>">subscription-expired-notification</a><br>
- #. <a href="<?php echo base_url('email-templates/meeting-invitation'); ?>">meeting-invitation</a><br>
- #. <a href="<?php echo base_url('email-templates/welcome-to-meetpass'); ?>">welcome-to-meetpass</a><br>
- #. <a href="<?php echo base_url('email-templates/meetpass-support'); ?>">meetpass-support</a><br>
- #. <a href="<?php echo base_url('email-templates/payment-receipt'); ?>">payment-receipt</a><br>
- #. <a href="<?php echo base_url('email-templates/website-reminder'); ?>">website-reminder</a><br>
- #. <a href="<?php echo base_url('email-templates/mom-update'); ?>">mom-update</a><br>
- <?php
- }
- else
- {
- $link = str_replace('-','_',$link);
- echo $message = $this->load->view('email_templates/'.$link, '', true);
- }
- }
- else
- {
- redirect('dashboard');
- }
- }
- ############################################ END OF EMAIL TEMPLATES ###############################
- ############################################ MANAGE PACKAGES ######################################
- public function get_package_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $subscription_packages_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_package_details($subscription_packages_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function manage_packages()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('package_category','Package Category','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('package_type','Package Type','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('package_name','Package Name','trim|required|xss_clean');
- $this->form_validation->set_rules('price','price','trim|required|xss_clean');
- $this->form_validation->set_rules('dummy_price','dummy price','trim|required|xss_clean');
- $this->form_validation->set_rules('days','days','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('yearly_renewal_discount','Yearly Renewal Discount','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('meetings_count','Meetings Count','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('meeting_members_count','Meetings Members Count','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('event_count','Events Count','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('event_members_count','Events Members Count','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('link_generation_status','Link Generation Status','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('app_create_meeting_status','App Create Meeting Status','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('package_status','Package Status','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('view_order','View Order','trim|required|xss_clean|numeric');
- if($this->input->post('submit')=='Save')
- {
- $this->form_validation->set_rules('subscription_packages_id','Subscription Package ID','trim|xss_clean');
- }
- else
- {
- $this->form_validation->set_rules('subscription_packages_id','Subscription Package ID','trim|xss_clean|numeric|required');
- }
- if($this->form_validation->run())
- {
- $country_id = $this->input->post('country_id');
- $package_category = $this->input->post('package_category');
- $package_type = $this->input->post('package_type');
- $package_name = $this->input->post('package_name');
- $price = $this->input->post('price');
- $dummy_price = $this->input->post('dummy_price');
- $days = $this->input->post('days');
- $yearly_renewal_discount = $this->input->post('yearly_renewal_discount');
- $meetings_count = $this->input->post('meetings_count');
- $meeting_members_count = $this->input->post('meeting_members_count');
- $event_count = $this->input->post('event_count');
- $event_members_count = $this->input->post('event_members_count');
- $link_generation_status = $this->input->post('link_generation_status');
- $app_create_meeting_status = $this->input->post('app_create_meeting_status');
- $multiple_locations_status = $this->input->post('multiple_locations_status');
- $package_status = $this->input->post('package_status');
- $view_order = $this->input->post('view_order');
- $subscription_packages_id = $this->input->post('subscription_packages_id');
- $submit = $this->input->post('submit');
- if($package_type==0)
- {
- $days = '30';
- }
- else
- {
- $yearly_renewal_discount = '0';
- $link_generation_status = '0';
- $app_create_meeting_status = '0';
- $multiple_locations_status = '0';
- }
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'package_type'=>$package_type,
- 'package_category'=>$package_category,
- 'country_id'=>$country_id,
- 'package_name'=>$package_name,
- 'price'=>$price,
- 'dummy_price'=>$dummy_price,
- 'yearly_renewal_discount'=>$yearly_renewal_discount,
- 'days'=>$days,
- 'meetings_count'=>$meetings_count,
- 'meeting_members_count'=>$meeting_members_count,
- 'event_count'=>$event_count,
- 'event_members_count'=>$event_members_count,
- 'link_generation_status'=>$link_generation_status,
- 'app_create_meeting_status'=>$app_create_meeting_status,
- 'multiple_locations_status'=>$multiple_locations_status,
- 'status'=>$package_status,
- 'view_order'=>$view_order);
- $CountryData = $this->Manage_model->get_country_details_row($country_id);
- if($submit=='Save')
- {
- // insert stripe api
- require_once APPPATH."third_party/stripe-php/init.php";
- $stripe = new \Stripe\StripeClient($this->config->item('StripeSecretKey'));
- $product = $stripe->products->create(['name'=>$package_name]); // create a product
- if(!empty($product) && isset($product->id) && $product->id!='')
- {
- // creating stripe subscription
- $price = $price*$CountryData['rates'];
- $subscription = $stripe->prices->create(['unit_amount' => $price*100,
- 'currency' => $CountryData['currency'],
- 'recurring' => ['interval' => 'month','interval_count'=>'1'],
- 'product' => $product->id]);
- if(!empty($subscription) && isset($subscription->id) && $subscription->id!='')
- {
- $values['stripe_subscription_id'] = $subscription->id; // adding stripe token keys
- $values['stripe_product_id'] = $product->id; // adding stripe token keys
- $subscription_packages_id = $this->Common_model->common_insert('subscription_packages',$values);
- $this->Common_model->Set_Message('1',"Package details added successfully");
- // Activity Log Record
- $head = 'Add Package';
- $description = 'Package Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('subscription_packages_id'=>$subscription_packages_id),'8');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- else
- {
- /*$CheckingPackageUsed = $this->Manage_model->checking_package_is_used_or_not($subscription_packages_id);
- if(empty($CheckingPackageUsed))
- {
- unset($values['datetime']); // unset datetime
- $where = array('subscription_packages_id'=>$subscription_packages_id);
- $this->Common_model->common_update('subscription_packages',$values,$where);
- $this->Common_model->Set_Message('1',"Package details updated successfully");
- // Activity Log Record
- $head = 'Update Package';
- $description = 'Package Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('subscription_packages_id'=>$subscription_packages_id),'5');
- // Activity Log Record
- }
- else
- {
- $values = array('status'=>$package_status);
- $where = array('subscription_packages_id'=>$subscription_packages_id);
- $this->Common_model->common_update('subscription_packages',$values,$where);
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Consumed package cannot be edited.");
- redirect(current_url());
- }*/
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Consumed package cannot be edited.");
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $CheckingPackageUsed = $this->Manage_model->checking_package_is_used_or_not($delete_id);
- if(empty($CheckingPackageUsed))
- {
- $where = array('subscription_packages_id'=>$delete_id);
- $value = array('subscription_packages_status'=>'1');
- $this->Common_model->common_update('subscription_packages',$value,$where);
- $this->Common_model->Set_Message('1','Package Removed Successfully');
- // Activity Log Record
- $head = 'Remove Package';
- $description = 'Package Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('subscription_packages_id'=>$delete_id),'8');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Consumed package cannot be removed.");
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_packages_admin($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['PD'] = $this->Manage_model->view_packages_admin($FD,$start,$limit,'0');
- $this->CommonPage('organizations/manage_packages',$data,'View Packages');
- }
- ############################################ END OF MANAGE PACKAGES ###############################
- ############################################ DEDICATED PACKAGES ###################################
- public function dedicated_packages()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'organizations_id','default'=>'');
- $param[] = array('key'=>'subscription_packages_id','default'=>'');
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_dedicated_packages_admin($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['PackageData'] = $this->Manage_model->organizations_dedicated_packages_list();
- $data['OrgData'] = $this->Manage_model->dedicated_packages_organizations_list();
- $data['PD'] = $this->Manage_model->view_dedicated_packages_admin($FD,$start,$limit,'0');
- $data['FD'] = $FD;
- $this->CommonPage('organizations/dedicated_packages',$data,'View Dedicated Packages');
- }
- ############################################ END OF DEDICATED PACKAGES ############################
- ############################################ VIEW PACKAGES HISTORY ################################
- public function view_packages_details()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $package_subscriptions_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_package_payment_details($package_subscriptions_id);
- if(!empty($Result))
- {
- $Result['package_payments_id'] = 'MPY'.sprintf("%05d", $Result['package_payments_id']);
- $Month = $Result['days']/30;
- if($Month%1==0){ $Result['days'] = $Month.' Month'; }
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_packages_details_admin()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $package_subscriptions_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_package_payment_details_admin($package_subscriptions_id);
- if(!empty($Result))
- {
- $Result['package_payments_id'] = 'MPY'.sprintf("%05d", $Result['package_payments_id']);
- $Month = $Result['days']/30;
- if($Month%1==0){ $Result['days'] = $Month.' Month'; }
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function packages_history()
- {
- # FILTER AND PAGINATION SECTION
- $FD = array();
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->packages_history($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->get_organization_country_details();
- $data['PD'] = $this->Manage_model->packages_history($FD,$start,$limit,'0');
- $this->CommonPage('organizations/packages_history',$data,'View Packages History');
- }
- ############################################ END OF VIEW PACKAGES HISTORY #########################
- ############################################ PRINT INVOICE ########################################
- public function invoice_print($package_subscriptions_id)
- {
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- #### REMOVE OLDER PDFS ####
- $FIL_PATH = FCPATH.'uploads/pdf/*';
- $TL_FILS = glob($FIL_PATH);
- $STRT_TIM = strtotime(date('Y-m-d H:i'));
- $END_TIME = date('Y-m-d H:i', strtotime('-30 minutes',$STRT_TIM));
- foreach($TL_FILS as $NFILES)
- {
- if(is_file($NFILES))
- {
- $FIL_TIME = date("Y-m-d H:i", filectime($NFILES));
- if($FIL_TIME<$END_TIME){unlink($NFILES);} // Remove files before 30 min
- }
- }
- #### REMOVE OLDER PDFS ####
- $package_subscriptions_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_package_payment_details_for_invoice($package_subscriptions_id);
- if(!empty($Result))
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['CountryData'] = $this->Manage_model->get_organization_country_details();
- $data['DT'] = $Result;
- $data['OD'] = $OD;
- $html = $this->load->view('organizations/invoice_print',$data,true);
- // Generate Invoice PDF
- require_once FCPATH.'/vendor/autoload.php';
- $DateTime = time().$package_subscriptions_id;
- $pdfFilePath = FCPATH."uploads/pdf/".$DateTime.".pdf";
- $pdf = new \Mpdf\Mpdf(['format' => 'A5']);
- $pdf->AddPageByArray(['margin-left' => 5,'margin-right' => 5,'margin-top' => 25,'margin-bottom' => 10,]);
- $pdf->WriteHTML($html);
- $pdf->Output($pdfFilePath, 'F');
- // Generate Invoice PDF
- ?><br><iframe id="MyiFrame" frameborder="0" style="border:0; width: 0; height: 0" src="<?php echo base_url('uploads/pdf/'.$DateTime.'.pdf'); ?>"></iframe><?php
- }
- }
- else
- {
- redirect('dashboard');
- }
- }
- ############################################ END OF PRINT INVOICE #################################
- ############################################ MEETING REPORT #######################################
- public function meeting_report($meetings_id)
- {
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- #### REMOVE OLDER PDFS ####
- $FIL_PATH = FCPATH.'uploads/pdf/*';
- $TL_FILS = glob($FIL_PATH);
- $STRT_TIM = strtotime(date('Y-m-d H:i'));
- $END_TIME = date('Y-m-d H:i', strtotime('-30 minutes',$STRT_TIM));
- foreach($TL_FILS as $NFILES)
- {
- if(is_file($NFILES))
- {
- $FIL_TIME = date("Y-m-d H:i", filectime($NFILES));
- if($FIL_TIME<$END_TIME){unlink($NFILES);} // Remove files before 30 min
- }
- }
- #### REMOVE OLDER PDFS ####
- $meetings_id = $this->input->post('data_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(!empty($MD))
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['MD'] = $MD;
- $data['OD'] = $OD;
- $data['MeetingMembersList'] = $this->Manage_model->get_meeting_members($meetings_id);
- $data['MFeedback'] = $this->Manage_model->get_meeting_members_feedback($meetings_id);
- $data['Invities'] = $this->Manage_model->get_meeting_members_count_new($meetings_id);
- $data['Attendees'] = $this->Manage_model->get_meeting_members_attended_count_new($meetings_id);
- $html = $this->load->view('meetings/meeting_report',$data,true);
- // Generate Invoice PDF
- require_once FCPATH.'/vendor/autoload.php';
- $DateTime = time().$meetings_id;
- $pdfFilePath = FCPATH."uploads/pdf/".$DateTime.".pdf";
- $pdf = new \Mpdf\Mpdf(['format' => 'A4']);
- $pdf->AddPageByArray(['margin-left' => 5,'margin-right' => 5,'margin-top' => 37,'margin-bottom' => 10,]);
- $pdf->WriteHTML($html);
- $pdf->Output($pdfFilePath, 'F');
- // Generate Invoice PDF
- ?><br><iframe id="MyiFrame" frameborder="0" style="border:0; width: 0; height: 0;" src="<?php echo base_url('uploads/pdf/'.$DateTime.'.pdf'); ?>"></iframe><?php
- }
- }
- else
- {
- redirect('dashboard');
- }
- }
- public function generate_meeting_report($meetings_id)
- {
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(!empty($MD))
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['MD'] = $MD;
- $data['OD'] = $OD;
- $data['MeetingMembersList'] = $this->Manage_model->get_meeting_members($meetings_id);
- $data['MFeedback'] = $this->Manage_model->get_meeting_members_feedback($meetings_id);
- $data['Invities'] = $this->Manage_model->get_meeting_members_count_new($meetings_id);
- $data['Attendees'] = $this->Manage_model->get_meeting_members_attended_count_new($meetings_id);
- $html = $this->load->view('meetings/meeting_report',$data,true);
- // Generate Invoice PDF
- require_once FCPATH.'/vendor/autoload.php';
- $DateTime = time().$meetings_id;
- $pdfFilePath = FCPATH."uploads/pdf/".$DateTime.".pdf";
- $pdf = new \Mpdf\Mpdf(['format' => 'A4']);
- $pdf->AddPageByArray(['margin-left' => 5,'margin-right' => 5,'margin-top' => 37,'margin-bottom' => 10,]);
- $pdf->WriteHTML($html);
- $pdf->Output($pdfFilePath, 'F');
- // Generate Invoice PDF
- return base_url('uploads/pdf/'.$DateTime.'.pdf');
- }
- else
- {
- return '';
- }
- }
- ############################################ END OF MEETING REPORT ################################
- ############################################ MOM LETTER HEAD ######################################
- public function mom_letterhead($meetings_id)
- {
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- #### REMOVE OLDER PDFS ####
- $FIL_PATH = FCPATH.'uploads/pdf/*';
- $TL_FILS = glob($FIL_PATH);
- $STRT_TIM = strtotime(date('Y-m-d H:i'));
- $END_TIME = date('Y-m-d H:i', strtotime('-30 minutes',$STRT_TIM));
- foreach($TL_FILS as $NFILES)
- {
- if(is_file($NFILES))
- {
- $FIL_TIME = date("Y-m-d H:i", filectime($NFILES));
- if($FIL_TIME<$END_TIME){unlink($NFILES);} // Remove files before 30 min
- }
- }
- #### REMOVE OLDER PDFS ####
- $meetings_id = $this->input->post('data_id');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(!empty($MD))
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $data['MD'] = $MD;
- $data['OD'] = $OD;
- $html = $this->load->view('meetings/mom_letterhead',$data,true);
- // Generate Invoice PDF
- require_once FCPATH.'/vendor/autoload.php';
- $DateTime = time().$meetings_id;
- $pdfFilePath = FCPATH."uploads/pdf/".$DateTime.".pdf";
- $pdf = new \Mpdf\Mpdf(['format' => 'A4']);
- $pdf->AddPageByArray(['margin-left' => 5,'margin-right' => 5,'margin-top' => 37,'margin-bottom' => 10,]);
- $pdf->WriteHTML($html);
- $pdf->Output($pdfFilePath, 'F');
- // Generate Invoice PDF
- ?><br><iframe id="MyiFrame" frameborder="0" style="border:0; width: 0; height: 0;" src="<?php echo base_url('uploads/pdf/'.$DateTime.'.pdf'); ?>"></iframe><?php
- }
- }
- else
- {
- redirect('dashboard');
- }
- }
- ############################################ END OF MOM LETTER HEAD ###############################
- ############################################ SUPPORT REQUEST ######################################
- public function view_support_request_details()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $support_request_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_support_request_details($support_request_id);
- if(!empty($Result))
- {
- $Result['support_request_id'] = 'MPST'.sprintf("%05d", $Result['support_request_id']);
- $Result['pending_datetime'] = date('d-m-Y h:iA',strtotime($Result['pending_datetime']));
- $Result['processed_datetime'] = date('d-m-Y h:iA',strtotime($Result['processed_datetime']));
- $Result['completed_datetime'] = date('d-m-Y h:iA',strtotime($Result['completed_datetime']));
- if($Result['status']==0)
- {
- $Result['status'] = '<span class="badge badge-danger">PENDING</span>';
- }
- elseif($Result['status']==1)
- {
- $Result['status'] = '<span class="badge badge-info">PROCESSING</span>';
- $Result['status'] .= ' - on '.$Result['processed_datetime'].'<br><b>Remark:</b> '.$Result['processed_remark'];
- }
- else
- {
- $Result['status'] = '<span class="badge badge-success">COMPLETED</span>';
- $Result['status'] .= ' - on '.$Result['completed_datetime'].'<br><b>Remark:</b> '.$Result['completed_remark'];
- }
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function support_request()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('support_request_type_id','Type','trim|required|xss_clean');
- $this->form_validation->set_rules('subject','Subject','trim|required|xss_clean');
- $this->form_validation->set_rules('message','Message','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $support_request_type_id = $this->input->post('support_request_type_id');
- $subject = $this->input->post('subject');
- $message = $this->input->post('message');
- $submit = $this->input->post('submit');
- $DateTime = date('Y-m-d H:i:s');
- $values = array('datetime'=>$DateTime,
- 'pending_datetime'=>$DateTime,
- 'organizations_id'=>$organizations_id,
- 'support_request_type_id'=>$support_request_type_id,
- 'subject'=>$subject,
- 'request'=>$message);
- $support_request_id = $this->Common_model->common_insert('support_request',$values);
- $this->Common_model->Set_Message('1',"Support requested successfully.");
- $Type = $this->Manage_model->support_request_types_id($support_request_type_id);
- $TicketNumber = 'MPST'.sprintf("%05d", $support_request_id);
- $DateTime = date('d-M-Y h:i A');
- // email to organization
- $OrgData['Subject'] = '[Ticket ID: '.$TicketNumber.'] '.$subject;
- $OrgData['Header'] = 'Dear '.$OD['name'].',<br><br>';
- $OrgData['Content'] = 'Thank you for reaching out Meet Pass support system.<br><br>This is an automatic response just to let you know we have got your email. You will get an answer back shortly.<br><br><hr><br>Ticket ID: '.$TicketNumber.'<br>Subject: '.$subject.'<br>Status: Pending<br><br>Regards,<br>Meet Pass';
- $this->SentMail('10',$OD['email'],$OrgData);
- // email to organization
- // email to meetpass
- $AdminData['Subject'] = 'New Support Request - [Ticket ID: '.$TicketNumber.'] '.$subject;
- $AdminData['Header'] = 'New Support Request.<br><br>';
- $AdminData['Content'] = $OD['name'].'<br>'.$OD['country'].'<br>Date & Time : '.$DateTime.'<br><br>Ticket ID: '.$TicketNumber.'<br>Type: '.$Type['support_request_type'].'<br>Subject: '.$subject.'<br>Status: Pending<br>Message: '.$message;
- $this->SentMail('10','support@meetpass.com', $AdminData);
- // email to meetpass
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF INSERT / UPDATE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->support_request_history($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['Type'] = $this->Manage_model->support_request_types();
- $data['SRH'] = $this->Manage_model->support_request_history($FD,$start,$limit,'0');
- $this->CommonPage('organizations/support_request',$data,'Support Ticket');
- }
- ############################################ END OF SUPPORT REQUEST ###############################
- ############################################ SUPPORT REQUEST - ADMIN ##############################
- public function view_support_request_details_admin()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $support_request_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_support_request_details_admin($support_request_id);
- if(!empty($Result))
- {
- $Result['support_request_id'] = 'MPST'.sprintf("%05d", $Result['support_request_id']);
- $Result['pending_datetime'] = date('d-m-Y h:iA',strtotime($Result['pending_datetime']));
- $Result['processed_datetime'] = date('d-m-Y h:iA',strtotime($Result['processed_datetime']));
- $Result['completed_datetime'] = date('d-m-Y h:iA',strtotime($Result['completed_datetime']));
- if($Result['status']==0)
- {
- $Result['status'] = '<span class="badge badge-danger">PENDING</span>';
- }
- elseif($Result['status']==1)
- {
- $Result['status'] = '<span class="badge badge-info">PROCESSING</span>';
- $Result['status'] .= ' - on '.$Result['processed_datetime'].'<br><b>Remark:</b> '.$Result['processed_remark'];
- }
- else
- {
- $Result['status'] = '<span class="badge badge-success">COMPLETED</span>';
- $Result['status'] .= ' - on '.$Result['completed_datetime'].'<br><b>Remark:</b> '.$Result['completed_remark'];
- }
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function support_request_admin($status='0')
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['ActiveRequest']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('support_request_id','Request','trim|required|xss_clean');
- $this->form_validation->set_rules('organizations_id','Organization','trim|required|xss_clean');
- $this->form_validation->set_rules('remark','Remark','trim|xss_clean');
- if($this->form_validation->run())
- {
- $users_id = $this->session->userdata('logged_in')['users_id'];
- $support_request_id = $this->input->post('support_request_id');
- $organizations_id = $this->input->post('organizations_id');
- $remark = $this->input->post('remark');
- $ActiveRequest = $this->input->post('ActiveRequest');
- $TicketNumber = 'MPST'.sprintf("%05d", $support_request_id);
- $DateTime = date('Y-m-d H:i:s');
- $CheckData = $this->Manage_model->support_request_admin_data($support_request_id,$organizations_id);
- if(!empty($CheckData))
- {
- $Response = '';
- if($remark!='')
- {
- $Response = '<br> Remark: '.$remark;
- }
- $Type = $CheckData['support_request_type'];
- $subject = $CheckData['subject'];
- $org_name = $CheckData['org_name'];
- $org_email = $CheckData['org_email'];
- $where = array('support_request_id'=>$support_request_id,'organizations_id'=>$organizations_id);
- if($CheckData['status']=='0' && $ActiveRequest=='Processing')
- {
- $values = array('processed_datetime'=>$DateTime,
- 'processed_remark'=>$remark,
- 'processed_by'=>$users_id,
- 'status'=>'1');
- $this->Common_model->common_update('support_request',$values,$where);
- $this->Common_model->Set_Message('1',"Support request processed successfully.");
- // email to organization
- $OrgData['Subject'] = 'Processing - [Ticket ID: '.$TicketNumber.'] '.$subject;
- $OrgData['Header'] = 'Dear '.$org_name.',<br><br>';
- $OrgData['Content'] = 'Thank you for reaching out Meet Pass support system.<br><br><hr><br>Ticket ID: '.$TicketNumber.'<br>Subject: '.$subject.'<br>Status: Processing'.$Response.'<br><br>Regards,<br>Meet Pass';
- $this->SentMail('10',$org_email,$OrgData);
- // email to organization
- // email to meetpass
- $AdminData['Subject'] = 'Processing - [Ticket ID: '.$TicketNumber.'] '.$subject;
- $AdminData['Header'] = 'Support Request Under Processing.<br><br>';
- $AdminData['Content'] = $org_name.'<br>Date & Time : '.$DateTime.'<br><br>Ticket ID: '.$TicketNumber.'<br>Type: '.$Type.'<br>Subject: '.$subject.'<br>Status: Processing<br>Message: '.$Response;
- $this->SentMail('10','support@meetpass.com', $AdminData);
- // email to meetpass
- }
- elseif($CheckData['status']=='1' && $ActiveRequest=='Finish')
- {
- $values = array('completed_datetime'=>$DateTime,
- 'completed_remark'=>$remark,
- 'completed_by'=>$users_id,
- 'status'=>'2');
- $this->Common_model->common_update('support_request',$values,$where);
- $this->Common_model->Set_Message('1',"Support request finished successfully.");
- // email to organization
- $OrgData['Subject'] = 'Finished - [Ticket ID: '.$TicketNumber.'] '.$subject;
- $OrgData['Header'] = 'Dear '.$org_name.',<br><br>';
- $OrgData['Content'] = 'Thank you for reaching out Meet Pass support system.<br><br><hr><br>Ticket ID: '.$TicketNumber.'<br>Subject: '.$subject.'<br>Status: Finished'.$Response.'<br><br>Regards,<br>Meet Pass';
- $this->SentMail('10',$org_email,$OrgData);
- // email to organization
- // email to meetpass
- $AdminData['Subject'] = 'Finished - [Ticket ID: '.$TicketNumber.'] '.$subject;
- $AdminData['Header'] = 'Support Request Finished.<br><br>';
- $AdminData['Content'] = $org_name.'<br>Date & Time : '.$DateTime.'<br><br>Ticket ID: '.$TicketNumber.'<br>Type: '.$Type.'<br>Subject: '.$subject.'<br>Status: Processing<br>Message: '.$Response;
- $this->SentMail('10','support@meetpass.com', $AdminData);
- // email to meetpass
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF INSERT / UPDATE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'ticket_no','default'=>'');
- $param[] = array('key'=>'status','default'=>$status);
- $FD = $this->Common_model->common_filter($URL,$param);
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->support_request_history_admin($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['SRH'] = $this->Manage_model->support_request_history_admin($FD,$start,$limit,'0');
- $this->CommonPage('organizations/support_request_admin',$data,'Support Requests');
- }
- ############################################ END OF SUPPORT REQUEST - ADMIN #######################
- ############################################ FAQ ##################################################
- public function faq()
- {
- $data['DT'] = $this->Manage_model->get_faq_list();
- $this->CommonPage('dashboard/faq',$data,'FAQ');
- }
- ############################################ END OF FAQ ###########################################
- ############################################ TUTORIALS ############################################
- public function tutorials()
- {
- $data['DT'] = $this->Manage_model->get_tutorials_list();
- $this->CommonPage('dashboard/tutorials',$data,'Tutorials');
- }
- ############################################ END OF TUTORIALS #####################################
- ############################################ APP LINKS ############################################
- public function app_links()
- {
- $this->CommonPage('dashboard/app_links','','Mobile Application Links');
- }
- ############################################ END OF APP LINKS #####################################
- ############################################ VISITORS REPORT ######################################
- public function visitors_report()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'organizations_members_id','default'=>'');
- $param[] = array('key'=>'start_date','default'=>date('01/m/Y'));
- $param[] = array('key'=>'end_date','default'=>date('t/m/Y'));
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_visitors_report($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['VR'] = $this->Manage_model->view_visitors_report($FD,$start,$limit,'0');
- $data['MD'] = $this->Manage_model->view_members_select();
- $this->CommonPage('reports/visitors_report', $data, 'Visitors Report');
- }
- ############################################ END OF VISITORS REPORT ###############################
- ############################################ VISITORS REPORT PDF ##################################
- public function visitors_report_print()
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- #### REMOVE OLDER PDFS ####
- $FIL_PATH = FCPATH.'uploads/pdf/*';
- $TL_FILS = glob($FIL_PATH);
- $STRT_TIM = strtotime(date('Y-m-d H:i'));
- $END_TIME = date('Y-m-d H:i', strtotime('-30 minutes',$STRT_TIM));
- foreach($TL_FILS as $NFILES)
- {
- if(is_file($NFILES))
- {
- $FIL_TIME = date("Y-m-d H:i", filectime($NFILES));
- if($FIL_TIME<$END_TIME){unlink($NFILES);} // Remove files before 30 min
- }
- }
- #### REMOVE OLDER PDFS ####
- if(isset($_SESSION['FILTER']['visitors-report']) && !empty($_SESSION['FILTER']['visitors-report']))
- {
- $FD = $_SESSION['FILTER']['visitors-report'];
- $start = $limit = '';
- $data['VR'] = $this->Manage_model->view_visitors_report($FD,$start,$limit,'0');
- $data['FD'] = $FD;
- $data['OD'] = $this->Manage_model->get_organization_details($organizations_id);
- $html = $this->load->view('reports/visitors_report_print',$data,true);
- // Generate Invoice PDF
- require_once FCPATH.'/vendor/autoload.php';
- $DateTime = time().$organizations_id;
- $pdfFilePath = FCPATH."uploads/pdf/".$DateTime.".pdf";
- $pdf = new \Mpdf\Mpdf(['format' => 'A4']);
- $pdf->AddPageByArray(['margin-left' => 5,'margin-right' => 5,'margin-top' => 37,'margin-bottom' => 10,]);
- $pdf->WriteHTML($html);
- $pdf->Output($pdfFilePath, 'F');
- // Generate Invoice PDF
- ?><br><iframe id="MyiFrame" frameborder="0" style="border:0; width: 0; height: 0;" src="<?php echo base_url('uploads/pdf/'.$DateTime.'.pdf'); ?>"></iframe><?php
- }
- }
- ############################################ END OF VISITORS REPORT PDF ###########################
- ############################################ MEMBERS MEETING REPORT ###############################
- public function view_members_meeting_report_details()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $members_meeting_report_id = $this->input->post('data_id');
- $Result = $this->Manage_model->view_members_meeting_report_details($members_meeting_report_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function members_meeting_report()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'organizations_members_id','default'=>'');
- $param[] = array('key'=>'start_date','default'=>date('01/m/Y'));
- $param[] = array('key'=>'end_date','default'=>date('t/m/Y'));
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->members_meeting_report($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['VR'] = $this->Manage_model->members_meeting_report($FD,$start,$limit,'0');
- $data['MD'] = $this->Manage_model->view_members_select();
- $this->CommonPage('reports/members_meeting_report', $data, 'Meeting Report');
- }
- ############################################ END OF MEMBERS MEETING REPORT ########################
- ############################################ MEMBERS MEETING REPORT ###############################
- public function subscription_report()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'country_id','default'=>'');
- $param[] = array('key'=>'start_date','default'=>date('01/m/Y'));
- $param[] = array('key'=>'end_date','default'=>date('t/m/Y'));
- $FD = $this->Common_model->common_filter($URL,$param);
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->subscription_report($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['VR'] = $this->Manage_model->subscription_report($FD,$start,$limit,'0');
- $data['GrandTotal'] = $this->Manage_model->subscription_report_grand_total($FD,$start,$limit,'0');
- $this->CommonPage('reports/subscription_report', $data, 'Subscribers Report');
- }
- ############################################ END OF MEMBERS MEETING REPORT ########################
- ############################################ ADMIN PROFILE ########################################
- public function admin_profile($tab='')
- {
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $country_id = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- else
- {
- redirect('dashboard');
- }
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('company','company','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','phone','trim|required|xss_clean');
- $this->form_validation->set_rules('email','email','trim|required|xss_clean');
- $this->form_validation->set_rules('address','address','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_name','cp_name','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_phone','cp_phone','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_email','cp_email','trim|xss_clean');
- $this->form_validation->set_rules('cp_position','cp_position','trim|xss_clean');
- $this->form_validation->set_rules('account_name','account_name','trim|xss_clean');
- $this->form_validation->set_rules('account_number','account_number','trim|xss_clean');
- $this->form_validation->set_rules('bank_name','bank_name','trim|xss_clean');
- $this->form_validation->set_rules('bank_branch','bank_branch','trim|xss_clean');
- $this->form_validation->set_rules('ifsc_code','ifsc_code','trim|xss_clean');
- $this->form_validation->set_rules('bank_address','bank_address','trim|xss_clean');
- if($this->form_validation->run())
- {
- $company = $this->input->post('company');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $address = $this->input->post('address');
- $cp_name = $this->input->post('cp_name');
- $cp_phone = $this->input->post('cp_phone');
- $cp_email = $this->input->post('cp_email');
- $cp_position = $this->input->post('cp_position');
- $account_name = $this->input->post('account_name');
- $account_number = $this->input->post('account_number');
- $bank_name = $this->input->post('bank_name');
- $bank_branch = $this->input->post('bank_branch');
- $ifsc_code = $this->input->post('ifsc_code');
- $bank_address = $this->input->post('bank_address');
- $submit = $this->input->post('submit');
- $values = array('company'=>ucwords($company),
- 'phone'=>$phone,
- 'email'=>$email,
- 'address'=>$address,
- 'cp_name'=>ucwords($cp_name),
- 'cp_phone'=>$cp_phone,
- 'cp_email'=>strtolower($cp_email),
- 'cp_position'=>$cp_position,
- 'account_name'=>$account_name,
- 'account_number'=>$account_number,
- 'bank_name'=>$bank_name,
- 'bank_branch'=>$bank_branch,
- 'ifsc_code'=>$ifsc_code,
- 'bank_address'=>$bank_address);
- $where = array('country_id'=>$country_id);
- $this->Common_model->common_update('country_admin',$values,$where);
- $this->Common_model->Set_Message('1',"Profile updated successfully.");
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- $data['OD'] = $this->Manage_model->get_country_admin_details($country_id);
- $this->CommonPage('organizations/admin_profile',$data,$data['OD']['company']);
- }
- ############################################ END OF ADMIN PROFILE #################################
- ############################################ VIEW COUNTRY ADMINS ##################################
- public function view_country_admins_details()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $country_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_country_admin_details($country_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function get_countryadmin_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $countryAdmin_id = $this->input->post('data_id');
- $Result = $this->Manage_model->view_country_admins_BYID($countryAdmin_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_country_admins()
- {
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('company','company','trim|required|xss_clean');
- $this->form_validation->set_rules('phone','phone','trim|required|xss_clean');
- $this->form_validation->set_rules('email','email','trim|required|xss_clean');
- $this->form_validation->set_rules('address','address','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_name','cp_name','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_phone','cp_phone','trim|required|xss_clean');
- $this->form_validation->set_rules('cp_email','cp_email','trim|xss_clean');
- $this->form_validation->set_rules('cp_position','cp_position','trim|xss_clean');
- $this->form_validation->set_rules('account_name','account_name','trim|xss_clean');
- $this->form_validation->set_rules('account_number','account_number','trim|xss_clean');
- $this->form_validation->set_rules('bank_name','bank_name','trim|xss_clean');
- $this->form_validation->set_rules('bank_branch','bank_branch','trim|xss_clean');
- $this->form_validation->set_rules('ifsc_code','ifsc_code','trim|xss_clean');
- $this->form_validation->set_rules('bank_address','bank_address','trim|xss_clean');
- if($this->form_validation->run())
- { $country_admin_id=$this->input->post('country_admin_id');
- $PDCountry_A=$this->input->post('PDCountry_A');
- $company = $this->input->post('company');
- $phone = $this->input->post('phone');
- $email = $this->input->post('email');
- $address = $this->input->post('address');
- $cp_name = $this->input->post('cp_name');
- $cp_phone = $this->input->post('cp_phone');
- $cp_email = $this->input->post('cp_email');
- $cp_position = $this->input->post('cp_position');
- $account_name = $this->input->post('account_name');
- $account_number = $this->input->post('account_number');
- $bank_name = $this->input->post('bank_name');
- $bank_branch = $this->input->post('bank_branch');
- $ifsc_code = $this->input->post('ifsc_code');
- $bank_address = $this->input->post('bank_addresss');
- $country_admin_status = $this->input->post('country_admin_status');
- $agreement_number = $this->input->post('PDAgreementNo_A');
- $percentage = $this->input->post('PDPercentage_A');
- $submit = $this->input->post('submit');
- $values = array('company'=>ucwords($company),
- 'phone'=>$phone,
- 'country_id'=>$PDCountry_A,
- 'email'=>$email,
- 'address'=>$address,
- 'cp_name'=>ucwords($cp_name),
- 'cp_phone'=>$cp_phone,
- 'cp_email'=>strtolower($cp_email),
- 'cp_position'=>$cp_position,
- 'account_name'=>$account_name,
- 'agreement_number'=>$agreement_number,
- 'percentage'=>$percentage,
- 'account_number'=>$account_number,
- 'bank_name'=>$bank_name,
- 'bank_branch'=>$bank_branch,
- 'ifsc_code'=>$ifsc_code,
- 'country_admin_status'=>$country_admin_status,
- 'bank_address'=>$bank_address);
- if($submit=='Save')
- {
- $id = $this->Common_model->common_insert('country_admin',$values);
- $this->Common_model->Set_Message('1',"<strong> Profile Saved successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('country_admin_id'=>$country_admin_id);
- $this->Common_model->common_update('country_admin',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>Profile Updated successfully.");
- }
- redirect(current_url());
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $FD = array();
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_country_admins($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['AD'] = $this->Manage_model->view_country_admins($FD,$start,$limit,'0');
- $data["CountryData"] = $this->Manage_model->select_view_country_org();
- $this->CommonPage('organizations/view_country_admins', $data, 'Country Admins');
- }
- ############################################ END OF VIEW COUNTRY ADMINS ###########################
- ############################################ COUNTRY ADMINS PAYMENTS ##############################
- public function get_country_admins_pending_payments()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('MP_country_id','MP_country_id','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('MP_year','MP_year','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('MP_month','MP_month','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $MP_country_id = $this->input->post('MP_country_id');
- $MP_year = $this->input->post('MP_year');
- $MP_month = $this->input->post('MP_month');
- $Result = $this->Manage_model->get_country_admin_details($MP_country_id);
- if(!empty($Result) && $Result['percentage']>0)
- {
- $SDate = $MP_year.'-'.$MP_month.'-01';
- $CheckPayment = $this->Manage_model->check_admin_payment_done($MP_country_id,$SDate);
- if(empty($CheckPayment))
- {
- $StartDate = $MP_year.'-'.$MP_month.'-01 00:00:00';
- $EndDate = date('Y-m-t',strtotime($StartDate)).' 23:59:59';
- $Rate = $Result['rates'];
- $Percentage = $Result['percentage'];
- $PendingPayment = $this->Manage_model->monthly_wise_pending_payment_report($MP_country_id,$StartDate,$EndDate);
- if($PendingPayment!='')
- {
- $CurrentMonthYear = date('Y-m-01');
- if($CurrentMonthYear!=$SDate)
- {
- $Amnt = ((($PendingPayment/$Rate)*$Percentage)/100);
- $Data['response'] = 'success';
- $Data['result']['amount'] = round($Amnt,2);
- $Data['result']['status'] = '';
- }
- else
- {
- $Data['response'] = 'success';
- $Data['result']['amount'] = '0';
- $Data['result']['status'] = 'currentmnth';
- }
- }
- else
- {
- $Data['response'] = 'success';
- $Data['result']['amount'] = '0';
- $Data['result']['status'] = 'null';
- }
- }
- else
- {
- $Data['response'] = 'success';
- $Data['result']['amount'] = $CheckPayment['amount'];
- $Data['result']['status'] = 'paid';
- }
- }
- }
- echo json_encode($Data);
- }
- public function country_admin_payments()
- {
- // make payment
- if(isset($_POST['MP_submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('MP_country_id','MP_country_id','trim|required|xss_clean');
- $this->form_validation->set_rules('MP_year','MP_year','trim|required|xss_clean');
- $this->form_validation->set_rules('MP_month','MP_month','trim|required|xss_clean');
- $this->form_validation->set_rules('MP_remarks','MP_remarks','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $MP_country_id = $this->input->post('MP_country_id');
- $MP_year = $this->input->post('MP_year');
- $MP_month = $this->input->post('MP_month');
- $MP_remarks = $this->input->post('MP_remarks');
- $Result = $this->Manage_model->get_country_admin_details($MP_country_id);
- if(!empty($Result))
- {
- $SDate = $MP_year.'-'.$MP_month.'-01';
- $CheckPayment = $this->Manage_model->check_admin_payment_done($MP_country_id,$SDate);
- if(empty($CheckPayment))
- {
- $StartDate = $MP_year.'-'.$MP_month.'-01 00:00:00';
- $EndDate = date('Y-m-t',strtotime($StartDate)).' 23:59:59';
- $Rate = $Result['rates'];
- $Percentage = $Result['percentage'];
- $PendingPayment = $this->Manage_model->monthly_wise_pending_payment_report($MP_country_id,$StartDate,$EndDate);
- if($PendingPayment!='')
- {
- $CurrentMonthYear = date('Y-m-01');
- if($CurrentMonthYear!=$SDate)
- {
- $Amnt = ((($PendingPayment/$Rate)*$Percentage)/100);
- $FinalAmount = round($Amnt,2);
- $SubAmount = round(($PendingPayment/$Rate),2);
- $values = array('datetime'=>date('Y-m-d H:i:s'),
- 'country_admin_id'=>$Result['country_admin_id'],
- 'country_id'=>$MP_country_id,
- 'paid_month'=>$SDate,
- 'amount'=>$FinalAmount,
- 'rates'=>$Rate,
- 'percentage'=>$Percentage,
- 'subscription_amount'=>$SubAmount,
- 'remarks'=>$MP_remarks);
- $this->Common_model->common_insert('country_admin_payments',$values);
- $this->Common_model->Set_Message('1',"The amount $".$FinalAmount." is paid");
- }
- else
- {
- $this->Common_model->Set_Message('2',"You can't pay current month payments");
- }
- }
- else
- {
- $this->Common_model->Set_Message('1',"No subscriptions");
- }
- }
- else
- {
- $this->Common_model->Set_Message('1',"The amount $".$CheckPayment['amount']." is already paid");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- // make payment
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'country_admin_id','default'=>'');
- $param[] = array('key'=>'start_date','default'=>date('01/m/Y'));
- $param[] = array('key'=>'end_date','default'=>date('t/m/Y'));
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->country_admin_payments($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['AD'] = $this->Manage_model->country_admin_payments($FD,$start,$limit,'0');
- $data['CAL'] = $this->Manage_model->view_country_admins_list();
- $this->CommonPage('organizations/country_admin_payments', $data, 'Country Admin Payments');
- }
- ############################################ END OF COUNTRY ADMINS PAYMENTS #######################
- ############################################ COUNTRY ADMINS PAYMENTS FOR VIEW #####################
- public function admin_payments()
- {
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $FD = array();
- $country_id = $this->session->userdata('logged_in')['table_id']; // for country admin only
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->country_admin_payments_view($country_id,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['AD'] = $this->Manage_model->country_admin_payments_view($country_id,$start,$limit,'0');
- $this->CommonPage('organizations/country_admin_payments_view', $data, 'Country Admin Payments');
- }
- ############################################ END OF COUNTRY ADMINS PAYMENTS FOR VIEW ##############
- ############################################ VIEW PACKAGES PAYMENT STATUS #########################
- public function view_packages_payment_status()
- {
- $this->load->model('Payment_model');
- if(isset($_REQUEST['tranid']) && isset($_REQUEST['trackid']))
- {
- $tranid = $_REQUEST['tranid'];
- $trackid = $_REQUEST['trackid'];
- $token = $_REQUEST['token'];
- $Result = $this->Payment_model->check_payment_status($trackid,$tranid); // checking server response
- $package_payments_id = str_replace('MPY', '', $trackid);
- if(!empty($Result) && isset($Result->result) && $Result->result =='Successful') // payment status: success
- {
- $PaymentDetails = $this->Manage_model->get_payment_details($package_payments_id);
- if(!empty($PaymentDetails))
- {
- $datetime = date('Y-m-d H:i:s');
- // update payments table
- $PPWhere = array('package_payments_id'=>$package_payments_id);
- $PPValue = array('status'=>'1',
- 'response_url'=>json_encode($_REQUEST),
- 'response_data'=>json_encode($Result),
- 'transactionid'=>$tranid,
- 'token'=>$token);
- // update payments table
- if($PaymentDetails['package_type']=='0') // monthly package
- {
- $BuyDate = date('Y-m-d');
- $DueDate = date('Y-m-d', strtotime('+1 month'));
- $PreviousDate = date('Y-m-d', strtotime('-1 days'));
- $CheckSubscriptionExist = $this->Manage_model->check_payment_subscription_exist($PaymentDetails['package_payments_id'],$PaymentDetails['subscription_packages_id']);
- if(empty($CheckSubscriptionExist))
- {
- // cancel previous subscriptions
- if($CheckSubscriptionExist['due_date']<$BuyDate)
- {
- $Cancel_SP_value = array('status'=>'1');
- }
- else
- {
- $Cancel_SP_value = array('status'=>'2');
- }
- $Cancel_SP_where = array('status'=>'0','organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('package_subscriptions',$Cancel_SP_value,$Cancel_SP_where); // tbl package_subscriptions
- $Cancel_ORG_value = array('meetings_count'=>'0','members_count'=>'0','events_count'=>'0','events_members_count'=>'0','dedicated_link_availability'=>'0','app_create_meeting_status'=>'0','multiple_locations_status'=>'0','follow_up_meeting_status'=>'0','advanced_security_level'=>'0','packge_validity_upto'=>$PreviousDate);
- $Cancel_ORG_where = array('organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('organizations',$Cancel_ORG_value,$Cancel_ORG_where); // tbl organizations
- // cancel previous subscriptions
- // insert into package subscriptions
- $SP_values = array( 'datetime'=>$datetime,
- 'organizations_id'=>$PaymentDetails['organizations_id'],
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id'],
- 'package_payments_id'=>$PaymentDetails['package_payments_id'],
- 'buy_date'=>$BuyDate,
- 'due_date'=>$DueDate,
- 'status'=>'0',
- 'recurring_status'=>'0');
- $package_subscriptions_id = $this->Common_model->common_insert('package_subscriptions',$SP_values);
- // insert into package subscriptions
- $PPValue['package_subscriptions_id'] = $package_subscriptions_id; // update subscription id to payments
- // updating monthly packages in to organization table
- $OrgWhere = array( 'organizations_id'=>$PaymentDetails['organizations_id']);
- $OrgValue = array( 'meetings_count'=>$PaymentDetails['meetings_count'],
- 'members_count'=>$PaymentDetails['meeting_members_count'],
- 'events_count'=>$PaymentDetails['event_count'],
- 'events_members_count'=>$PaymentDetails['event_members_count'],
- 'dedicated_link_availability'=>$PaymentDetails['link_generation_status'],
- 'app_create_meeting_status'=>$PaymentDetails['app_create_meeting_status'],
- 'multiple_locations_status'=>$PaymentDetails['multiple_locations_status'],
- 'follow_up_meeting_status'=>$PaymentDetails['follow_up_meeting_status'],
- 'advanced_security_level'=>$PaymentDetails['advanced_security_level'],
- 'packge_validity_upto'=>$DueDate,
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id']);
- $this->Common_model->common_update('organizations',$OrgValue,$OrgWhere); // tbl organizations
- // updating monthly packages in to organization table
- //sent mail
- $OD = $this->Manage_model->get_organization_details($PaymentDetails['organizations_id']);
- $this->SentMail('9',$OD['email']);
- //sent mail
- //sent mail payment receipt
- $CountryData = $this->Manage_model->get_organization_country_details();
- if($PaymentDetails['package_category']==0){ $PaymentDetails['package_category'] = 'Professional Package'; }
- elseif($PaymentDetails['package_category']==1){ $PaymentDetails['package_category'] = 'Business Package'; }
- elseif($PaymentDetails['package_category']==2){ $PaymentDetails['package_category'] = 'Entrepreneur Package'; }
- $data = array('Subject'=>'MEET PASS Payment Receipt','UserID'=>$OD['email'],'OrderID'=>$trackid,'Date'=>date('M d, Y',strtotime($BuyDate)),'NextDueDate'=>date('M d, Y',strtotime($DueDate)),'PackageName'=>$PaymentDetails['package_category'].' ('.$PaymentDetails['package_name'].')','PackageAmount'=>$PaymentDetails['amount'].' '.$CountryData['currency'],'BilledTo'=>$OD['name']);
- $this->SentMail('11',$OD['email'],$data);
- //sent mail payment receipt
- }
- }
- else // prepaid packages
- {
- $BuyDate = date('Y-m-d');
- $DueDate = date('Y-m-d', strtotime('+'.$PaymentDetails['days'].' days'));
- // insert into package_subscriptions_prepaid
- $SP_values = array( 'datetime'=>$datetime,
- 'organizations_id'=>$PaymentDetails['organizations_id'],
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id'],
- 'package_payments_id'=>$PaymentDetails['package_payments_id'],
- 'meetings_count'=>$PaymentDetails['meetings_count'],
- 'members_count'=>$PaymentDetails['meeting_members_count'],
- 'events_count'=>$PaymentDetails['event_count'],
- 'events_members_count'=>$PaymentDetails['event_members_count'],
- 'buy_date'=>$BuyDate,
- 'due_date'=>$DueDate);
- $package_subscriptions_prepaid_id = $this->Common_model->common_insert('package_subscriptions_prepaid',$SP_values);
- // insert into package_subscriptions_prepaid
- $PPValue['package_subscriptions_prepaid_id'] = $package_subscriptions_prepaid_id; // update subscription id to payments
- }
- $this->Common_model->Set_Message('1','Payment success.');
- $this->Common_model->common_update('package_payments',$PPValue,$PPWhere); // update package payment details
- }
- else // payment status: failled
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- else // payment status: failled
- {
- // update payments table
- $where = array('package_payments_id'=>$package_payments_id);
- $value = array( 'status'=>'2',
- 'response_url'=>json_encode($_REQUEST),
- 'response_data'=>json_encode($Result),
- 'transactionid'=>$tranid,
- 'token'=>$token);
- $this->Common_model->common_update('package_payments',$value,$where);
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- redirect('view-packages'); // if empty of parameters
- }
- ############################################ END OF VIEW PACKAGES PAYMENT STATUS ##################
- ############################################ VIEW PACKAGES ########################################
- public function view_packages()
- {
- $this->load->model('Payment_model');
- $CountryData = $this->Manage_model->get_organization_country_details();
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- // if country is qatar - open this payment page
- #Buy New Package // Tyla Technologies
- if(isset($_POST['BuyNow']))
- {
- $this->form_validation->set_rules('data_id','Data ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $subscription_packages_id = $this->input->post('data_id');
- // check organization available for this package
- $PackageAvailability = '0';
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- else
- {
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization_dedicated($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- }
- if($PackageAvailability=='1')
- {
- $datetime = date('Y-m-d H:i:s');
- $amount = round($CheckAvailability['price']*$CountryData['rates']); // in current rate
- $package_type = $CheckAvailability['package_type']; // recurring or not
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'subscription_packages_id'=>$subscription_packages_id,
- 'package_type'=>$package_type,
- 'amount'=>$amount);
- $package_payments_id = $this->Common_model->common_insert('package_payments',$values);
- // Generating Payment URL
- $RequestData = $this->Payment_model->generate_payment_url($package_payments_id,$amount,$package_type);
- // Update Request URL
- $where = array('package_payments_id'=>$package_payments_id);
- $value = array('request_parameters'=>$RequestData['request_parameters'],'request_url'=>$RequestData['request_url']);
- $this->Common_model->common_update('package_payments',$value,$where);
- redirect($RequestData['request_url']);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- #Buy New Package
- # FILTER AND PAGINATION SECTION
- $FD = array();
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_packages($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 10;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['MonthlyPackage'] = $this->Manage_model->view_monthly_packages($FD,$start,$limit,'0');
- $data['PrepaidPackage'] = array();
- $data['SpecialPackage'] = $this->Manage_model->view_dedicated_packages($FD,$start,$limit,'0');
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- if($OD['subscription_packages_id']!='0')
- {
- $data['CurrentPackage'] = $this->Manage_model->view_current_package_details($OD['subscription_packages_id']);
- //print_r($data['CurrentPackage']); die();
- }
- else
- {
- $data['CurrentPackage'] = array('subscription_packages_id'=>'0','package_category'=>'4','package_name'=>'14 Days Trial Package','price'=>'0','meetings_count'=>'10','meeting_members_count'=>'10','event_count'=>'2','event_members_count'=>'25','link_generation_status'=>'1','app_create_meeting_status'=>'1','multiple_locations_status'=>'1');
- }
- $data['CountryData'] = $CountryData;
- $data['OD'] = $OD;
- $this->CommonPage('organizations/view_packages',$data,'List of subscription packages');
- }
- ############################################ END OF VIEW PACKAGES #################################
- ############################################ STRIPE PAYMENT CARD DETAILS PAGE #####################
- public function subscription_payment()
- {
- $CountryData = $this->Manage_model->get_organization_country_details();
- if(isset($_POST['BuyNow']))
- {
- $this->form_validation->set_rules('data_id','Data ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $subscription_packages_id = $this->input->post('data_id');
- // check organization available for this package
- $PackageAvailability = '0';
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- else
- {
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization_dedicated($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- }
- if($PackageAvailability=='1')
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $data['OD'] = $this->Manage_model->get_organization_details($organizations_id);
- $datetime = date('Y-m-d H:i:s');
- $amount = round($CheckAvailability['price']*$CountryData['rates']); // in current rate
- $package_type = $CheckAvailability['package_type']; // recurring or not
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'subscription_packages_id'=>$subscription_packages_id,
- 'package_type'=>$package_type,
- 'amount'=>$amount,
- 'payment_gateway'=>'1',
- 'currency'=>$CountryData['currency']);
- $package_payments_id = $this->Common_model->common_insert('package_payments',$values);
- $CheckAvailability['amount'] = $amount;
- $CheckAvailability['currency'] = $CountryData['currency'];
- $CheckAvailability['package_payments_id'] = $package_payments_id;
- $data['PD'] = $CheckAvailability;
- $this->load->view('organizations/stripe_payment', $data);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- ############################################ END OF STRIPE PAYMENT CARD DETAILS PAGE ##############
- ############################################ STRIPE PAYMENT SUBMIT ################################
- public function subscription_payment_submit()
- {
- //include Stripe PHP library
- require_once APPPATH."third_party/stripe/init.php";
- $data['value']=$this->input->post('plan_val');
- if(!empty($_POST['stripeToken']))
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- //get token, card and user info from the form
- $name = trim($OD['name']);
- $email = trim($OD['email']);
- $token = trim($_POST['stripeToken']);
- $planname = trim($_POST['plan_name_fr']);
- $planval = trim($_POST['plan_val_fr']);
- $package_payments_id = trim($_POST['package_payments_id']);
- // Update Request URL
- $where = array('package_payments_id'=>$package_payments_id);
- $value = array('stripe_temp_token'=>$token);
- $this->Common_model->common_update('package_payments',$value,$where);
- //set api key
- $stripe = array("secret_key"=>$this->config->item('StripeSecretKey'),"publishable_key"=>$this->config->item('StripePublicKey'));
- \Stripe\Stripe::setApiKey($stripe['secret_key']);
- //add customer to stripe
- $customer = \Stripe\Customer::create(array('email'=>$email,'source'=>$token));
- //item information
- $currency = $_POST['currency'];
- $plan = $_POST['plan_name_fr'];
- $amount1 = $_POST['plan_val_fr'];
- $amount =(int)$amount1*100;
- $plan = \Stripe\Plan::create(array("product"=>["name"=>$plan],
- "amount"=>$amount,
- "currency"=>$currency,
- "interval"=>"month",
- "interval_count"=>'1'));
- // Add the plan to the customer (subscribe the customer)
- $subscription = \Stripe\Subscription::create(array("customer"=>$customer->id,"items"=>array(array("plan"=>$plan->id))));
- //retrieve charge details
- $chargeJson = $subscription->jsonSerialize();
- $created_date = date('d-m-Y', $subscription->created);
- $current_period_start_date = date('d-m-Y', $subscription->current_period_start);
- $current_period_end_date = date('d-m-Y', $subscription->current_period_end);
- if($subscription->status=='active')
- {
- $PaymentDetails = $this->Manage_model->get_payment_details($package_payments_id);
- if(!empty($PaymentDetails))
- {
- $datetime = date('Y-m-d H:i:s');
- // update payments table
- $PPWhere = array('package_payments_id'=>$package_payments_id);
- $PPValue = array('status'=>'1','response_data'=>json_encode($subscription));
- // update payments table
- if($PaymentDetails['package_type']=='0') // monthly package
- {
- $BuyDate = date('Y-m-d');
- $DueDate = date('Y-m-d', strtotime('+1 month'));
- $PreviousDate = date('Y-m-d', strtotime('-1 days'));
- $CheckSubscriptionExist = $this->Manage_model->check_payment_subscription_exist($PaymentDetails['package_payments_id'],$PaymentDetails['subscription_packages_id']);
- if(empty($CheckSubscriptionExist))
- {
- // cancel previous subscriptions
- if($CheckSubscriptionExist['due_date']<$BuyDate)
- {
- $Cancel_SP_value = array('status'=>'1');
- }
- else
- {
- $Cancel_SP_value = array('status'=>'2');
- }
- $Cancel_SP_where = array('status'=>'0','organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('package_subscriptions',$Cancel_SP_value,$Cancel_SP_where); // tbl package_subscriptions
- $Cancel_ORG_value = array('meetings_count'=>'0','members_count'=>'0','events_count'=>'0','events_members_count'=>'0','dedicated_link_availability'=>'0','app_create_meeting_status'=>'0','multiple_locations_status'=>'0','follow_up_meeting_status'=>'0','advanced_security_level'=>'0','packge_validity_upto'=>$PreviousDate);
- $Cancel_ORG_where = array('organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('organizations',$Cancel_ORG_value,$Cancel_ORG_where); // tbl organizations
- // cancel previous subscriptions
- // insert into package subscriptions
- $SP_values = array( 'datetime'=>$datetime,
- 'organizations_id'=>$PaymentDetails['organizations_id'],
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id'],
- 'package_payments_id'=>$PaymentDetails['package_payments_id'],
- 'buy_date'=>$BuyDate,
- 'due_date'=>$DueDate,
- 'status'=>'0',
- 'recurring_status'=>'0',
- 'payment_gateway'=>'1',
- 'stripe_temp_token'=>$token,
- 'currency'=>$subscription->items->data[0]->price->currency,
- 'subscription_id'=>$subscription->id,
- 'subscription_customer_id'=>$subscription->customer,
- 'subscription_item_id'=>$subscription->items->data[0]->id);
- $package_subscriptions_id = $this->Common_model->common_insert('package_subscriptions',$SP_values);
- // insert into package subscriptions
- $PPValue['package_subscriptions_id'] = $package_subscriptions_id; // update subscription id to payments
- // updating monthly packages in to organization table
- $OrgWhere = array( 'organizations_id'=>$PaymentDetails['organizations_id']);
- $OrgValue = array( 'meetings_count'=>$PaymentDetails['meetings_count'],
- 'members_count'=>$PaymentDetails['meeting_members_count'],
- 'events_count'=>$PaymentDetails['event_count'],
- 'events_members_count'=>$PaymentDetails['event_members_count'],
- 'dedicated_link_availability'=>$PaymentDetails['link_generation_status'],
- 'app_create_meeting_status'=>$PaymentDetails['app_create_meeting_status'],
- 'multiple_locations_status'=>$PaymentDetails['multiple_locations_status'],
- 'follow_up_meeting_status'=>$PaymentDetails['follow_up_meeting_status'],
- 'advanced_security_level'=>$PaymentDetails['advanced_security_level'],
- 'packge_validity_upto'=>$DueDate,
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id']);
- $this->Common_model->common_update('organizations',$OrgValue,$OrgWhere); // tbl organizations
- // updating monthly packages in to organization table
- //sent mail
- $OD = $this->Manage_model->get_organization_details($PaymentDetails['organizations_id']);
- $this->SentMail('9',$OD['email']);
- //sent mail
- //sent mail payment receipt
- $CountryData = $this->Manage_model->get_organization_country_details();
- $trackid = 'MPY'.sprintf("%05d", $PaymentDetails['package_payments_id']);
- if($PaymentDetails['package_category']==0){ $PaymentDetails['package_category'] = 'Professional Package'; }
- elseif($PaymentDetails['package_category']==1){ $PaymentDetails['package_category'] = 'Business Package'; }
- elseif($PaymentDetails['package_category']==2){ $PaymentDetails['package_category'] = 'Entrepreneur Package'; }
- $data = array('Subject'=>'MEET PASS Payment Receipt','UserID'=>$OD['email'],'OrderID'=>$trackid,'Date'=>date('M d, Y',strtotime($BuyDate)),'NextDueDate'=>date('M d, Y',strtotime($DueDate)),'PackageName'=>$PaymentDetails['package_category'].' ('.$PaymentDetails['package_name'].')','PackageAmount'=>$PaymentDetails['amount'].' '.$CountryData['currency'],'BilledTo'=>$OD['name']);
- $this->SentMail('11',$OD['email'],$data);
- //sent mail payment receipt
- }
- }
- $this->Common_model->Set_Message('1','Payment success.');
- $this->Common_model->common_update('package_payments',$PPValue,$PPWhere); // update package payment details
- }
- else // payment status: failled
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- else // payment status: failled
- {
- // update payments table
- $where = array('package_payments_id'=>$package_payments_id);
- $value = array( 'status'=>'2','response_data'=>json_encode($subscription));
- $this->Common_model->common_update('package_payments',$value,$where);
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- redirect('view-packages');
- }
- ############################################ END OF STRIPE PAYMENT SUBMIT #########################
- ############################################ VIEW ADDRESS #########################################
- public function get_address_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $data_id = $this->input->post('data_id');
- $select = array('organizations_address_id,location,latitude,longitude,building_name,building_number,floor_number,office_number,near_landmark');
- $where = array('organizations_address_id'=>$data_id);
- $Result = $this->Common_model->globalfetch('organizations_address',$select,$where);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function view_address()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('location','Location','trim|required|xss_clean');
- $this->form_validation->set_rules('latitude','Latitude','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('longitude','Longitude','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('building_name','Building Name','trim|required|xss_clean');
- $this->form_validation->set_rules('building_number','Building Number','trim|required|xss_clean');
- $this->form_validation->set_rules('floor_number','Floor Number','trim|required|xss_clean');
- $this->form_validation->set_rules('office_number','Office Number','trim|required|xss_clean');
- $this->form_validation->set_rules('near_landmark','Near Landmark','trim|required|xss_clean');
- if($this->input->post('submit')=='Save')
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|xss_clean');
- }
- else
- {
- $this->form_validation->set_rules('organizations_address_id','Organizations Address ID','trim|xss_clean|numeric|required');
- }
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $location = $this->input->post('location');
- $latitude = $this->input->post('latitude');
- $longitude = $this->input->post('longitude');
- $building_name = $this->input->post('building_name');
- $building_number = $this->input->post('building_number');
- $floor_number = $this->input->post('floor_number');
- $office_number = $this->input->post('office_number');
- $near_landmark = $this->input->post('near_landmark');
- $organizations_address_id = $this->input->post('organizations_address_id');
- $submit = $this->input->post('submit');
- $values = array('organizations_id'=>$organizations_id,
- 'location'=>$location,
- 'latitude'=>$latitude,
- 'longitude'=>$longitude,
- 'building_name'=>$building_name,
- 'building_number'=>$building_number,
- 'floor_number'=>$floor_number,
- 'office_number'=>$office_number,
- 'near_landmark'=>$near_landmark);
- if($submit=='Save')
- {
- $values['datetime'] = date('Y-m-d H:i:s');
- $organizations_address_id = $this->Common_model->common_insert('organizations_address',$values);
- $this->Common_model->Set_Message('1',"Address added successfully.");
- // Activity Log Record
- $head = 'Add Address';
- $description = 'Address Details Has Been Added By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_address_id'=>$organizations_address_id),'5');
- // Activity Log Record
- }
- else
- {
- $where = array('organizations_address_id'=>$organizations_address_id);
- $this->Common_model->common_update('organizations_address',$values,$where);
- $this->Common_model->Set_Message('1',"Address details updated successfully.");
- // Activity Log Record
- $head = 'Update Address';
- $description = 'Address Details Has Been Updated By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_address_id'=>$organizations_address_id),'5');
- // Activity Log Record
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $delete_id = $this->input->post('delete_id');
- $where = array('organizations_address_id'=>$delete_id);
- $value = array('organizations_address_status'=>'1');
- $this->Common_model->common_update('organizations_address',$value,$where);
- $this->Common_model->Set_Message('1','address removed successfully.');
- // Activity Log Record
- $head = 'Remove Address';
- $description = 'Address Details Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('organizations_address_id'=>$delete_id),'5');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $FD = array();;
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_address($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['AD'] = $this->Manage_model->view_address($FD,$start,$limit,'0');
- $this->CommonPage('organizations/view_address',$data,'List of address');
- }
- ############################################ END OF VIEW ADDRESS ##################################
- ############################################ STRIPE CHECKOUT ######################################
- public function stripe_payment_page()
- {
- $CountryData = $this->Manage_model->get_organization_country_details();
- if(isset($_POST['BuyNow']))
- {
- $this->form_validation->set_rules('data_id','Data ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $subscription_packages_id = $this->input->post('data_id');
- // check organization available for this package
- $PackageAvailability = '0';
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- else
- {
- $CheckAvailability = $this->Manage_model->check_package_available_for_organization_dedicated($subscription_packages_id);
- if(!empty($CheckAvailability))
- {
- $PackageAvailability = '1';
- }
- }
- if($PackageAvailability=='1')
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $data['OD'] = $this->Manage_model->get_organization_details($organizations_id);
- $datetime = date('Y-m-d H:i:s');
- $amount = round($CheckAvailability['price']*$CountryData['rates']); // in current rate
- $package_type = $CheckAvailability['package_type']; // recurring or not
- $values = array('datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'subscription_packages_id'=>$subscription_packages_id,
- 'package_type'=>$package_type,
- 'amount'=>$amount,
- 'payment_gateway'=>'1',
- 'currency'=>$CountryData['currency']);
- $package_payments_id = $this->Common_model->common_insert('package_payments',$values);
- $CheckAvailability['amount'] = $amount;
- $CheckAvailability['currency'] = $CountryData['currency'];
- $CheckAvailability['package_payments_id'] = $package_payments_id;
- $data['PD'] = $CheckAvailability;
- $data['package_payments_id'] = $package_payments_id;
- $this->load->view('organizations/stripe_payment_page', $data);
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect('view-packages');
- }
- }
- ############################################ END OF STRIPE CHECKOUT ###############################
- ############################################ STRIPE CHECKOUT AJAX #################################
- public function stripe_payment_page_ajax()
- {
- $response = array('status' => 0,'error' => array('message' => 'error'));
- if(isset($_POST['subscription_packages_id']))
- {
- $this->form_validation->set_rules('subscription_packages_id','subscription_packages_id','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('package_payments_id','package_payments_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $subscription_packages_id = $this->input->post('subscription_packages_id');
- $package_payments_id = $this->input->post('package_payments_id');
- $SD = $this->Manage_model->view_current_package_details_new($subscription_packages_id);
- if(!empty($SD) && $SD['stripe_subscription_id']!='')
- {
- require_once APPPATH."third_party/stripe-php/init.php";
- \Stripe\Stripe::setApiKey($this->config->item('StripeSecretKey'));
- $stripeAmount = round(10*100, 2);
- // Create new Checkout Session for the order
- try {
- $checkout_session = \Stripe\Checkout\Session::create([
- 'success_url' => base_url('Paymentsuccess/?session_id={CHECKOUT_SESSION_ID}'),
- 'cancel_url' => base_url('Paymentsuccess'),
- 'mode' => 'subscription',
- 'payment_method_types' => ['card'],
- 'mode' => 'subscription',
- 'line_items' => [[
- 'price' => $SD['stripe_subscription_id'],
- // For metered billing, do not pass quantity
- 'quantity' => 1,
- ]],
- ]);
- }
- catch(Exception $e)
- {
- $api_error = $e->getMessage();
- }
- if(empty($api_error) && $checkout_session)
- {
- $response = array('status' => 1,'message' => 'Checkout Session created successfully!','sessionId' => $checkout_session->id);
- // Update Request URL
- $where = array('package_payments_id'=>$package_payments_id,'subscription_packages_id'=>$subscription_packages_id);
- $value = array('stripe_session_id'=>$checkout_session->id);
- $this->Common_model->common_update('package_payments',$value,$where);
- }
- else
- {
- $response = array('status' => 0,'error' => array('message' => 'Checkout Session creation failed! '.$api_error));
- }
- }
- }
- }
- // Return response
- echo json_encode($response);
- }
- ############################################ END OF STRIPE CHECKOUT AJAX ##########################
- ############################################ STRIPE CHECKOUT CALLBACK #############################
- public function Paymentsuccess()
- {
- if(isset($_GET['session_id']) &&!empty($_GET['session_id']) && $_GET['session_id']!='')
- {
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- require_once APPPATH."third_party/stripe-php/init.php";
- $stripe = new \Stripe\StripeClient($this->config->item('StripeSecretKey'));
- $SessionID = trim($_GET['session_id']);
- $ResultData = $stripe->checkout->sessions->retrieve($SessionID,[]);
- /*cs_test_a1BCgCQfT5WJXaUL1wT7Ccsq07lcMSByOT500HYvaCi49Wqe8DEsf7NrPJ
- cs_test_a1BCgCQfT5WJXaUL1wT7Ccsq07lcMSByOT500HYvaCi49Wqe8DEsf7NrPJ*/
- //get token, card and user info from the form
- //set api key
- //retrieve charge details
- $chargeJson = $ResultData->jsonSerialize();
- // echo '<pre>';
- // print_r($chargeJson);
- // echo $ResultData->status;
- // echo $ResultData->payment_status;
- // echo $ResultData->subscription;
- // die;
- // $created_date = date('d-m-Y', $ResultData->created);
- // $current_period_start_date = date('d-m-Y', $ResultData->current_period_start);
- // $current_period_end_date = date('d-m-Y', $ResultData->current_period_end);
- $PaymentDetails = $this->Manage_model->get_payment_details_stripe_session($SessionID);
- if(!empty($PaymentDetails))
- {
- if($ResultData->status=='complete' && $ResultData->payment_status=='paid')
- {
- $datetime = date('Y-m-d H:i:s');
- $package_payments_id = $PaymentDetails['package_payments_id'];
- // update payments table
- $PPWhere = array('package_payments_id'=>$package_payments_id);
- $PPValue = array('status'=>'1','response_data'=>json_encode($ResultData));
- // update payments table
- if($PaymentDetails['package_type']=='0') // monthly package
- {
- $BuyDate = date('Y-m-d');
- $DueDate = date('Y-m-d', strtotime('+1 month'));
- $PreviousDate = date('Y-m-d', strtotime('-1 days'));
- $CheckSubscriptionExist = $this->Manage_model->check_payment_subscription_exist($PaymentDetails['package_payments_id'],$PaymentDetails['subscription_packages_id']);
- if(empty($CheckSubscriptionExist))
- {
- // cancel previous subscriptions
- if($CheckSubscriptionExist['due_date']<$BuyDate)
- {
- $Cancel_SP_value = array('status'=>'1');
- }
- else
- {
- $Cancel_SP_value = array('status'=>'2');
- }
- $Cancel_SP_where = array('status'=>'0','organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('package_subscriptions',$Cancel_SP_value,$Cancel_SP_where); // tbl package_subscriptions
- $Cancel_ORG_value = array('meetings_count'=>'0','members_count'=>'0','events_count'=>'0','events_members_count'=>'0','dedicated_link_availability'=>'0','app_create_meeting_status'=>'0','multiple_locations_status'=>'0','follow_up_meeting_status'=>'0','advanced_security_level'=>'0','packge_validity_upto'=>$PreviousDate);
- $Cancel_ORG_where = array('organizations_id'=>$PaymentDetails['organizations_id']);
- $this->Common_model->common_update('organizations',$Cancel_ORG_value,$Cancel_ORG_where); // tbl organizations
- // cancel previous subscriptions
- // insert into package subscriptions
- $SP_values = array( 'datetime'=>$datetime,
- 'organizations_id'=>$PaymentDetails['organizations_id'],
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id'],
- 'package_payments_id'=>$PaymentDetails['package_payments_id'],
- 'buy_date'=>$BuyDate,
- 'due_date'=>$DueDate,
- 'status'=>'0',
- 'recurring_status'=>'0',
- 'payment_gateway'=>'1',
- 'stripe_temp_token'=>$SessionID,
- 'currency'=>$ResultData->currency,
- 'subscription_id'=>$ResultData->subscription,
- 'subscription_customer_id'=>$ResultData->customer,
- 'subscription_item_id'=>'');
- $package_subscriptions_id = $this->Common_model->common_insert('package_subscriptions',$SP_values);
- // insert into package subscriptions
- $PPValue['package_subscriptions_id'] = $package_subscriptions_id; // update subscription id to payments
- // updating monthly packages in to organization table
- $OrgWhere = array( 'organizations_id'=>$PaymentDetails['organizations_id']);
- $OrgValue = array( 'meetings_count'=>$PaymentDetails['meetings_count'],
- 'members_count'=>$PaymentDetails['meeting_members_count'],
- 'events_count'=>$PaymentDetails['event_count'],
- 'events_members_count'=>$PaymentDetails['event_members_count'],
- 'dedicated_link_availability'=>$PaymentDetails['link_generation_status'],
- 'app_create_meeting_status'=>$PaymentDetails['app_create_meeting_status'],
- 'multiple_locations_status'=>$PaymentDetails['multiple_locations_status'],
- 'follow_up_meeting_status'=>$PaymentDetails['follow_up_meeting_status'],
- 'advanced_security_level'=>$PaymentDetails['advanced_security_level'],
- 'packge_validity_upto'=>$DueDate,
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id']);
- $this->Common_model->common_update('organizations',$OrgValue,$OrgWhere); // tbl organizations
- // updating monthly packages in to organization table
- //sent mail
- $OD = $this->Manage_model->get_organization_details($PaymentDetails['organizations_id']);
- $this->SentMail('9',$OD['email']);
- //sent mail
- //sent mail payment receipt
- $CountryData = $this->Manage_model->get_organization_country_details();
- $trackid = 'MPY'.sprintf("%05d", $PaymentDetails['package_payments_id']);
- if($PaymentDetails['package_category']==0){ $PaymentDetails['package_category'] = 'Professional Package'; }
- elseif($PaymentDetails['package_category']==1){ $PaymentDetails['package_category'] = 'Business Package'; }
- elseif($PaymentDetails['package_category']==2){ $PaymentDetails['package_category'] = 'Entrepreneur Package'; }
- $data = array('Subject'=>'MEET PASS Payment Receipt','UserID'=>$OD['email'],'OrderID'=>$trackid,'Date'=>date('M d, Y',strtotime($BuyDate)),'NextDueDate'=>date('M d, Y',strtotime($DueDate)),'PackageName'=>$PaymentDetails['package_category'].' ('.$PaymentDetails['package_name'].')','PackageAmount'=>$PaymentDetails['amount'].' '.$CountryData['currency'],'BilledTo'=>$OD['name']);
- $this->SentMail('11',$OD['email'],$data);
- //sent mail payment receipt
- }
- }
- $this->Common_model->Set_Message('1','Payment success.');
- $this->Common_model->common_update('package_payments',$PPValue,$PPWhere); // update package payment details
- }
- else // payment status: failled
- {
- $package_payments_id = $PaymentDetails['package_payments_id'];
- // update payments table
- $where = array('package_payments_id'=>$package_payments_id);
- $value = array( 'status'=>'2','response_data'=>json_encode($ResultData));
- $this->Common_model->common_update('package_payments',$value,$where);
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- else // payment status: failled
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Payment failled.');
- }
- }
- redirect('view-packages');
- }
- ############################################ END OF STRIPE CHECKOUT CALLBACK ######################
- /*public function stripe_subscription_creation()
- {
- #*********stripe
- require_once APPPATH."third_party/stripe-php/init.php";
- // Set your secret key. Remember to switch to your live secret key in production.
- // See your keys here: https://dashboard.stripe.com/apikeys
- $stripe = new \Stripe\StripeClient($this->config->item('StripeSecretKey'));
- $price = '1';
- $pr = $stripe->products->create([
- 'name' => '$package_name',
- ]);
- $sub = $stripe->prices->create([
- 'unit_amount' => $price*100,
- 'currency' => 'usd',
- 'recurring' => ['interval' => 'month','interval_count'=>'1'],
- 'product' => $pr->id,
- ]);
- #****Stripe object
- echo '<pre>';
- print_r($sub);
- echo $sub->id;
- }*/
- /*public function checkout_session_retrieve()
- {
- require_once APPPATH."third_party/stripe-php/init.php";
- $stripe = new \Stripe\StripeClient($this->config->item('StripeSecretKey'));
- $dt = $stripe->checkout->sessions->retrieve('cs_test_a1IoVmKcDfSNASX9j2ZiZEOEpWmxPW7bWizYlCMFBv2FOmWeUgdO9cVFcO',[]);
- echo '<pre>';
- print_r($dt);
- }*/
- ############################################ ASSIGN FREE SUBSCRIPTION PACKAGES ####################
- public function assign_free_subscription_packages($organizations_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['AssignPackage']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('organizations_id','organizations','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('subscription_packages_id','subscription package','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $organizations_id = $this->input->post('organizations_id');
- $subscription_packages_id = $this->input->post('subscription_packages_id');
- $PaymentDetails = $this->Manage_model->get_free_payment_package_details($subscription_packages_id);
- if(!empty($PaymentDetails))
- {
- $datetime = date('Y-m-d H:i:s');
- $BuyDate = date('Y-m-d');
- $DueDate = date('Y-m-d', strtotime('+1 month'));
- $PreviousDate = date('Y-m-d', strtotime('-1 days'));
- // cancel previous subscriptions
- $Cancel_SP_value = array('status'=>'2');
- $Cancel_SP_where = array('status'=>'0','organizations_id'=>$organizations_id);
- $this->Common_model->common_update('package_subscriptions',$Cancel_SP_value,$Cancel_SP_where); // tbl package_subscriptions
- $Cancel_ORG_value = array('meetings_count'=>'0','members_count'=>'0','events_count'=>'0','events_members_count'=>'0','dedicated_link_availability'=>'0','app_create_meeting_status'=>'0','multiple_locations_status'=>'0','follow_up_meeting_status'=>'0','advanced_security_level'=>'0','packge_validity_upto'=>$PreviousDate);
- $Cancel_ORG_where = array('organizations_id'=>$organizations_id);
- $this->Common_model->common_update('organizations',$Cancel_ORG_value,$Cancel_ORG_where); // tbl organizations
- // cancel previous subscriptions
- // insert into package subscriptions
- $SP_values = array( 'datetime'=>$datetime,
- 'organizations_id'=>$organizations_id,
- 'subscription_packages_id'=>$subscription_packages_id,
- 'package_payments_id'=>'0', // paid from admin
- 'buy_date'=>$BuyDate,
- 'due_date'=>$DueDate,
- 'status'=>'0',
- 'recurring_status'=>'0',
- 'payment_gateway'=>'-1',
- 'stripe_temp_token'=>'',
- 'currency'=>'',
- 'subscription_id'=>'',
- 'subscription_customer_id'=>'',
- 'subscription_item_id'=>'');
- $package_subscriptions_id = $this->Common_model->common_insert('package_subscriptions',$SP_values);
- // insert into package subscriptions
- // updating monthly packages in to organization table
- $OrgWhere = array( 'organizations_id'=>$organizations_id);
- $OrgValue = array( 'meetings_count'=>$PaymentDetails['meetings_count'],
- 'members_count'=>$PaymentDetails['meeting_members_count'],
- 'events_count'=>$PaymentDetails['event_count'],
- 'events_members_count'=>$PaymentDetails['event_members_count'],
- 'dedicated_link_availability'=>$PaymentDetails['link_generation_status'],
- 'app_create_meeting_status'=>$PaymentDetails['app_create_meeting_status'],
- 'multiple_locations_status'=>$PaymentDetails['multiple_locations_status'],
- 'follow_up_meeting_status'=>$PaymentDetails['follow_up_meeting_status'],
- 'advanced_security_level'=>$PaymentDetails['advanced_security_level'],
- 'packge_validity_upto'=>$DueDate,
- 'subscription_packages_id'=>$PaymentDetails['subscription_packages_id']);
- $this->Common_model->common_update('organizations',$OrgValue,$OrgWhere); // tbl organizations
- // updating monthly packages in to organization table
- //sent mail
- $OD = $this->Manage_model->get_organization_details($organizations_id);
- $this->SentMail('9',$OD['email']);
- //sent mail
- $this->Common_model->Set_Message('1','<strong>Success!</strong> Free package added successfully.');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect('organizations-details/'.$organizations_id.'/free-packages');
- }
- ############################################ END OF ASSIGN FREE SUBSCRIPTION PACKAGES #############
- public function manage_blogs()
- {
- # INSERT / UPDATE FUNCTION
- //print_r($_POST); die();
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('title','title','trim|required|xss_clean');
- $this->form_validation->set_rules('description','section_1','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $country_id = 1;
- $title = $this->input->post('title');
- $description = $this->input->post('description');
- $blogs_status = $this->input->post('blogs_status');
- $blog_category = $this->input->post('blog_category');
- $date = date("Y-m-d");
- $blog_id = $this->input->post('blog_id');
- $language = $this->input->post('language');
- $header_script = $this->input->post('header_script');
- $meta_title = $this->input->post('meta_title');
- $meta_keywords = $this->input->post('meta_keyword');
- $submit = $this->input->post('submit');
- $blogs_id = $this->input->post('blog_id');
- $slug = $this->input->post('slug');
- if(empty($slug)){
- $slug = $this->slugify($title);
- }
- $values = array('date'=>date('Y-m-d'),
- 'blogs_status'=>$blogs_status,
- 'blog_category'=>$blog_category,
- 'description'=>$description,
- 'language'=>$language,
- 'title'=>$title,
- 'slug'=>$slug,
- 'header_script'=>$header_script,
- 'meta_title'=>$meta_title,
- 'meta_keyword'=>$meta_keywords);
- $CountryData = $this->Manage_model->get_country_details_row($country_id);
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/blogs/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- }
- //echo "<pre>";print_r($_POST); print_r($values); die();
- if($submit=='Save')
- {
- $blog_id = $this->Common_model->common_insert('blogs',$values);
- $this->Common_model->Set_Message('1',"<strong>Blog details added successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('blogs_id'=>$blogs_id);
- $this->Common_model->common_update('blogs',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>Blog Updated successfully.");
- }
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('category_id'=>$delete_id);
- $value = array('is_deleted'=>'1');
- $this->Common_model->common_update('category',$value,$where);
- $this->Common_model->Set_Message('1','Category Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_blogs_admin($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['BLOGCAT'] = $this->Manage_model->get_category_List('1');
- $data['OD'] = $this->Manage_model->view_blogs_admin($FD,$start,$limit,'0');
- $this->CommonPage('blogs/view_blogs',$data,'View blogs');
- }
- ############################################ END OF blogs ###############################
- ############################################ END OF ASSIGN FREE SUBSCRIPTION PACKAGES #############
- public function product_pages()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- // $this->form_validation->set_rules('country_id','Country','trim|required|xss_clean|numeric');
- $this->form_validation->set_rules('title','title','trim|required|xss_clean');
- $this->form_validation->set_rules('section_1','section_1','trim|required|xss_clean');
- if($this->form_validation->run())
- { $country_id = 1;
- //$page_type = $this->input->post('page_type');
- $page_type = "product";
- $title = $this->input->post('title');
- $product_category = $this->input->post('product_category');
- $language = $this->input->post('language');
- $pstatus = $this->input->post('pstatus');
- $description = $this->input->post('description');
- $page_id = $this->input->post('page_id');
- $section_1 = $this->input->post('section_1');
- $link_1 = $this->input->post('link_1');
- $alt_1 = $this->input->post('alt_1');
- $SMHEADING_1 = $this->input->post('SMHEADING_1');
- $MAINHEADING_1 = $this->input->post('MAINHEADING_1');
- $section_2 = $this->input->post('section_2');
- $link_2 = $this->input->post('link_2');
- $alt_2 = $this->input->post('alt_2');
- $SMHEADING_2 = $this->input->post('SMHEADING_2');
- $MAINHEADING_2 = $this->input->post('MAINHEADING_2');
- $section_3 = $this->input->post('section_3');
- $link_3 = $this->input->post('link_3');
- $alt_3 = $this->input->post('alt_3');
- $SMHEADING_3 = $this->input->post('SMHEADING_3');
- $MAINHEADING_3 = $this->input->post('MAINHEADING_3');
- $section_4 = $this->input->post('section_4');
- $link_4 = $this->input->post('link_4');
- $alt_4 = $this->input->post('alt_4');
- $SMHEADING_4 = $this->input->post('SMHEADING_4');
- $MAINHEADING_4 = $this->input->post('MAINHEADING_4');
- $section_5 = $this->input->post('section_5');
- $link_5 = $this->input->post('link_5');
- $alt_5 = $this->input->post('alt_5');
- $SMHEADING_5 = $this->input->post('SMHEADING_5');
- $MAINHEADING_5 = $this->input->post('MAINHEADING_5');
- $section_6 = $this->input->post('section_6');
- $link_6 = $this->input->post('link_6');
- $alt_6 = $this->input->post('alt_6');
- $SMHEADING_6 = $this->input->post('SMHEADING_6');
- $MAINHEADING_6 = $this->input->post('MAINHEADING_6');
- $section_7 = $this->input->post('section_7');
- $link_7 = $this->input->post('link_7');
- $alt_7 = $this->input->post('alt_7');
- $SMHEADING_7 = $this->input->post('SMHEADING_7');
- $MAINHEADING_7 = $this->input->post('MAINHEADING_7');
- $section_8 = $this->input->post('section_8');
- $link_8 = $this->input->post('link_8');
- $alt_8 = $this->input->post('alt_8');
- $SMHEADING_8 = $this->input->post('SMHEADING_8');
- $MAINHEADING_8 = $this->input->post('MAINHEADING_8');
- $section_9 = $this->input->post('section_9');
- $link_9 = $this->input->post('link_9');
- $alt_9 = $this->input->post('alt_9');
- $meta_title = $_POST['meta_title'];
- $video_link = $this->input->post('video_link');
- $meta_keyword = $_POST['meta_keyword'];
- $header_script = $_POST['header_script'];
- $Icon_SMHEADING_1 = $this->input->post('Icon_SMHEADING_1');
- $Icon_SMHEADING_2 = $this->input->post('Icon_SMHEADING_2');
- $Icon_SMHEADING_3 = $this->input->post('Icon_SMHEADING_3');
- $Icon_SMHEADING_4 = $this->input->post('Icon_SMHEADING_4');
- $Icon_SMHEADING_5 = $this->input->post('Icon_SMHEADING_5');
- $Icon_SMHEADING_6 = $this->input->post('Icon_SMHEADING_6');
- $icon_link_1 = $this->input->post('icon_link_1');
- $icon_link_2 = $this->input->post('icon_link_2');
- $icon_link_3 = $this->input->post('icon_link_3');
- $icon_link_4 = $this->input->post('icon_link_4');
- $icon_link_5 = $this->input->post('icon_link_5');
- $icon_link_6 = $this->input->post('icon_link_6');
- $submit = $this->input->post('submit');
- $slug = $this->input->post('slug');
- if(empty($slug)){
- $slug = $this->slugify($title);
- }
- //$values=array();
- $values = array('title'=>$title,
- 'description'=>$description,
- 'product_category'=>$product_category,
- 'country_id'=>$country_id,
- 'section_1'=>$section_1,
- 'link_1'=>$link_1,
- 'section_2'=>$section_2,
- 'link_2'=>$link_2,
- 'section_3'=>$section_3,
- 'link_3'=>$link_3,
- 'section_4'=>$section_4,
- 'link_4'=>$link_4,
- 'section_5'=>$section_5,
- 'link_5'=>$link_5,
- 'section_6'=>$section_6,
- 'link_6'=>$link_6,
- 'section_7'=>$section_7,
- 'link_7'=>$link_7,
- 'section_8'=>$section_8,
- 'link_8'=>$link_8,
- 'section_9'=>$section_9,
- 'link_9'=>$link_9,
- 'meta_title'=>$meta_title,
- 'SMHEADING_1'=>$SMHEADING_1,
- 'SMHEADING_2'=>$SMHEADING_2,
- 'SMHEADING_3'=>$SMHEADING_3,
- 'SMHEADING_4'=>$SMHEADING_4,
- 'SMHEADING_5'=>$SMHEADING_5,
- 'SMHEADING_6'=>$SMHEADING_6,
- 'SMHEADING_7'=>$SMHEADING_7,
- 'SMHEADING_8'=>$SMHEADING_8,
- 'MAINHEADING_1'=>$MAINHEADING_1,
- 'MAINHEADING_2'=>$MAINHEADING_2,
- 'MAINHEADING_3'=>$MAINHEADING_3,
- 'MAINHEADING_4'=>$MAINHEADING_4,
- 'MAINHEADING_5'=>$MAINHEADING_5,
- 'MAINHEADING_6'=>$MAINHEADING_6,
- 'MAINHEADING_7'=>$MAINHEADING_7,
- 'MAINHEADING_8'=>$MAINHEADING_8,
- 'Icon_SMHEADING_1'=>$Icon_SMHEADING_1,
- 'Icon_SMHEADING_2'=>$Icon_SMHEADING_2,
- 'Icon_SMHEADING_3'=>$Icon_SMHEADING_3,
- 'Icon_SMHEADING_4'=>$Icon_SMHEADING_4,
- 'Icon_SMHEADING_5'=>$Icon_SMHEADING_5,
- 'Icon_SMHEADING_6'=>$Icon_SMHEADING_6,
- 'icon_link_1'=>$icon_link_1,
- 'icon_link_2'=>$icon_link_2,
- 'icon_link_3'=>$icon_link_3,
- 'icon_link_4'=>$icon_link_4,
- 'icon_link_5'=>$icon_link_5,
- 'icon_link_6'=>$icon_link_6,
- 'video_link'=>$video_link,
- 'meta_title'=>$meta_title,
- 'meta_keywords'=>$meta_keyword,
- 'header_script'=>$header_script,
- 'status'=>$pstatus, 'language'=>$language,
- 'slug'=>$slug);
- if(isset($_FILES['image']) && $_FILES['image']['name']!='')
- {
- $image_name = $this->Common_model->image_upload('./uploads/products/','image');
- if($image_name!='')
- {
- $values['image'] = $image_name;
- }
- }
- if(isset($_FILES['image_1']) && $_FILES['image_1']['name']!='')
- {
- $image_1 = $this->Common_model->image_uploadProducts('./uploads/products/','image_1');
- if($image_1!='')
- {
- $values['image_1'] = $image_1;
- }
- }if(isset($_FILES['image_2']) && $_FILES['image_2']['name']!='')
- {
- $image_2 = $this->Common_model->image_uploadProducts('./uploads/products/','image_2');
- if($image_2!='')
- {
- $values['image_2'] = $image_2;
- }
- }if(isset($_FILES['image_3']) && $_FILES['image_3']['name']!='')
- {
- $image_3 = $this->Common_model->image_uploadProducts('./uploads/products/','image_3');
- if($image_3!='')
- {
- $values['image_3'] = $image_3;
- }
- }
- if(isset($_FILES['image_4']) && $_FILES['image_4']['name']!='')
- {
- $image_4 = $this->Common_model->image_uploadProducts('./uploads/products/','image_4');
- if($image_4!='')
- {
- $values['image_4'] = $image_4;
- }
- }if(isset($_FILES['image_5']) && $_FILES['image_5']['name']!='')
- {
- $image_5 = $this->Common_model->image_uploadProducts('./uploads/products/','image_5');
- if($image_5!='')
- {
- $values['image_5'] = $image_5;
- }
- }if(isset($_FILES['image_6']) && $_FILES['image_6']['name']!='')
- {
- $image_6 = $this->Common_model->image_uploadProducts('./uploads/products/','image_6');
- if($image_6!='')
- {
- $values['image_6'] = $image_6;
- }
- }if(isset($_FILES['image_7']) && $_FILES['image_7']['name']!='')
- {
- $image_7 = $this->Common_model->image_uploadProducts('./uploads/products/','image_7');
- if($image_7!='')
- {
- $values['image_7'] = $image_7;
- }
- }if(isset($_FILES['image_8']) && $_FILES['image_8']['name']!='')
- {
- $image_8 = $this->Common_model->image_uploadProducts('./uploads/products/','image_8');
- if($image_8!='')
- {
- $values['image_8'] = $image_8;
- }
- }if(isset($_FILES['image_9']) && $_FILES['image_9']['name']!='')
- {
- $image_9 = $this->Common_model->image_uploadProducts('./uploads/products/','image_9');
- if($image_9!='')
- {
- $values['image_9'] = $image_9;
- }
- }
- if(isset($_FILES['icon_image_1']) && $_FILES['icon_image_1']['name']!='')
- {
- $icon_image_1 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_1');
- if($icon_image_1!='')
- {
- $values['icon_image_1'] = $icon_image_1;
- }
- }if(isset($_FILES['icon_image_2']) && $_FILES['icon_image_2']['name']!='')
- {
- $icon_image_2 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_2');
- if($icon_image_2!='')
- {
- $values['icon_image_2'] = $icon_image_2;
- }
- }if(isset($_FILES['icon_image_3']) && $_FILES['icon_image_3']['name']!='')
- {
- $icon_image_3 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_3');
- if($icon_image_3!='')
- {
- $values['icon_image_3'] = $icon_image_3;
- }
- }if(isset($_FILES['icon_image_4']) && $_FILES['icon_image_4']['name']!='')
- {
- $icon_image_4 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_4');
- if($icon_image_4!='')
- {
- $values['icon_image_4'] = $icon_image_4;
- }
- }if(isset($_FILES['icon_image_5']) && $_FILES['icon_image_5']['name']!='')
- {
- $icon_image_5 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_5');
- if($icon_image_5!='')
- {
- $values['icon_image_5'] = $icon_image_5;
- }
- }if(isset($_FILES['icon_image_6']) && $_FILES['icon_image_6']['name']!='')
- {
- $icon_image_6 = $this->Common_model->image_uploadProducts('./uploads/products/','icon_image_6');
- if($icon_image_6!='')
- {
- $values['icon_image_6'] = $icon_image_6;
- }
- }
- $CountryData = $this->Manage_model->get_country_details_row($country_id);
- if($submit=='Save')
- {
- // insert product api
- $subscription_packages_id = $this->Common_model->common_insert('custom_pages',$values);
- $this->Common_model->Set_Message('1',"details added successfully");
- redirect(current_url());
- }
- else
- { $where = array('id'=>$page_id);
- $this->Common_model->common_update('custom_pages',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>Blog Updated successfully.");
- $this->Common_model->Set_Message('1',"<strong>Error!</strong> Updated successfully.");
- }
- redirect(current_url());
- }
- else
- {
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $CheckingPackageUsed = $this->Manage_model->checking_package_is_used_or_not($delete_id);
- if(empty($CheckingPackageUsed))
- {
- $where = array('subscription_packages_id'=>$delete_id);
- $value = array('subscription_packages_status'=>'1');
- $this->Common_model->common_update('subscription_packages',$value,$where);
- $this->Common_model->Set_Message('1','Package Removed Successfully');
- // Activity Log Record
- $head = 'Remove Package';
- $description = 'Package Has Been Removed By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('subscription_packages_id'=>$delete_id),'8');
- // Activity Log Record
- }
- else
- {
- $this->Common_model->Set_Message('2',"<strong>Error!</strong> Consumed package cannot be removed.");
- redirect(current_url());
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_products_admin($FD,$start,$limit,'1',"product")[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['OD'] = $this->Manage_model->view_products_admin($FD,$start,$limit,'0',"product");
- $data['BLOGCAT'] = $this->Manage_model->get_category_List('2');
- $data["WebURLFrontend"]=$this->config->item('WebURLFrontend');
- $this->CommonPage('products/view_products',$data,'Products');
- }
- public function get_product_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $product_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_product_details($product_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }public function get_blog_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $blog_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_blog_data($blog_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- public function get_slug()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('title','title','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $title = $this->input->post('title');
- $Result = $this->slugify($title);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- ############################################ END OF products ###############################
- public static function slugify($text, string $divider = '-')
- {
- // replace non letter or digits by divider
- $text = preg_replace('~[^\pL\d]+~u', $divider, $text);
- // transliterate
- $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
- // remove unwanted characters
- $text = preg_replace('~[^-\w]+~', '', $text);
- // trim
- $text = trim($text, $divider);
- // remove duplicate divider
- $text = preg_replace('~-+~', $divider, $text);
- // lowercase
- $text = strtolower($text);
- if (empty($text)) {
- return 'n-a';
- }
- return $text;
- }
- ############################################ VIEW PACKAGES ########################################
- public function view_task()
- {
- $this->load->model('Payment_model');
- $CountryData = $this->Manage_model->get_organization_country_details();
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $this->CommonPage('task/view_task',$data,'task ongoing');
- }
- ############################################ END OF VIEW task #################################
- ############################################ ASSIGN Agenda DETAILS #######################
- public function add_agenda($meetings_id)
- {
- $this->load->view('include/preloader');
- if(isset($_POST['saveagenda']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- // $this->form_validation->set_rules('meetings_id','Meeting','trim|required|xss_clean');
- $this->form_validation->set_rules('agenda[]','Type','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meetings_id = $meetings_id;
- $agenda = $this->input->post('agenda[]');
- $members = $this->input->post('members[]');
- $AG_time = $this->input->post('AG_time');
- $MD = $this->Manage_model->meeting_details($meetings_id);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if(count($agenda)>0)
- {
- // if($MD['status']==1)
- // {
- // if($MD['meeting_datetime'] < $datetime)
- // {
- $values=array();
- for ($i=0; $i < count($agenda); $i++) {
- $values["agenda"][] = array(
- 'agenda'=>$agenda[$i],
- 'members'=>$members[$i],
- 'AG_time'=>$AG_time[$i]);
- $prms=array("description"=>json_encode($values));
- // sent notification
- if($MD['meeting_type']=='0')
- {
- //$Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- else
- {
- //$Content = array('title'=>'Event Invitation','description'=>'You are invited for a new event with '.$OD['name'].'. ','message'=>'You are invited to a new evevt by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your evevt access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- // $this->SentNotification('1',$members_id,$Content,$members_sub_id,$member_type);
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- //$this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- if(!empty($values))
- { $where=array("meetings_id"=>$meetings_id);
- $meetings_participants_id = $this->Common_model->common_update('meetings',$prms,$where);
- $this->Common_model->Set_Message('1',"".$i." Aganeda added successfully ss.");
- }
- // }
- // else
- // {
- // if($MD['meeting_type']==0) // meeting
- // {
- // $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired meeting details cannot be edited.");
- // }
- // else // event
- // {
- // $this->Common_model->Set_Message('2',"<strong>Error!</strong> Expired event details cannot be edited.");
- // }
- // }
- // }
- // else
- // {
- // $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- // }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- if(isset($_POST['publish']))
- {
- if(!empty($meetings_id))
- {
- $MD = $this->Manage_model->meeting_details($meetings_id);
- $members = $this->Manage_model->get_meeting_members($meetings_id);
- $OD = $this->Manage_model->get_organization_details($MD['organizations_id']);
- if(empty($MD)){ redirect('view-meetings'); }
- $datetime = date('Y-m-d H:i:s');
- if($MD['meeting_publish']==0 && !empty($MD['description']))
- {
- foreach($members as $DT){
- // sent notification
- if($MD['meeting_type']=='0')
- {
- $Content = array('title'=>'Meeting Invitation','description'=>'You are invited for a new meeting with '.$OD['name'].'. ','message'=>'You are invited to a new meeting by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your meeting access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- else
- {
- $Content = array('title'=>'Event Invitation','description'=>'You are invited for a new event with '.$OD['name'].'. ','message'=>'You are invited to a new evevt by '.strtok($OD['name'], " ").'-'.$TicketNumber.'. Download Meet Pass for your evevt access (onelink.to/meet). Meet, Mingle & Merge in Person.','meetings_id'=>$meetings_id,'TicketNumber'=>$TicketNumber,'Organization'=>$OD['name'],'MeetingTitle'=>$MD['meeting_title']);
- }
- $this->SentNotification('1',$members_id,$Content,$members_sub_id,$member_type);
- // sent notification
- // Activity Log Record
- $head = 'Assign Meeting Members';
- $description = 'Members Has Been Assigned By ';
- $this->Common_model->create_activity_log($head,$description,'',array(),array('meetings_id'=>$meetings_id),'6');
- // Activity Log Record
- }
- $values=array("meeting_publish"=>1);
- if(!empty($values))
- { $where=array("meetings_id"=>$meetings_id);
- $meetings_participants_id = $this->Common_model->common_update('meetings',$values,$where);
- $this->Common_model->Set_Message('1',"Meeting Publish added successfully.");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Add Agenda to Publish Meeting.');
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again111.');
- }
- }
- if($MD["flollow_up_status"]==1)
- {
- $meetings_id =$MD["flollow_up_id"];
- }
- redirect('meeting-details/'.$meetings_id.'/members');
- }
- ############################################ END OF ASSIGN MEETING MEMBERS DETAILS ################
- ############################################ END OF ASSIGN MEETING MEMBERS DETAILS ################
- public function category()
- {
- // make payment
- if(isset($_POST['MP_submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('MP_category_type','type','trim|required|xss_clean');
- $this->form_validation->set_rules('category_name','category name','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $MP_category_type = $this->input->post('MP_category_type');
- $category_name = $this->input->post('category_name');
- $category_name_ar = $this->input->post('category_name_ar');
- $category_status = $this->input->post('category_status');
- $hfid = $this->input->post('category_id');
- $values = array('category_type_id'=>$MP_category_type,
- 'category_name_en'=>$category_name,
- 'category_name_ar'=>$category_name_ar,
- 'category_status'=>$category_status);
- if($hfid =="")
- {
- $this->Common_model->common_insert('category',$values);
- $this->Common_model->Set_Message('1',"Category Saved");
- }
- else
- {
- $where=array("category_id"=>$hfid);
- $this->Common_model->common_update('category',$values,$where);
- $this->Common_model->Set_Message('1',"Category updated");
- }
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('category_id'=>$delete_id);
- $value = array('is_deleted'=>'1');
- $this->Common_model->common_update('category',$value,$where);
- $this->Common_model->Set_Message('1','Category Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- // make payment
- # FILTER AND PAGINATION SECTION
- $URL = $this->uri->segment(1);
- $param[] = array('key'=>'country_admin_id','default'=>'');
- $param[] = array('key'=>'start_date','default'=>date('01/m/Y'));
- $param[] = array('key'=>'end_date','default'=>date('t/m/Y'));
- $FD = $this->Common_model->common_filter($URL,$param);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->category_list($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['FD'] = $FD;
- $data['CAL'] = $this->Manage_model->category_type_master();
- $data['CAT'] = $this->Manage_model->category_list($FD,$start,$limit,'0');
- $this->CommonPage('manage/category', $data, 'Manage Category');
- }
- public function get_category_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $category_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_category_details($category_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- exit;
- }
- ############################################ END OF Category #######################
- ############################################ CMS Pages Start #######################
- ############################################FAQS Starts #############
- public function get_faq_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $faq_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_faq_details($faq_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- exit;
- }public function get_tutorials_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $faq_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_tutorials_details($faq_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- exit;
- }
- public function manage_faqs()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('question','question','trim|required|xss_clean');
- $this->form_validation->set_rules('answer','answer','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $faq_status = $this->input->post('faq_status');
- $faq_category_id = $this->input->post('faq_category_id');
- $faq_id = $this->input->post('faq_id');
- $language = $this->input->post('language');
- $question = $this->input->post('question');
- $answer = $this->input->post('answer');
- $faq_status = $this->input->post('faq_status');
- $submit = $this->input->post('submit');
- $values = array('faq_category_id'=>$faq_category_id,
- 'type_name'=>"web",
- 'language'=>$language,
- 'question'=>$question,
- 'faq_status'=>$faq_status,
- 'answer'=>$answer);
- if($submit=='Save')
- {
- $faq_id = $this->Common_model->common_insert('faq',$values);
- $this->Common_model->Set_Message('1',"<strong>faq details added successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('faq_id'=>$faq_id);
- $this->Common_model->common_update('faq',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>faq Updated successfully.");
- }
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('faq_id'=>$delete_id);
- $value = array('faq_status'=>'1');
- $this->Common_model->common_update('faq',$value,$where);
- $this->Common_model->Set_Message('1','faq Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_faqs_admin($FD,$start,$limit,'1',0)[0]->count;
- $page_ary['total_rows_ar'] = $this->Manage_model->view_faqs_admin($FD,$start,$limit,'1',1)[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['FAQCAT'] = $this->Manage_model->get_category_List('3');
- $data['FAQEN'] = $this->Manage_model->view_faqs_admin($FD,$start,$limit,'0',0);
- $data['FAQAR'] = $this->Manage_model->view_faqs_admin($FD,$start,$limit,'0',1);
- $this->CommonPage('cms/manage_faqs',$data,'View FAQS');
- }
- ############################################ END OF FAQS ###############################
- public function privacy_policy()
- { $data=array();
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('contant_en','question','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $contant_en = $this->input->post('contant_en');
- $faq_category_id = $this->input->post('faq_category_id');
- $page_id = $this->input->post('page_id');
- $contant_ar = $this->input->post('contant_ar');
- $submit = $this->input->post('submit');
- $values = array('contant_ar'=>$contant_ar,
- 'contant_en'=>$contant_en);
- $where = array('page_id'=>$page_id);
- $this->Common_model->common_update('home_cms',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong> Updated successfully.");
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- $data["contant"] = $this->Manage_model->get_cms_details("privacy-policy");
- $this->CommonPage('cms/privacy_policy',$data,'Privacy Policy');
- }
- public function terms_conditions()
- {if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('contant_en','question','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $contant_en = $this->input->post('contant_en');
- $faq_category_id = $this->input->post('faq_category_id');
- $page_id = $this->input->post('page_id');
- $contant_ar = $this->input->post('contant_ar');
- $submit = $this->input->post('submit');
- $values = array('contant_ar'=>$contant_ar,
- 'contant_en'=>$contant_en);
- $where = array('page_id'=>$page_id);
- $this->Common_model->common_update('home_cms',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong> Updated successfully.");
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- $data["contant"] = $this->Manage_model->get_cms_details("terms-conditions");
- $this->CommonPage('cms/terms_conditions',$data,'Terms conditions');
- }public function about_us()
- { if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('contant_en','question','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $contant_en = $this->input->post('contant_en');
- $contant_ar = $this->input->post('contant_ar');
- $vision_en = $this->input->post('vision_en');
- $vision_ar = $this->input->post('vision_ar');
- $mission_en = $this->input->post('mission_en');
- $mission_ar = $this->input->post('mission_ar');
- $team_en = $this->input->post('team_en');
- $team_ar = $this->input->post('team_ar');
- $page_id = $this->input->post('page_id');
- $submit = $this->input->post('submit');
- $values = array('contant_ar'=>$contant_ar,
- 'contant_en'=>$contant_en,
- 'vision_en'=>$vision_en,
- 'vision_ar'=>$vision_ar,
- 'mission_en'=>$mission_en,
- 'mission_ar'=>$mission_ar,
- 'team_en'=>$team_en,
- 'team_ar'=>$team_ar);
- $where = array('page_id'=>$page_id);
- $this->Common_model->common_update('home_cms',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong> Updated successfully.");
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- $data["contant"] = $this->Manage_model->get_cms_details("about");
- $this->CommonPage('cms/about_us',$data,'About Us');
- }
- public function contact_us()
- { if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('title','title','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $title = $this->input->post('title');
- $email = $this->input->post('email');
- $phone = $this->input->post('phone');
- $address = $this->input->post('address');
- $fb_link = $this->input->post('fb_link');
- $insta_link = $this->input->post('insta_link');
- $youtube_link = $this->input->post('youtube_link');
- $twitter_link = $this->input->post('twitter_link');
- $linkedin_link = $this->input->post('linkedin_link');
- $page_id =1;
- $submit = $this->input->post('submit');
- $values = array('title'=>$title,
- 'email'=>$email,
- 'phone'=>$phone,
- 'address'=>$address,
- 'fb_link'=>$fb_link,
- 'insta_link'=>$insta_link,
- 'youtube_link'=>$youtube_link,
- 'twitter_link'=>$twitter_link,
- 'linkedin_link'=>$linkedin_link);
- $where = array('id'=>$page_id);
- $this->Common_model->common_update('home_contant_us',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong> Updated successfully.");
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- $data["contant"] = $this->Manage_model->get_contact_details();
- $this->CommonPage('cms/contact_us',$data,'Contact Us');
- }public function faq_organization()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('question','question','trim|required|xss_clean');
- $this->form_validation->set_rules('answer','answer','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $faq_status = $this->input->post('faq_status');
- $faq_category_id = $this->input->post('faq_category_id');
- $faq_id = $this->input->post('faq_id');
- $language = 0;
- $question = $this->input->post('question');
- $answer = $this->input->post('answer');
- $faq_status = $this->input->post('faq_status');
- $submit = $this->input->post('submit');
- $values = array('faq_category_id'=>$faq_category_id,
- 'type_name'=>"org",
- 'language'=>$language,
- 'question'=>$question,
- 'faq_status'=>$faq_status,
- 'answer'=>$answer);
- if($submit=='Save')
- {
- $faq_id = $this->Common_model->common_insert('faq',$values);
- $this->Common_model->Set_Message('1',"<strong>faq details added successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('faq_id'=>$faq_id);
- $this->Common_model->common_update('faq',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>faq Updated successfully.");
- }
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('faq_id'=>$delete_id);
- $value = array('faq_status'=>'1');
- $this->Common_model->common_update('faq',$value,$where);
- $this->Common_model->Set_Message('1','faq Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_faqs_org($FD,$start,$limit,'1',0)[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['CountryData'] = $this->Manage_model->select_view_country_org();
- $data['FAQCAT'] = $this->Manage_model->get_category_List('4');
- $data['FAQEN'] = $this->Manage_model->view_faqs_org($FD,$start,$limit,'0',0);
- $this->CommonPage('cms/faq_organization',$data,'faq-organization');
- }
- public function tutorials_organization()
- {
- # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('title','link_url','trim|required|xss_clean');
- $this->form_validation->set_rules('link_url','link_url','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $status = $this->input->post('t_status');
- // $title = $this->input->post('title');
- $id = $this->input->post('id');
- $language = 0;
- $title = $this->input->post('title');
- $link_url = $this->input->post('link_url');
- $submit = $this->input->post('submit');
- $values = array('title'=>$title,
- 'link_url'=>$link_url,
- 'status'=>$status);
- if($submit=='Save')
- {
- $id = $this->Common_model->common_insert('organization_tutorials',$values);
- $this->Common_model->Set_Message('1',"<strong>organization tutorials details added successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('id'=>$id);
- $this->Common_model->common_update('organization_tutorials',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>organization tutorials Updated successfully.");
- }
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('id'=>$delete_id);
- $value = array('is_deleted'=>'1');
- $this->Common_model->common_update('organization_tutorials',$value,$where);
- $this->Common_model->Set_Message('1','faq Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->view_organization_tutorials($FD,$start,$limit,'1',0)[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['Tutorials'] = $this->Manage_model->view_organization_tutorials($FD,$start,$limit,'0',0);
- $this->CommonPage('cms/tutorials',$data,'Tutorials');
- }
- public function app_links_organization()
- { $data=array();
- $this->load->model('Payment_model');
- $CountryData = $this->Manage_model->get_organization_country_details();
- $organizations_id = $this->session->userdata('logged_in')['table_id'];
- $this->CommonPage('cms/app_links',$data,'app-links');
- }
- public function get_seo_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $seo_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_seo_details($seo_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- exit;
- }
- public function manage_seo()
- { # INSERT / UPDATE FUNCTION
- if(isset($_POST['submit']))
- {
- $this->form_validation->set_error_delimiters('<div class="ci-form-error">', '</div>');
- $this->form_validation->set_rules('meta_title_en','link_url','trim|required|xss_clean');
- //$this->form_validation->set_rules('link_url','link_url','trim|required|xss_clean');
- if($this->form_validation->run())
- {
- $meta_title_en = $_POST["meta_title_en"];
- $meta_title_ar = $_POST["meta_title_ar"];
- $id = $_POST["seo_id"];
- $header_script_en = $_POST["header_script_en"];
- $header_script_ar = $_POST["header_script_ar"];
- $meta_keyword_en = $_POST["meta_keyword_en"];
- $meta_keyword_ar = $_POST["meta_keyword_ar"];
- $slug = $_POST["slug"];
- $submit = $this->input->post('submit');
- $values = array('meta_title_en'=>$meta_title_en,
- 'meta_title_ar'=>$meta_title_ar,
- 'header_script_en'=>$header_script_en,
- 'header_script_ar'=>$header_script_ar,
- 'meta_keywords_en'=>$meta_keyword_en,
- 'meta_keywords_ar'=>$meta_keyword_ar,
- 'slug'=>$slug);
- if($submit=='Save')
- {
- $id = $this->Common_model->common_insert('seo',$values);
- $this->Common_model->Set_Message('1',"<strong> details added successfully</strong>");
- redirect(current_url());
- }
- else
- {
- $where = array('seo_id'=>$id);
- $this->Common_model->common_update('seo',$values,$where);
- $this->Common_model->Set_Message('1',"<strong>Sucess!</strong>Updated successfully.");
- }
- redirect(current_url());
- }
- else
- { $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- if($this->input->post('submit')=='Update')
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong>Oops something went wrong. Please try again.');
- redirect(current_url());
- }
- }
- }
- # END OF INSERT / UPDATE FUNCTION
- # DELETE FUNCTION
- if(isset($_POST['delete']))
- {
- $this->form_validation->set_rules('delete_id','Delete ID','trim|xss_clean|required');
- if($this->form_validation->run())
- {
- $delete_id = $this->input->post('delete_id');
- $where = array('id'=>$delete_id);
- $value = array('is_deleted'=>'1');
- $this->Common_model->common_update('organization_tutorials',$value,$where);
- $this->Common_model->Set_Message('1','faq Removed Successfully');
- }
- else
- {
- $this->Common_model->Set_Message('2','<strong>Error!</strong> Oops something went wrong. Please try again.');
- }
- redirect(current_url());
- }
- # END OF DELETE FUNCTION
- # FILTER AND PAGINATION SECTION
- $FD = array();
- if($this->session->userdata('logged_in')['privilege_id']==6)
- {
- $FD['country_id'] = $this->session->userdata('logged_in')['table_id']; // for country admin only
- }
- $URL = $this->uri->segment(1);
- $start = $limit = '';
- $page_ary['url'] = base_url($URL);
- $page_ary['total_rows'] = $this->Manage_model->viewSEO($FD,$start,$limit,'1')[0]->count;
- $limit = $page_ary['per_page'] = 30;
- $PGN_DATA = $this->Common_model->Pagination($page_ary);
- $data['page'] = $start = $PGN_DATA['page'];
- $data['links'] = $PGN_DATA['links'];
- # END OF FILTER AND PAGINATION SECTION
- $data['seo'] = $this->Manage_model->viewSEO($FD,$start,$limit,'0');
- $this->CommonPage('cms/seo',$data,'Seo Appliction');
- }
- ############################################ END OF CMS #######################
- public function get_meeting_data()
- {
- $Data['response'] = 'failed';
- $Data['result'] = array();
- $this->form_validation->set_rules('data_id','data_id','trim|required|xss_clean|numeric');
- if($this->form_validation->run())
- {
- $product_id = $this->input->post('data_id');
- $Result = $this->Manage_model->get_meeting_details($product_id);
- if(!empty($Result))
- {
- $Data['response'] = 'success';
- $Data['result'] = $Result;
- }
- }
- echo json_encode($Data);
- }
- }