本文整理汇总了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'));
}
}
示例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;
}
}
示例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);
}
}