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


PHP Country::delete方法代码示例

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


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

示例1: delete

 function delete()
 {
     $this->is_loggedin();
     global $runtime;
     $to_trash = new Country($runtime['ident']);
     $to_trash->delete();
     redirect('countries/all');
 }
开发者ID:stas,项目名称:bebuntu,代码行数:8,代码来源:countries-controller.php

示例2: delete

 public function delete($id = null)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new Country($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, $data->id, $action . ' ' . $data->country_name . ' Country');
             $data->delete();
         }
     }
     redirect("admin/" . $this->modules_name);
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:12,代码来源:countries.php

示例3: camp_html_breadcrumbs

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/country/country_common.php";
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
if (!$g_user->hasPermission('DeleteCountries')) {
    camp_html_display_error($translator->trans("You do not have the right to delete countries.", array(), 'country'));
    exit;
}
$f_country_code = Input::Get('f_country_code');
$f_country_language = Input::Get('f_country_language');
$country = new Country($f_country_code, $f_country_language);
$language = new Language($f_country_language);
$deleted = $country->delete();
if ($deleted) {
    camp_html_goto_page("/{$ADMIN}/country");
}
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Delete country", array(), 'country'), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
开发者ID:sourcefabric,项目名称:newscoop,代码行数:30,代码来源:do_del.php

示例4: doModel


//.........这里部分代码省略.........
                                                         }
                                                     }
                                                     unset($cities);
                                                     unset($cities_json);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         osc_add_flash_ok_message(sprintf(_m('%s has been added as a new country'), $countryName), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_country':
                     // edit country
                     $countryCode = Params::getParam('country_code');
                     $request = Params::getParam('e_country');
                     $ok = true;
                     foreach ($request as $k => $v) {
                         $result = $mCountries->updateLocale($countryCode, $k, $v);
                         if (!$result) {
                             $ok = false;
                         }
                     }
                     if ($ok) {
                         osc_add_flash_ok_message(_m('Country has been edited'), 'admin');
                     } else {
                         osc_add_flash_ok_message(_m('There were some problems editing the country'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_country':
                     // delete country
                     $countryId = Params::getParam('id');
                     // HAS ITEMS?
                     $has_items = Item::newInstance()->listWhere('l.fk_c_country_code = \'%s\' LIMIT 1', $countryId);
                     if (!$has_items) {
                         $mRegions = new Region();
                         $mCities = new City();
                         $aCountries = $mCountries->findByCode($countryId);
                         $aRegions = $mRegions->listWhere('fk_c_country_code =  \'' . $aCountries['pk_c_code'] . '\'');
                         foreach ($aRegions as $region) {
                             $mCities->delete(array('fk_i_region_id' => $region['pk_i_id']));
                             $mRegions->delete(array('pk_i_id' => $region['pk_i_id']));
                         }
                         $mCountries->delete(array('pk_c_code' => $aCountries['pk_c_code']));
                         osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCountries['s_name']), 'admin');
                     } else {
                         osc_add_flash_error_message(sprintf(_m('%s can not be deleted, some items are located in it'), $aCountries['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_region':
                     // add region
                     if (!Params::getParam('r_manual')) {
                         $this->install_location_by_region();
                     } else {
                         $mRegions = new Region();
                         $regionName = Params::getParam('region');
                         $countryCode = Params::getParam('country_c_parent');
                         $exists = $mRegions->findByNameAndCode($regionName, $countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('fk_c_country_code' => $countryCode, 's_name' => $regionName);
                             $mRegions->insert($data);
开发者ID:nsswaga,项目名称:OSClass,代码行数:67,代码来源:settings.php

示例5: doModel


//.........这里部分代码省略.........
                 case 'add_country':
                     // add country
                     if (!Params::getParam('c_manual')) {
                         $this->install_location_by_country();
                     } else {
                         $countryCode = Params::getParam('c_country');
                         $countryName = Params::getParam('country');
                         $countryLanguage = osc_language();
                         $exists = $mCountries->findByCode($countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('pk_c_code' => $countryCode, 'fk_c_locale_code' => $countryLanguage, 's_name' => $countryName);
                             $mCountries->insert($data);
                             osc_add_flash_message(sprintf(__('%s has been added as a new country'), $countryName), 'admin');
                         } else {
                             osc_add_flash_message(sprintf(__('%s already was in the database'), $countryName), 'admin');
                         }
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_country':
                     // edit country
                     $newCountry = Params::getParam('e_country');
                     $oldCountry = Params::getParam('country_old');
                     $exists = $mCountries->findByName($newCountry);
                     $old_exists = $mCountries->findByName($oldCountry);
                     if (!isset($exists['pk_c_code']) || $exists['pk_c_code'] == $old_exists['pk_c_code']) {
                         $mCountries->update(array('s_name' => $newCountry), array('s_name' => $oldCountry));
                         osc_add_flash_message(sprintf(__('%s has been edited'), $newCountry), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s already was in the database'), $newCountry), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_country':
                     // delete country
                     $countryId = Params::getParam('id');
                     // HAS ITEMS?
                     $has_items = Item::newInstance()->listWhere('l.fk_c_country_code = \'%s\' LIMIT 1', $countryId);
                     if (!$has_items) {
                         $mRegions = new Region();
                         $mCities = new City();
                         $aCountries = $mCountries->findByCode($countryId);
                         $aRegions = $mRegions->listWhere('fk_c_country_code =  \'' . $aCountries['pk_c_code'] . '\'');
                         foreach ($aRegions as $region) {
                             $mCities->delete(array('fk_i_region_id' => $region['pk_i_id']));
                             $mRegions->delete(array('pk_i_id' => $region['pk_i_id']));
                         }
                         $mCountries->delete(array('pk_c_code' => $aCountries['pk_c_code']));
                         osc_add_flash_message(sprintf(__('%s has been deleted'), $aCountries['s_name']), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s can not be deleted, some items are located in it'), $aCountries['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_region':
                     // add region
                     if (!Params::getParam('r_manual')) {
                         $this->install_location_by_region();
                     } else {
                         $mRegions = new Region();
                         $regionName = Params::getParam('region');
                         $countryCode = Params::getParam('country_c_parent');
                         $exists = $mRegions->findByNameAndCode($regionName, $countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('fk_c_country_code' => $countryCode, 's_name' => $regionName);
                             $mRegions->insert($data);
开发者ID:hashemgamal,项目名称:OSClass,代码行数:67,代码来源:settings.php


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