Commit 0560ed18 by Jithin

first review

parent d79460db
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Facebook API Configuration
| -------------------------------------------------------------------
|
| To get an facebook app details you have to create a Facebook app
| at Facebook developers panel (https://developers.facebook.com)
|
| facebook_app_id string Your Facebook App ID.
| facebook_app_secret string Your Facebook App Secret.
| facebook_login_type string Set login type. (web, js, canvas)
| facebook_login_redirect_url string URL to redirect back to after login. (do not include base URL)
| facebook_logout_redirect_url string URL to redirect back to after logout. (do not include base URL)
| facebook_permissions array Your required permissions.
| facebook_graph_version string Specify Facebook Graph version. Eg v2.6
| facebook_auth_on_load boolean Set to TRUE to check for valid access token on every page load.
*/
$config['facebook_app_id'] = '1986687558274486';
$config['facebook_app_secret'] = 'd848d17b4c5427ca8d55c99fdae378a5';
$config['facebook_login_type'] = 'web';
$config['facebook_login_redirect_url'] = 'Home/facebook_login';
$config['facebook_logout_redirect_url'] = 'user_authentication/logout';
$config['facebook_permissions'] = array('email');
$config['facebook_graph_version'] = 'v2.6';
$config['facebook_auth_on_load'] = TRUE;
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Doctor extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
function __construct()
{
parent::__construct();
$this->load->model('Doctor_model');
$this->load->model('Home_model');
date_default_timezone_set("Asia/Kolkata");
global $default_date ;
$this->default_date = '01/01/2017';
}
public function index()
{
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=="DOCTOR")
{
$template['page'] = "doctor_dash";
$template['page_title'] = "Dashboard";
$template['data'] = "Doctor page";
$doctor_data = $this->Doctor_model->get_single_doctor($userdata['id']);
$clinic_list = $this->Doctor_model->get_doctor_clinic_list($userdata['id']);
$day_appointment = $this->Doctor_model->get_doctor_appointments_day($userdata['id'],'null');
foreach ($day_appointment as $key => $value)
{
$times = explode('-', $value['booking_time']);
$day_appointment[$key]['time_start'] = $times[0];
$day_appointment[$key]['time_end'] = $times[1];
}
/*print_r($day_appointment);
die();*/
//print_r($day_appointment);die();
$template['doctor_data'] = $doctor_data;
$template['clinic_list'] = $clinic_list;
$template['day_appointment'] = $day_appointment;
$this->load->view('template/template', $template);
}
else
{
header('Location: '.base_url());
}
//print_r($userdata);
}
else
{
header('Location: '.base_url());
}
}
public function doctor_appointments_month()
{
$userdata = $this->session->userdata('UserData');
$month_appointment = $this->Doctor_model->get_doctor_appointments_month($userdata['id']);
$template['month_appointment'] = $month_appointment;
$this->load->view('doctor_dash_appointments_month',$template);
//print json_encode($day_appointments);
}
public function doctor_appointments_week()
{
$day_appointments = array();
$userdata = $this->session->userdata('UserData');
for ($i=0; $i < 7; $i++)
{
$day = date('D',strtotime('+'.$i.'day'));
$dayno = date('d',strtotime('+'.$i.'day'));
$week_appointments[$i] = $this->Doctor_model->get_doctor_appointments_week($userdata['id'],date('y-m-d',strtotime('+'.$i.'day')));
}
$template['week_appointments'] = $week_appointments;
$this->load->view('doctor_dash_appointments_week',$template);
//print json_encode($day_appointments);
}
public function getScheduleforClinic()
{
//print_r($_POST);
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=="DOCTOR")
{
$result = $this->Doctor_model->Schedulelist($_POST['clinic_id'],$userdata['id']);
if(!empty($result))
{
$res = array('status' => 'success', 'data'=>$result['date']);
}
else
{
$res = array('status' => 'fail', 'data'=>$result['date']);
}
print json_encode($res);
}
}
}
public function addSchedule()
{
if($this->session->userdata('UserData'))
{
if($this->session->userdata('UserData')['type']=="DOCTOR")
{
// print_r($this->default_date);
//print_r($_POST);
//die();
$insert_array = array();
$not_available_day = array();
$flag = 0;
$request = $_POST;
$flag_day_equal = 0;
//print_r($request);
$result = $this->Doctor_model->checkDoctorExist($this->session->userdata('UserData')['id']);
if(!empty($result))
{
//print_r($result);die();
foreach ($request['dct_sch_day'] as $req_day_key => $req_day_value)
{
foreach ($result as $db_key => $db_value)
{
$decode_date = json_decode($db_value['date'],true);
if(!empty($decode_date))
{
foreach ($decode_date as $time_key => $time_value)
{
if($req_day_value == $time_value['day'] && $db_value['clinic_id'] != $request['dct_sch_clinic'])
{
$startTime = 'dct_sch_'.$req_day_value.'_start';
$endTime = 'dct_sch_'.$req_day_value.'_end';
$interval = 'dct_sch_'.$req_day_value.'_int';
if((strtotime($this->default_date.$time_value['time']['start']) < strtotime($this->default_date.$request[$startTime ]) && strtotime($this->default_date.$request[$startTime ]) < strtotime($this->default_date.$time_value['time']['end'])) || (strtotime($this->default_date.$time_value['time']['start']) < strtotime($this->default_date.$request[$endTime]) && strtotime($this->default_date.$request[$endTime ]) < strtotime($this->default_date.$time_value['time']['end'])) || (strtotime($this->default_date.$request[$startTime ]) < strtotime($this->default_date.$time_value['time']['start']) && strtotime($this->default_date.$time_value['time']['start']) <strtotime($this->default_date.$request[$endTime])) || (strtotime($this->default_date.$request[$startTime ]) < strtotime($this->default_date.$time_value['time']['end']) && strtotime($this->default_date.$time_value['time']['end']) < strtotime($this->default_date.$request[$endTime])))
{
$flag_day_equal = 1;
}
}
}
}
}
}
if($flag_day_equal == 0)
{
foreach ($request['dct_sch_day'] as $key_elseDay => $value_elseDay)
{
$start = 'dct_sch_'.$value_elseDay.'_start';
$end = 'dct_sch_'.$value_elseDay.'_end';
$interval = 'dct_sch_'.$value_elseDay.'_int';
$res = array('day'=>$value_elseDay,
'time'=>array('start'=>$request[$start],
'end'=>$request[$end],
'interval'=>$request[$interval]));
array_push($insert_array, $res);
}
//print_r($insert_array);exit;
$this->Doctor_model->set_new_consultation($insert_array,$request['dct_sch_clinic'],array($this->session->userdata('UserData')['id']));
//print_r("success");
$res = array('status' => 'success','msg' => 'Successfully assigned' );
}
else{
//print_r("already");
$res = array('status' => 'fail','msg' => 'Schedule Assiging Failed' );
}
}
print json_encode($res);
}
}
}
public function addVacation()
{
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=="DOCTOR")
{
$request = array('doctor_id' => $userdata['id'],'clinic_id' => $_POST['doc-leave-clinic'],'start_date' => strtotime($_POST['dctr-leave-start']),'end_date' => strtotime($_POST['dctr-leave-end']));
//print_r($request);
$result = $this->Doctor_model->insertVacation($request);
if($result)
{
$res = array('status' => 'success');
}
else
{
$res = array('status' => 'fail' );
}
print json_encode($res);
}
}
}
public function get_myappointments_day()
{
//print_r($_POST['appointment_day']);
$userdata = $this->session->userdata('UserData');
$day_appointment = $this->Doctor_model->get_doctor_appointments_day($userdata['id'],$_POST['appointment_day']);
foreach ($day_appointment as $key => $value)
{
$times = explode('-', $value['booking_time']);
$day_appointment[$key]['time_start'] = $times[0];
$day_appointment[$key]['time_end'] = $times[1];
}
//print_r($day_appointment);
$template['day_appointment'] = $day_appointment;
$this->load->view('doctor_dash_appointments_day',$template);
}
public function medicalrecords()
{
$template['page'] = "doctor_medical_records";
$template['page_title'] = "Records";
$userdata = $this->session->userdata('UserData');
$doctor_data = $this->Doctor_model->get_single_doctor($userdata['id']);
$patient_attended = $this->Doctor_model->get_single_doc_pat_attended($userdata['id']);
//$template['doctor_data'] = $doctor_data;
//$template['clinic_list'] = $clinic_list;
//$template['day_appointment'] = $day_appointment;
$this->load->view('template/template', $template);
}
}
...@@ -21,8 +21,11 @@ class Home extends CI_Controller { ...@@ -21,8 +21,11 @@ class Home extends CI_Controller {
function __construct() function __construct()
{ {
date_default_timezone_set("Asia/Kolkata");
parent::__construct(); parent::__construct();
$this->load->model('Home_model'); $this->load->model('Home_model');
$this->load->library('facebook'); // Load facebook library
} }
public function index() public function index()
...@@ -30,8 +33,39 @@ class Home extends CI_Controller { ...@@ -30,8 +33,39 @@ class Home extends CI_Controller {
$template['page'] = "home"; $template['page'] = "home";
$template['page_title'] = "Home Page"; $template['page_title'] = "Home Page";
$template['data'] = "Home page"; $template['data'] = "Home page";
$speciality_list = $this->Home_model->get_speciality();
//print_r($speciality_list);die();
$template['speciality_list'] = $speciality_list;
/*FB LOGIN BEGINS*/
if(isset($_REQUEST['status']))
{
$template['FBLoginStatus'] = $_REQUEST['status'];
}
else
{
$template['FBLoginStatus'] = 'fail';
}
$fbuser = '';
$template['FBauthUrl'] = $this->facebook->login_url();
/*FB LOGIN ENDS*/
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']!="DOCTOR")
{
$this->load->view('template/template', $template); $this->load->view('template/template', $template);
} }
else
{
header('Location: '.base_url().'Doctor');
}
}
else
{ $this->load->view('template/template', $template); }
}
public function check_email() public function check_email()
{ {
...@@ -40,23 +74,47 @@ class Home extends CI_Controller { ...@@ -40,23 +74,47 @@ class Home extends CI_Controller {
//print_r($check_result);die(); //print_r($check_result);die();
print json_encode($check_result); print json_encode($check_result);
} }
public function check_username()
{
$data = $_POST;
$check_result = $this->Home_model->usernameExist($data);
//print_r($check_result);die();
print json_encode($check_result);
}
public function check_username_doc()
{
$data = $_POST;
$check_result = $this->Home_model->usernameExist_doc($data);
//print_r($check_result);die();
print json_encode($check_result);
}
public function check_email_doc()
{
$data = $_POST;
$check_result = $this->Home_model->emailExist_doc($data);
//print_r($check_result);die();
print json_encode($check_result);
}
public function reg_patient() public function reg_patient()
{ {
parse_str($_REQUEST['data'], $output); parse_str($_REQUEST['data'], $output);
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Kolkata");
$reg_data = array('email' => $output['reg_pat_email'],'name' => $output['reg_pat_name'],'username' => $output['reg_pat_username'],'password' => $output['reg_pat_password'],'cpf' => $output['reg_pat_cpf'],'rg' => $output['reg_pat_rg'],'dob' =>strtotime($output['reg_pat_dob']),'gender' => $output['reg_pat_gender'],'weight' => $output['reg_pat_weight'],'height' => $output['reg_pat_height'],'blood_group' => $output['reg_pat_bloodgrp'],'zip_code' => $output['reg_pat_cep'],'street_address' => $output['reg_pat_streetadd'],'locality' => $output['reg_pat_locality'],'number' => $output['reg_pat_number'],'landmark' => $output['reg_pat_complement'] ); $reg_data = array('email' => $output['reg_pat_email'],'name' => $output['reg_pat_name'],'username' => $output['reg_pat_username'],'password' => md5($output['reg_pat_password']),'cpf' => $output['reg_pat_cpf'],'rg' => $output['reg_pat_rg'],'dob' =>strtotime($output['reg_pat_dob']),'gender' => $output['reg_pat_gender'],'weight' => $output['reg_pat_weight'],'height' => $output['reg_pat_height'],'blood_group' => $output['reg_pat_bloodgrp'],'zip_code' => $output['reg_pat_cep'],'street_address' => $output['reg_pat_streetadd'],'locality' => $output['reg_pat_locality'],'number' => $output['reg_pat_number'],'landmark' => $output['reg_pat_complement'] );
//print_r($reg_data);die(); //print_r($reg_data);die();
$result = $this->Home_model->registration($reg_data); $result = $this->Home_model->registration($reg_data);
if($result['status'] == 'success'){ if($result['status'] == 'success')
{
if(isset($_FILES['pic']))
{
$fileName = $result['userdata']['id'].'_'.$_FILES['pic']['name']; $fileName = $result['userdata']['id'].'_'.$_FILES['pic']['name'];
$config = set_upload_options('./assets/uploads/profilepic/'); $config = set_upload_options('./assets/uploads/profilepic/');
$config['file_name'] = $fileName; $config['file_name'] = $fileName;
$this->load->library('upload', $config); $this->load->library('upload', $config);
if ( ! $this->upload->do_upload('pic')) { if ( ! $this->upload->do_upload('pic'))
{
$error = array('error' => $this->upload->display_errors('', '')); $error = array('error' => $this->upload->display_errors('', ''));
$res = array( $res = array(
"status"=> "error", "status"=> "failure",
"error"=> "Upload Error", "error"=> "Upload Error",
"message"=> "Sorry! Profile Photo not uploaded".$error['error'] "message"=> "Sorry! Profile Photo not uploaded".$error['error']
); );
...@@ -64,32 +122,310 @@ class Home extends CI_Controller { ...@@ -64,32 +122,310 @@ class Home extends CI_Controller {
} }
else else
{ {
$imagedata = $this->upload->data();
$fullfilepath='assets/uploads/profilepic/'.$imagedata['file_name'];
}
}
else
{
$fullfilepath = $output['reg_pat_profilepic'];
}
if(isset($fullfilepath))
{
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Kolkata");
$static_string = 'IPOK_User'.time(); $static_string = 'IPOK_User'.time();
$authToken = uniqid($static_string); $authToken = uniqid($static_string);
$result_authtoken = $this->Home_model->authtoken_registration($authToken,$result['userdata']['id']); $result_authtoken = $this->Home_model->authtoken_registration($authToken,$result['userdata']['id']);
if($result_authtoken){ if($result_authtoken)
$imagedata = $this->upload->data(); {
$fullfilepath='assets/uploads/profilepic/'.$imagedata['file_name'];
$picdata = array('profile_photo'=>$fullfilepath); $picdata = array('profile_photo'=>$fullfilepath);
$finalResult = $this->Home_model->updatePic($picdata,$result['userdata']['id']); $finalResult = $this->Home_model->updatePic($picdata,$result['userdata']['id']);
if($finalResult) if($finalResult)
{ $res = array('status'=>'success'); } //final success
else
{ {
$final_reply = array('status'=>'success'); $res = array(
print json_encode($final_reply); "status"=> "failure",
"error"=> "Database Error",
"message"=> "Sorry! Profile Photo not Saved"
);
}
if($this->session->userdata('FBData'))
{ unset($_SESSION['FBData']); }
}
}
} }
else else
{ {
$final_reply = array('status'=>'failure'); $res = array(
print json_encode($final_reply); "status"=> "failure",
"error"=> "Database Error",
"message"=> "Sorry! User Details not Saved"
);
} }
print json_encode($res);
} }
public function facebook_login()
{
$FBuserData = array();
// Check if user is logged in
if($this->facebook->is_authenticated())
{
// Get user facebook profile details
$userProfile = $this->facebook->request('get', '/me?fields=id,first_name,last_name,email,gender,locale,picture');
// Preparing data for database insertion
$FBuserData['oauth_provider'] = 'facebook';
$FBuserData['oauth_uid'] = $userProfile['id'];
$FBuserData['first_name'] = $userProfile['first_name'];
$FBuserData['last_name'] = $userProfile['last_name'];
$FBuserData['email'] = $userProfile['email'];
$FBuserData['gender'] = $userProfile['gender'];
$FBuserData['locale'] = $userProfile['locale'];
$FBuserData['profile_url'] = 'https://www.facebook.com/'.$userProfile['id'];
$FBuserData['picture_url'] = $userProfile['picture']['data']['url'];
// print_r($FBuserData);die();
if($FBuserData)
{
$check_result = $this->Home_model->emailExist(array('email' =>$FBuserData['email']));
if($check_result['message']=="success")
{
$status = 'success';
$this->session->set_userdata('FBData',$FBuserData);
header('Location: '.base_url().'Home/index?status='.$status);
}
else
{
//go directly to home page
} }
//redirect('Home/index');
die();
}
// Get logout URL
$data['logoutUrl'] = $this->facebook->logout_url();
}
}
public function login()
{
//parse_str($_REQUEST['LoginData'], $request);
//print_r($_POST);die();
$request = $_POST;
$result=$this->Home_model->login($request);
if(($result['status']=='success')&&($request['login_type']=="PATIENT"))
{
//print_r($result);die();
$update_location = $this->Home_model->location_update($result['userdata'],$request);
if($update_location['status']=='success')
{
$res = array(
"status"=> "success",
"data"=>array(
"type"=>"PATIENT",
"id"=> $result['userdata']['id'],
"name"=> $result['userdata']['name'],
"username"=> $result['userdata']['username'],
"email"=> $result['userdata']['email'],
"password" => $result['userdata']['password'],
"cpf" => $result['userdata']['cpf'],
"rg" => $result['userdata']['rg'],
"dob" => $result['userdata']['dob'],
"gender" => $result['userdata']['gender'],
"weight" => $result['userdata']['weight'] ,
"height" => $result['userdata']['height'],
"blood_group" => $result['userdata']['blood_group'],
"zip_code" => $result['userdata']['zip_code'],
"street_address" => $result['userdata']['street_address'],
"locality" => $result['userdata']['locality'],
"number" => $result['userdata']['number'],
"landmark" =>$result['userdata']['landmark'],
"profile_photo" => $result['userdata']['profile_photo'],
"bystander_name" => $result['userdata']['bystander_name'],
"bystander_relation" => $result['userdata']['bystander_relation'],
"bystander_cpf" => $result['userdata']['bystander_cpf'],
"bystander_dob" => $result['userdata']['bystander_dob'],
"bystander_profile_photo" => $result['userdata']['bystander_profile_photo'],
)
);
}
else
{
$res = array(
"status"=> "error",
"error"=> "Location Update Failed",
"message"=> "Check Location Credentials"
);
}
}
else if(($result['status']=='success')&&($request['login_type']=="DOCTOR"))
{
$update_location = $this->Home_model->location_update_doctor($result['userdata'],$request);
if($update_location['status']=='success')
{
$res = array(
"status"=> "success",
"data"=>array(
"type"=>"DOCTOR",
"id"=> $result['userdata']['id'],
"name"=> $result['userdata']['name'],
"username"=> $result['userdata']['username'],
"email"=> $result['userdata']['email'],
"password" => $result['userdata']['password'],
"specialization" => $result['userdata']['specialization'],
"telphone" => $result['userdata']['telephone'],
"cpf" => $result['userdata']['cpf'],
"rg" => $result['userdata']['rg'],
"dob" => $result['userdata']['dob'],
"gender" => $result['userdata']['gender'],
"price" => $result['userdata']['price'],
"zip_code" => $result['userdata']['cep'],
"street_address" => $result['userdata']['street_address'],
"locality" => $result['userdata']['locality'],
"number" => $result['userdata']['number'],
"landmark" =>$result['userdata']['complement'],
"profile_photo" => $result['userdata']['profile_pic'],
"bio" => $result['userdata']['about']
)
);
}
else
{
$res = array(
"status"=> "error",
"error"=> "Location Update Failed",
"message"=> "Check Location Credentials"
);
}
}
else if($result['status']=='fail')
{
$res = array(
"status"=> "error",
"error"=> "Login Failed",
"message"=> "Invalid Username or Password"
);
}
if(($res['status']=="success"))
{
$this->session->set_userdata('UserData',$res['data']);
//header('Location: '.base_url());
//header("Refresh:0");
//redirect(base_url()."");
}
//header('Location: '.base_url());
//print_r($this->session->userdata('PatientData'));die();
print json_encode($res);
}
public function logout()
{
if($this->session->userdata('UserData'))
{
unset($_SESSION['UserData']);
}
header('Location: '.base_url());
}
public function RegisterDoctor()
{
$template['page'] = "register_doctor";
$template['page_title'] = "Register Doctor";
$speciality_list = $this->Home_model->get_speciality();
//print_r($speciality_list);die();
$template['speciality_list'] = $speciality_list;
//$template['data'] = "Home page";
$this->load->view('template/template', $template);
}
public function doRegister()
{
//print_r(strtotime($_POST['dob']));die();
if(isset($_POST))
{
$data = $_POST;
$data['password'] = md5($data['password']);
$data['dob'] = strtotime($_POST['dob']);
$result = $this->Home_model->register_doctor($data);
//print_r($result);
if($result['status'] == 'success')
{
$fileName = $result['data']['id'].'_'.$_FILES['profile_pic']['name'];
$config = set_upload_options('./assets/uploads/profilepic/doctors/');
$config['file_name'] = $fileName;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('profile_pic'))
{
$error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"message"=> "Sorry! Profile Photo not uploaded".$error['error']
);
$this->Home_model->delete_registration_doctor($result['data']['id']);
$this->session->set_flashdata('message', array('message' => 'Registration Failed, Kindly Try Again', 'title' => 'Error', 'class' => 'danger'));
header('Location: '.base_url());
}
else
{
//print_r($this->input->post('name'));
//print_r($_POST['username']);
$imagedata = $this->upload->data();
$fullfilepath='assets/uploads/profilepic/doctors/'.$imagedata['file_name'];
$picdata = array('profile_pic'=>$fullfilepath);
$this->Home_model->updatePic_doctor($picdata,$result['data']['id']);
$this->session->set_flashdata('message', array('message' => 'Successfully Registered, Kindly Login', 'title' => 'Success', 'class' => 'success'));
header('Location: '.base_url());
}
}
else
{
$this->session->set_flashdata('message', array('message' => 'Registration Failed, Kindly Try Again', 'title' => 'Error', 'class' => 'danger'));
header('Location: '.base_url());
}
}
}
public function Dashboard()
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=='DOCTOR')
{
header('Location: '.base_url().'Doctor');
}
else if($userdata['type']=='PATIENT')
{
header('Location: '.base_url().'Patient');
}
} }
} }
}
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Patient extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
function __construct()
{
parent::__construct();
$this->load->model('Patient_model');
$this->load->model('Home_model');
$this->load->model('Search_doctor_model');
date_default_timezone_set("Asia/Kolkata");
}
public function index()
{
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=="PATIENT")
{
$template['page'] = "patient_dash";
$template['page_title'] = "Dashboard";
$template['data'] = "Patient page";
$patient_data = $this->Patient_model->get_single_patient($userdata['id']);
$completed_consultation = $this->Patient_model->get_patient_completed_consultation($userdata['id']);
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
//print_r($completed_consultation);
//$clinic_list = $this->Doctor_model->get_doctor_clinic_list($userdata['id']);
//$template['clinic_list'] = $clinic_list;
//print_r($patient_data);
$template['patient_data'] = $patient_data;
$template['completed_consultation'] = $completed_consultation;
$template['confirmed_consultation'] = $confirmed_consultation;
$this->load->view('template/template', $template);
}
else
{
header('Location: '.base_url());
}
//print_r($userdata);
}
else
{
header('Location: '.base_url());
}
}
public function getBooking()
{
$result = $this->Patient_model->get_Booking($_POST['booking_id']);
$result['book_date'] = date('d F Y',$result['book_date']);
$result['doc_pic'] = ''. base_url().$result['doc_pic'].'';
//print_r($result['doc_pic']);die();
print json_encode($result);
}
public function cancelBooking()
{
//print_r($_POST);die();
$userdata = $this->session->userdata('UserData');
$result = $this->Patient_model->cancel_Booking($_POST['booking_id']);
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
$template['confirmed_consultation'] = $confirmed_consultation;
$this->load->view('patient_dash_scheduled_booking',$template);
}
public function reScheduleConsultation()
{
$result = $this->Patient_model->get_Booking($_POST['booking_id']);
$result['book_date'] = date('d F Y',$result['book_date']);
$result['doc_pic'] = ''. base_url().$result['doc_pic'].'';
print json_encode($result);
}
public function updateBooking()
{
$userdata = $this->session->userdata('UserData');
//print_r($_POST);
$this->Patient_model->update_Booking($_POST);
$confirmed_consultation = $this->Patient_model->get_patient_confirmed_consultation($userdata['id']);
$template['confirmed_consultation'] = $confirmed_consultation;
$this->load->view('patient_dash_scheduled_booking',$template);
}
}
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Searchdoctor extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
function __construct()
{
parent::__construct();
$this->load->model('Search_doctor_model');
$this->load->model('Home_model');
$this->load->model('Doctor_model');
date_default_timezone_set("Asia/Kolkata");
}
public function index()
{
if(isset($_POST)&&(!empty($_POST)))
{
$request = $_POST;
//print_r($request);die();
$this->session->set_userdata('DoctorSearchData',$request);
}
header('Location: '.base_url().'Searchdoctor/search');
}
public function search()
{
$speciality_list = $this->Home_model->get_speciality();
$template['speciality_list'] = $speciality_list;
if($this->session->userdata('DoctorSearchData'))
{
$request = $this->session->userdata('DoctorSearchData');
//print_r($request);
//die();
if((isset($request['doctor-search-date']))&&(!empty($request['doctor-search-date'])))
{
$request['doctor-search-date'] = strtotime($request['doctor-search-date']);
}
$all_doctors = $this->Search_doctor_model->filter_search($request);
//print_r($all_doctors);die();
if(!empty($all_doctors))
{
$template['doctors_list'] = $all_doctors;
}
$template['page'] = "search_doctor";
$template['page_title'] = "Search Doctor";
$template['searchdata'] = $request;
$this->load->view('template/template', $template);
}
else
{
$template['page'] = "search_doctor";
$template['page_title'] = "Search Doctor";
$this->load->view('template/template', $template);
}
}
public function filter_search()
{
if(isset($_POST)&&(!empty($_POST)))
{
$request = $_POST;
//print_r($request);die();
$this->session->set_userdata('DoctorSearchData',$request);
//print_r($request);die();
if((isset($request['doctor-search-date']))&&(!empty($request['doctor-search-date'])))
{
$request['doctor-search-date'] = strtotime($request['doctor-search-date']);
}
$template['searchdata'] = $request;
$all_doctors = $this->Search_doctor_model->filter_search($request);
$template['doctors_list'] = $all_doctors;
//print_r($all_doctors);die();
$this->load->view('search_doctor_result',$template);
// print_r($html);die();
/*if(!empty($all_doctors))
{
$res = array(
"status"=> "success",
"html"=> $html);
}
else
{
$res = array(
"status"=> "error",
"message"=> "cant find result"
);
}
print_r($res);*/
//die();
}
}
public function doctorprofile()
{
$doctor_id = $this->uri->segment(3);
$clinic_id = $this->uri->segment(4);
$doctor_data = $this->Search_doctor_model->get_single_doctor_clinic($doctor_id,$clinic_id);
$day_appointments = array();
$userdata = $this->session->userdata('UserData');
for ($i=0; $i < 7; $i++)
{
$day = date('D',strtotime('+'.$i.'day'));
$dayno = date('d',strtotime('+'.$i.'day'));
$week_appointments[$i] = $this->Doctor_model->get_doctor_appointments_week($doctor_id,date('y-m-d',strtotime('+'.$i.'day')));
}
$template['week_appointments'] = $week_appointments;
//$this->load->view('doctor_dash_appointments_week',$template);
//print_r($doctor_data);die();
$template['page'] = "search_doctor_complete_profile";
$template['page_title'] = "Doctor Profile";
$template['doctor_data'] = $doctor_data;
$this->load->view('template/template', $template);
}
public function confirmbooking()
{
$doctor_id = $this->uri->segment(3);
$clinic_id = $this->uri->segment(4);
$doctor_data = $this->Search_doctor_model->get_single_doctor_clinic($doctor_id,$clinic_id);
//$template['time_slot'] = $res_new;
$template['page'] = "search_doctor_confirm_booking";
$template['page_title'] = "Booking";
$template['doctor_data'] = $doctor_data;
$this->load->view('template/template', $template);
}
public function getDoctorClinic_timeslot()
{
//print_r($_POST);
$result_availability = $this->Search_doctor_model->doctor_availability($_POST['doctor_id'],$_POST['clinic_id']);
if($result_availability['status'] == 'success')
{
$day = date('D',strtotime($_POST['book_date']));
$res = array();
$result_availability['data']['date'] = json_decode($result_availability['data']['date'],true);
foreach ($result_availability['data']['date'] as $key => $value) {
if($value['day'] == strtolower($day))
{
$interval_time = $value['time']['interval']*60;
$start_time = strtotime($value['time']['start']);
$end_time = strtotime($value['time']['end']);
for ($i=$start_time; $i <= $end_time; $i=$i+$interval_time) {
$initial = $i;
$end = $i+$interval_time;
array_push($res, array('time'=>date('h:i:sa',$initial).' - '.date('h:i:sa',$end)));
}
}
}
$res_new = array_values(array_unique($res,SORT_REGULAR));
//print_r($res_new);die();
}
print json_encode($res_new);
}
public function checkDoctorAvailability()
{
//print_r($_POST);
$check_leave = $this->Search_doctor_model->checkDoctorLeave($_POST);
//print_r($check_leave);
if($check_leave['count']==0)
{
$check_booking = $this->Search_doctor_model->checkDoctorBooking($_POST);
if($check_booking['count']==0)
{
if($this->session->userdata('UserData'))
{
$res = array('status' => 'success', 'msg' => 'booking success','isLogin' =>'true');
}
else
{
$res = array('status' => 'success', 'msg' => 'booking success','isLogin' =>'false');
}
}
else
{
$res = array('status' => 'fail', 'type' => 'booking slot','msg' => 'Booking Slot Unavailable, Choose Another' );
}
}
else
{
$res = array('status' => 'fail','type' => 'doctor leave', 'msg' => 'Doctor Unavailable, Choose Another Date' );
}
//print_r($res);die();
print json_encode($res);
}
public function markbooking()
{
if($this->session->userdata('UserData'))
{
$userdata = $this->session->userdata('UserData');
if($userdata['type']=="PATIENT")
{
$now = new DateTime();
$times = explode('-', $_POST['confirm-book-time']);
//print_r($_POST['confirm-book-date']);die();
$date = date('y-m-d');
$book_start_time = strtotime($_POST['confirm-book-date'].' '.$times[0]);
$book_end_time = strtotime($_POST['confirm-book-date'].' '.$times[1]);
//print_r($book_end_time);die();
$doctor_price = $this->Search_doctor_model->getDoctorPrice($_POST['confirm-book-doctor']);
$data = array('doctor_id' =>$_POST['confirm-book-doctor'] ,'clinic_id' =>$_POST['confirm-book-clinic'] ,'clinic_id' =>$_POST['confirm-book-clinic'],'patient_id' =>$userdata['id'] ,'date' =>strtotime($_POST['confirm-book-date']),'time' =>$_POST['confirm-book-time'],'amount'=>$doctor_price['price'],'requested_date'=>$now->getTimestamp(),'time_start'=>$book_start_time,'time_end'=>$book_end_time);
$res = $this->Search_doctor_model->insertBooking($data);
}
}
}
public function booking_payment()
{
$check_markbooking = $this->Search_doctor_model->checkBooking($_POST);
//print_r($check_markbooking);
if($check_markbooking['count']==1)
{
$result = $this->Search_doctor_model->set_payment_status($_POST);
$res = array('status' => 'success', 'payment_status'=>'1','message'=>'payment success','booking_date'=>date('d/m/Y',$check_markbooking['booking_date']),'booking_slot'=>$check_markbooking['booking_slot']);
}
else
{
$res = array('status' => 'fail', 'payment_status'=>'0','message'=>'nobooking/alreadypaid');
}
//print_r($res);die();
print json_encode($res);
}
public function doctor_complete_profile_appointments_week_next()
{
$day_appointments = array();
for ($i=0; $i < 7; $i++)
{
$day = date('D',strtotime('+'.$i.'day', strtotime($_POST['enddate'])));
$dayno = date('d',strtotime('+'.$i.'day', strtotime($_POST['enddate'])));
$week_appointments[$i] = $this->Doctor_model->get_doctor_appointments_week($_POST['doctor_id'],date('y-m-d',strtotime('+'.$i.'day', strtotime($_POST['enddate']))));
}
//print_r($week_appointments);
$template['week_appointments'] = $week_appointments;
$template['start_day'] = $_POST['enddate'];
$template['doctorid'] = $_POST['doctor_id'];
$this->load->view('search_doctor_complete_profile_appointments_week',$template);
}
public function doctor_complete_profile_appointments_week_prev()
{
$day_appointments = array();
for ($i=6; $i >=0; $i--)
{ /*date('y-m-d', strtotime('-7 days'))*/
$day = date('D',strtotime('+'.$i.'day', strtotime($_POST['startdate'])));
$dayno = date('d',strtotime('+'.$i.'day', strtotime($_POST['startdate'])));
$week_appointments[$i] = $this->Doctor_model->get_doctor_appointments_week($_POST['doctor_id'],date('y-m-d',strtotime('-'.$i.'day', strtotime($_POST['startdate'],strtotime('-7 days')))));
/*print_r(date('y-m-d',strtotime('-'.$i.'day', strtotime($_POST['startdate'])))); */
}
//print_r($week_appointments);die();
$template['week_appointments'] = $week_appointments;
$template['start_day'] = date('y-m-d',strtotime('-6day', strtotime($_POST['startdate'])));
//print_r($template);die();
$template['doctorid'] = $_POST['doctor_id'];
$this->load->view('search_doctor_complete_profile_appointments_week',$template);
}
}
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Facebook PHP SDK v5 for CodeIgniter 3.x
*
* Library for Facebook PHP SDK v5. It helps the user to login with their Facebook account
* in CodeIgniter application.
*
* This library requires the Facebook PHP SDK v5 and it should be placed in libraries folder.
*
* It also requires facebook configuration file and it should be placed in the config directory.
*
* @package CodeIgniter
* @category Libraries
* @author CodexWorld
* @license http://www.codexworld.com/license/
* @link http://www.codexworld.com
* @version 2.0
*/
// Include the autoloader provided in the SDK
require_once 'facebook-php-sdk/autoload.php';
use Facebook\Facebook as FB;
use Facebook\Authentication\AccessToken;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookSDKException;
use Facebook\Helpers\FacebookJavaScriptHelper;
use Facebook\Helpers\FacebookRedirectLoginHelper;
Class Facebook
{
/**
* @var FB
*/
private $fb;
/**
* @var FacebookRedirectLoginHelper|FacebookJavaScriptHelper
*/
private $helper;
/**
* Facebook constructor.
*/
public function __construct(){
// Load fb config
$this->load->config('facebook');
// Load required libraries and helpers
$this->load->library('session');
$this->load->helper('url');
if (!isset($this->fb)){
$this->fb = new FB([
'app_id' => $this->config->item('facebook_app_id'),
'app_secret' => $this->config->item('facebook_app_secret'),
'default_graph_version' => $this->config->item('facebook_graph_version')
]);
}
// Load correct helper depending on login type
// set in the config file
switch ($this->config->item('facebook_login_type')){
case 'js':
$this->helper = $this->fb->getJavaScriptHelper();
break;
case 'canvas':
$this->helper = $this->fb->getCanvasHelper();
break;
case 'page_tab':
$this->helper = $this->fb->getPageTabHelper();
break;
case 'web':
$this->helper = $this->fb->getRedirectLoginHelper();
break;
}
if ($this->config->item('facebook_auth_on_load') === TRUE){
// Try and authenticate the user right away (get valid access token)
$this->authenticate();
}
}
/**
* @return FB
*/
public function object(){
return $this->fb;
}
/**
* Check whether the user is logged in.
* by access token
*
* @return mixed|boolean
*/
public function is_authenticated(){
$access_token = $this->authenticate();
if(isset($access_token)){
return $access_token;
}
return false;
}
/**
* Do Graph request
*
* @param $method
* @param $endpoint
* @param array $params
* @param null $access_token
*
* @return array
*/
public function request($method, $endpoint, $params = [], $access_token = null){
try{
$response = $this->fb->{strtolower($method)}($endpoint, $params, $access_token);
return $response->getDecodedBody();
}catch(FacebookResponseException $e){
return $this->logError($e->getCode(), $e->getMessage());
}catch (FacebookSDKException $e){
return $this->logError($e->getCode(), $e->getMessage());
}
}
/**
* Generate Facebook login url for web
*
* @return string
*/
public function login_url(){
// Login type must be web, else return empty string
if($this->config->item('facebook_login_type') != 'web'){
return '';
}
// Get login url
return $this->helper->getLoginUrl(
base_url() . $this->config->item('facebook_login_redirect_url'),
$this->config->item('facebook_permissions')
);
}
/**
* Generate Facebook logout url for web
*
* @return string
*/
public function logout_url(){
// Login type must be web, else return empty string
if($this->config->item('facebook_login_type') != 'web'){
return '';
}
// Get logout url
return $this->helper->getLogoutUrl(
$this->get_access_token(),
base_url() . $this->config->item('facebook_logout_redirect_url')
);
}
/**
* Destroy local Facebook session
*/
public function destroy_session(){
$this->session->unset_userdata('fb_access_token');
}
/**
* Get a new access token from Facebook
*
* @return array|AccessToken|null|object|void
*/
private function authenticate(){
$access_token = $this->get_access_token();
if($access_token && $this->get_expire_time() > (time() + 30) || $access_token && !$this->get_expire_time()){
$this->fb->setDefaultAccessToken($access_token);
return $access_token;
}
// If we did not have a stored access token or if it has expired, try get a new access token
if(!$access_token){
try{
$access_token = $this->helper->getAccessToken();
}catch (FacebookSDKException $e){
$this->logError($e->getCode(), $e->getMessage());
return null;
}
// If we got a session we need to exchange it for a long lived session.
if(isset($access_token)){
$access_token = $this->long_lived_token($access_token);
$this->set_expire_time($access_token->getExpiresAt());
$this->set_access_token($access_token);
$this->fb->setDefaultAccessToken($access_token);
return $access_token;
}
}
// Collect errors if any when using web redirect based login
if($this->config->item('facebook_login_type') === 'web'){
if($this->helper->getError()){
// Collect error data
$error = array(
'error' => $this->helper->getError(),
'error_code' => $this->helper->getErrorCode(),
'error_reason' => $this->helper->getErrorReason(),
'error_description' => $this->helper->getErrorDescription()
);
return $error;
}
}
return $access_token;
}
/**
* Exchange short lived token for a long lived token
*
* @param AccessToken $access_token
*
* @return AccessToken|null
*/
private function long_lived_token(AccessToken $access_token){
if(!$access_token->isLongLived()){
$oauth2_client = $this->fb->getOAuth2Client();
try{
return $oauth2_client->getLongLivedAccessToken($access_token);
}catch (FacebookSDKException $e){
$this->logError($e->getCode(), $e->getMessage());
return null;
}
}
return $access_token;
}
/**
* Get stored access token
*
* @return mixed
*/
private function get_access_token(){
return $this->session->userdata('fb_access_token');
}
/**
* Store access token
*
* @param AccessToken $access_token
*/
private function set_access_token(AccessToken $access_token){
$this->session->set_userdata('fb_access_token', $access_token->getValue());
}
/**
* @return mixed
*/
private function get_expire_time(){
return $this->session->userdata('fb_expire');
}
/**
* @param DateTime $time
*/
private function set_expire_time(DateTime $time = null){
if ($time) {
$this->session->set_userdata('fb_expire', $time->getTimestamp());
}
}
/**
* @param $code
* @param $message
*
* @return array
*/
private function logError($code, $message){
log_message('error', '[FACEBOOK PHP SDK] code: ' . $code.' | message: '.$message);
return ['error' => $code, 'message' => $message];
}
/**
* Enables the use of CI super-global without having to define an extra variable.
*
* @param $var
*
* @return mixed
*/
public function __get($var){
return get_instance()->$var;
}
}
\ No newline at end of file
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Authentication;
/**
* Class AccessToken
*
* @package Facebook
*/
class AccessToken
{
/**
* The access token value.
*
* @var string
*/
protected $value = '';
/**
* Date when token expires.
*
* @var \DateTime|null
*/
protected $expiresAt;
/**
* Create a new access token entity.
*
* @param string $accessToken
* @param int $expiresAt
*/
public function __construct($accessToken, $expiresAt = 0)
{
$this->value = $accessToken;
if ($expiresAt) {
$this->setExpiresAtFromTimeStamp($expiresAt);
}
}
/**
* Generate an app secret proof to sign a request to Graph.
*
* @param string $appSecret The app secret.
*
* @return string
*/
public function getAppSecretProof($appSecret)
{
return hash_hmac('sha256', $this->value, $appSecret);
}
/**
* Getter for expiresAt.
*
* @return \DateTime|null
*/
public function getExpiresAt()
{
return $this->expiresAt;
}
/**
* Determines whether or not this is an app access token.
*
* @return bool
*/
public function isAppAccessToken()
{
return strpos($this->value, '|') !== false;
}
/**
* Determines whether or not this is a long-lived token.
*
* @return bool
*/
public function isLongLived()
{
if ($this->expiresAt) {
return $this->expiresAt->getTimestamp() > time() + (60 * 60 * 2);
}
if ($this->isAppAccessToken()) {
return true;
}
return false;
}
/**
* Checks the expiration of the access token.
*
* @return boolean|null
*/
public function isExpired()
{
if ($this->getExpiresAt() instanceof \DateTime) {
return $this->getExpiresAt()->getTimestamp() < time();
}
if ($this->isAppAccessToken()) {
return false;
}
return null;
}
/**
* Returns the access token as a string.
*
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* Returns the access token as a string.
*
* @return string
*/
public function __toString()
{
return $this->getValue();
}
/**
* Setter for expires_at.
*
* @param int $timeStamp
*/
protected function setExpiresAtFromTimeStamp($timeStamp)
{
$dt = new \DateTime();
$dt->setTimestamp($timeStamp);
$this->expiresAt = $dt;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Authentication;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class AccessTokenMetadata
*
* Represents metadata from an access token.
*
* @package Facebook
* @see https://developers.facebook.com/docs/graph-api/reference/debug_token
*/
class AccessTokenMetadata
{
/**
* The access token metadata.
*
* @var array
*/
protected $metadata = [];
/**
* Properties that should be cast as DateTime objects.
*
* @var array
*/
protected static $dateProperties = ['expires_at', 'issued_at'];
/**
* @param array $metadata
*
* @throws FacebookSDKException
*/
public function __construct(array $metadata)
{
if (!isset($metadata['data'])) {
throw new FacebookSDKException('Unexpected debug token response data.', 401);
}
$this->metadata = $metadata['data'];
$this->castTimestampsToDateTime();
}
/**
* Returns a value from the metadata.
*
* @param string $field The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*/
public function getField($field, $default = null)
{
if (isset($this->metadata[$field])) {
return $this->metadata[$field];
}
return $default;
}
/**
* Returns a value from the metadata.
*
* @param string $field The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*
* @deprecated 5.0.0 getProperty() has been renamed to getField()
* @todo v6: Remove this method
*/
public function getProperty($field, $default = null)
{
return $this->getField($field, $default);
}
/**
* Returns a value from a child property in the metadata.
*
* @param string $parentField The parent property.
* @param string $field The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*/
public function getChildProperty($parentField, $field, $default = null)
{
if (!isset($this->metadata[$parentField])) {
return $default;
}
if (!isset($this->metadata[$parentField][$field])) {
return $default;
}
return $this->metadata[$parentField][$field];
}
/**
* Returns a value from the error metadata.
*
* @param string $field The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*/
public function getErrorProperty($field, $default = null)
{
return $this->getChildProperty('error', $field, $default);
}
/**
* Returns a value from the "metadata" metadata. *Brain explodes*
*
* @param string $field The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*/
public function getMetadataProperty($field, $default = null)
{
return $this->getChildProperty('metadata', $field, $default);
}
/**
* The ID of the application this access token is for.
*
* @return string|null
*/
public function getAppId()
{
return $this->getField('app_id');
}
/**
* Name of the application this access token is for.
*
* @return string|null
*/
public function getApplication()
{
return $this->getField('application');
}
/**
* Any error that a request to the graph api
* would return due to the access token.
*
* @return bool|null
*/
public function isError()
{
return $this->getField('error') !== null;
}
/**
* The error code for the error.
*
* @return int|null
*/
public function getErrorCode()
{
return $this->getErrorProperty('code');
}
/**
* The error message for the error.
*
* @return string|null
*/
public function getErrorMessage()
{
return $this->getErrorProperty('message');
}
/**
* The error subcode for the error.
*
* @return int|null
*/
public function getErrorSubcode()
{
return $this->getErrorProperty('subcode');
}
/**
* DateTime when this access token expires.
*
* @return \DateTime|null
*/
public function getExpiresAt()
{
return $this->getField('expires_at');
}
/**
* Whether the access token is still valid or not.
*
* @return boolean|null
*/
public function getIsValid()
{
return $this->getField('is_valid');
}
/**
* DateTime when this access token was issued.
*
* Note that the issued_at field is not returned
* for short-lived access tokens.
*
* @see https://developers.facebook.com/docs/facebook-login/access-tokens#debug
*
* @return \DateTime|null
*/
public function getIssuedAt()
{
return $this->getField('issued_at');
}
/**
* General metadata associated with the access token.
* Can contain data like 'sso', 'auth_type', 'auth_nonce'.
*
* @return array|null
*/
public function getMetadata()
{
return $this->getField('metadata');
}
/**
* The 'sso' child property from the 'metadata' parent property.
*
* @return string|null
*/
public function getSso()
{
return $this->getMetadataProperty('sso');
}
/**
* The 'auth_type' child property from the 'metadata' parent property.
*
* @return string|null
*/
public function getAuthType()
{
return $this->getMetadataProperty('auth_type');
}
/**
* The 'auth_nonce' child property from the 'metadata' parent property.
*
* @return string|null
*/
public function getAuthNonce()
{
return $this->getMetadataProperty('auth_nonce');
}
/**
* For impersonated access tokens, the ID of
* the page this token contains.
*
* @return string|null
*/
public function getProfileId()
{
return $this->getField('profile_id');
}
/**
* List of permissions that the user has granted for
* the app in this access token.
*
* @return array
*/
public function getScopes()
{
return $this->getField('scopes');
}
/**
* The ID of the user this access token is for.
*
* @return string|null
*/
public function getUserId()
{
return $this->getField('user_id');
}
/**
* Ensures the app ID from the access token
* metadata is what we expect.
*
* @param string $appId
*
* @throws FacebookSDKException
*/
public function validateAppId($appId)
{
if ($this->getAppId() !== $appId) {
throw new FacebookSDKException('Access token metadata contains unexpected app ID.', 401);
}
}
/**
* Ensures the user ID from the access token
* metadata is what we expect.
*
* @param string $userId
*
* @throws FacebookSDKException
*/
public function validateUserId($userId)
{
if ($this->getUserId() !== $userId) {
throw new FacebookSDKException('Access token metadata contains unexpected user ID.', 401);
}
}
/**
* Ensures the access token has not expired yet.
*
* @throws FacebookSDKException
*/
public function validateExpiration()
{
if (!$this->getExpiresAt() instanceof \DateTime) {
return;
}
if ($this->getExpiresAt()->getTimestamp() < time()) {
throw new FacebookSDKException('Inspection of access token metadata shows that the access token has expired.', 401);
}
}
/**
* Converts a unix timestamp into a DateTime entity.
*
* @param int $timestamp
*
* @return \DateTime
*/
private function convertTimestampToDateTime($timestamp)
{
$dt = new \DateTime();
$dt->setTimestamp($timestamp);
return $dt;
}
/**
* Casts the unix timestamps as DateTime entities.
*/
private function castTimestampsToDateTime()
{
foreach (static::$dateProperties as $key) {
if (isset($this->metadata[$key]) && $this->metadata[$key] !== 0) {
$this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]);
}
}
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Authentication;
use Facebook\Facebook;
use Facebook\FacebookApp;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookClient;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class OAuth2Client
*
* @package Facebook
*/
class OAuth2Client
{
/**
* @const string The base authorization URL.
*/
const BASE_AUTHORIZATION_URL = 'https://www.facebook.com';
/**
* The FacebookApp entity.
*
* @var FacebookApp
*/
protected $app;
/**
* The Facebook client.
*
* @var FacebookClient
*/
protected $client;
/**
* The version of the Graph API to use.
*
* @var string
*/
protected $graphVersion;
/**
* The last request sent to Graph.
*
* @var FacebookRequest|null
*/
protected $lastRequest;
/**
* @param FacebookApp $app
* @param FacebookClient $client
* @param string|null $graphVersion The version of the Graph API to use.
*/
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
{
$this->app = $app;
$this->client = $client;
$this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
}
/**
* Returns the last FacebookRequest that was sent.
* Useful for debugging and testing.
*
* @return FacebookRequest|null
*/
public function getLastRequest()
{
return $this->lastRequest;
}
/**
* Get the metadata associated with the access token.
*
* @param AccessToken|string $accessToken The access token to debug.
*
* @return AccessTokenMetadata
*/
public function debugToken($accessToken)
{
$accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
$params = ['input_token' => $accessToken];
$this->lastRequest = new FacebookRequest(
$this->app,
$this->app->getAccessToken(),
'GET',
'/debug_token',
$params,
null,
$this->graphVersion
);
$response = $this->client->sendRequest($this->lastRequest);
$metadata = $response->getDecodedBody();
return new AccessTokenMetadata($metadata);
}
/**
* Generates an authorization URL to begin the process of authenticating a user.
*
* @param string $redirectUrl The callback URL to redirect to.
* @param string $state The CSPRNG-generated CSRF value.
* @param array $scope An array of permissions to request.
* @param array $params An array of parameters to generate URL.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*/
public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator = '&')
{
$params += [
'client_id' => $this->app->getId(),
'state' => $state,
'response_type' => 'code',
'sdk' => 'php-sdk-' . Facebook::VERSION,
'redirect_uri' => $redirectUrl,
'scope' => implode(',', $scope)
];
return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator);
}
/**
* Get a valid access token from a code.
*
* @param string $code
* @param string $redirectUri
*
* @return AccessToken
*
* @throws FacebookSDKException
*/
public function getAccessTokenFromCode($code, $redirectUri = '')
{
$params = [
'code' => $code,
'redirect_uri' => $redirectUri,
];
return $this->requestAnAccessToken($params);
}
/**
* Exchanges a short-lived access token with a long-lived access token.
*
* @param AccessToken|string $accessToken
*
* @return AccessToken
*
* @throws FacebookSDKException
*/
public function getLongLivedAccessToken($accessToken)
{
$accessToken = $accessToken instanceof AccessToken ? $accessToken->getValue() : $accessToken;
$params = [
'grant_type' => 'fb_exchange_token',
'fb_exchange_token' => $accessToken,
];
return $this->requestAnAccessToken($params);
}
/**
* Get a valid code from an access token.
*
* @param AccessToken|string $accessToken
* @param string $redirectUri
*
* @return AccessToken
*
* @throws FacebookSDKException
*/
public function getCodeFromLongLivedAccessToken($accessToken, $redirectUri = '')
{
$params = [
'redirect_uri' => $redirectUri,
];
$response = $this->sendRequestWithClientParams('/oauth/client_code', $params, $accessToken);
$data = $response->getDecodedBody();
if (!isset($data['code'])) {
throw new FacebookSDKException('Code was not returned from Graph.', 401);
}
return $data['code'];
}
/**
* Send a request to the OAuth endpoint.
*
* @param array $params
*
* @return AccessToken
*
* @throws FacebookSDKException
*/
protected function requestAnAccessToken(array $params)
{
$response = $this->sendRequestWithClientParams('/oauth/access_token', $params);
$data = $response->getDecodedBody();
if (!isset($data['access_token'])) {
throw new FacebookSDKException('Access token was not returned from Graph.', 401);
}
// Graph returns two different key names for expiration time
// on the same endpoint. Doh! :/
$expiresAt = 0;
if (isset($data['expires'])) {
// For exchanging a short lived token with a long lived token.
// The expiration time in seconds will be returned as "expires".
$expiresAt = time() + $data['expires'];
} elseif (isset($data['expires_in'])) {
// For exchanging a code for a short lived access token.
// The expiration time in seconds will be returned as "expires_in".
// See: https://developers.facebook.com/docs/facebook-login/access-tokens#long-via-code
$expiresAt = time() + $data['expires_in'];
}
return new AccessToken($data['access_token'], $expiresAt);
}
/**
* Send a request to Graph with an app access token.
*
* @param string $endpoint
* @param array $params
* @param AccessToken|string|null $accessToken
*
* @return FacebookResponse
*
* @throws FacebookResponseException
*/
protected function sendRequestWithClientParams($endpoint, array $params, $accessToken = null)
{
$params += $this->getClientParams();
$accessToken = $accessToken ?: $this->app->getAccessToken();
$this->lastRequest = new FacebookRequest(
$this->app,
$accessToken,
'GET',
$endpoint,
$params,
null,
$this->graphVersion
);
return $this->client->sendRequest($this->lastRequest);
}
/**
* Returns the client_* params for OAuth requests.
*
* @return array
*/
protected function getClientParams()
{
return [
'client_id' => $this->app->getId(),
'client_secret' => $this->app->getSecret(),
];
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookAuthenticationException
*
* @package Facebook
*/
class FacebookAuthenticationException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookAuthorizationException
*
* @package Facebook
*/
class FacebookAuthorizationException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookClientException
*
* @package Facebook
*/
class FacebookClientException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookOtherException
*
* @package Facebook
*/
class FacebookOtherException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
use Facebook\FacebookResponse;
/**
* Class FacebookResponseException
*
* @package Facebook
*/
class FacebookResponseException extends FacebookSDKException
{
/**
* @var FacebookResponse The response that threw the exception.
*/
protected $response;
/**
* @var array Decoded response.
*/
protected $responseData;
/**
* Creates a FacebookResponseException.
*
* @param FacebookResponse $response The response that threw the exception.
* @param FacebookSDKException $previousException The more detailed exception.
*/
public function __construct(FacebookResponse $response, FacebookSDKException $previousException = null)
{
$this->response = $response;
$this->responseData = $response->getDecodedBody();
$errorMessage = $this->get('message', 'Unknown error from Graph.');
$errorCode = $this->get('code', -1);
parent::__construct($errorMessage, $errorCode, $previousException);
}
/**
* A factory for creating the appropriate exception based on the response from Graph.
*
* @param FacebookResponse $response The response that threw the exception.
*
* @return FacebookResponseException
*/
public static function create(FacebookResponse $response)
{
$data = $response->getDecodedBody();
if (!isset($data['error']['code']) && isset($data['code'])) {
$data = ['error' => $data];
}
$code = isset($data['error']['code']) ? $data['error']['code'] : null;
$message = isset($data['error']['message']) ? $data['error']['message'] : 'Unknown error from Graph.';
if (isset($data['error']['error_subcode'])) {
switch ($data['error']['error_subcode']) {
// Other authentication issues
case 458:
case 459:
case 460:
case 463:
case 464:
case 467:
return new static($response, new FacebookAuthenticationException($message, $code));
// Video upload resumable error
case 1363030:
case 1363019:
case 1363037:
case 1363033:
case 1363021:
case 1363041:
return new static($response, new FacebookResumableUploadException($message, $code));
}
}
switch ($code) {
// Login status or token expired, revoked, or invalid
case 100:
case 102:
case 190:
return new static($response, new FacebookAuthenticationException($message, $code));
// Server issue, possible downtime
case 1:
case 2:
return new static($response, new FacebookServerException($message, $code));
// API Throttling
case 4:
case 17:
case 341:
return new static($response, new FacebookThrottleException($message, $code));
// Duplicate Post
case 506:
return new static($response, new FacebookClientException($message, $code));
}
// Missing Permissions
if ($code == 10 || ($code >= 200 && $code <= 299)) {
return new static($response, new FacebookAuthorizationException($message, $code));
}
// OAuth authentication error
if (isset($data['error']['type']) && $data['error']['type'] === 'OAuthException') {
return new static($response, new FacebookAuthenticationException($message, $code));
}
// All others
return new static($response, new FacebookOtherException($message, $code));
}
/**
* Checks isset and returns that or a default value.
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
private function get($key, $default = null)
{
if (isset($this->responseData['error'][$key])) {
return $this->responseData['error'][$key];
}
return $default;
}
/**
* Returns the HTTP status code
*
* @return int
*/
public function getHttpStatusCode()
{
return $this->response->getHttpStatusCode();
}
/**
* Returns the sub-error code
*
* @return int
*/
public function getSubErrorCode()
{
return $this->get('error_subcode', -1);
}
/**
* Returns the error type
*
* @return string
*/
public function getErrorType()
{
return $this->get('type', '');
}
/**
* Returns the raw response used to create the exception.
*
* @return string
*/
public function getRawResponse()
{
return $this->response->getBody();
}
/**
* Returns the decoded response used to create the exception.
*
* @return array
*/
public function getResponseData()
{
return $this->responseData;
}
/**
* Returns the response entity used to create the exception.
*
* @return FacebookResponse
*/
public function getResponse()
{
return $this->response;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookResumableUploadException
*
* @package Facebook
*/
class FacebookResumableUploadException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookSDKException
*
* @package Facebook
*/
class FacebookSDKException extends \Exception
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookServerException
*
* @package Facebook
*/
class FacebookServerException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Exceptions;
/**
* Class FacebookThrottleException
*
* @package Facebook
*/
class FacebookThrottleException extends FacebookSDKException
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\Authentication\AccessToken;
use Facebook\Authentication\OAuth2Client;
use Facebook\FileUpload\FacebookFile;
use Facebook\FileUpload\FacebookResumableUploader;
use Facebook\FileUpload\FacebookTransferChunk;
use Facebook\FileUpload\FacebookVideo;
use Facebook\GraphNodes\GraphEdge;
use Facebook\Url\UrlDetectionInterface;
use Facebook\Url\FacebookUrlDetectionHandler;
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorFactory;
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
use Facebook\HttpClients\HttpClientsFactory;
use Facebook\PersistentData\PersistentDataFactory;
use Facebook\PersistentData\PersistentDataInterface;
use Facebook\Helpers\FacebookCanvasHelper;
use Facebook\Helpers\FacebookJavaScriptHelper;
use Facebook\Helpers\FacebookPageTabHelper;
use Facebook\Helpers\FacebookRedirectLoginHelper;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class Facebook
*
* @package Facebook
*/
class Facebook
{
/**
* @const string Version number of the Facebook PHP SDK.
*/
const VERSION = '5.6.1';
/**
* @const string Default Graph API version for requests.
*/
const DEFAULT_GRAPH_VERSION = 'v2.10';
/**
* @const string The name of the environment variable that contains the app ID.
*/
const APP_ID_ENV_NAME = 'FACEBOOK_APP_ID';
/**
* @const string The name of the environment variable that contains the app secret.
*/
const APP_SECRET_ENV_NAME = 'FACEBOOK_APP_SECRET';
/**
* @var FacebookApp The FacebookApp entity.
*/
protected $app;
/**
* @var FacebookClient The Facebook client service.
*/
protected $client;
/**
* @var OAuth2Client The OAuth 2.0 client service.
*/
protected $oAuth2Client;
/**
* @var UrlDetectionInterface|null The URL detection handler.
*/
protected $urlDetectionHandler;
/**
* @var PseudoRandomStringGeneratorInterface|null The cryptographically secure pseudo-random string generator.
*/
protected $pseudoRandomStringGenerator;
/**
* @var AccessToken|null The default access token to use with requests.
*/
protected $defaultAccessToken;
/**
* @var string|null The default Graph version we want to use.
*/
protected $defaultGraphVersion;
/**
* @var PersistentDataInterface|null The persistent data handler.
*/
protected $persistentDataHandler;
/**
* @var FacebookResponse|FacebookBatchResponse|null Stores the last request made to Graph.
*/
protected $lastResponse;
/**
* Instantiates a new Facebook super-class object.
*
* @param array $config
*
* @throws FacebookSDKException
*/
public function __construct(array $config = [])
{
$config = array_merge([
'app_id' => getenv(static::APP_ID_ENV_NAME),
'app_secret' => getenv(static::APP_SECRET_ENV_NAME),
'default_graph_version' => static::DEFAULT_GRAPH_VERSION,
'enable_beta_mode' => false,
'http_client_handler' => null,
'persistent_data_handler' => null,
'pseudo_random_string_generator' => null,
'url_detection_handler' => null,
], $config);
if (!$config['app_id']) {
throw new FacebookSDKException('Required "app_id" key not supplied in config and could not find fallback environment variable "' . static::APP_ID_ENV_NAME . '"');
}
if (!$config['app_secret']) {
throw new FacebookSDKException('Required "app_secret" key not supplied in config and could not find fallback environment variable "' . static::APP_SECRET_ENV_NAME . '"');
}
$this->app = new FacebookApp($config['app_id'], $config['app_secret']);
$this->client = new FacebookClient(
HttpClientsFactory::createHttpClient($config['http_client_handler']),
$config['enable_beta_mode']
);
$this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator(
$config['pseudo_random_string_generator']
);
$this->setUrlDetectionHandler($config['url_detection_handler'] ?: new FacebookUrlDetectionHandler());
$this->persistentDataHandler = PersistentDataFactory::createPersistentDataHandler(
$config['persistent_data_handler']
);
if (isset($config['default_access_token'])) {
$this->setDefaultAccessToken($config['default_access_token']);
}
// @todo v6: Throw an InvalidArgumentException if "default_graph_version" is not set
$this->defaultGraphVersion = $config['default_graph_version'];
}
/**
* Returns the FacebookApp entity.
*
* @return FacebookApp
*/
public function getApp()
{
return $this->app;
}
/**
* Returns the FacebookClient service.
*
* @return FacebookClient
*/
public function getClient()
{
return $this->client;
}
/**
* Returns the OAuth 2.0 client service.
*
* @return OAuth2Client
*/
public function getOAuth2Client()
{
if (!$this->oAuth2Client instanceof OAuth2Client) {
$app = $this->getApp();
$client = $this->getClient();
$this->oAuth2Client = new OAuth2Client($app, $client, $this->defaultGraphVersion);
}
return $this->oAuth2Client;
}
/**
* Returns the last response returned from Graph.
*
* @return FacebookResponse|FacebookBatchResponse|null
*/
public function getLastResponse()
{
return $this->lastResponse;
}
/**
* Returns the URL detection handler.
*
* @return UrlDetectionInterface
*/
public function getUrlDetectionHandler()
{
return $this->urlDetectionHandler;
}
/**
* Changes the URL detection handler.
*
* @param UrlDetectionInterface $urlDetectionHandler
*/
private function setUrlDetectionHandler(UrlDetectionInterface $urlDetectionHandler)
{
$this->urlDetectionHandler = $urlDetectionHandler;
}
/**
* Returns the default AccessToken entity.
*
* @return AccessToken|null
*/
public function getDefaultAccessToken()
{
return $this->defaultAccessToken;
}
/**
* Sets the default access token to use with requests.
*
* @param AccessToken|string $accessToken The access token to save.
*
* @throws \InvalidArgumentException
*/
public function setDefaultAccessToken($accessToken)
{
if (is_string($accessToken)) {
$this->defaultAccessToken = new AccessToken($accessToken);
return;
}
if ($accessToken instanceof AccessToken) {
$this->defaultAccessToken = $accessToken;
return;
}
throw new \InvalidArgumentException('The default access token must be of type "string" or Facebook\AccessToken');
}
/**
* Returns the default Graph version.
*
* @return string
*/
public function getDefaultGraphVersion()
{
return $this->defaultGraphVersion;
}
/**
* Returns the redirect login helper.
*
* @return FacebookRedirectLoginHelper
*/
public function getRedirectLoginHelper()
{
return new FacebookRedirectLoginHelper(
$this->getOAuth2Client(),
$this->persistentDataHandler,
$this->urlDetectionHandler,
$this->pseudoRandomStringGenerator
);
}
/**
* Returns the JavaScript helper.
*
* @return FacebookJavaScriptHelper
*/
public function getJavaScriptHelper()
{
return new FacebookJavaScriptHelper($this->app, $this->client, $this->defaultGraphVersion);
}
/**
* Returns the canvas helper.
*
* @return FacebookCanvasHelper
*/
public function getCanvasHelper()
{
return new FacebookCanvasHelper($this->app, $this->client, $this->defaultGraphVersion);
}
/**
* Returns the page tab helper.
*
* @return FacebookPageTabHelper
*/
public function getPageTabHelper()
{
return new FacebookPageTabHelper($this->app, $this->client, $this->defaultGraphVersion);
}
/**
* Sends a GET request to Graph and returns the result.
*
* @param string $endpoint
* @param AccessToken|string|null $accessToken
* @param string|null $eTag
* @param string|null $graphVersion
*
* @return FacebookResponse
*
* @throws FacebookSDKException
*/
public function get($endpoint, $accessToken = null, $eTag = null, $graphVersion = null)
{
return $this->sendRequest(
'GET',
$endpoint,
$params = [],
$accessToken,
$eTag,
$graphVersion
);
}
/**
* Sends a POST request to Graph and returns the result.
*
* @param string $endpoint
* @param array $params
* @param AccessToken|string|null $accessToken
* @param string|null $eTag
* @param string|null $graphVersion
*
* @return FacebookResponse
*
* @throws FacebookSDKException
*/
public function post($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
return $this->sendRequest(
'POST',
$endpoint,
$params,
$accessToken,
$eTag,
$graphVersion
);
}
/**
* Sends a DELETE request to Graph and returns the result.
*
* @param string $endpoint
* @param array $params
* @param AccessToken|string|null $accessToken
* @param string|null $eTag
* @param string|null $graphVersion
*
* @return FacebookResponse
*
* @throws FacebookSDKException
*/
public function delete($endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
return $this->sendRequest(
'DELETE',
$endpoint,
$params,
$accessToken,
$eTag,
$graphVersion
);
}
/**
* Sends a request to Graph for the next page of results.
*
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
*
* @return GraphEdge|null
*
* @throws FacebookSDKException
*/
public function next(GraphEdge $graphEdge)
{
return $this->getPaginationResults($graphEdge, 'next');
}
/**
* Sends a request to Graph for the previous page of results.
*
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
*
* @return GraphEdge|null
*
* @throws FacebookSDKException
*/
public function previous(GraphEdge $graphEdge)
{
return $this->getPaginationResults($graphEdge, 'previous');
}
/**
* Sends a request to Graph for the next page of results.
*
* @param GraphEdge $graphEdge The GraphEdge to paginate over.
* @param string $direction The direction of the pagination: next|previous.
*
* @return GraphEdge|null
*
* @throws FacebookSDKException
*/
public function getPaginationResults(GraphEdge $graphEdge, $direction)
{
$paginationRequest = $graphEdge->getPaginationRequest($direction);
if (!$paginationRequest) {
return null;
}
$this->lastResponse = $this->client->sendRequest($paginationRequest);
// Keep the same GraphNode subclass
$subClassName = $graphEdge->getSubClassName();
$graphEdge = $this->lastResponse->getGraphEdge($subClassName, false);
return count($graphEdge) > 0 ? $graphEdge : null;
}
/**
* Sends a request to Graph and returns the result.
*
* @param string $method
* @param string $endpoint
* @param array $params
* @param AccessToken|string|null $accessToken
* @param string|null $eTag
* @param string|null $graphVersion
*
* @return FacebookResponse
*
* @throws FacebookSDKException
*/
public function sendRequest($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
$request = $this->request($method, $endpoint, $params, $accessToken, $eTag, $graphVersion);
return $this->lastResponse = $this->client->sendRequest($request);
}
/**
* Sends a batched request to Graph and returns the result.
*
* @param array $requests
* @param AccessToken|string|null $accessToken
* @param string|null $graphVersion
*
* @return FacebookBatchResponse
*
* @throws FacebookSDKException
*/
public function sendBatchRequest(array $requests, $accessToken = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
$batchRequest = new FacebookBatchRequest(
$this->app,
$requests,
$accessToken,
$graphVersion
);
return $this->lastResponse = $this->client->sendBatchRequest($batchRequest);
}
/**
* Instantiates an empty FacebookBatchRequest entity.
*
* @param AccessToken|string|null $accessToken The top-level access token. Requests with no access token
* will fallback to this.
* @param string|null $graphVersion The Graph API version to use.
* @return FacebookBatchRequest
*/
public function newBatchRequest($accessToken = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
return new FacebookBatchRequest(
$this->app,
[],
$accessToken,
$graphVersion
);
}
/**
* Instantiates a new FacebookRequest entity.
*
* @param string $method
* @param string $endpoint
* @param array $params
* @param AccessToken|string|null $accessToken
* @param string|null $eTag
* @param string|null $graphVersion
*
* @return FacebookRequest
*
* @throws FacebookSDKException
*/
public function request($method, $endpoint, array $params = [], $accessToken = null, $eTag = null, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
return new FacebookRequest(
$this->app,
$accessToken,
$method,
$endpoint,
$params,
$eTag,
$graphVersion
);
}
/**
* Factory to create FacebookFile's.
*
* @param string $pathToFile
*
* @return FacebookFile
*
* @throws FacebookSDKException
*/
public function fileToUpload($pathToFile)
{
return new FacebookFile($pathToFile);
}
/**
* Factory to create FacebookVideo's.
*
* @param string $pathToFile
*
* @return FacebookVideo
*
* @throws FacebookSDKException
*/
public function videoToUpload($pathToFile)
{
return new FacebookVideo($pathToFile);
}
/**
* Upload a video in chunks.
*
* @param int $target The id of the target node before the /videos edge.
* @param string $pathToFile The full path to the file.
* @param array $metadata The metadata associated with the video file.
* @param string|null $accessToken The access token.
* @param int $maxTransferTries The max times to retry a failed upload chunk.
* @param string|null $graphVersion The Graph API version to use.
*
* @return array
*
* @throws FacebookSDKException
*/
public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
$uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
$endpoint = '/'.$target.'/videos';
$file = $this->videoToUpload($pathToFile);
$chunk = $uploader->start($endpoint, $file);
do {
$chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries);
} while (!$chunk->isLastChunk());
return [
'video_id' => $chunk->getVideoId(),
'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
];
}
/**
* Attempts to upload a chunk of a file in $retryCountdown tries.
*
* @param FacebookResumableUploader $uploader
* @param string $endpoint
* @param FacebookTransferChunk $chunk
* @param int $retryCountdown
*
* @return FacebookTransferChunk
*
* @throws FacebookSDKException
*/
private function maxTriesTransfer(FacebookResumableUploader $uploader, $endpoint, FacebookTransferChunk $chunk, $retryCountdown)
{
$newChunk = $uploader->transfer($endpoint, $chunk, $retryCountdown < 1);
if ($newChunk !== $chunk) {
return $newChunk;
}
$retryCountdown--;
// If transfer() returned the same chunk entity, the transfer failed but is resumable.
return $this->maxTriesTransfer($uploader, $endpoint, $chunk, $retryCountdown);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\Authentication\AccessToken;
use Facebook\Exceptions\FacebookSDKException;
class FacebookApp implements \Serializable
{
/**
* @var string The app ID.
*/
protected $id;
/**
* @var string The app secret.
*/
protected $secret;
/**
* @param string $id
* @param string $secret
*
* @throws FacebookSDKException
*/
public function __construct($id, $secret)
{
if (!is_string($id)
// Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false
&& !is_int($id)) {
throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.');
}
// We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system
$this->id = (string) $id;
$this->secret = $secret;
}
/**
* Returns the app ID.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Returns the app secret.
*
* @return string
*/
public function getSecret()
{
return $this->secret;
}
/**
* Returns an app access token.
*
* @return AccessToken
*/
public function getAccessToken()
{
return new AccessToken($this->id . '|' . $this->secret);
}
/**
* Serializes the FacebookApp entity as a string.
*
* @return string
*/
public function serialize()
{
return implode('|', [$this->id, $this->secret]);
}
/**
* Unserializes a string as a FacebookApp entity.
*
* @param string $serialized
*/
public function unserialize($serialized)
{
list($id, $secret) = explode('|', $serialized);
$this->__construct($id, $secret);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use ArrayIterator;
use IteratorAggregate;
use ArrayAccess;
use Facebook\Authentication\AccessToken;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class BatchRequest
*
* @package Facebook
*/
class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, ArrayAccess
{
/**
* @var array An array of FacebookRequest entities to send.
*/
protected $requests;
/**
* @var array An array of files to upload.
*/
protected $attachedFiles;
/**
* Creates a new Request entity.
*
* @param FacebookApp|null $app
* @param array $requests
* @param AccessToken|string|null $accessToken
* @param string|null $graphVersion
*/
public function __construct(FacebookApp $app = null, array $requests = [], $accessToken = null, $graphVersion = null)
{
parent::__construct($app, $accessToken, 'POST', '', [], null, $graphVersion);
$this->add($requests);
}
/**
* Adds a new request to the array.
*
* @param FacebookRequest|array $request
* @param string|null|array $options Array of batch request options e.g. 'name', 'omit_response_on_success'.
* If a string is given, it is the value of the 'name' option.
*
* @return FacebookBatchRequest
*
* @throws \InvalidArgumentException
*/
public function add($request, $options = null)
{
if (is_array($request)) {
foreach ($request as $key => $req) {
$this->add($req, $key);
}
return $this;
}
if (!$request instanceof FacebookRequest) {
throw new \InvalidArgumentException('Argument for add() must be of type array or FacebookRequest.');
}
if (null === $options) {
$options = [];
} elseif (!is_array($options)) {
$options = ['name' => $options];
}
$this->addFallbackDefaults($request);
// File uploads
$attachedFiles = $this->extractFileAttachments($request);
$name = isset($options['name']) ? $options['name'] : null;
unset($options['name']);
$requestToAdd = [
'name' => $name,
'request' => $request,
'options' => $options,
'attached_files' => $attachedFiles,
];
$this->requests[] = $requestToAdd;
return $this;
}
/**
* Ensures that the FacebookApp and access token fall back when missing.
*
* @param FacebookRequest $request
*
* @throws FacebookSDKException
*/
public function addFallbackDefaults(FacebookRequest $request)
{
if (!$request->getApp()) {
$app = $this->getApp();
if (!$app) {
throw new FacebookSDKException('Missing FacebookApp on FacebookRequest and no fallback detected on FacebookBatchRequest.');
}
$request->setApp($app);
}
if (!$request->getAccessToken()) {
$accessToken = $this->getAccessToken();
if (!$accessToken) {
throw new FacebookSDKException('Missing access token on FacebookRequest and no fallback detected on FacebookBatchRequest.');
}
$request->setAccessToken($accessToken);
}
}
/**
* Extracts the files from a request.
*
* @param FacebookRequest $request
*
* @return string|null
*
* @throws FacebookSDKException
*/
public function extractFileAttachments(FacebookRequest $request)
{
if (!$request->containsFileUploads()) {
return null;
}
$files = $request->getFiles();
$fileNames = [];
foreach ($files as $file) {
$fileName = uniqid();
$this->addFile($fileName, $file);
$fileNames[] = $fileName;
}
$request->resetFiles();
// @TODO Does Graph support multiple uploads on one endpoint?
return implode(',', $fileNames);
}
/**
* Return the FacebookRequest entities.
*
* @return array
*/
public function getRequests()
{
return $this->requests;
}
/**
* Prepares the requests to be sent as a batch request.
*/
public function prepareRequestsForBatch()
{
$this->validateBatchRequestCount();
$params = [
'batch' => $this->convertRequestsToJson(),
'include_headers' => true,
];
$this->setParams($params);
}
/**
* Converts the requests into a JSON(P) string.
*
* @return string
*/
public function convertRequestsToJson()
{
$requests = [];
foreach ($this->requests as $request) {
$options = [];
if (null !== $request['name']) {
$options['name'] = $request['name'];
}
$options += $request['options'];
$requests[] = $this->requestEntityToBatchArray($request['request'], $options, $request['attached_files']);
}
return json_encode($requests);
}
/**
* Validate the request count before sending them as a batch.
*
* @throws FacebookSDKException
*/
public function validateBatchRequestCount()
{
$batchCount = count($this->requests);
if ($batchCount === 0) {
throw new FacebookSDKException('There are no batch requests to send.');
} elseif ($batchCount > 50) {
// Per: https://developers.facebook.com/docs/graph-api/making-multiple-requests#limits
throw new FacebookSDKException('You cannot send more than 50 batch requests at a time.');
}
}
/**
* Converts a Request entity into an array that is batch-friendly.
*
* @param FacebookRequest $request The request entity to convert.
* @param string|null|array $options Array of batch request options e.g. 'name', 'omit_response_on_success'.
* If a string is given, it is the value of the 'name' option.
* @param string|null $attachedFiles Names of files associated with the request.
*
* @return array
*/
public function requestEntityToBatchArray(FacebookRequest $request, $options = null, $attachedFiles = null)
{
if (null === $options) {
$options = [];
} elseif (!is_array($options)) {
$options = ['name' => $options];
}
$compiledHeaders = [];
$headers = $request->getHeaders();
foreach ($headers as $name => $value) {
$compiledHeaders[] = $name . ': ' . $value;
}
$batch = [
'headers' => $compiledHeaders,
'method' => $request->getMethod(),
'relative_url' => $request->getUrl(),
];
// Since file uploads are moved to the root request of a batch request,
// the child requests will always be URL-encoded.
$body = $request->getUrlEncodedBody()->getBody();
if ($body) {
$batch['body'] = $body;
}
$batch += $options;
if (null !== $attachedFiles) {
$batch['attached_files'] = $attachedFiles;
}
return $batch;
}
/**
* Get an iterator for the items.
*
* @return ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->requests);
}
/**
* @inheritdoc
*/
public function offsetSet($offset, $value)
{
$this->add($value, $offset);
}
/**
* @inheritdoc
*/
public function offsetExists($offset)
{
return isset($this->requests[$offset]);
}
/**
* @inheritdoc
*/
public function offsetUnset($offset)
{
unset($this->requests[$offset]);
}
/**
* @inheritdoc
*/
public function offsetGet($offset)
{
return isset($this->requests[$offset]) ? $this->requests[$offset] : null;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use ArrayIterator;
use IteratorAggregate;
use ArrayAccess;
/**
* Class FacebookBatchResponse
*
* @package Facebook
*/
class FacebookBatchResponse extends FacebookResponse implements IteratorAggregate, ArrayAccess
{
/**
* @var FacebookBatchRequest The original entity that made the batch request.
*/
protected $batchRequest;
/**
* @var array An array of FacebookResponse entities.
*/
protected $responses = [];
/**
* Creates a new Response entity.
*
* @param FacebookBatchRequest $batchRequest
* @param FacebookResponse $response
*/
public function __construct(FacebookBatchRequest $batchRequest, FacebookResponse $response)
{
$this->batchRequest = $batchRequest;
$request = $response->getRequest();
$body = $response->getBody();
$httpStatusCode = $response->getHttpStatusCode();
$headers = $response->getHeaders();
parent::__construct($request, $body, $httpStatusCode, $headers);
$responses = $response->getDecodedBody();
$this->setResponses($responses);
}
/**
* Returns an array of FacebookResponse entities.
*
* @return array
*/
public function getResponses()
{
return $this->responses;
}
/**
* The main batch response will be an array of requests so
* we need to iterate over all the responses.
*
* @param array $responses
*/
public function setResponses(array $responses)
{
$this->responses = [];
foreach ($responses as $key => $graphResponse) {
$this->addResponse($key, $graphResponse);
}
}
/**
* Add a response to the list.
*
* @param int $key
* @param array|null $response
*/
public function addResponse($key, $response)
{
$originalRequestName = isset($this->batchRequest[$key]['name']) ? $this->batchRequest[$key]['name'] : $key;
$originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : null;
$httpResponseBody = isset($response['body']) ? $response['body'] : null;
$httpResponseCode = isset($response['code']) ? $response['code'] : null;
// @TODO With PHP 5.5 support, this becomes array_column($response['headers'], 'value', 'name')
$httpResponseHeaders = isset($response['headers']) ? $this->normalizeBatchHeaders($response['headers']) : [];
$this->responses[$originalRequestName] = new FacebookResponse(
$originalRequest,
$httpResponseBody,
$httpResponseCode,
$httpResponseHeaders
);
}
/**
* @inheritdoc
*/
public function getIterator()
{
return new ArrayIterator($this->responses);
}
/**
* @inheritdoc
*/
public function offsetSet($offset, $value)
{
$this->addResponse($offset, $value);
}
/**
* @inheritdoc
*/
public function offsetExists($offset)
{
return isset($this->responses[$offset]);
}
/**
* @inheritdoc
*/
public function offsetUnset($offset)
{
unset($this->responses[$offset]);
}
/**
* @inheritdoc
*/
public function offsetGet($offset)
{
return isset($this->responses[$offset]) ? $this->responses[$offset] : null;
}
/**
* Converts the batch header array into a standard format.
* @TODO replace with array_column() when PHP 5.5 is supported.
*
* @param array $batchHeaders
*
* @return array
*/
private function normalizeBatchHeaders(array $batchHeaders)
{
$headers = [];
foreach ($batchHeaders as $header) {
$headers[$header['name']] = $header['value'];
}
return $headers;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\HttpClients\FacebookHttpClientInterface;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\HttpClients\FacebookStreamHttpClient;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class FacebookClient
*
* @package Facebook
*/
class FacebookClient
{
/**
* @const string Production Graph API URL.
*/
const BASE_GRAPH_URL = 'https://graph.facebook.com';
/**
* @const string Graph API URL for video uploads.
*/
const BASE_GRAPH_VIDEO_URL = 'https://graph-video.facebook.com';
/**
* @const string Beta Graph API URL.
*/
const BASE_GRAPH_URL_BETA = 'https://graph.beta.facebook.com';
/**
* @const string Beta Graph API URL for video uploads.
*/
const BASE_GRAPH_VIDEO_URL_BETA = 'https://graph-video.beta.facebook.com';
/**
* @const int The timeout in seconds for a normal request.
*/
const DEFAULT_REQUEST_TIMEOUT = 60;
/**
* @const int The timeout in seconds for a request that contains file uploads.
*/
const DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT = 3600;
/**
* @const int The timeout in seconds for a request that contains video uploads.
*/
const DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT = 7200;
/**
* @var bool Toggle to use Graph beta url.
*/
protected $enableBetaMode = false;
/**
* @var FacebookHttpClientInterface HTTP client handler.
*/
protected $httpClientHandler;
/**
* @var int The number of calls that have been made to Graph.
*/
public static $requestCount = 0;
/**
* Instantiates a new FacebookClient object.
*
* @param FacebookHttpClientInterface|null $httpClientHandler
* @param boolean $enableBeta
*/
public function __construct(FacebookHttpClientInterface $httpClientHandler = null, $enableBeta = false)
{
$this->httpClientHandler = $httpClientHandler ?: $this->detectHttpClientHandler();
$this->enableBetaMode = $enableBeta;
}
/**
* Sets the HTTP client handler.
*
* @param FacebookHttpClientInterface $httpClientHandler
*/
public function setHttpClientHandler(FacebookHttpClientInterface $httpClientHandler)
{
$this->httpClientHandler = $httpClientHandler;
}
/**
* Returns the HTTP client handler.
*
* @return FacebookHttpClientInterface
*/
public function getHttpClientHandler()
{
return $this->httpClientHandler;
}
/**
* Detects which HTTP client handler to use.
*
* @return FacebookHttpClientInterface
*/
public function detectHttpClientHandler()
{
return extension_loaded('curl') ? new FacebookCurlHttpClient() : new FacebookStreamHttpClient();
}
/**
* Toggle beta mode.
*
* @param boolean $betaMode
*/
public function enableBetaMode($betaMode = true)
{
$this->enableBetaMode = $betaMode;
}
/**
* Returns the base Graph URL.
*
* @param boolean $postToVideoUrl Post to the video API if videos are being uploaded.
*
* @return string
*/
public function getBaseGraphUrl($postToVideoUrl = false)
{
if ($postToVideoUrl) {
return $this->enableBetaMode ? static::BASE_GRAPH_VIDEO_URL_BETA : static::BASE_GRAPH_VIDEO_URL;
}
return $this->enableBetaMode ? static::BASE_GRAPH_URL_BETA : static::BASE_GRAPH_URL;
}
/**
* Prepares the request for sending to the client handler.
*
* @param FacebookRequest $request
*
* @return array
*/
public function prepareRequestMessage(FacebookRequest $request)
{
$postToVideoUrl = $request->containsVideoUploads();
$url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl();
// If we're sending files they should be sent as multipart/form-data
if ($request->containsFileUploads()) {
$requestBody = $request->getMultipartBody();
$request->setHeaders([
'Content-Type' => 'multipart/form-data; boundary=' . $requestBody->getBoundary(),
]);
} else {
$requestBody = $request->getUrlEncodedBody();
$request->setHeaders([
'Content-Type' => 'application/x-www-form-urlencoded',
]);
}
return [
$url,
$request->getMethod(),
$request->getHeaders(),
$requestBody->getBody(),
];
}
/**
* Makes the request to Graph and returns the result.
*
* @param FacebookRequest $request
*
* @return FacebookResponse
*
* @throws FacebookSDKException
*/
public function sendRequest(FacebookRequest $request)
{
if (get_class($request) === 'Facebook\FacebookRequest') {
$request->validateAccessToken();
}
list($url, $method, $headers, $body) = $this->prepareRequestMessage($request);
// Since file uploads can take a while, we need to give more time for uploads
$timeOut = static::DEFAULT_REQUEST_TIMEOUT;
if ($request->containsFileUploads()) {
$timeOut = static::DEFAULT_FILE_UPLOAD_REQUEST_TIMEOUT;
} elseif ($request->containsVideoUploads()) {
$timeOut = static::DEFAULT_VIDEO_UPLOAD_REQUEST_TIMEOUT;
}
// Should throw `FacebookSDKException` exception on HTTP client error.
// Don't catch to allow it to bubble up.
$rawResponse = $this->httpClientHandler->send($url, $method, $body, $headers, $timeOut);
static::$requestCount++;
$returnResponse = new FacebookResponse(
$request,
$rawResponse->getBody(),
$rawResponse->getHttpResponseCode(),
$rawResponse->getHeaders()
);
if ($returnResponse->isError()) {
throw $returnResponse->getThrownException();
}
return $returnResponse;
}
/**
* Makes a batched request to Graph and returns the result.
*
* @param FacebookBatchRequest $request
*
* @return FacebookBatchResponse
*
* @throws FacebookSDKException
*/
public function sendBatchRequest(FacebookBatchRequest $request)
{
$request->prepareRequestsForBatch();
$facebookResponse = $this->sendRequest($request);
return new FacebookBatchResponse($request, $facebookResponse);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\Authentication\AccessToken;
use Facebook\Url\FacebookUrlManipulator;
use Facebook\FileUpload\FacebookFile;
use Facebook\FileUpload\FacebookVideo;
use Facebook\Http\RequestBodyMultipart;
use Facebook\Http\RequestBodyUrlEncoded;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class Request
*
* @package Facebook
*/
class FacebookRequest
{
/**
* @var FacebookApp The Facebook app entity.
*/
protected $app;
/**
* @var string|null The access token to use for this request.
*/
protected $accessToken;
/**
* @var string The HTTP method for this request.
*/
protected $method;
/**
* @var string The Graph endpoint for this request.
*/
protected $endpoint;
/**
* @var array The headers to send with this request.
*/
protected $headers = [];
/**
* @var array The parameters to send with this request.
*/
protected $params = [];
/**
* @var array The files to send with this request.
*/
protected $files = [];
/**
* @var string ETag to send with this request.
*/
protected $eTag;
/**
* @var string Graph version to use for this request.
*/
protected $graphVersion;
/**
* Creates a new Request entity.
*
* @param FacebookApp|null $app
* @param AccessToken|string|null $accessToken
* @param string|null $method
* @param string|null $endpoint
* @param array|null $params
* @param string|null $eTag
* @param string|null $graphVersion
*/
public function __construct(FacebookApp $app = null, $accessToken = null, $method = null, $endpoint = null, array $params = [], $eTag = null, $graphVersion = null)
{
$this->setApp($app);
$this->setAccessToken($accessToken);
$this->setMethod($method);
$this->setEndpoint($endpoint);
$this->setParams($params);
$this->setETag($eTag);
$this->graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
}
/**
* Set the access token for this request.
*
* @param AccessToken|string|null
*
* @return FacebookRequest
*/
public function setAccessToken($accessToken)
{
$this->accessToken = $accessToken;
if ($accessToken instanceof AccessToken) {
$this->accessToken = $accessToken->getValue();
}
return $this;
}
/**
* Sets the access token with one harvested from a URL or POST params.
*
* @param string $accessToken The access token.
*
* @return FacebookRequest
*
* @throws FacebookSDKException
*/
public function setAccessTokenFromParams($accessToken)
{
$existingAccessToken = $this->getAccessToken();
if (!$existingAccessToken) {
$this->setAccessToken($accessToken);
} elseif ($accessToken !== $existingAccessToken) {
throw new FacebookSDKException('Access token mismatch. The access token provided in the FacebookRequest and the one provided in the URL or POST params do not match.');
}
return $this;
}
/**
* Return the access token for this request.
*
* @return string|null
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* Return the access token for this request as an AccessToken entity.
*
* @return AccessToken|null
*/
public function getAccessTokenEntity()
{
return $this->accessToken ? new AccessToken($this->accessToken) : null;
}
/**
* Set the FacebookApp entity used for this request.
*
* @param FacebookApp|null $app
*/
public function setApp(FacebookApp $app = null)
{
$this->app = $app;
}
/**
* Return the FacebookApp entity used for this request.
*
* @return FacebookApp
*/
public function getApp()
{
return $this->app;
}
/**
* Generate an app secret proof to sign this request.
*
* @return string|null
*/
public function getAppSecretProof()
{
if (!$accessTokenEntity = $this->getAccessTokenEntity()) {
return null;
}
return $accessTokenEntity->getAppSecretProof($this->app->getSecret());
}
/**
* Validate that an access token exists for this request.
*
* @throws FacebookSDKException
*/
public function validateAccessToken()
{
$accessToken = $this->getAccessToken();
if (!$accessToken) {
throw new FacebookSDKException('You must provide an access token.');
}
}
/**
* Set the HTTP method for this request.
*
* @param string
*/
public function setMethod($method)
{
$this->method = strtoupper($method);
}
/**
* Return the HTTP method for this request.
*
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* Validate that the HTTP method is set.
*
* @throws FacebookSDKException
*/
public function validateMethod()
{
if (!$this->method) {
throw new FacebookSDKException('HTTP method not specified.');
}
if (!in_array($this->method, ['GET', 'POST', 'DELETE'])) {
throw new FacebookSDKException('Invalid HTTP method specified.');
}
}
/**
* Set the endpoint for this request.
*
* @param string
*
* @return FacebookRequest
*
* @throws FacebookSDKException
*/
public function setEndpoint($endpoint)
{
// Harvest the access token from the endpoint to keep things in sync
$params = FacebookUrlManipulator::getParamsAsArray($endpoint);
if (isset($params['access_token'])) {
$this->setAccessTokenFromParams($params['access_token']);
}
// Clean the token & app secret proof from the endpoint.
$filterParams = ['access_token', 'appsecret_proof'];
$this->endpoint = FacebookUrlManipulator::removeParamsFromUrl($endpoint, $filterParams);
return $this;
}
/**
* Return the endpoint for this request.
*
* @return string
*/
public function getEndpoint()
{
// For batch requests, this will be empty
return $this->endpoint;
}
/**
* Generate and return the headers for this request.
*
* @return array
*/
public function getHeaders()
{
$headers = static::getDefaultHeaders();
if ($this->eTag) {
$headers['If-None-Match'] = $this->eTag;
}
return array_merge($this->headers, $headers);
}
/**
* Set the headers for this request.
*
* @param array $headers
*/
public function setHeaders(array $headers)
{
$this->headers = array_merge($this->headers, $headers);
}
/**
* Sets the eTag value.
*
* @param string $eTag
*/
public function setETag($eTag)
{
$this->eTag = $eTag;
}
/**
* Set the params for this request.
*
* @param array $params
*
* @return FacebookRequest
*
* @throws FacebookSDKException
*/
public function setParams(array $params = [])
{
if (isset($params['access_token'])) {
$this->setAccessTokenFromParams($params['access_token']);
}
// Don't let these buggers slip in.
unset($params['access_token'], $params['appsecret_proof']);
// @TODO Refactor code above with this
//$params = $this->sanitizeAuthenticationParams($params);
$params = $this->sanitizeFileParams($params);
$this->dangerouslySetParams($params);
return $this;
}
/**
* Set the params for this request without filtering them first.
*
* @param array $params
*
* @return FacebookRequest
*/
public function dangerouslySetParams(array $params = [])
{
$this->params = array_merge($this->params, $params);
return $this;
}
/**
* Iterate over the params and pull out the file uploads.
*
* @param array $params
*
* @return array
*/
public function sanitizeFileParams(array $params)
{
foreach ($params as $key => $value) {
if ($value instanceof FacebookFile) {
$this->addFile($key, $value);
unset($params[$key]);
}
}
return $params;
}
/**
* Add a file to be uploaded.
*
* @param string $key
* @param FacebookFile $file
*/
public function addFile($key, FacebookFile $file)
{
$this->files[$key] = $file;
}
/**
* Removes all the files from the upload queue.
*/
public function resetFiles()
{
$this->files = [];
}
/**
* Get the list of files to be uploaded.
*
* @return array
*/
public function getFiles()
{
return $this->files;
}
/**
* Let's us know if there is a file upload with this request.
*
* @return boolean
*/
public function containsFileUploads()
{
return !empty($this->files);
}
/**
* Let's us know if there is a video upload with this request.
*
* @return boolean
*/
public function containsVideoUploads()
{
foreach ($this->files as $file) {
if ($file instanceof FacebookVideo) {
return true;
}
}
return false;
}
/**
* Returns the body of the request as multipart/form-data.
*
* @return RequestBodyMultipart
*/
public function getMultipartBody()
{
$params = $this->getPostParams();
return new RequestBodyMultipart($params, $this->files);
}
/**
* Returns the body of the request as URL-encoded.
*
* @return RequestBodyUrlEncoded
*/
public function getUrlEncodedBody()
{
$params = $this->getPostParams();
return new RequestBodyUrlEncoded($params);
}
/**
* Generate and return the params for this request.
*
* @return array
*/
public function getParams()
{
$params = $this->params;
$accessToken = $this->getAccessToken();
if ($accessToken) {
$params['access_token'] = $accessToken;
$params['appsecret_proof'] = $this->getAppSecretProof();
}
return $params;
}
/**
* Only return params on POST requests.
*
* @return array
*/
public function getPostParams()
{
if ($this->getMethod() === 'POST') {
return $this->getParams();
}
return [];
}
/**
* The graph version used for this request.
*
* @return string
*/
public function getGraphVersion()
{
return $this->graphVersion;
}
/**
* Generate and return the URL for this request.
*
* @return string
*/
public function getUrl()
{
$this->validateMethod();
$graphVersion = FacebookUrlManipulator::forceSlashPrefix($this->graphVersion);
$endpoint = FacebookUrlManipulator::forceSlashPrefix($this->getEndpoint());
$url = $graphVersion . $endpoint;
if ($this->getMethod() !== 'POST') {
$params = $this->getParams();
$url = FacebookUrlManipulator::appendParamsToUrl($url, $params);
}
return $url;
}
/**
* Return the default headers that every request should use.
*
* @return array
*/
public static function getDefaultHeaders()
{
return [
'User-Agent' => 'fb-php-' . Facebook::VERSION,
'Accept-Encoding' => '*',
];
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\GraphNodes\GraphNodeFactory;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class FacebookResponse
*
* @package Facebook
*/
class FacebookResponse
{
/**
* @var int The HTTP status code response from Graph.
*/
protected $httpStatusCode;
/**
* @var array The headers returned from Graph.
*/
protected $headers;
/**
* @var string The raw body of the response from Graph.
*/
protected $body;
/**
* @var array The decoded body of the Graph response.
*/
protected $decodedBody = [];
/**
* @var FacebookRequest The original request that returned this response.
*/
protected $request;
/**
* @var FacebookSDKException The exception thrown by this request.
*/
protected $thrownException;
/**
* Creates a new Response entity.
*
* @param FacebookRequest $request
* @param string|null $body
* @param int|null $httpStatusCode
* @param array|null $headers
*/
public function __construct(FacebookRequest $request, $body = null, $httpStatusCode = null, array $headers = [])
{
$this->request = $request;
$this->body = $body;
$this->httpStatusCode = $httpStatusCode;
$this->headers = $headers;
$this->decodeBody();
}
/**
* Return the original request that returned this response.
*
* @return FacebookRequest
*/
public function getRequest()
{
return $this->request;
}
/**
* Return the FacebookApp entity used for this response.
*
* @return FacebookApp
*/
public function getApp()
{
return $this->request->getApp();
}
/**
* Return the access token that was used for this response.
*
* @return string|null
*/
public function getAccessToken()
{
return $this->request->getAccessToken();
}
/**
* Return the HTTP status code for this response.
*
* @return int
*/
public function getHttpStatusCode()
{
return $this->httpStatusCode;
}
/**
* Return the HTTP headers for this response.
*
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Return the raw body response.
*
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* Return the decoded body response.
*
* @return array
*/
public function getDecodedBody()
{
return $this->decodedBody;
}
/**
* Get the app secret proof that was used for this response.
*
* @return string|null
*/
public function getAppSecretProof()
{
return $this->request->getAppSecretProof();
}
/**
* Get the ETag associated with the response.
*
* @return string|null
*/
public function getETag()
{
return isset($this->headers['ETag']) ? $this->headers['ETag'] : null;
}
/**
* Get the version of Graph that returned this response.
*
* @return string|null
*/
public function getGraphVersion()
{
return isset($this->headers['Facebook-API-Version']) ? $this->headers['Facebook-API-Version'] : null;
}
/**
* Returns true if Graph returned an error message.
*
* @return boolean
*/
public function isError()
{
return isset($this->decodedBody['error']);
}
/**
* Throws the exception.
*
* @throws FacebookSDKException
*/
public function throwException()
{
throw $this->thrownException;
}
/**
* Instantiates an exception to be thrown later.
*/
public function makeException()
{
$this->thrownException = FacebookResponseException::create($this);
}
/**
* Returns the exception that was thrown for this request.
*
* @return FacebookResponseException|null
*/
public function getThrownException()
{
return $this->thrownException;
}
/**
* Convert the raw response into an array if possible.
*
* Graph will return 2 types of responses:
* - JSON(P)
* Most responses from Graph are JSON(P)
* - application/x-www-form-urlencoded key/value pairs
* Happens on the `/oauth/access_token` endpoint when exchanging
* a short-lived access token for a long-lived access token
* - And sometimes nothing :/ but that'd be a bug.
*/
public function decodeBody()
{
$this->decodedBody = json_decode($this->body, true);
if ($this->decodedBody === null) {
$this->decodedBody = [];
parse_str($this->body, $this->decodedBody);
} elseif (is_bool($this->decodedBody)) {
// Backwards compatibility for Graph < 2.1.
// Mimics 2.1 responses.
// @TODO Remove this after Graph 2.0 is no longer supported
$this->decodedBody = ['success' => $this->decodedBody];
} elseif (is_numeric($this->decodedBody)) {
$this->decodedBody = ['id' => $this->decodedBody];
}
if (!is_array($this->decodedBody)) {
$this->decodedBody = [];
}
if ($this->isError()) {
$this->makeException();
}
}
/**
* Instantiate a new GraphObject from response.
*
* @param string|null $subclassName The GraphNode subclass to cast to.
*
* @return \Facebook\GraphNodes\GraphObject
*
* @throws FacebookSDKException
*
* @deprecated 5.0.0 getGraphObject() has been renamed to getGraphNode()
* @todo v6: Remove this method
*/
public function getGraphObject($subclassName = null)
{
return $this->getGraphNode($subclassName);
}
/**
* Instantiate a new GraphNode from response.
*
* @param string|null $subclassName The GraphNode subclass to cast to.
*
* @return \Facebook\GraphNodes\GraphNode
*
* @throws FacebookSDKException
*/
public function getGraphNode($subclassName = null)
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphNode($subclassName);
}
/**
* Convenience method for creating a GraphAlbum collection.
*
* @return \Facebook\GraphNodes\GraphAlbum
*
* @throws FacebookSDKException
*/
public function getGraphAlbum()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphAlbum();
}
/**
* Convenience method for creating a GraphPage collection.
*
* @return \Facebook\GraphNodes\GraphPage
*
* @throws FacebookSDKException
*/
public function getGraphPage()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphPage();
}
/**
* Convenience method for creating a GraphSessionInfo collection.
*
* @return \Facebook\GraphNodes\GraphSessionInfo
*
* @throws FacebookSDKException
*/
public function getGraphSessionInfo()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphSessionInfo();
}
/**
* Convenience method for creating a GraphUser collection.
*
* @return \Facebook\GraphNodes\GraphUser
*
* @throws FacebookSDKException
*/
public function getGraphUser()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphUser();
}
/**
* Convenience method for creating a GraphEvent collection.
*
* @return \Facebook\GraphNodes\GraphEvent
*
* @throws FacebookSDKException
*/
public function getGraphEvent()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphEvent();
}
/**
* Convenience method for creating a GraphGroup collection.
*
* @return \Facebook\GraphNodes\GraphGroup
*
* @throws FacebookSDKException
*/
public function getGraphGroup()
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphGroup();
}
/**
* Instantiate a new GraphList from response.
*
* @param string|null $subclassName The GraphNode subclass to cast list items to.
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
*
* @return \Facebook\GraphNodes\GraphList
*
* @throws FacebookSDKException
*
* @deprecated 5.0.0 getGraphList() has been renamed to getGraphEdge()
* @todo v6: Remove this method
*/
public function getGraphList($subclassName = null, $auto_prefix = true)
{
return $this->getGraphEdge($subclassName, $auto_prefix);
}
/**
* Instantiate a new GraphEdge from response.
*
* @param string|null $subclassName The GraphNode subclass to cast list items to.
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
*
* @return \Facebook\GraphNodes\GraphEdge
*
* @throws FacebookSDKException
*/
public function getGraphEdge($subclassName = null, $auto_prefix = true)
{
$factory = new GraphNodeFactory($this);
return $factory->makeGraphEdge($subclassName, $auto_prefix);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\FileUpload;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class FacebookFile
*
* @package Facebook
*/
class FacebookFile
{
/**
* @var string The path to the file on the system.
*/
protected $path;
/**
* @var int The maximum bytes to read. Defaults to -1 (read all the remaining buffer).
*/
private $maxLength;
/**
* @var int Seek to the specified offset before reading. If this number is negative, no seeking will occur and reading will start from the current position.
*/
private $offset;
/**
* @var resource The stream pointing to the file.
*/
protected $stream;
/**
* Creates a new FacebookFile entity.
*
* @param string $filePath
* @param int $maxLength
* @param int $offset
*
* @throws FacebookSDKException
*/
public function __construct($filePath, $maxLength = -1, $offset = -1)
{
$this->path = $filePath;
$this->maxLength = $maxLength;
$this->offset = $offset;
$this->open();
}
/**
* Closes the stream when destructed.
*/
public function __destruct()
{
$this->close();
}
/**
* Opens a stream for the file.
*
* @throws FacebookSDKException
*/
public function open()
{
if (!$this->isRemoteFile($this->path) && !is_readable($this->path)) {
throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to read resource: ' . $this->path . '.');
}
$this->stream = fopen($this->path, 'r');
if (!$this->stream) {
throw new FacebookSDKException('Failed to create FacebookFile entity. Unable to open resource: ' . $this->path . '.');
}
}
/**
* Stops the file stream.
*/
public function close()
{
if (is_resource($this->stream)) {
fclose($this->stream);
}
}
/**
* Return the contents of the file.
*
* @return string
*/
public function getContents()
{
return stream_get_contents($this->stream, $this->maxLength, $this->offset);
}
/**
* Return the name of the file.
*
* @return string
*/
public function getFileName()
{
return basename($this->path);
}
/**
* Return the path of the file.
*
* @return string
*/
public function getFilePath()
{
return $this->path;
}
/**
* Return the size of the file.
*
* @return int
*/
public function getSize()
{
return filesize($this->path);
}
/**
* Return the mimetype of the file.
*
* @return string
*/
public function getMimetype()
{
return Mimetypes::getInstance()->fromFilename($this->path) ?: 'text/plain';
}
/**
* Returns true if the path to the file is remote.
*
* @param string $pathToFile
*
* @return boolean
*/
protected function isRemoteFile($pathToFile)
{
return preg_match('/^(https?|ftp):\/\/.*/', $pathToFile) === 1;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\FileUpload;
use Facebook\Authentication\AccessToken;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookResumableUploadException;
use Facebook\Exceptions\FacebookSDKException;
use Facebook\FacebookApp;
use Facebook\FacebookClient;
use Facebook\FacebookRequest;
/**
* Class FacebookResumableUploader
*
* @package Facebook
*/
class FacebookResumableUploader
{
/**
* @var FacebookApp
*/
protected $app;
/**
* @var string
*/
protected $accessToken;
/**
* @var FacebookClient The Facebook client service.
*/
protected $client;
/**
* @var string Graph version to use for this request.
*/
protected $graphVersion;
/**
* @param FacebookApp $app
* @param FacebookClient $client
* @param AccessToken|string|null $accessToken
* @param string $graphVersion
*/
public function __construct(FacebookApp $app, FacebookClient $client, $accessToken, $graphVersion)
{
$this->app = $app;
$this->client = $client;
$this->accessToken = $accessToken;
$this->graphVersion = $graphVersion;
}
/**
* Upload by chunks - start phase
*
* @param string $endpoint
* @param FacebookFile $file
*
* @return FacebookTransferChunk
*
* @throws FacebookSDKException
*/
public function start($endpoint, FacebookFile $file)
{
$params = [
'upload_phase' => 'start',
'file_size' => $file->getSize(),
];
$response = $this->sendUploadRequest($endpoint, $params);
return new FacebookTransferChunk($file, $response['upload_session_id'], $response['video_id'], $response['start_offset'], $response['end_offset']);
}
/**
* Upload by chunks - transfer phase
*
* @param string $endpoint
* @param FacebookTransferChunk $chunk
* @param boolean $allowToThrow
*
* @return FacebookTransferChunk
*
* @throws FacebookResponseException
*/
public function transfer($endpoint, FacebookTransferChunk $chunk, $allowToThrow = false)
{
$params = [
'upload_phase' => 'transfer',
'upload_session_id' => $chunk->getUploadSessionId(),
'start_offset' => $chunk->getStartOffset(),
'video_file_chunk' => $chunk->getPartialFile(),
];
try {
$response = $this->sendUploadRequest($endpoint, $params);
} catch (FacebookResponseException $e) {
$preException = $e->getPrevious();
if ($allowToThrow || !$preException instanceof FacebookResumableUploadException) {
throw $e;
}
// Return the same chunk entity so it can be retried.
return $chunk;
}
return new FacebookTransferChunk($chunk->getFile(), $chunk->getUploadSessionId(), $chunk->getVideoId(), $response['start_offset'], $response['end_offset']);
}
/**
* Upload by chunks - finish phase
*
* @param string $endpoint
* @param string $uploadSessionId
* @param array $metadata The metadata associated with the file.
*
* @return boolean
*
* @throws FacebookSDKException
*/
public function finish($endpoint, $uploadSessionId, $metadata = [])
{
$params = array_merge($metadata, [
'upload_phase' => 'finish',
'upload_session_id' => $uploadSessionId,
]);
$response = $this->sendUploadRequest($endpoint, $params);
return $response['success'];
}
/**
* Helper to make a FacebookRequest and send it.
*
* @param string $endpoint The endpoint to POST to.
* @param array $params The params to send with the request.
*
* @return array
*/
private function sendUploadRequest($endpoint, $params = [])
{
$request = new FacebookRequest($this->app, $this->accessToken, 'POST', $endpoint, $params, null, $this->graphVersion);
return $this->client->sendRequest($request)->getDecodedBody();
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\FileUpload;
/**
* Class FacebookTransferChunk
*
* @package Facebook
*/
class FacebookTransferChunk
{
/**
* @var FacebookFile The file to chunk during upload.
*/
private $file;
/**
* @var int The ID of the upload session.
*/
private $uploadSessionId;
/**
* @var int Start byte position of the next file chunk.
*/
private $startOffset;
/**
* @var int End byte position of the next file chunk.
*/
private $endOffset;
/**
* @var int The ID of the video.
*/
private $videoId;
/**
* @param FacebookFile $file
* @param int $uploadSessionId
* @param int $videoId
* @param int $startOffset
* @param int $endOffset
*/
public function __construct(FacebookFile $file, $uploadSessionId, $videoId, $startOffset, $endOffset)
{
$this->file = $file;
$this->uploadSessionId = $uploadSessionId;
$this->videoId = $videoId;
$this->startOffset = $startOffset;
$this->endOffset = $endOffset;
}
/**
* Return the file entity.
*
* @return FacebookFile
*/
public function getFile()
{
return $this->file;
}
/**
* Return a FacebookFile entity with partial content.
*
* @return FacebookFile
*/
public function getPartialFile()
{
$maxLength = $this->endOffset - $this->startOffset;
return new FacebookFile($this->file->getFilePath(), $maxLength, $this->startOffset);
}
/**
* Return upload session Id
*
* @return int
*/
public function getUploadSessionId()
{
return $this->uploadSessionId;
}
/**
* Check whether is the last chunk
*
* @return bool
*/
public function isLastChunk()
{
return $this->startOffset === $this->endOffset;
}
/**
* @return int
*/
public function getStartOffset()
{
return $this->startOffset;
}
/**
* Get uploaded video Id
*
* @return int
*/
public function getVideoId()
{
return $this->videoId;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\FileUpload;
/**
* Class FacebookVideo
*
* @package Facebook
*/
class FacebookVideo extends FacebookFile
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\FileUpload;
/**
* Provides mappings of file extensions to mimetypes
*
* Taken from Guzzle
*
* @see https://github.com/guzzle/guzzle/blob/master/src/Mimetypes.php
*
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
*/
class Mimetypes
{
/** @var self */
protected static $instance;
/** @var array Mapping of extension to mimetype */
protected $mimetypes = [
'3dml' => 'text/vnd.in3d.3dml',
'3g2' => 'video/3gpp2',
'3gp' => 'video/3gpp',
'7z' => 'application/x-7z-compressed',
'aab' => 'application/x-authorware-bin',
'aac' => 'audio/x-aac',
'aam' => 'application/x-authorware-map',
'aas' => 'application/x-authorware-seg',
'abw' => 'application/x-abiword',
'ac' => 'application/pkix-attr-cert',
'acc' => 'application/vnd.americandynamics.acc',
'ace' => 'application/x-ace-compressed',
'acu' => 'application/vnd.acucobol',
'acutc' => 'application/vnd.acucorp',
'adp' => 'audio/adpcm',
'aep' => 'application/vnd.audiograph',
'afm' => 'application/x-font-type1',
'afp' => 'application/vnd.ibm.modcap',
'ahead' => 'application/vnd.ahead.space',
'ai' => 'application/postscript',
'aif' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'air' => 'application/vnd.adobe.air-application-installer-package+zip',
'ait' => 'application/vnd.dvb.ait',
'ami' => 'application/vnd.amiga.ami',
'apk' => 'application/vnd.android.package-archive',
'application' => 'application/x-ms-application',
'apr' => 'application/vnd.lotus-approach',
'asa' => 'text/plain',
'asax' => 'application/octet-stream',
'asc' => 'application/pgp-signature',
'ascx' => 'text/plain',
'asf' => 'video/x-ms-asf',
'ashx' => 'text/plain',
'asm' => 'text/x-asm',
'asmx' => 'text/plain',
'aso' => 'application/vnd.accpac.simply.aso',
'asp' => 'text/plain',
'aspx' => 'text/plain',
'asx' => 'video/x-ms-asf',
'atc' => 'application/vnd.acucorp',
'atom' => 'application/atom+xml',
'atomcat' => 'application/atomcat+xml',
'atomsvc' => 'application/atomsvc+xml',
'atx' => 'application/vnd.antix.game-component',
'au' => 'audio/basic',
'avi' => 'video/x-msvideo',
'aw' => 'application/applixware',
'axd' => 'text/plain',
'azf' => 'application/vnd.airzip.filesecure.azf',
'azs' => 'application/vnd.airzip.filesecure.azs',
'azw' => 'application/vnd.amazon.ebook',
'bat' => 'application/x-msdownload',
'bcpio' => 'application/x-bcpio',
'bdf' => 'application/x-font-bdf',
'bdm' => 'application/vnd.syncml.dm+wbxml',
'bed' => 'application/vnd.realvnc.bed',
'bh2' => 'application/vnd.fujitsu.oasysprs',
'bin' => 'application/octet-stream',
'bmi' => 'application/vnd.bmi',
'bmp' => 'image/bmp',
'book' => 'application/vnd.framemaker',
'box' => 'application/vnd.previewsystems.box',
'boz' => 'application/x-bzip2',
'bpk' => 'application/octet-stream',
'btif' => 'image/prs.btif',
'bz' => 'application/x-bzip',
'bz2' => 'application/x-bzip2',
'c' => 'text/x-c',
'c11amc' => 'application/vnd.cluetrust.cartomobile-config',
'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',
'c4d' => 'application/vnd.clonk.c4group',
'c4f' => 'application/vnd.clonk.c4group',
'c4g' => 'application/vnd.clonk.c4group',
'c4p' => 'application/vnd.clonk.c4group',
'c4u' => 'application/vnd.clonk.c4group',
'cab' => 'application/vnd.ms-cab-compressed',
'car' => 'application/vnd.curl.car',
'cat' => 'application/vnd.ms-pki.seccat',
'cc' => 'text/x-c',
'cct' => 'application/x-director',
'ccxml' => 'application/ccxml+xml',
'cdbcmsg' => 'application/vnd.contact.cmsg',
'cdf' => 'application/x-netcdf',
'cdkey' => 'application/vnd.mediastation.cdkey',
'cdmia' => 'application/cdmi-capability',
'cdmic' => 'application/cdmi-container',
'cdmid' => 'application/cdmi-domain',
'cdmio' => 'application/cdmi-object',
'cdmiq' => 'application/cdmi-queue',
'cdx' => 'chemical/x-cdx',
'cdxml' => 'application/vnd.chemdraw+xml',
'cdy' => 'application/vnd.cinderella',
'cer' => 'application/pkix-cert',
'cfc' => 'application/x-coldfusion',
'cfm' => 'application/x-coldfusion',
'cgm' => 'image/cgm',
'chat' => 'application/x-chat',
'chm' => 'application/vnd.ms-htmlhelp',
'chrt' => 'application/vnd.kde.kchart',
'cif' => 'chemical/x-cif',
'cii' => 'application/vnd.anser-web-certificate-issue-initiation',
'cil' => 'application/vnd.ms-artgalry',
'cla' => 'application/vnd.claymore',
'class' => 'application/java-vm',
'clkk' => 'application/vnd.crick.clicker.keyboard',
'clkp' => 'application/vnd.crick.clicker.palette',
'clkt' => 'application/vnd.crick.clicker.template',
'clkw' => 'application/vnd.crick.clicker.wordbank',
'clkx' => 'application/vnd.crick.clicker',
'clp' => 'application/x-msclip',
'cmc' => 'application/vnd.cosmocaller',
'cmdf' => 'chemical/x-cmdf',
'cml' => 'chemical/x-cml',
'cmp' => 'application/vnd.yellowriver-custom-menu',
'cmx' => 'image/x-cmx',
'cod' => 'application/vnd.rim.cod',
'com' => 'application/x-msdownload',
'conf' => 'text/plain',
'cpio' => 'application/x-cpio',
'cpp' => 'text/x-c',
'cpt' => 'application/mac-compactpro',
'crd' => 'application/x-mscardfile',
'crl' => 'application/pkix-crl',
'crt' => 'application/x-x509-ca-cert',
'cryptonote' => 'application/vnd.rig.cryptonote',
'cs' => 'text/plain',
'csh' => 'application/x-csh',
'csml' => 'chemical/x-csml',
'csp' => 'application/vnd.commonspace',
'css' => 'text/css',
'cst' => 'application/x-director',
'csv' => 'text/csv',
'cu' => 'application/cu-seeme',
'curl' => 'text/vnd.curl',
'cww' => 'application/prs.cww',
'cxt' => 'application/x-director',
'cxx' => 'text/x-c',
'dae' => 'model/vnd.collada+xml',
'daf' => 'application/vnd.mobius.daf',
'dataless' => 'application/vnd.fdsn.seed',
'davmount' => 'application/davmount+xml',
'dcr' => 'application/x-director',
'dcurl' => 'text/vnd.curl.dcurl',
'dd2' => 'application/vnd.oma.dd2+xml',
'ddd' => 'application/vnd.fujixerox.ddd',
'deb' => 'application/x-debian-package',
'def' => 'text/plain',
'deploy' => 'application/octet-stream',
'der' => 'application/x-x509-ca-cert',
'dfac' => 'application/vnd.dreamfactory',
'dic' => 'text/x-c',
'dir' => 'application/x-director',
'dis' => 'application/vnd.mobius.dis',
'dist' => 'application/octet-stream',
'distz' => 'application/octet-stream',
'djv' => 'image/vnd.djvu',
'djvu' => 'image/vnd.djvu',
'dll' => 'application/x-msdownload',
'dmg' => 'application/octet-stream',
'dms' => 'application/octet-stream',
'dna' => 'application/vnd.dna',
'doc' => 'application/msword',
'docm' => 'application/vnd.ms-word.document.macroenabled.12',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'dot' => 'application/msword',
'dotm' => 'application/vnd.ms-word.template.macroenabled.12',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'dp' => 'application/vnd.osgi.dp',
'dpg' => 'application/vnd.dpgraph',
'dra' => 'audio/vnd.dra',
'dsc' => 'text/prs.lines.tag',
'dssc' => 'application/dssc+der',
'dtb' => 'application/x-dtbook+xml',
'dtd' => 'application/xml-dtd',
'dts' => 'audio/vnd.dts',
'dtshd' => 'audio/vnd.dts.hd',
'dump' => 'application/octet-stream',
'dvi' => 'application/x-dvi',
'dwf' => 'model/vnd.dwf',
'dwg' => 'image/vnd.dwg',
'dxf' => 'image/vnd.dxf',
'dxp' => 'application/vnd.spotfire.dxp',
'dxr' => 'application/x-director',
'ecelp4800' => 'audio/vnd.nuera.ecelp4800',
'ecelp7470' => 'audio/vnd.nuera.ecelp7470',
'ecelp9600' => 'audio/vnd.nuera.ecelp9600',
'ecma' => 'application/ecmascript',
'edm' => 'application/vnd.novadigm.edm',
'edx' => 'application/vnd.novadigm.edx',
'efif' => 'application/vnd.picsel',
'ei6' => 'application/vnd.pg.osasli',
'elc' => 'application/octet-stream',
'eml' => 'message/rfc822',
'emma' => 'application/emma+xml',
'eol' => 'audio/vnd.digital-winds',
'eot' => 'application/vnd.ms-fontobject',
'eps' => 'application/postscript',
'epub' => 'application/epub+zip',
'es3' => 'application/vnd.eszigno3+xml',
'esf' => 'application/vnd.epson.esf',
'et3' => 'application/vnd.eszigno3+xml',
'etx' => 'text/x-setext',
'exe' => 'application/x-msdownload',
'exi' => 'application/exi',
'ext' => 'application/vnd.novadigm.ext',
'ez' => 'application/andrew-inset',
'ez2' => 'application/vnd.ezpix-album',
'ez3' => 'application/vnd.ezpix-package',
'f' => 'text/x-fortran',
'f4v' => 'video/x-f4v',
'f77' => 'text/x-fortran',
'f90' => 'text/x-fortran',
'fbs' => 'image/vnd.fastbidsheet',
'fcs' => 'application/vnd.isac.fcs',
'fdf' => 'application/vnd.fdf',
'fe_launch' => 'application/vnd.denovo.fcselayout-link',
'fg5' => 'application/vnd.fujitsu.oasysgp',
'fgd' => 'application/x-director',
'fh' => 'image/x-freehand',
'fh4' => 'image/x-freehand',
'fh5' => 'image/x-freehand',
'fh7' => 'image/x-freehand',
'fhc' => 'image/x-freehand',
'fig' => 'application/x-xfig',
'fli' => 'video/x-fli',
'flo' => 'application/vnd.micrografx.flo',
'flv' => 'video/x-flv',
'flw' => 'application/vnd.kde.kivio',
'flx' => 'text/vnd.fmi.flexstor',
'fly' => 'text/vnd.fly',
'fm' => 'application/vnd.framemaker',
'fnc' => 'application/vnd.frogans.fnc',
'for' => 'text/x-fortran',
'fpx' => 'image/vnd.fpx',
'frame' => 'application/vnd.framemaker',
'fsc' => 'application/vnd.fsc.weblaunch',
'fst' => 'image/vnd.fst',
'ftc' => 'application/vnd.fluxtime.clip',
'fti' => 'application/vnd.anser-web-funds-transfer-initiation',
'fvt' => 'video/vnd.fvt',
'fxp' => 'application/vnd.adobe.fxp',
'fxpl' => 'application/vnd.adobe.fxp',
'fzs' => 'application/vnd.fuzzysheet',
'g2w' => 'application/vnd.geoplan',
'g3' => 'image/g3fax',
'g3w' => 'application/vnd.geospace',
'gac' => 'application/vnd.groove-account',
'gdl' => 'model/vnd.gdl',
'geo' => 'application/vnd.dynageo',
'gex' => 'application/vnd.geometry-explorer',
'ggb' => 'application/vnd.geogebra.file',
'ggt' => 'application/vnd.geogebra.tool',
'ghf' => 'application/vnd.groove-help',
'gif' => 'image/gif',
'gim' => 'application/vnd.groove-identity-message',
'gmx' => 'application/vnd.gmx',
'gnumeric' => 'application/x-gnumeric',
'gph' => 'application/vnd.flographit',
'gqf' => 'application/vnd.grafeq',
'gqs' => 'application/vnd.grafeq',
'gram' => 'application/srgs',
'gre' => 'application/vnd.geometry-explorer',
'grv' => 'application/vnd.groove-injector',
'grxml' => 'application/srgs+xml',
'gsf' => 'application/x-font-ghostscript',
'gtar' => 'application/x-gtar',
'gtm' => 'application/vnd.groove-tool-message',
'gtw' => 'model/vnd.gtw',
'gv' => 'text/vnd.graphviz',
'gxt' => 'application/vnd.geonext',
'h' => 'text/x-c',
'h261' => 'video/h261',
'h263' => 'video/h263',
'h264' => 'video/h264',
'hal' => 'application/vnd.hal+xml',
'hbci' => 'application/vnd.hbci',
'hdf' => 'application/x-hdf',
'hh' => 'text/x-c',
'hlp' => 'application/winhlp',
'hpgl' => 'application/vnd.hp-hpgl',
'hpid' => 'application/vnd.hp-hpid',
'hps' => 'application/vnd.hp-hps',
'hqx' => 'application/mac-binhex40',
'hta' => 'application/octet-stream',
'htc' => 'text/html',
'htke' => 'application/vnd.kenameaapp',
'htm' => 'text/html',
'html' => 'text/html',
'hvd' => 'application/vnd.yamaha.hv-dic',
'hvp' => 'application/vnd.yamaha.hv-voice',
'hvs' => 'application/vnd.yamaha.hv-script',
'i2g' => 'application/vnd.intergeo',
'icc' => 'application/vnd.iccprofile',
'ice' => 'x-conference/x-cooltalk',
'icm' => 'application/vnd.iccprofile',
'ico' => 'image/x-icon',
'ics' => 'text/calendar',
'ief' => 'image/ief',
'ifb' => 'text/calendar',
'ifm' => 'application/vnd.shana.informed.formdata',
'iges' => 'model/iges',
'igl' => 'application/vnd.igloader',
'igm' => 'application/vnd.insors.igm',
'igs' => 'model/iges',
'igx' => 'application/vnd.micrografx.igx',
'iif' => 'application/vnd.shana.informed.interchange',
'imp' => 'application/vnd.accpac.simply.imp',
'ims' => 'application/vnd.ms-ims',
'in' => 'text/plain',
'ini' => 'text/plain',
'ipfix' => 'application/ipfix',
'ipk' => 'application/vnd.shana.informed.package',
'irm' => 'application/vnd.ibm.rights-management',
'irp' => 'application/vnd.irepository.package+xml',
'iso' => 'application/octet-stream',
'itp' => 'application/vnd.shana.informed.formtemplate',
'ivp' => 'application/vnd.immervision-ivp',
'ivu' => 'application/vnd.immervision-ivu',
'jad' => 'text/vnd.sun.j2me.app-descriptor',
'jam' => 'application/vnd.jam',
'jar' => 'application/java-archive',
'java' => 'text/x-java-source',
'jisp' => 'application/vnd.jisp',
'jlt' => 'application/vnd.hp-jlyt',
'jnlp' => 'application/x-java-jnlp-file',
'joda' => 'application/vnd.joost.joda-archive',
'jpe' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpgm' => 'video/jpm',
'jpgv' => 'video/jpeg',
'jpm' => 'video/jpm',
'js' => 'text/javascript',
'json' => 'application/json',
'kar' => 'audio/midi',
'karbon' => 'application/vnd.kde.karbon',
'kfo' => 'application/vnd.kde.kformula',
'kia' => 'application/vnd.kidspiration',
'kml' => 'application/vnd.google-earth.kml+xml',
'kmz' => 'application/vnd.google-earth.kmz',
'kne' => 'application/vnd.kinar',
'knp' => 'application/vnd.kinar',
'kon' => 'application/vnd.kde.kontour',
'kpr' => 'application/vnd.kde.kpresenter',
'kpt' => 'application/vnd.kde.kpresenter',
'ksp' => 'application/vnd.kde.kspread',
'ktr' => 'application/vnd.kahootz',
'ktx' => 'image/ktx',
'ktz' => 'application/vnd.kahootz',
'kwd' => 'application/vnd.kde.kword',
'kwt' => 'application/vnd.kde.kword',
'lasxml' => 'application/vnd.las.las+xml',
'latex' => 'application/x-latex',
'lbd' => 'application/vnd.llamagraphics.life-balance.desktop',
'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
'les' => 'application/vnd.hhe.lesson-player',
'lha' => 'application/octet-stream',
'link66' => 'application/vnd.route66.link66+xml',
'list' => 'text/plain',
'list3820' => 'application/vnd.ibm.modcap',
'listafp' => 'application/vnd.ibm.modcap',
'log' => 'text/plain',
'lostxml' => 'application/lost+xml',
'lrf' => 'application/octet-stream',
'lrm' => 'application/vnd.ms-lrm',
'ltf' => 'application/vnd.frogans.ltf',
'lvp' => 'audio/vnd.lucent.voice',
'lwp' => 'application/vnd.lotus-wordpro',
'lzh' => 'application/octet-stream',
'm13' => 'application/x-msmediaview',
'm14' => 'application/x-msmediaview',
'm1v' => 'video/mpeg',
'm21' => 'application/mp21',
'm2a' => 'audio/mpeg',
'm2v' => 'video/mpeg',
'm3a' => 'audio/mpeg',
'm3u' => 'audio/x-mpegurl',
'm3u8' => 'application/vnd.apple.mpegurl',
'm4a' => 'audio/mp4',
'm4u' => 'video/vnd.mpegurl',
'm4v' => 'video/mp4',
'ma' => 'application/mathematica',
'mads' => 'application/mads+xml',
'mag' => 'application/vnd.ecowin.chart',
'maker' => 'application/vnd.framemaker',
'man' => 'text/troff',
'mathml' => 'application/mathml+xml',
'mb' => 'application/mathematica',
'mbk' => 'application/vnd.mobius.mbk',
'mbox' => 'application/mbox',
'mc1' => 'application/vnd.medcalcdata',
'mcd' => 'application/vnd.mcd',
'mcurl' => 'text/vnd.curl.mcurl',
'mdb' => 'application/x-msaccess',
'mdi' => 'image/vnd.ms-modi',
'me' => 'text/troff',
'mesh' => 'model/mesh',
'meta4' => 'application/metalink4+xml',
'mets' => 'application/mets+xml',
'mfm' => 'application/vnd.mfmp',
'mgp' => 'application/vnd.osgeo.mapguide.package',
'mgz' => 'application/vnd.proteus.magazine',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mif' => 'application/vnd.mif',
'mime' => 'message/rfc822',
'mj2' => 'video/mj2',
'mjp2' => 'video/mj2',
'mlp' => 'application/vnd.dolby.mlp',
'mmd' => 'application/vnd.chipnuts.karaoke-mmd',
'mmf' => 'application/vnd.smaf',
'mmr' => 'image/vnd.fujixerox.edmics-mmr',
'mny' => 'application/x-msmoney',
'mobi' => 'application/x-mobipocket-ebook',
'mods' => 'application/mods+xml',
'mov' => 'video/quicktime',
'movie' => 'video/x-sgi-movie',
'mp2' => 'audio/mpeg',
'mp21' => 'application/mp21',
'mp2a' => 'audio/mpeg',
'mp3' => 'audio/mpeg',
'mp4' => 'video/mp4',
'mp4a' => 'audio/mp4',
'mp4s' => 'application/mp4',
'mp4v' => 'video/mp4',
'mpc' => 'application/vnd.mophun.certificate',
'mpe' => 'video/mpeg',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpg4' => 'video/mp4',
'mpga' => 'audio/mpeg',
'mpkg' => 'application/vnd.apple.installer+xml',
'mpm' => 'application/vnd.blueice.multipass',
'mpn' => 'application/vnd.mophun.application',
'mpp' => 'application/vnd.ms-project',
'mpt' => 'application/vnd.ms-project',
'mpy' => 'application/vnd.ibm.minipay',
'mqy' => 'application/vnd.mobius.mqy',
'mrc' => 'application/marc',
'mrcx' => 'application/marcxml+xml',
'ms' => 'text/troff',
'mscml' => 'application/mediaservercontrol+xml',
'mseed' => 'application/vnd.fdsn.mseed',
'mseq' => 'application/vnd.mseq',
'msf' => 'application/vnd.epson.msf',
'msh' => 'model/mesh',
'msi' => 'application/x-msdownload',
'msl' => 'application/vnd.mobius.msl',
'msty' => 'application/vnd.muvee.style',
'mts' => 'model/vnd.mts',
'mus' => 'application/vnd.musician',
'musicxml' => 'application/vnd.recordare.musicxml+xml',
'mvb' => 'application/x-msmediaview',
'mwf' => 'application/vnd.mfer',
'mxf' => 'application/mxf',
'mxl' => 'application/vnd.recordare.musicxml',
'mxml' => 'application/xv+xml',
'mxs' => 'application/vnd.triscape.mxs',
'mxu' => 'video/vnd.mpegurl',
'n-gage' => 'application/vnd.nokia.n-gage.symbian.install',
'n3' => 'text/n3',
'nb' => 'application/mathematica',
'nbp' => 'application/vnd.wolfram.player',
'nc' => 'application/x-netcdf',
'ncx' => 'application/x-dtbncx+xml',
'ngdat' => 'application/vnd.nokia.n-gage.data',
'nlu' => 'application/vnd.neurolanguage.nlu',
'nml' => 'application/vnd.enliven',
'nnd' => 'application/vnd.noblenet-directory',
'nns' => 'application/vnd.noblenet-sealer',
'nnw' => 'application/vnd.noblenet-web',
'npx' => 'image/vnd.net-fpx',
'nsf' => 'application/vnd.lotus-notes',
'oa2' => 'application/vnd.fujitsu.oasys2',
'oa3' => 'application/vnd.fujitsu.oasys3',
'oas' => 'application/vnd.fujitsu.oasys',
'obd' => 'application/x-msbinder',
'oda' => 'application/oda',
'odb' => 'application/vnd.oasis.opendocument.database',
'odc' => 'application/vnd.oasis.opendocument.chart',
'odf' => 'application/vnd.oasis.opendocument.formula',
'odft' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'odi' => 'application/vnd.oasis.opendocument.image',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odt' => 'application/vnd.oasis.opendocument.text',
'oga' => 'audio/ogg',
'ogg' => 'audio/ogg',
'ogv' => 'video/ogg',
'ogx' => 'application/ogg',
'onepkg' => 'application/onenote',
'onetmp' => 'application/onenote',
'onetoc' => 'application/onenote',
'onetoc2' => 'application/onenote',
'opf' => 'application/oebps-package+xml',
'oprc' => 'application/vnd.palm',
'org' => 'application/vnd.lotus-organizer',
'osf' => 'application/vnd.yamaha.openscoreformat',
'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'otf' => 'application/x-font-otf',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'oth' => 'application/vnd.oasis.opendocument.text-web',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oxt' => 'application/vnd.openofficeorg.extension',
'p' => 'text/x-pascal',
'p10' => 'application/pkcs10',
'p12' => 'application/x-pkcs12',
'p7b' => 'application/x-pkcs7-certificates',
'p7c' => 'application/pkcs7-mime',
'p7m' => 'application/pkcs7-mime',
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'p8' => 'application/pkcs8',
'pas' => 'text/x-pascal',
'paw' => 'application/vnd.pawaafile',
'pbd' => 'application/vnd.powerbuilder6',
'pbm' => 'image/x-portable-bitmap',
'pcf' => 'application/x-font-pcf',
'pcl' => 'application/vnd.hp-pcl',
'pclxl' => 'application/vnd.hp-pclxl',
'pct' => 'image/x-pict',
'pcurl' => 'application/vnd.curl.pcurl',
'pcx' => 'image/x-pcx',
'pdb' => 'application/vnd.palm',
'pdf' => 'application/pdf',
'pfa' => 'application/x-font-type1',
'pfb' => 'application/x-font-type1',
'pfm' => 'application/x-font-type1',
'pfr' => 'application/font-tdpfr',
'pfx' => 'application/x-pkcs12',
'pgm' => 'image/x-portable-graymap',
'pgn' => 'application/x-chess-pgn',
'pgp' => 'application/pgp-encrypted',
'php' => 'text/x-php',
'phps' => 'application/x-httpd-phps',
'pic' => 'image/x-pict',
'pkg' => 'application/octet-stream',
'pki' => 'application/pkixcmp',
'pkipath' => 'application/pkix-pkipath',
'plb' => 'application/vnd.3gpp.pic-bw-large',
'plc' => 'application/vnd.mobius.plc',
'plf' => 'application/vnd.pocketlearn',
'pls' => 'application/pls+xml',
'pml' => 'application/vnd.ctc-posml',
'png' => 'image/png',
'pnm' => 'image/x-portable-anymap',
'portpkg' => 'application/vnd.macports.portpkg',
'pot' => 'application/vnd.ms-powerpoint',
'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',
'ppd' => 'application/vnd.cups-ppd',
'ppm' => 'image/x-portable-pixmap',
'pps' => 'application/vnd.ms-powerpoint',
'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppt' => 'application/vnd.ms-powerpoint',
'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'pqa' => 'application/vnd.palm',
'prc' => 'application/x-mobipocket-ebook',
'pre' => 'application/vnd.lotus-freelance',
'prf' => 'application/pics-rules',
'ps' => 'application/postscript',
'psb' => 'application/vnd.3gpp.pic-bw-small',
'psd' => 'image/vnd.adobe.photoshop',
'psf' => 'application/x-font-linux-psf',
'pskcxml' => 'application/pskc+xml',
'ptid' => 'application/vnd.pvi.ptid1',
'pub' => 'application/x-mspublisher',
'pvb' => 'application/vnd.3gpp.pic-bw-var',
'pwn' => 'application/vnd.3m.post-it-notes',
'pya' => 'audio/vnd.ms-playready.media.pya',
'pyv' => 'video/vnd.ms-playready.media.pyv',
'qam' => 'application/vnd.epson.quickanime',
'qbo' => 'application/vnd.intu.qbo',
'qfx' => 'application/vnd.intu.qfx',
'qps' => 'application/vnd.publishare-delta-tree',
'qt' => 'video/quicktime',
'qwd' => 'application/vnd.quark.quarkxpress',
'qwt' => 'application/vnd.quark.quarkxpress',
'qxb' => 'application/vnd.quark.quarkxpress',
'qxd' => 'application/vnd.quark.quarkxpress',
'qxl' => 'application/vnd.quark.quarkxpress',
'qxt' => 'application/vnd.quark.quarkxpress',
'ra' => 'audio/x-pn-realaudio',
'ram' => 'audio/x-pn-realaudio',
'rar' => 'application/x-rar-compressed',
'ras' => 'image/x-cmu-raster',
'rb' => 'text/plain',
'rcprofile' => 'application/vnd.ipunplugged.rcprofile',
'rdf' => 'application/rdf+xml',
'rdz' => 'application/vnd.data-vision.rdz',
'rep' => 'application/vnd.businessobjects',
'res' => 'application/x-dtbresource+xml',
'resx' => 'text/xml',
'rgb' => 'image/x-rgb',
'rif' => 'application/reginfo+xml',
'rip' => 'audio/vnd.rip',
'rl' => 'application/resource-lists+xml',
'rlc' => 'image/vnd.fujixerox.edmics-rlc',
'rld' => 'application/resource-lists-diff+xml',
'rm' => 'application/vnd.rn-realmedia',
'rmi' => 'audio/midi',
'rmp' => 'audio/x-pn-realaudio-plugin',
'rms' => 'application/vnd.jcp.javame.midlet-rms',
'rnc' => 'application/relax-ng-compact-syntax',
'roff' => 'text/troff',
'rp9' => 'application/vnd.cloanto.rp9',
'rpss' => 'application/vnd.nokia.radio-presets',
'rpst' => 'application/vnd.nokia.radio-preset',
'rq' => 'application/sparql-query',
'rs' => 'application/rls-services+xml',
'rsd' => 'application/rsd+xml',
'rss' => 'application/rss+xml',
'rtf' => 'application/rtf',
'rtx' => 'text/richtext',
's' => 'text/x-asm',
'saf' => 'application/vnd.yamaha.smaf-audio',
'sbml' => 'application/sbml+xml',
'sc' => 'application/vnd.ibm.secure-container',
'scd' => 'application/x-msschedule',
'scm' => 'application/vnd.lotus-screencam',
'scq' => 'application/scvp-cv-request',
'scs' => 'application/scvp-cv-response',
'scurl' => 'text/vnd.curl.scurl',
'sda' => 'application/vnd.stardivision.draw',
'sdc' => 'application/vnd.stardivision.calc',
'sdd' => 'application/vnd.stardivision.impress',
'sdkd' => 'application/vnd.solent.sdkm+xml',
'sdkm' => 'application/vnd.solent.sdkm+xml',
'sdp' => 'application/sdp',
'sdw' => 'application/vnd.stardivision.writer',
'see' => 'application/vnd.seemail',
'seed' => 'application/vnd.fdsn.seed',
'sema' => 'application/vnd.sema',
'semd' => 'application/vnd.semd',
'semf' => 'application/vnd.semf',
'ser' => 'application/java-serialized-object',
'setpay' => 'application/set-payment-initiation',
'setreg' => 'application/set-registration-initiation',
'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',
'sfs' => 'application/vnd.spotfire.sfs',
'sgl' => 'application/vnd.stardivision.writer-global',
'sgm' => 'text/sgml',
'sgml' => 'text/sgml',
'sh' => 'application/x-sh',
'shar' => 'application/x-shar',
'shf' => 'application/shf+xml',
'sig' => 'application/pgp-signature',
'silo' => 'model/mesh',
'sis' => 'application/vnd.symbian.install',
'sisx' => 'application/vnd.symbian.install',
'sit' => 'application/x-stuffit',
'sitx' => 'application/x-stuffitx',
'skd' => 'application/vnd.koan',
'skm' => 'application/vnd.koan',
'skp' => 'application/vnd.koan',
'skt' => 'application/vnd.koan',
'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
'slt' => 'application/vnd.epson.salt',
'sm' => 'application/vnd.stepmania.stepchart',
'smf' => 'application/vnd.stardivision.math',
'smi' => 'application/smil+xml',
'smil' => 'application/smil+xml',
'snd' => 'audio/basic',
'snf' => 'application/x-font-snf',
'so' => 'application/octet-stream',
'spc' => 'application/x-pkcs7-certificates',
'spf' => 'application/vnd.yamaha.smaf-phrase',
'spl' => 'application/x-futuresplash',
'spot' => 'text/vnd.in3d.spot',
'spp' => 'application/scvp-vp-response',
'spq' => 'application/scvp-vp-request',
'spx' => 'audio/ogg',
'src' => 'application/x-wais-source',
'srt' => 'application/octet-stream',
'sru' => 'application/sru+xml',
'srx' => 'application/sparql-results+xml',
'sse' => 'application/vnd.kodak-descriptor',
'ssf' => 'application/vnd.epson.ssf',
'ssml' => 'application/ssml+xml',
'st' => 'application/vnd.sailingtracker.track',
'stc' => 'application/vnd.sun.xml.calc.template',
'std' => 'application/vnd.sun.xml.draw.template',
'stf' => 'application/vnd.wt.stf',
'sti' => 'application/vnd.sun.xml.impress.template',
'stk' => 'application/hyperstudio',
'stl' => 'application/vnd.ms-pki.stl',
'str' => 'application/vnd.pg.format',
'stw' => 'application/vnd.sun.xml.writer.template',
'sub' => 'image/vnd.dvb.subtitle',
'sus' => 'application/vnd.sus-calendar',
'susp' => 'application/vnd.sus-calendar',
'sv4cpio' => 'application/x-sv4cpio',
'sv4crc' => 'application/x-sv4crc',
'svc' => 'application/vnd.dvb.service',
'svd' => 'application/vnd.svd',
'svg' => 'image/svg+xml',
'svgz' => 'image/svg+xml',
'swa' => 'application/x-director',
'swf' => 'application/x-shockwave-flash',
'swi' => 'application/vnd.aristanetworks.swi',
'sxc' => 'application/vnd.sun.xml.calc',
'sxd' => 'application/vnd.sun.xml.draw',
'sxg' => 'application/vnd.sun.xml.writer.global',
'sxi' => 'application/vnd.sun.xml.impress',
'sxm' => 'application/vnd.sun.xml.math',
'sxw' => 'application/vnd.sun.xml.writer',
't' => 'text/troff',
'tao' => 'application/vnd.tao.intent-module-archive',
'tar' => 'application/x-tar',
'tcap' => 'application/vnd.3gpp2.tcap',
'tcl' => 'application/x-tcl',
'teacher' => 'application/vnd.smart.teacher',
'tei' => 'application/tei+xml',
'teicorpus' => 'application/tei+xml',
'tex' => 'application/x-tex',
'texi' => 'application/x-texinfo',
'texinfo' => 'application/x-texinfo',
'text' => 'text/plain',
'tfi' => 'application/thraud+xml',
'tfm' => 'application/x-tex-tfm',
'thmx' => 'application/vnd.ms-officetheme',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'tmo' => 'application/vnd.tmobile-livetv',
'torrent' => 'application/x-bittorrent',
'tpl' => 'application/vnd.groove-tool-template',
'tpt' => 'application/vnd.trid.tpt',
'tr' => 'text/troff',
'tra' => 'application/vnd.trueapp',
'trm' => 'application/x-msterminal',
'tsd' => 'application/timestamped-data',
'tsv' => 'text/tab-separated-values',
'ttc' => 'application/x-font-ttf',
'ttf' => 'application/x-font-ttf',
'ttl' => 'text/turtle',
'twd' => 'application/vnd.simtech-mindmapper',
'twds' => 'application/vnd.simtech-mindmapper',
'txd' => 'application/vnd.genomatix.tuxedo',
'txf' => 'application/vnd.mobius.txf',
'txt' => 'text/plain',
'u32' => 'application/x-authorware-bin',
'udeb' => 'application/x-debian-package',
'ufd' => 'application/vnd.ufdl',
'ufdl' => 'application/vnd.ufdl',
'umj' => 'application/vnd.umajin',
'unityweb' => 'application/vnd.unity',
'uoml' => 'application/vnd.uoml+xml',
'uri' => 'text/uri-list',
'uris' => 'text/uri-list',
'urls' => 'text/uri-list',
'ustar' => 'application/x-ustar',
'utz' => 'application/vnd.uiq.theme',
'uu' => 'text/x-uuencode',
'uva' => 'audio/vnd.dece.audio',
'uvd' => 'application/vnd.dece.data',
'uvf' => 'application/vnd.dece.data',
'uvg' => 'image/vnd.dece.graphic',
'uvh' => 'video/vnd.dece.hd',
'uvi' => 'image/vnd.dece.graphic',
'uvm' => 'video/vnd.dece.mobile',
'uvp' => 'video/vnd.dece.pd',
'uvs' => 'video/vnd.dece.sd',
'uvt' => 'application/vnd.dece.ttml+xml',
'uvu' => 'video/vnd.uvvu.mp4',
'uvv' => 'video/vnd.dece.video',
'uvva' => 'audio/vnd.dece.audio',
'uvvd' => 'application/vnd.dece.data',
'uvvf' => 'application/vnd.dece.data',
'uvvg' => 'image/vnd.dece.graphic',
'uvvh' => 'video/vnd.dece.hd',
'uvvi' => 'image/vnd.dece.graphic',
'uvvm' => 'video/vnd.dece.mobile',
'uvvp' => 'video/vnd.dece.pd',
'uvvs' => 'video/vnd.dece.sd',
'uvvt' => 'application/vnd.dece.ttml+xml',
'uvvu' => 'video/vnd.uvvu.mp4',
'uvvv' => 'video/vnd.dece.video',
'uvvx' => 'application/vnd.dece.unspecified',
'uvx' => 'application/vnd.dece.unspecified',
'vcd' => 'application/x-cdlink',
'vcf' => 'text/x-vcard',
'vcg' => 'application/vnd.groove-vcard',
'vcs' => 'text/x-vcalendar',
'vcx' => 'application/vnd.vcx',
'vis' => 'application/vnd.visionary',
'viv' => 'video/vnd.vivo',
'vor' => 'application/vnd.stardivision.writer',
'vox' => 'application/x-authorware-bin',
'vrml' => 'model/vrml',
'vsd' => 'application/vnd.visio',
'vsf' => 'application/vnd.vsf',
'vss' => 'application/vnd.visio',
'vst' => 'application/vnd.visio',
'vsw' => 'application/vnd.visio',
'vtu' => 'model/vnd.vtu',
'vxml' => 'application/voicexml+xml',
'w3d' => 'application/x-director',
'wad' => 'application/x-doom',
'wav' => 'audio/x-wav',
'wax' => 'audio/x-ms-wax',
'wbmp' => 'image/vnd.wap.wbmp',
'wbs' => 'application/vnd.criticaltools.wbs+xml',
'wbxml' => 'application/vnd.wap.wbxml',
'wcm' => 'application/vnd.ms-works',
'wdb' => 'application/vnd.ms-works',
'weba' => 'audio/webm',
'webm' => 'video/webm',
'webp' => 'image/webp',
'wg' => 'application/vnd.pmi.widget',
'wgt' => 'application/widget',
'wks' => 'application/vnd.ms-works',
'wm' => 'video/x-ms-wm',
'wma' => 'audio/x-ms-wma',
'wmd' => 'application/x-ms-wmd',
'wmf' => 'application/x-msmetafile',
'wml' => 'text/vnd.wap.wml',
'wmlc' => 'application/vnd.wap.wmlc',
'wmls' => 'text/vnd.wap.wmlscript',
'wmlsc' => 'application/vnd.wap.wmlscriptc',
'wmv' => 'video/x-ms-wmv',
'wmx' => 'video/x-ms-wmx',
'wmz' => 'application/x-ms-wmz',
'woff' => 'application/x-font-woff',
'wpd' => 'application/vnd.wordperfect',
'wpl' => 'application/vnd.ms-wpl',
'wps' => 'application/vnd.ms-works',
'wqd' => 'application/vnd.wqd',
'wri' => 'application/x-mswrite',
'wrl' => 'model/vrml',
'wsdl' => 'application/wsdl+xml',
'wspolicy' => 'application/wspolicy+xml',
'wtb' => 'application/vnd.webturbo',
'wvx' => 'video/x-ms-wvx',
'x32' => 'application/x-authorware-bin',
'x3d' => 'application/vnd.hzn-3d-crossword',
'xap' => 'application/x-silverlight-app',
'xar' => 'application/vnd.xara',
'xbap' => 'application/x-ms-xbap',
'xbd' => 'application/vnd.fujixerox.docuworks.binder',
'xbm' => 'image/x-xbitmap',
'xdf' => 'application/xcap-diff+xml',
'xdm' => 'application/vnd.syncml.dm+xml',
'xdp' => 'application/vnd.adobe.xdp+xml',
'xdssc' => 'application/dssc+xml',
'xdw' => 'application/vnd.fujixerox.docuworks',
'xenc' => 'application/xenc+xml',
'xer' => 'application/patch-ops-error+xml',
'xfdf' => 'application/vnd.adobe.xfdf',
'xfdl' => 'application/vnd.xfdl',
'xht' => 'application/xhtml+xml',
'xhtml' => 'application/xhtml+xml',
'xhvml' => 'application/xv+xml',
'xif' => 'image/vnd.xiff',
'xla' => 'application/vnd.ms-excel',
'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
'xlc' => 'application/vnd.ms-excel',
'xlm' => 'application/vnd.ms-excel',
'xls' => 'application/vnd.ms-excel',
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xlt' => 'application/vnd.ms-excel',
'xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'xlw' => 'application/vnd.ms-excel',
'xml' => 'application/xml',
'xo' => 'application/vnd.olpc-sugar',
'xop' => 'application/xop+xml',
'xpi' => 'application/x-xpinstall',
'xpm' => 'image/x-xpixmap',
'xpr' => 'application/vnd.is-xpr',
'xps' => 'application/vnd.ms-xpsdocument',
'xpw' => 'application/vnd.intercon.formnet',
'xpx' => 'application/vnd.intercon.formnet',
'xsl' => 'application/xml',
'xslt' => 'application/xslt+xml',
'xsm' => 'application/vnd.syncml+xml',
'xspf' => 'application/xspf+xml',
'xul' => 'application/vnd.mozilla.xul+xml',
'xvm' => 'application/xv+xml',
'xvml' => 'application/xv+xml',
'xwd' => 'image/x-xwindowdump',
'xyz' => 'chemical/x-xyz',
'yaml' => 'text/yaml',
'yang' => 'application/yang',
'yin' => 'application/yin+xml',
'yml' => 'text/yaml',
'zaz' => 'application/vnd.zzazz.deck+xml',
'zip' => 'application/zip',
'zir' => 'application/vnd.zul',
'zirz' => 'application/vnd.zul',
'zmm' => 'application/vnd.handheld-entertainment+xml'
];
/**
* Get a singleton instance of the class
*
* @return self
* @codeCoverageIgnore
*/
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Get a mimetype value from a file extension
*
* @param string $extension File extension
*
* @return string|null
*/
public function fromExtension($extension)
{
$extension = strtolower($extension);
return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : null;
}
/**
* Get a mimetype from a filename
*
* @param string $filename Filename to generate a mimetype from
*
* @return string|null
*/
public function fromFilename($filename)
{
return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
use DateTime;
/**
* Birthday object to handle various Graph return formats
*
* @package Facebook
*/
class Birthday extends DateTime
{
/**
* @var bool
*/
private $hasDate = false;
/**
* @var bool
*/
private $hasYear = false;
/**
* Parses Graph birthday format to set indication flags, possible values:
*
* MM/DD/YYYY
* MM/DD
* YYYY
*
* @link https://developers.facebook.com/docs/graph-api/reference/user
*
* @param string $date
*/
public function __construct($date)
{
$parts = explode('/', $date);
$this->hasYear = count($parts) === 3 || count($parts) === 1;
$this->hasDate = count($parts) === 3 || count($parts) === 2;
parent::__construct($date);
}
/**
* Returns whether date object contains birth day and month
*
* @return bool
*/
public function hasDate()
{
return $this->hasDate;
}
/**
* Returns whether date object contains birth year
*
* @return bool
*/
public function hasYear()
{
return $this->hasYear;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class Collection
*
* Modified version of Collection in "illuminate/support" by Taylor Otwell
*
* @package Facebook
*/
use ArrayAccess;
use ArrayIterator;
use Countable;
use IteratorAggregate;
class Collection implements ArrayAccess, Countable, IteratorAggregate
{
/**
* The items contained in the collection.
*
* @var array
*/
protected $items = [];
/**
* Create a new collection.
*
* @param array $items
*/
public function __construct(array $items = [])
{
$this->items = $items;
}
/**
* Gets the value of a field from the Graph node.
*
* @param string $name The field to retrieve.
* @param mixed $default The default to return if the field doesn't exist.
*
* @return mixed
*/
public function getField($name, $default = null)
{
if (isset($this->items[$name])) {
return $this->items[$name];
}
return $default;
}
/**
* Gets the value of the named property for this graph object.
*
* @param string $name The property to retrieve.
* @param mixed $default The default to return if the property doesn't exist.
*
* @return mixed
*
* @deprecated 5.0.0 getProperty() has been renamed to getField()
* @todo v6: Remove this method
*/
public function getProperty($name, $default = null)
{
return $this->getField($name, $default);
}
/**
* Returns a list of all fields set on the object.
*
* @return array
*/
public function getFieldNames()
{
return array_keys($this->items);
}
/**
* Returns a list of all properties set on the object.
*
* @return array
*
* @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames()
* @todo v6: Remove this method
*/
public function getPropertyNames()
{
return $this->getFieldNames();
}
/**
* Get all of the items in the collection.
*
* @return array
*/
public function all()
{
return $this->items;
}
/**
* Get the collection of items as a plain array.
*
* @return array
*/
public function asArray()
{
return array_map(function ($value) {
return $value instanceof Collection ? $value->asArray() : $value;
}, $this->items);
}
/**
* Run a map over each of the items.
*
* @param \Closure $callback
*
* @return static
*/
public function map(\Closure $callback)
{
return new static(array_map($callback, $this->items, array_keys($this->items)));
}
/**
* Get the collection of items as JSON.
*
* @param int $options
*
* @return string
*/
public function asJson($options = 0)
{
return json_encode($this->asArray(), $options);
}
/**
* Count the number of items in the collection.
*
* @return int
*/
public function count()
{
return count($this->items);
}
/**
* Get an iterator for the items.
*
* @return ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->items);
}
/**
* Determine if an item exists at an offset.
*
* @param mixed $key
*
* @return bool
*/
public function offsetExists($key)
{
return array_key_exists($key, $this->items);
}
/**
* Get an item at a given offset.
*
* @param mixed $key
*
* @return mixed
*/
public function offsetGet($key)
{
return $this->items[$key];
}
/**
* Set the item at a given offset.
*
* @param mixed $key
* @param mixed $value
*
* @return void
*/
public function offsetSet($key, $value)
{
if (is_null($key)) {
$this->items[] = $value;
} else {
$this->items[$key] = $value;
}
}
/**
* Unset the item at a given offset.
*
* @param string $key
*
* @return void
*/
public function offsetUnset($key)
{
unset($this->items[$key]);
}
/**
* Convert the collection to its string representation.
*
* @return string
*/
public function __toString()
{
return $this->asJson();
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphAchievement
*
* @package Facebook
*/
class GraphAchievement extends GraphNode
{
/**
* @var array Maps object key names to Graph object types.
*/
protected static $graphObjectMap = [
'from' => '\Facebook\GraphNodes\GraphUser',
'application' => '\Facebook\GraphNodes\GraphApplication',
];
/**
* Returns the ID for the achievement.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the user who achieved this.
*
* @return GraphUser|null
*/
public function getFrom()
{
return $this->getField('from');
}
/**
* Returns the time at which this was achieved.
*
* @return \DateTime|null
*/
public function getPublishTime()
{
return $this->getField('publish_time');
}
/**
* Returns the app in which the user achieved this.
*
* @return GraphApplication|null
*/
public function getApplication()
{
return $this->getField('application');
}
/**
* Returns information about the achievement type this instance is connected with.
*
* @return array|null
*/
public function getData()
{
return $this->getField('data');
}
/**
* Returns the type of achievement.
*
* @see https://developers.facebook.com/docs/graph-api/reference/achievement
*
* @return string
*/
public function getType()
{
return 'game.achievement';
}
/**
* Indicates whether gaining the achievement published a feed story for the user.
*
* @return boolean|null
*/
public function isNoFeedStory()
{
return $this->getField('no_feed_story');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphAlbum
*
* @package Facebook
*/
class GraphAlbum extends GraphNode
{
/**
* @var array Maps object key names to Graph object types.
*/
protected static $graphObjectMap = [
'from' => '\Facebook\GraphNodes\GraphUser',
'place' => '\Facebook\GraphNodes\GraphPage',
];
/**
* Returns the ID for the album.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns whether the viewer can upload photos to this album.
*
* @return boolean|null
*/
public function getCanUpload()
{
return $this->getField('can_upload');
}
/**
* Returns the number of photos in this album.
*
* @return int|null
*/
public function getCount()
{
return $this->getField('count');
}
/**
* Returns the ID of the album's cover photo.
*
* @return string|null
*/
public function getCoverPhoto()
{
return $this->getField('cover_photo');
}
/**
* Returns the time the album was initially created.
*
* @return \DateTime|null
*/
public function getCreatedTime()
{
return $this->getField('created_time');
}
/**
* Returns the time the album was updated.
*
* @return \DateTime|null
*/
public function getUpdatedTime()
{
return $this->getField('updated_time');
}
/**
* Returns the description of the album.
*
* @return string|null
*/
public function getDescription()
{
return $this->getField('description');
}
/**
* Returns profile that created the album.
*
* @return GraphUser|null
*/
public function getFrom()
{
return $this->getField('from');
}
/**
* Returns profile that created the album.
*
* @return GraphPage|null
*/
public function getPlace()
{
return $this->getField('place');
}
/**
* Returns a link to this album on Facebook.
*
* @return string|null
*/
public function getLink()
{
return $this->getField('link');
}
/**
* Returns the textual location of the album.
*
* @return string|null
*/
public function getLocation()
{
return $this->getField('location');
}
/**
* Returns the title of the album.
*
* @return string|null
*/
public function getName()
{
return $this->getField('name');
}
/**
* Returns the privacy settings for the album.
*
* @return string|null
*/
public function getPrivacy()
{
return $this->getField('privacy');
}
/**
* Returns the type of the album.
*
* enum{ profile, mobile, wall, normal, album }
*
* @return string|null
*/
public function getType()
{
return $this->getField('type');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphApplication
*
* @package Facebook
*/
class GraphApplication extends GraphNode
{
/**
* Returns the ID for the application.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphCoverPhoto
*
* @package Facebook
*/
class GraphCoverPhoto extends GraphNode
{
/**
* Returns the id of cover if it exists
*
* @return int|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the source of cover if it exists
*
* @return string|null
*/
public function getSource()
{
return $this->getField('source');
}
/**
* Returns the offset_x of cover if it exists
*
* @return int|null
*/
public function getOffsetX()
{
return $this->getField('offset_x');
}
/**
* Returns the offset_y of cover if it exists
*
* @return int|null
*/
public function getOffsetY()
{
return $this->getField('offset_y');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
use Facebook\FacebookRequest;
use Facebook\Url\FacebookUrlManipulator;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class GraphEdge
*
* @package Facebook
*/
class GraphEdge extends Collection
{
/**
* @var FacebookRequest The original request that generated this data.
*/
protected $request;
/**
* @var array An array of Graph meta data like pagination, etc.
*/
protected $metaData = [];
/**
* @var string|null The parent Graph edge endpoint that generated the list.
*/
protected $parentEdgeEndpoint;
/**
* @var string|null The subclass of the child GraphNode's.
*/
protected $subclassName;
/**
* Init this collection of GraphNode's.
*
* @param FacebookRequest $request The original request that generated this data.
* @param array $data An array of GraphNode's.
* @param array $metaData An array of Graph meta data like pagination, etc.
* @param string|null $parentEdgeEndpoint The parent Graph edge endpoint that generated the list.
* @param string|null $subclassName The subclass of the child GraphNode's.
*/
public function __construct(FacebookRequest $request, array $data = [], array $metaData = [], $parentEdgeEndpoint = null, $subclassName = null)
{
$this->request = $request;
$this->metaData = $metaData;
$this->parentEdgeEndpoint = $parentEdgeEndpoint;
$this->subclassName = $subclassName;
parent::__construct($data);
}
/**
* Gets the parent Graph edge endpoint that generated the list.
*
* @return string|null
*/
public function getParentGraphEdge()
{
return $this->parentEdgeEndpoint;
}
/**
* Gets the subclass name that the child GraphNode's are cast as.
*
* @return string|null
*/
public function getSubClassName()
{
return $this->subclassName;
}
/**
* Returns the raw meta data associated with this GraphEdge.
*
* @return array
*/
public function getMetaData()
{
return $this->metaData;
}
/**
* Returns the next cursor if it exists.
*
* @return string|null
*/
public function getNextCursor()
{
return $this->getCursor('after');
}
/**
* Returns the previous cursor if it exists.
*
* @return string|null
*/
public function getPreviousCursor()
{
return $this->getCursor('before');
}
/**
* Returns the cursor for a specific direction if it exists.
*
* @param string $direction The direction of the page: after|before
*
* @return string|null
*/
public function getCursor($direction)
{
if (isset($this->metaData['paging']['cursors'][$direction])) {
return $this->metaData['paging']['cursors'][$direction];
}
return null;
}
/**
* Generates a pagination URL based on a cursor.
*
* @param string $direction The direction of the page: next|previous
*
* @return string|null
*
* @throws FacebookSDKException
*/
public function getPaginationUrl($direction)
{
$this->validateForPagination();
// Do we have a paging URL?
if (!isset($this->metaData['paging'][$direction])) {
return null;
}
$pageUrl = $this->metaData['paging'][$direction];
return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl);
}
/**
* Validates whether or not we can paginate on this request.
*
* @throws FacebookSDKException
*/
public function validateForPagination()
{
if ($this->request->getMethod() !== 'GET') {
throw new FacebookSDKException('You can only paginate on a GET request.', 720);
}
}
/**
* Gets the request object needed to make a next|previous page request.
*
* @param string $direction The direction of the page: next|previous
*
* @return FacebookRequest|null
*
* @throws FacebookSDKException
*/
public function getPaginationRequest($direction)
{
$pageUrl = $this->getPaginationUrl($direction);
if (!$pageUrl) {
return null;
}
$newRequest = clone $this->request;
$newRequest->setEndpoint($pageUrl);
return $newRequest;
}
/**
* Gets the request object needed to make a "next" page request.
*
* @return FacebookRequest|null
*
* @throws FacebookSDKException
*/
public function getNextPageRequest()
{
return $this->getPaginationRequest('next');
}
/**
* Gets the request object needed to make a "previous" page request.
*
* @return FacebookRequest|null
*
* @throws FacebookSDKException
*/
public function getPreviousPageRequest()
{
return $this->getPaginationRequest('previous');
}
/**
* The total number of results according to Graph if it exists.
*
* This will be returned if the summary=true modifier is present in the request.
*
* @return int|null
*/
public function getTotalCount()
{
if (isset($this->metaData['summary']['total_count'])) {
return $this->metaData['summary']['total_count'];
}
return null;
}
/**
* @inheritDoc
*/
public function map(\Closure $callback)
{
return new static(
$this->request,
array_map($callback, $this->items, array_keys($this->items)),
$this->metaData,
$this->parentEdgeEndpoint,
$this->subclassName
);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphEvent
*
* @package Facebook
*/
class GraphEvent extends GraphNode
{
/**
* @var array Maps object key names to GraphNode types.
*/
protected static $graphObjectMap = [
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
'place' => '\Facebook\GraphNodes\GraphPage',
'picture' => '\Facebook\GraphNodes\GraphPicture',
'parent_group' => '\Facebook\GraphNodes\GraphGroup',
];
/**
* Returns the `id` (The event ID) as string if present.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the `cover` (Cover picture) as GraphCoverPhoto if present.
*
* @return GraphCoverPhoto|null
*/
public function getCover()
{
return $this->getField('cover');
}
/**
* Returns the `description` (Long-form description) as string if present.
*
* @return string|null
*/
public function getDescription()
{
return $this->getField('description');
}
/**
* Returns the `end_time` (End time, if one has been set) as DateTime if present.
*
* @return \DateTime|null
*/
public function getEndTime()
{
return $this->getField('end_time');
}
/**
* Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present.
*
* @return bool|null
*/
public function getIsDateOnly()
{
return $this->getField('is_date_only');
}
/**
* Returns the `name` (Event name) as string if present.
*
* @return string|null
*/
public function getName()
{
return $this->getField('name');
}
/**
* Returns the `owner` (The profile that created the event) as GraphNode if present.
*
* @return GraphNode|null
*/
public function getOwner()
{
return $this->getField('owner');
}
/**
* Returns the `parent_group` (The group the event belongs to) as GraphGroup if present.
*
* @return GraphGroup|null
*/
public function getParentGroup()
{
return $this->getField('parent_group');
}
/**
* Returns the `place` (Event Place information) as GraphPage if present.
*
* @return GraphPage|null
*/
public function getPlace()
{
return $this->getField('place');
}
/**
* Returns the `privacy` (Who can see the event) as string if present.
*
* @return string|null
*/
public function getPrivacy()
{
return $this->getField('privacy');
}
/**
* Returns the `start_time` (Start time) as DateTime if present.
*
* @return \DateTime|null
*/
public function getStartTime()
{
return $this->getField('start_time');
}
/**
* Returns the `ticket_uri` (The link users can visit to buy a ticket to this event) as string if present.
*
* @return string|null
*/
public function getTicketUri()
{
return $this->getField('ticket_uri');
}
/**
* Returns the `timezone` (Timezone) as string if present.
*
* @return string|null
*/
public function getTimezone()
{
return $this->getField('timezone');
}
/**
* Returns the `updated_time` (Last update time) as DateTime if present.
*
* @return \DateTime|null
*/
public function getUpdatedTime()
{
return $this->getField('updated_time');
}
/**
* Returns the `picture` (Event picture) as GraphPicture if present.
*
* @return GraphPicture|null
*/
public function getPicture()
{
return $this->getField('picture');
}
/**
* Returns the `attending_count` (Number of people attending the event) as int if present.
*
* @return int|null
*/
public function getAttendingCount()
{
return $this->getField('attending_count');
}
/**
* Returns the `declined_count` (Number of people who declined the event) as int if present.
*
* @return int|null
*/
public function getDeclinedCount()
{
return $this->getField('declined_count');
}
/**
* Returns the `maybe_count` (Number of people who maybe going to the event) as int if present.
*
* @return int|null
*/
public function getMaybeCount()
{
return $this->getField('maybe_count');
}
/**
* Returns the `noreply_count` (Number of people who did not reply to the event) as int if present.
*
* @return int|null
*/
public function getNoreplyCount()
{
return $this->getField('noreply_count');
}
/**
* Returns the `invited_count` (Number of people invited to the event) as int if present.
*
* @return int|null
*/
public function getInvitedCount()
{
return $this->getField('invited_count');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphGroup
*
* @package Facebook
*/
class GraphGroup extends GraphNode
{
/**
* @var array Maps object key names to GraphNode types.
*/
protected static $graphObjectMap = [
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
'venue' => '\Facebook\GraphNodes\GraphLocation',
];
/**
* Returns the `id` (The Group ID) as string if present.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the `cover` (The cover photo of the Group) as GraphCoverPhoto if present.
*
* @return GraphCoverPhoto|null
*/
public function getCover()
{
return $this->getField('cover');
}
/**
* Returns the `description` (A brief description of the Group) as string if present.
*
* @return string|null
*/
public function getDescription()
{
return $this->getField('description');
}
/**
* Returns the `email` (The email address to upload content to the Group. Only current members of the Group can use this) as string if present.
*
* @return string|null
*/
public function getEmail()
{
return $this->getField('email');
}
/**
* Returns the `icon` (The URL for the Group's icon) as string if present.
*
* @return string|null
*/
public function getIcon()
{
return $this->getField('icon');
}
/**
* Returns the `link` (The Group's website) as string if present.
*
* @return string|null
*/
public function getLink()
{
return $this->getField('link');
}
/**
* Returns the `name` (The name of the Group) as string if present.
*
* @return string|null
*/
public function getName()
{
return $this->getField('name');
}
/**
* Returns the `member_request_count` (Number of people asking to join the group.) as int if present.
*
* @return int|null
*/
public function getMemberRequestCount()
{
return $this->getField('member_request_count');
}
/**
* Returns the `owner` (The profile that created this Group) as GraphNode if present.
*
* @return GraphNode|null
*/
public function getOwner()
{
return $this->getField('owner');
}
/**
* Returns the `parent` (The parent Group of this Group, if it exists) as GraphNode if present.
*
* @return GraphNode|null
*/
public function getParent()
{
return $this->getField('parent');
}
/**
* Returns the `privacy` (The privacy setting of the Group) as string if present.
*
* @return string|null
*/
public function getPrivacy()
{
return $this->getField('privacy');
}
/**
* Returns the `updated_time` (The last time the Group was updated (this includes changes in the Group's properties and changes in posts and comments if user can see them)) as \DateTime if present.
*
* @return \DateTime|null
*/
public function getUpdatedTime()
{
return $this->getField('updated_time');
}
/**
* Returns the `venue` (The location for the Group) as GraphLocation if present.
*
* @return GraphLocation|null
*/
public function getVenue()
{
return $this->getField('venue');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphList
*
* @package Facebook
*
* @deprecated 5.0.0 GraphList has been renamed to GraphEdge
* @todo v6: Remove this class
*/
class GraphList extends GraphEdge
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphLocation
*
* @package Facebook
*/
class GraphLocation extends GraphNode
{
/**
* Returns the street component of the location
*
* @return string|null
*/
public function getStreet()
{
return $this->getField('street');
}
/**
* Returns the city component of the location
*
* @return string|null
*/
public function getCity()
{
return $this->getField('city');
}
/**
* Returns the state component of the location
*
* @return string|null
*/
public function getState()
{
return $this->getField('state');
}
/**
* Returns the country component of the location
*
* @return string|null
*/
public function getCountry()
{
return $this->getField('country');
}
/**
* Returns the zipcode component of the location
*
* @return string|null
*/
public function getZip()
{
return $this->getField('zip');
}
/**
* Returns the latitude component of the location
*
* @return float|null
*/
public function getLatitude()
{
return $this->getField('latitude');
}
/**
* Returns the street component of the location
*
* @return float|null
*/
public function getLongitude()
{
return $this->getField('longitude');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphNode
*
* @package Facebook
*/
class GraphNode extends Collection
{
/**
* @var array Maps object key names to Graph object types.
*/
protected static $graphObjectMap = [];
/**
* Init this Graph object.
*
* @param array $data
*/
public function __construct(array $data = [])
{
parent::__construct($this->castItems($data));
}
/**
* Iterates over an array and detects the types each node
* should be cast to and returns all the items as an array.
*
* @TODO Add auto-casting to AccessToken entities.
*
* @param array $data The array to iterate over.
*
* @return array
*/
public function castItems(array $data)
{
$items = [];
foreach ($data as $k => $v) {
if ($this->shouldCastAsDateTime($k)
&& (is_numeric($v)
|| $this->isIso8601DateString($v))
) {
$items[$k] = $this->castToDateTime($v);
} elseif ($k === 'birthday') {
$items[$k] = $this->castToBirthday($v);
} else {
$items[$k] = $v;
}
}
return $items;
}
/**
* Uncasts any auto-casted datatypes.
* Basically the reverse of castItems().
*
* @return array
*/
public function uncastItems()
{
$items = $this->asArray();
return array_map(function ($v) {
if ($v instanceof \DateTime) {
return $v->format(\DateTime::ISO8601);
}
return $v;
}, $items);
}
/**
* Get the collection of items as JSON.
*
* @param int $options
*
* @return string
*/
public function asJson($options = 0)
{
return json_encode($this->uncastItems(), $options);
}
/**
* Detects an ISO 8601 formatted string.
*
* @param string $string
*
* @return boolean
*
* @see https://developers.facebook.com/docs/graph-api/using-graph-api/#readmodifiers
* @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html
* @see http://en.wikipedia.org/wiki/ISO_8601
*/
public function isIso8601DateString($string)
{
// This insane regex was yoinked from here:
// http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
// ...and I'm all like:
// http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why
$crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))'
. '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?'
. '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d'
. '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])'
. '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d'
. '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/';
return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1;
}
/**
* Determines if a value from Graph should be cast to DateTime.
*
* @param string $key
*
* @return boolean
*/
public function shouldCastAsDateTime($key)
{
return in_array($key, [
'created_time',
'updated_time',
'start_time',
'end_time',
'backdated_time',
'issued_at',
'expires_at',
'publish_time'
], true);
}
/**
* Casts a date value from Graph to DateTime.
*
* @param int|string $value
*
* @return \DateTime
*/
public function castToDateTime($value)
{
if (is_int($value)) {
$dt = new \DateTime();
$dt->setTimestamp($value);
} else {
$dt = new \DateTime($value);
}
return $dt;
}
/**
* Casts a birthday value from Graph to Birthday
*
* @param string $value
*
* @return Birthday
*/
public function castToBirthday($value)
{
return new Birthday($value);
}
/**
* Getter for $graphObjectMap.
*
* @return array
*/
public static function getObjectMap()
{
return static::$graphObjectMap;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
use Facebook\FacebookResponse;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class GraphNodeFactory
*
* @package Facebook
*
* ## Assumptions ##
* GraphEdge - is ALWAYS a numeric array
* GraphEdge - is ALWAYS an array of GraphNode types
* GraphNode - is ALWAYS an associative array
* GraphNode - MAY contain GraphNode's "recurrable"
* GraphNode - MAY contain GraphEdge's "recurrable"
* GraphNode - MAY contain DateTime's "primitives"
* GraphNode - MAY contain string's "primitives"
*/
class GraphNodeFactory
{
/**
* @const string The base graph object class.
*/
const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphNode';
/**
* @const string The base graph edge class.
*/
const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphEdge';
/**
* @const string The graph object prefix.
*/
const BASE_GRAPH_OBJECT_PREFIX = '\Facebook\GraphNodes\\';
/**
* @var FacebookResponse The response entity from Graph.
*/
protected $response;
/**
* @var array The decoded body of the FacebookResponse entity from Graph.
*/
protected $decodedBody;
/**
* Init this Graph object.
*
* @param FacebookResponse $response The response entity from Graph.
*/
public function __construct(FacebookResponse $response)
{
$this->response = $response;
$this->decodedBody = $response->getDecodedBody();
}
/**
* Tries to convert a FacebookResponse entity into a GraphNode.
*
* @param string|null $subclassName The GraphNode sub class to cast to.
*
* @return GraphNode
*
* @throws FacebookSDKException
*/
public function makeGraphNode($subclassName = null)
{
$this->validateResponseAsArray();
$this->validateResponseCastableAsGraphNode();
return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
}
/**
* Convenience method for creating a GraphAchievement collection.
*
* @return GraphAchievement
*
* @throws FacebookSDKException
*/
public function makeGraphAchievement()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement');
}
/**
* Convenience method for creating a GraphAlbum collection.
*
* @return GraphAlbum
*
* @throws FacebookSDKException
*/
public function makeGraphAlbum()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum');
}
/**
* Convenience method for creating a GraphPage collection.
*
* @return GraphPage
*
* @throws FacebookSDKException
*/
public function makeGraphPage()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage');
}
/**
* Convenience method for creating a GraphSessionInfo collection.
*
* @return GraphSessionInfo
*
* @throws FacebookSDKException
*/
public function makeGraphSessionInfo()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo');
}
/**
* Convenience method for creating a GraphUser collection.
*
* @return GraphUser
*
* @throws FacebookSDKException
*/
public function makeGraphUser()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser');
}
/**
* Convenience method for creating a GraphEvent collection.
*
* @return GraphEvent
*
* @throws FacebookSDKException
*/
public function makeGraphEvent()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
}
/**
* Convenience method for creating a GraphGroup collection.
*
* @return GraphGroup
*
* @throws FacebookSDKException
*/
public function makeGraphGroup()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup');
}
/**
* Tries to convert a FacebookResponse entity into a GraphEdge.
*
* @param string|null $subclassName The GraphNode sub class to cast the list items to.
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
*
* @return GraphEdge
*
* @throws FacebookSDKException
*/
public function makeGraphEdge($subclassName = null, $auto_prefix = true)
{
$this->validateResponseAsArray();
$this->validateResponseCastableAsGraphEdge();
if ($subclassName && $auto_prefix) {
$subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName;
}
return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName);
}
/**
* Validates the decoded body.
*
* @throws FacebookSDKException
*/
public function validateResponseAsArray()
{
if (!is_array($this->decodedBody)) {
throw new FacebookSDKException('Unable to get response from Graph as array.', 620);
}
}
/**
* Validates that the return data can be cast as a GraphNode.
*
* @throws FacebookSDKException
*/
public function validateResponseCastableAsGraphNode()
{
if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) {
throw new FacebookSDKException(
'Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.',
620
);
}
}
/**
* Validates that the return data can be cast as a GraphEdge.
*
* @throws FacebookSDKException
*/
public function validateResponseCastableAsGraphEdge()
{
if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) {
throw new FacebookSDKException(
'Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.',
620
);
}
}
/**
* Safely instantiates a GraphNode of $subclassName.
*
* @param array $data The array of data to iterate over.
* @param string|null $subclassName The subclass to cast this collection to.
*
* @return GraphNode
*
* @throws FacebookSDKException
*/
public function safelyMakeGraphNode(array $data, $subclassName = null)
{
$subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS;
static::validateSubclass($subclassName);
// Remember the parent node ID
$parentNodeId = isset($data['id']) ? $data['id'] : null;
$items = [];
foreach ($data as $k => $v) {
// Array means could be recurable
if (is_array($v)) {
// Detect any smart-casting from the $graphObjectMap array.
// This is always empty on the GraphNode collection, but subclasses can define
// their own array of smart-casting types.
$graphObjectMap = $subclassName::getObjectMap();
$objectSubClass = isset($graphObjectMap[$k])
? $graphObjectMap[$k]
: null;
// Could be a GraphEdge or GraphNode
$items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId);
} else {
$items[$k] = $v;
}
}
return new $subclassName($items);
}
/**
* Takes an array of values and determines how to cast each node.
*
* @param array $data The array of data to iterate over.
* @param string|null $subclassName The subclass to cast this collection to.
* @param string|null $parentKey The key of this data (Graph edge).
* @param string|null $parentNodeId The parent Graph node ID.
*
* @return GraphNode|GraphEdge
*
* @throws FacebookSDKException
*/
public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
{
if (isset($data['data'])) {
// Create GraphEdge
if (static::isCastableAsGraphEdge($data['data'])) {
return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId);
}
// Sometimes Graph is a weirdo and returns a GraphNode under the "data" key
$data = $data['data'];
}
// Create GraphNode
return $this->safelyMakeGraphNode($data, $subclassName);
}
/**
* Return an array of GraphNode's.
*
* @param array $data The array of data to iterate over.
* @param string|null $subclassName The GraphNode subclass to cast each item in the list to.
* @param string|null $parentKey The key of this data (Graph edge).
* @param string|null $parentNodeId The parent Graph node ID.
*
* @return GraphEdge
*
* @throws FacebookSDKException
*/
public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null)
{
if (!isset($data['data'])) {
throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620);
}
$dataList = [];
foreach ($data['data'] as $graphNode) {
$dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName);
}
$metaData = $this->getMetaData($data);
// We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination)
$parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null;
$className = static::BASE_GRAPH_EDGE_CLASS;
return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName);
}
/**
* Get the meta data from a list in a Graph response.
*
* @param array $data The Graph response.
*
* @return array
*/
public function getMetaData(array $data)
{
unset($data['data']);
return $data;
}
/**
* Determines whether or not the data should be cast as a GraphEdge.
*
* @param array $data
*
* @return boolean
*/
public static function isCastableAsGraphEdge(array $data)
{
if ($data === []) {
return true;
}
// Checks for a sequential numeric array which would be a GraphEdge
return array_keys($data) === range(0, count($data) - 1);
}
/**
* Ensures that the subclass in question is valid.
*
* @param string $subclassName The GraphNode subclass to validate.
*
* @throws FacebookSDKException
*/
public static function validateSubclass($subclassName)
{
if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) {
return;
}
throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphObject
*
* @package Facebook
*
* @deprecated 5.0.0 GraphObject has been renamed to GraphNode
* @todo v6: Remove this class
*/
class GraphObject extends GraphNode
{
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class GraphObjectFactory
*
* @package Facebook
*
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
* @todo v6: Remove this class
*/
class GraphObjectFactory extends GraphNodeFactory
{
/**
* @const string The base graph object class.
*/
const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphObject';
/**
* @const string The base graph edge class.
*/
const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphList';
/**
* Tries to convert a FacebookResponse entity into a GraphNode.
*
* @param string|null $subclassName The GraphNode sub class to cast to.
*
* @return GraphNode
*
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
*/
public function makeGraphObject($subclassName = null)
{
return $this->makeGraphNode($subclassName);
}
/**
* Convenience method for creating a GraphEvent collection.
*
* @return GraphEvent
*
* @throws FacebookSDKException
*/
public function makeGraphEvent()
{
return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
}
/**
* Tries to convert a FacebookResponse entity into a GraphEdge.
*
* @param string|null $subclassName The GraphNode sub class to cast the list items to.
* @param boolean $auto_prefix Toggle to auto-prefix the subclass name.
*
* @return GraphEdge
*
* @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
*/
public function makeGraphList($subclassName = null, $auto_prefix = true)
{
return $this->makeGraphEdge($subclassName, $auto_prefix);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphPage
*
* @package Facebook
*/
class GraphPage extends GraphNode
{
/**
* @var array Maps object key names to Graph object types.
*/
protected static $graphObjectMap = [
'best_page' => '\Facebook\GraphNodes\GraphPage',
'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
'location' => '\Facebook\GraphNodes\GraphLocation',
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
'picture' => '\Facebook\GraphNodes\GraphPicture',
];
/**
* Returns the ID for the user's page as a string if present.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the Category for the user's page as a string if present.
*
* @return string|null
*/
public function getCategory()
{
return $this->getField('category');
}
/**
* Returns the Name of the user's page as a string if present.
*
* @return string|null
*/
public function getName()
{
return $this->getField('name');
}
/**
* Returns the best available Page on Facebook.
*
* @return GraphPage|null
*/
public function getBestPage()
{
return $this->getField('best_page');
}
/**
* Returns the brand's global (parent) Page.
*
* @return GraphPage|null
*/
public function getGlobalBrandParentPage()
{
return $this->getField('global_brand_parent_page');
}
/**
* Returns the location of this place.
*
* @return GraphLocation|null
*/
public function getLocation()
{
return $this->getField('location');
}
/**
* Returns CoverPhoto of the Page.
*
* @return GraphCoverPhoto|null
*/
public function getCover()
{
return $this->getField('cover');
}
/**
* Returns Picture of the Page.
*
* @return GraphPicture|null
*/
public function getPicture()
{
return $this->getField('picture');
}
/**
* Returns the page access token for the admin user.
*
* Only available in the `/me/accounts` context.
*
* @return string|null
*/
public function getAccessToken()
{
return $this->getField('access_token');
}
/**
* Returns the roles of the page admin user.
*
* Only available in the `/me/accounts` context.
*
* @return array|null
*/
public function getPerms()
{
return $this->getField('perms');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphPicture
*
* @package Facebook
*/
class GraphPicture extends GraphNode
{
/**
* Returns true if user picture is silhouette.
*
* @return bool|null
*/
public function isSilhouette()
{
return $this->getField('is_silhouette');
}
/**
* Returns the url of user picture if it exists
*
* @return string|null
*/
public function getUrl()
{
return $this->getField('url');
}
/**
* Returns the width of user picture if it exists
*
* @return int|null
*/
public function getWidth()
{
return $this->getField('width');
}
/**
* Returns the height of user picture if it exists
*
* @return int|null
*/
public function getHeight()
{
return $this->getField('height');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphSessionInfo
*
* @package Facebook
*/
class GraphSessionInfo extends GraphNode
{
/**
* Returns the application id the token was issued for.
*
* @return string|null
*/
public function getAppId()
{
return $this->getField('app_id');
}
/**
* Returns the application name the token was issued for.
*
* @return string|null
*/
public function getApplication()
{
return $this->getField('application');
}
/**
* Returns the date & time that the token expires.
*
* @return \DateTime|null
*/
public function getExpiresAt()
{
return $this->getField('expires_at');
}
/**
* Returns whether the token is valid.
*
* @return boolean
*/
public function getIsValid()
{
return $this->getField('is_valid');
}
/**
* Returns the date & time the token was issued at.
*
* @return \DateTime|null
*/
public function getIssuedAt()
{
return $this->getField('issued_at');
}
/**
* Returns the scope permissions associated with the token.
*
* @return array
*/
public function getScopes()
{
return $this->getField('scopes');
}
/**
* Returns the login id of the user associated with the token.
*
* @return string|null
*/
public function getUserId()
{
return $this->getField('user_id');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\GraphNodes;
/**
* Class GraphUser
*
* @package Facebook
*/
class GraphUser extends GraphNode
{
/**
* @var array Maps object key names to Graph object types.
*/
protected static $graphObjectMap = [
'hometown' => '\Facebook\GraphNodes\GraphPage',
'location' => '\Facebook\GraphNodes\GraphPage',
'significant_other' => '\Facebook\GraphNodes\GraphUser',
'picture' => '\Facebook\GraphNodes\GraphPicture',
];
/**
* Returns the ID for the user as a string if present.
*
* @return string|null
*/
public function getId()
{
return $this->getField('id');
}
/**
* Returns the name for the user as a string if present.
*
* @return string|null
*/
public function getName()
{
return $this->getField('name');
}
/**
* Returns the first name for the user as a string if present.
*
* @return string|null
*/
public function getFirstName()
{
return $this->getField('first_name');
}
/**
* Returns the middle name for the user as a string if present.
*
* @return string|null
*/
public function getMiddleName()
{
return $this->getField('middle_name');
}
/**
* Returns the last name for the user as a string if present.
*
* @return string|null
*/
public function getLastName()
{
return $this->getField('last_name');
}
/**
* Returns the email for the user as a string if present.
*
* @return string|null
*/
public function getEmail()
{
return $this->getField('email');
}
/**
* Returns the gender for the user as a string if present.
*
* @return string|null
*/
public function getGender()
{
return $this->getField('gender');
}
/**
* Returns the Facebook URL for the user as a string if available.
*
* @return string|null
*/
public function getLink()
{
return $this->getField('link');
}
/**
* Returns the users birthday, if available.
*
* @return \DateTime|null
*/
public function getBirthday()
{
return $this->getField('birthday');
}
/**
* Returns the current location of the user as a GraphPage.
*
* @return GraphPage|null
*/
public function getLocation()
{
return $this->getField('location');
}
/**
* Returns the current location of the user as a GraphPage.
*
* @return GraphPage|null
*/
public function getHometown()
{
return $this->getField('hometown');
}
/**
* Returns the current location of the user as a GraphUser.
*
* @return GraphUser|null
*/
public function getSignificantOther()
{
return $this->getField('significant_other');
}
/**
* Returns the picture of the user as a GraphPicture
*
* @return GraphPicture|null
*/
public function getPicture()
{
return $this->getField('picture');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Helpers;
/**
* Class FacebookCanvasLoginHelper
*
* @package Facebook
*/
class FacebookCanvasHelper extends FacebookSignedRequestFromInputHelper
{
/**
* Returns the app data value.
*
* @return mixed|null
*/
public function getAppData()
{
return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
}
/**
* Get raw signed request from POST.
*
* @return string|null
*/
public function getRawSignedRequest()
{
return $this->getRawSignedRequestFromPost() ?: null;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Helpers;
/**
* Class FacebookJavaScriptLoginHelper
*
* @package Facebook
*/
class FacebookJavaScriptHelper extends FacebookSignedRequestFromInputHelper
{
/**
* Get raw signed request from the cookie.
*
* @return string|null
*/
public function getRawSignedRequest()
{
return $this->getRawSignedRequestFromCookie();
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Helpers;
use Facebook\FacebookApp;
use Facebook\FacebookClient;
/**
* Class FacebookPageTabHelper
*
* @package Facebook
*/
class FacebookPageTabHelper extends FacebookCanvasHelper
{
/**
* @var array|null
*/
protected $pageData;
/**
* Initialize the helper and process available signed request data.
*
* @param FacebookApp $app The FacebookApp entity.
* @param FacebookClient $client The client to make HTTP requests.
* @param string|null $graphVersion The version of Graph to use.
*/
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
{
parent::__construct($app, $client, $graphVersion);
if (!$this->signedRequest) {
return;
}
$this->pageData = $this->signedRequest->get('page');
}
/**
* Returns a value from the page data.
*
* @param string $key
* @param mixed|null $default
*
* @return mixed|null
*/
public function getPageData($key, $default = null)
{
if (isset($this->pageData[$key])) {
return $this->pageData[$key];
}
return $default;
}
/**
* Returns true if the user is an admin.
*
* @return boolean
*/
public function isAdmin()
{
return $this->getPageData('admin') === true;
}
/**
* Returns the page id if available.
*
* @return string|null
*/
public function getPageId()
{
return $this->getPageData('id');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Helpers;
use Facebook\Authentication\AccessToken;
use Facebook\Authentication\OAuth2Client;
use Facebook\Exceptions\FacebookSDKException;
use Facebook\PersistentData\FacebookSessionPersistentDataHandler;
use Facebook\PersistentData\PersistentDataInterface;
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorFactory;
use Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface;
use Facebook\Url\FacebookUrlDetectionHandler;
use Facebook\Url\FacebookUrlManipulator;
use Facebook\Url\UrlDetectionInterface;
/**
* Class FacebookRedirectLoginHelper
*
* @package Facebook
*/
class FacebookRedirectLoginHelper
{
/**
* @const int The length of CSRF string to validate the login link.
*/
const CSRF_LENGTH = 32;
/**
* @var OAuth2Client The OAuth 2.0 client service.
*/
protected $oAuth2Client;
/**
* @var UrlDetectionInterface The URL detection handler.
*/
protected $urlDetectionHandler;
/**
* @var PersistentDataInterface The persistent data handler.
*/
protected $persistentDataHandler;
/**
* @var PseudoRandomStringGeneratorInterface The cryptographically secure pseudo-random string generator.
*/
protected $pseudoRandomStringGenerator;
/**
* @param OAuth2Client $oAuth2Client The OAuth 2.0 client service.
* @param PersistentDataInterface|null $persistentDataHandler The persistent data handler.
* @param UrlDetectionInterface|null $urlHandler The URL detection handler.
* @param PseudoRandomStringGeneratorInterface|null $prsg The cryptographically secure pseudo-random string generator.
*/
public function __construct(OAuth2Client $oAuth2Client, PersistentDataInterface $persistentDataHandler = null, UrlDetectionInterface $urlHandler = null, PseudoRandomStringGeneratorInterface $prsg = null)
{
$this->oAuth2Client = $oAuth2Client;
$this->persistentDataHandler = $persistentDataHandler ?: new FacebookSessionPersistentDataHandler();
$this->urlDetectionHandler = $urlHandler ?: new FacebookUrlDetectionHandler();
$this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator($prsg);
}
/**
* Returns the persistent data handler.
*
* @return PersistentDataInterface
*/
public function getPersistentDataHandler()
{
return $this->persistentDataHandler;
}
/**
* Returns the URL detection handler.
*
* @return UrlDetectionInterface
*/
public function getUrlDetectionHandler()
{
return $this->urlDetectionHandler;
}
/**
* Returns the cryptographically secure pseudo-random string generator.
*
* @return PseudoRandomStringGeneratorInterface
*/
public function getPseudoRandomStringGenerator()
{
return $this->pseudoRandomStringGenerator;
}
/**
* Stores CSRF state and returns a URL to which the user should be sent to in order to continue the login process with Facebook.
*
* @param string $redirectUrl The URL Facebook should redirect users to after login.
* @param array $scope List of permissions to request during login.
* @param array $params An array of parameters to generate URL.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*/
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
{
$state = $this->persistentDataHandler->get('state') ?: $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
$this->persistentDataHandler->set('state', $state);
return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
}
/**
* Returns the URL to send the user in order to login to Facebook.
*
* @param string $redirectUrl The URL Facebook should redirect users to after login.
* @param array $scope List of permissions to request during login.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*/
public function getLoginUrl($redirectUrl, array $scope = [], $separator = '&')
{
return $this->makeUrl($redirectUrl, $scope, [], $separator);
}
/**
* Returns the URL to send the user in order to log out of Facebook.
*
* @param AccessToken|string $accessToken The access token that will be logged out.
* @param string $next The url Facebook should redirect the user to after a successful logout.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*
* @throws FacebookSDKException
*/
public function getLogoutUrl($accessToken, $next, $separator = '&')
{
if (!$accessToken instanceof AccessToken) {
$accessToken = new AccessToken($accessToken);
}
if ($accessToken->isAppAccessToken()) {
throw new FacebookSDKException('Cannot generate a logout URL with an app access token.', 722);
}
$params = [
'next' => $next,
'access_token' => $accessToken->getValue(),
];
return 'https://www.facebook.com/logout.php?' . http_build_query($params, null, $separator);
}
/**
* Returns the URL to send the user in order to login to Facebook with permission(s) to be re-asked.
*
* @param string $redirectUrl The URL Facebook should redirect users to after login.
* @param array $scope List of permissions to request during login.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*/
public function getReRequestUrl($redirectUrl, array $scope = [], $separator = '&')
{
$params = ['auth_type' => 'rerequest'];
return $this->makeUrl($redirectUrl, $scope, $params, $separator);
}
/**
* Returns the URL to send the user in order to login to Facebook with user to be re-authenticated.
*
* @param string $redirectUrl The URL Facebook should redirect users to after login.
* @param array $scope List of permissions to request during login.
* @param string $separator The separator to use in http_build_query().
*
* @return string
*/
public function getReAuthenticationUrl($redirectUrl, array $scope = [], $separator = '&')
{
$params = ['auth_type' => 'reauthenticate'];
return $this->makeUrl($redirectUrl, $scope, $params, $separator);
}
/**
* Takes a valid code from a login redirect, and returns an AccessToken entity.
*
* @param string|null $redirectUrl The redirect URL.
*
* @return AccessToken|null
*
* @throws FacebookSDKException
*/
public function getAccessToken($redirectUrl = null)
{
if (!$code = $this->getCode()) {
return null;
}
$this->validateCsrf();
$this->resetCsrf();
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
// At minimum we need to remove the state param
$redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);
return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
}
/**
* Validate the request against a cross-site request forgery.
*
* @throws FacebookSDKException
*/
protected function validateCsrf()
{
$state = $this->getState();
if (!$state) {
throw new FacebookSDKException('Cross-site request forgery validation failed. Required GET param "state" missing.');
}
$savedState = $this->persistentDataHandler->get('state');
if (!$savedState) {
throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing from persistent data.');
}
if (\hash_equals($savedState, $state)) {
return;
}
throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
}
/**
* Resets the CSRF so that it doesn't get reused.
*/
private function resetCsrf()
{
$this->persistentDataHandler->set('state', null);
}
/**
* Return the code.
*
* @return string|null
*/
protected function getCode()
{
return $this->getInput('code');
}
/**
* Return the state.
*
* @return string|null
*/
protected function getState()
{
return $this->getInput('state');
}
/**
* Return the error code.
*
* @return string|null
*/
public function getErrorCode()
{
return $this->getInput('error_code');
}
/**
* Returns the error.
*
* @return string|null
*/
public function getError()
{
return $this->getInput('error');
}
/**
* Returns the error reason.
*
* @return string|null
*/
public function getErrorReason()
{
return $this->getInput('error_reason');
}
/**
* Returns the error description.
*
* @return string|null
*/
public function getErrorDescription()
{
return $this->getInput('error_description');
}
/**
* Returns a value from a GET param.
*
* @param string $key
*
* @return string|null
*/
private function getInput($key)
{
return isset($_GET[$key]) ? $_GET[$key] : null;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Helpers;
use Facebook\Facebook;
use Facebook\FacebookApp;
use Facebook\FacebookClient;
use Facebook\SignedRequest;
use Facebook\Authentication\AccessToken;
use Facebook\Authentication\OAuth2Client;
/**
* Class FacebookSignedRequestFromInputHelper
*
* @package Facebook
*/
abstract class FacebookSignedRequestFromInputHelper
{
/**
* @var SignedRequest|null The SignedRequest entity.
*/
protected $signedRequest;
/**
* @var FacebookApp The FacebookApp entity.
*/
protected $app;
/**
* @var OAuth2Client The OAuth 2.0 client service.
*/
protected $oAuth2Client;
/**
* Initialize the helper and process available signed request data.
*
* @param FacebookApp $app The FacebookApp entity.
* @param FacebookClient $client The client to make HTTP requests.
* @param string|null $graphVersion The version of Graph to use.
*/
public function __construct(FacebookApp $app, FacebookClient $client, $graphVersion = null)
{
$this->app = $app;
$graphVersion = $graphVersion ?: Facebook::DEFAULT_GRAPH_VERSION;
$this->oAuth2Client = new OAuth2Client($this->app, $client, $graphVersion);
$this->instantiateSignedRequest();
}
/**
* Instantiates a new SignedRequest entity.
*
* @param string|null
*/
public function instantiateSignedRequest($rawSignedRequest = null)
{
$rawSignedRequest = $rawSignedRequest ?: $this->getRawSignedRequest();
if (!$rawSignedRequest) {
return;
}
$this->signedRequest = new SignedRequest($this->app, $rawSignedRequest);
}
/**
* Returns an AccessToken entity from the signed request.
*
* @return AccessToken|null
*
* @throws \Facebook\Exceptions\FacebookSDKException
*/
public function getAccessToken()
{
if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
$code = $this->signedRequest->get('code');
$accessToken = $this->signedRequest->get('oauth_token');
if ($code && !$accessToken) {
return $this->oAuth2Client->getAccessTokenFromCode($code);
}
$expiresAt = $this->signedRequest->get('expires', 0);
return new AccessToken($accessToken, $expiresAt);
}
return null;
}
/**
* Returns the SignedRequest entity.
*
* @return SignedRequest|null
*/
public function getSignedRequest()
{
return $this->signedRequest;
}
/**
* Returns the user_id if available.
*
* @return string|null
*/
public function getUserId()
{
return $this->signedRequest ? $this->signedRequest->getUserId() : null;
}
/**
* Get raw signed request from input.
*
* @return string|null
*/
abstract public function getRawSignedRequest();
/**
* Get raw signed request from POST input.
*
* @return string|null
*/
public function getRawSignedRequestFromPost()
{
if (isset($_POST['signed_request'])) {
return $_POST['signed_request'];
}
return null;
}
/**
* Get raw signed request from cookie set from the Javascript SDK.
*
* @return string|null
*/
public function getRawSignedRequestFromCookie()
{
if (isset($_COOKIE['fbsr_' . $this->app->getId()])) {
return $_COOKIE['fbsr_' . $this->app->getId()];
}
return null;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Http;
/**
* Class GraphRawResponse
*
* @package Facebook
*/
class GraphRawResponse
{
/**
* @var array The response headers in the form of an associative array.
*/
protected $headers;
/**
* @var string The raw response body.
*/
protected $body;
/**
* @var int The HTTP status response code.
*/
protected $httpResponseCode;
/**
* Creates a new GraphRawResponse entity.
*
* @param string|array $headers The headers as a raw string or array.
* @param string $body The raw response body.
* @param int $httpStatusCode The HTTP response code (if sending headers as parsed array).
*/
public function __construct($headers, $body, $httpStatusCode = null)
{
if (is_numeric($httpStatusCode)) {
$this->httpResponseCode = (int)$httpStatusCode;
}
if (is_array($headers)) {
$this->headers = $headers;
} else {
$this->setHeadersFromString($headers);
}
$this->body = $body;
}
/**
* Return the response headers.
*
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Return the body of the response.
*
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* Return the HTTP response code.
*
* @return int
*/
public function getHttpResponseCode()
{
return $this->httpResponseCode;
}
/**
* Sets the HTTP response code from a raw header.
*
* @param string $rawResponseHeader
*/
public function setHttpResponseCodeFromHeader($rawResponseHeader)
{
preg_match('|HTTP/\d\.\d\s+(\d+)\s+.*|', $rawResponseHeader, $match);
$this->httpResponseCode = (int)$match[1];
}
/**
* Parse the raw headers and set as an array.
*
* @param string $rawHeaders The raw headers from the response.
*/
protected function setHeadersFromString($rawHeaders)
{
// Normalize line breaks
$rawHeaders = str_replace("\r\n", "\n", $rawHeaders);
// There will be multiple headers if a 301 was followed
// or a proxy was followed, etc
$headerCollection = explode("\n\n", trim($rawHeaders));
// We just want the last response (at the end)
$rawHeader = array_pop($headerCollection);
$headerComponents = explode("\n", $rawHeader);
foreach ($headerComponents as $line) {
if (strpos($line, ': ') === false) {
$this->setHttpResponseCodeFromHeader($line);
} else {
list($key, $value) = explode(': ', $line, 2);
$this->headers[$key] = $value;
}
}
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Http;
/**
* Interface
*
* @package Facebook
*/
interface RequestBodyInterface
{
/**
* Get the body of the request to send to Graph.
*
* @return string
*/
public function getBody();
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Http;
use Facebook\FileUpload\FacebookFile;
/**
* Class RequestBodyMultipartt
*
* Some things copied from Guzzle
*
* @package Facebook
*
* @see https://github.com/guzzle/guzzle/blob/master/src/Post/MultipartBody.php
*/
class RequestBodyMultipart implements RequestBodyInterface
{
/**
* @var string The boundary.
*/
private $boundary;
/**
* @var array The parameters to send with this request.
*/
private $params;
/**
* @var array The files to send with this request.
*/
private $files = [];
/**
* @param array $params The parameters to send with this request.
* @param array $files The files to send with this request.
* @param string $boundary Provide a specific boundary.
*/
public function __construct(array $params = [], array $files = [], $boundary = null)
{
$this->params = $params;
$this->files = $files;
$this->boundary = $boundary ?: uniqid();
}
/**
* @inheritdoc
*/
public function getBody()
{
$body = '';
// Compile normal params
$params = $this->getNestedParams($this->params);
foreach ($params as $k => $v) {
$body .= $this->getParamString($k, $v);
}
// Compile files
foreach ($this->files as $k => $v) {
$body .= $this->getFileString($k, $v);
}
// Peace out
$body .= "--{$this->boundary}--\r\n";
return $body;
}
/**
* Get the boundary
*
* @return string
*/
public function getBoundary()
{
return $this->boundary;
}
/**
* Get the string needed to transfer a file.
*
* @param string $name
* @param FacebookFile $file
*
* @return string
*/
private function getFileString($name, FacebookFile $file)
{
return sprintf(
"--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"%s\r\n\r\n%s\r\n",
$this->boundary,
$name,
$file->getFileName(),
$this->getFileHeaders($file),
$file->getContents()
);
}
/**
* Get the string needed to transfer a POST field.
*
* @param string $name
* @param string $value
*
* @return string
*/
private function getParamString($name, $value)
{
return sprintf(
"--%s\r\nContent-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n",
$this->boundary,
$name,
$value
);
}
/**
* Returns the params as an array of nested params.
*
* @param array $params
*
* @return array
*/
private function getNestedParams(array $params)
{
$query = http_build_query($params, null, '&');
$params = explode('&', $query);
$result = [];
foreach ($params as $param) {
list($key, $value) = explode('=', $param, 2);
$result[urldecode($key)] = urldecode($value);
}
return $result;
}
/**
* Get the headers needed before transferring the content of a POST file.
*
* @param FacebookFile $file
*
* @return string
*/
protected function getFileHeaders(FacebookFile $file)
{
return "\r\nContent-Type: {$file->getMimetype()}";
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Http;
/**
* Class RequestBodyUrlEncoded
*
* @package Facebook
*/
class RequestBodyUrlEncoded implements RequestBodyInterface
{
/**
* @var array The parameters to send with this request.
*/
protected $params = [];
/**
* Creates a new GraphUrlEncodedBody entity.
*
* @param array $params
*/
public function __construct(array $params)
{
$this->params = $params;
}
/**
* @inheritdoc
*/
public function getBody()
{
return http_build_query($this->params, null, '&');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
/**
* Class FacebookCurl
*
* Abstraction for the procedural curl elements so that curl can be mocked and the implementation can be tested.
*
* @package Facebook
*/
class FacebookCurl
{
/**
* @var resource Curl resource instance
*/
protected $curl;
/**
* Make a new curl reference instance
*/
public function init()
{
$this->curl = curl_init();
}
/**
* Set a curl option
*
* @param $key
* @param $value
*/
public function setopt($key, $value)
{
curl_setopt($this->curl, $key, $value);
}
/**
* Set an array of options to a curl resource
*
* @param array $options
*/
public function setoptArray(array $options)
{
curl_setopt_array($this->curl, $options);
}
/**
* Send a curl request
*
* @return mixed
*/
public function exec()
{
return curl_exec($this->curl);
}
/**
* Return the curl error number
*
* @return int
*/
public function errno()
{
return curl_errno($this->curl);
}
/**
* Return the curl error message
*
* @return string
*/
public function error()
{
return curl_error($this->curl);
}
/**
* Get info from a curl reference
*
* @param $type
*
* @return mixed
*/
public function getinfo($type)
{
return curl_getinfo($this->curl, $type);
}
/**
* Get the currently installed curl version
*
* @return array
*/
public function version()
{
return curl_version();
}
/**
* Close the resource connection to curl
*/
public function close()
{
curl_close($this->curl);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
use Facebook\Http\GraphRawResponse;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class FacebookCurlHttpClient
*
* @package Facebook
*/
class FacebookCurlHttpClient implements FacebookHttpClientInterface
{
/**
* @var string The client error message
*/
protected $curlErrorMessage = '';
/**
* @var int The curl client error code
*/
protected $curlErrorCode = 0;
/**
* @var string|boolean The raw response from the server
*/
protected $rawResponse;
/**
* @var FacebookCurl Procedural curl as object
*/
protected $facebookCurl;
/**
* @param FacebookCurl|null Procedural curl as object
*/
public function __construct(FacebookCurl $facebookCurl = null)
{
$this->facebookCurl = $facebookCurl ?: new FacebookCurl();
}
/**
* @inheritdoc
*/
public function send($url, $method, $body, array $headers, $timeOut)
{
$this->openConnection($url, $method, $body, $headers, $timeOut);
$this->sendRequest();
if ($curlErrorCode = $this->facebookCurl->errno()) {
throw new FacebookSDKException($this->facebookCurl->error(), $curlErrorCode);
}
// Separate the raw headers from the raw body
list($rawHeaders, $rawBody) = $this->extractResponseHeadersAndBody();
$this->closeConnection();
return new GraphRawResponse($rawHeaders, $rawBody);
}
/**
* Opens a new curl connection.
*
* @param string $url The endpoint to send the request to.
* @param string $method The request method.
* @param string $body The body of the request.
* @param array $headers The request headers.
* @param int $timeOut The timeout in seconds for the request.
*/
public function openConnection($url, $method, $body, array $headers, $timeOut)
{
$options = [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $this->compileRequestHeaders($headers),
CURLOPT_URL => $url,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => $timeOut,
CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects
CURLOPT_HEADER => true, // Enable header processing
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_CAINFO => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
];
if ($method !== "GET") {
$options[CURLOPT_POSTFIELDS] = $body;
}
$this->facebookCurl->init();
$this->facebookCurl->setoptArray($options);
}
/**
* Closes an existing curl connection
*/
public function closeConnection()
{
$this->facebookCurl->close();
}
/**
* Send the request and get the raw response from curl
*/
public function sendRequest()
{
$this->rawResponse = $this->facebookCurl->exec();
}
/**
* Compiles the request headers into a curl-friendly format.
*
* @param array $headers The request headers.
*
* @return array
*/
public function compileRequestHeaders(array $headers)
{
$return = [];
foreach ($headers as $key => $value) {
$return[] = $key . ': ' . $value;
}
return $return;
}
/**
* Extracts the headers and the body into a two-part array
*
* @return array
*/
public function extractResponseHeadersAndBody()
{
$parts = explode("\r\n\r\n", $this->rawResponse);
$rawBody = array_pop($parts);
$rawHeaders = implode("\r\n\r\n", $parts);
return [trim($rawHeaders), trim($rawBody)];
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
use Facebook\Http\GraphRawResponse;
use Facebook\Exceptions\FacebookSDKException;
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use GuzzleHttp\Ring\Exception\RingException;
use GuzzleHttp\Exception\RequestException;
class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
{
/**
* @var \GuzzleHttp\Client The Guzzle client.
*/
protected $guzzleClient;
/**
* @param \GuzzleHttp\Client|null The Guzzle client.
*/
public function __construct(Client $guzzleClient = null)
{
$this->guzzleClient = $guzzleClient ?: new Client();
}
/**
* @inheritdoc
*/
public function send($url, $method, $body, array $headers, $timeOut)
{
$options = [
'headers' => $headers,
'body' => $body,
'timeout' => $timeOut,
'connect_timeout' => 10,
'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
];
$request = $this->guzzleClient->createRequest($method, $url, $options);
try {
$rawResponse = $this->guzzleClient->send($request);
} catch (RequestException $e) {
$rawResponse = $e->getResponse();
if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
throw new FacebookSDKException($e->getMessage(), $e->getCode());
}
}
$rawHeaders = $this->getHeadersAsString($rawResponse);
$rawBody = $rawResponse->getBody();
$httpStatusCode = $rawResponse->getStatusCode();
return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
}
/**
* Returns the Guzzle array of headers as a string.
*
* @param ResponseInterface $response The Guzzle response.
*
* @return string
*/
public function getHeadersAsString(ResponseInterface $response)
{
$headers = $response->getHeaders();
$rawHeaders = [];
foreach ($headers as $name => $values) {
$rawHeaders[] = $name . ": " . implode(", ", $values);
}
return implode("\r\n", $rawHeaders);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
/**
* Interface FacebookHttpClientInterface
*
* @package Facebook
*/
interface FacebookHttpClientInterface
{
/**
* Sends a request to the server and returns the raw response.
*
* @param string $url The endpoint to send the request to.
* @param string $method The request method.
* @param string $body The body of the request.
* @param array $headers The request headers.
* @param int $timeOut The timeout in seconds for the request.
*
* @return \Facebook\Http\GraphRawResponse Raw response from the server.
*
* @throws \Facebook\Exceptions\FacebookSDKException
*/
public function send($url, $method, $body, array $headers, $timeOut);
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
/**
* Class FacebookStream
*
* Abstraction for the procedural stream elements so that the functions can be
* mocked and the implementation can be tested.
*
* @package Facebook
*/
class FacebookStream
{
/**
* @var resource Context stream resource instance
*/
protected $stream;
/**
* @var array Response headers from the stream wrapper
*/
protected $responseHeaders = [];
/**
* Make a new context stream reference instance
*
* @param array $options
*/
public function streamContextCreate(array $options)
{
$this->stream = stream_context_create($options);
}
/**
* The response headers from the stream wrapper
*
* @return array
*/
public function getResponseHeaders()
{
return $this->responseHeaders;
}
/**
* Send a stream wrapped request
*
* @param string $url
*
* @return mixed
*/
public function fileGetContents($url)
{
$rawResponse = file_get_contents($url, false, $this->stream);
$this->responseHeaders = $http_response_header ?: [];
return $rawResponse;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
use Facebook\Http\GraphRawResponse;
use Facebook\Exceptions\FacebookSDKException;
class FacebookStreamHttpClient implements FacebookHttpClientInterface
{
/**
* @var FacebookStream Procedural stream wrapper as object.
*/
protected $facebookStream;
/**
* @param FacebookStream|null Procedural stream wrapper as object.
*/
public function __construct(FacebookStream $facebookStream = null)
{
$this->facebookStream = $facebookStream ?: new FacebookStream();
}
/**
* @inheritdoc
*/
public function send($url, $method, $body, array $headers, $timeOut)
{
$options = [
'http' => [
'method' => $method,
'header' => $this->compileHeader($headers),
'content' => $body,
'timeout' => $timeOut,
'ignore_errors' => true
],
'ssl' => [
'verify_peer' => true,
'verify_peer_name' => true,
'allow_self_signed' => true, // All root certificates are self-signed
'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
],
];
$this->facebookStream->streamContextCreate($options);
$rawBody = $this->facebookStream->fileGetContents($url);
$rawHeaders = $this->facebookStream->getResponseHeaders();
if ($rawBody === false || empty($rawHeaders)) {
throw new FacebookSDKException('Stream returned an empty response', 660);
}
$rawHeaders = implode("\r\n", $rawHeaders);
return new GraphRawResponse($rawHeaders, $rawBody);
}
/**
* Formats the headers for use in the stream wrapper.
*
* @param array $headers The request headers.
*
* @return string
*/
public function compileHeader(array $headers)
{
$header = [];
foreach ($headers as $k => $v) {
$header[] = $k . ': ' . $v;
}
return implode("\r\n", $header);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\HttpClients;
use GuzzleHttp\Client;
use InvalidArgumentException;
use Exception;
class HttpClientsFactory
{
private function __construct()
{
// a factory constructor should never be invoked
}
/**
* HTTP client generation.
*
* @param FacebookHttpClientInterface|Client|string|null $handler
*
* @throws Exception If the cURL extension or the Guzzle client aren't available (if required).
* @throws InvalidArgumentException If the http client handler isn't "curl", "stream", "guzzle", or an instance of Facebook\HttpClients\FacebookHttpClientInterface.
*
* @return FacebookHttpClientInterface
*/
public static function createHttpClient($handler)
{
if (!$handler) {
return self::detectDefaultClient();
}
if ($handler instanceof FacebookHttpClientInterface) {
return $handler;
}
if ('stream' === $handler) {
return new FacebookStreamHttpClient();
}
if ('curl' === $handler) {
if (!extension_loaded('curl')) {
throw new Exception('The cURL extension must be loaded in order to use the "curl" handler.');
}
return new FacebookCurlHttpClient();
}
if ('guzzle' === $handler && !class_exists('GuzzleHttp\Client')) {
throw new Exception('The Guzzle HTTP client must be included in order to use the "guzzle" handler.');
}
if ($handler instanceof Client) {
return new FacebookGuzzleHttpClient($handler);
}
if ('guzzle' === $handler) {
return new FacebookGuzzleHttpClient();
}
throw new InvalidArgumentException('The http client handler must be set to "curl", "stream", "guzzle", be an instance of GuzzleHttp\Client or an instance of Facebook\HttpClients\FacebookHttpClientInterface');
}
/**
* Detect default HTTP client.
*
* @return FacebookHttpClientInterface
*/
private static function detectDefaultClient()
{
if (extension_loaded('curl')) {
return new FacebookCurlHttpClient();
}
if (class_exists('GuzzleHttp\Client')) {
return new FacebookGuzzleHttpClient();
}
return new FacebookStreamHttpClient();
}
}
-----BEGIN CERTIFICATE-----
MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
+OkuE6N36B9K
-----END CERTIFICATE-----
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PersistentData;
/**
* Class FacebookMemoryPersistentDataHandler
*
* @package Facebook
*/
class FacebookMemoryPersistentDataHandler implements PersistentDataInterface
{
/**
* @var array The session data to keep in memory.
*/
protected $sessionData = [];
/**
* @inheritdoc
*/
public function get($key)
{
return isset($this->sessionData[$key]) ? $this->sessionData[$key] : null;
}
/**
* @inheritdoc
*/
public function set($key, $value)
{
$this->sessionData[$key] = $value;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PersistentData;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class FacebookSessionPersistentDataHandler
*
* @package Facebook
*/
class FacebookSessionPersistentDataHandler implements PersistentDataInterface
{
/**
* @var string Prefix to use for session variables.
*/
protected $sessionPrefix = 'FBRLH_';
/**
* Init the session handler.
*
* @param boolean $enableSessionCheck
*
* @throws FacebookSDKException
*/
public function __construct($enableSessionCheck = true)
{
if ($enableSessionCheck && session_status() !== PHP_SESSION_ACTIVE) {
throw new FacebookSDKException(
'Sessions are not active. Please make sure session_start() is at the top of your script.',
720
);
}
}
/**
* @inheritdoc
*/
public function get($key)
{
if (isset($_SESSION[$this->sessionPrefix . $key])) {
return $_SESSION[$this->sessionPrefix . $key];
}
return null;
}
/**
* @inheritdoc
*/
public function set($key, $value)
{
$_SESSION[$this->sessionPrefix . $key] = $value;
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PersistentData;
use InvalidArgumentException;
class PersistentDataFactory
{
private function __construct()
{
// a factory constructor should never be invoked
}
/**
* PersistentData generation.
*
* @param PersistentDataInterface|string|null $handler
*
* @throws InvalidArgumentException If the persistent data handler isn't "session", "memory", or an instance of Facebook\PersistentData\PersistentDataInterface.
*
* @return PersistentDataInterface
*/
public static function createPersistentDataHandler($handler)
{
if (!$handler) {
return session_status() === PHP_SESSION_ACTIVE
? new FacebookSessionPersistentDataHandler()
: new FacebookMemoryPersistentDataHandler();
}
if ($handler instanceof PersistentDataInterface) {
return $handler;
}
if ('session' === $handler) {
return new FacebookSessionPersistentDataHandler();
}
if ('memory' === $handler) {
return new FacebookMemoryPersistentDataHandler();
}
throw new InvalidArgumentException('The persistent data handler must be set to "session", "memory", or be an instance of Facebook\PersistentData\PersistentDataInterface');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PersistentData;
/**
* Interface PersistentDataInterface
*
* @package Facebook
*/
interface PersistentDataInterface
{
/**
* Get a value from a persistent data store.
*
* @param string $key
*
* @return mixed
*/
public function get($key);
/**
* Set a value in the persistent data store.
*
* @param string $key
* @param mixed $value
*/
public function set($key, $value);
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
use Facebook\Exceptions\FacebookSDKException;
class McryptPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
{
use PseudoRandomStringGeneratorTrait;
/**
* @const string The error message when generating the string fails.
*/
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from mcrypt_create_iv(). ';
/**
* @throws FacebookSDKException
*/
public function __construct()
{
if (!function_exists('mcrypt_create_iv')) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'The function mcrypt_create_iv() does not exist.'
);
}
}
/**
* @inheritdoc
*/
public function getPseudoRandomString($length)
{
$this->validateLength($length);
$binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
if ($binaryString === false) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'mcrypt_create_iv() returned an error.'
);
}
return $this->binToHex($binaryString, $length);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
use Facebook\Exceptions\FacebookSDKException;
class OpenSslPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
{
use PseudoRandomStringGeneratorTrait;
/**
* @const string The error message when generating the string fails.
*/
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from openssl_random_pseudo_bytes().';
/**
* @throws FacebookSDKException
*/
public function __construct()
{
if (!function_exists('openssl_random_pseudo_bytes')) {
throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function openssl_random_pseudo_bytes() does not exist.');
}
}
/**
* @inheritdoc
*/
public function getPseudoRandomString($length)
{
$this->validateLength($length);
$wasCryptographicallyStrong = false;
$binaryString = openssl_random_pseudo_bytes($length, $wasCryptographicallyStrong);
if ($binaryString === false) {
throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned an unknown error.');
}
if ($wasCryptographicallyStrong !== true) {
throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned a pseudo-random string but it was not cryptographically secure and cannot be used.');
}
return $this->binToHex($binaryString, $length);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
use Facebook\Exceptions\FacebookSDKException;
use InvalidArgumentException;
class PseudoRandomStringGeneratorFactory
{
private function __construct()
{
// a factory constructor should never be invoked
}
/**
* Pseudo random string generator creation.
*
* @param PseudoRandomStringGeneratorInterface|string|null $generator
*
* @throws InvalidArgumentException If the pseudo random string generator must be set to "random_bytes", "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface.
*
* @return PseudoRandomStringGeneratorInterface
*/
public static function createPseudoRandomStringGenerator($generator)
{
if (!$generator) {
return self::detectDefaultPseudoRandomStringGenerator();
}
if ($generator instanceof PseudoRandomStringGeneratorInterface) {
return $generator;
}
if ('random_bytes' === $generator) {
return new RandomBytesPseudoRandomStringGenerator();
}
if ('mcrypt' === $generator) {
return new McryptPseudoRandomStringGenerator();
}
if ('openssl' === $generator) {
return new OpenSslPseudoRandomStringGenerator();
}
if ('urandom' === $generator) {
return new UrandomPseudoRandomStringGenerator();
}
throw new InvalidArgumentException('The pseudo random string generator must be set to "random_bytes", "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface');
}
/**
* Detects which pseudo-random string generator to use.
*
* @throws FacebookSDKException If unable to detect a cryptographically secure pseudo-random string generator.
*
* @return PseudoRandomStringGeneratorInterface
*/
private static function detectDefaultPseudoRandomStringGenerator()
{
// Check for PHP 7's CSPRNG first to keep mcrypt deprecation messages from appearing in PHP 7.1.
if (function_exists('random_bytes')) {
return new RandomBytesPseudoRandomStringGenerator();
}
// Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically
// secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() next.
if (function_exists('mcrypt_create_iv')) {
return new McryptPseudoRandomStringGenerator();
}
if (function_exists('openssl_random_pseudo_bytes')) {
return new OpenSslPseudoRandomStringGenerator();
}
if (!ini_get('open_basedir') && is_readable('/dev/urandom')) {
return new UrandomPseudoRandomStringGenerator();
}
throw new FacebookSDKException('Unable to detect a cryptographically secure pseudo-random string generator.');
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
/**
* Interface
*
* @package Facebook
*/
interface PseudoRandomStringGeneratorInterface
{
/**
* Get a cryptographically secure pseudo-random string of arbitrary length.
*
* @see http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
*
* @param int $length The length of the string to return.
*
* @return string
*
* @throws \Facebook\Exceptions\FacebookSDKException|\InvalidArgumentException
*/
public function getPseudoRandomString($length);
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
trait PseudoRandomStringGeneratorTrait
{
/**
* Validates the length argument of a random string.
*
* @param int $length The length to validate.
*
* @throws \InvalidArgumentException
*/
public function validateLength($length)
{
if (!is_int($length)) {
throw new \InvalidArgumentException('getPseudoRandomString() expects an integer for the string length');
}
if ($length < 1) {
throw new \InvalidArgumentException('getPseudoRandomString() expects a length greater than 1');
}
}
/**
* Converts binary data to hexadecimal of arbitrary length.
*
* @param string $binaryData The binary data to convert to hex.
* @param int $length The length of the string to return.
*
* @return string
*/
public function binToHex($binaryData, $length)
{
return \substr(\bin2hex($binaryData), 0, $length);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
use Facebook\Exceptions\FacebookSDKException;
class RandomBytesPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
{
use PseudoRandomStringGeneratorTrait;
/**
* @const string The error message when generating the string fails.
*/
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from random_bytes(). ';
/**
* @throws FacebookSDKException
*/
public function __construct()
{
if (!function_exists('random_bytes')) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'The function random_bytes() does not exist.'
);
}
}
/**
* @inheritdoc
*/
public function getPseudoRandomString($length)
{
$this->validateLength($length);
return $this->binToHex(random_bytes($length), $length);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\PseudoRandomString;
use Facebook\Exceptions\FacebookSDKException;
class UrandomPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
{
use PseudoRandomStringGeneratorTrait;
/**
* @const string The error message when generating the string fails.
*/
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from /dev/urandom. ';
/**
* @throws FacebookSDKException
*/
public function __construct()
{
if (ini_get('open_basedir')) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'There is an open_basedir constraint that prevents access to /dev/urandom.'
);
}
if (!is_readable('/dev/urandom')) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'Unable to read from /dev/urandom.'
);
}
}
/**
* @inheritdoc
*/
public function getPseudoRandomString($length)
{
$this->validateLength($length);
$stream = fopen('/dev/urandom', 'rb');
if (!is_resource($stream)) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'Unable to open stream to /dev/urandom.'
);
}
if (!defined('HHVM_VERSION')) {
stream_set_read_buffer($stream, 0);
}
$binaryString = fread($stream, $length);
fclose($stream);
if (!$binaryString) {
throw new FacebookSDKException(
static::ERROR_MESSAGE .
'Stream to /dev/urandom returned no data.'
);
}
return $this->binToHex($binaryString, $length);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook;
use Facebook\Exceptions\FacebookSDKException;
/**
* Class SignedRequest
*
* @package Facebook
*/
class SignedRequest
{
/**
* @var FacebookApp The FacebookApp entity.
*/
protected $app;
/**
* @var string The raw encrypted signed request.
*/
protected $rawSignedRequest;
/**
* @var array The payload from the decrypted signed request.
*/
protected $payload;
/**
* Instantiate a new SignedRequest entity.
*
* @param FacebookApp $facebookApp The FacebookApp entity.
* @param string|null $rawSignedRequest The raw signed request.
*/
public function __construct(FacebookApp $facebookApp, $rawSignedRequest = null)
{
$this->app = $facebookApp;
if (!$rawSignedRequest) {
return;
}
$this->rawSignedRequest = $rawSignedRequest;
$this->parse();
}
/**
* Returns the raw signed request data.
*
* @return string|null
*/
public function getRawSignedRequest()
{
return $this->rawSignedRequest;
}
/**
* Returns the parsed signed request data.
*
* @return array|null
*/
public function getPayload()
{
return $this->payload;
}
/**
* Returns a property from the signed request data if available.
*
* @param string $key
* @param mixed|null $default
*
* @return mixed|null
*/
public function get($key, $default = null)
{
if (isset($this->payload[$key])) {
return $this->payload[$key];
}
return $default;
}
/**
* Returns user_id from signed request data if available.
*
* @return string|null
*/
public function getUserId()
{
return $this->get('user_id');
}
/**
* Checks for OAuth data in the payload.
*
* @return boolean
*/
public function hasOAuthData()
{
return $this->get('oauth_token') || $this->get('code');
}
/**
* Creates a signed request from an array of data.
*
* @param array $payload
*
* @return string
*/
public function make(array $payload)
{
$payload['algorithm'] = isset($payload['algorithm']) ? $payload['algorithm'] : 'HMAC-SHA256';
$payload['issued_at'] = isset($payload['issued_at']) ? $payload['issued_at'] : time();
$encodedPayload = $this->base64UrlEncode(json_encode($payload));
$hashedSig = $this->hashSignature($encodedPayload);
$encodedSig = $this->base64UrlEncode($hashedSig);
return $encodedSig . '.' . $encodedPayload;
}
/**
* Validates and decodes a signed request and saves
* the payload to an array.
*/
protected function parse()
{
list($encodedSig, $encodedPayload) = $this->split();
// Signature validation
$sig = $this->decodeSignature($encodedSig);
$hashedSig = $this->hashSignature($encodedPayload);
$this->validateSignature($hashedSig, $sig);
$this->payload = $this->decodePayload($encodedPayload);
// Payload validation
$this->validateAlgorithm();
}
/**
* Splits a raw signed request into signature and payload.
*
* @return array
*
* @throws FacebookSDKException
*/
protected function split()
{
if (strpos($this->rawSignedRequest, '.') === false) {
throw new FacebookSDKException('Malformed signed request.', 606);
}
return explode('.', $this->rawSignedRequest, 2);
}
/**
* Decodes the raw signature from a signed request.
*
* @param string $encodedSig
*
* @return string
*
* @throws FacebookSDKException
*/
protected function decodeSignature($encodedSig)
{
$sig = $this->base64UrlDecode($encodedSig);
if (!$sig) {
throw new FacebookSDKException('Signed request has malformed encoded signature data.', 607);
}
return $sig;
}
/**
* Decodes the raw payload from a signed request.
*
* @param string $encodedPayload
*
* @return array
*
* @throws FacebookSDKException
*/
protected function decodePayload($encodedPayload)
{
$payload = $this->base64UrlDecode($encodedPayload);
if ($payload) {
$payload = json_decode($payload, true);
}
if (!is_array($payload)) {
throw new FacebookSDKException('Signed request has malformed encoded payload data.', 607);
}
return $payload;
}
/**
* Validates the algorithm used in a signed request.
*
* @throws FacebookSDKException
*/
protected function validateAlgorithm()
{
if ($this->get('algorithm') !== 'HMAC-SHA256') {
throw new FacebookSDKException('Signed request is using the wrong algorithm.', 605);
}
}
/**
* Hashes the signature used in a signed request.
*
* @param string $encodedData
*
* @return string
*
* @throws FacebookSDKException
*/
protected function hashSignature($encodedData)
{
$hashedSig = hash_hmac(
'sha256',
$encodedData,
$this->app->getSecret(),
$raw_output = true
);
if (!$hashedSig) {
throw new FacebookSDKException('Unable to hash signature from encoded payload data.', 602);
}
return $hashedSig;
}
/**
* Validates the signature used in a signed request.
*
* @param string $hashedSig
* @param string $sig
*
* @throws FacebookSDKException
*/
protected function validateSignature($hashedSig, $sig)
{
if (\hash_equals($hashedSig, $sig)) {
return;
}
throw new FacebookSDKException('Signed request has an invalid signature.', 602);
}
/**
* Base64 decoding which replaces characters:
* + instead of -
* / instead of _
*
* @link http://en.wikipedia.org/wiki/Base64#URL_applications
*
* @param string $input base64 url encoded input
*
* @return string decoded string
*/
public function base64UrlDecode($input)
{
$urlDecodedBase64 = strtr($input, '-_', '+/');
$this->validateBase64($urlDecodedBase64);
return base64_decode($urlDecodedBase64);
}
/**
* Base64 encoding which replaces characters:
* + instead of -
* / instead of _
*
* @link http://en.wikipedia.org/wiki/Base64#URL_applications
*
* @param string $input string to encode
*
* @return string base64 url encoded input
*/
public function base64UrlEncode($input)
{
return strtr(base64_encode($input), '+/', '-_');
}
/**
* Validates a base64 string.
*
* @param string $input base64 value to validate
*
* @throws FacebookSDKException
*/
protected function validateBase64($input)
{
if (!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $input)) {
throw new FacebookSDKException('Signed request contains malformed base64 encoding.', 608);
}
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Url;
/**
* Class FacebookUrlDetectionHandler
*
* @package Facebook
*/
class FacebookUrlDetectionHandler implements UrlDetectionInterface
{
/**
* @inheritdoc
*/
public function getCurrentUrl()
{
return $this->getHttpScheme() . '://' . $this->getHostName() . $this->getServerVar('REQUEST_URI');
}
/**
* Get the currently active URL scheme.
*
* @return string
*/
protected function getHttpScheme()
{
return $this->isBehindSsl() ? 'https' : 'http';
}
/**
* Tries to detect if the server is running behind an SSL.
*
* @return boolean
*/
protected function isBehindSsl()
{
// Check for proxy first
$protocol = $this->getHeader('X_FORWARDED_PROTO');
if ($protocol) {
return $this->protocolWithActiveSsl($protocol);
}
$protocol = $this->getServerVar('HTTPS');
if ($protocol) {
return $this->protocolWithActiveSsl($protocol);
}
return (string)$this->getServerVar('SERVER_PORT') === '443';
}
/**
* Detects an active SSL protocol value.
*
* @param string $protocol
*
* @return boolean
*/
protected function protocolWithActiveSsl($protocol)
{
$protocol = strtolower((string)$protocol);
return in_array($protocol, ['on', '1', 'https', 'ssl'], true);
}
/**
* Tries to detect the host name of the server.
*
* Some elements adapted from
*
* @see https://github.com/symfony/HttpFoundation/blob/master/Request.php
*
* @return string
*/
protected function getHostName()
{
// Check for proxy first
$header = $this->getHeader('X_FORWARDED_HOST');
if ($header && $this->isValidForwardedHost($header)) {
$elements = explode(',', $header);
$host = $elements[count($elements) - 1];
} elseif (!$host = $this->getHeader('HOST')) {
if (!$host = $this->getServerVar('SERVER_NAME')) {
$host = $this->getServerVar('SERVER_ADDR');
}
}
// trim and remove port number from host
// host is lowercase as per RFC 952/2181
$host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
// Port number
$scheme = $this->getHttpScheme();
$port = $this->getCurrentPort();
$appendPort = ':' . $port;
// Don't append port number if a normal port.
if (($scheme == 'http' && $port == '80') || ($scheme == 'https' && $port == '443')) {
$appendPort = '';
}
return $host . $appendPort;
}
protected function getCurrentPort()
{
// Check for proxy first
$port = $this->getHeader('X_FORWARDED_PORT');
if ($port) {
return (string)$port;
}
$protocol = (string)$this->getHeader('X_FORWARDED_PROTO');
if ($protocol === 'https') {
return '443';
}
return (string)$this->getServerVar('SERVER_PORT');
}
/**
* Returns the a value from the $_SERVER super global.
*
* @param string $key
*
* @return string
*/
protected function getServerVar($key)
{
return isset($_SERVER[$key]) ? $_SERVER[$key] : '';
}
/**
* Gets a value from the HTTP request headers.
*
* @param string $key
*
* @return string
*/
protected function getHeader($key)
{
return $this->getServerVar('HTTP_' . $key);
}
/**
* Checks if the value in X_FORWARDED_HOST is a valid hostname
* Could prevent unintended redirections
*
* @param string $header
*
* @return boolean
*/
protected function isValidForwardedHost($header)
{
$elements = explode(',', $header);
$host = $elements[count($elements) - 1];
return preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check
&& 0 < strlen($host) && strlen($host) < 254 //overall length check
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host); //length of each label
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Url;
/**
* Class FacebookUrlManipulator
*
* @package Facebook
*/
class FacebookUrlManipulator
{
/**
* Remove params from a URL.
*
* @param string $url The URL to filter.
* @param array $paramsToFilter The params to filter from the URL.
*
* @return string The URL with the params removed.
*/
public static function removeParamsFromUrl($url, array $paramsToFilter)
{
$parts = parse_url($url);
$query = '';
if (isset($parts['query'])) {
$params = [];
parse_str($parts['query'], $params);
// Remove query params
foreach ($paramsToFilter as $paramName) {
unset($params[$paramName]);
}
if (count($params) > 0) {
$query = '?' . http_build_query($params, null, '&');
}
}
$scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : '';
$host = isset($parts['host']) ? $parts['host'] : '';
$port = isset($parts['port']) ? ':' . $parts['port'] : '';
$path = isset($parts['path']) ? $parts['path'] : '';
$fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
return $scheme . $host . $port . $path . $query . $fragment;
}
/**
* Gracefully appends params to the URL.
*
* @param string $url The URL that will receive the params.
* @param array $newParams The params to append to the URL.
*
* @return string
*/
public static function appendParamsToUrl($url, array $newParams = [])
{
if (empty($newParams)) {
return $url;
}
if (strpos($url, '?') === false) {
return $url . '?' . http_build_query($newParams, null, '&');
}
list($path, $query) = explode('?', $url, 2);
$existingParams = [];
parse_str($query, $existingParams);
// Favor params from the original URL over $newParams
$newParams = array_merge($newParams, $existingParams);
// Sort for a predicable order
ksort($newParams);
return $path . '?' . http_build_query($newParams, null, '&');
}
/**
* Returns the params from a URL in the form of an array.
*
* @param string $url The URL to parse the params from.
*
* @return array
*/
public static function getParamsAsArray($url)
{
$query = parse_url($url, PHP_URL_QUERY);
if (!$query) {
return [];
}
$params = [];
parse_str($query, $params);
return $params;
}
/**
* Adds the params of the first URL to the second URL.
*
* Any params that already exist in the second URL will go untouched.
*
* @param string $urlToStealFrom The URL harvest the params from.
* @param string $urlToAddTo The URL that will receive the new params.
*
* @return string The $urlToAddTo with any new params from $urlToStealFrom.
*/
public static function mergeUrlParams($urlToStealFrom, $urlToAddTo)
{
$newParams = static::getParamsAsArray($urlToStealFrom);
// Nothing new to add, return as-is
if (!$newParams) {
return $urlToAddTo;
}
return static::appendParamsToUrl($urlToAddTo, $newParams);
}
/**
* Check for a "/" prefix and prepend it if not exists.
*
* @param string|null $string
*
* @return string|null
*/
public static function forceSlashPrefix($string)
{
if (!$string) {
return $string;
}
return strpos($string, '/') === 0 ? $string : '/' . $string;
}
/**
* Trims off the hostname and Graph version from a URL.
*
* @param string $urlToTrim The URL the needs the surgery.
*
* @return string The $urlToTrim with the hostname and Graph version removed.
*/
public static function baseGraphUrlEndpoint($urlToTrim)
{
return '/' . preg_replace('/^https:\/\/.+\.facebook\.com(\/v.+?)?\//', '', $urlToTrim);
}
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Facebook\Url;
/**
* Interface UrlDetectionInterface
*
* @package Facebook
*/
interface UrlDetectionInterface
{
/**
* Get the currently active URL.
*
* @return string
*/
public function getCurrentUrl();
}
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/**
* You only need this file if you are not using composer.
* Why are you not using composer?
* https://getcomposer.org/
*/
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
}
require_once __DIR__ . '/polyfills.php';
/**
* Register the autoloader for the Facebook SDK classes.
*
* Based off the official PSR-4 autoloader example found here:
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
*
* @param string $class The fully-qualified class name.
*
* @return void
*/
spl_autoload_register(function ($class) {
// project-specific namespace prefix
$prefix = 'Facebook\\';
// For backwards compatibility
$customBaseDir = '';
// @todo v6: Remove support for 'FACEBOOK_SDK_V4_SRC_DIR'
if (defined('FACEBOOK_SDK_V4_SRC_DIR')) {
$customBaseDir = FACEBOOK_SDK_V4_SRC_DIR;
} elseif (defined('FACEBOOK_SDK_SRC_DIR')) {
$customBaseDir = FACEBOOK_SDK_SRC_DIR;
}
// base directory for the namespace prefix
$baseDir = $customBaseDir ?: __DIR__ . '/';
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relativeClass = substr($class, $len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = rtrim($baseDir, '/') . '/' . str_replace('\\', '/', $relativeClass) . '.php';
// if the file exists, require it
if (file_exists($file)) {
require $file;
}
});
<?php
/**
* Copyright 2017 Facebook, Inc.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/**
* @see https://github.com/sarciszewski/php-future/blob/master/src/Security.php#L37-L51
*/
if (!function_exists('hash_equals')) {
function hash_equals($knownString, $userString)
{
if (function_exists('mb_strlen')) {
$kLen = mb_strlen($knownString, '8bit');
$uLen = mb_strlen($userString, '8bit');
} else {
$kLen = strlen($knownString);
$uLen = strlen($userString);
}
if ($kLen !== $uLen) {
return false;
}
$result = 0;
for ($i = 0; $i < $kLen; $i++) {
$result |= (ord($knownString[$i]) ^ ord($userString[$i]));
}
// They are only identical strings if $result is exactly 0...
return 0 === $result;
}
}
<?php
class Doctor_model extends CI_Model {
function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
}
public function get_single_doctor($id)
{
$this->db->select("tbl_doctors.id as doctorid,
tbl_doctors.name as dr_name,
tbl_doctors.profile_pic as dr_pic,
tbl_doctors.email as dr_email,
tbl_doctors.dob as dr_dob,
tbl_doctors.about as dr_bio,
tbl_doctors.price as dr_price,
tbl_doctors.gender as dr_gender,
tbl_doctors.locality as dr_locality,
tbl_specialization.specialization_name AS dr_specialization,
");
$this->db->from('tbl_doctors');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
$this->db->where('tbl_doctors.id',$id);
$data =$this->db->get()->row_array();
return $data;
}
public function get_doctor_clinic_list($id)
{
$this->db->select("tbl_clinic.name as clinic_name,
tbl_clinic.id as clinic_id
");
$this->db->from('tbl_clinic_doctors');
$this->db->join('tbl_clinic', 'tbl_clinic.id = tbl_clinic_doctors.clinic_id','inner');
$this->db->where('tbl_clinic_doctors.doctor_id',$id);
//$this->db->get();
// $data = $this->db->last_query();
$data =$this->db->get()->result_array();
//print_r($data);die();
return $data;
}
public function checkDoctorExist($doc_id)
{
$this->db->select("*");
$this->db->from("tbl_consultation");
$this->db->where_in("tbl_consultation.doctor_id",$doc_id);
$this->db->order_by("id", "asc");
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
return $query->result_array();
}
public function Schedulelist($clinicId,$docId)
{
$this->db->select("date");
$this->db->from("tbl_consultation");
$this->db->where("tbl_consultation.doctor_id",$docId);
$this->db->where("tbl_consultation.clinic_id",$clinicId);
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
return $query->row_array();
}
function set_new_consultation($data,$clinicId,$doctors)
{
$newData = json_encode($data);
foreach ($doctors as $key => $value) {
$this->db->where(array('doctor_id'=>$value,'clinic_id'=>$clinicId));
$this->db->update('tbl_consultation',array('date'=>$newData));
}
}
function assignDoctors($doctors,$clinicId)
{
foreach ($doctors as $key => $value)
{
$this->db->insert('tbl_clinic_doctors',array('doctor_id'=>$value,'clinic_id'=>$clinicId));
}
}
function insertVacation($request)
{
if($this->db->insert('tbl_doctor_leave', $request))
{
return true;
}
else
{
return false;
}
}
public function get_doctor_appointments_day($dctr_id,$list_day)
{
if($list_day=='null')
{
$date = date('y-m-d');
$today = strtotime($date.' 00:00:00');
}
else
{
$today = strtotime($list_day.' 00:00:00');
}
//print_r($today);die()
//$this->db->select("*");
$this->db->select("tbl_booking.id as booking_id,
tbl_booking.date as booking_date,
tbl_booking.time as booking_time,
tbl_booking.booking_status as booking_status,
tbl_booking.patient_id as pat_id,
tbl_registration.name as pat_name,
tbl_registration.profile_photo as pat_pic,
");
$this->db->from("tbl_booking");
$this->db->where("tbl_booking.doctor_id",$dctr_id);
$this->db->where("tbl_booking.date",$today);
$this->db->where("tbl_booking.payment_status",1);
$this->db->where("tbl_booking.booking_status",1);
$this->db->order_by("tbl_booking.time_start", "asc");
$this->db->join('tbl_registration', 'tbl_registration.id = tbl_booking.patient_id','inner');
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
return $query->result_array();
}
public function get_doctor_appointments_month($doctor_id)
{
$this->db->select("count(date) as count,dayofmonth(from_unixtime(`tbl_booking`.`date`)) as day");
$this->db->from("tbl_booking");
$this->db->where("tbl_booking.doctor_id",$doctor_id);
//$this->db->where("MONTHNAME(FROM_UNIXTIME(tbl_booking.date))",MONTHNAME(CURRENT_DATE()));
$this->db->where('monthname(from_unixtime(`tbl_booking`.`date`))', date('F',time()));
$this->db->order_by("tbl_booking.date", "asc");
$this->db->group_by('tbl_booking.date');
//WHERE MONTH(columnName) = MONTH(CURRENT_DATE())
//$this->db->where_in("tbl_booking.clinic_id",$clinicId);
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
$data = $query->result_array();
return $data;
}
public function get_doctor_appointments_week($doctor_id,$date)
{
$date_timestamp = strtotime($date);
//print_r($date.'-');
//print_r($date_timestamp);die();
//print_r($doctor_id);
//$this->db->select("count(date) as 0,dayofmonth(from_unixtime(`tbl_booking`.`date`)) as day");
$this->db->select("DATE_FORMAT(FROM_UNIXTIME(tbl_booking.time_start), '%H') as hour,count(*) as count");
$this->db->from("tbl_booking");
$this->db->where("tbl_booking.doctor_id",$doctor_id);
$this->db->where("tbl_booking.date",$date_timestamp);
//$this->db->where("MONTHNAME(FROM_UNIXTIME(tbl_booking.date))",MONTHNAME(CURRENT_DATE()));
//$where = 'tbl_booking.date > DATE_SUB(NOW(), INTERVAL 1 WEEK)';
//$this->db->where("tbl_booking.date >= DATE_SUB(NOW(), INTERVAL 1 WEEK)",NULL,FALSE);
$this->db->order_by("tbl_booking.date", "asc");
$this->db->group_by('DATE_FORMAT(FROM_UNIXTIME(tbl_booking.time_start), "%H")');
$query = $this->db->get();
$data = $query->result_array();
$data1 = $this->db->last_query();
return $data;
}
public function get_single_doc_pat_attended($doc_id)
{
$this->db->select("tbl_booking.id as book_id,
tbl_booking.date as book_date,
tbl_booking.time as book_time,
tbl_registration.name as pat_name,
tbl_registration.profile_pic as pat_pic
");
$this->db->from('tbl_booking');
$this->db->join('tbl_doctors', 'tbl_booking.doctor_id = tbl_doctors.id','inner');
$this->db->where('tbl_booking.patient_id',$id);
$this->db->where('tbl_booking.booking_status',2);
$this->db->order_by("tbl_booking.date", "asc");
$this->db->order_by("tbl_booking.time_start", "asc");
//$this->db->get();
// $data = $this->db->last_query();
$data =$this->db->get()->result_array();
//print_r($data);die();
return $data;
}
}
?>
\ No newline at end of file
...@@ -4,22 +4,74 @@ ...@@ -4,22 +4,74 @@
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
} }
public function get_speciality()
{
$query = $this->db->get("tbl_specialization");
if($query->num_rows() > 0)
{
$return_array = $query->result_array();
}
else
{
$return_array = array('message'=>'fail');
}
return $return_array;
}
public function emailExist($data) public function emailExist($data)
{ {
$query_email = $this->db->get_where("tbl_registration",array("email"=>$data['email'])); $query_email = $this->db->get_where("tbl_registration",array("email"=>$data['email']));
if($query_email->num_rows() > 0){ if($query_email->num_rows() > 0)
{
$return_array = array('message'=>'email already exist'); $return_array = array('message'=>'email already exist');
} }
else{ else
{
$return_array = array('message'=>'success');
}
return $return_array;
}
public function usernameExist($data)
{
$query_email = $this->db->get_where("tbl_registration",array("username"=>$data['username']));
if($query_email->num_rows() > 0)
{
$return_array = array('message'=>'username already exist');
}
else
{
$return_array = array('message'=>'success');
}
return $return_array;
}
public function usernameExist_doc($data)
{
$query_email = $this->db->get_where("tbl_doctors",array("username"=>$data['username']));
if($query_email->num_rows() > 0)
{
$return_array = array('message'=>'username already exist');
}
else
{
$return_array = array('message'=>'success');
}
return $return_array;
}
public function emailExist_doc($data)
{
$query_email = $this->db->get_where("tbl_doctors",array("email"=>$data['email']));
if($query_email->num_rows() > 0)
{
$return_array = array('message'=>'email already exist');
}
else
{
$return_array = array('message'=>'success'); $return_array = array('message'=>'success');
} }
return $return_array; return $return_array;
} }
function registration($data) public function registration($data)
{ {
if($this->db->insert('tbl_registration', $data)){ if($this->db->insert('tbl_registration', $data)){
$insertid = $this->db->insert_id(); $insertid = $this->db->insert_id();
...@@ -32,7 +84,7 @@ ...@@ -32,7 +84,7 @@
//print_r($return_array);die(); //print_r($return_array);die();
return $return_array; return $return_array;
} }
function authtoken_registration($authtoken,$userid){ public function authtoken_registration($authtoken,$userid){
$data = array('authtoken'=>$authtoken,'userid'=>$userid); $data = array('authtoken'=>$authtoken,'userid'=>$userid);
if($this->db->insert('tbl_authtoken', $data)){ if($this->db->insert('tbl_authtoken', $data)){
return true; return true;
...@@ -41,17 +93,126 @@ ...@@ -41,17 +93,126 @@
return false; return false;
} }
} }
function updatePic($data,$id){ public function updatePic($data,$id){
if($this->db->update('tbl_registration', $data, array('id' => $id))) if($this->db->update('tbl_registration', $data, array('id' => $id)))
return true; return true;
else else
return false; return false;
} }
function delete_registration($uid) public function delete_registration($uid)
{ {
if($this->db->where_in('id', $uid)->delete('tbl_registration')){} if($this->db->where_in('id', $uid)->delete('tbl_registration')){}
} }
public function login($data)
{
//print_r($data['login_type']);die();
if($data['login_type']=="PATIENT")
{
//$this->db->join('tbl_authtoken', 'tbl_authtoken.userid = tbl_registration.id', 'inner');
$query = $this->db->get_where("tbl_registration",array("username"=>$data['login-form-username'],"password"=>md5($data['login-form-password'])));
$query_email = $this->db->get_where("tbl_registration",array("email"=>$data['login-form-username'],"password"=>md5($data['login-form-password'])));
}
else if($data['login_type']=="DOCTOR")
{
$query = $this->db->get_where("tbl_doctors",array("username"=>$data['login-form-username'],"password"=>md5($data['login-form-password'])));
$query_email = $this->db->get_where("tbl_doctors",array("email"=>$data['login-form-username'],"password"=>md5($data['login-form-password'])));
}
if($query->num_rows() > 0 || $query_email->num_rows() >0 ){
if($query->num_rows() > 0)
{
$return_array = array('status'=>'success','userdata'=>$query->row_array());
}
else if($query_email->num_rows() >0)
{
$return_array = array('status'=>'success','userdata'=>$query_email->row_array());
}
}
else{
$return_array = array('status'=>'fail');
}
//print_r($return_array);die();
return $return_array;
}
/*public function location_update($userdata,$request)
{
//print_r($userdata['id']);die();
$query = $this->db->get_where("tbl_user_location",array("userid"=>$userdata['id']));
if($query->num_rows() > 0)
{
print_r("location exist");die();
}
else
{
if($this->db->insert("tbl_user_location",array("userid"=>$userdata['id'],"location_name"=>$request['address'],"location_latitude"=>$request['latitude'],"location_longitude"=>$request['longitude']))){
$return_array = array('status'=>'success');
}
else{
$return_array = array('status'=>'fail');
}
}
return $return_array;
}*/
function location_update($userdata,$request){
//print_r($request['address']);die();
$sql = $this->db->insert_string('tbl_user_location', array("userid"=>$userdata['id'],"location_name"=>$request['address'],"location_latitude"=>$request['latitude'],"location_longitude"=>$request['longitude'])) . ' ON DUPLICATE KEY UPDATE userid = ' .$userdata['id'].',location_name ='.'"' .$request['address'].'"'.',location_latitude='.$request['latitude'].',location_longitude='.$request['longitude'];
//print_r($this->db->last_sqlquery());die();
if($this->db->query($sql)){
$return_array = array('status'=>'success');
}
else{
$return_array = array('status'=>'fail');
}
return $return_array;
}
function location_update_doctor($userdata,$request){
//print_r($request['address']);die();
$sql = $this->db->insert_string('tbl_doctors_location', array("doctor_id"=>$userdata['id'],"location_name"=>$request['address'],"location_lattitude"=>$request['latitude'],"location_longitude"=>$request['longitude'])) . ' ON DUPLICATE KEY UPDATE doctor_id = ' .$userdata['id'].',location_name ='.'"' .$request['address'].'"'.',location_lattitude='.$request['latitude'].',location_longitude='.$request['longitude'];
//print_r($this->db->last_sqlquery());die();
if($this->db->query($sql)){
$return_array = array('status'=>'success');
}
else{
$return_array = array('status'=>'fail');
}
return $return_array;
}
function register_doctor($data)
{
if($this->db->insert('tbl_doctors', $data))
{
$insertid = $this->db->insert_id();
$query = $this->db->get_where("tbl_doctors",array("id"=>$insertid));
$return_array = array('status'=>'success','data'=>$query->row_array());
}
else
{
$return_array = array('status'=>'fail');
}
return $return_array;
}
function delete_registration_doctor($uid)
{
if($this->db->where_in('id', $uid)->delete('tbl_doctors')){ }
}
function updatePic_doctor($data,$id)
{
$this->db->update('tbl_doctors', $data, array('id' => $id));
}
......
<?php
class Patient_model extends CI_Model {
function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
}
public function get_single_patient($id)
{
$this->db->select("tbl_registration.id as patientid,
tbl_registration.name as pt_name,
tbl_registration.profile_photo as pt_pic,
tbl_registration.email as pt_email,
tbl_registration.dob as pt_dob,
tbl_registration.number as pt_number,
tbl_registration.blood_group as pt_blood_group,
tbl_registration.weight as pt_weight,
tbl_registration.height as pt_height,
tbl_registration.street_address as pt_street_add,
tbl_registration.locality as pt_locality,
tbl_registration.zip_code as pt_zip_code
");
$this->db->from('tbl_registration');
//$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
$this->db->where('tbl_registration.id',$id);
$data =$this->db->get()->row_array();
return $data;
}
public function get_doctor_clinic_list($id)
{
$this->db->select("tbl_clinic.name as clinic_name,
tbl_clinic.id as clinic_id
");
$this->db->from('tbl_clinic_doctors');
$this->db->join('tbl_clinic', 'tbl_clinic.id = tbl_clinic_doctors.clinic_id','inner');
$this->db->where('tbl_clinic_doctors.doctor_id',$id);
//$this->db->get();
// $data = $this->db->last_query();
$data =$this->db->get()->result_array();
//print_r($data);die();
return $data;
}
public function get_patient_completed_consultation($id)
{
$this->db->select("tbl_booking.id as book_id,
tbl_booking.date as book_date,
tbl_booking.time as book_time,
tbl_doctors.name as doc_name,
tbl_doctors.profile_pic as doc_pic
");
$this->db->from('tbl_booking');
$this->db->join('tbl_doctors', 'tbl_booking.doctor_id = tbl_doctors.id','inner');
$this->db->where('tbl_booking.patient_id',$id);
$this->db->where('tbl_booking.booking_status',2);
$this->db->order_by("tbl_booking.date", "asc");
$this->db->order_by("tbl_booking.time_start", "asc");
//$this->db->get();
// $data = $this->db->last_query();
$data =$this->db->get()->result_array();
//print_r($data);die();
return $data;
}
public function get_patient_confirmed_consultation($id)
{
$this->db->select("tbl_booking.id as book_id,
tbl_booking.date as book_date,
tbl_booking.time as book_time,
tbl_doctors.name as doc_name,
tbl_doctors.profile_pic as doc_pic
");
$this->db->from('tbl_booking');
$this->db->join('tbl_doctors', 'tbl_booking.doctor_id = tbl_doctors.id','inner');
$this->db->where('tbl_booking.patient_id',$id);
$this->db->where('tbl_booking.booking_status',1);
$this->db->where('tbl_booking.payment_status',1);
$this->db->order_by("tbl_booking.date", "asc");
$this->db->order_by("tbl_booking.time_start", "asc");
//$this->db->get();
// $data = $this->db->last_query();
$data =$this->db->get()->result_array();
//print_r($data);die();
return $data;
}
public function get_Booking($booking_id)
{
$this->db->select("tbl_booking.id as book_id,
tbl_booking.doctor_id as doc_id,
tbl_booking.clinic_id as clinic_id,
tbl_booking.date as book_date,
tbl_booking.time as book_time,
tbl_doctors.name as doc_name,
tbl_doctors.profile_pic as doc_pic,
tbl_specialization.specialization_name as doc_specialization
");
$this->db->from('tbl_booking');
$this->db->join('tbl_doctors', 'tbl_booking.doctor_id = tbl_doctors.id','inner');
$this->db->join('tbl_specialization', 'tbl_doctors.specialization = tbl_specialization.id','inner');
$this->db->where('tbl_booking.id',$booking_id);
$query = $this->db->get();
return $query->row_array();
}
public function cancel_Booking($booking_id)
{
$this->db->where('tbl_booking.id',$booking_id);
$this->db->update('tbl_booking',array('booking_status'=>4));
}
public function update_Booking($data)
{
$times = explode('-', $data['confirm-book-time']);
$book_start_time = strtotime($data['confirm-book-date'].' '.$times[0]);
$book_end_time = strtotime($data['confirm-book-date'].' '.$times[1]);
//print_r($book_end_time);die();
$this->db->where('tbl_booking.id',$data['reschedule-book-id']);
$this->db->update('tbl_booking',array('date'=>strtotime($data['confirm-book-date']),'time'=>$data['confirm-book-time'],'time_start'=>$book_start_time,'time_end'=>$book_end_time));
}
public function checkDoctorExist($doc_id)
{
$this->db->select("*");
$this->db->from("tbl_consultation");
$this->db->where_in("tbl_consultation.doctor_id",$doc_id);
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
return $query->result_array();
}
public function Schedulelist($clinicId,$docId)
{
$this->db->select("date");
$this->db->from("tbl_consultation");
$this->db->where_in("tbl_consultation.doctor_id",$docId);
$this->db->where_in("tbl_consultation.clinic_id",$clinicId);
//$this->db->where("tbl_consultation.clinic_id",$clinicId);
$query = $this->db->get();
return $query->row_array();
}
function set_new_consultation($data,$clinicId,$doctors)
{
$newData = json_encode($data);
foreach ($doctors as $key => $value) {
$this->db->where(array('doctor_id'=>$value,'clinic_id'=>$clinicId));
$this->db->update('tbl_consultation',array('date'=>$newData));
}
}
function assignDoctors($doctors,$clinicId)
{
foreach ($doctors as $key => $value)
{
$this->db->insert('tbl_clinic_doctors',array('doctor_id'=>$value,'clinic_id'=>$clinicId));
}
}
function insertVacation($request)
{
if($this->db->insert('tbl_doctor_leave', $request))
{
return true;
}
else
{
return false;
}
}
}
?>
\ No newline at end of file
<?php
class Search_doctor_model extends CI_Model {
function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Kolkata");
}
public function doctor_search($post_data)
{
$limit = 1;
$page = 1;
if(isset($post_data['page'])) {
$page = $post_data['page'];
}
$start = ($page-1) * $limit;
$lat = $post_data["doctor-search-latitude"];
$lng = $post_data["doctor-search-longitude"];
$this->db->select("tbl_doctors.profile_pic AS doctor_photo,
tbl_doctors.about AS biography,
tbl_doctors.street_address AS street_address,
tbl_doctors.locality AS locality,
tbl_specialization.specialization_name AS specialization,
tbl_doctors.id as doctorid,
tbl_doctors.name,
tbl_doctors.price,
tbl_clinic.id AS clinic_id,
tbl_clinic.name AS clinic_name,
ROUND(( 6371 * acos( cos( radians({$lat}) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians({$lng}) ) + sin( radians({$lat}) ) * sin( radians( `location_lattitude` ) ) ) )) AS clinic_distance,
tbl_clinic.street_address AS clinic_street_address,
tbl_clinic.cep AS clinic_cep,
tbl_clinic.locality AS clinic_locality,
tbl_clinic.number AS clinic_number,
tbl_clinic.location_lattitude AS clinic_lat,
tbl_clinic.location_longitude AS clinic_lng"
);
$this->db->from('tbl_doctors');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
$this->db->join('tbl_doctor_leave', 'tbl_doctor_leave.doctor_id = tbl_doctors.id','left');
$this->db->join('tbl_clinic_doctors', 'tbl_doctors.id = tbl_clinic_doctors.doctor_id','left');
$this->db->join('tbl_clinic', 'tbl_clinic_doctors.clinic_id = tbl_clinic.id','left');
if(isset($post_data['doctor-search-speciality']) && !empty($post_data['doctor-search-speciality']))
{
$this->db->where('tbl_specialization.specialization_name',$post_data['doctor-search-speciality']);
}
if(isset($post_data['doctor-search-location']) && !empty($post_data['doctor-search-location']))
{
/*$where = "ROUND(( 6371 * acos( cos( radians({$post_data['doctor-search-latitude']}) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians({$post_data['doctor-search-longitude']}) ) + sin( radians({$post_data['doctor-search-latitude']}) ) * sin( radians( `location_lattitude` ) ) ) )) <=10";
$this->db->where($where);*/
$where = "ROUND(( 6371 * acos( cos( radians({$post_data['doctor-search-latitude']}) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians({$post_data['doctor-search-longitude']}) ) + sin( radians({$post_data['doctor-search-latitude']}) ) * sin( radians( `location_lattitude` ) ) ) ))";
$this->db->where($where."<=10" );
}
if(isset($post_data['doctor-search-date']) && !empty($post_data['doctor-search-date']))
{
$this->db->where($post_data['doctor-search-date'].'<'.'tbl_doctor_leave.start_date');
$this->db->or_where($post_data['doctor-search-date'].'>'.'tbl_doctor_leave.end_date');
}
/*$this->db->get();
echo $this->db->last_query();die();*/
$this->db->limit($limit, $start);
$data =$this->db->get()->result_array();
return $data;
}
public function get_single_doctor_clinic($dctr_id,$clinic_id)
{
$this->db->select("tbl_doctors.id as doctorid,
tbl_doctors.name as dr_name,
tbl_doctors.profile_pic as dr_pic,
tbl_doctors.email as dr_email,
tbl_doctors.dob as dr_dob,
tbl_doctors.about as dr_bio,
tbl_doctors.price as dr_price,
tbl_specialization.specialization_name AS dr_specialization,
tbl_clinic.id AS clinic_id,
tbl_clinic.name AS clinic_name,
tbl_clinic.street_address AS clinic_street_address,
tbl_clinic.locality AS clinic_locality,
tbl_clinic.cep clinic_cep,
tbl_clinic.number AS clinic_number,
tbl_clinic.location_lattitude AS clinic_lat,
tbl_clinic.location_longitude AS clinic_lng
");
$this->db->from('tbl_doctors');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
$this->db->join('tbl_clinic_doctors', 'tbl_doctors.id = tbl_clinic_doctors.doctor_id','left');
$this->db->join('tbl_clinic', 'tbl_clinic_doctors.clinic_id = tbl_clinic.id','left');
$this->db->where('tbl_doctors.id',$dctr_id);
$this->db->where('tbl_clinic.id',$clinic_id);
$data =$this->db->get()->row_array();
return $data;
}
public function filter_search($post_data)
{
//print_r($post_data);
//die();
$limit = 10;
$page = 1;
if(isset($post_data['page'])) {
$page = $post_data['page'];
}
$start = ($page-1) * $limit;
$lat = $post_data["doctor-search-latitude"];
$lng = $post_data["doctor-search-longitude"];
$this->db->select("tbl_doctors.profile_pic AS doctor_photo,
tbl_doctors.about AS biography,
tbl_doctors.street_address AS street_address,
tbl_doctors.locality AS locality,
tbl_specialization.specialization_name AS specialization,
tbl_doctors.id as doctorid,
tbl_doctors.name,
tbl_doctors.price,
tbl_clinic.id AS clinic_id,
tbl_clinic.name AS clinic_name,
ROUND(( 6371 * acos( cos( radians({$lat}) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians({$lng}) ) + sin( radians({$lat}) ) * sin( radians( `location_lattitude` ) ) ) )) AS clinic_distance,
tbl_clinic.street_address AS clinic_street_address,
tbl_clinic.cep AS clinic_cep,
tbl_clinic.locality AS clinic_locality,
tbl_clinic.number AS clinic_number,
tbl_clinic.location_lattitude AS clinic_lat,
tbl_clinic.location_longitude AS clinic_lng"
);
//$this->db->select_max("tbl_doctors.price" , "max_price");
$this->db->from('tbl_doctors');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','left');
$this->db->join('tbl_doctor_leave', 'tbl_doctor_leave.doctor_id = tbl_doctors.id','left');
$this->db->join('tbl_clinic_doctors', 'tbl_doctors.id = tbl_clinic_doctors.doctor_id','inner');
$this->db->join('tbl_clinic', 'tbl_clinic_doctors.clinic_id = tbl_clinic.id','left');
if(isset($post_data['doctor-search-speciality']) && !empty($post_data['doctor-search-speciality']))
{
$this->db->where('tbl_specialization.specialization_name',$post_data['doctor-search-speciality']);
}
//Initial Search with Location Input
if( !empty($post_data['doctor-search-location']) && empty($post_data['filter_dr_srch_distance_end']) && empty($post_data['filter_dr_srch_distance_start']))
{
$where = "ROUND(( 6371 * acos( cos( radians($lat) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( `location_lattitude` ) ) ) ))";
$this->db->where($where."<= 10" );
}
//Filter Search Location
if( !empty($post_data['filter_dr_srch_distance_end']) && !empty($post_data['filter_dr_srch_distance_start']))
{
$post_data['filter_dr_srch_distance_end'] = preg_replace("/[^0-9,.]/", "", $post_data['filter_dr_srch_distance_end'] );
$post_data['filter_dr_srch_distance_start'] = preg_replace("/[^0-9,.]/", "", $post_data['filter_dr_srch_distance_start'] );
$where = "ROUND(( 6371 * acos( cos( radians($lat) ) * cos( radians( `location_lattitude` ) ) * cos( radians( `location_longitude` ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( `location_lattitude` ) ) ) ))";
$this->db->where($where.">= {$post_data['filter_dr_srch_distance_start']}" );
$this->db->where($where."<= {$post_data['filter_dr_srch_distance_end']}" );
}
if(isset($post_data['filter_dr_gender']) && !empty($post_data['filter_dr_gender']))
{
$this->db->where('tbl_doctors.gender',$post_data['filter_dr_gender']);
}
if(!empty($post_data['filter_dr_srch_price_high']) && !empty($post_data['filter_dr_srch_price_low']))
{
$post_data['filter_dr_srch_price_low'] = preg_replace("/[^0-9,.]/", "", $post_data['filter_dr_srch_price_low'] );
$post_data['filter_dr_srch_price_high'] = preg_replace("/[^0-9,.]/", "", $post_data['filter_dr_srch_price_high'] );
$this->db->where('tbl_doctors.price'.">= {$post_data['filter_dr_srch_price_low']}" );
$this->db->where('tbl_doctors.price'."<= {$post_data['filter_dr_srch_price_high']}" );
}
if(isset($post_data['doctor-search-date']) && !empty($post_data['doctor-search-date']))
{
$this->db->or_where($post_data['doctor-search-date'].'<'.'tbl_doctor_leave.start_date');
$this->db->or_where($post_data['doctor-search-date'].'>'.'tbl_doctor_leave.end_date');
}
//print_r("expression");
//$this->db->get();
$this->db->limit($limit, $start);
//echo $this->db->last_query();die();
$data =$this->db->get()->result_array();
return $data;
}
function doctor_availability($doctor_id,$clinic_id)
{
$this->db->select("tbl_consultation.*");
$query = $this->db->get_where('tbl_consultation',array('doctor_id' => $doctor_id,'clinic_id' => $clinic_id));
//print_r($query->row_array());
if ($query->num_rows() > 0) {
$return_array = array('status'=>'success','data'=>$query->row_array());
}
else{
$return_array = array('status'=>'fail');
}
return $return_array;
}
function checkDoctorLeave($data)
{
$date = strtotime($data['confirm-book-date']);
$this->db->select('count(*) as count');
$this->db->from('tbl_doctor_leave');
$this->db->where('tbl_doctor_leave.start_date'."<= {$date}" );
$this->db->where('tbl_doctor_leave.end_date'.">= {$date}" );
$this->db->where('tbl_doctor_leave.doctor_id',$data['confirm-book-doctor'] );
$this->db->where('tbl_doctor_leave.clinic_id',$data['confirm-book-clinic'] );
$data =$this->db->get()->row_array();
//print_r($data);die();
return $data;
}
function checkDoctorBooking($data)
{
$date = strtotime($data['confirm-book-date']);
//print_r($data);die();
$this->db->select('count(*) as count');
//$this->db->select('tbl_booking.id');
$this->db->from('tbl_booking');
$this->db->where('tbl_booking.time',$data['confirm-book-time']);
$this->db->where('tbl_booking.doctor_id',$data['confirm-book-doctor'] );
$this->db->where('tbl_booking.clinic_id',$data['confirm-book-clinic'] );
$this->db->where('tbl_booking.date',$date);
$this->db->where('tbl_booking.booking_status<3');
//$this->db->or_where('tbl_booking.booking_status','2');
//$this->db->or_where('tbl_booking.booking_status','0');
$data =$this->db->get()->row_array();
//print_r($data);die();
return $data;
}
function getDoctorPrice($doctorid)
{
$this->db->select('tbl_doctors.price as price');
$this->db->from('tbl_doctors');
$this->db->where('tbl_doctors.id',$doctorid);
$data =$this->db->get()->row_array();
//print_r($data);die();
return $data;
}
function insertBooking($data)
{
if($this->db->insert('tbl_booking',$data))
{
$res = array('status' => 'success', 'type' =>'booking confirmed');
}
else
{
$res = array('status' => 'fail', 'type' =>'booking unconfirmed');
}
return $res;
}
function checkBooking($data)
{
$date = strtotime($data['confirm-book-date']);
$this->db->select('count(*) as count');
$this->db->select('tbl_booking.date as booking_date');
$this->db->select('tbl_booking.time as booking_slot');
$this->db->from('tbl_booking');
$this->db->where('tbl_booking.time',$data['confirm-book-time']);
$this->db->where('tbl_booking.doctor_id',$data['confirm-book-doctor'] );
$this->db->where('tbl_booking.clinic_id',$data['confirm-book-clinic'] );
$this->db->where('tbl_booking.payment_status','0');
$data =$this->db->get()->row_array();
//print_r($data);die();
return $data;
}
function set_payment_status($data)
{
$update = array('payment_status' => '1');
$this->db->where('tbl_booking.time',$data['confirm-book-time']);
$this->db->where('tbl_booking.doctor_id',$data['confirm-book-doctor'] );
$this->db->where('tbl_booking.clinic_id',$data['confirm-book-clinic'] );
$this->db->where('tbl_booking.payment_status','0');
$this->db->update('tbl_booking', $update);
}
}
?>
\ No newline at end of file
<div class="ip_set_two_wrapper">
<div class="container ip_custom_container">
<div class="ip_top_dash_bay">
<div class="row">
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_appointments.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="210">0</strong>
<p>Attendance</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_feature.png">
</div>
<div class="ip_top_dash_detail" >
<strong class="ip_counter" data-count="780023">0</strong>
<p>Billed</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_paintences.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="6586">0</strong>
<p>Patients</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list bordernone">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_vistors.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="523">0</strong>
<p>Profile Views</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="ip_bio_tab_div">
<div class="row m0">
<div class="col-md-2 p0 height100">
<div class="ip_bio_tab_bay height100">
<ul>
<li class="active" data-toggle="tab" href="#profile">Profile</li>
<li data-toggle="tab" href="#bio">Biography</li>
<li class="arrow" data-toggle="tab" href="#special">Specialization</li>
<li data-toggle="tab" href="#photo">Photos</li>
<li data-toggle="tab" href="#more" class="arrow">More</li>
</ul>
</div>
</div>
<div class="col-md-10 p0">
<div class="ip_bio_tab_content">
<div class="tab-content">
<div id="profile" class="tab-pane fade in active">
<div class="ip_profile_tab_top">
<div class="ip_profile_tab_circle">
<img src="<?php echo base_url();echo $doctor_data['dr_pic'];?>">
</div>
<div class="ip_profile_tab_name">
<h3>Dr. <?php echo $doctor_data['dr_name'] ?></h3>
</div>
<div class="ip_profile_tab_button">
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_edit.png"></div>
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_delete.png"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="ip_profile_tab_detail">
<div class="row">
<div class="col-md-6">
<ul>
<li>
<div class="child1">Email :</div>
<div class="child2"><?php echo $doctor_data['dr_email'] ?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Phone :</div>
<div class="child2">015-6983-345</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Site :</div>
<div class="child2">www.dummy.com</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Company :</div>
<div class="child2">Dummy</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Job Title :</div>
<div class="child2"><?php echo $doctor_data["dr_specialization"];?></div>
<div class="clear"></div>
</li>
</ul>
</div>
<div class="col-md-6">
<ul>
<?php if(!empty($doctor_data['dr_dob']))
{?>
<li>
<div class="child1">Birthday :</div>
<div class="child2"><?php echo date('d F Y',$doctor_data["dr_dob"]);?></div>
<div class="clear"></div>
</li>
<?php
}
?>
<li>
<div class="child1">Current City :</div>
<div class="child2"><?php echo $doctor_data["dr_locality"];?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Studied at :</div>
<div class="child2">Harward University</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="bio" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3><?php echo $doctor_data["dr_bio"];?></h3>
</div>
</div>
<div id="special" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3><?php echo $doctor_data["dr_specialization"];?></s></h3>
</div>
</div>
<div id="photo" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>Photos</h3>
</div>
</div>
<div id="more" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>More</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_grid_cols">
<div class="row">
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Attendence
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail textCenter">
<div class="ip_attendence_circle">
<div class="c100 p25">
<span><strong>25</strong></span>
<div class="slice">
<div class="bar"></div>
<div class="fill"></div>
</div>
</div>
<div class="clear"></div>
</div>
<p>Total attendence today</p>
<div class="ip_bio_bottom_bay">
<li>
<strong>94</strong>
<p>Week</p>
</li>
<li>
<strong>302</strong>
<p>Month</p>
</li>
<li>
<strong>946</strong>
<p>Year</p>
</li>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Notification
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_notification_list">
<ul>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Messages
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_message_list">
<ul>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="ip_full_calender_div">
<div class="ip_full_calender_head">
<div class="ip_full_calender_nav">
<div class="btn-group">
<button type="button" class="btn" id="appointments_day_prevbtn"><img src="<?php echo base_url();?>assets/images/ip_arw_left.png"></button>
<button type="button" class="btn" id="appointments_day_nextbtn"><img src="<?php echo base_url();?>assets/images/ip_arw_right.png"></button>
</div>
<div class="btn-group">
<button type="button" class="btn ip_apppointment_btn_custom" id="appointments_day_todaybtn"><a>TODAY</a></button>
</div>
</div>
<h3>Appointment</h3>
<div class="ip_record_settings">
<div class="btn-group ip_custom_tabs_menu">
<button type="button" class="btn ip_apppointment_btn_custom current dctr_dash_appoint_day"><a href="#tab-1">DAY</a></button>
<button type="button" class="btn ip_apppointment_btn_custom dctr_dash_appoint_week"><a href="#tab-2">WEEK</a></button>
<button type="button" class="btn ip_apppointment_btn_custom dctr_dash_appoint_month"><a href="#tab-3">MONTH</a></button>
</div>
<span class="settings"><img src="<?php echo base_url();?>assets/images/ip_settings.png"></span>
</div>
</div>
<div class="ip_full_calender_content">
<div class="ip_custom_tab">
<div id="tab-1" class="ip_period_section ip_custom_tab_content">
<div class="row m0">
<div class="col-md-9 p0">
<div class="ip_day_scheduleler">
<ul>
<li class="ip_current_date">08</li>
<li class="ip_current_month">September</li>
<div class="clear"></div>
</ul>
<div class="ip_day_space"></div>
<ul class="ip_day_listing" id="ip-appointments-day">
<?php $this->load->view('doctor_dash_appointments_day'); ?>
</ul>
</div>
</div>
<div class="col-md-3 p0">
<div class="ip_appointment_calender">
<div class="ip_current_day_frame">
<!-- value="<?php echo date('m/d/Y');?>" -->
<input class="ip_current_day" id="ip_appointment_calender" value="<?php echo date('m/d/Y');?>" placeholder="Select Date" />
</div>
</div>
</div>
</div>
</div>
<div id="tab-2" class="ip_period_section ip_custom_tab_content">
<div class="ip_table_head">
<ul>
<!-- <li class="time_slot"></li>
<li>MON, 3</li>
<li>TUES, 4</li>
<li>WED, 5</li>
<li>THUR, 6</li>
<li>FRI, 7</li>
<li>SAT, 8</li>
<li class="borderrightnone">SUN, 9</li> -->
<li class="time_slot"></li>
<?php
//$today =date('N',time());
for ($i=0; $i < 7; $i++) {
$day = date('D',strtotime('+'.$i.'day'));
$dayno = date('d',strtotime('+'.$i.'day'));
?>
<li><?php echo $day.','. $dayno;?></li>
<?php
}
?>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_head_divide">
<ul>
<li class="time_slot"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="borderrightnone"></li>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_days">
<ul id="dctr_week_appointment">
<?php $this->load->view('doctor_dash_appointments_week');?>
</ul>
</div>
</div>
<div id="tab-3" class="ip_period_section ip_custom_tab_content">
<div class="ip_month_schedule">
<div class="ip_month_schedule_head">
<ul>
<li>MONDAY</li>
<li>TUESDAY</li>
<li>WEDNESDAY</li>
<li>THURSDAY</li>
<li>FRIDAY</li>
<li>SATURDAY</li>
<li>SUNDAY</li>
<div class="clear"></div>
</ul>
</div>
<div class="ip_month_schedule_dates">
<ul id="dctr_month_appointment">
<?php $this->load->view('doctor_dash_appointments_month'); ?>
<div class="clear"></div>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_grid_cols">
<div class="row">
<div class="col-md-8">
<div class="ip_schedule_div">
<form data-parsley-validate="" role="form" id="doc_sch_sub_form">
<div class="ip_schedule_head">
<div class="ip_bio_head bordernone floatLeft">
Main Schedule
</div>
<div class="ip_head_button floatRight">
<div class="floatLeft mr5">
<select class="ip_select_clinic_input" data-parsley-required="" name="dct_sch_clinic" id="doc_sel_clinic" >
<option disabled selected>Select Clinic</option>
<?php foreach ($clinic_list as $key => $value) {
?>
<option value="<?php echo $value['clinic_id']?>"><?php echo $value['clinic_name']?></option>
<?php
}
?>
</select>
</div>
<div class="floatLeft">
<div class="btn-group btn-group-sm">
<button type="button" class="btn ip_bio_head_btn"><img src="<?php echo base_url();?>assets/images/ip_arw_left.png"></button>
<button type="button" class="btn ip_bio_head_btn"><img src="<?php echo base_url();?>assets/images/ip_arw_right.png"></button>
</div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="ip_schedule_week">
<li>
<input id="clinic_day_mon" disabled="" type="checkbox" name="dct_sch_day[]" value="mon">
<label for="clinic_day_mon">Monday</label>
</li>
<li>
<input id="clinic_day_tue" disabled="" type="checkbox" name="dct_sch_day[]" value="tue">
<label for="clinic_day_tue">Tuesday</label>
</li>
<li>
<input id="clinic_day_wed" disabled="" type="checkbox" name="dct_sch_day[]" value="wed">
<label for="clinic_day_wed">Wednesday</label>
</li>
<li>
<input id="clinic_day_thu" disabled="" type="checkbox" name="dct_sch_day[]" value="thu">
<label for="clinic_day_thu">Thursday</label>
</li>
<li>
<input id="clinic_day_fri" disabled="" type="checkbox" name="dct_sch_day[]" value="fri">
<label for="clinic_day_fri">Friday</label>
</li>
<li>
<input id="clinic_day_sat" disabled="" type="checkbox" name="dct_sch_day[]" value="sat">
<label for="clinic_day_sat">Saturday</label>
</li>
<li>
<input id="clinic_day_sun" data-parsley-mincheck="1" data-parsley-required="" disabled="" type="checkbox" name="dct_sch_day[]" value="sun">
<label for="clinic_day_sun">Sunday</label>
</li>
<div class="clear"></div>
</div>
<div class="ip_schedule_timing">
<li id="clinic_day_mon_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Monday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option> </select>-->
<input disabled="" id="sch_mon_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker " name="dct_sch_mon_start" placeholder="" >
<input disabled="" data-parsley-mintime = "#sch_mon_start" name="dct_sch_mon_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_mon_end">
<!-- <select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-1" class="ip_custom_checkbox" name="checkbox-1" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_mon_int" name="dct_sch_mon_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_tue_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Tuesday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_tue_start" name="dct_sch_tue_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" >
<input disabled="" data-parsley-mintime = "#sch_tue_start" name="dct_sch_tue_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_tue_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-2" class="ip_custom_checkbox" name="checkbox-2" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_tue_int" name="dct_sch_tue_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_wed_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Wednesday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_wed_start" name="dct_sch_wed_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="">
<input disabled="" data-parsley-mintime="#sch_wed_start" name="dct_sch_wed_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_wed_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-3" class="ip_custom_checkbox" name="checkbox-3" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select id="sch_wed_int" disabled="" name="dct_sch_wed_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_thu_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Thursday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_thu_start" name="dct_sch_thu_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" >
<input disabled="" data-parsley-mintime="#sch_thu_start" name="dct_sch_thu_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_thu_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-4" class="ip_custom_checkbox" name="checkbox-4" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_thu_int" name="dct_sch_thu_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_fri_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Friday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_fri_start" name="dct_sch_fri_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" >
<input disabled="" data-parsley-mintime="#sch_fri_start" name="dct_sch_fri_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_fri_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-5" class="ip_custom_checkbox" name="checkbox-5" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_fri_int" name="dct_sch_fri_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_sat_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Saturday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_sat_start" name="dct_sch_sat_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" >
<input disabled="" data-parsley-mintime="#sch_sat_start" name="dct_sch_sat_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_sat_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-6" class="ip_custom_checkbox" name="checkbox-6" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_sat_int" name="dct_sch_sat_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
<li id="clinic_day_sun_div" class="inp-dis">
<div class="row">
<div class="col-md-6">
<h6>Sunday</h6>
<!-- <select class="ip_schedule_timing_input floatLeft">
<option>05:25 PM</option>
</select>
<select class="ip_schedule_timing_input floatRight">
<option>05:25 PM</option>
</select> -->
<input disabled="" id="sch_sun_start" name="dct_sch_sun_start" class="ip_time floatLeft ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" >
<input disabled="" data-parsley-mintime="#sch_sun_start" name="dct_sch_sun_end" class="ip_time floatRight ip_schedule_timing_input dctr_dsh_timepicker" placeholder="" id="sch_sun_end">
<div class="clear"></div>
</div>
<div class="col-md-6">
<h6 class="ip_schedule_check">
<!-- <input id="checkbox-7" class="ip_custom_checkbox" name="checkbox-7" type="checkbox" checked> -->
<p class="ip_custom_checkbox_label">Interval</p>
</h6>
<select disabled="" id="sch_sun_int" name="dct_sch_sun_int" class="ip_schedule_timing_input floatLeft">
<option disabled selected>Time</option>
<?php
for ($i = 1; $i <= 59; $i++) {
?>
<option value="<?php echo $i?>"><?php echo $i?> min(s)</option>
<?php
}
?>
</select>
<div class="clear"></div>
</div>
</div>
</li>
</div>
<div class="ip_schedule_button_bay">
<button class="ip_schedule_btn" type="button" id="doc_sch_sub">ADD SCHEDULE</button>
</div>
</form>
<div id="add_schedule_success" class="alert alert-success hidden">
Schedule added Successfully.
</div>
<div id="add_schedule_fail" class="alert alert-danger hidden">
<strong>Sorry! </strong>Schedules are unavailable.
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_schedule_div">
<form data-parsley-validate="" role="form" id="doc_leave_sub_form">
<div class="ip_schedule_head">
<div class="ip_bio_head bordernone floatLeft">
Vacation
</div>
<div class="ip_head_button bordernone floatRight">
<select class="ip_select_clinic_input" data-parsley-required="true" name="doc-leave-clinic" id="doc_leave_clinic" >
<option disabled selected>Select Clinic</option>
<?php foreach ($clinic_list as $key => $value) {
?>
<option value="<?php echo $value['clinic_id']?>"><?php echo $value['clinic_name']?></option>
<?php
}
?>
</select>
</div>
<div class="clear"></div>
</div>
<div class="ip_schedule_detail">
<li>
<div class="child1">Start of Vacation</div>
<div class="child2" id="sandbox-container">
<input data-parsley-required="true" class="ip_schedule_input" name="dctr-leave-start" id="dctr_leave_start" placeholder="">
</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">End of Vacation</div>
<div class="child2" id="sandbox-container">
<input data-parsley-required="true" class="ip_schedule_input" name="dctr-leave-end" id="dctr_leave_end" data-parsley-mindate="#dctr_leave_start" placeholder="">
</div>
<div class="clear"></div>
</li>
</div>
<div class="ip_schedule_button_bay">
<button class="ip_schedule_btn" type="button" id="doc_leave_sub" >ACTIVATE VACATION</button>
</div>
<div class="alert alert-success hidden" id="add_vacation_success">
<strong>Success!</strong> Vacation Added.
</div>
<div class="alert alert-success hidden" id="add_vacation_fail">
<strong>Error!</strong> Vacation not Added.
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
if(!empty($day_appointment))
{
foreach ($day_appointment as $key => $value)
{
?>
<li>
<div class="ip_day_time_slot">
<p><?php echo $value['time_start'];?></p>
</div>
<div class="ip_day_time_schedule_details">
<div class="ip_avialable p10">
<div class="row m0 height100">
<div class="col-md-4 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
<span><img src="<?php echo base_url();echo $value['pat_pic'];?>"></span>
<span><?php echo $value['pat_name'];?></span>
</div>
</div>
<div class="col-md-3 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
<input id="checkbox-3" class="ip_custom_checkbox1" name="checkbox-3" type="checkbox" checked>
<label for="checkbox-3" class="ip_custom_checkbox_label1">Start service</label>
</div>
</div>
<div class="col-md-3 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
<input id="checkbox-4" class="ip_custom_checkbox1" name="checkbox-4" type="checkbox" checked>
<label for="checkbox-4" class="ip_custom_checkbox_label1">Notify Delay</label>
</div>
</div>
<div class="col-md-2 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
<span class="ip_canceler"><img src="<?php echo base_url();?>assets/images/ip_cancel.png"></span>
<span class="ip_canceler">Cancel</span>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</li>
<?php
}
}
else
{
?>
<li>
<div class="ip_day_time_slot">
<p></p>
</div>
<div class="ip_day_time_schedule_details ip_avialable">
<div class="row m0 height100">
<div class="col-md-4 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
</div>
</div>
<div class="col-md-8 p0 height100">
<div class="ip_day_time_schedule_details_data height100">
NO APPOINTMENTS
</div>
</div>
</div>
</div>
<div class="clear"></div>
</li>
<?php
}
?>
\ No newline at end of file
<?php
$noofdays = date('t', time());
$timestamp = strtotime(date('01-m-Y'));
$startDay =date('N',$timestamp);
for ($i=1; $i < $startDay ; $i++) {
?>
<li><div class="ip_month_inner_date"><span></span></div></li>
<?php
}
for ($i=1; $i <= $noofdays; $i++) {
?>
<li><div class="ip_month_inner_date">
<span><?php echo$i ?></span>
<?php
for ($j=0; $j < $noofdays; $j++)
{
if(!empty($month_appointment[$j])&&($month_appointment[$j]['day']==$i))
{
?>
<div class="selected">
<strong><?php echo $month_appointment[$j]['count'] ?></strong>
<p>CONSULTATION</p>
<p>APPOINTMENT</p>
</div>
<?php
}
}
?>
</div>
</li>
<?php
}
?>
<!-- <li><div class="ip_month_inner_date"><span>01</span></div></li>
<li><div class="ip_month_inner_date selected"><span>02</span><strong>7</strong>
<p>CONSULTATION</p>
<p>APPOINTMENT</p></div></li>
<li><div class="ip_month_inner_date"><span>03</span></div></li> -->
<!-- <li><div class="ip_month_inner_date selected"><span>04</span><strong>10</strong>
<p>CONSULTATION</p>
<p>APPOINTMENT</p></div></li> -->
<!-- <li><div class="ip_month_inner_date"><span>05</span></div></li>
<li><div class="ip_month_inner_date"><span>06</span></div></li>
<li><div class="ip_month_inner_date selected"><strong>5</strong>
<p>CONSULTATION</p>
<p>APPOINTMENT</p>
<span>07</span></div></li> -->
\ No newline at end of file
<!-- <pre>
<?php print_r($week_appointments);?>
</pre> -->
<li class="time_slot">
<div class="ip_time_interval">
<ul>
<?php for ($i=1; $i <=24 ; $i++) {
?>
<li><p><?php echo $i;?>:00</p></li>
<?php
}?>
</ul>
</div>
</li>
<?php foreach ($week_appointments as $key => $value)
{
?>
<li>
<div class="ip_time_avialability">
<ul>
<?php for ($i=0; $i <24 ; $i++) { ?>
<li>
<div class="ip_avialability ">
<?php
foreach ($value as $key_inner => $value_inner)
{
if($value_inner['hour']==$i)
{
?>
<div class="ip_avialable">
<?php echo$value_inner['count'];?> Appointments
</div>
<?php
}
}
?>
<!-- <li>
<div class="ip_avialable">
1 Appointments
</div>
</li> -->
</div>
</li>
<?php
}?>
<!-- <li>
<div class="ip_avialability ip_avialable">
<span><img src="<?php echo base_url();?>assets/images/ip_pic.png"></span>
<span>Ria Lorence</span>
</div>
</li> -->
</ul>
</div>
</li>
<?php
}
?>
<!-- <li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability ip_avialable">
<span><img src="<?php echo base_url();?>assets/images/ip_pic.png"></span>
<span>Ria Lorence</span>
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
<span><img src="<?php echo base_url();?>assets/images/ip_pic.png"></span>
<span>Ria Lorence</span>
</div>
</li>
</ul>
</div>
</li>
-->
<div class="clear"></div>
\ No newline at end of file
<div class="ip_set_two_wrapper">
<div class="container ip_custom_container">
<div class="ip_top_dash_bay">
<div class="row">
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_appointments.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="210">0</strong>
<p>Attendance</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_feature.png">
</div>
<div class="ip_top_dash_detail" >
<strong class="ip_counter" data-count="780023">0</strong>
<p>Billed</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_paintences.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="6586">0</strong>
<p>Patients</p>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-md-3">
<div class="ip_top_dash_list bordernone">
<div class="ip_top_dash_circle">
<img src="<?php echo base_url();?>assets/images/ip_vistors.png">
</div>
<div class="ip_top_dash_detail">
<strong class="ip_counter" data-count="523">0</strong>
<p>Profile Views</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="ip_main_path_stream">
<ul>
<li>Dashboard<span><img src="<?php echo base_url();?>assets/images/ip_tab_list_arw.png"></span></li>
<li>Medical Records<span><img src="<?php echo base_url();?>assets/images/ip_tab_list_arw.png"></span></li>
</ul>
</div>
<div class="ip_records_wrapper">
<div class="row m0">
<div class="col-md-2 p0">
<div class="ip_record_section">
<div class="ip_record_section_header">
Medical Records
</div>
<div class="ip_record_section_detail">
<li data-toggle="tab" href="#attended"><span><img src="<?php echo base_url();?>assets/images/ip_record1.png"></span>Patience Attended</li>
<li data-toggle="tab" href="#schedulled"><span><img src="<?php echo base_url();?>assets/images/ip_record2.png"></span>Patience Scheduled</li>
</div>
</div>
</div>
<div class="col-md-10 p0 tab-content">
<div id="attended" class="ip_paitent_tab tab-pane fade in active">
<div class="ip_record_section">
<div class="ip_record_header1">
<div class="ip_select_all">
<div class="ip_schedule_check">
<input id="checkbox-1" class="ip_custom_checkbox" name="checkbox-1" type="checkbox" checked>
<label for="checkbox-1" class="ip_custom_checkbox_label"><img src="<?php echo base_url();?>assets/images/ip_drp_grey.png"></label>
</div>
</div>
<div class="ip_record_search_box">
<input class="ip_record_search_box_input" type="text" placeholder="Search">
</div>
<div class="ip_record_settings">
<span>1-10 of 100</span>
<span class="direction">
<img src="<?php echo base_url();?>assets/images/ip_arw_left.png">
<img src="<?php echo base_url();?>assets/images/ip_arw_right.png">
</span>
<span class="settings"><img src="<?php echo base_url();?>assets/images/ip_settings.png"></span>
</div>
<div class="clear"></div>
</div>
</div>
<div class="ip_record_listing">
<ul>
<li>
<div class="row m0">
<div class="col-md-1 p0">
<div class="ip_schedule_check">
<input id="checkbox-2" class="ip_custom_checkbox" name="checkbox-1" type="checkbox" checked>
<label for="checkbox-2" class="ip_custom_checkbox_label"></label>
</div>
</div>
<div class="col-md-3 p0">
<div class="ip_record_pic">
</div>
<div class="ip_record_name">
Colin Marcus
</div>
<div class="clear"></div>
</div>
<div class="col-md-4 p0">
<div class="ip_record_document">
<span><img src="<?php echo base_url();?>assets/images/ip_doc.png"></span><span>Last Consultation :<strong>13-Sept-2017</strong></span>
</div>
</div>
<div class="col-md-4 p0">
<div class="ip_record_document">
<span><img src="<?php echo base_url();?>assets/images/ip_doc.png"></span><span>Next Consultation :<strong>13-Sept-2017</strong></span>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div id="schedulled" class="ip_paitent_tab tab-pane fade">
<div class="ip_record_section">
<div class="ip_record_header1">
<div class="ip_select_all">
<div class="ip_schedule_check">
<input id="select-all-scheduled" class="ip_custom_checkbox" name="checkbox-1" type="checkbox" checked>
<label for="select-all-scheduled" class="ip_custom_checkbox_label"><img src="<?php echo base_url();?>assets/images/ip_drp_grey.png"></label>
</div>
</div>
<div class="ip_record_search_box">
<input class="ip_record_search_box_input" type="text" placeholder="Search">
</div>
<div class="ip_record_settings">
<span>1-10 of 100</span>
<span class="direction">
<img src="<?php echo base_url();?>assets/images/ip_arw_left.png">
<img src="<?php echo base_url();?>assets/images/ip_arw_right.png">
</span>
<span class="settings"><img src="<?php echo base_url();?>assets/images/ip_settings.png"></span>
</div>
<div class="clear"></div>
</div>
</div>
<div class="ip_record_listing">
<ul>
<li>
<div class="row m0">
<div class="col-md-1 p0">
<div class="ip_schedule_check">
<input id="select-scheduled" class="ip_custom_checkbox" name="checkbox-1" type="checkbox" checked>
<label for="select-scheduled" class="ip_custom_checkbox_label"></label>
</div>
</div>
<div class="col-md-3 p0">
<div class="ip_record_pic">
</div>
<div class="ip_record_name">
Jithin Varghese
</div>
<div class="clear"></div>
</div>
<div class="col-md-4 p0">
<div class="ip_record_document">
<span><img src="<?php echo base_url();?>assets/images/ip_doc.png"></span><span>Last Consultation :<strong>13-Sept-2017</strong></span>
</div>
</div>
<div class="col-md-4 p0">
<div class="ip_record_document">
<span><img src="<?php echo base_url();?>assets/images/ip_doc.png"></span><span>Next Consultation :<strong>13-Sept-2017</strong></span>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_main_wrapper" style="margin-top:70px;"> <div class="ip_main_wrapper" style="margin-top:70px;">
<nav class="navbar navbar-fixed-top"> <nav class="navbar navbar-fixed-top">
<!-- SECONDARY-HEADER-LOGEDOUT--> <!-- SECONDARY-HEADER-LOGEDOUT-->
...@@ -19,12 +23,34 @@ ...@@ -19,12 +23,34 @@
<ul class="nav navbar-nav ip_navbar_nav"> <ul class="nav navbar-nav ip_navbar_nav">
<li class="active"><a>HOME</a></li> <li class="active"><a>HOME</a></li>
<li><a> ABOUT</a></li> <li><a> ABOUT</a></li>
<?php
if(!$this->session->userdata('UserData'))
{
?>
<li data-toggle="modal" data-target="#choose"><a>REGISTER CONSULTING</a></li> <li data-toggle="modal" data-target="#choose"><a>REGISTER CONSULTING</a></li>
<?php
}
?>
<li><a>CONTACT US</a></li> <li><a>CONTACT US</a></li>
</ul> </ul>
<ul class="nav navbar-right ip_nav_bar_right"> <ul class="nav navbar-right ip_nav_bar_right">
<div class="ip_right_nav_home"> <div class="ip_right_nav_home">
<li data-toggle="modal" data-target="#login"><a>LOG IN</a></li> <?php
if($this->session->userdata('UserData'))
{
?>
<li class="logout-btn"><a href="<?php echo base_url()?>Home/logout">Hi <?php $UserData = $this->session->userdata('UserData'); echo $UserData['name'] ?> , LOG OUT</a></li>
<?php
}
else
{
?>
<li class="open-loginmodel"><a>LOG IN</a></li>
<?php
}
?>
<li class="ip_nav_download_btn"> <li class="ip_nav_download_btn">
<div class="ip_nav_download_btn_inner"> <div class="ip_nav_download_btn_inner">
<a>Download App</a> <a>Download App</a>
...@@ -37,6 +63,7 @@ ...@@ -37,6 +63,7 @@
</div> </div>
</nav> </nav>
<!--LOGIN MODEL BEGINS--> <!--LOGIN MODEL BEGINS-->
<div id="login" class="modal fade" role="dialog"> <div id="login" class="modal fade" role="dialog">
<div class="modal-dialog ip_login_modal"> <div class="modal-dialog ip_login_modal">
...@@ -46,23 +73,39 @@ ...@@ -46,23 +73,39 @@
<img src="<?php echo base_url();?>assets/images/ip_logo1.png"> <img src="<?php echo base_url();?>assets/images/ip_logo1.png">
</div> </div>
<hr> <hr>
<form role="form" data-parsley-validate="" id="login-form">
<div class="ip_login_input_form"> <div class="ip_login_input_form">
<div class="ip_login_input_row"> <div class="ip_login_input_row">
<input class="ip_login_input ip_login_user" placeholder="Login"> <div>
<input id="a" class="ip_custom_checkbox1 ip_gender_check_checkbox " type="radio" data-parsley-required data-parsley-error-message="Choose Login Type" class="" name="login_type" value="DOCTOR">
<label for="a" class="ip_custom_checkbox_label1 ip_doc_paitent ip_gender_check_label">DOCTOR</label>
<input id="b" class="ip_custom_checkbox1 ip_gender_check_checkbox " type="radio" name="login_type" value="PATIENT">
<label for="b" class="ip_custom_checkbox_label1 ip_doc_paitent ip_gender_check_label">PATIENT</label>
<div class="clear"></div>
</div>
</div>
<div class="ip_login_input_row">
<input name="login-form-username" data-parsley-required class="ip_login_input ip_login_user clear-login-data" placeholder="Login">
</div> </div>
<div class="ip_login_input_row"> <div class="ip_login_input_row">
<input class="ip_login_input ip_login_pass" placeholder="Password"> <input name="login-form-password" data-parsley-required class="ip_login_input ip_login_pass clear-login-data" placeholder="Password" type="password">
</div> </div>
<div class=""> <div class="">
<button class="ip_login_modal_signin floatLeft">LOGIN</button> <button type="button" class="ip_login_modal_signin floatLeft" id="login_submit">LOGIN</button>
<p class="floatLeft" data-toggle="modal" data-target="#forgot">Forgot Password</p> <p class="floatLeft" data-toggle="modal" data-target="#forgot">Forgot Password</p>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
</form>
<div id="err-login" class="alert alert-danger hidden">
</div>
<hr> <hr>
<div class="ip_login_input_form"> <div class="ip_login_input_form">
<div class="textCenter"> <div class="textCenter">
<p>Not yet registered?<a>Register Now!</a></p> <p id="home_registernowbtn">Not yet registered?<a>Register Now!</a></p>
</div> </div>
</div> </div>
</div> </div>
...@@ -136,7 +179,7 @@ We send the information to<br>password recovery </p> ...@@ -136,7 +179,7 @@ We send the information to<br>password recovery </p>
</div> </div>
<br><br> <br><br>
<div class="ip_reg_modal_footer"> <div class="ip_reg_modal_footer">
<button class="ip_sign_footer_btn" id="reg_choose_dct" data-toggle="modal">REGISTER AS DOCTOR / CLINIC</button> <button class="ip_sign_footer_btn" id="reg_choose_dct" type="button" onclick="location.href='<?php echo base_url();?>Home/RegisterDoctor'" data-toggle="modal">REGISTER AS DOCTOR / CLINIC</button>
<button class="ip_sign_footer_btn" id="reg_choose_pat" data-toggle="modal">REGISTER AS PAITENT</button> <button class="ip_sign_footer_btn" id="reg_choose_pat" data-toggle="modal">REGISTER AS PAITENT</button>
</div> </div>
</div> </div>
...@@ -217,6 +260,7 @@ We send the information to<br>password recovery </p> ...@@ -217,6 +260,7 @@ We send the information to<br>password recovery </p>
</div> </div>
</div> </div>
<!--DOCTOR REGISTRATION MODEL ENDS--> <!--DOCTOR REGISTRATION MODEL ENDS-->
<!--PATIENT REGISTRATION MODEL BEGINS--> <!--PATIENT REGISTRATION MODEL BEGINS-->
...@@ -257,7 +301,9 @@ We send the information to<br>password recovery </p> ...@@ -257,7 +301,9 @@ We send the information to<br>password recovery </p>
<p class="textCenter">I would like to register your clinic or office, <a>click here</a></p> <p class="textCenter">I would like to register your clinic or office, <a>click here</a></p>
<div class="ip_reg_with_fb"> <div class="ip_reg_with_fb">
<div class="ip_logo_fb floatLeft"></div> <div class="ip_logo_fb floatLeft"></div>
<div class="ip_content_fb floatRight">ENTER WITH FACEBOOK</div>
<div class="ip_content_fb floatRight" onclick="location.href='<?php if(!empty($FBauthUrl)) echo $FBauthUrl ?>'">ENTER WITH FACEBOOK</div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<p class="textCenter">By creating my account I agree to the <a>TERMS AND CONDITIONS.</a></p> <p class="textCenter">By creating my account I agree to the <a>TERMS AND CONDITIONS.</a></p>
...@@ -267,7 +313,7 @@ We send the information to<br>password recovery </p> ...@@ -267,7 +313,7 @@ We send the information to<br>password recovery </p>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="ip_bank_detail_frame"> <div class="ip_bank_detail_frame">
<input name="reg_pat_email" maxlength="100" type="text" data-parsley-required="true" data-parsley-username="" class="ip_reg_form_input form-control reset-form-custom" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" placeholder="E-mail" id="reg-form-email" > <input name="reg_pat_email" maxlength="100" type="text" data-parsley-required="true" data-parsley-email="" class="ip_reg_form_input form-control reset-form-custom" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" placeholder="E-mail" id="reg-form-email" >
</div> </div>
...@@ -302,19 +348,19 @@ We send the information to<br>password recovery </p> ...@@ -302,19 +348,19 @@ We send the information to<br>password recovery </p>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<p>Gender</p> <p>Gender</p>
<div class="ip_day_time_schedule_details_data p0 floatLeft ip_gender_check"> <div class="ip_day_time_schedule_details_data p0 ip_gender_check">
<input id="checkbox-31" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" required data-parsley-error-message="Choose Gender" value="MALE"> <div>
<label for="checkbox-31" class="ip_custom_checkbox_label1 ip_gender_check_label">Male</label> <input id="reg-form-patient-male" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" required data-parsley-error-message="Choose Gender" value="MALE">
</div> <label for="reg-form-patient-male" class="ip_custom_checkbox_label1 ip_gender_check_label">Male</label>
<div class="ip_day_time_schedule_details_data p0 floatLeft ip_gender_check">
<input id="checkbox-32" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" value="FEMALE"> <input id="reg-form-patient-female" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" value="FEMALE">
<label for="checkbox-32" class="ip_custom_checkbox_label1 ip_gender_check_label">Female</label> <label for="reg-form-patient-female" class="ip_custom_checkbox_label1 ip_gender_check_label">Female</label>
<input id="reg-form-patient-others" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" value="OTHERS">
<label for="reg-form-patient-others" class="ip_custom_checkbox_label1 ip_gender_check_label">Others</label>
<div class="clear"></div>
</div> </div>
<div class="ip_day_time_schedule_details_data p0 floatLeft ip_gender_check">
<input id="checkbox-33" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="reg_pat_gender" type="radio" value="OTHERS">
<label for="checkbox-33" class="ip_custom_checkbox_label1 ip_gender_check_label">Others</label>
</div> </div>
<div class="clear"></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -371,7 +417,7 @@ We send the information to<br>password recovery </p> ...@@ -371,7 +417,7 @@ We send the information to<br>password recovery </p>
</div> </div>
<hr> <hr>
<div class="ip_reg_modal_footer"> <div class="ip_reg_modal_footer">
<button class="ip_sign_footer_btn btn btn-primary nextBtn nextBtn-2" type="button">Next</button> <button class="ip_sign_footer_btn btn btn-primary nextBtn floatRight nextBtn-2" type="button">Next</button>
<button class="ip_sign_footer_btn btn btn-primary prevBtn floatLeft prevBtn-2" type="button">Previous</button> <button class="ip_sign_footer_btn btn btn-primary prevBtn floatLeft prevBtn-2" type="button">Previous</button>
</div> </div>
</div> </div>
...@@ -426,7 +472,7 @@ We send the information to<br>password recovery </p> ...@@ -426,7 +472,7 @@ We send the information to<br>password recovery </p>
</div> </div>
<hr> <hr>
<div class="ip_reg_modal_footer"> <div class="ip_reg_modal_footer">
<button class="ip_sign_footer_btn btn btn-primary nextBtn nextBtn-3" type="button">Next</button> <button class="ip_sign_footer_btn btn btn-primary nextBtn floatRight nextBtn-3" type="button">Next</button>
<button class="ip_sign_footer_btn btn btn-primary prevBtn floatLeft prevBtn-3" type="button">Previous</button> <button class="ip_sign_footer_btn btn btn-primary prevBtn floatLeft prevBtn-3" type="button">Previous</button>
</div> </div>
</div> </div>
...@@ -443,7 +489,7 @@ We send the information to<br>password recovery </p> ...@@ -443,7 +489,7 @@ We send the information to<br>password recovery </p>
<div class="col-md-12"> <div class="col-md-12">
<p>Name</p> <p>Name</p>
<div class="ip_bank_detail_frame"> <div class="ip_bank_detail_frame">
<input data-parsley-required name="reg_pat_name" maxlength="100" type="text" class="ip_reg_form_input reset-form-custom" > <input data-parsley-required id="reg-form-patient-name" name="reg_pat_name" maxlength="100" type="text" class="ip_reg_form_input reset-form-custom" >
</div> </div>
</div> </div>
</div> </div>
...@@ -453,7 +499,7 @@ We send the information to<br>password recovery </p> ...@@ -453,7 +499,7 @@ We send the information to<br>password recovery </p>
<div class="col-md-6"> <div class="col-md-6">
<p>User</p> <p>User</p>
<div class="ip_bank_detail_frame"> <div class="ip_bank_detail_frame">
<input data-parsley-required name="reg_pat_username" maxlength="100" type="text" class="ip_reg_form_input reset-form-custom" placeholder=""> <input data-parsley-required data-parsley-username="" name="reg_pat_username" maxlength="100" type="text" class="ip_reg_form_input reset-form-custom" placeholder="">
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
...@@ -474,9 +520,22 @@ We send the information to<br>password recovery </p> ...@@ -474,9 +520,22 @@ We send the information to<br>password recovery </p>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<p>Add Photo to profile</p> <p>Add Photo to profile</p>
<div class="ip_reg_add_phot_div">
<button class="ip_add_photo_doc">Add Photo
<input id="reg_pat_pic" data-parsley-required name="reg_pat_profilepic" type="file" class="ip_reg_form_input reset-form-custom "
data-parsley-error-message="Choose Profile Photo" onchange="pat_loadthumbnail(this)" placeholder="" >
</button>
<div class="ip_reg_modal_addphoto"> <div class="ip_reg_modal_addphoto">
<input id="reg_pat_pic" data-parsley-required name="reg_pat_profilepic" type="file" class="ip_reg_form_input reset-form-custom" placeholder=""> <img src="" id="reg-pat-temppic">
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -494,30 +553,65 @@ We send the information to<br>password recovery </p> ...@@ -494,30 +553,65 @@ We send the information to<br>password recovery </p>
</div> </div>
</div> </div>
<?php
if($this->session->flashdata('message')) {
$message = $this->session->flashdata('message');
?>
<div class="alert alert-<?php echo $message['class']; ?> alert-dismissible flash-msg">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><strong> <?php echo $message['title']; ?></strong></h4>
<?php echo $message['message']; ?>
</div>
<?php
}
?>
<div class="alert alert-success hidden" id="pat-reg-success">
<strong>Success!</strong> Account Registred,Kindly Login.
</div>
<div class="alert alert-danger hidden" id="pat-reg-error">
<strong>Error!</strong> Account Registration Failed,Try Again.
</div>
<!--PATIENT REGISTRATION MODEL ENDS--> <!--PATIENT REGISTRATION MODEL ENDS-->
<div class="ip_home_banner"> <div class="ip_home_banner">
<div class="ip_home_banner_inner"> <div class="ip_home_banner_inner">
<div class="container"> <div class="container">
<h3>We promise practicality</h3> <h3>We promise practicality</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p> <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, </p>
<form role="form" id="doctor-search-form" action="<?php echo base_url()?>Searchdoctor" method="post" >
<div class="ip_search_home_div"> <div class="ip_search_home_div">
<div class="ip_speciality"> <div class="ip_speciality">
<input class="ip_speciality_input" placeholder="Speciality"> <!-- <input class="ip_speciality_input" name="doctor-search-speciality" placeholder="Speciality"> -->
<select class="ip_speciality_input" placeholder="" name="doctor-search-speciality">
<option disabled selected>Speciality</option>
<?php foreach ($speciality_list as $key => $value) {
?>
<option value="<?php echo $value['specialization_name']?>"><?php echo $value['specialization_name']?></option>
<?php
}
?>
</select>
</div> </div>
<div class="ip_location_home_search"> <div class="ip_location_home_search">
<input class="ip_speciality_input" placeholder="Location"> <input class="ip_speciality_input" name="doctor-search-location" id="doctor_search_location" placeholder="Location">
<input type="hidden" id="locationLattitude" name="doctor-search-latitude">
<input type="hidden" id="locationLongitude" name="doctor-search-longitude">
</div> </div>
<div class="ip_search_home_search_btn"> <div class="ip_search_home_search_btn">
</div> </div>
<div class="ip_home_search_menu"> <div class="ip_home_search_menu">
<div class="ip_home_search_menu_inner"></div> <div class="ip_home_search_menu_inner"></div>
</div> </div>
<div class="ip_home_search_data"> <div class="ip_home_search_data" id="sandbox-container">
<input class="ip_speciality_input" placeholder="Data"> <input class="ip_speciality_input" name="doctor-search-date" placeholder="Date">
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</form>
</div> </div>
</div> </div>
<img src="<?php echo base_url();?>assets/images/ip_banner.jpg"> <img src="<?php echo base_url();?>assets/images/ip_banner.jpg">
...@@ -728,9 +822,9 @@ We send the information to<br>password recovery </p> ...@@ -728,9 +822,9 @@ We send the information to<br>password recovery </p>
</div> </div>
</div> </div>
</footer> </footer>
<!-- <!--
<script>
// Get a handle to the player // Get a handle to the player
player = document.getElementById('ip_video-element'); player = document.getElementById('ip_video-element');
...@@ -882,8 +976,7 @@ We send the information to<br>password recovery </p> ...@@ -882,8 +976,7 @@ We send the information to<br>password recovery </p>
alert("Fullscreen API is not supported"); alert("Fullscreen API is not supported");
} }
} --> }
</script> </script>-->
<script>
</script>
<?php
if($this->session->userdata('FBData'))
{
$FBData = $this->session->userdata('FBData');
?>
<script>
var temp = '<?php echo $FBLoginStatus?>';
if(temp=='success')
{
$('#regpaitent').modal("show");
var fb_email = "<?php if(isset($FBData)) echo $FBData['email']?>" ;//setting email id
$('#reg-form-email').val(fb_email);
var fb_gender = '<?php if(isset($FBData)) echo $FBData['gender']?>'; //setting gender
if(fb_gender=="female"){$('#reg-form-patient-female').prop('checked', true);}
else if(fb_gender=="male"){$('#reg-form-patient-male').prop('checked', true);}
else {$('#reg-form-patient-others').prop('checked', true);}
var fb_name = "<?php if(isset($FBData)) echo $FBData['first_name']?>" ;//setting name
$('#reg-form-patient-name').val(fb_name);
<?php
$img = 'assets/fb_profilepic/'.$FBData['oauth_uid'].'.jpg';
$imagedata = file_get_contents($FBData['picture_url']);
file_put_contents($img, $imagedata);
?>
$("#add_photo_pat,#reg-doc-temppic").remove();
$(".ip_reg_modal_addphoto").append("<input id='reg_pat_pic' name='reg_pat_profilepic' type='hidden' class='ip_reg_form_input reset-form-custom from-facebook' value='<?php echo $img; ?>'>");
$(".ip_reg_modal_addphoto").append("<img src='<?php echo base_url().$img; ?>'>");
}
</script>
<?php
}
?>
<div class="ip_set_two_wrapper">
<div class="container ip_custom_container">
<div class="ip_bio_tab_div">
<div class="row m0">
<div class="col-md-2 p0 height100">
<div class="ip_bio_tab_bay height100">
<ul>
<li class="active" data-toggle="tab" href="#profile">Profile</li>
<li data-toggle="tab" href="#bio">Address</li>
<li data-toggle="tab" href="#photo">Photos</li>
<li class="arrow" data-toggle="tab" href="#special">Support</li>
<li data-toggle="tab" href="#more" class="arrow">More</li>
</ul>
</div>
</div>
<div class="col-md-10 p0">
<div class="ip_bio_tab_content">
<div class="tab-content">
<div id="profile" class="tab-pane fade in active">
<div class="ip_profile_tab_top">
<div class="ip_profile_tab_circle">
<img src="<?php echo base_url();echo $patient_data['pt_pic']?>">
</div>
<div class="ip_profile_tab_name">
<h3><?php echo $patient_data['pt_name']?></h3>
</div>
<div class="ip_profile_tab_button">
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_edit.png"></div>
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_delete.png"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="ip_profile_tab_detail">
<div class="row">
<div class="col-md-6">
<ul>
<li>
<div class="child1">Email :</div>
<div class="child2"><?php echo $patient_data['pt_email']?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Phone :</div>
<div class="child2"><?php echo $patient_data['pt_number']?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">BloodGroup :</div>
<div class="child2"><?php echo $patient_data['pt_blood_group']?></div>
<div class="clear"></div>
</li>
</ul>
</div>
<div class="col-md-6">
<ul>
<li>
<div class="child1">Birthday :</div>
<div class="child2"><?php echo date('d F Y',$patient_data['pt_dob']);?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Weight :</div>
<div class="child2"><?php echo $patient_data['pt_weight']?>Kg</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Height :</div>
<div class="child2"><?php echo $patient_data['pt_height']?>cm</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="bio" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>Address</h3>
<p><?php echo $patient_data['pt_street_add']?></p>
<p><?php echo $patient_data['pt_locality']?></p>
<p><?php echo $patient_data['pt_zip_code']?></p>
</div>
</div>
<div id="special" class="tab-pane fade">
<div class="ip_profile_tab_detail p0">
<div class="ip_profile_tab_top p0">
<div class="ip_profile_contato">
<h5><strong>What is the reason for your contact?</strong></h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<div class="clear"></div>
<div class="row">
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-11" class="ip_custom_checkbox1" name="checkbox-11" type="checkbox" checked="">
<label for="checkbox-11" class="ip_custom_checkbox_label1">Problems Attendent</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-12" class="ip_custom_checkbox1" name="checkbox-12" type="checkbox" checked="">
<label for="checkbox-12" class="ip_custom_checkbox_label1">Difficulty to schedule</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-13" class="ip_custom_checkbox1" name="checkbox-13" type="checkbox" checked="">
<label for="checkbox-13" class="ip_custom_checkbox_label1">Problems with payment</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-13" class="ip_custom_checkbox1" name="checkbox-13" type="checkbox" checked="">
<label for="checkbox-13" class="ip_custom_checkbox_label1">Others</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div>
<div class="ip_edit_record_detail">
<div class="ip_edit_text_bay">
<div class="ip_edit_record_text">
<ul>
<li><img src="<?php echo base_url();?>assets/images/ip_edit1.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit2.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit3.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit4.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit5.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit6.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit7.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit8.png"></li>
<div class="clear"></div>
</ul>
</div>
<textarea class="ip_edit_record_content_textarea" rows="4"></textarea>
</div>
<div class="ip_edit_bottom_btn_bay">
<button class="ip_edit_save_btn floatRight">SEND</button>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
<div id="photo" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>Photos</h3>
</div>
</div>
<div id="more" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3 data-toggle="modal" data-target="#pop1">popup1</h3>
<h3 data-toggle="modal" data-target="#pop2">popup2</h3>
<h3 data-toggle="modal" data-target="#pop3">popup3</h3>
<h3 data-toggle="modal" data-target="#pop4">popup4</h3>
<h3 data-toggle="modal" data-target="#pop5">popup5</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_grid_cols">
<div class="row">
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Notification
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_notification_list">
<ul>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Messages
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_message_list">
<ul>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
promotions
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail textCenter">
<div class="ip_bio_message_list">
<ul>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_record_main_div">
<div class="ip_bio_head">
Consultation
<div class="ip_record_btn_group floatRight">
<div class="btn-group ip_custom_tabs_menu">
<button type="button" class="btn ip_apppointment_btn_custom current"><a href="#tab-1">CONSULTATION</a></button>
<button type="button" class="btn ip_apppointment_btn_custom"><a href="#tab-2">SCHEDULED CONSULTATION</a></button>
</div>
</div>
<div class="clear"></div>
</div>
<div class="ip_custom_tab">
<div id="tab-1" class="ip_custom_tab_content">
<ul>
<?php
if(!empty($completed_consultation))
{
foreach ($completed_consultation as $key => $element)
{
?>
<li>
<div class="row m0 height100">
<div class="col-md-2 p0 height100"><div class="ip_record_main_head_data"><strong>Consultation: </strong><?php echo date('d M Y',$element['book_date']);?></div></div>
<div class="col-md-2 p0 height100"><div class="ip_record_main_head_data"><?php echo $element['book_time']?></div></div>
<div class="col-md-3 p0 height100"><div class="ip_record_main_head_data">Dr.<?php echo $element['doc_name']?></div></div>
<div class="col-md-2 p0 height100">
<div class="ip_record_main_head_data">
<form id="ip_user_rating_form">
<div id="ip_selected_rating" class="ip_selected_rating floatLeft">5.0</div>
<span class="ip_user_rating floatLeft">
<input type="radio" name="rating" value="5.0"><span class="star"></span>
<input type="radio" name="rating" value="4.0"><span class="star"></span>
<input type="radio" name="rating" value="3.0"><span class="star"></span>
<input type="radio" name="rating" value="2.0"><span class="star"></span>
<input type="radio" name="rating" value="1.0"><span class="star"></span>
</span>
<div class="clear"></div>
</form>
</div>
</div>
<div class="col-md-3 p0 height100"><div class="ip_record_main_head_data"><button class="ip_reader_btn">OPEN MEDICAL RECORDS</button></div></div>
</div>
</li>
<?php
}
}
else
{
?>
<li>
<div class="row m0 height100">
<div class="col-md-12 p0 height100"><div class="ip_record_main_head_data">NO CONSULTATIONS</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
<div id="tab-2" class="ip_custom_tab_content">
<ul id="confirmed-schedules-div">
<?php $this->load->view('patient_dash_scheduled_booking'); ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- SET-FOUR-SCREEN-SEVEN -->
<div id="pop1" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="ip_custom_modal">
<div class="ip_custom_modal_head">
<button type="button" class="close" data-dismiss="modal">&times;</button>
Rescheduling
</div>
<div class="ip_custom_modal_content">
<div class="ip_main_tab_content">
<div class="ip_main_tab_pic">
</div>
<h5><strong>Ann Alexander</strong></h5>
<p>Cardiologist</p>
<div class="ip_profile_ratting">
<fieldset class="ip_rating">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
</fieldset>
<div class="clear"></div>
</div>
<h4>14th december 2017</h4>
<h6>16:00 hours</h6>
<div class="ip_profile_datetime">
<input class="ip_calender floatLeft" placeholder="" id="ip_datepicker">
<input class="ip_time floatRight" placeholder="" id="ip_timepicker">
<div class="clear"></div>
</div>
</div>
<div class="ip_custom_modal_btn_bay">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<button class="ip_custom_modal_btm_btn1">SCHE: APPOINTMENT</button>
</div>
<div class="col-md-2">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- SET-FOUR-SCREEN-EIGHT -->
<div id="pop2" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="ip_custom_modal">
<div class="ip_custom_modal_head">
<button type="button" class="close" data-dismiss="modal">&times;</button>
Cancellation
</div>
<div class="ip_custom_modal_content">
<div class="ip_main_tab_content">
<div class="ip_main_tab_pic">
<img id="cancel-consult-modal-pic" src="">
</div>
<h5 ><strong id="cancel-consult-modal-name"></strong></h5>
<p id="cancel-consult-modal-spec"></p>
<h4 id="cancel-consult-modal-date" ></h4>
<h6 id="cancel-consult-modal-time"></h6>
</div>
</div>
<hr>
<div class="ip_custom_modal_btn_bay">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's scimen book
</p>
<div class="row">
<div class="col-md-8">
<button id="cancel-consult-modal-btn" class="ip_custom_modal_btm_btn2">CANCEL CONSULTATION</button>
</div>
<div class="col-md-4">
<button class="ip_custom_modal_btm_btn3" type="button" data-dismiss="modal">BACK</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- SET-FOUR-SCREEN-NINE -->
<div id="pop3" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- SET-FOUT-SCREEN-ELEVEN -->
<div id="pop4" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="ip_custom_modal_wrapper">
<div class="ip_custom_modal_head1">
Consultation Advisory
</div>
<div class="ip_custom_modal_outter">
<div class="ip_custom_modal">
<div class="ip_custom_modal_head">
<button type="button" class="close" data-dismiss="modal">&times;</button>
Rescheduling
</div>
<div class="ip_custom_modal_content">
<div class="ip_main_tab_content">
<div class="ip_main_tab_pic">
<img id="reschedule-consult-pic">
</div>
<h5><strong id="reschedule-consult-name"></strong></h5>
<p id="reschedule-consult-spec"></p>
<div class="ip_profile_ratting">
<fieldset class="ip_rating">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
</fieldset>
<div class="clear"></div>
</div>
<h4 id="reschedule-consult-date"></h4>
<h6 id="reschedule-consult-time"></h6>
<div class="ip_profile_datetime">
<form role="form" id="reschedule_book_form" data-parsley-validate="">
<input type="hidden" name="reschedule-book-id" id="reschedule_book_id" >
<input type="hidden" name="confirm-book-clinic" id="reschedule_book_clinic" >
<input type="hidden" name="confirm-book-doctor" id="reschedule_book_doctor" >
<div id="sandbox-container"><input class="ip_calender floatLeft reschedule_book_date_cus" placeholder="" data-parsley-required="" name="confirm-book-date" id="reschedule_book_date">
</div>
<!-- <input class="ip_time floatRight" placeholder="" id="ip_timepicker"> -->
<select id="reschedule-consult-timeslot" data-parsley-required="" name="confirm-book-time" class="ip_time floatRight">
<option disabled selected>Time</option>
</select>
<div class="clear"></div>
</div>
</form>
</div>
<div class="ip_custom_modal_btn_bay">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<button id="reschedule-consult-btn" type="button" class="ip_custom_modal_btm_btn1">SCHE:APPOINTMENT</button>
</div>
<div class="col-md-2">
</div>
</div>
</div>
<div id="err_reschedule_booking" class="alert alert-danger ip_profile_reschedule_error hidden">DOCCTOE SNOR ASIAIJNCSMSS</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- SET-FIVE-SCREEN-FIVE -->
<div id="pop5" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="ip_custom_modal">
<div class="ip_custom_modal_head">
<button type="button" class="close" data-dismiss="modal">&times;</button>
Delay
</div>
<div class="ip_custom_modal_content">
<div class="ip_main_tab_content">
<p>Notify me if delayed</p>
<div class="ip_notify_time">
<li>
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-41" class="ip_custom_checkbox1" name="checkbox-41" type="checkbox" checked="">
<label for="checkbox-41" class="ip_custom_checkbox_label1">15 minutes</label>
<div class="clear"></div>
</div>
</li>
<li>
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-42" class="ip_custom_checkbox1" name="checkbox-42" type="checkbox" checked="">
<label for="checkbox-42" class="ip_custom_checkbox_label1">30 minutes</label>
<div class="clear"></div>
</div>
</li>
<li>
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-43" class="ip_custom_checkbox1" name="checkbox-43" type="checkbox" checked="">
<label for="checkbox-43" class="ip_custom_checkbox_label1">01 hour</label>
<div class="clear"></div>
</div>
</li>
<li>
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-44" class="ip_custom_checkbox1" name="checkbox-44" type="checkbox" checked="">
<label for="checkbox-44" class="ip_custom_checkbox_label1">01 hr 30 min</label>
<div class="clear"></div>
</div>
</li>
<div class="clearfix"></div>
</div>
</div>
</div>
<hr>
<div class="ip_custom_modal_btn_bay">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's scimen book
</p>
<div class="row">
<div class="col-md-8">
<button class="ip_custom_modal_btm_btn2">NOTIFY</button>
</div>
<div class="col-md-4">
<button class="ip_custom_modal_btm_btn3">BACK</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_set_two_wrapper">
<div class="container ip_custom_container">
<div class="ip_bio_tab_div">
<div class="row m0">
<div class="col-md-2 p0 height100">
<div class="ip_bio_tab_bay height100">
<ul>
<li class="active" data-toggle="tab" href="#profile">Profile</li>
<li data-toggle="tab" href="#bio">Address</li>
<li data-toggle="tab" href="#photo">Photos</li>
<li class="arrow" data-toggle="tab" href="#special">Support</li>
<li data-toggle="tab" href="#more" class="arrow">More</li>
</ul>
</div>
</div>
<div class="col-md-10 p0">
<div class="ip_bio_tab_content">
<div class="tab-content">
<div id="profile" class="tab-pane fade in active">
<div class="ip_profile_tab_detail p0">
<div class="ip_profile_tab_top">
<div class="ip_profile_tab_circle">
<img src="<?php echo base_url();echo $patient_data['pt_pic']?>">
</div>
<div class="ip_profile_tab_name">
<h3><?php echo $patient_data['pt_name']?></h3>
</div>
<div class="ip_profile_tab_button">
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_edit.png"></div>
<div class="ip_profile_tab_button_circle"><img src="<?php echo base_url();?>assets/images/ip_delete.png"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="row">
<div class="col-md-6">
<ul>
<li>
<div class="child1">Email :</div>
<div class="child2"><?php echo $patient_data['pt_email']?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Phone :</div>
<div class="child2"><?php echo $patient_data['pt_number']?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">BloodGroup :</div>
<div class="child2"><?php echo $patient_data['pt_blood_group']?></div>
<div class="clear"></div>
</li>
</ul>
</div>
<div class="col-md-6">
<ul>
<li>
<div class="child1">Birthday :</div>
<div class="child2"><?php echo date('d F Y',$patient_data['pt_dob']);?></div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Weight :</div>
<div class="child2"><?php echo $patient_data['pt_weight']?>Kg</div>
<div class="clear"></div>
</li>
<li>
<div class="child1">Height :</div>
<div class="child2"><?php echo $patient_data['pt_height']?>cm</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="bio" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>Address</h3>
<p><?php echo $patient_data['pt_street_add']?></p>
<p><?php echo $patient_data['pt_locality']?></p>
<p><?php echo $patient_data['pt_zip_code']?></p>
</div>
</div>
<div id="special" class="tab-pane fade">
<div class="ip_profile_tab_detail p0">
<div class="ip_profile_tab_top p0">
<div class="ip_profile_contato">
<h5><strong>What is the reason for your contact?</strong></h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<div class="clear"></div>
<div class="row">
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-11" class="ip_custom_checkbox1" name="checkbox-11" type="checkbox" checked="">
<label for="checkbox-11" class="ip_custom_checkbox_label1">Problems Attendent</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-12" class="ip_custom_checkbox1" name="checkbox-12" type="checkbox" checked="">
<label for="checkbox-12" class="ip_custom_checkbox_label1">Difficulty to schedule</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-13" class="ip_custom_checkbox1" name="checkbox-13" type="checkbox" checked="">
<label for="checkbox-13" class="ip_custom_checkbox_label1">Problems with payment</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="ip_day_time_schedule_details_data p0">
<input id="checkbox-13" class="ip_custom_checkbox1" name="checkbox-13" type="checkbox" checked="">
<label for="checkbox-13" class="ip_custom_checkbox_label1">Others</label>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div>
<div class="ip_edit_record_detail">
<div class="ip_edit_text_bay">
<div class="ip_edit_record_text">
<ul>
<li><img src="<?php echo base_url();?>assets/images/ip_edit1.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit2.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit3.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit4.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit5.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit6.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit7.png"></li>
<li><img src="<?php echo base_url();?>assets/images/ip_edit8.png"></li>
<div class="clear"></div>
</ul>
</div>
<textarea class="ip_edit_record_content_textarea" rows="4"></textarea>
</div>
<div class="ip_edit_bottom_btn_bay">
<button class="ip_edit_save_btn floatRight">SEND</button>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
<div id="photo" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>Photos</h3>
</div>
</div>
<div id="more" class="tab-pane fade">
<div class="ip_profile_tab_detail">
<h3>More</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ip_grid_cols">
<div class="row">
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Notification
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_notification_list">
<ul>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
<li>
<h5>Nyla Augusta
<div class="ip_notification_time">12:56</div>
</h5>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
Messages
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail">
<div class="ip_bio_message_list">
<ul>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_message_pic">
</div>
<div class="ip_bio_messages">
<h5>Nyla Augusta</h5><div class="ip_message_time">12:56</div>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="ip_bio_tab_div">
<div class="ip_bio_head">
promotions
<div class="ip_bio_more">
</div>
</div>
<div class="ip_bio_detail textCenter">
<div class="ip_bio_message_list">
<ul>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
<li>
<div class="ip_bio_messages width100">
<div class="ip_promo_image">
</div>
<h5>Nyla Augusta</h5>
<div class="clear"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been</p>
</div>
<div class="clear"></div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="ip_full_calender_div">
<div class="ip_full_calender_head">
<div class="ip_full_calender_nav">
<div class="btn-group">
<button type="button" class="btn"><img src="<?php echo base_url();?>assets/images/ip_arw_left.png"></button>
<button type="button" class="btn"><img src="<?php echo base_url();?>assets/images/ip_arw_right.png"></button>
</div>
<div class="btn-group">
<button type="button" class="btn ip_apppointment_btn_custom"><a>SEPTEMBER</a></button>
</div>
</div>
<h3>Appointment of Dr. Jinu Samuel</h3>
</div>
<div class="ip_full_calender_content">
<div class="ip_table_head">
<ul>
<li class="time_slot"></li>
<li>MON, 3</li>
<li>TUES, 4</li>
<li>WED, 5</li>
<li>THUR, 6</li>
<li>FRI, 7</li>
<li>SAT, 8</li>
<li class="borderrightnone">SUN, 9</li>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_head_divide">
<ul>
<li class="time_slot"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="borderrightnone"></li>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_days">
<ul>
<li class="time_slot">
<div class="ip_time_interval">
<ul>
<li><p>13:00</p></li>
<li><p>14:00</p></li>
<li><p>15:00</p></li>
<li><p>16:00</p></li>
<li><p>17:00</p></li>
<li><p>18:00</p></li>
<li><p>19:00</p></li>
<li><p>20:00</p></li>
<li><p>21:00</p></li>
<li><p>22:00</p></li>
<li><p>23:00</p></li>
<li><p>00:00</p></li>
<li><p>01:00</p></li>
<li><p>02:00</p></li>
<li><p>03:00</p></li>
<li><p>04:00</p></li>
<li><p>05:00</p></li>
<li><p>06:00</p></li>
<li><p>07:00</p></li>
<li><p>08:00</p></li>
<li><p>09:00</p></li>
<li><p>10:00</p></li>
<li><p>11:00</p></li>
<li><p>12:00</p></li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_not_avialable">
Not Available
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li>
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability ip_avialable">
Avialable
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<li class="borderrightnone">
<div class="ip_time_avialability">
<ul>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
<li>
<div class="ip_avialability">
</div>
</li>
</ul>
</div>
</li>
<div class="clear"></div>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
if(!empty($confirmed_consultation))
{
foreach ($confirmed_consultation as $key => $element)
{
?>
<li>
<div class="row m0 height100">
<div class="col-md-2 p0 height100"><div class="ip_record_main_head_data"><strong>Consultation: </strong><?php echo date('d M Y',$element['book_date']);?></div></div>
<div class="col-md-2 p0 height100"><div class="ip_record_main_head_data"><?php echo $element['book_time']?></div></div>
<div class="col-md-2 p0 height100"><div class="ip_record_main_head_data">Dr.<?php echo $element['doc_name']?></div></div>
<div class="col-md-3 p0 height100"><div class="ip_record_main_head_data"><button class="ip_reader_btn" onclick="change_consult(<?php echo $element['book_id']?>)">CHANGE SCHEDULE</button></div></div>
<div class="col-md-3 p0 height100"><div class="ip_record_main_head_data"><button class="ip_reader_btn" bookingid="<?php echo $element['book_id']?>" onclick="cancel_consult(<?php echo $element['book_id']?>)"><a>CANCEL CONSULTATION</a></button></div></div>
</div>
</li>
<?php
}
}
else
{
?>
<li>
<div class="row m0 height100">
<div class="col-md-12 p0 height100"><div class="ip_record_main_head_data">NO SCHEDULED CONSULTATIONS</div></div>
</div>
</li>
<?php
}
?>
\ No newline at end of file
<style>
.ip_reg_modal_addphoto img{width:100%;height:100%;object-fit:cover;object-position:center;border-radius:50%;}
</style>
<div class="ip_set_two_wrapper">
<div class="container ip_custom_container">
<div class="ip_edit_record_wrapper">
<div class="ip_edit_record_cover">
<form role="form" data-parsley-validate="" id="reg-form-doctor" method="POST" action="<?php echo base_url();?>Home/doRegister" enctype="multipart/form-data">
<div class="ip_edit_record_head backgroundnone">
Create a Medical Account
</div>
<div class="ip_edit_record_detail">
<div class="row">
<div class="col-md-7">
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="name" data-parsley-required="true" placeholder="Name">
</div>
</div>
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" data-parsley-emaildoc="" name="email" data-parsley-required="true"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"placeholder="Email">
</div>
</div>
<div class="ip_edit_row">
<div class="row">
<div class="col-md-6">
<p class="ip_row_p">RG</p>
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="rg" placeholder="">
</div>
</div>
<div class="col-md-6">
<p class="ip_row_p">CPF</p>
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="cpf" placeholder="">
</div>
</div>
</div>
</div>
<div class="ip_edit_row">
<div class="row">
<div class="col-md-6">
<p class="ip_row_p">CRM</p>
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="crm" placeholder="">
</div>
</div>
<div class="col-md-6">
<p class="ip_row_p">Telephone</p>
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="telephone" placeholder="">
</div>
</div>
</div>
</div>
<div class="ip_edit_row">
<div class="row">
<div class="col-md-6">
<p class="ip_row_p">UserName</p>
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="username" data-parsley-usernamedoc="" data-parsley-required="true" placeholder="">
</div>
</div>
<div class="col-md-6">
<p class="ip_row_p">Password</p>
<div class="ip_bank_detail_frame">
<input id="reg-doctor-pass" name="password" class="ip_bank_input" data-parsley-required="true" type="Password" placeholder="">
</div>
</div>
</div>
</div>
<div class="ip_edit_row">
<div class="row">
<div class="col-md-6">
<p class="ip_row_p">Confirm Password</p>
<div class="ip_bank_detail_frame">
<input data-parsley-equalto="#reg-doctor-pass" data-parsley-required type="Password" class="ip_bank_input" placeholder="">
</div>
</div>
<div class="col-md-6">
<p class="ip_row_p">Add Profile Photo</p>
<div class="ip_reg_add_phot_div">
<button id="add_photo_pat" class="ip_add_photo_doc">Add Photo
<input class="" type="file" name="profile_pic" data-parsley-error-message="Choose Profile Photo" data-parsley-required onchange="doc_loadthumbnail(this)">
</button>
<div class="ip_reg_modal_addphoto">
<img src="" id="reg-doc-temppic">
</div>
</div>
</div>
</div>
</div>
<div class="ip_edit_row">
<div class="col-md-6">
<p class="ip_row_p">Gender</p>
<div class="ip_day_time_schedule_details_data p0 ip_gender_check">
<div>
<input id="reg-form-doc-male" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="gender" type="radio" required data-parsley-error-message="Choose Gender" value="MALE">
<label for="reg-form-doc-male" class="ip_custom_checkbox_label1 ip_gender_check_label">Male</label>
<input id="reg-form-doc-female" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="gender" type="radio" value="FEMALE">
<label for="reg-form-doc-female" class="ip_custom_checkbox_label1 ip_gender_check_label">Female</label>
<input id="reg-form-doc-others" class="ip_custom_checkbox1 ip_gender_check_checkbox " name="gender" type="radio" value="OTHERS">
<label for="reg-form-doc-others" class="ip_custom_checkbox_label1 ip_gender_check_label">Others</label>
<div class="clear"></div>
</div>
</div>
</div>
<div class="col-md-6">
<p class="ip_row_p">Date of Birth</p>
<div class="ip_bank_detail_frame" id="sandbox-container">
<!-- <input class="ip_reg_form_input" type="text" form-control" placeholder=""> -->
<input name="dob" class="ip_reg_form_input form-control reset-form-custom" data-parsley-required="true">
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="cep" data-parsley-required placeholder="CEP">
</div>
</div>
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="street_address" data-parsley-required placeholder="Rua">
</div>
</div>
<div class="ip_edit_row">
<div class="row">
<div class="col-md-7">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="locality" data-parsley-required placeholder="Neighbour hood">
</div>
</div>
<div class="col-md-5">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="number" data-parsley-required placeholder="Number">
</div>
</div>
</div>
</div>
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<input class="ip_bank_input" name="complement" placeholder="Complement">
</div>
</div>
<div class="ip_edit_row">
<div class="ip_bank_detail_frame" style="height:auto;">
<textarea class="ip_bank_input" name="about" placeholder="BIOGRAPHY" data-parsley-required rows="8">
</textarea>
</div>
</div>
<div class="ip_edit_row">
<div class="ip_bank_detail_frame">
<!-- <input class="ip_bank_input" placeholder="Specialization"> -->
<select class="ip_bank_input" placeholder="" data-parsley-required name="specialization">
<option disabled selected>Speciality</option>
<?php foreach ($speciality_list as $key => $value) {
?>
<option value="<?php echo $value['id']?>"><?php echo $value['specialization_name']?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="ip_coloborator_btn_bay">
<button class="ip_colaborator_btn" type="submit">CREATE AN ACCOUNT</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container ip_custom_container" >
<div class="col-md-3">
<form id="searchfilter_form">
<div class="ip_filter_div">
<div class="dropdown ip_filter_dropdown pl15">
<div class="dropdown-toggle ip_filter_drop_toggle" data-toggle="collapse" data-target="#ip_filter">FILTROS</div>
</div>
<div id="ip_filter" class="collapse in">
<hr>
<h5 class="pl15">AVALIACOES</h5>
<div class="ip_star_rate pl15">
<label onclick="" class="ip_star_rate_toggle_btn">
<input type="radio" value="1" class="filter-change" name="filter_dr_rating"/>1</label>
<label onclick="" class="ip_star_rate_toggle_btn">
<input type="radio" value="2" class="filter-change" name="filter_dr_rating"/>2</label>
<label onclick="" class="ip_star_rate_toggle_btn">
<input type="radio" value="3" class="filter-change" name="filter_dr_rating"/>3</label>
<label onclick="" class="ip_star_rate_toggle_btn">
<input type="radio" value="4" class="filter-change" name="filter_dr_rating"/>4</label>
<label onclick="" class="ip_star_rate_toggle_btn">
<input type="radio" value="5" class="filter-change" name="filter_dr_rating"/>5</label>
</div>
<hr>
<h5 class="pl15">DISTANCIA</h5>
<div class="ip_box_drop_down pl15">
<div class="dropdown ip_dropdown">
<div class="dropdown-toggle ip_drop_toggle" type="button" data-toggle="dropdown">Centro da Cidade</div>
<ul class="dropdown-menu ip_dropdown_menu">
<li><a href="#">Dummy 1</a></li>
<li><a href="#">Dummy 2</a></li>
<li><a href="#">Dummy 3</a></li>
<li><a href="#">Dummy 4</a></li>
<li><a href="#">Dummy 5</a></li>
<li><a href="#">Dummy 6</a></li>
</ul>
</div>
</div>
<hr>
<div class="ip_distance_slider pl15">
<div id="ip_filter_distance_range"></div>
<div class="ip_filter_range_count">
<input type="text" id="ip_filter_distance_start" name="filter_dr_srch_distance_start" class="ip_distance_count floatLeft filter-change" readonly >
<input type="text" id="ip_filter_distance_end" name="filter_dr_srch_distance_end" class="ip_distance_count floatRight filter-change" readonly >
<div class="clear"></div>
</div>
</div>
<hr>
<select class="ip_box_drop_down ip_dropdown pl15 filter-change" placeholder="" name="doctor-search-speciality" id="filter_dr_srch_speciality">
<option disabled selected>Speciality</option>
<?php foreach ($speciality_list as $key => $value) {
?>
<option value="<?php echo $value['specialization_name']?>"><?php echo $value['specialization_name']?></option>
<?php
}
?>
</select>
<hr>
<h5 class="pl15">LOCATION</h5>
<div class="ip_box_drop_down pl15">
<input class="ip_dropdown filter-change" type="text" placeholder="Enter Location" id="filter_dr_srch_loc" name="doctor-search-location">
<input type="hidden" id="filter_dr_srch_lat" name="doctor-search-latitude">
<input type="hidden" id="filter_dr_srch_lng" name="doctor-search-longitude">
</div>
<hr>
<h5 class="pl15">RETORNO INCLUSO</h5>
<div class="ip_return pl15">
<label onclick="" class="ip_return_option_toggle_btn">
<input type="radio" name="group3"/>SIM</label>
<label onclick="" class="ip_return_option_toggle_btn">
<input type="radio" name="group3"/>NAO</label>
</div>
<hr>
</div>
<div class="dropdown ip_filter_dropdown pl15">
<div class="dropdown-toggle ip_filter_drop_toggle" data-toggle="collapse" data-target="#ip_filter1">VER NO MAPA</div>
</div>
<div id="ip_filter2" class="collapse in">
</div>
</div>
</div>
<div class="col-md-9">
<div class="ip_result_div">
<div class="ip_result_settings_bay">
<div class="row">
<div class="col-md-3">
<div class="ip_calender_div">
<input class="ip_calender ip_datentime filter-change" id="ip_datepicker_srch" name="doctor-search-date">
</div>
<!-- <input class="ip_time ip_datentime" id="ip_timepicker"> -->
<div class="clear"></div>
</div>
<div class="col-md-9 p0">
<div class="ip_other_settings">
<p>
<?php if(!empty($searchdata['doctor-search-speciality'])){?><span>Resultado para busca por <a><?php echo $searchdata['doctor-search-speciality'];?></a></span><?php }?>
<?php if(!empty($searchdata['doctor-search-location'])){?><span> localiza em <strong><img src="<?php echo base_url();?>assets/images/ip_location.png"></strong><a><?php echo $searchdata['doctor-search-location'];?></a></span><?php }?>
</p>
</div>
</div>
</div>
</div>
<div class="ip_filter_settings">
<div class="row">
<div class="col-md-7">
<div class="ip_price_filter">
<h5>FILTRAR POR VALOR</h5>
<div id="ip_price_slider"></div>
<div class="ip_filter_price_count">
<input type="text" id="ip_filter_price_low" name="filter_dr_srch_price_low" class="ip_price_count floatLeft filter-change" readonly >
<input type="text" id="ip_filter_price_high" name="filter_dr_srch_price_high" class="ip_price_count floatRight filter-change" readonly >
<div class="clear"></div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="ip_filter_more_list">
<label onclick="" class="ip_filter_more_list_toggle_btn">
<input type="radio" class="filter-change" value="ATENDIMENTO DOMICILIAR" name="filter_dr_gender"/>ATENDIMENTO DOMICILIAR</label>
<label onclick="" class="ip_filter_more_list_toggle_btn">
<input type="radio" id="dctr-filter-male" value="MALE" class="filter-change" name="filter_dr_gender"/>HOMENS</label>
<label onclick="" class="ip_filter_more_list_toggle_btn">
<input type="radio" id="dctr-filter-female" value="FEMALE" class="filter-change" name="filter_dr_gender"/>MULHERES</label>
</div>
</div>
</div>
</div>
<div class="ip_sort_more_list">
<label onclick="" class="ip_sort_more_list_toggle_btn">
<input type="checkbox" name="group3"/>Order by</label>
</div>
<div class="ip_sort_more_list">
<label onclick="" class="ip_sort_more_list_toggle_btn">
<input type="checkbox" name="group3"/>Price</label>
</div>
<div class="ip_sort_more_list">
<label onclick="" class="ip_sort_more_list_toggle_btn">
<input type="checkbox" name="group3"/>Availabilities</label>
</div>
</form>
<div class="ip_result_listing">
<div class="ip_result_listing_loader hidden" id="search_filter_loader"></div>
<ul id="searchresult">
<?php $this->load->view('search_doctor_result'); ?>
</ul>
</div>
<!-- <div><p id="load-more">LOAD MORE</p></div> -->
</div>
</div>
</div>
\ No newline at end of file
<div class="container ip_custom_container">
<div class="row">
<div class="col-md-12">
<div class="ip_result_div">
<div class="ip_result_listing">
<div class="ip_profile_complete_detail">
<div class="ip_profile_complete_banner">
<div class="ip_profile_complete_pic">
<img src="<?php echo base_url();echo $doctor_data['dr_pic']; ?>">
</div>
<div class="ip_profile_detail">
<h2>Dr.<?php echo $doctor_data['dr_name'];?></h2>
<fieldset class="ip_rating">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
</fieldset>
</div>
<div class="clear"></div>
</div>
<div class="ip_profile_details_listing">
<li>Email:<strong><?php echo $doctor_data['dr_email'];?></strong></li>
<li>Birthday:<strong><?php echo date('d F Y',$doctor_data["dr_dob"]);?></strong></li>
<li>Site:<strong>www.annalex.com</strong></li>
<div class="clear"></div>
</div>
<hr>
<div class="ip_profile_bio">
<h6>BIOGRAFIA</h6>
<p><?php echo $doctor_data['dr_bio'];?></p>
</div>
<div class="ip_profile_others">
<div class="row">
<div class="col-md-7">
<div class="ip_detailed_map">
<div class="ip_location_map_head">
Especializações
</div>
<div class="ip_location_map_area bordernone">
<li>- <?php echo $doctor_data['dr_specialization'];?></li>
</div>
</div>
</div>
<div class="col-md-5">
<div class="ip_detailed_map">
<div class="ip_location_map_head">
Location
</div>
<div class="ip_location_map_area" data-lat="<?php echo $doctor_data['clinic_lat']?>" data-lng="<?php echo $doctor_data['clinic_lng']?>" id="doctor_location">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="ip_full_calender_div">
<div class="ip_full_calender_head">
<div class="ip_full_calender_nav">
<div class="btn-group">
<button type="button" id="complete_profile_appointment_prevbtn" class="btn"><img src="<?php echo base_url();?>assets/images/ip_arw_left.png"></button>
<button type="button" id="complete_profile_appointment_nextbtn" class="btn"><img src="<?php echo base_url();?>assets/images/ip_arw_right.png"></button>
</div>
</div>
<h3>Appointment</h3>
</div>
<div class="ip_full_calender_content" id="complete_profile_appointment">
<?php $template['doctorid'] = $doctor_data['doctorid'];
$this->load->view('search_doctor_complete_profile_appointments_week',$template); ?>
</div>
</div>
</div>
</div>
<div class="ip_agenda_btn_bay">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-8">
<div class="ip_knw_more_btn_bay">
<button class="ip_knwmore_detail_btn floatRight ip_knw_more_btn_2" type="button" onclick="location.href='<?php echo base_url()?>Searchdoctor/confirmbooking/<?php echo $doctor_data["doctorid"]?>/<?php echo $doctor_data["clinic_id"]?>'">MARCAR CONSULTA</button>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
<script >
setTimeout(function(){
initialize_map('doctor_location');
},1000)
</script>
<div class="ip_table_head">
<ul>
<li class="time_slot"></li>
<?php
if(!empty($start_day))
{
for ($i=0; $i < 7; $i++)
{
$day = date('D',strtotime('+'.$i.'day', strtotime($start_day)));
$dayno = date('d',strtotime('+'.$i.'day', strtotime($start_day)));
$date = date('Y-m-d',strtotime('+'.$i.'day', strtotime($start_day)))
?>
<li id="appoint-week-view-day<?php echo$i;?>" data-date="<?php echo$date;?>" data-docid="<?php echo $doctorid?>"><?php echo $day.','. $dayno;?></li>
<?php
}
}
else
{
for ($i=0; $i < 7; $i++)
{
$day = date('D',strtotime('+'.$i.'day'));
$dayno = date('d',strtotime('+'.$i.'day'));
$date = date('Y-m-d',strtotime('+'.$i.'day'))
?>
<li id="appoint-week-view-day<?php echo$i;?>" data-date="<?php echo$date;?>" data-docid="<?php echo $doctor_data['doctorid']?>"><?php echo $day.','. $dayno;?></li>
<?php
}
}
?>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_head_divide">
<ul>
<li class="time_slot"></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li class="borderrightnone"></li>
<div class="clear"></div>
</ul>
</div>
<div class="ip_table_days">
<ul>
<li class="time_slot">
<div class="ip_time_interval">
<ul>
<?php for ($i=1; $i <=24 ; $i++) {
?>
<li><p><?php echo $i;?>:00</p></li>
<?php
}?>
</ul>
</div>
</li>
<?php foreach ($week_appointments as $key => $value)
{
?>
<li>
<div class="ip_time_avialability">
<ul>
<?php for ($i=0; $i <24 ; $i++) { ?>
<li>
<div class="ip_avialability ">
<?php
foreach ($value as $key_inner => $value_inner)
{
if($value_inner['hour']==$i)
{
?>
<div class="ip_avialable">
<?php echo$value_inner['count'];?> Appointments
</div>
<?php
}
}
?>
</div>
</li>
<?php
}
?>
</ul>
</div>
</li>
<?php
}
?>
<div class="clear"></div>
</ul>
</div>
<div class="container ip_custom_container">
<div class="ip_main_tabs_div">
<div class="ip_main_tab_head">
<ul>
<li class="active confirm-tab-1" >REVIEW INFORMATION</li>
<li class="confirm-tab-2" >LOGIN</li>
<li class="confirm-tab-3" >PAYMENT</li>
<li class="confirm-tab-4" >CONFIRMATION</li>
</ul>
<div class="clear"></div>
<button class="hidden" id="btnTrigger-review" data-toggle="tab" href="#review">
<button class="hidden" id="btnTrigger-login" data-toggle="tab" href="#login">
<button class="hidden" id="btnTrigger-payment" data-toggle="tab" href="#payment">
<button class="hidden" id="btnTrigger-confirmation" data-toggle="tab" href="#confirmation">
</div>
<div class="ip_main_tab_content">
<div class="tab-content">
<div id="review" class="tab-pane fade in active">
<div class="ip_main_tab_pic">
<img src="<?php echo base_url();echo $doctor_data['dr_pic']?>">
</div>
<h5><strong><?php echo $doctor_data['dr_name']?></strong></h5>
<p><?php echo $doctor_data['dr_specialization']?></p>
<p><?php echo $doctor_data['clinic_name']?>,<?php echo $doctor_data['clinic_street_address']?>,<?php echo $doctor_data['clinic_locality']?>-<?php echo $doctor_data['clinic_cep']?></p>
<div class="ip_profile_ratting">
<fieldset class="ip_rating">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
</fieldset>
<div class="clear"></div>
</div>
<!-- <h4>14th december 2017</h4>
<h6>16:00 hours</h6> -->
<form role="form" id="confirm_book_form" data-parsley-validate="">
<input type="hidden" name="confirm-book-clinic" id="confirm_book_clinic" value="<?php echo $doctor_data['clinic_id']?>">
<input type="hidden" name="confirm-book-doctor" id="confirm_book_doctor" value="<?php echo $doctor_data['doctorid']?>">
<div class="ip_profile_datetime ip_booking_date" >
<div id="sandbox-container"><input type="text" class="ip_calender floatLeft" data-parsley-required="" placeholder="" id="confirm_book_date" name="confirm-book-date" ></div>
<!-- <input class="ip_time floatRight timepicker-cus" data-parsley-required="" placeholder="" name="confirm-book-time" id="confirm_book_time"> -->
<select data-parsley-required="" id="schedule-consult-timeslot" class="ip_time floatRight" placeholder="" name="confirm-book-time">
<option disabled selected>Time Slots</option>
<!-- <?php foreach ($time_slot as $key => $value) {
?>
<option value="<?php echo $value['time']?>"><?php echo $value['time']?></option>
<?php
}
?> -->
</select>
<div class="clear"></div>
</div>
</form>
<div class="ip_profile_list_div">
<ul>
<li class="floatLeft" data-toggle="modal" data-target="#waitinglistmodal">ENTER THE WAITING LIST</li>
<li class="floatRight">KNOW MORE</li>
<div class="clear"></div>
</ul>
</div>
<div id="err_confirm_booking" class="alert alert-danger ip_profile_book_error hidden"></div>
<hr>
<div class="row">
<div class="col-md-6">
<input class="ip_coupon" placeholder="COUPON">
<div class="clear"></div>
</div>
<div class="col-md-6">
<div class="ip_total_price">
<div class="ip_price floatLeft">
TOTAL PRICE
</div>
<div class="ip_amount floatRight">
R$ <?php echo $doctor_data['dr_price'];?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="ip_bottom_tab_btn_bay">
<div class="row">
<div class="col-md-6">
<button type="button" onclick="location.href='<?php echo base_url();?>Searchdoctor'" class="ip_tab_bottom_btn ip_tab_bottom_btn_back floatLeft">BACK</button>
<div class="clear"></div>
</div>
<div class="col-md-6">
<button class="ip_tab_bottom_btn ip_tab_bottom_btn_continue floatRight" id="confirm_booking_continue_btn">CONTINUE</button>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div id="login" class="tab-pane fade">
<h1>Login</h1>
<div class="ip_main_tab_content_inner">
<form role="form" data-parsley-validate="" id="confirm-book-login-form">
<div class="ip_login_input_form">
<input type="hidden" name="login_type" value="PATIENT">
<div class="ip_login_input_row">
<input name="login-form-username" data-parsley-required class="ip_login_input ip_login_user clear-login-data" placeholder="Login">
</div>
<div class="ip_login_input_row">
<input name="login-form-password" data-parsley-required class="ip_login_input ip_login_pass clear-login-data" placeholder="Password" type="password">
</div>
<input type="hidden" name="latitude" id="" >
<input type="hidden" name="longitude" >
<input type="hidden" name="address" >
<div class="">
<button type="button" class="ip_login_modal_signin floatLeft" id="confirm-book-login_submit">LOGIN</button>
<p class="floatLeft" data-toggle="modal" data-target="#forgot">Forgot Password</p>
<div class="clear"></div>
</div>
<div id="err-login-ajax" class="alert alert-danger hidden"></div>
</div>
</form>
<button type="button" id="tab_login_back" class="ip_tab_bottom_btn ip_tab_bottom_btn_back width100">BACK</button>
</div>
</div>
<div id="payment" class="tab-pane fade">
<h1>Payment</h1>
<div class="ip_main_tab_content_inner">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal </p>
<input class="ip_content_inner_input" placeholder="Name">
<input class="ip_content_inner_input" placeholder="Card Number">
<div class="ip_card_validity">
<div class="a1"><span>EXPIRATION DATE</span></div>
<div class="a1">
<select class="ip_validity_select">
<option>MM</option>
</select>
</div>
<div class="a1">
<select class="ip_validity_select">
<option>YY</option>
</select>
</div>
<div class="a1"><span class="t0">CVV<img src="<?php echo base_url();?>assets/images/ip_ques.png"></span></div>
<div class="clear"></div>
</div>
<div class="width100 textCenter">
<button type="button" id="book_payment_btn" class="ip_makepayment_btn">
MAKE PAYMENT
</button>
</div>
<div class="width100 textCenter p5">
<button type="button" id="tab_payment_back" class="ip_tab_bottom_btn ip_tab_bottom_btn_back ip_tab_payment_back">BACK</button>
</div>
</div>
</div>
<div id="confirmation" class="tab-pane fade">
<h1>Consultation Confirmed</h1>
<br>
<div class="ip_main_tab_content_inner">
<div class="width100 textCenter">
<div class="ip_main_tab_pic">
<img src="<?php echo base_url();echo $doctor_data['dr_pic']?>">
</div>
<h5><strong><?php echo $doctor_data['dr_name']?></strong></h5>
<h6><?php echo $doctor_data['dr_specialization']?></h6>
<p class="ip_booking_confirm_detail">
<?php echo $doctor_data['clinic_name']?><br>
<?php echo $doctor_data['clinic_street_address']?>,
<?php echo $doctor_data['clinic_locality']?>-<?php echo $doctor_data['clinic_cep']?><br>
<br>
<span id="book-date-show"> </span><br><span id="book-time-show"> </span>
</p>
<br>
<br>
<br>
<button type="button" onclick="location.href='<?php echo base_url();?>Patient'" class="ip_makepayment_btn">
DONE
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- WAITING-LIST-MODAL -->
<div id="waitinglistmodal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="ip_waiting_list_modal_wrapper">
<div class="ip_waiting_list">
<div class="ip_waiting_list_head">
Waiting list
</div>
<div class="ip_waiting_list_body">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<p> dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's,</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
</div>
</div>
</div>
</div>
<script>
<?php
if(!empty($searchdata['filter_dr_srch_price_high'])&&!empty($searchdata['filter_dr_srch_price_low']))
{
?>
pr1 = '<?php echo $searchdata['filter_dr_srch_price_low'];?>';
pr2 = '<?php echo $searchdata['filter_dr_srch_price_high'];?>';
pr1 = pr1.replace('R$ ','');
pr2 = pr2.replace('R$ ','');
setTimeout(function() {
$( "#ip_price_slider" ).slider("option", {
values: [pr1, pr2]
});
$("#ip_filter_price_low" ).val('<?php echo $searchdata['filter_dr_srch_price_low'];?>');
$("#ip_filter_price_high" ).val('<?php echo $searchdata['filter_dr_srch_price_high'];?>');
}, 1000);
<?php
}
else
{
?>
setTimeout(function() {
$( "#ip_price_slider" ).slider("option", {
values: [low_price, high_price]
});
$("#ip_filter_price_low" ).val("R$"+low_price);
$("#ip_filter_price_high" ).val("R$"+high_price);
}, 1000);
<?php
}
?>
<?php
if(!empty($searchdata['filter_dr_srch_distance_start'])&&!empty($searchdata['filter_dr_srch_distance_end']))
{
?>
dis1 = '<?php echo $searchdata['filter_dr_srch_distance_start'];?>';
dis2 = '<?php echo $searchdata['filter_dr_srch_distance_end'];?>';
dis1 = dis1.replace(' km','');
dis2 = dis2.replace(' km','');
setTimeout(function(){
$( "#ip_filter_distance_range" ).slider("option", {
values: [dis1, dis2]
});
$( "#ip_filter_distance_start" ).val('<?php echo $searchdata['filter_dr_srch_distance_start'];?>');
$( "#ip_filter_distance_end" ).val('<?php echo $searchdata['filter_dr_srch_distance_end'];?>');
},1000);
<?php
}
else
{
?>
setTimeout(function(){
$( "#ip_filter_distance_range" ).slider("option", {
values: [start_distance, end_distance]
});
$( "#ip_filter_distance_start" ).val(start_distance+" km");
$( "#ip_filter_distance_end" ).val(end_distance+" km");
},1000);
<?php
}
?>
<?php if(!empty($searchdata['doctor-search-location']))
{?>
$("#filter_dr_srch_loc" ).val("<?php echo $searchdata['doctor-search-location'];?>");
$("#filter_dr_srch_lat" ).val("<?php echo $searchdata['doctor-search-latitude'];?>");
$("#filter_dr_srch_lng" ).val("<?php echo $searchdata['doctor-search-longitude'];?>");
<?php
}
?>
<?php if(!empty($searchdata['doctor-search-date']))
{?>
$("#ip_datepicker_srch" ).val("<?php echo date('m/d/Y',$searchdata['doctor-search-date']);?>");
<?php
}
?>
<?php if(!empty($searchdata['filter_dr_gender']))
{
?> var filter_gender = '<?php echo $searchdata['filter_dr_gender']?>';
if(filter_gender=="MALE")
{
id = '#dctr-filter-male'
}
else if(filter_gender=="FEMALE")
{
id = '#dctr-filter-female'
}
$(id).prop('checked', true);
setTimeout(function() {
$(id).trigger("change");
}, 1000)
<?php
}
?>
<?php if(!empty($searchdata['doctor-search-speciality']))
{?>
$('#filter_dr_srch_speciality')
.val('<?php echo $searchdata['doctor-search-speciality'];?>')
.trigger('change');
<?php
}
?>
</script>
<?php
//print_r($searchdata);
if(!empty($doctors_list)){
// print_r($doctors_list);
}
// $all_doctors_loc=array();
if(!empty($doctors_list))
{
$all_price=array();
$all_distance=array();
foreach ($doctors_list as $key => $value) {
?>
<li>
<div class="ip_search_pic">
<?php if(!empty($value['doctor_photo'])){?>
<img src="<?php echo base_url().$value['doctor_photo']?>">
<?php }
else
{ ?>
<img src="<?php echo base_url()?>assets/images/doctor-background.jpg">
<?php }?>
</div>
<div class="ip_search_detail">
<h5><?php echo $value['name']?></h5>
<p><?php echo $value['specialization']?></p>
<h6><?php echo $value['clinic_name']?>,<?php echo $value['clinic_street_address']?>-<?php echo $value['clinic_locality']?></h6>
</div>
<div class="ip_search_ratting_price">
<p>R$ <?php echo $value['price']?></p>
<fieldset class="ip_rating">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
</fieldset>
</div>
<div class="ip_know_more">
<button class="ip_know_more_btn " data-toggle="collapse" data-target="#ip_detail<?php echo $key?>">Saiba mais</button>
</div>
<div class="clear"></div>
<div id="ip_detail<?php echo $key?>" class="collapse cus-map">
<div class="ip_know_more_detail">
<div class="row">
<div class="col-md-7">
<div class="ip_detailed_tab">
<div class="ip_detailed_tab_head">
<ul>
<li class="active" data-toggle="tab" href="#biography<?php echo $key?>">Biografia</li>
<li data-toggle="tab" href="#specialization<?php echo $key?>">Especializações</li>
</ul>
</div>
<div class="ip_detailed_tab_content">
<div class="tab-content">
<div id="biography<?php echo $key?>" class="tab-pane fade in active">
<p><?php echo $value['biography']?></p>
<!-- <p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer</p> -->
</div>
<div id="specialization<?php echo $key?>" class="tab-pane fade">
<p><?php echo $value['specialization']?></p>
<!-- <p> Ipsum is that
it has a more-or-less normal distribution of letters, as opposed to using 'Content here,
content here', making it look like readable English.</p> -->
</div>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="ip_detailed_map">
<div class="ip_location_map_head">
localização
</div>
<div class="ip_location_map_area map_data" data-lat="<?php echo $value['clinic_lat']?>" data-lng="<?php echo $value['clinic_lng']?>" id="doctor_location<?php echo $key?>" >
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="ip_knw_more_btn_bay">
<button class="ip_knwmore_detail_btn floatLeft ip_knw_more_btn_1" type="button" onclick="location.href='<?php echo base_url()?>Searchdoctor/doctorprofile/<?php echo $value["doctorid"]?>/<?php echo $value["clinic_id"]?>'">VER PERFIL COMPLETO</button>
<button class="ip_knwmore_detail_btn floatRight ip_knw_more_btn_2" type="button" onclick="location.href='<?php echo base_url()?>Searchdoctor/confirmbooking/<?php echo $value["doctorid"]?>/<?php echo $value["clinic_id"]?>'">MARCAR CONSULTA</button>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</div>
</li>
<?php
array_push($all_price,$value['price']);
array_push($all_distance,$value['clinic_distance']);
}
//print_r($all_price);
//print_r($all_distance);
}
else
{
?>
<li>
<p>NO RECORDS FOUND</p>
</li>
<?php } ?>
<script>
var low_price = '<?php echo min($all_price);?>';
var high_price = '<?php echo max($all_price);?>';
var start_distance = '<?php echo min($all_distance);?>';
var end_distance = '<?php echo max($all_distance);?>';
</script>
...@@ -3,16 +3,21 @@ ...@@ -3,16 +3,21 @@
<!-- SCRIPTS --> <!-- SCRIPTS -->
<script>
var base_url = '<?php echo base_url(); ?>';
</script>
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyCYwWLoimApB0_O3XhlzbZ3GLcaY833y2Y"></script>
<script src="<?php echo base_url();?>assets/js/ie-emulation-modes-warning.js.download"></script> <script src="<?php echo base_url();?>assets/js/ie-emulation-modes-warning.js.download"></script>
<script src="<?php echo base_url();?>assets/js/jquery.min.js"></script> <script src="<?php echo base_url();?>assets/js/jquery.min.js"></script>
<script src="<?php echo base_url();?>assets/js/moment.min.js"></script> <script src="<?php echo base_url();?>assets/js/moment.min.js"></script>
<!-- <script src="../assets/js/fullcalendar.min.js"></script> --> <!-- <script src="../assets/js/fullcalendar.min.js"></script> -->
<script>window.jQuery || document.write('<script src="<?php echo base_url();?>assets/js/vendor/jquery.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="<?php echo base_url();?>assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="<?php echo base_url();?>assets/js/bootstrap.min.js.download"></script> <script src="<?php echo base_url();?>assets/js/bootstrap.min.js"></script>
<script src="<?php echo base_url();?>assets/js/ie10-viewport-bug-workaround.js.download"></script> <script src="<?php echo base_url();?>assets/js/ie10-viewport-bug-workaround.js.download"></script>
<script src="<?php echo base_url();?>assets/js/jquery-ui.js"></script> <script src="<?php echo base_url();?>assets/js/jquery-ui.js"></script>
<script src="<?php echo base_url();?>assets/js/gmap.js"></script> <!-- <script src="<?php echo base_url();?>assets/js/gmap.js"></script> -->
<script src="<?php echo base_url();?>assets/js/parsley.min.js"></script> <script src="<?php echo base_url();?>assets/js/parsley.min.js"></script>
<script src="<?php echo base_url();?>assets/js/custom.js"></script> <script src="<?php echo base_url();?>assets/js/custom.js"></script>
<script src="<?php echo base_url();?>assets/js/bootstrap-datepicker.js"></script> <script src="<?php echo base_url();?>assets/js/bootstrap-datepicker.js"></script>
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
<p>Copenhagen, Denmark</p> <p>Copenhagen, Denmark</p>
<h6>+45 878-78-14</h6> <h6>+45 878-78-14</h6>
<div class="ip_footer_social"> <div class="ip_footer_social">
<li><img src="../assets/images/ip_facebook.png"></li> <li><img src="<?php echo base_url();?>assets/images/ip_facebook.png"></li>
<li><img src="../assets/images/ip_twitter.png"></li> <li><img src="<?php echo base_url();?>assets/images/ip_twitter.png"></li>
<li><img src="../assets/images/ip_base.png"></li> <li><img src="<?php echo base_url();?>assets/images/ip_base.png"></li>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
......
<?php if($this->session->userdata('UserData'))
{$userdata = $this->session->userdata('UserData');}
?>
<div class="ip_main_wrapper"> <div class="ip_main_wrapper">
<nav class="navbar navbar-fixed-top"> <nav class="navbar navbar-fixed-top">
<!-- PRIMARY-HEADER --> <!-- PRIMARY-HEADER -->
<div class="ip_header_primary"> <!-- <div class="ip_header_primary">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar_primary" aria-expanded="false" aria-controls="navbar"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar_primary" aria-expanded="false" aria-controls="navbar">
...@@ -47,7 +50,7 @@ ...@@ -47,7 +50,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<!-- SECONDARY-HEADER-LOGEDOUT--> <!-- SECONDARY-HEADER-LOGEDOUT-->
...@@ -90,12 +93,27 @@ ...@@ -90,12 +93,27 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<div class="ip_logo" href="http://getbootstrap.com/examples/starter-template/#"><img src="<?php echo base_url();?>assets/images/ip_logo.png"></div> <div class="ip_logo" onclick="location.href='<?php echo base_url();?>'"><img src="<?php echo base_url();?>assets/images/ip_logo.png"></div>
</div> </div>
<div id="navbar" class="navbar-collapse collapse" aria-expanded="false" style="height: 1px;"> <div id="navbar" class="navbar-collapse collapse" aria-expanded="false" style="height: 1px;">
<ul class="nav navbar-nav ip_navbar_nav"> <ul class="nav navbar-nav ip_navbar_nav">
<li class="active"><a>Dashboard</a></li> <li class="active">
<?php if(!empty($userdata))
{
?>
<a href="<?php echo base_url()?>Home/Dashboard">Dashboard</a>
<?php
}
else
{
?>
<a>Dashboard</a>
<?php
}
?>
</li>
<li><a>Appointment Book</a></li> <li><a>Appointment Book</a></li>
<li><a>Wallet</a></li> <li><a>Wallet</a></li>
<li class="dropdown"> <li class="dropdown">
...@@ -164,15 +182,27 @@ ...@@ -164,15 +182,27 @@
<li> <li>
<div class="ip_nav_account_details dropdown"> <div class="ip_nav_account_details dropdown">
<div class="ip_nav_account_profile_pic dropdown-toggle" data-toggle="dropdown"> <div class="ip_nav_account_profile_pic dropdown-toggle" data-toggle="dropdown">
<?php if(!empty($userdata))
{?>
<img src="<?php echo base_url();echo $userdata['profile_photo'];?>"> <?php } ?>
</div> </div>
<ul class="dropdown-menu ip_nav_profile_listing"> <ul class="dropdown-menu ip_nav_profile_listing">
<div class="ip_arrow_up"></div> <div class="ip_arrow_up"></div>
<li>Create contributor profile</li> <li>Create contributor profile</li>
<li>Edit contributor profile</li> <li>Edit contributor profile</li>
<li class="bordernone">Sign Out</li> <?php if(!empty($userdata)){
?>
<li class="bordernone">
<a href="<?php echo base_url()?>Home/logout">Sign Out</a>
</li>
<?php
} ?>
</ul> </ul>
<div class="ip_nav_account_profile_name"> <div class="ip_nav_account_profile_name">
Dr. Ann Alexander <?php if(!empty($userdata)&&($userdata['type']=="DOCTOR"))
{?>Dr.<?php echo $userdata['name'];}
else if(!empty($userdata)&&($userdata['type']=="PATIENT")){echo $userdata['name'];}
else{?>Login/Register <?php } ?>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
......
...@@ -12,17 +12,17 @@ ...@@ -12,17 +12,17 @@
<body > <body >
<?php <?php
if($page!="home"){ $this->load->view('template/header');}
//$this->load->view('template/header');
//$this->load->view('Templates/left-menu'); //$this->load->view('Templates/left-menu');
// $this->load->view('template/left-menu-old'); // $this->load->view('template/left-menu-old');
$this->load->view($page); $this->load->view($page);
if($page!="home"){ $this->load->view('template/footer');}
//$this->load->view('template/footer');
?> ?>
<?php <?php
$this->load->view('template/footer-script'); $this->load->view('template/footer-script');
if($page=="home"){$this->load->view('home_custom_script');}
if($page=="search_doctor"){$this->load->view('search_doctor_custom_script');}
?> ?>
</body> </body>
</html> </html>
...@@ -26,6 +26,7 @@ body::-webkit-scrollbar { ...@@ -26,6 +26,7 @@ body::-webkit-scrollbar {
.pt0{padding-top:0px !important;} .pt0{padding-top:0px !important;}
.pb0{padding-bottom: 0px !important;} .pb0{padding-bottom: 0px !important;}
.pl15{padding-left:20px !important;padding-right:20px !important;} .pl15{padding-left:20px !important;padding-right:20px !important;}
.p10{padding: 10px !important;}
.m0{margin:0px !important;} .m0{margin:0px !important;}
.ml0{margin-left: 0px !important;} .ml0{margin-left: 0px !important;}
...@@ -40,6 +41,7 @@ body::-webkit-scrollbar { ...@@ -40,6 +41,7 @@ body::-webkit-scrollbar {
.bottom10{bottom:10px;} .bottom10{bottom:10px;}
.left10{left:10px;} .left10{left:10px;}
.right10{right:10px;} .right10{right:10px;}
.mr5{margin-right:5px;}
.absolute{position: absolute !important;} .absolute{position: absolute !important;}
.relative{position: relative !important;} .relative{position: relative !important;}
...@@ -138,10 +140,11 @@ body::-webkit-scrollbar { ...@@ -138,10 +140,11 @@ body::-webkit-scrollbar {
.ip_filter_dropdown_menu li a{padding:10px;cursor:pointer;} .ip_filter_dropdown_menu li a{padding:10px;cursor:pointer;}
.ip_filter_div h5{color:#646669;font-weight:600;padding:10px;margin:0px;} .ip_filter_div h5{color:#646669;font-weight:600;padding:10px;margin:0px;}
.ip_star_rate{width:100%;padding:10px;} .ip_star_rate{width:100%;padding:10px;}
.ip_star_rate li{display:inline-block;width:35px;height:25px;border:1px solid #dddddd;color:#dddddd;border-radius:4px;margin-right:8px;background:url("../images/ip_star.png");background-size:27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;} .ip_star_rate_toggle_btn{display:inline-block;width:35px;height:25px;border:1px solid #dddddd;color:#dddddd;border-radius:4px;margin-right:8px;background:url("../images/ip_star.png");background-size:27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;}
.ip_star_rate li:focus{display:inline-block;width:35px;height:25px;border-radius:4px;margin-right:8px;color:#ff004f;background:url("../images/ip_star_active.png");background-size: 27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;} .ip_star_rate_toggle_btn_focus{display:inline-block;width:35px;height:25px;border-radius:4px;margin-right:8px;color:#ff004f;border:1px solid #ff004f;background:url("../images/ip_star_active.png");background-size: 27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;}
.ip_star_rate li:hover{display:inline-block;width:35px;height:25px;border-radius:4px;margin-right:8px;color:#ff004f;background:url("../images/ip_star_active.png");background-size: 27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;} .ip_star_rate_toggle_btn_focus:hover{display:inline-block;width:35px;height:25px;border-radius:4px;margin-right:8px;color:#ff004f;border:1px solid #ff004f;background:url("../images/ip_star_active.png");background-size: 27px;background-repeat: no-repeat;background-position:8px;font-size: 14px;padding-left: 6px;cursor:pointer;}
.ip_star_rate li span{position:relative;top:1px;} .ip_star_rate_toggle_btn_visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ip_star_rate_toggle_btn_visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.ip_dropdown{width:100%;padding:10px;color:#646669;font-weight:600;position:relative;cursor:pointer;border:1px solid #dddddd;border-radius:5px;} .ip_dropdown{width:100%;padding:10px;color:#646669;font-weight:600;position:relative;cursor:pointer;border:1px solid #dddddd;border-radius:5px;}
.ip_drop_toggle{background:url("../images/ip_black_down.png"); background-position: right -12px top -11px;background-repeat:no-repeat;background-size: 45px;cursor:pointer;font-weight: 500;} .ip_drop_toggle{background:url("../images/ip_black_down.png"); background-position: right -12px top -11px;background-repeat:no-repeat;background-size: 45px;cursor:pointer;font-weight: 500;}
.ip_dropdown_menu{width:100%;left:0px;right:0px;margin:0px;padding:0px;box-shadow:none !important;border-radius:0px;cursor:pointer;} .ip_dropdown_menu{width:100%;left:0px;right:0px;margin:0px;padding:0px;box-shadow:none !important;border-radius:0px;cursor:pointer;}
...@@ -155,9 +158,11 @@ body::-webkit-scrollbar { ...@@ -155,9 +158,11 @@ body::-webkit-scrollbar {
.ip_distance_count{width:50px;height:30px;border-radius:3px;border:2px solid #dddddd;color:#dddddd;font-size:12px;text-align:center;} .ip_distance_count{width:50px;height:30px;border-radius:3px;border:2px solid #dddddd;color:#dddddd;font-size:12px;text-align:center;}
.ip_filter_range_count{padding-top:20px;padding-bottom:20px;} .ip_filter_range_count{padding-top:20px;padding-bottom:20px;}
.ip_return{width:100%;text-align:center;padding-top: 10px;padding-bottom: 10px;} .ip_return{width:100%;text-align:center;padding-top: 10px;padding-bottom: 10px;}
.ip_return_option{width:110px;height:35px;border:2px solid #dddddd;border-radius:20px;display:inline-block;text-align:center;color:#dddddd;padding:5px;margin: 3px;cursor:pointer;} .ip_return_option_toggle_btn{width:110px;height:35px;border:2px solid #dddddd;border-radius:20px;display:inline-block;text-align:center;color:#dddddd;padding:5px;margin: 3px;cursor:pointer;}
.ip_return_option:hover{color:#ff004f;} .ip_return_option_toggle_btn:hover{color:#ff004f;}
.ip_return_option:focus{color:#ff004f;} .ip_return_option_toggle_focus{color:#ff004f;}
.ip_return_option_toggle_btn_visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ip_return_option_toggle_btn_visuallyhidden.focusable:active, .ip_return_option_toggle_btn_visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.ip_result_div{width:100%;} .ip_result_div{width:100%;}
.ip_result_settings_bay{width:100%;} .ip_result_settings_bay{width:100%;}
...@@ -182,15 +187,19 @@ body::-webkit-scrollbar { ...@@ -182,15 +187,19 @@ body::-webkit-scrollbar {
.ip_price_count{width:75px;height:25px;border-radius:3px;border:2px solid #dddddd;color:#dddddd;font-size:12px;text-align:center;} .ip_price_count{width:75px;height:25px;border-radius:3px;border:2px solid #dddddd;color:#dddddd;font-size:12px;text-align:center;}
.ip_filter_price_count{padding-top:10px;padding-bottom:10px;} .ip_filter_price_count{padding-top:10px;padding-bottom:10px;}
.ip_filter_more_list{width:100%;text-align:left;} .ip_filter_more_list{width:100%;text-align:left;}
.ip_filter_more_list li{display:inline-block;border:1px solid #dddddd;border-radius:20px;padding:5px;padding-left:15px;padding-right:15px;font-size:10px;cursor:pointer;} .ip_filter_more_list_toggle_btn { display:inline-block;border:1px solid #dddddd;border-radius:20px;padding:5px;padding-left:15px;padding-right:15px;font-size:10px;cursor:pointer;}
.ip_filter_more_list li:hover{color:#ff7600;} .ip_filter_more_list_toggle_focus { color:#ff7600;}
.ip_filter_more_list li:focus{color:#ff7600;} .ip_filter_more_list_toggle_focus:hover{ color:#ff7600;}
.ip_sort_settings{width:100%;text-align:left;border-bottom:1px solid #ededed;padding-bottom:10px;} .ip_filter_visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ip_sort_settings li{display:inline-block;color:#bfbfbf;font-size: 16px;padding-right:20px;background-size: 30px;background-repeat: no-repeat; background-position: right 0px top -3px;} .ip_filter_visuallyhidden.focusable:active, .ip_filter_visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.ip_sort_settings li span img{width:30px;} .ip_sort_more_list{display:inline-block;text-align:left;}
.ip_sort_up{color:#515356 !important;} .ip_sort_more_list_toggle_btn { display:inline-block;color:#bfbfbf;font-size: 16px;padding-right:20px;background-size: 30px;background-repeat: no-repeat; background-position: right 0px top -3px;cursor:pointer;}
.ip_sort_down{;} .ip_sort_more_list_toggle_focus { color:#515356 !important;}
.ip_result_listing{width:100%;} .ip_sort_more_list_toggle_focus:hover{ color:#515356 !important;}
.ip_sort_visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ip_sort_visuallyhidden.focusable:active, .ip_sort_visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.ip_result_listing{width:100%; position: relative;}
.ip_result_listing_loader{position: absolute;top:0px;bottom: 0px;left:0px;right:0px;background-color: rgba(0,0,0,0.3) !important;background:url("../images/loader.gif"); background-repeat: no-repeat;background-position: center;background-size: 70px;}
.ip_result_listing ul {width:100%;margin:0px;padding:0px;padding-top: 25px;} .ip_result_listing ul {width:100%;margin:0px;padding:0px;padding-top: 25px;}
.ip_result_listing ul li{width:100%;list-style:none;border-bottom:1px solid #ededed;padding-left: 15px;padding-bottom: 25px;padding-top: 20px;} .ip_result_listing ul li{width:100%;list-style:none;border-bottom:1px solid #ededed;padding-left: 15px;padding-bottom: 25px;padding-top: 20px;}
.ip_search_pic{width:110px;height:110px;border-radius:50%;background:#ededed;float:left;} .ip_search_pic{width:110px;height:110px;border-radius:50%;background:#ededed;float:left;}
...@@ -314,9 +323,12 @@ body::-webkit-scrollbar { ...@@ -314,9 +323,12 @@ body::-webkit-scrollbar {
.ip_profile_ratting{width:85px;margin:0 auto;} .ip_profile_ratting{width:85px;margin:0 auto;}
.ip_profile_ratting .ip_rating > label{margin-bottom: 0px !important;} .ip_profile_ratting .ip_rating > label{margin-bottom: 0px !important;}
.ip_profile_ratting .ip_rating > label:before { margin:3px;font-size:11px;font-family: FontAwesome;display: inline-block;content: "\f005";} .ip_profile_ratting .ip_rating > label:before { margin:3px;font-size:11px;font-family: FontAwesome;display: inline-block;content: "\f005";}
.ip_profile_datetime{width: 200px;margin:0 auto;padding-top: 15px;padding-bottom: 15px;} .ip_profile_datetime{width:auto;margin:0 auto;padding-top: 15px;padding-bottom: 15px;}
.ip_profile_datetime .ip_calender{padding-left: 5px;background:url("../images/ip_calender_grey.png");background-repeat: no-repeat !important;background-position: right;background-size:40px;} .ip_booking_date{width:290px !important;}
.ip_profile_datetime .ip_time{padding-left: 5px;background:url("../images/ip_timing_grey.png");background-repeat: no-repeat !important;background-position: right;background-size:40px;} .ip_booking_date .ip_calender{margin-bottom: 5px;}
.ip_booking_date .ip_time{margin-bottom: 5px;}
.ip_profile_datetime .ip_calender{width:100%;margin-bottom: 5px;padding-left: 5px;background:url("../images/ip_calender_grey.png");background-repeat: no-repeat !important;background-position: right;background-size:40px;}
.ip_profile_datetime .ip_time{width:100%;margin-bottom: 5px;padding-left: 5px;background:url("../images/ip_timing_grey.png");background-repeat: no-repeat !important;background-position: right;background-size:40px;-moz-appearance:none;-webkit-appearance: none;}
.ip_coupon{float: left;width:35%;height:40px;border:1px solid #ededed;border-radius:20px;background: url(../images/ip_black_forward.png);background-position: right;background-repeat: no-repeat;background-size: 45px;outline: :none;padding-left:15px;color: #bebebe;font-weight: 600;} .ip_coupon{float: left;width:35%;height:40px;border:1px solid #ededed;border-radius:20px;background: url(../images/ip_black_forward.png);background-position: right;background-repeat: no-repeat;background-size: 45px;outline: :none;padding-left:15px;color: #bebebe;font-weight: 600;}
.ip_coupon:focus{outline: none;} .ip_coupon:focus{outline: none;}
.ip_total_price{width:40%;float: right;} .ip_total_price{width:40%;float: right;}
...@@ -329,6 +341,9 @@ body::-webkit-scrollbar { ...@@ -329,6 +341,9 @@ body::-webkit-scrollbar {
.ip_main_tab_content h1{text-align: center;color: #424242;font-weight:700;} .ip_main_tab_content h1{text-align: center;color: #424242;font-weight:700;}
.ip_main_tab_content_inner{width:35%;margin:0 auto;} .ip_main_tab_content_inner{width:35%;margin:0 auto;}
.ip_main_tab_content_inner p{padding-top:20px;padding-bottom: 20px;} .ip_main_tab_content_inner p{padding-top:20px;padding-bottom: 20px;}
.ip_main_tab_content_inner h6{color: #b31aaa;font-weight: 600;font-size: 16px;}
.ip_booking_confirm_detail {color: #a8a8a8 !important;padding-top: 10px !important;padding-bottom: 10px !important;}
.ip_booking_confirm_detail span{font-weight: 400;font-size: 18px;color: #424242;}
.ip_content_inner_input{width:100%;height:40px;background:#ededed;border:none;padding:10px;outline:none;margin-bottom:20px;} .ip_content_inner_input{width:100%;height:40px;background:#ededed;border:none;padding:10px;outline:none;margin-bottom:20px;}
.ip_card_validity{width:100%;text-align: center;padding-bottom: 30px;} .ip_card_validity{width:100%;text-align: center;padding-bottom: 30px;}
.ip_card_validity .a1{float:left;margin-right: 30px;} .ip_card_validity .a1{float:left;margin-right: 30px;}
...@@ -425,11 +440,12 @@ body::-webkit-scrollbar { ...@@ -425,11 +440,12 @@ body::-webkit-scrollbar {
.ip_schedule_input:focus{outline:none;} .ip_schedule_input:focus{outline:none;}
.ip_schedule_button_bay{width:100%;text-align: center;padding:20px;} .ip_schedule_button_bay{width:100%;text-align: center;padding:20px;}
.ip_schedule_btn{height:35px;color: #fff;font-weight: 900;background: #3bcfff;border-radius:3px;border:none;outline:none;font-size: 14px;padding-left: 35px;padding-right:35px;} .ip_schedule_btn{height:35px;color: #fff;font-weight: 900;background: #3bcfff;border-radius:3px;border:none;outline:none;font-size: 14px;padding-left: 35px;padding-right:35px;}
.ip_schedule_week{width:100%;text-align: center;border-bottom:1px solid #f4f4f4;padding: 25px;} .ip_schedule_week{width:100%;text-align: center;position:relative;border-bottom:1px solid #f4f4f4;padding: 25px;}
.ip_schedule_week li{display: inline-block;white-space: nowrap; .ip_schedule_week li{float:left;white-space: nowrap;
overflow: hidden; overflow: hidden;list-style: none;
text-overflow: ellipsis;padding: 0px;width:12.5%;padding:2%;color: #c0c0c0;font-weight:bold;margin:5px;border-bottom:3px solid #f5f5f5;padding-top: 0px;} text-overflow: ellipsis;padding: 0px;width:12.28%;padding:2%;padding-left: 0px;padding-right: 0px;color: #c0c0c0;font-weight:bold;margin:5px;border-bottom:3px solid #f5f5f5;padding-top: 0px;}
.ip_schedule_week .select{color: #43d8ff;border-bottom:3px solid #43d8ff;} .ip_schedule_week .select{color: #43d8ff;border-bottom:3px solid #43d8ff;}
.ip_schedule_week .parsley-errors-list {top:75px;}
.ip_schedule_timing{width:100%;} .ip_schedule_timing{width:100%;}
.ip_schedule_timing li{width: 100%;list-style: none;padding: 25px;border-bottom:2px solid #f5f5f5;} .ip_schedule_timing li{width: 100%;list-style: none;padding: 25px;border-bottom:2px solid #f5f5f5;}
.ip_schedule_timing li h6{color: #43d8ff;font-weight: 900;margin:0px;font-size: 14px;height:35px;} .ip_schedule_timing li h6{color: #43d8ff;font-weight: 900;margin:0px;font-size: 14px;height:35px;}
...@@ -717,8 +733,8 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -717,8 +733,8 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_time_avialability{width:100%;} .ip_time_avialability{width:100%;}
.ip_time_avialability ul{width:100%;margin:0px;padding:0px;height:100% !important;} .ip_time_avialability ul{width:100%;margin:0px;padding:0px;height:100% !important;}
.ip_time_avialability ul li{width:100%;list-style: none;height:60px;} .ip_time_avialability ul li{width:100%;list-style: none;height:60px;}
.ip_avialability{height:100%;color: #797979;font-weight: 900;text-align: left;padding:10px;} .ip_avialability{height:100%;color: #797979;font-weight: 900;text-align: left;padding:10px;position: relative;}
.ip_avialable{border-left:3px solid #63da37;} .ip_avialable{border-left:3px solid #63da37;position: absolute;top:0px;right:0px;bottom:0px;left:0px;padding:20px;}
.ip_not_avialable{border-left:3px solid #ff004f;} .ip_not_avialable{border-left:3px solid #ff004f;}
.ip_apppointment_btn_custom{width:auto !important;font-weight: 700;color: #bfbfbf;} .ip_apppointment_btn_custom{width:auto !important;font-weight: 700;color: #bfbfbf;}
.ip_apppointment_btn_custom a{text-decoration: none;color: #c4c4c4 !important;font-weight: 800;padding-left: 20px;padding-right: 20px;padding-top: 10px;padding-bottom: 10px;} .ip_apppointment_btn_custom a{text-decoration: none;color: #c4c4c4 !important;font-weight: 800;padding-left: 20px;padding-right: 20px;padding-top: 10px;padding-bottom: 10px;}
...@@ -737,15 +753,18 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -737,15 +753,18 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_day_scheduleler ul li{list-style: none;padding:5px;color: #bfbfbf;font-weight:700;} .ip_day_scheduleler ul li{list-style: none;padding:5px;color: #bfbfbf;font-weight:700;}
.ip_current_date{padding-left:30px !important;padding-right:30px !important;background: #fff;width:80px;float: left;} .ip_current_date{padding-left:30px !important;padding-right:30px !important;background: #fff;width:80px;float: left;}
.ip_current_month{color: #929292 !important;padding-left: 30px !important;background: #f9f9f9;width: calc(100% - 80px);float: right;} .ip_current_month{color: #929292 !important;padding-left: 30px !important;background: #f9f9f9;width: calc(100% - 80px);float: right;}
.ip_current_day{color: #929292 !important;padding-left: 30px !important;width:100%;border:none;padding:5px;}
.ip_current_day_frame{padding:0px;;margin:0px;border-top:2px solid #f5f5f5;border-bottom:2px solid #f5f5f5;}
.ip_day_listing{padding:0px;margin:0px;border:none !important;} .ip_day_listing{padding:0px;margin:0px;border:none !important;}
.ip_day_listing li{list-style: none;width:100%;background:#fff;height:60px;padding: 0px !important;} .ip_day_listing li{list-style: none;width:100%;background:#fff;height:60px;padding: 0px !important;}
.ip_day_space{width:100%;height:50px;padding: 0px !important;} .ip_day_space{width:100%;height:50px;padding: 0px !important;}
.ip_day_time_slot{width:80px;float: left;height:100%;} .ip_day_time_slot{width:80px;float: left;height:100%;}
.ip_day_time_schedule_details{ width: calc(100% - 80px);float: right;border-top:1px solid #f5f5f5;border-bottom:1px solid #f5f5f5;height:100%;} .ip_day_time_schedule_details{ width: calc(100% - 80px);float: right;position:relative;border-top:1px solid #f5f5f5;border-bottom:1px solid #f5f5f5;height:100%;}
.ip_day_time_slot p{margin:0px;padding:0px;text-align: right;padding-right: 10px;position: relative;bottom: 0px;} .ip_day_time_slot p{margin:0px;padding:0px;text-align: right;padding-right: 10px;position: relative;bottom: 0px;}
.ip_day_time_schedule_details_data span{color: #797979;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} .ip_day_time_schedule_details_data span{color: #797979;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.ip_day_time_schedule_details_data span img{width: 35px;height:35px;border-radius:50%;margin-right:20px;} .ip_day_time_schedule_details_data span img{width: 35px;height:35px;border-radius:50%;margin-right:20px;}
.ip_day_time_schedule_details_data{padding:10px;} .ip_day_time_schedule_details_data{}
.ip_day_time_schedule_details_data .ip_gender_check_checkbox{left:auto !important;}
.ip_day_listing{height:500px;overflow: scroll;} .ip_day_listing{height:500px;overflow: scroll;}
.ip_day_listing::-webkit-scrollbar { display: none; } .ip_day_listing::-webkit-scrollbar { display: none; }
.ip_day_listing::-moz-scrollbar { display: none;} .ip_day_listing::-moz-scrollbar { display: none;}
...@@ -781,8 +800,8 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -781,8 +800,8 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_month_schedule_dates ul{width:100%;margin:0px;padding:0px;} .ip_month_schedule_dates ul{width:100%;margin:0px;padding:0px;}
.ip_month_schedule_dates ul li{width:14.28%;float: left;text-align: center;border: 1px solid #f5f5f5;margin: 0px;list-style: none;color: #bfbfbf;font-weight: 700;height:120px;padding:5px;} .ip_month_schedule_dates ul li{width:14.28%;float: left;text-align: center;border: 1px solid #f5f5f5;margin: 0px;list-style: none;color: #bfbfbf;font-weight: 700;height:120px;padding:5px;}
.ip_month_inner_date{position: relative;height: 100%;width: 100%;border-radius:3px; padding: 16px;} .ip_month_inner_date{position: relative;height: 100%;width: 100%;border-radius:3px; padding: 16px;}
.ip_month_schedule_dates ul li .selected{background:#e0f7d7;color: #929292 !important;} .ip_month_schedule_dates ul li .selected{background:#e0f7d7;color: #929292 !important;padding: 15px;position: absolute;left: 0px;right: 0px;top: 0px;bottom: 0px;z-index: 1;}
.ip_month_inner_date span{position: absolute;top:10px;right:10px;} .ip_month_inner_date span{position: absolute;top:10px;right:10px;z-index: 2;}
.ip_month_schedule_dates ul li .selected strong{color: #009714;font-weight: 900;padding-bottom:3px;font-size: 16px;} .ip_month_schedule_dates ul li .selected strong{color: #009714;font-weight: 900;padding-bottom:3px;font-size: 16px;}
.ip_month_schedule_dates ul li .selected p{color: #009714;padding: 0px;margin:0px;padding-bottom:3px;} .ip_month_schedule_dates ul li .selected p{color: #009714;padding: 0px;margin:0px;padding-bottom:3px;}
...@@ -942,6 +961,7 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -942,6 +961,7 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_speciality_input::-moz-placeholder {color:#fff;} .ip_speciality_input::-moz-placeholder {color:#fff;}
.ip_speciality_input:-ms-input-placeholder {color:#fff;} .ip_speciality_input:-ms-input-placeholder {color:#fff;}
.ip_speciality_input:-moz-placeholder {color:#fff;} .ip_speciality_input:-moz-placeholder {color:#fff;}
.ip_speciality_input option{background: rgba(0,0,0,0.7) !important;}
.ip_home_search_menu{float: right;padding: 10px;width:70px;height:100%;color:#fff;} .ip_home_search_menu{float: right;padding: 10px;width:70px;height:100%;color:#fff;}
.ip_home_search_menu_inner{height:100%;width:100%;border-left:1px solid #fff;background: url(../images/ip_search_menu_home.png);background-position: center;background-repeat: no-repeat;background-size: 20px;background-size: 40px;} .ip_home_search_menu_inner{height:100%;width:100%;border-left:1px solid #fff;background: url(../images/ip_search_menu_home.png);background-position: center;background-repeat: no-repeat;background-size: 20px;background-size: 40px;}
.ip_home_search_data{float: right;padding: 10px;width:20%;height:100%;color:#fff;} .ip_home_search_data{float: right;padding: 10px;width:20%;height:100%;color:#fff;}
...@@ -1036,6 +1056,12 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -1036,6 +1056,12 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_content_fb{height:55px;width:calc(100% - 65px);background:#3B5998;text-align:center;border-radius:5px;color:#fff;font-size: 15px;font-weight: 300;padding: 15px;} .ip_content_fb{height:55px;width:calc(100% - 65px);background:#3B5998;text-align:center;border-radius:5px;color:#fff;font-size: 15px;font-weight: 300;padding: 15px;}
.ip_reg_modal_addphoto{width:60px;height:60px;border-radius:50%;background:#a8a8a8;} .ip_reg_modal_addphoto{width:60px;height:60px;border-radius:50%;background:#a8a8a8;}
.ip_reg_modal_addphoto img{width:100%;height:100%;border-radius:50%;object-fit:cover;object-position:center;} .ip_reg_modal_addphoto img{width:100%;height:100%;border-radius:50%;object-fit:cover;object-position:center;}
.ip_reg_add_phot_div{position: relative;}
.ip_add_photo_doc input{opacity: 0;position: absolute;left:0px;right:0px;top:0px;bottom: 0px;}
.ip_add_photo_doc{position:absolute;left:75px;height: 40px;color: #fff;background: #3bcfff;border-radius: 3px;border: none;padding-left: 15px;padding-right: 15px;font-weight: 500;outline: none;}
.ip_add_photo_doc .parsley-errors-list {top: 45px;
width: 145px;
left: 0px;}
.ip_gender_check{position: relative;top: 15px;} .ip_gender_check{position: relative;top: 15px;}
.ip_gender_check label{top:0px !important;} .ip_gender_check label{top:0px !important;}
.ip_gender_check_checkbox{top:0px !important;left:15px !important;z-index: 9;} .ip_gender_check_checkbox{top:0px !important;left:15px !important;z-index: 9;}
...@@ -1059,6 +1085,7 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px ...@@ -1059,6 +1085,7 @@ unicode-bidi: bidi-override;display: inline-block;position: relative;bottom: 5px
.ip_login_user{background:url(../images/ip_user1.png);} .ip_login_user{background:url(../images/ip_user1.png);}
.ip_login_pass{background:url(../images/ip_pass1.png);} .ip_login_pass{background:url(../images/ip_pass1.png);}
.ip_login_msg{background:url(../images/ip_msg.png);} .ip_login_msg{background:url(../images/ip_msg.png);}
.ip_login_input_form .ip_doc_paitent{top:0px !important;}
...@@ -1731,3 +1758,24 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active { ...@@ -1731,3 +1758,24 @@ fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active {
.datepicker.dropdown-menu td { .datepicker.dropdown-menu td {
padding: 4px 5px; padding: 4px 5px;
} }
.ip_select_clinic_input {
width: 150px;
border: 2px solid #f4f4f4;
height: 33px;
background: transparent;
border-radius: 3px;
padding-left: 10px;
font-weight: 900;
color: #a9a9a9;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
background: url(../images/ip_drp_grey.png);
background-repeat: no-repeat;
background-position: right;
background-size: 30px;
}
.inp-dis{background: #FAFAFA;}
.ip_profile_book_error{text-align: center;width: 320px;margin: 0 auto;}
.ip_tab_payment_back{width: 75%;margin: 0 auto;height: 40px;}
.ip_profile_reschedule_error{text-align: center;margin: 0 auto;font-size: 11px;}
\ No newline at end of file
...@@ -15,19 +15,20 @@ textarea.parsley-error { ...@@ -15,19 +15,20 @@ textarea.parsley-error {
} }
.parsley-errors-list { .parsley-errors-list {
margin: 2px 0 3px; margin: 6px 0 3px;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
font-size: 0.9em; font-size: 0.9em;
line-height: 0.9em; line-height: 0.9em;
opacity: 0; opacity: 0;
transition: all .3s ease-in; transition: all .3s ease-in;
-o-transition: all .3s ease-in; -o-transition: all .3s ease-in;
-moz-transition: all .3s ease-in; -moz-transition: all .3s ease-in;
-webkit-transition: all .3s ease-in; -webkit-transition: all .3s ease-in;
} }
.parsley-errors-list li{width:100%;color: #B94A48 !important;font-weight:400;padding: 0px !important;border:none;margin:none;}
.parsley-errors-list.filled { .parsley-errors-list.filled {
opacity: 1; opacity: 1;
position: absolute;
} }
\ No newline at end of file
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under the MIT license
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
\ No newline at end of file
function post_ajax(url, data) {
var result = '';
$.ajax({
type: "POST",
url: url,
data: data,
success: function(response) {
result = response;
},
error: function(response) {
result = 'error';
},
async: false
});
return result;
}
function post_ajax_serialize(url, data) {
var result = '';
$.ajax({
type: "POST",
url: url,
data: data,
contentType:false,
processData:false,
success: function(response) {
result = response;
},
error: function(response) {
result = 'error';
},
async: false
});
return result;
}
function initialize_map(id) {
var latitude = $('#'+id).data('lat')
var longitude = $('#'+id).data('lng')
var myLatlng = new google.maps.LatLng(latitude,longitude);
var mapOptions = {
zoom: 14,
scrollwheel: false,
disableDefaultUI: true,
center: myLatlng
};
var map = new google.maps.Map(document.getElementById(id), mapOptions);
var contentString = '';
var infowindow = new google.maps.InfoWindow({
content: '<div class="map-content"><p>Clinic Location</p></div>'
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function load_filterchange()
{
var filter_data = $('#searchfilter_form').serialize();
console.log(filter_data);
var filter_response = post_ajax(base_url+'Searchdoctor/filter_search',filter_data);
//var filter_result = JSON.parse(filter_response);
// console.log(filter_response);
$('#searchresult').html(filter_response);
load_dynamic_map();
$('#search_filter_loader').addClass('hidden');
}
$('#reg-doc-temppic').hide();
function doc_loadthumbnail(file)
{
$('#reg-doc-temppic').show();
var tmppath = URL.createObjectURL(file.files[0]);
$('#reg-doc-temppic').attr('src',tmppath);
//console.log(file.files[0])
}
$('#reg-pat-temppic').hide();
function pat_loadthumbnail(file)
{
$('#reg-pat-temppic').show();
var tmppath = URL.createObjectURL(file.files[0]);
$('#reg-pat-temppic').attr('src',tmppath);
//console.log(file.files[0])
}
Global_getLocation = function()
{
if (navigator.geolocation)
{
var item = navigator.geolocation.getCurrentPosition(Global_showPosition);
}
}
Global_showPosition = function(position)
{
/*code for reverse geo location*/
var geocoder = new google.maps.Geocoder;
var latlng = {lat:position.coords.latitude, lng: position.coords.longitude};
geocoder.geocode({'location': latlng}, function(results, status)
{
if(status === 'OK')
{
if (results[1])
{
var marker = new google.maps.Marker({position: latlng});
console.log("position : ",position.coords.latitude,position.coords.longitude,results[3].formatted_address);
var location_finder = {'latitude' : position.coords.latitude,
'longitude' : position.coords.longitude,
'address' : results[3].formatted_address};
sessionStorage.location_finder = JSON.stringify(location_finder);
}
}
else
{
console.log('Cant Find Your Location!');
}
});
}
function cancel_consult(thiss)
{
var object = {'booking_id': thiss};
var result = post_ajax(base_url+'Patient/getBooking',object);
var items = JSON.parse(result);
$('#cancel-consult-modal-name').html(items.doc_name);
$('#cancel-consult-modal-spec').html(items.doc_specialization);
$('#cancel-consult-modal-date').html(items.book_date);
$('#cancel-consult-modal-time').html(items.book_time);
$('#cancel-consult-modal-pic').attr('src',items.doc_pic);
$('#cancel-consult-modal-btn').attr('bookingid',items.book_id);
$('#pop2').modal('show');
}
function change_consult(thiss)
{
var object = {'booking_id': thiss};
var result = post_ajax(base_url+'Patient/reScheduleConsultation',object);
var items = JSON.parse(result);
$('#reschedule_book_id').attr('value',items.book_id)
$('#reschedule_book_clinic').attr('value',items.clinic_id)
$('#reschedule_book_doctor').attr('value',items.doc_id)
$('#reschedule-consult-name').html(items.doc_name);
$('#reschedule-consult-spec').html(items.doc_specialization);
$('#reschedule-consult-date').html(items.book_date);
$('#reschedule-consult-time').html(items.book_time);
$('#reschedule-consult-pic').attr('src',items.doc_pic);
// $('#reschedule-consult-btn').attr('bookingid',items.book_id);
$('#pop4').modal('show');
}
$(function(){ $(function(){
/*DOCTOR SEARCH - COMPLETE PROFILE*/
/*----------------------------------*/
$('#complete_profile_appointment_nextbtn').on('click',function(){
var date_end = $('#appoint-week-view-day6').data('date');
var doc_id = $('#appoint-week-view-day6').data('docid');
var obj = { 'enddate':date_end,
'doctor_id':doc_id};
var result = post_ajax(base_url+'Searchdoctor/doctor_complete_profile_appointments_week_next',obj);
$('#complete_profile_appointment').html(result);
})
$('#complete_profile_appointment_prevbtn').on('click',function(){
var date_start = $('#appoint-week-view-day0').data('date');
var doc_id = $('#appoint-week-view-day0').data('docid');
var obj = { 'startdate':date_start,
'doctor_id':doc_id};
var result = post_ajax(base_url+'Searchdoctor/doctor_complete_profile_appointments_week_prev',obj);
$('#complete_profile_appointment').html(result);
})
/*----------------------------------*/
/*PATIENT DASHBOARD*/
/*----------------------------------*/
$('#cancel-consult-modal-btn').click(function()
{
var bookingid = $(this).attr('bookingid');
var object = {'booking_id':bookingid}
var result = post_ajax(base_url+'Patient/cancelBooking',object);
$('#confirmed-schedules-div').html(result);
$('#pop2').modal('hide');
})
$('#reschedule_book_date').on('changeDate', function(ev) {
$('#reschedule-consult-timeslot').html('<option disabled selected>Time Slots</option>');
var object = {'book_date':$('#reschedule_book_date').val(),'clinic_id':$('#reschedule_book_clinic').val(),
'doctor_id':$('#reschedule_book_doctor').val()}
var result = post_ajax(base_url+'Searchdoctor/getDoctorClinic_timeslot',object);
var elements = JSON.parse(result);
if(elements.length>0)
{
$.each(elements, function (i, item) {
$('#reschedule-consult-timeslot').append($('<option>', {
value: item.time,
text : item.time
}));
})
}
else
{
$('#reschedule-consult-timeslot').html('<option disabled selected>No Time Slot Available</option>');
}
});
$('#reschedule-consult-btn').click(function(){
if ($('#reschedule_book_form').parsley().validate() )
{
console.log($('#reschedule_book_form').serialize())
var result = post_ajax(base_url+'Searchdoctor/checkDoctorAvailability',$('#reschedule_book_form').serializeArray());
var items = JSON.parse(result);
if(items.status=="success"&&items.msg=="booking success")
{
var result = post_ajax(base_url+'Patient/updateBooking',$('#reschedule_book_form').serializeArray());
$('#pop4').modal('hide');
$('#confirmed-schedules-div').html(result);
}
else if(items.status=="fail"&&items.type=="doctor leave")
{
$('#err_reschedule_booking').html(items.msg).removeClass('hidden');
setTimeout(function(){
$('#err_reschedule_booking').addClass('hidden');
},10000);
}
else if(items.status=="fail"&&items.type=="booking slot")
{
$('#err_reschedule_booking').html(items.msg).removeClass('hidden');
setTimeout(function(){
$('#err_reschedule_booking').addClass('hidden');
},10000);
}
}
})
/*----------------------------------*/
/*CONFIRM BOOKING*/
/*----------------------------------*/
$('.timepicker-cus').timepicker();
$('#tab_login_back').click(function(){
$('.confirm-tab-2').removeClass('active');
$('#btnTrigger-review').click();
$('.confirm-tab-1').addClass('active');
});
$('#tab_payment_back').click(function(){
$('.confirm-tab-3').removeClass('active');
$('#btnTrigger-review').click();
$('.confirm-tab-1').addClass('active');
});
$('#confirm_book_date').on('changeDate', function(ev) {
$('#schedule-consult-timeslot').html('<option disabled selected>Time Slots</option>');
//console.log($('#confirm_book_date').val());
var object = {'book_date':$('#confirm_book_date').val(),'clinic_id':$('#confirm_book_clinic').val(),
'doctor_id':$('#confirm_book_doctor').val()}
var result = post_ajax(base_url+'Searchdoctor/getDoctorClinic_timeslot',object);
var elements = JSON.parse(result);
if(elements.length>0)
{
$.each(elements, function (i, item) {
$('#schedule-consult-timeslot').append($('<option>', {
value: item.time,
text : item.time
}));
})
}
else
{
$('#schedule-consult-timeslot').html('<option disabled selected>No Time Slot Available</option>');
}
});
$('#confirm_booking_continue_btn').click(function()
{
if ($('#confirm_book_form').parsley().validate() )
{
var result = post_ajax(base_url+'Searchdoctor/checkDoctorAvailability',$('#confirm_book_form').serializeArray());
var items = JSON.parse(result);
if(items.status=="success"&&items.isLogin=="false")
{
$('.confirm-tab-1').removeClass('active');
$('#btnTrigger-login').click();
$('.confirm-tab-2').addClass('active');
}
else if(items.status=="success"&&items.isLogin=="true")
{
post_ajax(base_url+'Searchdoctor/markbooking',$('#confirm_book_form').serializeArray());
$('.confirm-tab-1').removeClass('active');
$('#btnTrigger-payment').click();
$('.confirm-tab-3').addClass('active');
}
else if(items.status=="fail"&&items.type=="doctor leave")
{
$('#err_confirm_booking').html(items.msg).removeClass('hidden');
setTimeout(function(){
$('#err_confirm_booking').addClass('hidden');
},10000);
}
else if(items.status=="fail"&&items.type=="booking slot")
{
$('#err_confirm_booking').html(items.msg).removeClass('hidden');
setTimeout(function(){
$('#err_confirm_booking').addClass('hidden');
},10000);
}
}
})
$('#confirm-book-login_submit').click(function()
{
if ($('#confirm-book-login-form').parsley().validate() )
{
Global_getLocation();
setTimeout(function()
{
var curr_location = JSON.parse(sessionStorage.location_finder);
var LoginData = $('#confirm-book-login-form').serialize()+'&'+'latitude='+curr_location.latitude+'&'+'longitude='+curr_location.longitude+'&'+'address='+curr_location.address;
var result = post_ajax(base_url+'Home/login',LoginData);
var items = JSON.parse(result);
console.log(items);
if(items.status=="error"&&items.error=="Login Failed")
{
$('#err-login-ajax').html(items.message).removeClass('hidden');
setTimeout(function(){
$('#err-login-ajax').addClass('hidden');
},10000);
}
else if(items.status=="success")
{
var result_inner = post_ajax(base_url+'Searchdoctor/checkDoctorAvailability',$('#confirm_book_form').serializeArray());
var items_inner = JSON.parse(result_inner);
//console.log(items_inner)
if(items_inner.status=="success")
{
post_ajax(base_url+'Searchdoctor/markbooking',$('#confirm_book_form').serializeArray());
$('.confirm-tab-2').removeClass('active');
$('#btnTrigger-payment').click();
$('.confirm-tab-3').addClass('active');
}
else if(items_inner.status=="fail")
{
$('.confirm-tab-2').removeClass('active');
$('#btnTrigger-review').click();
$('.confirm-tab-1').addClass('active');
$('#err_confirm_booking').html(items_inner.msg).removeClass('hidden');
setTimeout(function(){
$('#err_confirm_booking').addClass('hidden');
},10000);
}
/* $('.confirm-tab-2').removeClass('active');
$('#btnTrigger-payment').click();
$('.confirm-tab-3').addClass('active');*/
}
},1000);
}
})
$('#book_payment_btn').click(function(){
var result = post_ajax(base_url+'Searchdoctor/booking_payment',$('#confirm_book_form').serializeArray());
var items = JSON.parse(result);
if(items.status=="success"&&items.payment_status=="1")
{
//console.log(items);
$('#book-date-show').html('On '+items.booking_date+' ');
$('#book-time-show').html(' at '+items.booking_slot);
$('.confirm-tab-3').removeClass('active');
$('#btnTrigger-confirmation').click();
$('.confirm-tab-4').addClass('active');
}
else if(items.status=="fail")
{
alert('payment error');
}
});
/*----------------------------------*/
/*DOCTOR SEARCH STARTS*/
/*----------------------------------*/
var search_place;
var input = document.getElementById('doctor_search_location');
var options = {
componentRestrictions: {
country: 'in'
},
types: ['(cities)']
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete, 'place_changed', function ()
{
search_place = autocomplete.getPlace();
console.log(search_place.formatted_address, search_place.geometry.location.lat(),search_place.geometry.location.lng());
});
$('.ip_search_home_search_btn').click(function()
{
var searchForm = document.getElementById('doctor-search-form');
if(document.getElementById('doctor_search_location').value!="")
{
$('#locationLattitude').val(search_place.geometry.location.lat());
$('#locationLongitude').val(search_place.geometry.location.lng());
searchForm.submit();
}
else
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition_home);
}
function showPosition_home(position)
{
console.log(position.coords.latitude,position.coords.longitude)
$('#locationLattitude').val(position.coords.latitude);
$('#locationLongitude').val(position.coords.longitude);
searchForm.submit();
}
}
})
/*DOCTOR SEARCH RESULT-PAGE STARTS*/
/*----------------------------------*/
var filter_input = document.getElementById('filter_dr_srch_loc');
var filter_options = {
componentRestrictions: {
country: 'in'
},
types: ['(cities)']
};
var filter_autocomplete = new google.maps.places.Autocomplete(filter_input, filter_options);
google.maps.event.addListener(filter_autocomplete, 'place_changed', function ()
{
var place = filter_autocomplete.getPlace();
console.log(place.formatted_address, place.geometry.location.lat(),place.geometry.location.lng());
$("#filter_dr_srch_lat" ).val(place.geometry.location.lat());
$("#filter_dr_srch_lng" ).val(place.geometry.location.lng());
});
$('.filter-change').on('change',function(){
$('#search_filter_loader').removeClass('hidden');
setTimeout(function(){
if($('#filter_dr_srch_loc').val()=="" || $('#filter_dr_srch_loc').val()==undefined|| $('#filter_dr_srch_loc').val()==null)
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
function showPosition(position)
{
$('#filter_dr_srch_lat').val(position.coords.latitude);
$('#filter_dr_srch_lng').val(position.coords.longitude);
// console.log($('#filter_dr_srch_lat').val(),$('#filter_dr_srch_lng').val())
load_filterchange();
}
}
else
{
load_filterchange();
}
},1500);
})
$('#load-more').click(function(){
});
/*----------------------------------*/
/*LOGIN-WIZARD STARTS*/
/*----------------------------------*/
$('.open-loginmodel').click(function(){
$('.clear-login-data').val("");
$('input[name=login_type]').prop('checked', false);
$("#login").modal("show");
})
$('#home_registernowbtn a').click(function()
{
$("#login").modal("hide");
$("#choose").modal("show");
})
$("#login_submit").click(function()
{
$('#err-login').addClass('hidden');
if ($('#login-form').parsley().validate() )
{
getLocation = function()
{
if (navigator.geolocation)
{
var item = navigator.geolocation.getCurrentPosition(showPosition);
}
}
showPosition = function(position) {
/*code for reverse geo location*/
var geocoder = new google.maps.Geocoder;
var latlng = {lat:position.coords.latitude, lng: position.coords.longitude};
geocoder.geocode({'location': latlng}, function(results, status)
{
if(status === 'OK')
{
if (results[1])
{
var marker = new google.maps.Marker({position: latlng});
console.log("position : ",position.coords.latitude,position.coords.longitude,results[3].formatted_address);
var location_finder = {'latitude' : position.coords.latitude,
'longitude' : position.coords.longitude,
'address' : results[3].formatted_address};
do_login(location_finder);
}
}
else
{
console.log('Cant Find Your Location!');
}
});
}
getLocation();
function do_login(location)
{
// var LoginData = new FormData(); // Currently empty
// LoginData.append('LoginData',$('#login-form').serialize()+'&'+'latitude='+location.latitude+'&'+'longitude='+location.longitude+'&'+'address='+location.address);
/* for (var key of LoginData.entries()) {
console.log(key[0] + ', ' + key[1]);
}*/
var LoginData = $('#login-form').serialize()+'&'+'latitude='+location.latitude+'&'+'longitude='+location.longitude+'&'+'address='+location.address;
var result = post_ajax(base_url+'Home/login',LoginData);
var items = JSON.parse(result);
console.log(items);
if(items.status=="success"&&items.data.type=="PATIENT")
{
$("#login").modal("hide");
window.location.reload();
}
else if(items.status=="success"&&items.data.type=="DOCTOR")
{
$("#login").modal("hide");
window.location.href='Doctor/';
}
if(items.status=="error"&&items.error=="Login Failed")
{
$("#err-login").html(items.message);
$('#err-login').removeClass('hidden');
}
else if(items.status=="error"&&items.error=="Location Update Failed")
{
$("#err-login").html(items.message);
$('#err-login').removeClass('hidden');
}
}
}
});
/*----------------------------------*/ /*----------------------------------*/
/*REGISTRATION-CHOOSE-WIZARD STARTS*/ /*REGISTRATION-CHOOSE-WIZARD STARTS*/
/*----------------------------------*/
$('#reg_choose_dct').click(function(){ $('#reg_choose_dct').click(function(){
// $('#choose').hide(); // $('#choose').hide();
$("#choose").modal("hide"); $("#choose").modal("hide");
$('#reg').modal("show"); //$('#reg').modal("show");
}) })
$('#reg_choose_pat').click(function(){ $('#reg_choose_pat').click(function(){
...@@ -14,9 +651,10 @@ $('#reg_choose_pat').click(function(){ ...@@ -14,9 +651,10 @@ $('#reg_choose_pat').click(function(){
}) })
/*----------------------------------*/ /*----------------------------------*/
/*----------------------------------*/
/*REGISTRATION-WIZARD STARTS*/
/*REGISTRATION-WIZARD STARTS*/
/*----------------------------------*/
/* $( "#reg_datepicker" ).datepicker({ /* $( "#reg_datepicker" ).datepicker({
format: 'mm/dd/yyyy', format: 'mm/dd/yyyy',
startDate: '-3d' startDate: '-3d'
...@@ -61,19 +699,13 @@ $('#reg_choose_pat').click(function(){ ...@@ -61,19 +699,13 @@ $('#reg_choose_pat').click(function(){
$('div.setup-panel div a.btn-success').trigger('click'); $('div.setup-panel div a.btn-success').trigger('click');
window.Parsley.addValidator('username', { window.Parsley.addValidator('email', {
requirementType: 'string', requirementType: 'string',
validateString: function(value, requirement) validateString: function(value, requirement)
{ {
var obj = {'email':value } var obj = {'email':value }
var status; var status;
$.ajax({ var result = post_ajax(base_url+'Home/check_email',obj);
type: 'POST',
url :'Home/check_email',
data : obj,
async : false,
success: function (result)
{
var items = JSON.parse(result); var items = JSON.parse(result);
if(items.message!="success") if(items.message!="success")
{ {
...@@ -83,13 +715,32 @@ $('#reg_choose_pat').click(function(){ ...@@ -83,13 +715,32 @@ $('#reg_choose_pat').click(function(){
{ {
status = true; status = true;
} }
}
});
return status; return status;
}, },
messages: { en: 'This email address already exists!' } messages: { en: 'This email address already exists!' }
}); });
window.Parsley.addValidator('username', {
requirementType: 'string',
validateString: function(value, requirement)
{
var obj = {'username':value }
var status;
var result = post_ajax(base_url+'Home/check_username',obj);
var items = JSON.parse(result);
if(items.message!="success")
{
status = false;
}
else
{
status = true;
}
return status;
},
messages: { en: 'Username not Available!' }
});
$(".nextBtn-1").click(function() $(".nextBtn-1").click(function()
{ {
if ($('#reg-form-patient-1').parsley().validate() ) if ($('#reg-form-patient-1').parsley().validate() )
...@@ -134,16 +785,20 @@ $('#reg_choose_pat').click(function(){ ...@@ -134,16 +785,20 @@ $('#reg_choose_pat').click(function(){
if ($('#reg-form-patient-4').parsley().validate() ) if ($('#reg-form-patient-4').parsley().validate() )
{ {
var formData = new FormData(); // Currently empty var formData = new FormData(); // Currently empty
formData.append('data',$('#reg-form-patient-1').serialize()+'&'+$('#reg-form-patient-2').serialize()+'&'+$('#reg-form-patient-3').serialize()+'&'+$('#reg-form-patient-4').serialize()); formData.append('data',$('#reg-form-patient-1').serialize()+'&'+$('#reg-form-patient-2').serialize()+'&'+$('#reg-form-patient-3').serialize()+'&'+$('#reg-form-patient-4').serialize());
if(!$('#reg_pat_pic').hasClass('from-facebook'))
{
formData.append('pic', $('#reg_pat_pic')[0].files[0]); // Attach file formData.append('pic', $('#reg_pat_pic')[0].files[0]); // Attach file
/*for (var key of formData.entries()) { }
/* for (var key of formData.entries()) {
console.log(key[0] + ', ' + key[1]); console.log(key[0] + ', ' + key[1]);
}*/ }*/
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url :'Home/reg_patient', url : base_url+'Home/reg_patient',
data : formData, data : formData,
async : false, async : false,
contentType: false, // NEEDED, DON'T OMIT THIS (requires jQuery 1.6+) contentType: false, // NEEDED, DON'T OMIT THIS (requires jQuery 1.6+)
...@@ -152,13 +807,25 @@ $('#reg_choose_pat').click(function(){ ...@@ -152,13 +807,25 @@ $('#reg_choose_pat').click(function(){
{ {
//console.log(result) //console.log(result)
var items = JSON.parse(result); var items = JSON.parse(result);
//console.log(items.status) console.log(items)
if(items.status=="success") if(items.status=="success")
{ {
$('.reset-form-custom').val(""); $('.reset-form-custom').val("");
$('input[name=reg_pat_gender]').prop('checked', false); $('input[name=reg_pat_gender]').prop('checked', false);
$('#regpaitent').modal("hide"); $('#regpaitent').modal("hide");
prevStep("step-2"); prevStep("step-2");
$('#pat-reg-success').removeClass('hidden');
setTimeout(function(){$('#pat-reg-success').addClass('hidden');},7000);
}
else if(items.status=="failure")
{
//console.log(items.error,items.message)
$('.reset-form-custom').val("");
$('input[name=reg_pat_gender]').prop('checked', false);
$('#regpaitent').modal("hide");
prevStep("step-2");
$('#pat-reg-error').removeClass('hidden');
setTimeout(function(){$('#pat-reg-error').addClass('hidden');},7000);
} }
} }
...@@ -174,11 +841,62 @@ $('#reg_choose_pat').click(function(){ ...@@ -174,11 +841,62 @@ $('#reg_choose_pat').click(function(){
}) })
/*REGISTRATION-WIZARD ENDS*/ /*REGISTRATION-WIZARD ENDS*/
/*DOCTOR REGISTRATION-WIZARD STARTS*/
/*----------------------------------*/
window.Parsley.addValidator('usernamedoc', {
requirementType: 'string',
validateString: function(value, requirement)
{
var obj = {'username':value }
var status;
var result = post_ajax(base_url+'Home/check_username_doc',obj);
var items = JSON.parse(result);
if(items.message!="success")
{
status = false;
}
else
{
status = true;
}
return status;
},
messages: { en: 'Username not Available!' }
});
window.Parsley.addValidator('emaildoc', {
requirementType: 'string',
validateString: function(value, requirement)
{
var obj = {'email':value }
var status;
var result = post_ajax(base_url+'Home/check_email_doc',obj);
var items = JSON.parse(result);
if(items.message!="success")
{
status = false;
}
else
{
status = true;
}
return status;
},
messages: { en: 'Email not Available!' }
});
/*DOCTOR REGISTRATION-WIZARD ENDS*/
/*DATEPICKER JS*/ /*DATEPICKER JS*/
$('#sandbox-container input').datepicker({ $('#sandbox-container input').datepicker({
autoclose: true autoclose: true,
}); onSelect: function(dateText) {
console.log("Selected date: " + dateText + "; input's current value: " + this.value);
}
})/*.on('changeDate', function(ev) {
console.log($('#confirm_book_date').val());
});*/
$('#sandbox-container input').on('show', function(e){ $('#sandbox-container input').on('show', function(e){
console.debug('show', e.date, $(this).data('stickyDate')); console.debug('show', e.date, $(this).data('stickyDate'));
...@@ -277,29 +995,34 @@ $('#sandbox-container input').on('hide', function(e){ ...@@ -277,29 +995,34 @@ $('#sandbox-container input').on('hide', function(e){
/*DISTANCE-RANGE-SLIDER*/ /*DISTANCE-RANGE-SLIDER*/
$( "#ip_filter_distance_range" ).slider({ /*$( "#ip_filter_distance_start" ).val("0 km" );
$( "#ip_filter_distance_end" ).val("10 km" );*/
$( "#ip_filter_distance_range" ).slider({
range: true, range: true,
min: 0, min: 0,
max: 99, max: 99,
values: [ 25,75 ], values: [ 0,10 ],
slide: function( event, ui ) { slide: function( event, ui ) {
$( "#start" ).val(ui.values[ 0 ] + " km" ); // console.log(event, ui )
$( "#end" ).val(ui.values[ 1 ] + " km" ); $( "#ip_filter_distance_start" ).val(ui.values[ 0 ] + " km" );
$( "#ip_filter_distance_end" ).val(ui.values[ 1 ] + " km" ).trigger('change');
} }
}); });
/*----------------------------------*/ /*----------------------------------*/
/*PRICE-RANGE-SLIDER*/ /*PRICE-RANGE-SLIDER*/
/*$( "#ip_filter_price_low" ).val("R$ 100");
$( "#ip_filter_price_high" ).val("R$ 500");*/
$( "#ip_price_slider" ).slider({ $( "#ip_price_slider" ).slider({
range: true, range: true,
min: 0, min: 0,
max: 500, max: 3000,
values: [ 75, 300 ], values: [ 100, 500 ],
slide: function( event, ui ) { slide: function( event, ui ) {
$( "#low" ).val( "R$ " + ui.values[ 0 ]); $( "#ip_filter_price_low" ).val( "R$ " + ui.values[ 0 ]);
$( "#high" ).val( "R$ " + ui.values[ 1 ]); $( "#ip_filter_price_high" ).val( "R$ " + ui.values[ 1 ]).trigger('change');
} }
}); });
...@@ -307,13 +1030,19 @@ $('#sandbox-container input').on('hide', function(e){ ...@@ -307,13 +1030,19 @@ $('#sandbox-container input').on('hide', function(e){
/*SEARCH-RESULT-DATEPICKER*/ /*SEARCH-RESULT-DATEPICKER*/
$( "#ip_datepicker" ).datepicker(); $( "#ip_datepicker_srch" ).datepicker({
autoclose:true
});
/*----------------------------------*/ /*----------------------------------*/
/*APPOINTMENT-CALENDER*/ /*APPOINTMENT-CALENDER*/
$( "#ip_appointment_calender" ).datepicker(); $( "#ip_appointment_calender" ).datepicker({
autoclose:true,
todayHighlight: true
});
/*----------------------------------*/ /*----------------------------------*/
...@@ -324,6 +1053,375 @@ $('#ip_timepicker').timepicker(); ...@@ -324,6 +1053,375 @@ $('#ip_timepicker').timepicker();
/*----------------------------------*/ /*----------------------------------*/
/*DOCTOR DASHBOARD*/
var days = ['mon','tue','wed','thu','fri','sat','sun'];
$('.dctr_dsh_timepicker').timepicker();
$('#doc_sel_clinic').change(function(){
var obj = {"clinic_id": $('#doc_sel_clinic').val()};
//console.log("obj",obj);
$('.ip_schedule_week input').prop('checked', false);
for(i = 0 ; i < days.length ; i++)
{
$('#sch_'+days[i]+'_start').val('');
$('#sch_'+days[i]+'_end').val('');
$('#sch_'+days[i]+'_int').val("Time").trigger('change');
$('#clinic_day_'+days[i]+'_div').addClass('inp-dis');
$('#clinic_day_'+days[i]+'_div input').attr('disabled','disabled');
$('#clinic_day_'+days[i]+'_div input').removeAttr('data-parsley-required');
$('#clinic_day_'+days[i]+'_div select').attr('disabled','disabled');
$('#clinic_day_'+days[i]+'_div select').removeAttr('required');
}
var result = post_ajax(base_url+'Doctor/getScheduleforClinic',obj);
var items = JSON.parse(result);
$('.ip_schedule_week input').removeAttr('disabled'); //remove disabled
if(items.status=="success"&&items.data!="")
{
var ScheduleData = JSON.parse(items.data);
// console.log(ScheduleData);
Object.keys(ScheduleData).forEach(function(key,index)
{
// key: the name of the object key
// index: the ordinal position of the key within the object
var elem = ScheduleData[index];
if(elem.day=="mon"||elem.day=="tue"||elem.day=="wed"||elem.day=="thu"||elem.day=="fri"||elem.day=="sat"||elem.day=="sun")
{
//$('input[name=login_type]').prop('checked', false);
$('#clinic_day_'+elem.day).prop('checked', true);
var start_timestamp = new Date('01/01/2017 '+elem.time.start).getTime();
var end_timestamp = new Date('01/01/2017 '+elem.time.end).getTime();
//console.log(start_timestamp,end_timestamp)
$('#sch_'+elem.day+'_start').timepicker('setTime', new Date(start_timestamp));
$('#sch_'+elem.day+'_end').timepicker('setTime', new Date(end_timestamp));
$('#sch_'+elem.day+'_int').val(elem.time.interval).trigger('change');
$('#clinic_day_'+elem.day+'_div').removeClass('inp-dis');
$('#clinic_day_'+elem.day+'_div input').removeAttr('disabled');
$('#clinic_day_'+elem.day+'_div input').attr('data-parsley-required','true');
$('#clinic_day_'+elem.day+'_div select').removeAttr('disabled');
$('#clinic_day_'+elem.day+'_div select').attr('required','true');
}
});
}
})
$('#clinic_day_mon').change(function()
{
var $check = $(this),
$div = $('#clinic_day_mon_div');
if ($check.prop('checked'))
{
$div.removeClass('inp-dis');
$('#clinic_day_mon_div input').removeAttr('disabled');
$('#clinic_day_mon_div input').attr('data-parsley-required','true');
$('#clinic_day_mon_div select').removeAttr('disabled');
$('#clinic_day_mon_div select').attr('required','true');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_mon_div input').attr('disabled','disabled');
$('#clinic_day_mon_div input').removeAttr('data-parsley-required');
$('#clinic_day_mon_div select').attr('disabled','disabled');}
$('#clinic_day_mon_div select').removeAttr('required');
});
$('#clinic_day_tue').change(function()
{
var $check = $(this),
$div = $('#clinic_day_tue_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_tue_div input').removeAttr('disabled');
$('#clinic_day_tue_div input').attr('data-parsley-required','true');
$('#clinic_day_tue_div select').attr('required','true');
$('#clinic_day_tue_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_tue_div input').attr('disabled','disabled');
$('#clinic_day_tue_div input').removeAttr('data-parsley-required');
$('#clinic_day_tue_div select').removeAttr('required');
$('#clinic_day_tue_div select').attr('disabled','disabled');}
});
$('#clinic_day_wed').change(function()
{
var $check = $(this),
$div = $('#clinic_day_wed_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_wed_div input').removeAttr('disabled');
$('#clinic_day_wed_div input').attr('data-parsley-required','true');
$('#clinic_day_wed_div select').attr('required','true');
$('#clinic_day_wed_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_wed_div input').attr('disabled','disabled');
$('#clinic_day_wed_div input').removeAttr('data-parsley-required');
$('#clinic_day_wed_div select').removeAttr('required');
$('#clinic_day_wed_div select').attr('disabled','disabled');}
});
$('#clinic_day_thu').change(function()
{
var $check = $(this),
$div = $('#clinic_day_thu_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_thu_div input').removeAttr('disabled');
$('#clinic_day_thu_div input').attr('data-parsley-required','true');
$('#clinic_day_thu_div select').attr('required','true');
$('#clinic_day_thu_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_thu_div input').attr('disabled','disabled');
$('#clinic_day_thu_div input').removeAttr('data-parsley-required');
$('#clinic_day_thu_div select').removeAttr('required');
$('#clinic_day_thu_div select').attr('disabled','disabled');}
});
$('#clinic_day_fri').change(function()
{
var $check = $(this),
$div = $('#clinic_day_fri_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_fri_div input').removeAttr('disabled');
$('#clinic_day_fri_div input').attr('data-parsley-required','true');
$('#clinic_day_fri_div select').attr('required','true');
$('#clinic_day_fri_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_fri_div input').attr('disabled','disabled');
$('#clinic_day_fri_div input').removeAttr('data-parsley-required');
$('#clinic_day_fri_div select').removeAttr('required');
$('#clinic_day_fri_div select').attr('disabled','disabled');}
});
$('#clinic_day_sat').change(function()
{
var $check = $(this),
$div = $('#clinic_day_sat_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_sat_div input').removeAttr('disabled');
$('#clinic_day_sat_div input').attr('data-parsley-required','true');
$('#clinic_day_sat_div select').attr('required','true');
$('#clinic_day_sat_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_sat_div input').attr('disabled','disabled');
$('#clinic_day_sat_div input').removeAttr('data-parsley-required');
$('#clinic_day_sat_div select').removeAttr('required');
$('#clinic_day_sat_div select').attr('disabled','disabled');}
});
$('#clinic_day_sun').change(function()
{
var $check = $(this),
$div = $('#clinic_day_sun_div');
if ($check.prop('checked'))
{ $div.removeClass('inp-dis');
$('#clinic_day_sun_div input').removeAttr('disabled');
$('#clinic_day_sat_div input').attr('data-parsley-required','true');
$('#clinic_day_sat_div select').attr('required','true');
$('#clinic_day_sun_div select').removeAttr('disabled');
}
else {
$div.addClass('inp-dis');
$('#clinic_day_sun_div input').attr('disabled','disabled');
$('#clinic_day_sat_div input').removeAttr('data-parsley-required');
$('#clinic_day_sat_div select').removeAttr('required');
$('#clinic_day_sun_div select').attr('disabled','disabled');}
});
window.Parsley
.addValidator('mintime', {
requirementType: 'string',
validateString: function(value, requirement)
{ defaultDate = "01/01/17";
//console.log($(requirement).val())
var time1 = defaultDate+' '+value;
var time2 = defaultDate+' '+$(requirement).val();
var date1 = Date.parse(time1);
var date2 = Date.parse(time2);
// console.log(time1);
//console.log("end",date1);
//console.log("start",date2);
if(date1 > date2){
return true;
}
else{ return false; }
},
messages: {
en: 'Time should be greater than Start Time'
}
});
window.Parsley
.addValidator('mindate', {
requirementType: 'string',
validateString: function(value, requirement)
{
var val1 = value;
var val2 = $(requirement).val();
var date1 = Date.parse(val1);
var date2 = Date.parse(val2);
/* console.log("end",date1);
console.log("start",date2);*/
if(date1 > date2){
return true;
}
else{ return false; }
},
messages: {
en: 'Invalid End Date'
}
});
$('#doc_sch_sub').click(function(){
if ($('#doc_sch_sub_form').parsley().validate() )
{
//console.log($('#doc_sch_sub_form').serializeArray());
var result = post_ajax(base_url+'Doctor/addSchedule',$('#doc_sch_sub_form').serializeArray());
var items = JSON.parse(result);
// console.log(result);
if(items.status=='success'&&items.msg=="Successfully assigned")
{
$('#add_schedule_success').removeClass('hidden');
$('#doc_sel_clinic').val("Select Clinic").trigger('change');
setTimeout(function(){
$('#add_schedule_success').addClass('hidden');
},5000)
}
else if(items.status=='fail'&&items.msg=="Schedule Assiging Failed")
{
$('#add_schedule_fail').removeClass('hidden');
setTimeout(function(){
$('#add_schedule_fail').addClass('hidden');
},5000)
}
}
});
$('#doc_leave_sub').click(function()
{
if ($('#doc_leave_sub_form').parsley().validate() )
{
var result = post_ajax(base_url+'Doctor/addVacation',$('#doc_leave_sub_form').serializeArray());
var items = JSON.parse(result);
console.log(result);
if(items.status=='success')
{
$('#add_vacation_success').removeClass('hidden');
$('#doc_leave_clinic').val("Select Clinic");
$('#dctr_leave_start,#dctr_leave_end').val("");
setTimeout(function(){
$('#add_vacation_success').addClass('hidden');
},5000)
}
else if(items.status=='fail')
{
$('#add_vacation_fail').removeClass('hidden');
setTimeout(function(){
$('#add_vacation_fail').addClass('hidden');
},5000)
}
}
})
$('#ip_appointment_calender').on('changeDate', function(ev) {
var objDate = new Date( $('#ip_appointment_calender').val()),locale = "en-us",month = objDate.toLocaleString(locale, { month: "long" });
var today = new Date($('#ip_appointment_calender').val());
var day = today.getDate();
$('.ip_current_date').html(day);
$('.ip_current_month').html(month);
var obj = {'appointment_day' : $('#ip_appointment_calender').val()}
$('#ip_appointment_calender').attr('value',obj.appointment_day);
var result = post_ajax(base_url+'Doctor/get_myappointments_day',obj);
$('#ip-appointments-day').html(result);
});
$('#appointments_day_nextbtn').on('click',function(){
var tomorrow = new Date($('#ip_appointment_calender').val());
tomorrow.setDate(tomorrow.getDate() + 1);
today_mnth = tomorrow.getMonth()+1;
today_day = tomorrow.getDate();
today_year = tomorrow.getFullYear();
var next_day = today_mnth+'/'+today_day+'/'+today_year;
$('#ip_appointment_calender').datepicker('update',next_day).trigger('changeDate');
});
$('#appointments_day_prevbtn').on('click',function(){
var tomorrow = new Date($('#ip_appointment_calender').val());
tomorrow.setDate(tomorrow.getDate() - 1);
today_mnth = tomorrow.getMonth()+1;
today_day = tomorrow.getDate();
today_year = tomorrow.getFullYear();
var prev_day = today_mnth+'/'+today_day+'/'+today_year;
$('#ip_appointment_calender').datepicker('update',prev_day).trigger('changeDate');
});
$('#appointments_day_todaybtn').on('click',function(){
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate());
today_mnth = tomorrow.getMonth()+1;
today_day = tomorrow.getDate();
today_year = tomorrow.getFullYear();
var today_day = today_mnth+'/'+today_day+'/'+today_year;
$('#ip_appointment_calender').datepicker('update',today_day).trigger('changeDate');
});
/*function daysInMonth(month,year) {
return new Date(year, month, 0).getDate();
}
*/
//July
//alert(daysInMonth(12,2017)); //31
var month_names = ['January', 'February', 'March','April', 'May', 'June', 'July','August', 'September', 'October', 'November', 'December'];
new_date = new Date();
$('.ip_current_date').html(new_date.getDate());
$('.ip_current_month').html(month_names[new_date.getMonth()]);
//alert(n+'-'+d.getFullYear()+'-'+d.getDate())
$('.dctr_dash_appoint_day').on("click", function(){
$('#appointments_day_todaybtn,#appointments_day_nextbtn,#appointments_day_prevbtn').removeAttr("disabled");
});
$('.dctr_dash_appoint_week').on("click", function(){
$('#appointments_day_todaybtn,#appointments_day_nextbtn,#appointments_day_prevbtn').attr('disabled','disabled');
var result = post_ajax(base_url+'Doctor/doctor_appointments_week');
$('#dctr_week_appointment').html(result);
});
$('.dctr_dash_appoint_month').on("click", function(){
$('#appointments_day_todaybtn,#appointments_day_nextbtn,#appointments_day_prevbtn').attr('disabled','disabled');
var result = post_ajax(base_url+'Doctor/doctor_appointments_month');
$('#dctr_month_appointment').html(result);
});
/*----------------------------------*/
/*SEARCH-RESULT-MAPS*/ /*SEARCH-RESULT-MAPS*/
var map; var map;
...@@ -464,4 +1562,78 @@ document.getElementById("search-text").addEventListener("click", function (event ...@@ -464,4 +1562,78 @@ document.getElementById("search-text").addEventListener("click", function (event
/*----------------------------------*/ /*----------------------------------*/
/*RATTING-SCRIPTS*/
$(".ip_star_rate_toggle_btn:not('.noscript') input[type=radio]")
.addClass("ip_filter_visuallyhidden")
.change(function() {
if( $(this).attr("name") ) {
$(this).parent().addClass("ip_star_rate_toggle_btn_focus").siblings().removeClass("ip_star_rate_toggle_btn_focus")
} else {
$(this).parent().toggleClass("ip_star_rate_toggle_btn_focus");
}
});
/*----------------------------------*/
/*FILTER-SCRIPTS*/
$(".ip_filter_more_list_toggle_btn:not('.noscript') input[type=radio]")
.addClass("ip_filter_visuallyhidden");
$(".ip_filter_more_list_toggle_btn:not('.noscript') input[type=radio]")
.change(function() {
$(".ip_filter_more_list_toggle_btn").removeClass("ip_filter_more_list_toggle_focus");
if( $(this).prop("checked") == true ) {
// alert($(this).attr("name"))
$(this).parent().addClass("ip_filter_more_list_toggle_focus");
} else {
$(this).parent().removeClass("ip_filter_more_list_toggle_focus");
}
/*$(this).parent().addClass("ip_filter_more_list_toggle_focus").siblings().removeClass("ip_filter_more_list_toggle_focus");
if($(this).is(':checked')) {
$(this).parent().toggleClass("ip_filter_more_list_toggle_focus");
}*/
});
/*----------------------------------*/
/* RETURN-SCRIPT */
$(".ip_return_option_toggle_btn:not('.noscript') input[type=radio]")
.addClass("ip_filter_visuallyhidden")
.change(function() {
if( $(this).attr("name") ) {
$(this).parent().addClass("ip_return_option_toggle_focus").siblings().removeClass("ip_return_option_toggle_focus")
} else {
$(this).parent().toggleClass("ip_return_option_toggle_focus");
}
});
/*----------------------------------*/
$(".ip_sort_more_list_toggle_btn:not('.noscript') input[type=checkbox]")
.addClass("ip_sort_visuallyhidden")
.change(function() {
if( $(this).attr("name") ) {
$(this).parent().addClass("ip_sort_more_list_toggle_focus").siblings().removeClass("ip_sort_more_list_toggle_focus")
} else {
$(this).parent().toggleClass("ip_sort_more_list_toggle_focus");
}
});
}); });
$('.cus-map').on('shown.bs.collapse', function () {
var id = $(this).find('.map_data').first().attr("id");
initialize_map(id);
})
function load_dynamic_map(){
$('.cus-map').on('shown.bs.collapse', function () {
var id = $(this).find('.map_data').first().attr("id");
initialize_map(id);
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment