예제 #1
0
파일: import.php 프로젝트: pashakiz/crowdf
 /**
  * Update the countries with new columns.
  */
 protected function updateCountries($content)
 {
     JLoader::register("CrowdfundingTableCountry", JPATH_ADMINISTRATOR . "/components/com_crowdfunding/tables/country.php");
     $db = $this->getDbo();
     foreach ($content->country as $item) {
         $code = Joomla\String\String::trim($item->code);
         $keys = array("code" => $code);
         $table = new CrowdfundingTableCountry($db);
         $table->load($keys);
         if (!$table->id) {
             $table->name = Joomla\String\String::trim($item->name);
             $table->code = $code;
         }
         $table->code4 = Joomla\String\String::trim($item->code4);
         $table->latitude = Joomla\String\String::trim($item->latitude);
         $table->longitude = Joomla\String\String::trim($item->longitude);
         $table->currency = Joomla\String\String::trim($item->currency);
         $table->timezone = Joomla\String\String::trim($item->timezone);
         $table->store();
     }
 }
예제 #2
0
 /**
  * Update the countries with new columns.
  * 
  * @param SimpleXMLElement $content
  */
 protected function updateCountries($content)
 {
     JLoader::register('CrowdfundingTableCountry', JPATH_ADMINISTRATOR . '/components/com_crowdfunding/tables/country.php');
     $db = $this->getDbo();
     foreach ($content->country as $item) {
         $code = JString::trim($item->code);
         $keys = array('code' => $code);
         $table = new CrowdfundingTableCountry($db);
         $table->load($keys);
         if (!(int) $table->id) {
             $table->set('name', JString::trim($item->name));
             $table->set('code', $code);
         }
         $table->set('locale', JString::trim($item->locale));
         $table->set('latitude', JString::trim($item->latitude));
         $table->set('longitude', JString::trim($item->longitude));
         $table->set('currency', JString::trim($item->currency));
         $table->set('timezone', JString::trim($item->timezone));
         $table->store();
     }
 }