diff --git a/application/controllers/Notification.php b/application/controllers/Notification.php index f8b6ba8..9b605fc 100644 --- a/application/controllers/Notification.php +++ b/application/controllers/Notification.php @@ -64,6 +64,9 @@ class Notification extends CI_Controller { if(!isset($_POST['registration_mail']) || empty($_POST['registration_mail'])){ unset($_POST['registration_mail']); } + if(!isset($_POST['provider_verify_mail']) || empty($_POST['provider_verify_mail'])){ + unset($_POST['provider_verify_mail']); + } if(!isset($_POST['checker_activation_mail']) || empty($_POST['checker_activation_mail'])){ unset($_POST['checker_activation_mail']); } diff --git a/application/controllers/Provider.php b/application/controllers/Provider.php index de5c915..95f75d7 100644 --- a/application/controllers/Provider.php +++ b/application/controllers/Provider.php @@ -31,7 +31,7 @@ class Provider extends CI_Controller { $template['pDescription'] = "View and Manage Organizers"; $template['page_head'] = "Organizer Management"; - $template['provider_data'] = $this->Provider_model->getProviderData('','0,1'); + $template['provider_data'] = $this->Provider_model->getProviderData(''); $this->load->view('template',$template); } @@ -198,7 +198,7 @@ class Provider extends CI_Controller { $template['pTitle'] = "Edit Organizers"; $template['pDescription'] = "Update Organizer Data"; - $template['provider_data'] = $this->Provider_model->getProviderData($provider_id,1); + $template['provider_data'] = $this->Provider_model->getProviderData($provider_id,'0,1'); $template['provider_id'] = encode_param($provider_id); $this->load->view('template',$template); } @@ -315,5 +315,44 @@ class Provider extends CI_Controller { $this->session->set_flashdata('message', $flashMsg); redirect(base_url('Provider/getProviderPayDetails/'.$_POST['provider_id'])); } + + function resetPassword($provider_id = ''){ + $flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error'); + if(empty($provider_id) || !is_numeric($provider_id = decode_param($provider_id))){ + $this->session->set_flashdata('message', $flashMsg); + redirect(base_url('Provider/viewProviders')); + } + $unique_id = $this->Provider_model->resetPassword($provider_id); + $providerData = $this->Provider_model->getProviderData($provider_id); + + if(empty($unique_id) || empty($providerData)){ + $this->session->set_flashdata('message', $flashMsg); + redirect(base_url('Provider/viewProviders')); + } + + $this->load->model('Api_model'); + $subject = "New Password for Organizer Account"; + $email_id = $providerData->email; + $template = getNotifTemplate(); + $message = "<html> + <body> + New password of your Organizer Account for the username + <strong>".$providerData->username."</strong> is <strong>".$unique_id."</strong><br> + </body> + </html>"; + + if(isset($template['provider_verify_mail']) && !empty($template['provider_verify_mail'])){ + $message = str_replace(array('{:user_name}','{:password}'), + array($providerData->username,$resetLink), + $template['provider_verify_mail']); + } + $this->Api_model->send_mail($subject,$email_id,$message); + + $flashMsg = array('message'=>'Password Generated..!','class'=>'success'); + $this->session->set_flashdata('message', $flashMsg); + redirect(base_url('Provider/viewProviders')); + } + + } ?> \ No newline at end of file diff --git a/application/models/Api_model.php b/application/models/Api_model.php index 6286b5a..d648cd4 100644 --- a/application/models/Api_model.php +++ b/application/models/Api_model.php @@ -137,7 +137,6 @@ class Api_model extends CI_Model { $ci->email->from('no-reply@nuvento.com', 'TimeOut'); $ci->email->to($email); - $ci->email->cc('epocnova@gmail.com'); $ci->email->subject($subject); $ci->email->message($message); $ci->email->set_mailtype('html'); @@ -686,7 +685,7 @@ class Api_model extends CI_Model { FROM review WHERE event_id=$rs->event_id"; $rating = $this->db->query($sql)->row_array(); $rate = isset($rating['rate'])&&!empty($rating['rate'])? - $rating['rate']:'0.0'; + round($rating['rate'],1):'0.0'; $sql = "SELECT SUM(booking.no_of_ticket) AS attend FROM booking WHERE status IN (1,2) AND event_id=$rs->event_id"; diff --git a/application/models/Provider_model.php b/application/models/Provider_model.php index f039033..a04e179 100644 --- a/application/models/Provider_model.php +++ b/application/models/Provider_model.php @@ -42,7 +42,7 @@ class Provider_model extends CI_Model { return $status; } - public function getProviderData($provider_id='',$view='1'){ + public function getProviderData($provider_id='',$view=''){ $cond = (!empty($view))?" USR.status IN ($view) ":" USR.status != '2' "; $cond .= (!empty($provider_id))?" AND PRV.provider_id='$provider_id' ":""; @@ -226,5 +226,15 @@ class Provider_model extends CI_Model { } return ($status)?1:0; } + + function resetPassword($provider_id = ''){ + if(empty($provider_id)){ + return 0; + } + $unique_id = rand(11111111,99999999); + $status = $this->db->update('users',array('password'=>md5($unique_id),'status'=>1), + array('id'=>$provider_id,'user_type'=>'2')); + return ($status)?$unique_id:0; + } } ?> \ No newline at end of file diff --git a/application/models/Webservice_model.php b/application/models/Webservice_model.php index 9474ffb..a6e9603 100644 --- a/application/models/Webservice_model.php +++ b/application/models/Webservice_model.php @@ -550,7 +550,7 @@ class Webservice_model extends CI_Model { FROM review WHERE event_id=$event_id"; $rating = $this->db->query($sql)->row_array(); $rate = isset($rating['rate'])&&!empty($rating['rate'])? - $rating['rate']:'0.0'; + round($rating['rate'],1):'0.0'; $sql = "SELECT SUM(booking.no_of_ticket) AS attend FROM booking WHERE status IN (1,2) AND event_id=$event_id"; diff --git a/application/views/Notification/notification.php b/application/views/Notification/notification.php index a0da3e7..b3b16f7 100644 --- a/application/views/Notification/notification.php +++ b/application/views/Notification/notification.php @@ -78,15 +78,23 @@ </div> <div class="col-sm-6"> <div class="form-group"> + <label>Provider Password Reset Mail</label> + <p>Username => {:user_name} , Reset Link => {:password}</p> + <textarea id="rich_editor_11" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Checker Activation Mail" name="provider_verify_mail" + style="height:108px;" data-parsley-trigger="change"><?= $notificationData->provider_verify_mail ?></textarea> + </div> + </div> + </div> + + <div class="col-sm-12"> + <div class="col-sm-6"> + <div class="form-group"> <label>Staff Registration Mail</label> <p>Username => {:user_name} , Password => {:password}</p> <textarea id="rich_editor_9" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Staff Registration Mail" name="staff_reg_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->staff_reg_mail ?></textarea> </div> </div> - </div> - - <div class="col-sm-12"> <div class="col-sm-6"> <div class="form-group"> <label>Booking Mail</label> diff --git a/application/views/Provider/viewProvider.php b/application/views/Provider/viewProvider.php index 7b3fd88..e49a919 100644 --- a/application/views/Provider/viewProvider.php +++ b/application/views/Provider/viewProvider.php @@ -60,7 +60,10 @@ <th class="center" id="statusFlag_<?= $provider->provider_id ?>"> <?= ($provider->status == 1)?'Active':'De-activate' ?> </th> - <td class="center"> + <td class="center"> + <a class="btn btn-sm btn-link" style="margin-top:-13px;" href="<?= base_url('Provider/resetPassword/'.encode_param($provider->provider_id)) ?>"> + <i class="fa fa-fw fa-key"></i>Reset Password + </a><br> <a class="btn btn-sm btn-info" id="viewProvider" provider_id="<?= encode_param($provider->provider_id) ?>"> <i class="fa fa-fw fa-eye"></i>View </a> diff --git a/application/views/Templates/footer-script.php b/application/views/Templates/footer-script.php index f0c448f..3d5841d 100644 --- a/application/views/Templates/footer-script.php +++ b/application/views/Templates/footer-script.php @@ -33,6 +33,7 @@ if(jQuery('#rich_editor_8').length==1){CKEDITOR.replace('rich_editor_8');} if(jQuery('#rich_editor_9').length==1){CKEDITOR.replace('rich_editor_9');} if(jQuery('#rich_editor_10').length==1){CKEDITOR.replace('rich_editor_10');} + if(jQuery('#rich_editor_11').length==1){CKEDITOR.replace('rich_editor_11');} if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3',{language:'ar'});} if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4',{language:'ar'});}