本文整理汇总了PHP中Model_Ad::sold方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Ad::sold方法的具体用法?PHP Model_Ad::sold怎么用?PHP Model_Ad::sold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Ad
的用法示例。
在下文中一共展示了Model_Ad::sold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_sold
/**
* Mark advertisement as deactivated : STATUS = 50 and set the stock equal to zero
*/
public function action_sold()
{
$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->sold()) {
Alert::set(Alert::SUCCESS, __('Advertisement is marked as Sold'));
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'));
}
}