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


PHP Model_Content::delete方法代码示例

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


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

示例1: action_delete

 /**
  * action: DELETE
  */
 public function action_delete()
 {
     $this->auto_render = FALSE;
     $id = $this->request->param('id');
     $content = new Model_Content($id);
     if ($content->loaded()) {
         //deleting default locale emails is not allowed
         if ($content->type == 'email' and $content->locale == i18n::$locale_default) {
             Alert::set(Alert::INFO, sprintf(__('Sorry, deleting %s locale emails is not allowed'), i18n::$locale_default));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $content->type . '&locale_select=' . $content->locale);
         } else {
             try {
                 $content->delete();
                 $this->template->content = 'OK';
             } catch (Exception $e) {
                 Alert::set(Alert::ERROR, $e->getMessage());
             }
         }
     }
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:23,代码来源:content.php

示例2: action_delete

 /**
  * action: DELETE
  */
 public function action_delete()
 {
     $this->auto_render = FALSE;
     $id = $this->request->param('id');
     $content = new Model_Content($id);
     $type = $content->type;
     $locale = $content->locale;
     if ($content->loaded()) {
         try {
             $content->delete();
             Cache::instance()->delete_all();
             $this->template->content = 'OK';
             Alert::set(Alert::SUCCESS, __('Content is deleted'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
     } else {
         Alert::set(Alert::INFO, __('Content is not deleted'));
     }
     Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $type . '&locale_select=' . $locale);
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:24,代码来源:content.php


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