本文整理汇总了PHP中Model_Location::forge方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Location::forge方法的具体用法?PHP Model_Location::forge怎么用?PHP Model_Location::forge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Location
的用法示例。
在下文中一共展示了Model_Location::forge方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->pass = Model_Pass::forge(array('name' => 'test name', 'description' => 'desc', 'logo_text' => 'sample', 'barcode_message' => 'message', 'barcode_format' => 0));
$this->pass->locations[] = Model_Location::forge(array('latitude' => 1.01, 'longitude' => 1.02));
$this->pass->locations[] = Model_Location::forge(array('latitude' => 2.03, 'longitude' => 2.04, 'altitude' => 2.05, 'relevant_text' => 'text'));
$this->pass->save();
}
示例2: action_create
public function action_create()
{
if (Input::method() == 'POST') {
$val = Model_Location::validate('create');
if ($val->run()) {
$location = Model_Location::forge(array('name' => Input::post('name'), 'can_sell' => Input::post('can_sell')));
if ($location and $location->save()) {
Session::set_flash('success', e('Added location #' . $location->id . '.'));
Response::redirect('admin/locations');
} else {
Session::set_flash('error', e('Could not save location.'));
}
} else {
Session::set_flash('error', $val->error());
}
}
$this->template->title = "Locations";
$this->template->content = View::forge('admin/locations/create');
}
示例3: array
$event_numbers = array();
// \DB::query('TRUNCATE TABLE fleamarkets')->execute();
// \DB::query('TRUNCATE TABLE fleamarket_entry_styles')->execute();
// \DB::query('TRUNCATE TABLE fleamarket_abouts')->execute();
// \DB::query('TRUNCATE TABLE locations')->execute();
for ($i = 1; $i <= 2000; $i++) {
$group_code = array_rand($group_codes);
$group_code_name = $group_codes[$group_code];
$register_type = array_rand($register_types);
// 開催地情報
$location_name = array_rand($location_list, 1);
$location = $location_list[$location_name];
list($prefecture, $address) = getAddress($location);
$prefecture_id = array_search($prefecture, $prefectures);
$location_line = array('branch_id' => null, 'name' => $location_name, 'zip' => '100-0001', 'prefecture_id' => $prefecture_id, 'address' => $address, 'googlemap_address' => $location, 'register_type' => $register_types[$register_type], 'created_user' => 0, 'updated_user' => null, 'created_at' => \Date::forge()->format('mysql'));
$location = \Model_Location::forge($location_line);
$location->save();
$location_id = $location->location_id;
// フリマ情報
if (isset($event_numbers[$group_code])) {
$event_number = ++$event_numbers[$group_code];
} else {
$event_number = $event_numbers[$group_code] = 1;
}
$event_status = array_rand($event_statuses);
$event_reservation_status = array_rand($event_reservation_statuses);
$event_month = array_rand($event_months);
$event_day = array_rand($event_days);
$event_date = '2014-' . $event_months[$event_month] . '-' . $event_days[$event_day];
$event_start = array_rand($event_start_list);
$event_end = array_rand($event_end_list);
示例4: registerLocation
/**
* 会場情報を登録する
*
* @access private
* @param
* @return object
* @author kobayashi
*/
private function registerLocation()
{
$data = $this->getLocationData();
if (!$data) {
throw new \Exception(\Model_Error::ER00402);
}
if (\Input::param('location_id')) {
$location = \Model_Location::find(\Input::post('location_id'));
$data['updated_user'] = $this->administrator->administrator_id;
unset($data['register_type']);
unset($data['created_at']);
unset($data['created_user']);
} else {
$location = \Model_Location::forge();
$data['created_user'] = $this->administrator->administrator_id;
$data['register_type'] = \Model_Location::REGISTER_TYPE_ADMIN;
}
if ($location) {
$location->set($data)->save();
}
return $location;
}
示例5: action_locations
public function action_locations($id = null)
{
$pass = Model_Pass::find($id);
if (Input::method() == 'POST') {
$val = Model_Location::validate('create');
if ($val->run()) {
$location = Model_Location::forge(array('latitude' => \Fuel\Core\Input::post('latitude'), 'longitude' => \Fuel\Core\Input::post('longitude'), 'altitude' => \Fuel\Core\Input::post('altitude', null), 'relevant_text' => \Fuel\Core\Input::post('relevant_text', null)));
$pass->locations[] = $location;
if ($location and $pass->save()) {
Session::set_flash('success', e('Added location #' . $location->id . '.'));
\Fuel\Core\Response::redirect('admin/pass/locations/' . $id);
return;
} else {
Session::set_flash('error', e('Could not save location.'));
}
} else {
Session::set_flash('error', $val->error());
}
}
$this->template->set_global('pass', $pass, false);
$this->template->title = "Pass Locations";
$this->template->content = View::forge('admin/pass/locations');
}
示例6: saveLocation
/**
* 会場情報登録・更新
*
* @access private
* @param object $fieldset フィールドセット
* @param mixed $location_id 会場ID
* @return bool
* @author ida
*/
private function saveLocation($fieldset)
{
$location_data = $this->createLocation($fieldset);
if (!empty($location_data['location_id'])) {
$location = \Model_Location::find($location_data['location_id']);
} else {
$location = \Model_Location::forge();
}
unset($location_data['location_id']);
if ($location->set($location_data)->save()) {
return $location;
} else {
throw new Exception();
}
}