本文整理匯總了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'));
}
}