/** * Searches for students */ public function searchAction() { $query = Criteria::fromInput($this->di, "Students", array_merge($_GET, $_POST)); $this->persistent->parameters = $query->getParams(); $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $students = \Students::find($parameters)->toArray(true); $this->view->disable(); $this->response->setContentType('application/json', 'UTF-8'); echo json_encode(array("student" => $students)); }
static function updateStudent($inputs) { $student = Students::find($inputs['studentId']); $student->student_name = $inputs['studentName']; $student->student_gender = $inputs['studentGender']; $student->student_date_of_birth = date('Y-m-d', strtotime($inputs['studentDob'])); $student->nickname = $inputs['nickname']; $student->school = $inputs['school']; $student->location = $inputs['location']; $student->hobbies = $inputs['hobbies']; $student->emergency_contact = $inputs['emergencyContact']; $student->remarks = $inputs['remarks']; $student->health_issue = $inputs['healthIssue']; $student->updated_by = Session::get('userId'); $student->updated_at = date("Y-m-d H:i:s"); $student->save(); return $student; }
public function indexAction() { $this->view->title = $this->trans->_("students"); $request = new Request(); $students = \Students::find(); $search = trim($request->get("search")); $pageCount = $request->get("page-count") ? $request->get("page-count") : $this->session->get("page-count"); if ($pageCount) { $this->session->set("page-count", $pageCount); } $orderColumn = trim($request->get("order-column")) . " " . trim($request->get("order-type")); $paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => \Students::find(array("order" => trim($orderColumn) ? $orderColumn : "id ASC", "conditions" => "id LIKE ?1 ", "bind" => array(1 => "%" . $search . "%"))), "limit" => $pageCount ? $pageCount : 30, "page" => $request->get("page"))); $page = $paginator->getPaginate(); $this->view->page = $page; //$this->view->users=$students->; $this->view->countItems = count($page->items); $this->view->search = $search; $this->view->orderColumn = $request->get("order-column"); $this->view->orderType = $request->get("order-type"); $this->view->pageCount = $pageCount; }
function getScaledSkillScore($studentId, $skillId, $debug = false) { // Special case for persistence, which has two parts that need to be scaled independently if ($skillId == "persistence") { // Scale the two parts indpendently, and weight them equally return ($this->getScaledSkillScore($studentId, "persistence_attempts", $debug) + $this->getScaledSkillScore($studentId, "persistence_watched", $debug)) / 2; } $scoreResults = Students::find(["columns" => "{$skillId}"]); $studentId = str_replace("'", "", $studentId); $rawScores = array_column($scoreResults->toArray(), "{$skillId}"); $rawScore = Students::findFirst("email = '{$studentId}'")->{$skillId}; $scaledScore = StatsHelper::calculateScaledScore($rawScores, $rawScore); if ($debug) { echo "All scores for skill {$skillId}: \n"; foreach ($rawScores as $s) { echo "{$s}\n"; } echo "Raw {$skillId} score for student {$studentId} is {$rawScore}, and scaled score is {$scaledScore}\n"; } return round($scaledScore * 100) / 10; }
public function UpdateRetentionFollowup() { $inputs = Input::all(); $retention_data_make_reminder_null = Comments::where('retention_id', '=', $inputs['retention_id'])->update(array('reminder_date' => Null)); $retention_data = Comments::where('retention_id', '=', $inputs['retention_id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($retention_data['student_id']); if ($inputs['followup_status'] == 'ACTIVE/SCHEDULED') { $commentText = "Active call " . 'on ' . date('Y-m-d', strtotime($inputs['rDate'])) . ' ' . $inputs['customer_text_area']; } elseif ($inputs['followup_status'] == 'REMINDER_CALL') { $commentText = "Reminder call " . 'on ' . date('Y-m-d', strtotime($inputs['rDate'])) . ' ' . $inputs['customer_text_area']; } elseif ($inputs['followup_status'] == 'FOLLOW_CALL') { $commentText = "Follow call " . 'on ' . date('Y-m-d', strtotime($inputs['rDate'])) . ' ' . $inputs['customer_text_area']; } elseif ($inputs['followup_status'] == 'CALL_SPOUSE') { $commentText = "Call Spouse " . 'on ' . date('Y-m-d', strtotime($inputs['rDate'])) . ' ' . $inputs['customer_text_area']; } elseif ($inputs['followup_status'] == 'NOT_AVAILABLE') { $commentText = "Not Available " . 'on ' . date('Y-m-d') . ' ' . $inputs['customer_text_area']; } elseif ($inputs['followup_status'] == 'CLOSE_CALL') { $commentText = "Followupcall closed on " . date('Y-m-d') . ' ' . $inputs['customer_text_area']; } $commentsInput['customerId'] = $retention_data['customer_id']; $commentsInput['student_id'] = $retention_data['student_id']; $commentsInput['retention_id'] = $retention_data['retention_id']; $commentsInput['followupType'] = $retention_data['followup_type']; $commentsInput['commentStatus'] = $inputs['followup_status']; $commentsInput['commentType'] = $inputs['comment_type']; $commentsInput['commentText'] = $commentText; if ($inputs['followup_status'] != 'CLOSE_CALL') { if (isset($inputs['rDate'])) { $commentsInput['reminderDate'] = $inputs['rDate']; } } Comments::addComments($commentsInput); return Response::json(array('status' => 'success')); }
public function details($id) { if (Auth::check()) { $currentPage = "CUSTOMERS_LIST"; $mainMenu = "CUSTOMERS_MAIN"; $inputs = Input::all(); if (isset($inputs['customerName'])) { if (Customers::addCustomers($inputs)) { Session::flash('msg', "Customer added successfully."); } else { Session::flash('warning', "Customer, Course Could not be added at the moment."); } } $customer = Customers::getCustomersById($id); $students = Students::getStudentByCustomer($id); $comments = Comments::getCommentByCustomerId($id); $provinces = Provinces::getProvinces("IN"); $kidsSelect = Students::getStudentsForSelectBox($id); $membershipTypes = MembershipTypes::getMembershipTypesForSelectBox(); $birthdays = BirthdayParties::getBirthdaysByCustomer($id); //return $customer; //Membership if (isset($inputs['membershipTypesMembersDiv'])) { /* echo '<pre>'; print_r($inputs); echo '</pre>'; exit(); */ if ($inputs['membershipTypesMembersDiv'] != "") { $membershipInput['customer_id'] = $id; $membershipInput['membership_type_id'] = $inputs['membershipTypesMembersDiv']; CustomerMembership::addMembership($membershipInput); $order['customer_id'] = $id; $order['payment_for'] = "membership"; $order['payment_dues_id'] = ''; $order['payment_mode'] = $inputs['paymentTypeRadio']; $order['card_last_digit'] = $inputs['card4digits']; $order['card_type'] = $inputs['cardType']; $order['bank_name'] = $inputs['bankName']; $order['cheque_number'] = $inputs['chequeNumber']; $order['amount'] = $inputs['membershipPrice']; $order['order_status'] = "completed"; Orders::createOrder($order); } } //$customerMembership = ""; /* echo '<pre>'; print_r($customer); echo '</pre>'; exit(); */ $presentDate = Carbon::now(); $membershipStartDate = Carbon::now(); $membershipEndDate = Carbon::now(); $customerMembershipId = ''; if (isset($customer->CustomerMembership['0'])) { $select = count($customer->CustomerMembership) - 1; $membershipStartDate = $membershipStartDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_start_date); $membershipEndDate = $membershipEndDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_end_date); if ($membershipStartDate->lte($presentDate) && $membershipEndDate->gte($presentDate)) { $customerMembershipId = $customer->CustomerMembership[$select]->membership_type_id; } } if (isset($customerMembershipId)) { $customerMembership = MembershipTypes::getMembershipTypeByID($customerMembershipId); } $membershipTypesAll = MembershipTypes::getMembershipTypes(); $birthdaypaiddata = Orders::getBirthdayfulldata($id); for ($i = 0; $i < count($birthdaypaiddata); $i++) { $studentData = Students::getStudentById($birthdaypaiddata[$i]['student_id']); $birthdaypaiddata[$i]['student_name'] = $studentData[0]['student_name']; $birthdaypaiddata[$i]['student_date_of_birth'] = $studentData[0]['student_date_of_birth']; $birthdayData = BirthdayParties::getBirthdaybyId($birthdaypaiddata[$i]['birthday_id']); $birthdaypaiddata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date']; $birthdaypaiddata[$i]['tax_amount'] = $birthdaypaiddata[0]['tax_amount']; $user_data = User::getUsersByUserId($birthdaypaiddata[$i]['created_by']); $birthdaypaiddata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name']; $birthdaypaiddata[$i]['encrypted_id'] = Crypt::encrypt($birthdaypaiddata[$i]['id']); } $birthdayDuedata = PaymentDues::getPaymentpendingfulldata($id); for ($i = 0; $i < count($birthdayDuedata); $i++) { $studentData = Students::getStudentById($birthdayDuedata[$i]['student_id']); $birthdayDuedata[$i]['student_name'] = $studentData[0]['student_name']; $user_data = User::getUsersByUserId($birthdayDuedata[$i]['created_by']); $birthdayDuedata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name']; $birthdayData = BirthdayParties::getBirthdaybyId($birthdayDuedata[$i]['birthday_id']); $birthdayDuedata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date']; } //followup_data $iv_data = IntroVisit::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($iv_data); $i++) { $comments_data = Comments::where('introvisit_id', '=', $iv_data[$i]['id'])->orderBy('id', 'DESC')->first(); $iv_data[$i]['comment_data'] = $comments_data; $student = Students::find($iv_data[$i]['student_id']); $iv_data[$i]['student_name'] = $student['student_name']; $iv_data[$i]['iv_date'] = date("Y-m-d", strtotime($iv_data[$i]['iv_date'])); } $birthday_data = BirthdayParties::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($birthday_data); $i++) { $birthday_comments = Comments::where('birthday_id', '=', $birthday_data[$i]['id'])->orderBy('id', 'DESC')->first(); $birthday_data[$i]['comment_data'] = $birthday_comments; $student_data = Students::find($birthday_data[$i]['student_id']); $birthday_data[$i]['student_name'] = $student_data['student_name']; $birthday_data[$i]['birthday_party_date'] = date("Y-m-d", strtotime($birthday_data[$i]['birthday_party_date'])); } //for complaints $complaint_data = Complaint::getComplaintByCustomerId($id); //Comments::where('customer_id','=',$id)->get(); for ($i = 0; $i < count($complaint_data); $i++) { $complaint_data[$i]['comments'] = Comments::where('complaint_id', '=', $complaint_data[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($complaint_data[$i]['student_id']); $complaint_data[$i]['student_name'] = $student_data['student_name']; } //for retention $retention_data = Retention::getRetentionByCustomerId($id); for ($i = 0; $i < count($retention_data); $i++) { $retention_data[$i]['comments'] = Comments::where('retention_id', '=', $retention_data[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($retention_data[$i]['student_id']); $retention_data[$i]['student_name'] = $student_data['student_name']; } //for inquiry $inuiry_data = Inquiry::getInquiryByCustomerId($id); for ($i = 0; $i < count($inuiry_data); $i++) { $inuiry_data[$i]['comments'] = Comments::where('inquiry_id', '=', $inuiry_data[$i]['id'])->orderBy('id', 'DESC')->first(); } //for enrollment payment followup/brush up calls $enrollmentFollowupData = PaymentFollowups::getPaymentFollowupByCustomerId($id); for ($i = 0; $i < count($enrollmentFollowupData); $i++) { $enrollmentFollowupData[$i]['comments'] = Comments::where('paymentfollowup_id', '=', $enrollmentFollowupData[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($enrollmentFollowupData[$i]['student_id']); $enrollmentFollowupData[$i]['student_name'] = $student_data['student_name']; $paymentDueData = PaymentDues::find($enrollmentFollowupData[$i]['payment_due_id']); $enrollmentFollowupData[$i]['payment_date'] = $paymentDueData['end_order_date']; } // for customer kids enrollment. $customer_student_data = Students::where('customer_id', '=', $id)->where('franchisee_id', '=', Session::get('franchiseId'))->select('id', 'student_name')->get(); for ($i = 0; $i < count($customer_student_data); $i++) { $student_classes = StudentClasses::getEnrolledStudentBatch($customer_student_data[$i]['id']); //return $student_classes[0]['batch_id']; $customer_student_data[$i]['student_classes_data'] = $student_classes; } //return $customer_student_data; for ($i = 0; $i < count($customer_student_data); $i++) { for ($j = 0; $j < count($customer_student_data[$i]['student_classes_data']); $j++) { $find = Batches::find($customer_student_data[$i]['student_classes_data'][$j]['batch_id']); $customer_student_data[$i]['student_classes_data'][$j]['batch_name'] = $find->batch_name; } } //return the customer membership follolwup $customer_membership_data = MembershipFollowup::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($customer_membership_data); $i++) { $membershipid[$i] = $customer_membership_data[$i]['id']; } if (isset($membershipid)) { for ($i = 0; $i < count($membershipid); $i++) { $membership_followup_data[$i] = Comments::where('membership_followup_id', '=', $membershipid[$i])->orderBy('id', 'DESC')->first(); $memfollowup_data = MembershipFollowup::find($membershipid[$i]); $Customer_membership_data = CustomerMembership::find($memfollowup_data->membership_id); $membership_followup_data[$i]['membership_end_date'] = $Customer_membership_data->membership_end_date; } } $viewData = array('birthdaypaiddata', 'birthdayDuedata', 'customer', 'students', 'currentPage', 'mainMenu', 'comments', 'provinces', 'customerMembership', 'kidsSelect', 'membershipTypes', 'membershipTypesAll', 'birthdays', 'iv_data', 'birthday_data', 'complaint_data', 'retention_data', 'inuiry_data', 'enrollmentFollowupData', 'customer_student_data', 'membership_followup_data'); return View::make('pages.customers.details', compact($viewData)); } else { return Redirect::to("/"); } }