/** * @RequestMapping(url="json/user_stories",type=json) * @RequestParams(true) */ public function invokeHandler(RequestData $data) { $uid = $data->get("uid"); $stories = new Stories(); $author = new UserDetails($uid); $author->fetchDetails(); return $author; }
public function signupAction() { $con = new Controller(); $reg = new SignupValidation(); $user = new UserDetails(); if ($reg->validate() === true) { if ($user->insertUser() === true && $user->insertUserMobile() === true) { $con->render('userPage'); } else { $con->render("fail"); } } }
public static function getUserDetailsBasedOnUserId($userId) { $sql = 'select `id` from ecomm_user_details where user = "******"'; $result = Database::singleton()->query_fetch($sql); if (!@$result['id']) { $obj = new UserDetails(); $obj->setUser($userId); $obj->save(); } else { $obj = new UserDetails($result['id']); } return $obj; }
/** * Display a listing of the resource. * GET /leavepayadmin * * @return Response */ public function index() { $empty = ''; $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $getleave = LeaveWPay::with('user')->where('status', $empty)->orderBy('created_at', 'desc')->get(); return View::make('admindashboard.leavepay')->with('admin', $profile)->with('getleave', $getleave)->with('title', 'STI | Leave Panel with pay'); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['DonationRequest'])) { $model->attributes = $_POST['DonationRequest']; $model->city = Utilities::getLookupIdByValue(Constants::$city_lookup_code, $model->city); $model->blood_group = Utilities::getLookupIdByValue(Constants::$bloodgrp_lookup_code, $model->blood_group); $model->area = Utilities::getLookupIdByValue(Constants::$area_lookup_code, $model->area); $model->state = $model->city0->lookup_parent_id; if (!Utilities::checkDateFormat($model->date)) { $model->date = DateTime::createFromFormat('d/M/yyyy', $model->date)->format('Y-m-d'); } if ($model->save()) { if ($model->status == "Donor Assigned") { $donor = UserDetails::model()->findByPk($model->donor); $donor->last_donation_date = date("Y-m-d"); $donor->donation_status = 'Y'; $donor->save(false); } $this->redirect(array('view', 'id' => $model->request_id)); } } $model->city = $model->city0->lookup_value; $model->area = $model->area0->lookup_value; $model->blood_group = $model->bloodGroup->lookup_value; //$model->date = DateTime::createFromFormat('Y-m-d', $model->date )->format('d/M/y'); $this->render('update', array('model' => $model)); }
/** * Display the specified resource. * GET /policies/{id} * * @param int $id * @return Response */ public function show() { $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $policies = AdminPolicies::orderBy('created_at', 'desc')->get(); return View::make('dashboard.policies')->with('profile', $profile)->with('policies', $policies)->with('countleave', $leavecount)->with('title', 'STI | School Policies'); }
/** * Display the specified resource. * GET /leavewopay/{id} * * @param int $id * @return Response */ public function show($id) { $recentleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $getleave = LeaveWOPay::with('user')->where('leave_id', $id)->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); return View::make('dashboard.leave_logw')->with('profile', $profile)->with('rleave', $recentleave)->with('getleave', $getleave)->with('countleave', $leavecount)->with('title', 'STI | Leave with pay'); }
public function loadModel($id) { $model = UserDetails::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function show_announce($id) { $post_comment = AnnouncementComments::where('post_id', $id)->orderBy('created_at', 'desc')->get(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $announce = Announcements::with('user')->where('post_id', $id)->orderBy('created_at', 'desc')->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.announcement')->with('post', $announce)->with('post_comment', $post_comment)->with('profile', $profile)->with('countleave', $leavecount)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('title', 'STI | Show Announcement'); }
/** * Display a listing of the resource. * GET /notification * * @return Response */ public function index() { $leavelog = UserLeaveLog::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $leaveoblog = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $obleave = LeaveOB::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $awtleave = LeaveAWT::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.notification_box')->with('profile', $profile)->with('leavelog', $leavelog)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('leaveob', $leaveoblog)->with('leaveawt', $awtleave)->with('countleave', $leavecount)->with('obleave', $obleave)->with('title', 'STI | Notification Box'); }
public function calculateCost($session, $cartItems) { //Here is an example, lets say that the shipping cost is one dollar per shipped item //Also, there is an international fee of $20 that will apply if the shipping address is not in Canada $result = 20.0; foreach ($cartItems as $cartItem) { $result += $cartItem->getQuantity(); } if (!@$_SESSION['authenticated_user']) { return $result; } $userId = @$_SESSION['authenticated_user']->getId(); $userDetails = UserDetails::getUserDetailsBasedOnUserId($userId); $shippingAddress = $userDetails->getAddress('shipping_address'); if ($shippingAddress->getCountryName() == "Canada") { $result -= 20.0; } return $result; }
/** * Displays the login page */ public function actionLogin() { $form = new LoginForm(); // collect user input data if (isset($_POST['LoginForm'])) { if (isset($_POST['LoginForm']['loginWithField'])) { // if user is logging with email, but param changed to username, // we should try to log him in with email. // if login attempt is unsuccessful, he will have to try again with username LoginForm::$loginWithField = $_POST['LoginForm']['loginWithField']; unset($_POST['LoginForm']['loginWithField']); } $form->attributes = $_POST['LoginForm']; // validate user input and redirect to return page if valid if ($form->validate()) { // set the welcome message MUserFlash::setTopSuccess(Yii::t('hint', '{screenName}, you have been successfully logged in.', array('{screenName}' => MHtml::wrapInTag(Yii::app()->user->screenName, 'strong')))); // user was just authenticated, but let's check anyway if (!Yii::app()->user->isGuest) { // update user stats if (($userDetails = UserDetails::model()->findByPk(Yii::app()->user->id)) !== null) { $userDetails->saveAttributes(array('lastLoginTime' => time(), 'lastVisitTime' => time(), 'totalTimeLoggedIn' => $userDetails->totalTimeLoggedIn + 60)); } else { // hmmm, user details does not exists Yii::log(W3::t('system', 'Member with ID {userId} has no UserDetails record associated. Method called: {method}.', array('{userId}' => Yii::app()->user->id, '{method}' => __METHOD__ . '()')), 'error', 'w3'); } } // go to previous/profile page $url = Yii::app()->homeUrl == Yii::app()->user->returnUrl ? array('site/index') : Yii::app()->user->returnUrl; $this->redirect($url); } } if (!Yii::app()->user->isGuest) { // warn user if already logged in MUserFlash::setTopInfo(Yii::t('hint', '{screenName}, this action will log you out from your current account.', array('{screenName}' => MHtml::wrapInTag(Yii::app()->user->screenName, 'strong')))); } // display the login form $this->render($this->action->id, array('form' => $form)); }
/** * @return UserDetails */ private function getUserDetails() { return UserDetails::model()->findShardedDataByUserId($this->id, 'user_id'); }
<?php $user_id = Sentry::getUser()->id; $user_group = UsersGroups::where('user_id', '=', $user_id)->get()->first(); $userDetails = UserDetails::where('user_id', '=', $user_id)->get()->first(); ?> @section('upper-dropdown') <a data-toggle="dropdown" data-hover="dropdown" class="dropdown-toggle" data-close-others="true" href="#"> @if($userDetails->pic == null) <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="30px" height="30px"> @else <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" class="img-circle" alt="" width="30px" height="30px"> @endif <span class="username hidden-xs">{{ $userDetails->first_name }} {{ $userDetails->last_name }}</span> <i class="fa fa-caret-down "></i> </a> @stop @section('left-user-profile') <div class="inline-block"> @if($userDetails->pic == null) <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="50px" height="50px"> @else <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" alt="" height="50px" width="50px"> @endif </div> <div class="inline-block"> <h5 class="no-margin"> Welcome </h5> <h4 class="no-margin"> {{ $userDetails->first_name }} {{ $userDetails->last_name }} </h4> </div> @stop @section('left-menu')
public function postSignIn() { $inputs = array('identity' => Input::get('identity'), 'password' => Input::get('password')); //Since user can enter username,email we cannot have email validator $rules = array('identity' => 'required|min:4|max:32', 'password' => 'required|min:6'); //Find is that username or password and change identity validation rules //Lets use regular expressions if (filter_var(Input::get('identity'), FILTER_VALIDATE_EMAIL)) { //It is email $rules['identity'] = 'required|min:4|max:32|email'; } else { //It is username . Check if username exist in profile table if (UserDetails::where('username', Input::get('identity'))->count() > 0) { //User exist so get email address $user = UserDetails::where('username', Input::get('identity'))->first(); $inputs['identity'] = $user->email; } else { Session::flash('global', 'User does not exist'); return Redirect::to(route('teacher-sign-in'))->withInput(Input::except('password')); } } $v = Validator::make($inputs, $rules); if ($v->fails()) { return Redirect::to(route('teacher-sign-in'))->withErrors($v)->withInput(Input::except('password')); } else { try { //Try to authenticate user $user = Sentry::getUserProvider()->findByLogin(Input::get('identity')); $throttle = Sentry::getThrottleProvider()->findByUserId($user->id); $throttle->check(); //Authenticate user $credentials = array('email' => Input::get('identity'), 'password' => Input::get('password')); //For now auto activate users $user = Sentry::authenticate($credentials, false); //At this point we may get many exceptions lets handle all user management and throttle exceptions } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { Session::flash('global', 'Login field is required.'); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { Session::flash('global', 'Password field is required.'); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) { Session::flash('global', 'Wrong password, try again.'); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { Session::flash('global', 'User was not found.'); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { Session::flash('global', 'User is not activated.'); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { Session::flash('global', 'User is suspended '); return Redirect::to(route('teacher-sign-in')); } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { Session::flash('global', 'User is banned.'); return Redirect::to(route('teacher-sign-in')); } // $users_login_info = UsersLoginInfo::where('user_id', '=', $user->id)->get(); Session::flash('global', 'Loggedin Successfully'); if ($user->school_id != null && $user->last_login != null) { $school_id = $user->school_id; $users_login_info = new UsersLoginInfo(); $users_login_info->user_id = $user->id; $users_login_info->school_id = $school_id; if ($users_login_info->save()) { Session::flash('global', 'Loggedin Successfully.'); return Redirect::to(route('teacher-home')); } } else { return Redirect::to(route('teacher-welcome-settings')); } } }
public function getUserProfile() { $user = Sentry::getUser(); $user_details = UserDetails::where('user_id', '=', $user->id)->get()->first(); return View::make('user.profile')->withuser($user)->with('user_details', $user_details); }
<?php include_once "model/UserDetails.php"; include_once "header.php"; if (isset($_GET)) { $username = $_GET['username']; $ouserdetails = new UserDetails($dbh); return $ouserdetails->userAvailable($username); }
<?php include_once "model/UserDetails.php"; include_once "header.php"; if (isset($_POST)) { $userid = $_POST['userid']; $otableUserDetails = new UserDetails($dbh); $val = $otableUserDetails->fetchUsers($userid); echo json_encode($val); }
public static function canUserCheckOut($session = null, $cartDetails = null) { /* * The criteria are: * 1. The user is logged in * 2. The user has shipping address * 3. The user has billing address * 4. The user has a phone number * 5. The order amount is more than a particular limit * 6. The shipping class is defined * 7. The payment class is defined */ if (!$session) { $session = Session::getActiveSession(); } $sessionId = $session->getId(); if (!$session->getUser()) { //1. The user is logged in return "User is not logged in"; } $userDetails = UserDetails::getUserDetailsBasedOnUserId($session->getUser()); $shippingAddress = $userDetails->getAddress('shipping_address'); if (!$shippingAddress || !$shippingAddress->getStreetAddress() || !$shippingAddress->getCity() || !$shippingAddress->getPostalCode() || !$shippingAddress->getState() || !$shippingAddress->getCountry()) { return "Shipping address cannot be empty"; } $billingAddress = $userDetails->getAddress('billing_address'); if (!$billingAddress || !$billingAddress->getStreetAddress() || !$billingAddress->getCity() || !$billingAddress->getPostalCode() || !$billingAddress->getState() || !$billingAddress->getCountry()) { return "Billing address cannot be empty"; } if (!$userDetails->getPhoneNumber()) { //4.The user has a phone number return "Phone number cannot be empty"; } if (!$cartDetails) { $cartDetails = Module_EComm::getCartDetails(); } if ($cartDetails["subTotal"] < SiteConfig::get("EComm::MinimumOrderValue")) { //5. The order amount is more than a particular limit return "You must buy at least " . SiteConfig::get("EComm::MinimumOrderValue"); } if (!$session->getShippingClass()) { //6. The shipping class is defined return "You did not select your shipping option"; } if (!$session->getPaymentClass()) { //7. The payment class is defined return "You did not select your payment option"; } return 0; }
public function update_leave($id) { $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $leavecount = LeaveCounter::where('employee_id', $id)->first(); return View::make('admindashboard.updateleave')->with('profile', $profile)->with('leavecount', $leavecount)->with('title', 'STI | Update Leave Count'); }
public function ob_log($id) { $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $leaveob = LeaveOB::where('leave_id', $id)->first(); $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $rleave = LeaveOB::where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.leave_oblog')->with('profile', $profile)->with('countleave', $leavecount)->with('getleave', $leaveob)->with('rleave', $rleave)->with('title', 'STI | OB Log'); }
/** * Display a listing of the resource. * GET /leavewplog * * @return Response */ public function index() { $profile = UserDetails::where('employee_id', Auth::user()->employee_id)->first(); $getleave = AdminLogWP::with('user')->where('status', '!=', '')->orderBy('created_at', 'desc')->get(); return View::make('admindashboard.wplog.approvelog')->with('admin', $profile)->with('getleave', $getleave)->with('title', 'STI | (With pay) Logs'); }
public function updateUserAddress($newAddress) { $user = new UserDetails(); $user->cangeAddress($newAddress); }
public function setEducationalDetails($arrEducation) { $objUserDetails = new UserDetails(); if ($objUser->getUserId() != NULL) { $objUserDetails->setInstituteName($arrEducation['institute_name']); $objUserDetails->setInstituteId($objUser->institute_id); $objUserDetails->setYearOfCompletion($objUser->year_of_completion); $objUserDetails->setCourseId($objUser->course_id); $objUserDetails->setCourseName($objUser->course_name); $objUserDetails->setSpecificationId($objUser->specification_id); $objUserDetails->setSpecificationName($objUser->specification_name); } }
public function getUserelepass($id) { $pass = UserDetails::model()->findByAttributes(array('user_id' => $id)); return $pass->sign; }
/** * Print out array of models for the jqGrid rows. */ public function actionGridData() { if (!Yii::app()->request->isPostRequest) { throw new CHttpException(400, Yii::t('http', 'Invalid request. Please do not repeat this request again.')); exit; } // specify request details $jqGrid = $this->processJqGridRequest(); // specify filter parameters $accessType = isset($_GET['accessType']) ? $_GET['accessType'] : null; if ($accessType !== 'all' && $accessType !== (string) User::MEMBER && $accessType !== (string) User::CLIENT && $accessType !== (string) User::CONSULTANT && $accessType !== (string) User::MANAGER && $accessType !== (string) User::ADMINISTRATOR) { $accessType = 'all'; } $state = isset($_GET['state']) ? $_GET['state'] : null; if ($state !== 'all' && $state !== 'active' && $state !== 'inactive') { $state = 'all'; } // criteria $criteria = new CDbCriteria(); if ($jqGrid['searchField'] !== null && $jqGrid['searchString'] !== null && $jqGrid['searchOper'] !== null) { $field = array('accessType' => "`t`.`accessType`", 'createTime' => "`t`.`createTime`", 'email' => "`t`.`email`", 'screenName' => "`t`.`screenName`", 'deactivationTime' => "`User_UserDetails`.`deactivationTime`", 'occupation' => "`User_UserDetails`.`occupation`"); $operation = $this->getJqGridOperationArray(); $keywordFormula = $this->getJqGridKeywordFormulaArray(); if (isset($field[$jqGrid['searchField']]) && isset($operation[$jqGrid['searchOper']])) { $criteria->condition = '(' . $field[$jqGrid['searchField']] . ' ' . $operation[$jqGrid['searchOper']] . ' :keyword)'; $criteria->params = array(':keyword' => str_replace('keyword', $jqGrid['searchString'], $keywordFormula[$jqGrid['searchOper']])); // search by special field types if ($jqGrid['searchField'] === 'createTime' && ($keyword = strtotime($jqGrid['searchString'])) !== false) { $criteria->params = array(':keyword' => str_replace('keyword', $keyword, $keywordFormula[$jqGrid['searchOper']])); if (date('H:i:s', $keyword) === '00:00:00') { // visitor is looking for a precision by day, not by second $criteria->condition = '(TO_DAYS(FROM_UNIXTIME(' . $field[$jqGrid['searchField']] . ',"%Y-%m-%d")) ' . $operation[$jqGrid['searchOper']] . ' TO_DAYS(FROM_UNIXTIME(:keyword,"%Y-%m-%d")))'; } } } } if ($accessType === (string) User::MEMBER) { $criteria->addCondition("`t`.`accessType`=:member"); $criteria->params[':member'] = User::MEMBER; } else { if ($accessType === (string) User::CLIENT) { $criteria->addCondition("`t`.`accessType`=:client"); $criteria->params[':client'] = User::CLIENT; } else { if ($accessType === (string) User::CONSULTANT) { $criteria->addCondition("`t`.`accessType`=:consultant"); $criteria->params[':consultant'] = User::CONSULTANT; } else { if ($accessType === (string) User::MANAGER) { $criteria->addCondition("`t`.`accessType`=:manager"); $criteria->params[':manager'] = User::MANAGER; } else { if ($accessType === (string) User::ADMINISTRATOR) { $criteria->addCondition("`t`.`accessType`=:administrator"); $criteria->params[':administrator'] = User::ADMINISTRATOR; } } } } } if ($state === 'active') { $criteria->addCondition("(`t`.`isActive` IS NULL OR `t`.`isActive`!=:isNotActive)"); $criteria->params[':isNotActive'] = User::IS_NOT_ACTIVE; } else { if ($state === 'inactive') { $criteria->addCondition("`t`.`isActive`=:isNotActive"); $criteria->params[':isNotActive'] = User::IS_NOT_ACTIVE; } } // pagination $with = array(); if (strpos($criteria->condition, 'User_UserDetails') !== false) { $with[] = 'details'; } if (count($with) >= 1) { $pages = new CPagination(User::model()->with($with)->count($criteria)); } else { $pages = new CPagination(User::model()->count($criteria)); } $pages->pageSize = $jqGrid['pageSize'] !== null ? $jqGrid['pageSize'] : self::GRID_PAGE_SIZE; $pages->applyLimit($criteria); // sort $sort = new CSort('User'); $sort->attributes = array('accessType' => array('asc' => "`t`.`accessLevel`", 'desc' => "`t`.`accessLevel` desc", 'label' => User::model()->getAttributeLabel('accessType')), 'createTime' => array('asc' => "`t`.`createTime`", 'desc' => "`t`.`createTime` desc", 'label' => User::model()->getAttributeLabel('Registered')), 'email' => array('asc' => "`t`.`email`", 'desc' => "`t`.`email` desc", 'label' => User::model()->getAttributeLabel('email')), 'screenName' => array('asc' => "`t`.`screenName`", 'desc' => "`t`.`screenName` desc", 'label' => User::model()->getAttributeLabel('screenName')), 'deactivationTime' => array('asc' => "`User_UserDetails`.`deactivationTime`", 'desc' => "`User_UserDetails`.`deactivationTime` desc", 'label' => UserDetails::model()->getAttributeLabel('Deact')), 'occupation' => array('asc' => "`User_UserDetails`.`occupation`", 'desc' => "`User_UserDetails`.`occupation` desc", 'label' => UserDetails::model()->getAttributeLabel('occupation'))); $sort->defaultOrder = "`t`.`screenName`"; $sort->applyOrder($criteria); // find all $models = User::model()->with('details')->findAll($criteria); // create resulting data array $data = array('page' => $pages->getCurrentPage() + 1, 'total' => $pages->getPageCount(), 'records' => $pages->getItemCount(), 'rows' => array()); foreach ($models as $model) { $data['rows'][] = array('id' => $model->id, 'cell' => array(CHtml::encode($model->screenName), CHtml::encode($model->details->occupation), CHtml::encode($model->email), CHtml::encode(MDate::format($model->createTime, 'medium', null)), CHtml::encode(MDate::format($model->details->deactivationTime, 'medium', null)), CHtml::encode($model->getAttributeView('accessType')), CHtml::link('<span class="ui-icon ui-icon-zoomin"></span>', array('show', 'id' => $model->id), array('class' => 'w3-ig w3-link-icon w3-border-1px-transparent w3-first ui-corner-all', 'title' => Yii::t('link', 'Show'))) . CHtml::link('<span class="ui-icon ui-icon-pencil"></span>', array('update', 'id' => $model->id), array('class' => 'w3-ig w3-link-icon w3-border-1px-transparent w3-last ui-corner-all', 'title' => Yii::t('link', 'Edit'))))); } $this->printJson($data); }
/** * Merges two user detail value objects * * @param UserDetails $established * @param UserDetails $patch * * @return UserDetails */ public static function mergeProfileData(UserDetails $established, UserDetails $patch) { // since the current business behavior does not allow the change of email addresses // or the registration date, these values are immutable return new self($established->getEmail(), $patch->getLastAction(), $established->getRegistrationDate(), $patch->getLocale() ?: $established->getLocale(), $patch->getRealName() ?: $established->getRealName(), $patch->isLocked()); }
public function getuserphoto($id) { $name = UserDetails::model()->findByAttributes(array('user_id' => $id)); if ($name->photo != NULL) { return '<img src="users/' . $id . '/' . $name->photo . '.jpg" width="59" height="59" />'; } else { return '<img src="images/user.jpg" width="59" height="59" />'; } }
public function postEdit() { $pic_New_Name = NULL; if (Input::hasFile('pic')) { $file = Input::file('pic'); $new_path = 'assets\\projects\\images\\profilepics'; $file_Temporary_name = $file->getFilename(); // emporary file name $file_OriginalName = $file->getClientOriginalName(); // Original Name of the file $file_Size = $file->getClientSize(); // Size of the file $file_MimeType = $file->getClientMimeType(); // Mime Type of the file $file_Extension = $file->guessClientExtension(); // Ext of the file $file_TemporaryPath = $file->getRealPath(); // Temporary file path $pic_New_Name = md5(date('Y-m-d H:i:s:u')) . "." . $file_Extension; $uploaded = $file->move($new_path, $pic_New_Name); } //$pic = Image::make($file)->resize(300,150)->save($new_path.$file_OriginalName); $validator = Validator::make(Input::all(), array('first_name' => 'max:30', 'last_name' => 'max:30', 'mobile_number' => 'max:10', 'home_number' => 'max:10', 'dd' => 'max:2', 'mm' => 'max:2', 'yyyy' => 'max:4', 'add_1' => 'max:30', 'city' => 'max:30', 'state' => 'max:30', 'pin_code' => 'max:10', 'country' => 'max:30')); if ($validator->fails()) { return Redirect::route('admin-profile')->withErrors($validator)->withInput(); } else { $user = $this->getUser(); $user_details = UserDetails::where('user_id', '=', $user->id)->get()->first(); $now = date("Y-m-d H-i-s"); $user_details->first_name = Input::get('first_name'); $user_details->middle_name = Input::get('middle_name'); $user_details->last_name = Input::get('last_name'); if ($user_details->mobile_number != Input::get('mobile_number')) { $user_details->mobile_number = Input::get('mobile_number'); $user_details->mobile_updated_at = $now; } $user_details->home_number = Input::get('home_number'); $user_details->dob = Input::get('yyyy') . "-" . Input::get('mm') . "-" . Input::get('dd'); $user_details->sex = Input::get('sex'); $user_details->marriage_status = Input::get('marriage_status'); if ($user_details->add_1 != Input::get('add_1') || $user_details->add_2 != Input::get('add_2')) { $user_details->add_1 = Input::get('add_1'); $user_details->add_2 = Input::get('add_2'); $user_details->address_updated_at = $now; } if ($user_details->city != Input::get('city') || $user_details->state != Input::get('state') || $user_details->pin_code != Input::get('pin_code') || $user_details->country != Input::get('country')) { $user_details->city = Input::get('city'); $user_details->state = Input::get('state'); $user_details->pin_code = Input::get('pin_code'); $user_details->country = Input::get('country'); $user_details->address_updated_at = $now; } if (isset($pic_New_Name)) { $user_details->pic = $pic_New_Name; $user_details->pic_updated_at = $now; } if ($user_details->save()) { return Redirect::route('admin-profile')->with('details-changed', 'Your Details are updated'); } else { return Redirect::route('admin-profile')->with('details-not-changed', 'Your Details Couldnt updated. Some Error Occured'); } } }
<?php include_once "model/UserDetails.php"; include_once "header.php"; if (isset($_POST)) { $oldpassword = $_POST['oldpassword']; $username = $_POST['username']; $locid = $_POST['locid']; $ouserdetails = new UserDetails($dbh); return $ouserdetails->passwordAvailable($oldpassword, $username, $locid); }