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


PHP Area::first方法代码示例

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


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

示例1: settings

 /**
  * @before _secure, _vendor
  */
 public function settings()
 {
     $this->seo(array("title" => "Settings", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre = Centre::first(array("id = ?" => $this->member->centre_id));
     $location = Location::first(array("id = ?" => $centre->location_id));
     $area = Area::first(array("id = ?" => $location->area_id));
     if (RequestMethods::post("action") == "settings") {
         $phone = RequestMethods::post("phone");
         $user = $this->user;
         $message = null;
         if ($phone != $user->phone) {
             $exist = User::first(array("phone = ?" => $phone));
             if ($exist) {
                 $message = "Phone number already exists";
             } else {
                 $user->phone = $phone;
             }
         }
         $user->name = RequestMethods::post("name");
         $user->save();
         $this->setUser($user);
         $location = \Location::saveRecord($user, $location);
         $phone = RequestMethods::post("cphone");
         if ($centre->phone != $phone) {
             $exist = Centre::first(array("phone = ?" => $phone));
             if ($exist) {
                 $message = "Landline already exists!!";
             } else {
                 $centre->phone = $phone;
                 $centre->save();
             }
         }
         if (!$message) {
             $message = "Info updated!!";
         }
         $view->set("message", $message);
     }
     if (RequestMethods::post("action") == "operations") {
         $operations = RequestMethods::post("operations");
         foreach ($operations as $key => $value) {
             $operation = Operation::first(array("centre_id = ?" => $id, "area_id = ?" => $value));
             if (!$operation) {
                 $operation = new Operation(array("user_id" => $this->user->id, "centre_id" => $id, "organization_id" => $this->organization->id, "area_id" => $value, "live" => 1));
                 $operation->save();
             }
         }
     }
     $ops = Operation::all(array("centre_id = ?" => $id), array("area_id"));
     $opa = array();
     foreach ($ops as $o) {
         $opa[] = $o->area_id;
     }
     $view->set("centre", $centre);
     $view->set("area", $area);
     $view->set("location", $location);
     $view->set("opa", $opa);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:61,代码来源:vendor.php

示例2: create

 /**
  * @before _secure, _vendor
  */
 public function create()
 {
     $this->seo(array("title" => "Create runner", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $msg = "";
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("id", "location_id"));
     $upload = function ($key) {
         if (isset($_FILES["image"]["name"][$key])) {
             $file = $_FILES["image"];
             $path = APP_PATH . "/public/assets/uploads/images/";
             $extension = pathinfo($file["name"][$key], PATHINFO_EXTENSION);
             if (!preg_match("/^(jpe?g|gif|png|bmp)\$/", $extension)) {
                 return false;
             }
             $filename = uniqid() . ".{$extension}";
             if (move_uploaded_file($file["tmp_name"][$key], $path . $filename)) {
                 return $filename;
             } else {
                 return FALSE;
             }
         } else {
             return false;
         }
     };
     if (RequestMethods::post("phone")) {
         $phone = RequestMethods::post("phone");
         $name = RequestMethods::post("name");
         $centre_id = RequestMethods::post("centre_id");
         foreach ($phone as $key => $value) {
             if (!empty($value)) {
                 $exist = User::first(array("phone = ?" => $phone[$key]), array("id"));
                 $img = $upload($key);
                 if (!$img) {
                     $msg = 'Not a vaild image';
                 } else {
                     if ($exist) {
                         $msg = 'Phone number already exists';
                     }
                 }
                 if (!$exist && $img) {
                     $user = new User(array("name" => $name[$key], "email" => "", "phone" => $phone[$key], "password" => sha1(rand(100000, 9999999)), "gender" => $gender[$key], "birthday" => "", "live" => true));
                     $user->save();
                     foreach ($centre_id[$key] as $k => $v) {
                         $runner = new Member(array("user_id" => $user->id, "organization_id" => $this->organization->id, "centre_id" => $v, "designation" => "runner", "image" => $img, "live" => true));
                         $runner->save();
                     }
                     $msg = "Runner Created Successfully";
                 } else {
                     $msg .= ", Not all were added";
                 }
             }
         }
         $view->set("message", $msg);
     }
     $locations = array();
     foreach ($centres as $c) {
         $l = Location::first(array("id = ?" => $c->location_id), array("area_id"));
         $a = Area::first(array("id = ?" => $l->area_id), array("name", "id"));
         $data = array("id" => $c->id, "name" => $a->name);
         $data = ArrayMethods::toObject($data);
         $locations[$c->id] = $data;
     }
     $view->set("centres", $locations);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:67,代码来源:runner.php

示例3: details

 public function details($title, $id = '')
 {
     $organization = Organization::first(array("id = ?" => $id));
     $this->seo(array("title" => $organization->name, "keywords" => $organization->name, "description" => substr(strip_tags($organization->details), 0, 150), "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre = Centre::first(array("organization_id = ?" => $id), array("*"), "created", "desc");
     $services = Service::all(array("centre_id = ?" => $centre->id), array("property", "property_id", "charge"));
     $location = Location::first(array("id = ?" => $centre->location_id), array("street", "area_id", "city_id"));
     $area = Area::first(array("id = ?" => $location->area_id), array("name"));
     $city = City::first(array("id = ?" => $location->city_id), array("name"));
     $view->set("centre", $centre);
     $view->set("area", $area);
     $view->set("city", $city);
     $view->set("location", $location);
     $view->set("services", $services);
     $view->set("organization", $organization);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:17,代码来源:lab.php

示例4: display

 /**
  * @before _secure, _vendor
  */
 public function display($id)
 {
     $this->seo(array("title" => "Display Appointments", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $apptmt = Appointment::first(array("id = ?" => $id), array("service_id", "id", "start", "centre_id", "user_id", "location_id"));
     $usr = User::first(array("id = ?" => $apptmt->user_id), array("id", "name", "email", "phone"));
     $job = Job::first(array("appointment_id = ?" => $apptmt->id), array("user_id", "id"));
     $location = Location::first(array("id = ?" => $apptmt->location_id), array("street", "area_id", "city_id"));
     $area = Area::first(array("id = ?" => $location->area_id), array("name"));
     $city = City::first(array("id = ?" => $location->city_id), array("name"));
     if (!$apptmt) {
         $view->set("err", "Invalid ID");
     } else {
         $view->set("usr", $usr);
         $view->set("job", $job);
         $view->set("e", $apptmt);
         $view->set("address", $location->street . ", " . $area->name . ", " . $city->name);
     }
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:22,代码来源:appointments.php

示例5: search

 public function search()
 {
     $this->seo(array("title" => "Search", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $diff = 65;
     $test_ids = RequestMethods::get("test", array());
     $city = RequestMethods::get("city", "");
     $area = RequestMethods::get("area", "");
     if (strlen($city) > 0 && strlen($area) > 0) {
         if (!isset($_COOKIE["cityId"])) {
             setcookie("cityId", $city, time() + 86400 * 30, "/");
         }
         if (!isset($_COOKIE["areaId"])) {
             setcookie("areaId", $area, time() + 86400 * 30, "/");
             $a = Area::first(array("id = ?" => $area), array("name"));
             setcookie("areaName", $a->name, time() + 86400 * 30, "/");
         }
     }
     $in = implode(",", $test_ids);
     $size = sizeof($test_ids);
     $database = Registry::get("database");
     $result = $database->execute("SELECT centre_id FROM services WHERE city_id={$city} AND area_id={$area} AND property='test' AND property_id IN ({$in}) GROUP BY centre_id HAVING count(distinct property_id) = {$size}");
     $centres = array();
     if ($result) {
         for ($i = 0; $i < $result->num_rows; $i++) {
             $data = $result->fetch_array(MYSQLI_ASSOC);
             $centres[] = $data["centre_id"];
         }
     }
     //echo "<pre>", print_r($centres), "</pre>";
     $alltests = Test::all(array("live = ?" => true), array("id", "title"));
     $view->set("area", $area);
     $view->set("city", $city);
     $view->set("centres", $centres);
     $view->set("alltests", $alltests);
     $view->set("test_ids", $test_ids);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:37,代码来源:medicaltest.php


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