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


PHP Model_Ad::deactivate方法代码示例

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


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

示例1: action_deactivate

 /**
  * Mark advertisement as deactivated : STATUS = 50
  */
 public function action_deactivate()
 {
     $deact_ad = new Model_Ad($this->request->param('id'));
     if ($deact_ad->loaded()) {
         if (Auth::instance()->get_user()->id_user != $deact_ad->id_user) {
             Alert::set(Alert::ALERT, __("This is not your advertisement."));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
         }
         if ($deact_ad->deactivate()) {
             Alert::set(Alert::SUCCESS, __('Advertisement is deactivated'));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
         } else {
             Alert::set(Alert::ALERT, __("Warning, Advertisement is already marked as 'deactivated'"));
             HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
         }
     } else {
         //throw 404
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:23,代码来源:myads.php

示例2: action_delete

 /**
  * Handle DELETE requests.
  * actually just disables the ad ;)
  */
 public function action_delete()
 {
     try {
         if (is_numeric($id_ad = $this->request->param('id'))) {
             $ad = new Model_Ad();
             $ad->where('id_ad', '=', $id_ad)->where('id_user', '=', $this->user->id_user)->find();
             if ($ad->loaded()) {
                 if ($ret = $ad->deactivate()) {
                     $this->rest_output($ret);
                 } else {
                     $this->_error($ret);
                 }
             } else {
                 $this->_error(__('Advertisement not found'), 404);
             }
         } else {
             $this->_error(__('Advertisement not found'), 404);
         }
     } catch (Kohana_HTTP_Exception $khe) {
         $this->_error($khe);
         return;
     }
 }
开发者ID:AndresGrams,项目名称:openclassifieds2,代码行数:27,代码来源:ads.php

示例3: action_deactivate

 /**
  * Mark advertisement as deactivated : STATUS = 50
  */
 public function action_deactivate()
 {
     $id = $this->request->param('id');
     $param_current_url = Core::get('current_url');
     $format_id = explode('_', $id);
     foreach ($format_id as $id) {
         if (isset($id) and is_numeric($id)) {
             $deact_ad = new Model_Ad($id);
             $deact_ad->deactivate();
         }
     }
     Alert::set(Alert::SUCCESS, __('Advertisement is deactivated'));
     if ($param_current_url == Model_Ad::STATUS_NOPUBLISHED and in_array(core::config('general.moderation'), Model_Ad::$moderation_status)) {
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'ad', 'action' => 'moderate')));
     } elseif ($param_current_url == Model_Ad::STATUS_PUBLISHED) {
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'ad', 'action' => 'index')));
     } else {
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'ad', 'action' => 'index')) . '?status=' . $param_current_url);
     }
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:23,代码来源:ad.php


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