本文整理汇总了PHP中Model_Location::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Location::find方法的具体用法?PHP Model_Location::find怎么用?PHP Model_Location::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Location
的用法示例。
在下文中一共展示了Model_Location::find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* view method
*
* @access public
* @return void
* @author ida
*/
public function view()
{
$this->fleamarket_id = \Input::param('fleamarket_id');
$this->prefectures = \Config::get('master.prefectures');
$this->entry_styles = \Config::get('master.entry_styles');
$this->event_statuses = \Model_Fleamarket::getEventStatuses();
$this->locations = \Model_Location::find('all');
$this->link_from_list = $this->getLinkFromList();
}
示例2: action_delete
public function action_delete($id = null)
{
if ($location = Model_Location::find($id)) {
$location->delete();
Session::set_flash('success', e('Deleted location #' . $id));
} else {
Session::set_flash('error', e('Could not delete location #' . $id));
}
Response::redirect('admin/locations');
}
示例3: update_location
private function update_location($sub, $ip)
{
$rack = $ip->network->device->racks;
$room = $rack->rooms;
$floor = $room->floors;
$building = $floor->buildings;
$loc = Model_Location::find()->where('rack', $rack['id'])->where('node', $sub->id)->get_one();
if (!$loc) {
$in = array('node' => $sub->id, 'type' => 0, 'building' => $building['id'], 'floor' => $floor['id'], 'room' => $room['id'], 'rack' => $rack['id'], 'pos_from' => 1, 'pos_to' => $rack['size']);
$location = new Model_Location($in);
$location->save();
}
}
示例4: checkForInhert
private function checkForInhert($data)
{
//check if data already exist
$vars = array('building', 'floor', 'room', 'rack', 'pos_from', 'pos_to');
$b = $data[0];
$f = $data[1];
$ro = $data[2];
$ra = $data[3];
for ($i = 0; $i < 4; $i++) {
if ($data[$i] == 'all') {
$v = $i - 1;
$loc = Model_Location::find()->where('node', $this->name)->where($vars[$v], $data[$v])->get_one();
if ($loc['id'] != '') {
return array('v' => $v, 'i' => $i, 'base' => $vars[$v], 'val' => $data[$i], 'stat' => false, 'data' => $data);
}
}
}
$locs = Model_Location::find()->where('node', $this->name)->get();
$taken = array();
foreach ($locs as $loc) {
for ($i = 0; $i < 4; $i++) {
if ($loc[$vars[$i]] == 0) {
$p = $i - 1;
$inbase = $loc[$vars[$p]];
$insert = $data[$p];
if ($inbase == $insert) {
return array('base' => $inbase, 'stat' => false, 'data' => $data);
}
}
}
if ($loc['rack'] == $data[3]) {
if ($loc['pos_from'] <= $data[5] && $loc['pos_from'] >= $data[4]) {
return array('base' => 'pos_from', 'stat' => false, 'data' => $data);
}
if ($loc['pos_to'] <= $data[5] && $loc['pos_to'] >= $data[4]) {
return array('base' => 'pos_to', 'stat' => false, 'data' => $data);
}
if ($loc['pos_to'] <= $data[5] && $loc['pos_from'] >= $data[4]) {
return array('base' => 'pos_iner', 'stat' => false, 'data' => $data);
}
if ($loc['pos_to'] >= $data[5] && $loc['pos_from'] <= $data[4]) {
return array('base' => 'pos_iner', 'stat' => false, 'data' => $data);
}
}
}
return array('stat' => true, 'data' => $data);
}
示例5: Floor
public static function Floor($model, $method)
{
if ($method == 'before_delete') {
$locations = Model_Location::find()->where('floor', $model->id)->get();
foreach ($locations as $loc) {
$loc->delete();
}
}
}
示例6: 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;
}
示例7: getLocation
/**
* 会場情報を取得する
*
* @access private
* @param mixed $location_id 会場ID
* @return object
* @author ida
*/
private function getLocation($location_id)
{
$result = \Model_Location::find($location_id);
return $result;
}
示例8: view
/**
* view method
*
* @access public
* @return void
* @author ida
*/
public function view()
{
$this->entry_styles = \Config::get('master.entry_styles');
$this->event_statuses = \Model_Fleamarket::getEventStatuses();
$this->locations = \Model_Location::find('all');
}
示例9: 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();
}
}