Commit a5ae8345 by Tobin

Merge branch 'master' into 'dev_production'

Master See merge request !18
parents 6004f14c 5f1cf3e1
...@@ -308,6 +308,17 @@ class Api extends CI_Controller { ...@@ -308,6 +308,17 @@ class Api extends CI_Controller {
} }
} }
public function save_organizer(){
$data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Api_model->save_organizer($data);
if($res['status']!=0){
$this->response($res['status']);
}
else{
$this->errorResponse($res['code'],$res['message']);
}
}
public function payNow($auth_token='',$amount=0,$booking_id='',$event_id=''){ public function payNow($auth_token='',$amount=0,$booking_id='',$event_id=''){
if(empty($auth_token) || empty($amount) || empty($booking_id)){ if(empty($auth_token) || empty($amount) || empty($booking_id)){
redirect('https://projects.nuvento.com/failure'); redirect('https://projects.nuvento.com/failure');
......
...@@ -42,7 +42,7 @@ class Provider extends CI_Controller { ...@@ -42,7 +42,7 @@ class Provider extends CI_Controller {
!is_numeric($provider_id = decode_param($_POST['provider_id']))){ !is_numeric($provider_id = decode_param($_POST['provider_id']))){
echo json_encode($resArr);exit; echo json_encode($resArr);exit;
} }
$view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:0; $view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:'0,1';
$mechData = $this->Provider_model->getProviderData($provider_id,$view_all); $mechData = $this->Provider_model->getProviderData($provider_id,$view_all);
if(empty($mechData)){ if(empty($mechData)){
...@@ -230,7 +230,6 @@ class Provider extends CI_Controller { ...@@ -230,7 +230,6 @@ class Provider extends CI_Controller {
$provider_id = $this->session->userdata('id'); $provider_id = $this->session->userdata('id');
} }
} }
$template['page'] = 'Provider/providerPayDetails'; $template['page'] = 'Provider/providerPayDetails';
$template['page_desc'] = "Payment Details"; $template['page_desc'] = "Payment Details";
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
function genQRcode($data){ function genQRcode($data){
include 'qr_code/autoload.php'; include 'qr_code/autoload.php';
$logo = 'assets/images/asset_logo.png'; $logo = 'assets/images/qr-cod-icon.png';
$QR = imagecreatefrompng('https://chart.googleapis.com/chart?cht=qr&chld=H|1&chs=500x500&chl='.urlencode($data)); $QR = imagecreatefrompng('https://chart.googleapis.com/chart?cht=qr&chld=H|1&chs=500x500&chl='.urlencode($data));
$logo = imagecreatefromstring(file_get_contents($logo)); $logo = imagecreatefromstring(file_get_contents($logo));
...@@ -125,4 +125,24 @@ ...@@ -125,4 +125,24 @@
include 'BayanPayPaymentLibrary.php'; include 'BayanPayPaymentLibrary.php';
} }
// function resizeImage($file=array()){
// if(empty($file) || ($size = $file['size']/1024) < 100 ||
// empty($info = getimagesize($file['tmp_name'])) || $info['mime'] == 'image/gif'){
// return false;
// }
// $resize = 100 - ((100/$size)*100);
// pre($resize);
// if ($info['mime'] == 'image/jpeg') {
// $fname = 'assets/uploads/services/img_upload_'.time().'.jpg';
// $image = imagecreatefromjpeg($file['tmp_name']);
// imagejpeg($image,$fname,$resize);
// }
// else if ($info['mime'] == 'image/png') {
// $fname = 'assets/uploads/services/img_upload_'.time().'.png';
// $image = imagecreatefromjpeg($file['tmp_name']);
// imagepng($image,$fname,$resize);
// }
// return $fname;
// }
?> ?>
\ No newline at end of file
...@@ -34,7 +34,10 @@ class Api_model extends CI_Model { ...@@ -34,7 +34,10 @@ class Api_model extends CI_Model {
function register($data) { function register($data) {
try{ try{
$res_count = $this->db->where('email',$data['email_id'])->or_where('phone',$data['phone'])->get('customer')->row(); $email = $data['email_id'];
$phone = $data['phone'];
$res_count = $this->db->query("SELECT * FROM customer INNER JOIN `users` ON users.id = customer.customer_id AND users.user_type = 3 WHERE users.status = 1 AND (customer.email = '$email' OR customer.phone = '$phone')")->row();
//$res_count = $this->db->where('email',$data['email_id'])->where()->or_where('phone',$data['phone'])->get('customer')->row();
if(count($res_count) > 0) { if(count($res_count) > 0) {
if($res_count->email == $data['email_id'] && $res_count->phone == $data['phone']){ if($res_count->email == $data['email_id'] && $res_count->phone == $data['phone']){
$res = array('status'=>0,'message'=>'Already have an account with email id and phone no. Please login','code'=>'ER12'); $res = array('status'=>0,'message'=>'Already have an account with email id and phone no. Please login','code'=>'ER12');
...@@ -58,7 +61,8 @@ class Api_model extends CI_Model { ...@@ -58,7 +61,8 @@ class Api_model extends CI_Model {
$customer_data = array( $customer_data = array(
'customer_id'=>$id, 'customer_id'=>$id,
'phone'=>$data['phone'], 'phone'=>$data['phone'],
'email'=>$data['email_id'] 'email'=>$data['email_id'],
'name'=>$data['name']
); );
$this->db->insert('customer', $customer_data); $this->db->insert('customer', $customer_data);
...@@ -922,5 +926,23 @@ class Api_model extends CI_Model { ...@@ -922,5 +926,23 @@ class Api_model extends CI_Model {
} }
return $res; return $res;
} }
public function save_organizer($data){
try{
$count=$this->db->get_where('users',array('username'=>$data['email_id']))->num_rows();
if($count > 0){
$res = array('status'=>0,'message'=>'Email Id Already Exist','code'=>'ER06');
}else{
$this->db->insert('users',array('username'=>$data['email_id'],'password'=>md5($data['password']),'display_name'=>$data['name'],'status'=>'0'));
$last_id = $this->db->insert_id();
if($this->db->insert('provider',array('provider_id'=>$last_id,'name'=>$data['name'],'email'=>$data['email_id'],'phone'=>$data['phone']))){
$res = array('status'=>1);
}
}
}catch(Exception $e){
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
}
return $res;
}
} }
?> ?>
...@@ -262,6 +262,40 @@ class Validation_model extends CI_Model { ...@@ -262,6 +262,40 @@ class Validation_model extends CI_Model {
) )
) , ) ,
) , ) ,
'save_organizer' => array(
'name' => array(
'required' => array(
'code' => 'ER27',
'message' => 'Name is null or empty'
)
) ,
'phone' => array(
'required' => array(
'code' => 'ER08',
'message' => 'Phone Number is null or empty'
),
'phone' => array(
'code' => 'ER08',
'message' => 'Invalid Phone no'
) ,
),
'email_id' => array(
'required' => array(
'code' => 'ER02',
'message' => 'Email Id is null or empty'
),
'email' => array(
'code' => 'ER03',
'message' => 'Invalid Email id'
)
),
'password' => array(
'required' => array(
'code' => 'ER04',
'message' => 'Password is null or empty'
)
)
) ,
'payNow' => array(), 'payNow' => array(),
'searchEvent' => array() 'searchEvent' => array()
); );
......
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