当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::first方法代码示例

本文整理汇总了PHP中Service::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::first方法的具体用法?PHP Service::first怎么用?PHP Service::first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service::first方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: infos

 public static function infos($centre_id, $test_ids, $city, $area)
 {
     $charge = 0;
     $url = "";
     $arr = array();
     $count = count($test_ids);
     foreach ($test_ids as $test_id) {
         $where = array("city_id = ?" => $city, "area_id = ?" => $area, "property = ?" => "test", "property_id = ?" => $test_id, "centre_id = ?" => $centre_id);
         $service = Service::first($where, array("id", "charge"));
         $charge += $service->charge;
         array_push($arr, $service->id);
         if ($count == 1) {
             $url .= "service[]=" . $service->id;
         } else {
             $url .= "service[]=" . $service->id . "&";
         }
         --$count;
     }
     return array("url" => $url, "charge" => $charge, "services" => implode(",", $arr));
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:20,代码来源:service.php

示例2: index

 /**
  * @before _secure
  */
 public function index()
 {
     $this->seo(array("title" => "Appointments Scheduled", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $appointments = array();
     $page = RequestMethods::get("page", 1);
     $limit = RequestMethods::get("limit", 10);
     $count = Appointment::count(array("user_id" => $this->user->id));
     $as = Appointment::all(array("user_id =?" => $this->user->id, "live = ?" => 1), array("id", "service_id", "start", "end", "patient_id"), "start", "asc", $limit, $page);
     foreach ($as as $a) {
         $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id", "organization_id", "charge"));
         $organization = Organization::first(array("id = ?" => $service->organization_id), array("id", "name"));
         $model = ucfirst($service->property);
         $item = $model::first(array("id = ?" => $service->property_id), array("title"));
         $patient = User::first(array("id = ?" => $a->patient_id), array("name"));
         array_push($appointments, array("item" => $item->title, "organization_id" => $organization->id, "organization_name" => $organization->name, "patient" => $patient->name, "start" => $a->start, "end" => $a->end, "id" => $a->id, "charge" => $service->charge));
     }
     $view->set("appointments", $appointments);
     $view->set("page", $page);
     $view->set("limit", $limit);
     $view->set("count", $count);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:25,代码来源:patient.php

示例3: orders

 /**
  * @before _secure
  */
 public function orders()
 {
     $this->seo(array("title" => "Orders", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $orders = array();
     $os = Order::all(array("user_id = ?" => $this->user->id), array("id", "amount", "ref_id"), "created", "desc");
     foreach ($os as $o) {
         $title = array();
         $appointments = Appointment::all(array("order_id = ?" => $o->id), array("service_id", "start", "end", "patient_id"));
         foreach ($appointments as $a) {
             $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id"));
             $model = ucfirst($service->property);
             $item = $model::first(array("id = ?" => $service->property_id), array("title"));
             $title[] = $item->title;
             $start = $a->start;
             $end = $a->end;
             $patient_id = $a->patient_id;
         }
         $patient = User::first(array("id = ?" => $patient_id), array("name"));
         array_push($orders, array("item" => implode(", ", $title), "amount" => $o->amount, "id" => $o->id, "ref_id" => $o->ref_id, "patient" => $patient->name, "start" => $start, "end" => $end));
     }
     $view->set("orders", $orders);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:26,代码来源:finance.php

示例4: all

 /**
  * @before _secure, _vendor
  */
 public function all()
 {
     $this->noview();
     $events = array();
     $now = strftime("%Y-%m-%d", strtotime('now'));
     if ($this->member->designation == "admin") {
         $where = array("organization_id = ?" => $this->member->organization_id);
     } else {
         $where = array("centre_id = ?" => $this->member->centre_id);
     }
     $appointments = Appointment::all($where, array("service_id", "start", "end", "allDay", "id"));
     $returnTime = function ($date) {
         $d = explode(" ", $date);
         $d = implode("T", $d);
         return $d;
     };
     foreach ($appointments as $appointment) {
         $diff = 0;
         $color = '#3a87ad';
         //blue
         $service = Service::first(array("id = ?" => $appointment->service_id), array("property", "property_id"));
         $class = ucfirst($service->property);
         $item = $class::first(array("id = ?" => $service->property_id), array("title"));
         $job = Job::first(array("appointment_id = ?" => $appointment->id), array("id"));
         $diff = round((strtotime($appointment->start) - strtotime('now')) / 3600);
         if ($diff < 13) {
             $color = '#FF0000';
             //red
         }
         if (isset($job)) {
             $color = '#00FF00';
             //green
         }
         $events[] = array("title" => $item->title, "start" => $returnTime($appointment->start), "end" => $returnTime($appointment->end), "allDay" => $appointment->allDay ? true : false, "id" => $appointment->id, "color" => $color);
     }
     echo json_encode($events);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:40,代码来源:appointments.php

示例5: appointments

 /**
  * @before _secure, _doctor
  */
 public function appointments()
 {
     $this->seo(array("title" => "My Appointments", "view" => $this->getLayoutView()));
     $this->getLayoutView()->set("cal", true);
     $view = $this->getActionView();
     $appointments = array();
     $page = RequestMethods::get("page", 1);
     $limit = RequestMethods::get("limit", 10);
     $count = Appointment::count(array("user_id" => $this->user->id));
     $as = Appointment::all(array("user_id =?" => $this->user->id, "live = ?" => 1), array("id", "service_id", "start", "end", "patient_id"), "start", "asc", $limit, $page);
     foreach ($as as $a) {
         $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id", "organization_id", "charge"));
         $organization = Organization::first(array("id = ?" => $service->organization_id), array("id", "name"));
         $model = ucfirst($service->property);
         $item = $model::first(array("id = ?" => $service->property_id), array("title"));
         $patient = User::first(array("id = ?" => $a->patient_id), array("name"));
         array_push($appointments, array("item" => $item->title, "organization_id" => $organization->id, "organization_name" => $organization->name, "patient" => $patient->name, "start" => $a->start, "end" => $a->end, "id" => $a->id, "charge" => $service->charge));
     }
     $organization = Registry::get("session")->get("organization");
     if (RequestMethods::post("action") == "capacity") {
         \Slot::saveRecord($this->user, $organization);
         $view->set("message", "Slots Saved Successfully");
     }
     $view->set("appointments", $appointments);
     $days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
     $view->set("days", $days);
     $view->set("slots", Shared\Services\Doctor::slots($this->user));
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:31,代码来源:doctor.php

示例6: _saveCharge

 protected function _saveCharge($centres, $locations, $opts)
 {
     foreach ($centres as $centre) {
         $location = $locations[$centre->location_id];
         if (isset($opts['service_id']) && (int) $opts['service_id'] != 0) {
             $service = Service::first(array("id = ?" => $opts['service_id']));
         } else {
             $service = Service::first(array("property = ?" => "test", "property_id = ?" => $opts['test_id'], "centre_id = ?" => $centre->id, "organization_id = ?" => $this->organization->id));
         }
         if (!$service) {
             $service = new Service(array("property" => "test", "property_id" => $opts['test_id'], "centre_id" => $centre->id, "city_id" => $location->city_id, "area_id" => $location->area_id, "organization_id" => $this->organization->id));
         }
         $service->charge = $opts['charge'];
         $service->save();
     }
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:16,代码来源:medicaltest.php


注:本文中的Service::first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。