public static function _manage_platoon($div, $plt) { $division = Division::findByName(strtolower($div)); $platoonId = Platoon::getIdFromNumber($plt, $division->id); if (!is_null($platoonId)) { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) { $tools = Tool::find_all($user->role); $divisions = Division::find_all(); $platoon = Platoon::findById($platoonId); $unassignedMembers = Platoon::unassignedMembers($platoonId, true); $squads = Squad::findByPlatoonId($platoonId); $memberCount = count((array) Platoon::members($platoonId)); $js = 'manage'; Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content'); Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions')); } else { // insufficient access Flight::redirect('404/', 404); } } else { // nonexistent platoon Flight::redirect('404/', 404); } }
public function overview() { $members = Member::find('all', ['order' => 'username']); $this->setViewData('members', $members); $schedules = Schedule::find('all', ['conditions' => ['date >= UNIX_TIMESTAMP()'], 'order' => 'date']); $this->setViewData('schedules', $schedules); }
public static function loanAccountNumber($loanaccount) { $member = Member::find($loanaccount->member->id); $count = count($member->loanaccounts); $count = $count + 1; //$count = DB::table('loanproducts')->where('member_id', '=', $loanaccount->member->id)->count(); $loanno = $loanaccount->loanproduct->short_name . "-" . $loanaccount->member->membership_no . "-" . $count; return $loanno; }
public static function _doUsersOnline() { if (isset($_SESSION['loggedIn'])) { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); Flight::render('user/online_list', compact('user', 'member')); } else { Flight::render('user/online_list'); } }
public static function createAccount($id) { $member = Member::find($id); $share = new Share(); $acc = 'SH-' . $member->membership_no; $shareaccount = new Shareaccount(); $shareaccount->member()->associate($member); $shareaccount->account_number = $acc; $shareaccount->opening_date = date('Y-m-d'); $shareaccount->save(); }
public static function _doDivisionThreadCheck() { if (!empty($_POST['player'])) { $player = trim($_POST['player']); $member = Member::find(intval($_SESSION['memberid'])); $gameThreads = DivisionThread::find_all($member->game_id); $js = 'check_threads'; Flight::render('recruiting/thread_check', compact('js', 'gameThreads', 'player')); } else { echo "<span class='text-muted'>A valid player was not provided!</span>"; } }
public static function _authenticate() { if (User::isLoggedIn()) { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); $tools = Tool::find_all($user->role); $divisions = Division::find_all(); Flight::render('layouts/auth', [], 'content'); Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions')); } else { Flight::render('layouts/auth', [], 'content'); Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions')); } }
/** * Store a newly created shareaccount in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Shareaccount::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $member = Member::find(Input::get('member_id')); $acc = 'SH-' . $member_no; $shareaccount = new Shareaccount(); $shareaccount->member()->associate($member); $shareaccount->account_number = $acc; $shareaccount->opening_date = date(); $shareaccount->save(); return Redirect::route('shareaccounts.index'); }
public function actionLogin() { $model = new Member(); $email = $_REQUEST['email']; $passwd = md5($_REQUEST['passwd']); $arr = $model->find()->where(['email' => $email])->asArray()->one(); if ($arr) { if ($arr['password'] == $passwd) { $res['code'] = '10200'; $res['mess'] = 'success'; $res['stat'] = ''; exit(json_encode($res)); } } print_r($arr); die; }
function _doBattlelogIdUpdate() { $members = array(); $battlelog_names = objectToArray(Member::find(array('status_id' => 1, 'battlelog_name !%' => 0, 'battlelog_id' => 0))); $countNames = count($battlelog_names); echo "Fetched battlelog names. ({$countNames})<br /><br />"; foreach ($battlelog_names as $row) { $battlelog_id = Member::getBattlelogId($row['battlelog_name']); if (!$battlelog_id['error']) { $sql = "UPDATE member SET battlelog_id = {$battlelog_id['id']} WHERE battlelog_name = '{$row['battlelog_name']}'"; Flight::aod()->sql($sql)->one(); echo "Added ID {$battlelog_id['id']} to {$row['battlelog_name']}<br />"; } else { echo "ERROR: {$row['battlelog_name']} - {$battlelog_id['message']}<br />"; } } echo "done syncing battlelog ids."; }
public static function _retentionNumbers() { $user = User::find(intval($_SESSION['userid'])); if ($user->role >= 3 || User::isDev()) { $member = Member::find(intval($_SESSION['memberid'])); $tools = Tool::find_all($user->role); $divisions = Division::find_all(); $recruited = Report::recruitedLast30days($member->game_id); $removed = Report::removedLast30days($member->game_id); $monthlyBreakdown = Report::recruitingWeekly($member->game_id); $byTheMonth = Report::recruitingByTheMonth($member->game_id); $js = 'report'; Flight::render('reports/retention', compact('recruited', 'removed', 'js', 'monthlyBreakdown', 'byTheMonth'), 'content'); Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions)); } else { Flight::redirect('/404', 404); } }
/** * This function shows user profile */ public function getUserProfile() { if (Session::get('admin') == 'admin') { $user = User::where('username', '=', Session::get('username'))->get()->first(); $userProfile = Admin::find($user->details_id); $userProfile->DOB = DateFormat::show($userProfile->DOB); return View::make('user.profile')->with('userProfile', $userProfile); } if (Session::get('employee') == 'employee') { $user = User::where('username', '=', Session::get('username'))->get()->first(); $userProfile = Employee::find($user->details_id); $userProfile->DOB = DateFormat::show($userProfile->DOB); return View::make('user.profile')->with('userProfile', $userProfile); } if (Session::get('member') == 'member') { $user = User::where('username', '=', Session::get('username'))->get()->first(); $userProfile = Member::find($user->details_id); $userProfile->DOB = DateFormat::show($userProfile->DOB); return View::make('user.profile')->with('userProfile', $userProfile); } }
public function postSignIn() { // check validation $validator = Validator::make(Input::all(), array('username' => 'required', 'password' => 'required')); // if validation is failed it's redirected // to sign in page with validation errors if ($validator->fails()) { return Redirect::route('signin-get')->withErrors($validator)->withInput(); } else { $remember = Input::has('remember') ? true : false; $auth = Auth::attempt(array('username' => Input::get('username'), 'password' => trim(Input::get('password')), 'active' => 1), $remember); if ($auth) { $user = User::where('username', '=', Input::get('username'))->get()->first(); // Holding all important data // from database to session // variable Session::put('username', $user->username); Session::put('user_level', $user->user_level); Session::put('user_id', $user->id); Session::put('wc_msg', 1); if ($user->user_level === 'admin') { Session::put('admin', 'admin'); Session::put('employee_id', Employee::find($user->details_id)->id); return Redirect::intended('/admin'); } elseif ($user->user_level === 'employee') { Session::put('employee', 'employee'); Session::put('employee_id', Employee::find($user->details_id)->id); return Redirect::intended('/employee'); } elseif ($user->user_level === 'member') { Session::put('member', 'member'); Session::put('member_id', Member::find($user->details_id)->id); return Redirect::intended('/member'); } } else { return View::make('userAuthentication.signin')->with('invalid', 'Invalid Username/Password.'); } } }
public static function importSavings($member, $date, $savingaccount, $amount) { $member = Member::find($member[0]->id); $savingaccount = Savingaccount::find($savingaccount[0]->id); //check if account and member exists $savingtransaction = new Savingtransaction(); $savingtransaction->date = $date; $savingtransaction->savingaccount()->associate($savingaccount); $savingtransaction->amount = $amount; $savingtransaction->type = 'credit'; $savingtransaction->description = 'savings deposit'; $savingtransaction->transacted_by = $member->fullname; $savingtransaction->save(); foreach ($savingaccount->savingproduct->savingpostings as $posting) { if ($posting->transaction == 'deposit') { $debit_account = $posting->debit_account; $credit_account = $posting->credit_account; } } $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => $date, 'amount' => $amount, 'initiated_by' => 'system', 'description' => 'cash deposit'); $journal = new Journal(); $journal->journal_entry($data); Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'Savings imported', 'Savings', $amount); }
public function postAction() { try { $id = Arr::get($_POST, 'id', null); $password = Arr::get($_POST, 'password', false); $email = Arr::get($_POST, 'email', ''); $name = Arr::get($_POST, 'name', ''); $birthday = Arr::get($_POST, 'birthday', ''); $phone = Arr::get($_POST, 'phone', ''); $address = Arr::get($_POST, 'address', ''); if ($id === null) { throw new Exception('request error.'); } $m = Member::find($id); if ($m == null) { throw new Exception('not found user'); } if (!$password) { $password = trim($password); if (!empty($password)) { $m->password = Hash::make($password); } } $m->email = $email; $m->name = $name; $m->birthday = $birthday; $m->phone = $phone; $m->address = $address; if (!$m->save()) { throw new Exception('store user error'); } return Redirect::route('admin.member.list'); } catch (Exception $e) { return Redirect::route('admin.member.list', array('message' => $e->getMessage())); } }
public function updateMember($member_id) { $cre = ["member" => Input::get('member'), "username" => Input::get('username'), "dob" => Input::get('dob'), "city_id" => Input::get('city_id'), "center_id" => Input::get('center_id'), "doj" => Input::get('doj'), "mobile" => Input::get('mobile'), "address" => Input::get('address'), "city" => Input::get('city'), "priv" => Input::get('priv'), "state" => Input::get('state')]; $rules = ["member" => 'required', "username" => 'required', "member" => 'required', "dob" => 'required', "doj" => 'required', "mobile" => 'required', "address" => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $member = Member::find($member_id); $member->name = Input::get('member'); $member->username = Input::get('username'); $member->dob = Input::get('dob'); $member->city_id = Input::get('city_id'); $member->center_id = Input::get('center_id'); $member->doj = Input::get('doj'); $member->mobile = Input::get('mobile'); $member->address = Input::get('address'); $member->city = Input::get('city'); $member->priv = Input::get('priv'); $member->state = Input::get('state'); $member->save(); $count = Input::get('count'); $data["success"] = true; $data["message"] = html_entity_decode(View::make('admin.manage.members.view', ["data" => $member, "count" => $count])); } else { $data["success"] = false; $data["message"] = "All fields are not filled"; } return json_encode($data); }
public static function dateMemberTable() { $id = AppHelper::idMemberTable(); $var = Member::find($id); return $var->date_of_membership; }
public function active($type, $id) { if ($type == 'true') { Member::Where('status', '=', 1)->update(array('status' => 2)); return Redirect::to('members'); } if ($type == 'false') { foreach (User::Where('status', '=', 1)->get() as $val) { User::find($val->id)->roles()->detach(1); } User::Where('status', '=', 1)->delete(); return Redirect::to('members'); } if ($type == 'one') { $member = Member::find($id); $member->status = 2; $member->save(); Logfile::addData('Kích hoạt', 'thành viên', $member->id, $member->name); return Redirect::to('members'); } }
public function doPaymentSelect($id) { $user = Auth::user(); $member = Member::find($id); $title = 'League Together - ' . $member->team->club->name . ' Teams'; $type = Input::get('type'); $club = Club::find($member->team->club->id); switch ($type) { case 'full': $price = $member->getOriginal('due'); $today = Carbon::Now(); $early = new Carbon($member->early_due_deadline); if ($member->early_due_deadline) { if ($today->startOfDay() <= $early->startOfDay()) { $price = $member->getOriginal('early_due'); } } $item = array('id' => $member->team->id, 'name' => "Membership Team " . $member->team->name, 'price' => $price, 'quantity' => 1, 'organization' => $member->team->club->name, 'organization_id' => $member->team->club->id, 'member_id' => $member->id, 'player_id' => $member->player->id, 'user_id' => $user->id, 'type' => $type, 'autopay' => false); Cart::insert($item); foreach (Cart::contents() as $item) { $item->name = "Membership Team " . $member->team->name; $item->quantity = 1; } return Redirect::action('MemberController@paymentCreate', array($member->id)); case 'plan': $price = $member->plan->getOriginal('initial'); $item = array('id' => $member->team->id, 'name' => "Membership Team " . $member->team->name, 'price' => $price, 'quantity' => 1, 'organization' => $member->team->club->name, 'organization_id' => $member->team->club->id, 'member_id' => $member->id, 'player_id' => $member->player->id, 'user_id' => $user->id, 'type' => $type, 'autopay' => false); Cart::insert($item); foreach (Cart::contents() as $item) { $item->name = "Membership Team " . $member->team->name; $item->quantity = 1; } return Redirect::action('MemberController@paymentCreate', array($member->id)); default: return Redirect::action('MemberController@paymentSelect', array($member->id))->with('error', 'Opps we are having some trouble processing your request, please try later. Error# 345'); } }
public function getMembers() { $options = ['order' => 'username']; $members = Member::find('all', $options); return $members; }
public function test11() { // 모든 슬립 avgSleep 가져옴. $member = Member::find(1); // $a = $this->avgSleepRepo->getAllAvgSleep($member); // $_self = &$this; // $a->each(function($record) use ($member, $_self) { // $regidx = $record->regIdx; // $eachSleep = $_self->sleepRecordRepo->getRecordsByRegIdx($member, $regidx); // $eachSleep->each(function($srecord) { // $srecord->noisePeak = mt_rand(500, 700); // $srecord->noise = 'output_normal.wav'; // $srecord->update(); // }); // }); $eachSleeps = $this->sleepRecordRepo->getRecordsByRegIdx($member, 9); $eachSleeps = $eachSleeps->toArray(); $count = count($eachSleeps); for ($i = 0; $i < $count; $i += 20) { $obj = NULL; $noisePeak = -1; for ($j = $i; $j < $i + 20; $j++) { if (!isset($eachSleeps[$j])) { break; } $np = $eachSleeps[$j]['noisePeak']; if ($np > $noisePeak) { $obj = $eachSleeps[$j]; $noisePeak = $np; } } echo ' 시작 시간 : ' . $eachSleeps[$i]['regtime'] . '<br />'; echo ' 시끄러운 정도 , 파일 이름 ' . sprintf("%s %s <br />", $obj['noisePeak'], $obj['noise']); echo '<br />'; } }
public static function validatePassword($pass, $user) { $user = strtolower($user); $params = self::find($user); $member = Member::find($user); if (!empty($params)) { if ($pass == hasher($pass, $params->credential)) { return array('userid' => $params->id, 'memberid' => $member->id); } else { return false; } } else { return false; } }
/** * Execute the console command. * * @return mixed */ public function fire() { $startDate = Carbon::now(); $from = Carbon::now()->hour(0)->minute(0)->second(0); $to = Carbon::now()->hour(23)->minute(59)->second(59); $schedules = SchedulePayment::where('status', 0)->whereBetween('date', array($from, $to))->with('member.user.profile')->get(); //$schedules = SchedulePayment::where('status', 0)->with('member.user.profile')->get(); $errors = array(); $totalAmount = array(); $errorAmount = array(); //save daylog $dayLog = new ScheduleDailyLog(); $dayLog->started_on = Carbon::now()->toDateTimeString(); $dayLog->payments_count = count($schedules); $dayLog->save(); Cart::destroy(); foreach ($schedules as $schedule) { try { $vault = $schedule->member->user->profile->customer_vault; $user = User::find($schedule->member->user->id); $player = Player::find($schedule->member->player->id); $club = Club::find($schedule->club_id); $team = Team::find($schedule->member->team_id); $uuid = Uuid::generate(); $member = Member::find($schedule->member->id); $history = SchedulePayment::find($schedule->id); //manually login user out before login new user Auth::logout(); //manually login user Auth::login($user); //clear cart content Cart::destroy(); //set cart item $itemCart = array('id' => $team->id, 'name' => "Scheduled payment for " . $team->name, 'price' => $schedule->subtotal, 'quantity' => 1, 'organization' => $club->name, 'organization_id' => $club->id, 'player_id' => $player->id, 'user_id' => $user->id, 'type' => 'full', 'autopay' => true); Cart::insert($itemCart); //check if vault exist if ($vault) { $param = array('customer_vault_id' => $vault, 'discount' => null, 'club' => $club->id); $payment = new Payment(); $transaction = $payment->sale($param); //temp json_decode(json_encode($array), FALSE); //$transaction = json_decode(json_encode(array('response' => 1, 'total'=>$schedule->total, 'fee'=>$schedule->fee)), FALSE); if ($transaction->response == 3 || $transaction->response == 2) { $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $transaction->transactionid . ' : ' . $transaction->responsetext, 'error_amount' => $schedule->total, 'daily_log_id' => $dayLog->id); array_push($errorAmount, number_format($schedule->total, 2)); //Email error $emailerrorstatus = $payment->error($transaction, $club->id, $player->id); } else { array_push($totalAmount, number_format($transaction->total, 2)); $payment->id = $uuid; $payment->customer = $vault; $payment->transaction = $transaction->transactionid; $payment->subtotal = $transaction->subtotal; $payment->service_fee = $transaction->fee; $payment->total = $transaction->total; $payment->promo = $transaction->promo; $payment->tax = $transaction->tax; $payment->discount = $transaction->discount; $payment->club_id = $club->id; $payment->user_id = $user->id; $payment->player_id = $player->id; $payment->event_type = null; $payment->type = $transaction->type; $payment->save(); //Email receipt $payment->receipt($transaction, $club->id, $player->id); $sale = new Item(); $sale->description = $itemCart['name']; $sale->quantity = $itemCart['quantity']; $sale->price = $itemCart['price']; $sale->fee = $transaction->fee; $sale->member_id = $member->id; $sale->team_id = $team->id; $sale->payment_id = $uuid; $sale->save(); //update schedule $history->status = 2; $history->save(); } } else { //save error that vault didnt exist $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => 'Customer Vault not found', 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id); array_push($errorAmount, number_format($schedule->total, 2)); } } catch (Exception $e) { //save internal error $errors[] = array('payment_schedule_id' => $schedule->id, 'error_description' => $e, 'error_amount' => number_format($schedule->total, 2), 'daily_log_id' => $dayLog->id); array_push($errorAmount, number_format($schedule->total, 2)); } } //end of foreach schedule //save log for everything done $dayLogEnd = ScheduleDailyLog::find($dayLog->id); $dayLogEnd->ended_on = Carbon::now()->toDateTimeString(); $dayLogEnd->successful_count = Count($totalAmount); $dayLogEnd->error_count = Count($errors); $dayLogEnd->total_amount = array_sum($totalAmount); $dayLogEnd->total_amount_error = array_sum($errorAmount); $dayLogEnd->save(); //save log for errors if (Count($errors) > 0) { foreach ($errors as $errorItem) { $scheduleError = new ScheduleDailyError(); $scheduleError->error_description = $errorItem['error_description']; $scheduleError->error_amount = $errorItem['error_amount']; $scheduleError->payment_schedule_id = $errorItem['payment_schedule_id']; $scheduleError->daily_log_id = $dayLogEnd->id; $scheduleError->save(); } } return Log::info($errors); }
public static function _updateLoa() { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); if (isset($_POST['remove']) || isset($_POST['approve'])) { if ($user->role < 2) { $data = array('success' => false, 'message' => "You are not authorized to perform that action."); } else { $loa = isset($_POST['loa_id']) ? LeaveOfAbsence::findById($_POST['loa_id']) : null; if (isset($_POST['remove'])) { $revoked = LeaveOfAbsence::delete($loa->id); UserAction::create(array('type_id' => 8, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $loa->member_id)); $data = array('success' => true, 'message' => "Leave of absence successfully removed."); } else { if (isset($_POST['approve'])) { if ($member->member_id == $loa->member_id) { $data = array('success' => false, 'message' => "You can't approve your own leave of absence!"); } else { $approved = LeaveOfAbsence::approve($loa->id, $member->member_id); UserAction::create(array('type_id' => 7, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $loa->member_id)); $data = array('success' => true, 'message' => "Leave of absence successfully approved."); } } } } } else { $date = date('Y-m-d', strtotime($_POST['date'])); $reason = $_POST['reason']; $comment = htmlentities($_POST['comment'], ENT_QUOTES); $name = Member::findForumName($_POST['id']); if ($name) { if (strtotime($date) > strtotime('now')) { if (LeaveOfAbsence::exists($member->member_id)) { $data = array('success' => false, 'message' => "This member already has an LOA in place!"); } else { LeaveOfAbsence::add($_POST['id'], $date, $reason, $comment, $member->game_id); UserAction::create(array('type_id' => 11, 'date' => date("Y-m-d H:i:s"), 'user_id' => $_POST['id'])); $data = array('success' => true, 'Request successfully submitted!', 'id' => $_POST['id'], 'name' => $name, 'date' => date('M d, Y', strtotime($date)), 'reason' => $reason); } } else { $data = array('success' => false, 'message' => "Date cannot be before today's date."); } } else { $data = array('success' => false, 'message' => 'The member id you provided appears to be invalid.'); } } echo json_encode($data); }
$sid = $_POST['sid']; $linkedin_id = $_POST['linkedin_id']; if (empty($sid)) { $seed = Seed::generateSeed(); $hash = sha1($id . md5($linkedin_id) . $seed['login']['seed']); $sid = $seed['login']['id']; } $_SESSION['yel']['member']['id'] = $id; $_SESSION['yel']['member']['hash'] = $hash; $_SESSION['yel']['member']['sid'] = $sid; $_SESSION['yel']['member']['linkedin_id'] = $linkedin_id; header('Content-type: text/xml'); $member = new Member($id, $sid); // 1. find whether this member exists, from the ID $criteria = array('columns' => "COUNT(*) AS is_exists", 'match' => "email_addr = '" . $id . "'"); $result = $member->find($criteria); if ($result[0]['is_exists'] != '1') { // sign the member up $joined_on = today(); $data = array(); $data['password'] = md5(generate_random_string_of(6)); $data['phone_num'] = '0'; $data['firstname'] = $_POST['linkedin_firstname']; $data['lastname'] = $_POST['linkedin_lastname']; $data['linkedin_id'] = $linkedin_id; $data['joined_on'] = $joined_on; $data['updated_on'] = $joined_on; $data['active'] = 'Y'; $data['checked_profile'] = 'Y'; if (is_null($data['firstname']) || empty($data['firstname']) || is_null($data['lastname']) || empty($data['lastname'])) { $data['firstname'] = 'Unknown';
public function validation($team, $member) { $member = Member::find($member); $player = Player::find($member->player_id)->with("user")->FirstOrFail(); $user = $player->user[0]; $messages = array('card.required' => "Credit Card Number Required", 'month.required' => "Expiration Month Required", 'year.required' => "Expiration Year Required", 'cvv.required' => "Security Code Required", 'address1.required' => "Billing Address Required", 'city.required' => "Billing City Required", 'state.required' => "Billing state Required", 'zip.required' => "Billing zip Required"); $validator = Validator::make(Input::all(), Plan::$rules_validation, $messages); if ($validator->passes()) { //validation done prior ajax $param = array('ccnumber' => Input::get('card'), 'ccexp' => sprintf('%02s', Input::get('month')) . Input::get('year'), 'cvv' => Input::get('cvv'), 'address1' => Input::get('address1'), 'city' => Input::get('city'), 'state' => Input::get('state'), 'zip' => Input::get('zip')); $payment = new Payment(); $transaction = $payment->create_customer($param, $user->id); if ($transaction->response == 3 || $transaction->response == 2) { $data = array('success' => false, 'error' => $transaction); $object = json_decode(json_encode($data), FALSE); return Redirect::back()->withErrors($object->error->responsetext)->withInput(); } else { //update user customer # User::where('id', $user->id)->update(array('customer_id' => $transaction->customer_vault_id)); return Redirect::action('PlanController@create', array($team, $member->id)); } } $error = $validator->errors()->all(':message'); return Redirect::back()->withErrors($error)->withInput(); }
public static function _doAddMember() { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); $division = Division::findById($member->game_id); $platoon_id = $user->role >= 3 || User::isDev() ? $_POST['platoon_id'] : $member->platoon_id; $squad_id = $user->role >= 2 || User::isDev() ? $_POST['squad_id'] : Squad::mySquadId($member->id) ?: 0; $recruiter = $member->member_id; $position_id = 6; // provide params for brand new members $params = array('member_id' => $_POST['member_id'], 'forum_name' => trim($_POST['forum_name']), 'recruiter' => $recruiter, 'game_id' => $_POST['game_id'], 'status_id' => 999, 'join_date' => date("Y-m-d H:i:s"), 'last_forum_login' => date("Y-m-d H:i:s"), 'last_activity' => date("Y-m-d H:i:s"), 'last_forum_post' => date("Y-m-d H:i:s"), 'last_promotion' => date("Y-m-d H:i:s"), 'rank_id' => 1, 'platoon_id' => $platoon_id, 'squad_id' => $squad_id, 'position_id' => $position_id); if (Member::exists($_POST['member_id'])) { // update existing record $existing_member_id = Member::findId($_POST['member_id']); $params = array_merge($params, array('id' => $existing_member_id)); $affected_rows = Member::modify($params); if ($affected_rows > 0) { UserAction::create(array('type_id' => 10, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $params['member_id'])); $data = array('success' => true, 'message' => "Existing member successfully updated!"); } else { $data = array('success' => false, 'message' => "Existing member could not be updated."); } } else { // member doesn't exist $insert_id = Member::create($params); if ($insert_id != 0) { UserAction::create(array('type_id' => 1, 'date' => date("Y-m-d H:i:s"), 'user_id' => $member->member_id, 'target_id' => $params['member_id'])); $data = array('success' => true, 'message' => "Member successfully added!"); } else { $data = array('success' => false, 'message' => "Member could not be added."); } } if ($insert_id != 0) { if (isset($_POST['played_games'])) { $games = $_POST['played_games']; foreach ($games as $game) { $memberGame = new stdClass(); $memberGame->member_id = $insert_id; $memberGame->game_id = $game; MemberGame::add($memberGame); } } if (isset($_POST['ingame_name'])) { $ingame_name = trim($_POST['ingame_name']); $handle = new stdClass(); $handle->member_id = $insert_id; $handle->handle_type = $division->primary_handle; $handle->handle_value = $ingame_name; $handle->handle_account_id = '0'; $handle->invalid = '0'; $handle->invalid_date = '0000-00-00'; MemberHandle::add($handle); } } echo json_encode($data); }
public function postAssignshopcat() { $in = Input::get(); $category = $in['category']; $cats = Prefs::getShopCategory()->ShopCatToSelection('slug', 'name', false); $product_ids = $in['product_ids']; foreach ($product_ids as $p) { $prop = Member::find($p); $prop->shopcategory = $cats[$category]; $prop->shopcategoryLink = $category; $prop->save(); } return Response::json(array('result' => 'OK')); }
Route::get('products/edit/{id}', 'ProductsController@edit'); Route::get('products/create', 'ProductsController@create'); Route::get('products/delete/{id}', 'ProductsController@destroy'); Route::get('products/orders/{id}', 'ProductsController@orders'); Route::get('shop', 'ProductsController@shop'); /* * orders controllers */ Route::resource('orders', 'OrdersController'); Route::post('orders/update/{id}', 'OrdersControler@update'); Route::get('orders/edit/{id}', 'OrdersControler@edit'); Route::get('orders/delete/{id}', 'OrdersControler@destroy'); Route::get('savings', function () { $mem = Confide::user()->username; $memb = DB::table('members')->where('membership_no', '=', $mem)->pluck('id'); $member = Member::find($memb); return View::make('css.savingaccounts', compact('member')); }); Route::post('loanguarantors', function () { $mem_id = Input::get('member_id'); $member = Member::findOrFail($mem_id); $loanaccount = Loanaccount::findOrFail(Input::get('loanaccount_id')); $guarantor = new Loanguarantor(); $guarantor->member()->associate($member); $guarantor->loanaccount()->associate($loanaccount); $guarantor->amount = Input::get('amount'); $guarantor->save(); return Redirect::to('memloans/' . $loanaccount->id); }); Route::get('backups', function () { //$backups = Backup::getRestorationFiles('../app/storage/backup/');
</p><p style="font-weight: bold;">Find a member... </p><p><?php $criteria = array('columns' => 'members.email_addr, CONCAT(members.firstname, \' \', members.lastname) AS name, countries.country, currencies.symbol', 'match' => 'email_addr = \'pamalite@gmail.com\'', 'joins' => 'countries ON countries.country_code = members.country, currencies ON currencies.country_code = countries.country_code'); $members = Member::find($criteria); print_array($members); ?> </p><p style="font-weight: bold;">Create a new member... </p><p><?php $member = new Member('*****@*****.**'); $data = array(); $data['password'] = md5('bibi'); $data['forget_password_question'] = 1; $data['forget_password_answer'] = 'bibi answer'; $data['phone_num'] = '222 2234 4566'; $data['firstname'] = 'Bibi'; $data['lastname'] = 'Choon'; $data['zip'] = '0A33Z8'; $data['country'] = 'CA'; if ($member->create($data)) { $criteria = array('columns' => 'members.email_addr, CONCAT(members.firstname, \' \', members.lastname) AS name, countries.country, currencies.symbol', 'match' => 'email_addr = \'bibi@bibi.com\'', 'joins' => 'countries ON countries.country_code = members.country, currencies ON currencies.country_code = countries.country_code'); print_array(Member::find($criteria)); } else { echo "exit"; exit; } ?> </p>