public function dashboardAction()
 {
     $auth = new FrontEndAuth();
     $model = new Practitioners();
     $bookingModel = new Bookings();
     $common = new Common();
     if (!$auth->hasIdentity(3)) {
         return $this->redirect()->toRoute('login', array('action' => 'index'));
     }
     $session = new Container('frontend');
     // 0:- both(sms & mail) are verified 1:- any one or both(sms & mail) are unverified
     $verifystatus = $session->email_verification_status == 1 && $session->sms_verification_status == 1 ? 0 : 1;
     $api = new Api();
     $api_url = $this->getServiceLocator()->get('config')['api_url']['value'];
     $res = $api->curl($api_url . "/api/spusers/" . $session->userid . "/", array(''), "GET");
     if ($res->getStatusCode() != 200) {
         return $this->redirect()->toRoute('practitioner', array('action' => 'list'));
     }
     $data = $this->getSpdata($res);
     array_pop($data['address']);
     //echo '<pre>'; print_r($data); exit;
     $services_count = $this->getservicesdata($session->userid, $api, $api_url);
     // get all services list
     //echo '<pre>'; print_r($services_count); exit;
     $parentService = isset($services_count['results'][0]['category_id']) ? $model->getParentService($api_url, $services_count['results'][0]['category_id']) : 'Not Available';
     $bussCategoryName = $parentService ? $parentService['category_name'] : 'Not Avaialable';
     $service_category_list = $this->getCategories();
     //getting services list for service provider
     $feedback_list = $this->getSPfeedback($session->userid, $api, $api_url);
     //getting feedback list for service provider
     $video_list = $this->getSPmedia($session->userid, $api, $api_url, 2, 5);
     //getting video list for service provider
     $image_list = $this->getSPmedia($session->userid, $api, $api_url, 1, 5);
     //getting images list for service provider
     $options = $model->getSPoptions($session->userid, $api_url);
     //getting available options for service provider
     $varification = $model->getSPvarification($session->userid, $api_url);
     //getting varified/unverified ids for service provider
     $bookings_count = $bookingModel->getBookingsCount($api_url, $session->userid);
     //getting bookings count for service provider
     $workdays = $model->getSPWorkdays($session->userid, $api_url);
     //getting workdays for service provider
     $addservice_form = new SPaddservicesFrom($service_category_list);
     // Getting practitioner's organization
     $org = $model->getSPOrganization($api_url, $session->userid);
     $data['details']['organization'] = isset($org['organization_name']) ? $org['organization_name'] : '';
     $subscriptionDetails = $common->getSubscriptiondetails($api_url, '', true);
     $features = $common->getFeatures($api_url, $session->userid);
     isset($features['chat']) ? $chat = $features['chat'] : ($chat = 0);
     // getting banner for this page
     $banners = $common->getBanner($api_url, 4);
     return new ViewModel(array('states' => $common->getstatesByCountry($api_url), 'countries' => $common->getCountries($api_url), 'AllEducations' => $model->getEducations($api_url), 'languages' => $model->getLanguages($api_url), 'content' => $data['content'], 'addresses' => $data['address'], 'work_address' => $data['work_address'], 'contact' => $data['contact'], 'details' => $data['details'], 'service_list' => $data['service_list'], 'form_review' => $data['form_review'], 'form_ask' => $data['form_ask'], 'form_booking' => $data['form_booking'], 'commission' => $data['commission'], 'language' => $data['language'], 'educations' => $data['educations'], 'addservice_form' => $addservice_form, 'feedback' => $feedback_list, 'ratings' => $ratings, 'workdays' => $workdays, 'available_days' => $model->getAvailableDays($api_url), 'availability' => $model->getSPWorkdays($session->userid, $api_url, '', true), 'appointment_delay' => $model->getAppointmentDelay($session->userid, $api_url), 'response' => $data['response'], 'feedback_count' => count($feedback_list), 'video_list' => $video_list, 'image_list' => $image_list, 'options' => $options, 'varification' => $varification, 'booking_count' => $bookings_count, 'services_count' => $services_count['count'], 'newsletter_count' => count($model->getSPnewsletter($session->userid, $api_url)), 'notifications' => $model->getNotifications($api_url), 'auth' => $auth, 'loggedin_userid' => $session->userid, 'successMsgs' => $this->flashMessenger()->getCurrentSuccessMessages(), 'errors' => $this->flashMessenger()->getCurrentErrorMessages(), 'baseurl' => $this->getServiceLocator()->get('config')['basepath']['url'], 'chaturl' => $this->getServiceLocator()->get('config')['chatpath']['url'], 'verifystatus' => $verifystatus, 'organizations' => $model->getOrganizations($api_url), 'location_types' => $model->getLocationTypes($api_url), 'features' => $subscriptionDetails['features'], 'successMsgs' => $this->flashMessenger()->getCurrentSuccessMessages(), 'errors' => $this->flashMessenger()->getCurrentErrorMessages(), 'banners' => $banners, 'commission' => $data['commission'], 'chat' => $chat, 'browser' => $common->getBrowser(), 'bussCategoryName' => $bussCategoryName));
 }