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