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


PHP Addresses::save方法代码示例

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


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

示例1: actionAdd

 public function actionAdd($bid)
 {
     $brand = Brands::model()->findByPk($bid);
     $model = new Addresses();
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Addresses'])) {
         if ($_FILES['file']) {
             foreach ($_FILES['file']['name'] as $k => $v) {
                 if ($v) {
                     $file[$k] = CUploadedFile::getInstanceByName('file[' . $k . ']');
                     if (in_array(strtolower($file[$k]->getExtensionName()), array('jpg', 'gif', 'png', 'jpeg'))) {
                         $model->{$k} = $k . '.' . $file[$k]->getExtensionName();
                     } else {
                         $model->{$k} = CUploadedFile::getInstanceByName('file[' . $k . ']');
                     }
                 }
             }
         }
         $model->attributes = $_POST['Addresses'];
         if ($model->save()) {
             if ($file) {
                 $folder = dirname(Yii::app()->request->scriptFile);
                 $folder .= '/userdata/addresses/addresses_' . $model->id . '/';
                 foreach ($file as $k => $v) {
                     if (in_array(strtolower($file[$k]->getExtensionName()), array('jpg', 'gif', 'png', 'jpeg'))) {
                         UploadImages::upload($file[$k]->getTempName(), $model->{$k}, $folder, 'addresses', $k);
                     }
                 }
             }
             $this->redirect('/admin/brands/' . $bid . '/addresses/');
         }
     }
     $this->render('_form', array('model' => $model, 'brand' => $brand, 'title' => 'Добавление адреса'));
 }
开发者ID:parxtan,项目名称:gdeskidki,代码行数:35,代码来源:AddressesController.php

示例2: Addresses

$addrs = new Addresses();
$addrs->setKeyID($keyID);
// home address
$homeAddr = $addrs->getColumn('homeAddress');
$homeAddr->setColumn('city', 'san francisco');
$homeAddr->setColumn('street', '1234 x street');
$homeAddr->setColumn('zip', '94107');
// work address
$workAddr = $addrs->getColumn('workAddress');
$workAddr->setColumn('city', 'san jose');
$workAddr->setColumn('street', '9876 y drive');
// custom labelled supercolumn
$customAddr = new Address('customAddress');
$customAddr->setColumn('city', 'another city');
$addrs->addSuper($customAddr);
if (!$addrs->save()) {
    die($addrs->lastError());
}
unset($addrs);
// Load the saved Addresses
$addrs = new Addresses();
if (!$addrs->load($keyID)) {
    die($addrs->lastError());
}
// Show our loaded CF in JSON format, including key path
echo '<pre>' . $addrs->toJSON(TRUE) . '</pre>';
// Example export -> import of JSON structure from loaded data into new object
$addrsClone = new Addresses();
// Populates data from JSON export (therefore must exclude key path)
$addrsClone->populate($addrs->toJSON());
// Set key
开发者ID:jlaprise,项目名称:Pandra,代码行数:31,代码来源:address_supercolumn.php

示例3: createEmptyCompany

    /**
     * Create Empty company without users
     * @param $fedId
     * @param $newCompanyName
     * @param $impVendorInfo
     * @return Clients
     */
    public static function createEmptyCompany($fedId, $newCompanyName, $impVendorInfo = null)
    {
        $client = new Clients;

        // begin transaction
        $transaction = Yii::app()->db->beginTransaction();
        try {
            $company = new Companies;
            $project = new Projects;
            $companyAdreses = new CompanyAddresses;
            //$usersClientList = new UsersClientList;

            $company->Company_Name = $newCompanyName;
            $company->Company_Fed_ID = $fedId;
            if (preg_match('/^(\d{2}\-\d{7})|(\d{3}\-\d{2}\-\d{4})$/', $company->Company_Fed_ID)) {
                //usual w9 do nothing
            }

            if (preg_match('/^(IN[-]\d{7})$/', $company->Company_Fed_ID)) {
            //international w9
                $company->Temp_Fed_ID_Flag = 'N';

            }
            if (preg_match('/^(T0[-]\d{7})$/', $company->Company_Fed_ID)) {
                //international w9
                $company->Temp_Fed_ID_Flag = 'T';
            }

            $company->Auth_Code = Helper::generatePassword();

            $company->save();


            $company_adress = new Addresses;

            if ($impVendorInfo) {
                $company_adress = new Addresses;
                $company_adress->Address1 = $impVendorInfo['address'];
                $company_adress->City = $impVendorInfo['city'];
                $company_adress->State = $impVendorInfo['state'];
                $company_adress->ZIP = $impVendorInfo['zip'];
                if ($company_adress->validate()) {
                    $company_adress->save();
                } else {
                    $company_adress = new Addresses;
                    $company_adress->save();
                }
            }

            $company_adress->save();

            $companyAdreses->Company_ID = $company->Company_ID;
            $companyAdreses->Address_ID = $company_adress->Address_ID ? $company_adress->Address_ID : 0;
            $companyAdreses->save();

            $client->Company_ID = $company->Company_ID;
            $client->Client_Type = 1;
            $client->Client_Number = 1;
            $client->save();

            //create client project
            $project->Client_ID = $client->Client_ID;
            $project->Project_Name = "Corporate";
            $project->Project_Description = "Description of the Project";
            $project->PO_Starting_Number = Projects::DEFAULT_PO_STARTING_NUMBER;
            $project->Ck_Req_Starting_Numb = Projects::DEFAULT_CKRQ_STARTING_NUMBER;
            $project->save();

            $transaction->commit();
        } catch(Exception $e) {
            $transaction->rollback();
        }

        return $client;
    }
开发者ID:ranvijayj,项目名称:htmlasa,代码行数:82,代码来源:Companies.php

示例4: AddNew

 /**
  * Add a new address
  * @param $id
  * @param array $data
  * @return integer address_id
  */
 public static function AddNew(array $data, $id = "")
 {
     if (is_numeric($id)) {
         $address = self::find($id);
     } else {
         $address = new Addresses();
     }
     $address['address'] = $data['address'];
     $address['city'] = $data['city'];
     $address['code'] = $data['code'];
     $address['area'] = $data['area'];
     $region_id = intval($data['region_id']);
     if ($region_id != 0) {
         $address['region_id'] = $region_id;
     }
     // Get the latitude and longitude coordinates
     $coords = Shineisp_Commons_Utilities::getCoordinates($data['city']);
     $address['latitude'] = $coords['results'][0]['geometry']['location']['lat'];
     $address['longitude'] = $coords['results'][0]['geometry']['location']['lng'];
     $address['country_id'] = $data['country_id'];
     $address['customer_id'] = $data['customer_id'];
     $address->save();
     return $address['address_id'];
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:30,代码来源:Addresses.php


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