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


PHP Country::LoadByCode方法代码示例

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


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

示例1: CountryByCode

 /**
  * Return the country name (e.g. "Canada") given the country code (e.g. "CA").
  * @param string $strCode The country code.
  * @return The country name.
  */
 public static function CountryByCode($strCode)
 {
     $objCountry = Country::LoadByCode($strCode);
     if ($objCountry instanceof Country) {
         return $objCountry->country;
     } else {
         return '';
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:14,代码来源:Country.php

示例2: LoadByCountry

 public static function LoadByCountry($strCountry, $blnRestrict = false)
 {
     $objCountry = Country::LoadByCode($strCountry);
     if ($blnRestrict) {
         if (count(Destination::model()->countByAttributes(array('country' => $objCountry->id, 'state' => null)))) {
             $arrStates = State::model()->findAllByAttributes(array('country_id' => $objCountry->id, 'active' => 1), State::GetDefaultOrdering());
             return Destination::ConvertStatesToDestinations($objCountry->id, $arrStates);
         }
     }
     return Destination::model()->findAll('country IS NULL OR country=:t1 ' . Destination::GetDefaultOrdering(true), array(':t1' => $objCountry->id));
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:11,代码来源:Destination.php

示例3: QDateTime

    $objPerson->SetPassword($objRow['password']);
    $objPerson->FirstName = $objRow['first_name'];
    $objPerson->LastName = $objRow['last_name'];
    $objPerson->Email = $objRow['email'];
    $objPerson->PasswordResetFlag = false;
    $objPerson->DisplayRealNameFlag = $objRow['display_real_name_flag'];
    $objPerson->DisplayEmailFlag = $objRow['display_email_flag'];
    $objPerson->OptInFlag = $objRow['opt_in_flag'];
    $objPerson->DonatedFlag = $objRow['donated_flag'];
    $objPerson->Location = $objRow['location'];
    $objPerson->Url = $objRow['url'];
    $objPerson->RegistrationDate = new QDateTime($objRow['registration_date']);
    if ($objRow['country_id']) {
        $objCountryResult = $objDb->query('SELECT * FROM country WHERE id=' . $objRow['country_id']);
        $objCountryRow = $objCountryResult->fetch_array();
        $objPerson->Country = Country::LoadByCode($objCountryRow['code']);
    }
    $objPerson->RefreshDisplayName();
    $objPerson->Save();
    if ($objPerson->Id != $objRow['id']) {
        Person::GetDatabase()->NonQuery('UPDATE person SET id=' . $objRow['id'] . ' WHERE id=' . $objPerson->Id);
    }
}
$intNewTopicLinkIdArray[3591] = 7;
$intNewTopicLinkIdArray[3578] = 7;
$intNewTopicLinkIdArray[3547] = 7;
$intNewTopicLinkIdArray[3455] = 7;
$intNewTopicLinkIdArray[3242] = 7;
$intNewTopicLinkIdArray[3244] = 7;
$objResult = $objDb->query('SELECT * FROM topic ORDER BY id');
while (QDataGen::DisplayWhileTask('Migrating Topics', $objResult->num_rows)) {
开发者ID:qcodo,项目名称:qcodo-website,代码行数:31,代码来源:migrator.cli.php

示例4: actionConvertDestinationTables

 /**
  * 18 Change destination tables and map to country/state ids
  */
 protected function actionConvertDestinationTables()
 {
     //Convert Wish List items to new formats
     //Ship to me
     //Ship to buyer
     //Keep in store
     //find and remove any destinations with an erroneous taxcode
     $sql = 'SELECT `id` FROM `xlsws_destination` WHERE `taxcode` NOT IN (SELECT xlsws_tax_code.lsid FROM xlsws_tax_code);';
     $array = Yii::app()->db->createCommand($sql)->queryAll();
     foreach ($array as $a) {
         Yii::log('Destination id ' . $a['id'] . 'deleted due to erroneous tax code', 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         _dbx('DELETE FROM `xlsws_destination` WHERE `id`=' . $a['id'] . ';');
     }
     $objDestinations = Destination::model()->findAll();
     foreach ($objDestinations as $objDestination) {
         if ($objDestination->country == "*") {
             $objDestination->country = null;
         } else {
             if (!is_numeric($objDestination->country)) {
                 $objC = Country::LoadByCode($objDestination->country);
                 $objDestination->country = $objC->id;
             }
         }
         if ($objDestination->state == "*" || $objDestination->state == null) {
             $objDestination->state = null;
         } else {
             if (!is_numeric($objDestination->state)) {
                 $objS = State::LoadByCode($objDestination->state, $objDestination->country);
                 $objDestination->state = $objS->id;
             }
         }
         if (!$objDestination->save()) {
             return print_r($objDestination->getErrors());
         }
     }
     //Need to map destinations to IDs before doing this
     _dbx("update `xlsws_destination` set country=null where country=0;");
     _dbx("update `xlsws_destination` set state=null where state=0;");
     _dbx("ALTER TABLE `xlsws_destination` CHANGE `country` `country` INT(11)  UNSIGNED  NULL  DEFAULT NULL;");
     _dbx("ALTER TABLE `xlsws_destination` CHANGE `state` `state` INT(11)  UNSIGNED  NULL  DEFAULT NULL;");
     _dbx("ALTER TABLE `xlsws_destination` CHANGE `taxcode` `taxcode` INT(11)  UNSIGNED  NULL  DEFAULT NULL;");
     _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`state`) REFERENCES `xlsws_state` (`id`);");
     _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`country`) REFERENCES `xlsws_country` (`id`);");
     _dbx("ALTER TABLE `xlsws_destination` ADD FOREIGN KEY (`taxcode`) REFERENCES `xlsws_tax_code` (`lsid`);");
     _dbx("ALTER TABLE `xlsws_category` CHANGE `custom_page` `custom_page` INT(11)  UNSIGNED  NULL  DEFAULT NULL;");
     _dbx("UPDATE `xlsws_category` set `custom_page`=null where `custom_page`=0;");
     _dbx("ALTER TABLE `xlsws_category` ADD FOREIGN KEY (`custom_page`) REFERENCES `xlsws_custom_page` (`id`);");
     _dbx("ALTER TABLE `xlsws_country` DROP `code_a3`;");
     _dbx("update `xlsws_shipping_tiers` set `class_name`='tieredshipping';");
     return array('result' => "success", 'makeline' => 19, 'tag' => 'Applying database schema changes', 'total' => 50);
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:54,代码来源:InstallController.php

示例5: setBillingCountryCode

 public function setBillingCountryCode($strCountryCode)
 {
     $objBillingCountry = Country::LoadByCode($strCountryCode);
     if ($objBillingCountry === null) {
         $this->billingCountry = null;
     } else {
         $this->billingCountry = $objBillingCountry->id;
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:9,代码来源:BaseCheckoutForm.php


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