本文整理汇总了PHP中Banner::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Banner::select方法的具体用法?PHP Banner::select怎么用?PHP Banner::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Banner
的用法示例。
在下文中一共展示了Banner::select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listBanner
public function listBanner()
{
if (!Request::ajax()) {
return App::abort(404);
}
$start = Input::has('start') ? (int) Input::get('start') : 0;
$length = Input::has('length') ? Input::get('length') : 10;
$search = Input::has('search') ? Input::get('search') : [];
$banners = Banner::select('id', 'name', 'order_no', 'image', 'active');
if (!empty($search)) {
foreach ($search as $key => $value) {
if (empty($value)) {
continue;
}
if ($key == 'active') {
if ($value == 'yes') {
$value = 1;
} else {
$value = 0;
}
$banners->where($key, $value);
} else {
$value = ltrim(rtrim($value));
$banners->where($key, 'like', '%' . $value . '%');
}
}
}
$order = Input::has('order') ? Input::get('order') : [];
if (!empty($order)) {
$columns = Input::has('columns') ? Input::get('columns') : [];
foreach ($order as $value) {
$column = $value['column'];
if (!isset($columns[$column]['name']) || empty($columns[$column]['name'])) {
continue;
}
$banners->orderBy($columns[$column]['name'], $value['dir'] == 'asc' ? 'asc' : 'desc');
}
}
$count = $banners->count();
if ($length > 0) {
$banners = $banners->skip($start)->take($length);
}
$arrBanners = $banners->get()->toArray();
$arrReturn = ['draw' => Input::has('draw') ? Input::get('draw') : 1, 'recordsTotal' => Banner::count(), 'recordsFiltered' => $count, 'data' => []];
if (!empty($arrBanners)) {
foreach ($arrBanners as $banner) {
$arrReturn['data'][] = array(++$start, $banner['id'], $banner['name'], $banner['image'], $banner['order_no'], $banner['active']);
}
}
$response = Response::json($arrReturn);
$response->header('Content-Type', 'application/json');
return $response;
}
示例2: begin
public function begin()
{
/** @var Html $document */
$groupId = $this->getParams('banner_group_id');
if ($groupId) {
$this->banners = Banner::select()->where('`status`=:status AND `term_id`=:term_id')->setParameters([':status' => 'ACTIVE', ':term_id' => $groupId])->orderBy('ordering')->execute();
}
}
示例3: getBanners
public static function getBanners()
{
$arrData = [];
if (Cache::has('banners')) {
$arrData = Cache::get('banners');
} else {
$banners = Banner::select('image')->where('active', 1)->orderBy('order_no', 'asc')->get();
foreach ($banners as $banner) {
$arrData[] = URL . '/' . $banner->image;
}
Cache::forever('banners', $arrData);
}
$rand = rand(0, count($arrData) - 1);
return ['main' => isset($arrData[$rand]) ? $arrData[$rand] : ''];
}
示例4: array
/**
*
* @access public
*/
function update_ads()
{
$id = get_post_value('id');
$field = array('banner_id', 'img_path', 'created', 'title', 'start_time', 'end_time', 'orders', 'language');
$m = new Banner();
$m->clear();
$m->setField($field);
$m->setTable('vcb_index_banner2');
$m->setWhere('banner_id', '=', $id);
$m->setWhere('status', '!=', '60000');
$data = $m->select();
//print_r($data);
$this->assign('data', $data);
}
示例5: Index
function Index()
{
//echo "session=";
// print_r($_SESSION);
// echo "<br>cookie=";
// print_r($_COOKIE);
if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
//检测session
$this->assign('username', $_SESSION['username']);
} else {
if (!empty($_COOKIE["username"])) {
//检测cookie
$userCookie = $_COOKIE["username"];
$this->assign('username', $userCookie);
} else {
//游客登陆
$tourists_id = Login::getTouristsId();
if ($tourists_id == null) {
Login::setTouristsId();
}
//
}
}
//else结束
//
$c = new Category();
$category_1 = $c->getCategory_1_id();
$this->assign('category_1', $category_1);
$f = new Floor();
$floor_1 = $f->getFloor_1_id();
$this->assign('floor_1', $floor_1);
//
$m = new Category();
$num = count($m->getCategory_1_id()) * 10000;
$category_2_all = $this->get_category_2();
$this->assign('category_2_all', $category_2_all);
//var_dump($category_2_all);
//echo $num1."<br>";
$category_3_all = $this->get_category_3();
//echo "oh:".$num2."<br>";
//$this->assign('category_3_'.$i."_".$j.$k, $category_3_1[$k]);
//var_dump($category_3_all);
$this->assign('category_3_all', $category_3_all);
//$a=new Banner();
$floor_2_all = $this->get_floor_2();
$floor_3_all = $this->get_floor_3();
$this->assign('floor_2_all', $floor_2_all);
$this->assign('floor_3_all', $floor_3_all);
//********************************
$type = get_post_value('type');
$language = get_post_value('language');
$key = get_post_value('key');
$field = array('category_id', 'type', 'title', 'created', 'start_time', 'end_time', 'status', 'language');
$m = new Banner();
$m->clear();
$m->setField($field);
$m->setTable('vcb_banner_categor');
//$m->setWhere('status', '!=', '60000');//暂不设置
if ($type != '') {
$m->setWhere('type', '=', $type);
}
if ($language != '') {
$m->setWhere('language', '=', $language);
}
if ($key != '') {
$m->setWhere('title', 'LIKE', '%' . $key . '%');
}
$m->setOrderBy('type');
$data = $m->select();
//状态标题 在每一条数据后加上4个数据
$count = count($data);
for ($i = 0; $i < $count; $i++) {
$data[$i]['status_cn'] = $m->getStatus('cn', $data[$i]['status']);
$data[$i]['status_th'] = $m->getStatus('th', $data[$i]['status']);
//$data[$i]['type'] = $m->getTypeCaption($data[$i]['type']);//返回位置对应描述
$data[$i]['dataInformation'] = $m->getImage($data[$i]['category_id']);
}
//print_r($data);
$this->assign('dataOfBanner', $data);
}
示例6: update
/**
* 返回更新国家信息
* @access public
*/
function update()
{
$id = get_post_value('id');
$field = array('category_id', 'type', 'title', 'created', 'start_time', 'end_time', 'status', 'language');
$m = new Banner();
$m->clear();
$m->setField($field);
$m->setTable('vcb_banner_categor');
$m->setWhere('category_id', '=', $id);
$m->setWhere('status', '!=', '60000');
$data = $m->select();
$this->assign('data', $data);
//修改原记录
//图像
$field = array('image_path', 'orders', 'image_id');
$m->clear();
$m->setField($field);
$m->setTable('vcb_banner_images');
$m->setWhere('category_id', '=', $id);
$m->setWhere('status', '=', '10000');
$m->setOrderBy('orders');
$data = $m->select();
$this->assign('images', $data);
}