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


PHP Map::save方法代码示例

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


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

示例1: create

 public static function create()
 {
     if (!Input::has('name')) {
         App::abort(400);
     }
     $user = Auth::user();
     $map = new Map();
     $map->width = 512;
     $map->height = 512;
     $map->name = Input::get('name');
     $map->description = Input::has('description') ? Input::get('description') : '';
     $map->version = 960;
     $map->save();
     $ownership = new Permission();
     $ownership->mapid = $map->id;
     $ownership->userid = $user->id;
     $ownership->owner = true;
     $ownership->edit = true;
     $ownership->view = true;
     $ownership = $map->permissions()->save($ownership);
     $minimap = new Minimap();
     $minimap->mapid = $map->id;
     $minimap->updated_at = new \DateTime();
     $minimap = $map->minimap()->save($minimap);
     \OTWorlds\MinimapPainter::$filename = $minimap->path;
     \OTWorlds\MinimapPainter::create(512, 512);
     \OTWorlds\MinimapPainter::save();
     return $map->id;
 }
开发者ID:Ablankzin,项目名称:OTWorlds,代码行数:29,代码来源:MapController.php

示例2: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     $rules = array('name' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         // Get the inputs, with some exceptions
         $inputs = Input::except('csrf_token');
         $this->map->name = $inputs['name'];
         $this->map->save();
         // Save permissions
         $this->role->perms()->sync($this->permission->preparePermissionsForSave($inputs['permissions']));
         // Was the map created?
         if ($this->map->id) {
             return Api::to(array('success', Lang::get('admin/maps/messages.create.success'))) ?: Redirect::to('admin/maps/' . $this->map->id . '/edit')->with('success', Lang::get('admin/maps/messages.create.success'));
         } else {
             return Api::to(array('error', Lang::get('admin/maps/messages.create.error'))) ?: Redirect::to('admin/maps/create')->withInput()->with('error', Lang::get('admin/maps/messages.create.error'));
         }
     } else {
         return Api::to(array('error', Lang::get('admin/maps/messages.create.error'))) ?: Redirect::to('admin/maps/create')->withInput()->withErrors($validator);
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:26,代码来源:AdminMapsController.php

示例3: initRcon

 /**
  * Initilizes the Rcon instance.
  *
  * @return void
  */
 public function initRcon()
 {
     try {
         $rcon = new Rcon($this->map->match->server->ip, $this->map->match->server->port, $this->map->match->server->rcon);
         Logger::log("connecting to rcon {$this->map->match->server->ip}:{$this->map->match->server->port}", Logger::LEVEL_DEBUG);
         $rcon->connect();
     } catch (RconConnectException $e) {
         Logger::log("Could not connect to the CS:GO server. {$e->getMessage()}", Logger::LEVEL_ERROR);
         $this->map->status = 0;
         $this->map->save();
         return;
     } catch (RconAuthException $e) {
         Logger::log("Could not authenticate with the CS:GO server. {$e->getMessage()}", Logger::LEVEL_ERROR);
         $this->map->status = 0;
         $this->map->save();
         return;
     }
     Logger::log('successfully connected to rcon', Logger::LEVEL_DEBUG);
     $this->rcon = $rcon;
     $this->chat = new DefaultChat($this->rcon);
     // temp
 }
开发者ID:uniquoooo,项目名称:CSManager,代码行数:27,代码来源:Handler.php

示例4: tmhOAuth

<?php

// Lib
include 'lib/tmhOAuth/tmhOAuth.php';
include 'lib/tmhOAuth/tmhUtilities.php';
include 'class/city.php';
include 'class/map.php';
// Config
include 'config.php';
// Auth
$tmhOAuth = new tmhOAuth(array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret, 'user_token' => $user_token, 'user_secret' => $user_secret));
// Path
if (!is_dir('exports') && !mkdir('exports')) {
    exit;
}
$pathinfo = pathinfo($path = 'exports/' . time() . '.jpg');
$name = $pathinfo['basename'];
// Map
$map = new Map();
if (!$map->save($path) || !($path = realpath($path))) {
    exit;
}
// Params
$image = array("@{$path}", 'type=image/jpeg', "filename={$name}");
$params = array('image' => implode(';', $image), 'use' => 'true');
// Request
$code = $tmhOAuth->request('POST', $tmhOAuth->url('1/account/update_profile_background_image'), $params, true, true);
// Response
echo $code;
开发者ID:radiokun,项目名称:gutenHashTag,代码行数:29,代码来源:upload.php

示例5: save_map

/**
 * Google Maps Draw Module
 * @package drawonmaps
 * 
 * Class: SiteConf
 * File: functions.php
 * Description: General functions of the tool
 */
function save_map($post_list)
{
    $vars_tmp = array();
    $map_id = $post_list['map_id'];
    if ($map_id > 0) {
        try {
            $map = new Map($map_id);
        } catch (Exception $e) {
            $vars_tmp['error_msg'] = $e->getMessage();
        }
    } else {
        $map = new Map();
    }
    $map->title = trim($post_list['map_title']);
    $map->description = trim($post_list['map_description']);
    $map->center_lat = $post_list['map_center_lat'];
    $map->center_lng = $post_list['map_center_lng'];
    $map->zoom = intval($post_list['map_zoom']);
    $map->typeid = trim($post_list['map_typeid']);
    $map->user_id = 0;
    $result = $map->save();
    if ($result) {
        //load the new created map
        $map = new Map($result);
        $vars_tmp['map'] = $map;
        $vars_tmp['error_msg'] = '';
        if ($map_id > 0) {
            // delete map objects only for existing maps
            $map->deleteMapObjects();
        }
        if ($post_list['marker_title']) {
            foreach ($post_list['marker_title'] as $key => $n) {
                // new map marker record created
                $get_object_id = $map->updateMapObject($n, $post_list['marker_coords'][$key], 1, null, $post_list['marker_icon'][$key]);
                if (!$get_object_id[0]) {
                    $vars_tmp['error_msg'] .= $get_object_id[1];
                }
            }
        }
        if ($post_list['line_title']) {
            foreach ($post_list['line_title'] as $key => $n) {
                // new map polyline record created
                $get_object_id = $map->updateMapObject($n, $post_list['line_coords'][$key], 2);
                if (!$get_object_id[0]) {
                    $vars_tmp['error_msg'] .= $get_object_id[1];
                }
            }
        }
        if ($post_list['poly_title']) {
            foreach ($post_list['poly_title'] as $key => $n) {
                // new map polygon record created
                $get_object_id = $map->updateMapObject($n, $post_list['poly_coords'][$key], 3);
                if (!$get_object_id[0]) {
                    $vars_tmp['error_msg'] .= $get_object_id[1];
                }
            }
        }
        if ($post_list['rect_title']) {
            foreach ($post_list['rect_title'] as $key => $n) {
                // new map rectagle record created
                $get_object_id = $map->updateMapObject($n, $post_list['rect_coords'][$key], 4);
                if (!$get_object_id[0]) {
                    $vars_tmp['error_msg'] .= $get_object_id[1];
                }
            }
        }
        if ($post_list['circle_title']) {
            foreach ($post_list['circle_title'] as $key => $n) {
                // new map circle record created
                $get_object_id = $map->updateMapObject($n, $post_list['circle_coords'][$key], 5);
                if (!$get_object_id[0]) {
                    $vars_tmp['error_msg'] .= $get_object_id[1];
                }
            }
        }
    }
    $vars_tmp['success_msg'] = 'The map <strong>' . $map->title . '</strong> saved successfully';
    $vars_load = load_map($map->id);
    if (is_array($vars_load)) {
        $vars_tmp = array_merge($vars_tmp, $vars_load);
    }
    return $vars_tmp;
}
开发者ID:sahidhossen,项目名称:project_inkcity,代码行数:91,代码来源:functions.php


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