コード例 #1
0
 public function postplanlist()
 {
     $serviceRequest = $this->GetObjectFromJsonRequest(Input::json()->all());
     $serviceResponse = $this->PlanDataProvider->getPlanList($serviceRequest->Data);
     if (count($serviceResponse->Data->PlanListArray) > 0) {
         $index = $serviceRequest->Data->PageSize * ($serviceRequest->Data->PageIndex - 1) + 1;
         foreach ($serviceResponse->Data->PlanListArray as $plans) {
             $planID = Constants::$QueryStringPlanID . "=" . $plans->PlanID;
             $plans->EncryptPlanID = Common::getEncryptDecryptID('encrypt', $planID);
             $plans->DisplayName = Common::GetSubString($plans->PlanName);
             $plans->Index = $index++;
         }
     }
     return $this->GetJsonResponse($serviceResponse);
 }
コード例 #2
0
 public function getAddFundamental($encryptedFundamentalID = 0)
 {
     $isEditMode = false;
     if ($encryptedFundamentalID) {
         $isEditMode = true;
     }
     if (SessionHelper::getRoleID() != Constants::$RoleAdmin) {
         return Redirect::to('unauthorize');
     }
     if ($isEditMode) {
         $decryptFundamentalID = Common::getEncryptDecryptValue('decrypt', $encryptedFundamentalID);
         $fundamentalID = Common::getExplodeValue($decryptFundamentalID, Constants::$QueryStringFundamentalID);
     } else {
         $fundamentalID = 0;
     }
     $serviceResponse = $this->DataProvider->getFundamentalDetails($fundamentalID);
     return View::make('admin.addfundamental', (array) $serviceResponse->Data);
 }
コード例 #3
0
 public function postAuthenticate()
 {
     $serviceRequest = $this->GetObjectFromJsonRequest(Input::json()->all());
     /*$serviceResponse = $this->securityDataProvider->postAuthenticate($serviceRequest->Data);*/
     $serviceResponse = $this->securityDataProvider->AuthenticateUser($serviceRequest->Data);
     if (!empty($serviceResponse->Data)) {
         SessionHelper::setRoleID($serviceResponse->Data->userdeatil->RoleID);
         SessionHelper::setRoleName($serviceResponse->Data->userdeatil->RoleName);
         SessionHelper::setUserName($serviceResponse->Data->userdeatil->FirstName);
     }
     if ($serviceResponse->IsSuccess) {
         $userLoginChecked = Auth::User();
         if (!empty($userLoginChecked)) {
             $sessionCheckURL = SessionHelper::getRedirectURL();
             if (!empty($sessionCheckURL)) {
                 $serviceResponse->Data->redirectURL = $sessionCheckURL;
             } else {
                 $logInRoleData = Common::GetLoginRoleText($userLoginChecked->RoleID);
                 $serviceResponse->Data->redirectURL = URL::to('/' . $logInRoleData->redirectURL);
             }
         }
     }
     return $this->GetJsonResponse($serviceResponse);
 }
コード例 #4
0
 public function SaveAnalyst($analystModel, $loginUserID)
 {
     $response = new ServiceResponse();
     $messages = array('required' => trans('messages.PropertyRequired'), 'min' => trans('messages.PropertyMin'));
     $isEditMode = $analystModel['AnalystID'] > 0;
     $analystEntity = new AnalystEntity();
     $validator = Validator::make((array) $analystModel, $isEditMode ? $analystEntity::$Add_rules : $analystEntity::$Add_rules, $messages);
     $validator->setAttributeNames($analystEntity::$niceNameArray);
     if ($validator->fails()) {
         $response->Message = Common::getValidationMessagesFormat($validator->messages());
         return $response;
     }
     $searchParams = array();
     $searchValueData = new SearchValueModel();
     $searchValueData->Name = "Title";
     $searchValueData->Value = Common::GetDataWithTrim($analystModel['Title']);
     $searchValueData->CheckStartWith = Constants::$CheckStartWith;
     array_push($searchParams, $searchValueData);
     $searchValueData = new SearchValueModel();
     $searchValueData->Name = "IsEnable";
     $searchValueData->Value = Constants::$IsEnableValue;
     array_push($searchParams, $searchValueData);
     if ($isEditMode) {
         $customWhere = "AnalystID NOT IN ({$analystModel['AnalystID']})";
     } else {
         $customWhere = "";
     }
     $checkUnique = $this->GetEntityCount($analystEntity, $searchParams, "", "", $customWhere);
     if ($checkUnique == 0) {
         $dateTime = date(Constants::$DefaultDateTimeFormat);
         if ($isEditMode) {
             $analystEntity = $this->GetEntityForUpdateByPrimaryKey($analystEntity, $analystModel['AnalystID']);
             if ($analystEntity->IsEnable == Constants::$Value_True) {
                 $users = UserEntity::where('IsEnable', Constants::$Value_True)->lists('UserID');
                 if (count($users) > 0) {
                     foreach ($users as $userID) {
                         $notificationEntity = new NotificationEntity();
                         $notificationEntity->UserID = $userID;
                         $notificationEntity->NotificationType = Constants::$NotificationType['Analyst'];
                         $notificationEntity->Message = 'Correction - ' . $analystEntity->Title;
                         $notificationEntity->ImageUrl = $analystEntity->Image ? Constants::$Path_AnalystImages . $analystEntity->AnalystID . '/' . rawurlencode($analystEntity->Image) : '';
                         $notificationEntity->Key = $analystEntity->AnalystID;
                         $notificationEntity->CreatedDate = date(Constants::$DefaultDateTimeFormat);
                         $notificationEntity->save();
                     }
                 }
             }
         }
         $analystEntity->Title = Common::GetDataWithTrim($analystModel['Title']);
         $analystEntity->Description = $analystModel['Description'];
         if (!$isEditMode) {
             $analystEntity->CreatedDate = $dateTime;
         }
         $analystEntity->ModifiedDate = $dateTime;
         if ($analystdetails = $this->SaveEntity($analystEntity)) {
             if ($analystdetails) {
                 $response->IsSuccess = true;
                 if ($analystModel['Image']) {
                     if (!is_dir(public_path(Constants::$Path_AnalystImages . $analystEntity->AnalystID))) {
                         mkdir(public_path(Constants::$Path_AnalystImages . $analystEntity->AnalystID), 0755);
                     } else {
                         $path = public_path(Constants::$Path_AnalystImages . $analystEntity->AnalystID . '/');
                         foreach (glob($path . "*.*") as $file) {
                             unlink($file);
                         }
                     }
                     $destinationPath = public_path(Constants::$Path_AnalystImages . $analystEntity->AnalystID);
                     /* $fileName = $analystModel['Image']->getClientOriginalName();
                        $originalFileName = Input::file()['Image']->getClientOriginalName();
                        $resizeFile = $originalFileName->resize(120, 120);*/
                     $fileName = $analystModel['Image']->getClientOriginalName();
                     $success = $analystModel['Image']->move($destinationPath, $fileName);
                     if ($success) {
                         $analystEntity->Image = $fileName;
                         $analystEntity->save();
                     }
                 }
             }
         } else {
             $response->Message = trans('messages.ErrorOccured');
         }
         if (!$isEditMode) {
             $response->Message = trans('messages.AnalystAddedSuccess');
         } else {
             $response->Message = trans('messages.AnalystUpdateSuccess');
         }
     } else {
         $response->Message = "'" . Common::GetDataWithTrim($analystEntity['Title']) . "' " . trans('messages.AnalystAlreadyExist');
     }
     return $response;
 }
コード例 #5
0
 public function Dashboard()
 {
     $response = new ServiceResponse();
     $model = new stdClass();
     $totalUser = UserEntity::where("IsDeleted", 0)->count();
     //$this->GetEntityCount(new UserEntity(),"");
     $totalEarning = DB::select("SELECT SUM(pph.SubscriptionAmount) AS Amount, YEAR(PaymentDate) AS `Year` FROM paymentplanshistory pph where IsTrial = 0 GROUP BY YEAR(PaymentDate)");
     //PaymentPlansHistoryEntity::all()->sum("SubscriptionAmount");
     $totalPaidUsers = PaymentPlansHistoryEntity::where("IsTrial", 0)->where("isActive", 1)->count();
     $totalTrialUsers = PaymentPlansHistoryEntity::where("IsTrial", 1)->where("isActive", 1)->count();
     $lastTenUser = $this->RunQueryStatement("SELECT * FROM users ORDER BY CreatedDate DESC LIMIT 10", Constants::$QueryType_Select);
     $lastTenPayment = $this->RunQueryStatement("SELECT u.UserID,u.FirstName,u.LastName,u.City ,ph.IsActive,u.Mobile , ph.Amount ,ph.SubscriptionAmount,ph.PaymentDate FROM paymentplanshistory ph\n        LEFT JOIN users u ON u.UserID = ph.UserID\n        WHERE  ph.IsTrial = 0\n        ORDER BY PaymentDate DESC LIMIT 10", Constants::$QueryType_Select);
     if ($totalEarning && count($totalEarning) > 0) {
         foreach ($totalEarning as $perYear) {
             $perYear->Amount = Common::moneyFormatIndia((int) $perYear->Amount);
         }
     } else {
         $totalEarning = array();
     }
     //$totalEarning = Common::moneyFormatIndia((int)$totalEarning);
     $model->TotalUsers = $totalUser;
     $model->TotalEarning = $totalEarning;
     $model->TotalPaidUsers = $totalPaidUsers;
     $model->TotalTrialUsers = $totalTrialUsers;
     $model->LastTenUser = $lastTenUser;
     $model->LastTenPayment = $lastTenPayment;
     $response->Data = $model;
     $response->IsSuccess = true;
     return $response;
 }
コード例 #6
0
 public function IsAuthorized($requestSegment)
 {
     if (SessionHelper::getRoleID() != Constants::$RoleDCC) {
         $requestURLSegment = Request::segment($requestSegment);
         if (!empty($requestURLSegment)) {
             $decodeRequestURL = urldecode($requestURLSegment);
             $decryptProjectID = Common::getEncryptDecryptValue('decrypt', $decodeRequestURL);
             $projectID = Common::getExplodeValue($decryptProjectID, Constants::$QueryStringProjectID);
             $propertyName = 'ProjectID';
             $userProjectIdArray = Common::GetPropertyArrayFromArray(SessionHelper::getUserProjectList(), $propertyName);
             if (!in_array($projectID, $userProjectIdArray)) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     }
 }
コード例 #7
0
 public function SaveNews($newsmodel, $newsImage, $user)
 {
     $response = new ServiceResponse();
     $newsEntity = new NewsEntity();
     $messages = array('required' => trans('messages.PropertyRequired'));
     $validator = Validator::make((array) $newsmodel, $newsEntity::$Add_rules, $messages);
     $validator->setAttributeNames($newsEntity::$niceNameArray);
     if ($validator->fails()) {
         $response->Message = Common::getValidationMessagesFormat($validator->messages());
         $response->IsSuccess = false;
         return $response;
     }
     $dateTime = date(Constants::$DefaultDateTimeFormat);
     $newsEntity->Description = $newsmodel->Description;
     $newsEntity->GroupID = serialize($newsmodel->GroupID);
     $newsEntity->CreatedDate = $dateTime;
     $newsEntity->ModifiedDate = $dateTime;
     $newsEntity->UserID = $user->Data->UserID;
     if ($newsEntity->save()) {
         if ($newsImage) {
             if (!is_dir(public_path(Constants::$Path_NewsImages . $newsEntity->NewsID))) {
                 mkdir(public_path(Constants::$Path_NewsImages . $newsEntity->NewsID), 0755);
             } else {
                 $path = public_path(Constants::$Path_NewsImages . $newsEntity->NewsID . '/');
                 // Loop over all of the files in the folder
                 foreach (glob($path . "*.*") as $file) {
                     unlink($file);
                     // Delete each file through the loop
                 }
             }
             $destinationPath = public_path(Constants::$Path_NewsImages . $newsEntity->NewsID);
             $fileName = $newsImage->getClientOriginalName();
             $success = $newsImage->move($destinationPath, $fileName);
             if ($success) {
                 $newsEntity->Image = $fileName;
                 $newsEntity->save();
             }
         }
         /*Save Notification for all users*/
         $userlist = array();
         $users = array();
         if (in_array(Constants::$AllGroupID, $newsmodel->GroupID)) {
             $users = UserEntity::where('IsEnable', Constants::$Value_True)->lists('UserID');
         } else {
             foreach ($newsmodel->GroupID as $value) {
                 if ($value == Constants::$TrialGroupID) {
                     $userlist[] = PaymentPlansHistoryEntity::where('IsTrial', Constants::$Value_True)->where('IsActive', Constants::$Value_True)->distinct('UserID')->lists('UserID');
                 } else {
                     if ($value == Constants::$FreeGroupID) {
                         $historyUser = DB::table('paymentplanshistory')->where('IsActive', Constants::$Value_True)->distinct('UserID')->lists('UserID');
                         if (count($historyUser) > 0) {
                             $freeUser = DB::table('users')->whereNotIn('UserID', $historyUser)->where('IsEnable', Constants::$Value_True)->lists('UserID');
                             $userlist[] = $freeUser;
                         }
                     } else {
                         if ($value == Constants::$PaidGroupID) {
                             $paidCount = PaymentPlansHistoryEntity::where('IsTrial', Constants::$Value_False)->where('IsActive', Constants::$Value_True)->distinct('UserID')->lists('UserID');
                             $userlist[] = $paidCount;
                         } else {
                             $userlist[] = DB::table('usergroups')->where('GroupID', $value)->lists('UserID');
                         }
                     }
                 }
             }
             $userlist[] = DB::table('users')->whereIn('userid', DB::table('userroles')->where('RoleID', Constants::$RoleAdmin)->lists('UserID'))->where('IsEnable', Constants::$Value_True)->lists('UserID');
             if (count($userlist) > 1) {
                 foreach ($userlist as $listuser) {
                     $users = array_unique(array_merge($users, $listuser));
                 }
             }
         }
         foreach ($users as $userID) {
             $UserNewsEntity = new UserNewsEntity();
             $UserNewsEntity->NewsID = $newsEntity->NewsID;
             $UserNewsEntity->UserID = $userID;
             $UserNewsEntity->save();
             $notificationEntity = new NotificationEntity();
             $notificationEntity->UserID = $userID;
             $notificationEntity->NotificationType = Constants::$NotificationType['General'];
             $notificationEntity->Message = $newsEntity->Description;
             //trans("messages.NewNewsMessageReceivedPush");
             $notificationEntity->ImageUrl = $newsEntity->Image ? Constants::$Path_NewsImages . $newsEntity->NewsID . '/' . rawurlencode($newsEntity->Image) : '';
             $notificationEntity->CreatedDate = date(Constants::$DefaultDateTimeFormat);
             $notificationEntity->save();
         }
         $response->Data = $newsEntity;
         $response->Message = trans('messages.newsadded');
         $response->IsSuccess = true;
     }
     return $response;
 }
コード例 #8
0
 public function SaveScript($scriptModel, $cUser)
 {
     $response = new ServiceResponse();
     $messages = array('required' => trans('messages.PropertyRequired'), 'min' => trans('messages.PropertyMin'), 'max' => trans('messages.PropertyMax'));
     $isEditMode = $scriptModel['ScriptID'] > 0;
     $scriptEntity = new ScriptEntity();
     $validator = Validator::make((array) $scriptModel, $scriptEntity::$Add_rules, $messages);
     $validator->setAttributeNames($scriptEntity::$niceNameArray);
     if ($validator->fails()) {
         $response->Message = Common::getValidationMessagesFormat($validator->messages());
         return $response;
     }
     $checkUnique = ScriptEntity::where("Script", trim($scriptModel['Script']))->where("SegmentID", $scriptModel['SegmentID'])->where('ScriptID', '!=', $scriptModel['ScriptID'])->first();
     if ($checkUnique == null) {
         $dateTime = date(Constants::$DefaultDateTimeFormat);
         if ($isEditMode) {
             $scriptEntity = $this->GetEntityForUpdateByPrimaryKey($scriptEntity, $scriptModel['ScriptID']);
         }
         $scriptEntity->Script = Common::GetDataWithTrim($scriptModel['Script']);
         $scriptEntity->SegmentID = $scriptModel['SegmentID'];
         if ($scriptDetails = $this->SaveEntity($scriptEntity)) {
             if ($scriptModel['Image']) {
                 if (!is_dir(public_path(Constants::$Path_ScriptImages . $scriptEntity->ScriptID))) {
                     mkdir(public_path(Constants::$Path_ScriptImages . $scriptEntity->ScriptID), 0755);
                 } else {
                     $path = public_path(Constants::$Path_ScriptImages . $scriptEntity->ScriptID . '/');
                     foreach (glob($path . "*.*") as $file) {
                         unlink($file);
                     }
                 }
                 $destinationPath = public_path(Constants::$Path_ScriptImages . $scriptEntity->ScriptID);
                 $fileName = $scriptModel['Image']->getClientOriginalName();
                 $success = $scriptModel['Image']->move($destinationPath, $fileName);
                 if ($success) {
                     $scriptEntity->Image = $fileName;
                     $scriptEntity->save();
                 }
             }
             $response->Message = !$isEditMode ? trans('messages.ScriptAddedSuccess') : trans('messages.ScriptUpdateSuccess');
             $response->IsSuccess = true;
         } else {
             $response->Message = trans('messages.ErrorOccured');
         }
     } else {
         $response->Message = "'" . Common::GetDataWithTrim($scriptModel['Script']) . "' " . trans('messages.ScriptAlreadyExist');
     }
     return $response;
 }
コード例 #9
0
 public function postUserGroup()
 {
     $serviceRequest = $this->GetObjectFromJsonRequest(Input::json()->all());
     $serviceResponse = $this->GroupDataProvider->getUserGroupList($serviceRequest->Data);
     if (count($serviceResponse->Data->UserGroupListArray) > 0) {
         $index = $serviceRequest->Data->PageSize * ($serviceRequest->Data->PageIndex - 1) + 1;
         foreach ($serviceResponse->Data->UserGroupListArray as $groups) {
             $groupID = Constants::$QueryStringGroupID . "=" . $groups->GroupID;
             $groups->EncryptGroupID = Common::getEncryptDecryptID('encrypt', $groupID);
             $userID = Constants::$QueryStringUSerID . "=" . $groups->UserID;
             $groups->EncryptUserID = Common::getEncryptDecryptID('encrypt', $userID);
             $groups->UserName = $groups->FirstName . "  " . $groups->LastName;
             $groups->Index = $index++;
         }
     }
     return $this->GetJsonResponse($serviceResponse);
 }
コード例 #10
0
 public function SaveGroup($groupModel, $loginUserID)
 {
     $response = new ServiceResponse();
     $isEditMode = $groupModel->GroupID > 0;
     $groupEntity = new GroupEntity();
     $searchParams = array();
     $searchValueData = new SearchValueModel();
     $searchValueData->Name = "GroupName";
     $searchValueData->Value = Common::GetDataWithTrim($groupModel->GroupName);
     $searchValueData->CheckStartWith = Constants::$CheckStartWith;
     array_push($searchParams, $searchValueData);
     $searchValueData = new SearchValueModel();
     $searchValueData->Name = "IsEnable";
     $searchValueData->Value = Constants::$IsEnableValue;
     array_push($searchParams, $searchValueData);
     if ($isEditMode) {
         $customWhere = "GroupID NOT IN ({$groupModel->GroupID})";
     } else {
         $customWhere = "";
     }
     $checkUniqueEmail = $this->GetEntityCount($groupEntity, $searchParams, "", "", $customWhere);
     if ($checkUniqueEmail == 0) {
         $dateTime = date(Constants::$DefaultDateTimeFormat);
         if ($isEditMode) {
             $groupEntity = $this->GetEntityForUpdateByPrimaryKey($groupEntity, $groupModel->GroupID);
         }
         $groupEntity->GroupName = Common::GetDataWithTrim($groupModel->GroupName);
         $groupEntity->IsEnable = Constants::$IsEnableValue;
         if (!$isEditMode) {
             $groupEntity->CreatedDate = $dateTime;
             $groupEntity->CreatedBy = $loginUserID;
         }
         $groupEntity->ModifiedDate = $dateTime;
         $groupEntity->ModifiedBy = $loginUserID;
         if ($this->SaveEntity($groupEntity)) {
             $response->IsSuccess = true;
         } else {
             $response->Message = trans('messages.ErrorOccured');
         }
         if (!$isEditMode) {
             $response->Message = trans('messages.GroupAddedSuccess');
         } else {
             $response->Message = trans('messages.GroupUpdateSuccess');
         }
     } else {
         $response->Message = "'" . Common::GetDataWithTrim($groupModel->GroupName) . "' " . trans('messages.GroupAlreadyExist');
     }
     return $response;
 }
コード例 #11
0
 public function UpdateCall($callModel)
 {
     $response = new ServiceResponse();
     if (property_exists($callModel, "CallID") && $callModel->CallID) {
         $messages = array('required' => trans('messages.PropertyRequired'));
         $validator = Validator::make((array) $callModel, CallEntity::$updateCall_rules, $messages);
         $validator->setAttributeNames(CallEntity::$niceNameArray);
         if ($validator->fails()) {
             $response->Message = Common::getValidationMessagesFormat($validator->messages());
             return $response;
         } else {
             $CallEntity = CallEntity::find($callModel->CallID);
             $CallEntity->ScriptID = $callModel->ScriptID;
             $CallEntity->Action = $callModel->Action;
             $CallEntity->InitiatingPrice = $callModel->InitiatingPrice;
             $CallEntity->T1 = round($callModel->T1, Constants::$DecimalValue);
             $CallEntity->T2 = round($callModel->T2, Constants::$DecimalValue);
             $CallEntity->SL = round($callModel->SL, Constants::$DecimalValue);
             $CallEntity->ResultID = property_exists($callModel, 'ResultID') ? $callModel->ResultID : '';
             $CallEntity->ResultDescription = property_exists($callModel, 'ResultDescription') ? $callModel->ResultDescription : '';
             if ($CallEntity->save()) {
                 $response->Message = trans("messages.CallUpdateSuccess");
                 $response->IsSuccess = TRUE;
             } else {
                 $response->Message = trans("messages.ErrorOccured");
             }
         }
     } else {
         $response->Message = trans("messages.ErrorOccured");
     }
     return $response;
 }
コード例 #12
0
 public function SendAPNsFromNotification()
 {
     $notifications = DB::select("SELECT u.DeviceUDID AS Devices,u.IsIOSGeneralOn,\n                                    u.IsIOSAnalystOn,u.IsIOSFundamentalOn,u.IsIOSEquityOn,u.IsIOSFutureOn,u.IsIOSCommodityOn,u.IsIOSBTSTOn,u.IsIOSChatOn,\n                                    n.NotificationID, NotificationType,Message, `Key`, ImageUrl, IsPast\n                                    FROM notifications n LEFT JOIN users u ON u.UserID = n.UserID and u.IsAndroid = 0 AND u.DeviceUDID IS NOT NULL WHERE issent = 0 AND IFNULL(u.DeviceUDID,'') != ''");
     if ($notifications) {
         foreach ($notifications as $notification) {
             $notifications = DB::select("Update notifications SET IsSent=2 where NotificationID=?", array($notification->NotificationID));
             if ($notification && $notification->Devices) {
                 if ($notification->IsIOSGeneralOn && $notification->NotificationType == Constants::$NotificationType['General']) {
                     $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                 } else {
                     if ($notification->IsIOSAnalystOn && $notification->NotificationType == Constants::$NotificationType['Analyst']) {
                         $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                     } else {
                         if ($notification->IsIOSFundamentalOn && $notification->NotificationType == Constants::$NotificationType['Fundamental']) {
                             $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                         } else {
                             if ($notification->IsIOSEquityOn && $notification->NotificationType == Constants::$NotificationType['Equity']) {
                                 $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                             } else {
                                 if ($notification->IsIOSFutureOn && $notification->NotificationType == Constants::$NotificationType['Future']) {
                                     $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                                 } else {
                                     if ($notification->IsIOSCommodityOn && $notification->NotificationType == Constants::$NotificationType['Commodity']) {
                                         $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                                     } else {
                                         if ($notification->IsIOSBTSTOn && $notification->NotificationType == Constants::$NotificationType['BTST']) {
                                             $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                                         } else {
                                             if ($notification->IsIOSChatOn && $notification->NotificationType == Constants::$NotificationType['Chat']) {
                                                 $notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 /*else{
                       $notificationEntity = DB::table('notifications')->where("NotificationID", $notification->NotificationID)->update(array("IsSent" => 1,"SentDate" => date(Constants::$DefaultDateTimeFormat)));
                   }*/
                 //$notificationResponse = Common::SendIOSCloudMessage($notification->Devices, Common::GetIOSCloudMessage($notification->Message, $notification->NotificationType, $notification->Key, $notification->NotificationID, $notification->ImageUrl, $notification->IsPast));
                 if ($notificationResponse) {
                     $notificationEntity = DB::table('notifications')->where("NotificationID", $notification->NotificationID)->update(array("IsSent" => 1, "SentDate" => date(Constants::$DefaultDateTimeFormat)));
                 } else {
                     $notificationEntity = DB::table('notifications')->where("NotificationID", $notification->NotificationID)->update(array("IsSent" => 3, "SentDate" => date(Constants::$DefaultDateTimeFormat)));
                 }
             }
             $notifications = DB::select("Update notifications SET IsSent=0 where NotificationID=? and IsSent=2", array($notification->NotificationID));
         }
     }
 }
コード例 #13
0
ファイル: common.php プロジェクト: rohitbhalani/RB_Test
 public static function GetLoginRolesMenu()
 {
     $roles = new stdClass();
     $combineAdminRoleID = Constants::$QueryStringRoleID . "=" . Constants::$RoleAdmin;
     $encryptedAdminRoleID = Common::getEncryptDecryptValue("encrypt", $combineAdminRoleID);
     $roles->AdminRoleId = $encryptedAdminRoleID;
     $combineStaffRoleID = Constants::$QueryStringRoleID . "=" . Constants::$RoleSupportStaff;
     $encryptedStaffRoleID = Common::getEncryptDecryptValue("encrypt", $combineStaffRoleID);
     $roles->SupportStaffRoleId = $encryptedStaffRoleID;
     return $roles;
 }
コード例 #14
0
 public function Awsdownloadsinglefile($key, $filename = '', $userid, $downloadTokenValue = "")
 {
     try {
         $signedurl = $this->Awsdownloadfile($key);
         $url = $signedurl->signedUrl;
         $file = explode('/', $key);
         $rfile = fopen($url, 'r');
         $tempfile = $file[count($file) - 1];
         $tempfolder = public_path() . DIRECTORY_SEPARATOR . 'temp';
         $tempfolder = str_replace('\\', '/', $tempfolder);
         $tempfolder = str_replace('/', DIRECTORY_SEPARATOR, $tempfolder);
         is_dir($tempfolder) || mkdir($tempfolder);
         $tempUserFolder = $tempfolder . DIRECTORY_SEPARATOR . $this->GenerateFolderName($userid);
         is_dir($tempUserFolder) || mkdir($tempUserFolder);
         $tempfile = $tempUserFolder . DIRECTORY_SEPARATOR . basename($tempfile);
         $lfile = fopen($tempfile, 'w');
         while (!feof($rfile)) {
             fwrite($lfile, fread($rfile, 4095), 4095);
         }
         fclose($rfile);
         fclose($lfile);
         $fullPath = $tempfile;
         if (!$filename) {
             $filename = basename($fullPath);
         }
         setcookie("fileDownloadToken", $downloadTokenValue, time() + 3600, "/");
         setcookie("userSingleFileDownloadToken", $downloadTokenValue, time() + 3600, "/");
         setcookie("DownloadSingleRFI", $downloadTokenValue, time() + 3600, "/");
         setcookie("DownloadPlansRFI", $downloadTokenValue, time() + 3600, "/");
         setcookie("DownloadSpecsRFI", $downloadTokenValue, time() + 3600, "/");
         setcookie("DownloadSpecsSubmittal", $downloadTokenValue, time() + 3600, "/");
         setcookie("DownloadSubmittalFiles", $downloadTokenValue, time() + 3600, "/");
         $fileDetail = pathinfo($filename);
         $filedata = file_get_contents($fullPath);
         // Read the file's contents
         header('Content-Description: File Transfer; charset=UTF-8');
         $contentType = Common::GetFileContentType($filename);
         header('Content-Type: ' . $contentType . '');
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Content-Length: ' . filesize($fullPath));
         ob_clean();
         flush();
         readfile($fullPath);
         $parentDir = dirname($fullPath);
         unlink($fullPath);
         is_dir($parentDir) && rmdir($parentDir);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }