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


PHP Zone::model方法代码示例

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


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

示例1: actionUpdate

 public function actionUpdate($id)
 {
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     } else {
         $model->loadDataFromStore($id);
     }
     $directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR);
     $themes = array();
     foreach ($directories as $directory) {
         $themes[] = basename($directory);
     }
     $layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name');
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name');
     $languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name');
     $currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title');
     $yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes'));
     $lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title');
     $weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title');
     $taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address"));
     $customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name');
     $informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title'));
     // TODO: localisation
     $orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name');
     // TODO: localisation
     $returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name');
     $mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP"));
     $this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:34,代码来源:SettingsController.php

示例2: actionTreeFill

 public function actionTreeFill()
 {
     $id = !isset($_GET['root']) ? 'source' : $_GET['root'];
     $dataTree = array();
     if ($id == 'source') {
         $root = Zone::model()->findByPk(0);
     } else {
         $root = Zone::model()->findByPk($id);
     }
     foreach ($root->children as $child) {
         $dataTree[] = array('id' => $child->zid, 'text' => CHtml::link($child->name, array('/zone/view/id/' . $child->zid)), 'collapsed' => $child->zid != 0, 'hasChildren' => true);
     }
     echo CTreeView::saveDataAsJson($dataTree);
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:14,代码来源:TestController.php

示例3: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $zone = Zone::model()->findAllByAttributes(array('district_id' => $id));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['District'])) {
         $model->attributes = $_POST['District'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'zone' => $zone));
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:19,代码来源:DistrictController.php

示例4: actionUpdate

 public function actionUpdate($id)
 {
     $model = Zone::model()->findByPk($id);
     if (!is_object($model)) {
         throw new CException("Specified zone doesn't exists.");
         return;
     }
     if (isset($_POST['Zone'])) {
         $model->attributes = $_POST['Zone'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     }
     $statusOptions = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $this->render('update', array('model' => $model, 'statusOptions' => $statusOptions, 'countries' => $countries));
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:17,代码来源:ZonesController.php

示例5: actionDelete

 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         // check child
         $zone = Zone::model()->find('state_id=?', array($model->id));
         if ($zone == NULL) {
             $model->delete();
         } else {
         }
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:24,代码来源:StateController.php

示例6: beforeDelete

 public function beforeDelete()
 {
     $project = project::model()->findAll();
     $zone = Zone::model()->findAll();
     foreach ($project as $id => $item) {
         $projects = explode('|', $item->country_id);
         if (in_array($this->country_id, array_values($projects))) {
             Yii::app()->setFlashMessage('Can not delete, Country in use in project master', 'error');
             return false;
         }
     }
     foreach ($zone as $id => $item) {
         $zones = explode('|', $item->country_id);
         if (in_array($this->country_id, array_values($zones))) {
             Yii::app()->setFlashMessage('Can not delete, Country in use in zone master', 'error');
             return false;
         }
     }
     return parent::beforeDelete();
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:20,代码来源:Country.php

示例7: getZone

 public static function getZone($id)
 {
     return Zone::model()->findByPk($id);
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:4,代码来源:ZoneService.php

示例8: getRows

 public function getRows($pq)
 {
     $rows = $pq->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
     $n = count($rows);
     echo 'Jumlah propinsi: ' . $n . " \n";
     $count = 0;
     foreach ($rows as $value) {
         $count++;
         $row = pq($value);
         $kolom_provinsi = $row->find('td:eq(1) > a');
         $nama_provinsi = $kolom_provinsi->text();
         $link_provinsi = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolom_provinsi->attr('href')) . '&perhal=1000';
         echo sprintf("Memproses propinsi %d dari %d\n", $count, $n);
         echo sprintf("Propinsi: %s Link: %s\n", $nama_provinsi, $link_provinsi);
         $province = Province::model()->findByAttributes(array('name' => $nama_provinsi));
         if (!$province instanceof Province) {
             $province = new Province();
             $province->name = $nama_provinsi;
             if (!$province->save()) {
                 throw new CException('Cannot save province');
             }
         }
         $countdistrict = 0;
         $pqDist = phpQuery::newDocumentHtml($this->getContents($link_provinsi));
         $rowsDist = $pqDist->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
         $nDist = count($rowsDist);
         $countDist = 0;
         foreach ($rowsDist as $valueDist) {
             $countDist++;
             $rowDist = pq($valueDist);
             switch ($rowDist->find('td:eq(2)')->text()) {
                 case 'Kota':
                     $tipeDist = 'kota';
                     break;
                 default:
                 case 'Kab.':
                     $tipeDist = 'kabupaten';
                     break;
             }
             $kolomDist = $rowDist->find('td:eq(3) > a');
             $namaDist = $kolomDist->text();
             $linkDist = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomDist->attr('href')) . '&perhal=1000';
             echo sprintf("Memproses distrik " . $province->name . " %d dari %d\n", $countDist, $nDist);
             echo sprintf("Distrik: %s Link: %s\n", $namaDist, $linkDist);
             $distrik = District::model()->findByAttributes(array('name' => $namaDist, 'province_id' => $province->id, 'type' => $tipeDist));
             if (!$distrik instanceof District) {
                 $distrik = new District();
                 $distrik->name = $namaDist;
                 $distrik->type = $tipeDist;
                 $distrik->province_id = $province->id;
                 if (!$distrik->save()) {
                     throw new CException('Cannot save district');
                 }
             }
             $pqZone = phpQuery::newDocumentHtml($this->getContents($linkDist));
             $rowsZone = $pqZone->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
             $nZone = count($rowsZone);
             $countZone = 0;
             foreach ($rowsZone as $valueZone) {
                 $countZone++;
                 $rowZone = pq($valueZone);
                 $kolomZone = $rowZone->find('td:eq(4) > a');
                 $namaZone = $kolomZone->text();
                 $linkZone = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomZone->attr('href')) . '&perhal=1000';
                 echo sprintf("Memproses zone  %d dari %d\n", $countZone, $nZone);
                 echo sprintf("zone: %s Link: %s\n", $namaZone, $linkZone);
                 $new_zone = false;
                 $zone = Zone::model()->findByAttributes(array('name' => $namaZone, 'district_id' => $distrik->id));
                 if (!$zone instanceof Zone) {
                     $zone = new Zone();
                     $zone->name = $namaZone;
                     $zone->active = 1;
                     $zone->district_id = $distrik->id;
                     if (!$zone->save()) {
                         throw new CException('Cannot save Zone');
                     }
                     $new_zone = true;
                 }
                 echo 'sukses saving zone' . "\n";
                 $countArea = 0;
                 $pqArea = phpQuery::newDocumentHtml($this->getContents($linkZone));
                 $rowsArea = $pqArea->find("table[bgcolor='#ffccff'] tr[bgcolor='#ccffff']");
                 $nArea = count($rowsArea);
                 // Let's speed up things a bit
                 $trans = Yii::app()->db->beginTransaction();
                 foreach ($rowsArea as $valueArea) {
                     $countArea++;
                     $rowArea = pq($valueArea);
                     $kolomArea = $rowArea->find('td:eq(2) > a');
                     $kolomKodePos = $rowArea->find('td:eq(1)');
                     $namaArea = $kolomArea->text();
                     $kodePos = $kolomKodePos->text();
                     $linkKodePos = str_replace(' ', '%20', self::NomorNetKodePosBaseUrl . $kolomArea->attr('href')) . '&perhal=1000';
                     $area = $new_zone ? null : Area::model()->findByAttributes(array('name' => $namaArea, 'zone_id' => $zone->id));
                     if (!$area instanceof Area) {
                         $area = new Area();
                         $area->name = $namaArea;
                         $area->postcode = $kodePos;
                         $area->zone_id = $zone->id;
                         if (!$area->save()) {
//.........这里部分代码省略.........
开发者ID:aantonw,项目名称:dcourier.system,代码行数:101,代码来源:UpdatedbCommand.php

示例9: array

		<?php 
echo $form->labelEx($model, "[{$id}]country_id");
?>
		<?php 
echo $form->dropDownList($model, "[{$id}]country_id", CHtml::listData(Country::model()->findAll('', 'id', 'name'), 'id', 'name'), array('ajax' => array('type' => 'POST', 'url' => $this->createUrl('zones') . "id/{$id}", 'update' => '#CheckoutAddress_' . $id . '_zone_id')));
?>
		<?php 
echo $form->error($model, "[{$id}]country_id");
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, "[{$id}]zone_id");
?>
		<?php 
echo $form->dropDownList($model, "[{$id}]zone_id", CHtml::listData(Zone::model()->findAll('', 'id', 'name'), 'id', 'name'));
?>
		<?php 
echo $form->error($model, "[{$id}]zone_id");
?>
		</div><!-- row -->


<?php 
$this->endWidget();
?>
</div><!-- form -->
<div class="uid hide"><a href="<?php 
echo $this->createUrl('delete', array('id' => $model->id));
?>
" class="del-link"></a><a href="<?php 
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:31,代码来源:_address.php

示例10: array

		<?php 
echo $form->labelEx($model, "[{$id}]country_id");
?>
		<?php 
echo $form->dropDownList($model, "[{$id}]country_id", CHtml::listData(Country::model()->findAll(''), 'id', 'name'), array('ajax' => array('type' => 'POST', 'url' => $this->createUrl('zones') . "id/{$id}", 'update' => '#CheckoutAddress_' . $id . '_zone_id')));
?>
		<?php 
echo $form->error($model, "[{$id}]country_id");
?>
		</div><!-- row-fluid -->
		<div class="row-fluid">
		<?php 
echo $form->labelEx($model, "[{$id}]zone_id");
?>
		<?php 
echo $form->dropDownList($model, "[{$id}]zone_id", CHtml::listData(Zone::model()->findAll('country_id=:country_id', array(':country_id' => $c_id)), 'id', 'name'));
?>
		<?php 
echo $form->error($model, "[{$id}]zone_id");
?>
		</div><!-- row-fluid -->


<?php 
$this->endWidget();
?>
</div><!-- form -->
<div class="uid hide"><a href="<?php 
echo $this->createUrl('delete', array('id' => $model->id));
?>
" class="del-link"></a><a href="<?php 
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:31,代码来源:_address.php

示例11: modzone

 /**
  * Modify User POST
  */
 function modzone()
 {
     $clang = Yii::app()->lang;
     $zone_name = flattenText(Yii::app()->request->getPost("zone_name"));
     $z_name = flattenText(Yii::app()->request->getPost("z_name"));
     $zone_id = (int) Yii::app()->request->getPost("zone_id");
     $z_id = (int) Yii::app()->request->getPost("z_id");
     $c_id = (int) Yii::app()->request->getPost("c_id");
     $IsActive = flattenText(Yii::app()->request->getPost("IsActive"));
     $addsummary = '';
     $aViewUrls = array();
     $is_Active = 0;
     if ($IsActive) {
         $is_Active = 1;
     }
     $sresult = Zone::model()->findAllByAttributes(array('zone_id' => $zone_id));
     $sresultcount = count($sresult);
     if (Permission::model()->hasGlobalPermission('superadmin', 'read') || $sresultcount > 0 && Permission::model()->hasGlobalPermission('Regions', 'update')) {
         if ($z_name == '') {
             $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Editing zone"), $clang->gT("Could not modify zone."), "warningheader", $clang->gT("Zone  name not be empty."), $this->getController()->createUrl('admin/zone/modifyzone'), $clang->gT("Back"), array('zone_id' => $zone_id));
         } elseif (Zone::model()->findByAttributes(array('zone_Name' => $z_name, 'IsActive' => $is_Active), 'country_id=:country_id', array(':country_id' => $c_id))) {
             $aViewUrls['message'] = array('title' => $clang->gT("Failed to add Zone"), 'message' => $clang->gT("The Zone already exists."), 'class' => 'warningheader');
         } else {
             $oRecord = Zone::model()->findByPk($zone_id);
             $oRecord->zone_Name = $this->escape($z_name);
             $oRecord->country_id = $this->escape($c_id);
             $oRecord->IsActive = $this->escape($is_Active);
             $uresult = $oRecord->save();
             // store result of save in uresult
             if ($uresult) {
                 // When saved successfully
                 Yii::app()->setFlashMessage($clang->gT("Zone updated successfully"));
                 $this->getController()->redirect(array("admin/zone/index"));
             } else {
                 //Saving the user failed for some reason, message about email is not helpful here
                 // Username and/or email adress already exists.
                 $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Editing zone"), $clang->gT("Could not modify zone."), 'warningheader');
             }
         }
     } else {
         Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
     }
     $this->_renderWrappedTemplate('region/Zone', $aViewUrls);
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:47,代码来源:zoneaction.php

示例12: getRootZone

 protected function getRootZone($rootId)
 {
     return Zone::model()->findByPk(isset($rootId) && $rootId != 'source' ? $rootId : 0);
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:4,代码来源:ZoneController.php

示例13: array

    ?>
            </td>
            <td align="right" style="text-align: right;">
                <label for='zone'>
                    <a href="<?php 
    echo CController::createUrl('admin/zone/index');
    ?>
" target="_blank"><?php 
    $clang->eT("Zone* : ");
    ?>
</a>
                </label>
            </td>
            <td>
                <?php 
    $zone = Zone::model()->findAll('country_id=:country_id', array(':country_id' => (int) $mrw["country_id"]));
    $zonelist = CHtml::listData($zone, 'zone_id', 'zone_Name');
    echo CHtml::dropDownList('zonelist', $mrw['zone_id'], $zonelist, array('ajax' => array('type' => 'POST', 'data' => array('action' => 'selectstate', 'zone_name' => 'js:this.value'), 'url' => CController::createUrl('admin/contact/sa/selectstate'), 'update' => '#statelist')));
    ?>
            </td>
        </tr>
        <tr>
            <td align="right" style="text-align: right;">
                <label for='state'>
                    <a href="<?php 
    echo CController::createUrl('admin/state/index');
    ?>
" target="_blank"><?php 
    $clang->eT("State* : ");
    ?>
</a>
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:31,代码来源:view_editcompany.php

示例14: actionZones

 public function actionZones($id)
 {
     //echo 'post is'.$id;
     if (Yii::app()->getRequest()->getIsAjaxRequest() && isset($id)) {
         $data = Zone::model()->findAll('country_id=:country_id', array(':country_id' => (int) $_POST['CheckoutAddress'][$id]['country_id']));
         $data = CHtml::listData($data, 'id', 'name');
         foreach ($data as $value => $name) {
             echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
         }
     } else {
         throw new CHttpException(400, Yii::t('info', 'Your request is invalid.'));
     }
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:13,代码来源:CustomerController.php

示例15: array

    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'place-of-offence-form', 'enableAjaxValidation' => false));
?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>

            <?php 
echo $form->textFieldControlGroup($model, 'place', array('span' => 5, 'maxlength' => 145));
?>

            <?php 
echo $form->dropDownListControlGroup($model, 'zone_id', CHtml::listData(Zone::model()->findAll(array('order' => 'id ASC')), 'id', 'zone'), array('span' => 5));
?>
      

            <?php 
echo $form->textFieldControlGroup($model, 'police_station_id', array('span' => 5));
?>
            
            <div id="select_district" >
                <label>Select District</label>
                <?php 
//echo $form->dropDownList($model,'district_id',CHtml::listData(District::model()->findAllByAttributes(array('states_id'=>$model->state_id),array('order' => 'name ASC')), 'id', 'name'),array('empty'=>'---Select State first---','span'=>5));
?>
                <?php 
echo $form->dropDownList($model, 'state_id', CHtml::listData(States::model()->findAllByPk(array(19, 7, 32)), 'id', 'name'), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('placeOfPosting/courts'), 'update' => '#PlaceOfOffence_court_id', 'data' => array('state_id' => 'js:this.value')), 'empty' => 'Select District'), array('span' => 5));
?>
开发者ID:harpreet39,项目名称:challan,代码行数:31,代码来源:_form.php


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