本文整理匯總了PHP中SiteHelpers::getNamePromotion方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteHelpers::getNamePromotion方法的具體用法?PHP SiteHelpers::getNamePromotion怎麽用?PHP SiteHelpers::getNamePromotion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SiteHelpers
的用法示例。
在下文中一共展示了SiteHelpers::getNamePromotion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postDownloads
function postDownloads()
{
if ($this->access['is_excel'] == 0) {
return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
}
$sort = !is_null(Input::get('sort')) ? Input::get('sort') : 'ProductID';
$order = !is_null(Input::get('order')) ? Input::get('order') : 'desc';
$data = DB::table('products');
if ($_POST['ProductID'] != '') {
$data->where('ProductID', "LIKE", "%" . $_POST['ProductID'] . "%");
}
if ($_POST['ProductName'] != '') {
$data->where('ProductName', "LIKE", "%" . $_POST['ProductName'] . "%");
}
if ($_POST['UnitPrice'] != '') {
$data->where('UnitPrice', "LIKE", "%" . $_POST['UnitPrice'] . "%");
}
if ($_POST['CategoryID'] != '') {
$data->where('CategoryID', "=", $_POST['CategoryID']);
}
if ($_POST['id_promotion'] != '') {
$data->where('id_promotion', "=", $_POST['id_promotion']);
}
if ($_POST['status'] != '') {
$data->where('status', "=", $_POST['status']);
}
$data = $data->get();
$content = $this->data['pageTitle'];
$content .= '<table border="1">';
$content .= '<tr>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_id') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_name') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_price') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_category') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_promotion') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_status') . '</th>';
$content .= '<th style="background:#f9f9f9;">' . Lang::get('core.table_created') . '</th>';
$content .= '</tr>';
foreach ($data as $item) {
$promotion = SiteHelpers::getNamePromotion($item->id_promotion);
$promotion = count($promotion) > 0 ? $promotion->name : '';
$status = $item->status == 1 ? Lang::get('core.enable') : Lang::get('core.disable');
$content .= '<tr>';
$content .= '<td>' . $item->ProductID . '</td>';
$content .= '<td>' . $item->ProductName . '</td>';
$content .= '<td>' . $item->UnitPrice . '</td>';
$content .= '<td>' . SiteHelpers::getNameCat($item->CategoryID) . '</td>';
$content .= '<td>' . $promotion . '</td>';
$content .= '<td>' . $status . '</td>';
$content .= '<td>' . date('Y-m-d', $item->created) . '</td>';
$content .= '</tr>';
}
$content .= '</table>';
@header('Content-Type: application/ms-excel');
@header('Content-Length: ' . strlen($content));
@header('Content-disposition: inline; filename="' . $title . ' ' . date("d/m/Y") . '.xls"');
echo $content;
exit;
}