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


PHP Location_Model::is_valid_location方法代码示例

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


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

示例1: save_report

 /**
  * Saves an incident
  *
  * @param Validation $post Validation object with the data to be saved
  * @param Incident_Model $incident Incident_Model instance to be modified
  * @param Location_Model $location_model Location to be attached to the incident
  * @param int $id ID no. of the report
  *
  */
 public static function save_report($post, $incident, $location_id)
 {
     // Exception handling
     if (!$post instanceof Validation_Core and !$incident instanceof Incident_Model) {
         // Throw exception
         throw new Kohana_Exception('Invalid parameter types');
     }
     // Verify that the location id exists
     if (!Location_Model::is_valid_location($location_id)) {
         throw new Kohana_Exception(sprintf('Invalid location id specified: ', $location_id));
     }
     // Is this new or edit?
     if ($incident->loaded) {
         // Edit
         $incident->incident_datemodify = date("Y-m-d H:i:s", time());
     } else {
         // New
         $incident->incident_dateadd = date("Y-m-d H:i:s", time());
     }
     $incident->location_id = $location_id;
     //$incident->locale = $post->locale;
     if (isset($post->form_id)) {
         $incident->form_id = $post->form_id;
     }
     // Check if the user id has been specified
     if (isset($_SESSION['auth_user'])) {
         $incident->user_id = $_SESSION['auth_user']->id;
     }
     $incident->incident_title = $post->incident_title;
     $incident->incident_description = $post->incident_description;
     $incident_date = explode("/", $post->incident_date);
     // Where the $_POST['date'] is a value posted by form in mm/dd/yyyy format
     $incident_date = $incident_date[2] . "-" . $incident_date[0] . "-" . $incident_date[1];
     $incident_time = $post->incident_hour . ":" . $post->incident_minute . ":00 " . $post->incident_ampm;
     $incident->incident_date = date("Y-m-d H:i:s", strtotime($incident_date . " " . $incident_time));
     // Is this an Email, SMS, Twitter submitted report?
     if (!empty($post->service_id)) {
         // SMS
         if ($post->service_id == 1) {
             $incident->incident_mode = 2;
         } elseif ($post->service_id == 2) {
             $incident->incident_mode = 3;
         } elseif ($post->service_id == 3) {
             $incident->incident_mode = 4;
         } else {
             // Default to Web Form
             $incident->incident_mode = 1;
         }
     }
     // Approval Status
     if (isset($post->incident_active)) {
         $incident->incident_active = $post->incident_active;
     }
     // Verification status
     if (isset($post->incident_verified)) {
         $incident->incident_verified = $post->incident_verified;
     }
     // Incident zoom
     if (!empty($post->incident_zoom)) {
         $incident->incident_zoom = intval($post->incident_zoom);
     }
     // Tag this as a report that needs to be sent out as an alert
     if ($incident->incident_active == 1 and $incident->incident_alert_status != 2) {
         // 2 = report that has had an alert sent
         $incident->incident_alert_status = '1';
     }
     // Remove alert if report is unactivated and alert hasn't yet been sent
     if ($incident->incident_active == 0 and $incident->incident_alert_status == 1) {
         $incident->incident_alert_status = '0';
     }
     // Save the incident
     $incident->save();
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:82,代码来源:reports.php


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