本文整理汇总了PHP中Location::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::model方法的具体用法?PHP Location::model怎么用?PHP Location::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new TransferFile();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['TransferFile'])) {
$model->attributes = $_POST['TransferFile'];
$temp = $_GET['formId'];
$model->fid = $_GET['itemId'];
$model->uid = $_GET['itemId'];
$modelRow = User::model()->find('id = :id', array(':id' => $model->transfer_to));
$modelRow1 = Location::model()->find('id = :id', array(':id' => $model->transfer_location));
$connection = Yii::app()->db;
$sql = "\n\t\t\tselect * \n\t\t\tfrom fopen \n\t\t\twhere id ={$model->fid}";
$command = $connection->createCommand($sql);
$dataReader = $command->query();
$row = $dataReader->read();
$model->ownedby = $row['OWNER'];
$model->previous_location = $row['LOCATION'];
$sql = "\n\t\t\tUPDATE fopen SET OWNER='{$modelRow->name}' and LOCATION='{$modelRow1->name}' WHERE ID='{$model->fid}'";
$command = $connection->createCommand($sql);
$dataReader = $command->execute();
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例2: checkDomainIsUniqueAndCorrect
public function checkDomainIsUniqueAndCorrect($attribute, $params)
{
$code_entities_match = array('\'', ' ', '--', '"', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '{', '}', '|', ':', '"', '<', '>', '?', '[', ']', '\\', ';', "'", ',', '.', '/', '*', '+', '~', '`', '=');
$code_entities_replace = array('', '-', '-', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
$domain = str_replace($code_entities_match, $code_entities_replace, $this->domain);
if ($domain != $this->domain) {
$this->addError($attribute, 'Subdomain contains unallowed characters. It cannot contain spaces or special chars!');
return false;
}
// check the domain is unique in the account
$locs = Location::model()->findAllByAttributes(array('wlabel_id' => Yii::app()->user->getWhiteLabelId(), 'domain' => $this->domain));
if ($locs != null) {
if ($this->isNewRecord) {
$this->addError($attribute, 'There already exists location with the same subdomain!');
return;
}
foreach ($locs as $loc) {
if ($loc->location_id != $this->location_id) {
// found other locatioon with the same subdomain
$this->addError($attribute, 'There already exists location with the same subdomain!');
return;
}
}
}
return true;
}
示例3: loadLocation
public function loadLocation($id)
{
$model = Location::model()->findByPk($id);
if (null === $model) {
throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
}
return $model;
}
示例4: actionLookup
public function actionLookup($postcode)
{
$criteria = new CDbCriteria();
$criteria->compare('postcode', $postcode, true);
$lookUpResult = Location::model()->findAll($criteria);
if (count($lookUpResult) == 0 || empty($postcode)) {
echo 'No address found.';
return false;
}
$this->render('_lookup_form', array('lookUpResult' => $lookUpResult));
}
示例5: selectAll
public function selectAll()
{
$criteria = new CDbCriteria();
$criteria->select = 'id,name';
$result = Location::model()->findAll($criteria);
foreach ($result as $value) {
$data[$value->id]['name'] = $value->name;
}
$data['subject'] = array('name');
return $data;
}
示例6: actionUsers
/**
* This is the action to handle external exceptions.
*/
public function actionUsers()
{
$model = new Users();
$model->scenario = 'users';
if (isset($_POST['Users'])) {
$model->attributes = $_POST['Users'];
$location = Location::model()->findByPk($_POST['location']);
$model->location = $location->location;
if ($model->save()) {
$this->redirect(array('site/login'));
}
}
$this->render('Users', array('model' => $model));
}
示例7: getLocation
private function getLocation()
{
$location = new Location();
$location->Address = $this->locationStreet;
$location->City = $this->locationCity;
$location->State = Location::GetStates()[$this->locationState];
$location->Zip = $this->locationZip;
$result = Location::model()->findExisting($location);
if ($result == null) {
$location->save();
$result = $location;
}
return $result;
}
示例8: actionCountry
public function actionCountry()
{
//error_log(' -------------------- country --------------------------------');
//error_log('country_id ' . Yii::app()->request->getPost('country'));
Filter::setCountryId(Yii::app()->request->getPost('country'));
//error_log('get country_id ' . Filter::getCountryId());
$data = Location::model()->selectCity(Filter::getCountryId());
Filter::setCityId(current(array_keys($data)));
//error_log('get city_id ' . Filter::getCityId());
//error_log(' -------------------- end country1 --------------------------------');
//echo "<pre>";
//error_log(print_r($_SESSION['filter'],true));
//echo "</pre>";
//Yii::app()->end();
//echo CHtml::tag('option', array('value' => 0, 'selected'=>true), CHtml::encode('All city'), true). "\n";
$tagList = '';
foreach ($data as $key => $value) {
$tagList .= CHtml::tag('option', array('value' => $key), CHtml::encode($value), true) . "\n";
}
$this->responceAjax($tagList);
}
示例9: parseUrl
public function parseUrl($manager, $request, $pathInfo, $rawPathInfo)
{
if (!preg_match('%^([\\w-]+)/([\\w-]+)?$%', $pathInfo, $matches)) {
return FALSE;
}
$regionSlug = $matches[1];
$actionOrLocationSlug = $matches[2];
$region = Region::model()->findByAttributes(array('slug' => $regionSlug));
if (null === $region) {
return FALSE;
}
if ('spaces' === $actionOrLocationSlug) {
$_GET['id'] = $region->id;
return 'location/list';
}
$location = Location::model()->findByAttributes(array('slug' => $actionOrLocationSlug, 'region_id' => $region->id));
if (null === $location) {
return FALSE;
}
$_GET['id'] = $location->id;
return 'location/view';
}
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Information();
// $model->scenario = 'information';
if (isset($_POST['Information'])) {
$model->attributes = $_POST['Information'];
$rnd = rand(0, 9999);
// generate random number between 0-9999
$uploadedFile = CUploadedFile::getInstance($model, 'image');
if ($uploadedFile) {
$fileName = "{$rnd}-{$uploadedFile}";
// random number + file name
$model->image = $fileName;
}
// var_dump($_POST['Information']['description']);exit;
$model->user_id = yii::app()->user->id;
$phone = Phone::model()->findByPk($_POST['phone']);
$model->phone = $phone->phone;
$user = Users::model()->findByPk(yii::app()->user->id);
// var_dump($user->email);exit;
$model->email = $user->email;
$location = Location::model()->findByPk($_POST['location']);
$model->location = $location->location;
$model->normal = "Normal";
$model->description = str_replace("\r\n", "<br />", $_POST['Information']['description']);
$t = time();
$model->time = date("Y-m-d", $t);
if ($model->save()) {
if ($uploadedFile) {
$uploadedFile->saveAs(Yii::app()->basePath . '/../banner/' . $fileName);
// image will uplode to rootDirectory/banner/
}
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例11: array
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="span2"><?php
echo $form->labelEx($model, 'transfer_to', array('class' => 'inline-labels'));
?>
</div>
<div class="span3"><?php
echo $form->dropDownList($model, 'transfer_to', $transferTo, array('span' => 2, 'prompt' => '---'));
?>
</div>
<div class="span2"><?php
echo $form->labelEx($model, 'transfer_location', array('class' => 'inline-labels'));
?>
</div>
<div class="span3"><?php
echo $form->dropDownList($model, 'transfer_location', CHtml::listData(Location::model()->findAll(), 'id', 'name'), array('span' => 2, 'prompt' => '---'));
?>
</div>
</div>
</div>
</tr>
<tr>
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="span2"><?php
echo $form->labelEx($model, 'transfer_date', array('class' => 'inline-labels'));
?>
</div>
<div class="span3"><?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('attribute' => 'transfer_date', 'name' => 'transfer_date', 'htmlOptions' => array('value' => date('Y-m-d')), 'model' => $model, 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd')));
?>
示例12: actionLocation
public function actionLocation($id, $to = null)
{
$this->response(Location::model(), $id, 'description', $to);
}
示例13: actionGrid
/**
* Grid of all models.
*/
public function actionGrid()
{
$criteria = new CDbCriteria();
$pages = new CPagination(Location::model()->count($criteria));
$pages->pageSize = self::GRID_PAGE_SIZE;
$pages->applyLimit($criteria);
$sort = new CSort('Location');
$sort->applyOrder($criteria);
$models = Location::model()->findAll($criteria);
$this->render($this->action->id, array('models' => $models, 'pages' => $pages, 'sort' => $sort));
}
示例14: array
<?php
echo $form->textField($model, 'full_name', array('size' => 60, 'maxlength' => 256, 'class' => 'form-control'));
?>
</div>
<?php
echo $form->error($model, 'full_name');
?>
</div>
<div class="form-group row">
<?php
echo $form->labelEx($model, 'location', array('class' => 'control-label'));
?>
<div class="leb">
<?php
$records = Location::model()->findAll(array('order' => 'location'));
$lis = CHtml::listData($records, 'id', 'location');
echo CHtml::dropDownList('location', null, $lis, array('empty' => 'Select Location', 'class' => 'form-control-drop'));
?>
</div>
<?php
echo $form->error($model, 'location');
?>
</div>
<div class="form-group row">
<?php
echo $form->labelEx($model, 'phone', array('class' => 'control-label'));
?>
<div class="leb">
<?php
示例15: array
<?php
$passed = true;
$advertisers = Advertiser::model()->getAdvertisers();
if (count($advertisers) <= 0) {
echo "You need to define some advertisers first!<br/>";
$passed = false;
}
$categories = Category::model()->getCategories(false);
if (count($categories) <= 0) {
echo "You need to define some categories first!<br/>";
$passed = false;
}
$locations = Location::model()->getLocations(false);
if (count($locations) <= 0) {
echo "You need to define some locations first!<br/>";
$passed = false;
}
if ($passed) {
?>
<div class="form">
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'listing-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>
<?php
echo $form->errorSummary($model);
?>