本文整理汇总了PHP中Banner::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Banner::model方法的具体用法?PHP Banner::model怎么用?PHP Banner::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Banner
的用法示例。
在下文中一共展示了Banner::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$this->tituloManual = "Novo pedido";
$modelPizzaria = Pizzaria::model()->find();
$modelBanner = Banner::model()->ativos()->find();
if (!$this->validaSituacao()) {
$this->render('indisponivel', array('modelPizzaria' => $modelPizzaria, 'modelBanner' => $modelBanner));
Yii::app()->end();
}
$dataBebidas = new Produto();
$dataPratosLanche = new Produto();
$dataPromocao = new Promocao();
$modelSabor = array();
$modelTamanho = array();
$arrayTipoSabor = array();
$listCombinado = array();
switch ($modelPizzaria->tipo_restaurante) {
case TipoRestaurante::_TIPO_PIZZARIA_:
$modelSabor = Sabor::model()->ativos()->findAll();
$modelTamanho = Tamanho::getArrayTamanho();
$arrayTipoSabor = TipoSabor::getArrayTipoSabor();
break;
default:
$listCombinado = CHtml::listData(Combinado::model()->ativos()->findAll(), 'id', 'nome');
break;
}
$this->render('index', array('modelPedido' => new Pedido(), 'loginForm' => new LoginForm(), 'modelCliente' => new Cliente(), 'modelUsuario' => new Usuario(), 'dataBebidas' => $dataBebidas->ativos()->bebidas()->search(), 'dataPratosLanche' => $dataPratosLanche->ativos()->pratoLanche()->search(), 'dataPromocao' => $dataPromocao->ativas()->search(), 'modelSabor' => $modelSabor, 'modelTamanho' => $modelTamanho, 'arrayTipoSabor' => $arrayTipoSabor, 'modelPizzaria' => $modelPizzaria, 'arrayBairro' => CHtml::listData(EnderecoPermitido::model()->ativos()->findAll(array('group' => 'bairro', 'distinct' => true)), 'bairro', 'bairro'), 'arrayFormaPagamento' => CHtml::listData(FormaPagamento::model()->ativos()->findAll(), 'id', 'nome'), 'listCombinado' => $listCombinado, 'modelBanner' => $modelBanner));
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
die;
$model = new Customer();
// $jaspers_franchise = JaspersFranchise::model()->findAll();
$jaspers_companies = JaspersCompanies::model()->findAllByAttributes(array('franchise_id' => Yii::app()->user->franchise));
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$bannerImg = Banner::model()->findByAttributes(array('isactive' => 1, 'loc' => 1));
$curUser = User::model()->findByPk(Yii::app()->user->uid);
if (isset($_POST['Customer'])) {
$model->attributes = $_POST['Customer'];
$model->jaspers_franchise = Yii::app()->user->franchise;
$curUser->name = $model->contact;
$curUser->save();
if (Yii::app()->user->isUser()) {
$model->attendee = Yii::app()->user->uid;
$model->franchise = Yii::app()->user->franchise;
}
if ($model->save()) {
Yii::app()->session['last_created_user'] = $model->attributes;
$istApp = new CustAppoint();
$istApp->app_id = 1;
$istApp->cus_id = getCurCusId();
$istApp->status = 0;
$istApp->save();
if (isset($_GET['back'])) {
$this->redirect(array('site/index'));
}
//$this->redirect(array('site/getstarted', 'id' => getCurCusId()));
$this->redirect(array('workingwell/create', 'id' => getCurCusId()));
}
}
$this->render('create', array('model' => $model, 'bannerImg' => $bannerImg, 'curUser' => $curUser, 'jaspers_companies' => $jaspers_companies));
}
示例3: loadModel
public function loadModel($id)
{
if (($model = Banner::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例4: banner
public function banner($params = array())
{
//获取最新banner图片列表
$images = Banner::model()->getBannerList();
//获取通卡信息列表
$cards = Yii::app()->params['cards'];
return $this->notice('OK', 0, '成功', ['images' => $images, 'cards' => $cards]);
}
示例5: init
public function init()
{
$criteria = new CDbCriteria();
$criteria->order = 'sequence';
$criteria->addColumnCondition(array('id_banner_place' => $this->idBannerPlace));
$this->banners = Banner::model()->with('bannerFile')->findAll($criteria);
parent::init();
}
示例6: actionSuccess
public function actionSuccess()
{
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 4);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '反馈中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->layout = 'main';
$this->render('success', array('banner' => $banner));
}
示例7: getBanner
public function getBanner()
{
$ya = date('Y-m-d H:i:s');
$c = new CDbCriteria();
$c->condition = 'estado = :estado AND (inicio_publicacion < :inicio_p OR inicio_publicacion IS NULL) AND (fin_publicacion > :fin_p OR fin_publicacion IS NULL)';
$c->params = array(':estado' => 1, 'inicio_p' => $ya, 'fin_p' => $ya);
$dependencia = new CDbCacheDependency("SELECT GREATEST(MAX(creado), MAX(modificado)) FROM banner WHERE estado = 1 AND (inicio_publicacion < '" . $ya . "' OR inicio_publicacion IS NULL) AND (fin_publicacion > '" . $ya . "' OR fin_publicacion IS NULL)");
return Banner::model()->cache(3600, $dependencia)->find($c);
}
示例8: run
public function run()
{
$model = Banner::model()->findByAttributes(array('active' => 1));
if ($model != null && (!isset(Yii::app()->request->cookies['closeBanner']) || Yii::app()->request->cookies['closeBanner'] != $model->id) && ($model->presence == 'all' || Yii::app()->controller->id . '/' . Yii::app()->controller->action->id == 'site/index')) {
Yii::app()->clientScript->registerCssFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('banner.assets'), false, -1, YII_DEBUG) . '/css/banner.css');
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScript('banner-message', "\n\n\t\t\t\$(document).ready(function() {\n\t\t\t \$('#banner-message').fadeIn('slow');\n\t\t\t \$('#banner-message a.banner-message-close-notify').click(function() {\n\t\t\t \$('#banner-message').fadeOut('slow');\n\n\t\t\t\t var d = new Date();\n\t\t\t\t d.setTime(d.getTime() + (180*24*60*60*1000));\n\t\t\t\t var expires = 'expires='+d.toUTCString();\n\t\t\t\t document.cookie = 'closeBanner' + '=' + " . $model->id . " + '; ' + expires;\n\n\t\t\t return false;\n\t\t\t });\n\t\t\t});", CClientScript::POS_READY);
$this->render('bannerMessageWidget', array('model' => $model));
}
}
示例9: run
public function run()
{
//
// $model = Banner::model()->find(array(
// 'condition' => ' dateTo <= NOW() AND dateFrom >= NOW() ',
// 'order' => 'bannerId DESC'
// ));
$model = Banner::model()->find(array('condition' => " dateFrom >= '" . date('Y-m-d') . "' AND dateFrom <= '" . date('Y-m-d') . "'"));
if (!$model) {
$model = new $this->modelName();
}
if (!in_array('CModel', class_parents($model))) {
throw new CException('Not correct model class');
}
if (Yii::app()->request->isPostRequest && $_FILES['file']['name']) {
$t = $_FILES['file']['type'];
if ($t != 'image/png' && $t != 'image/jpg' && $t != 'image/jpeg' && $t != 'image/gif') {
echo CJSON::encode(array('status' => 'ok', 'msg' => "Error incorrect file format"));
Yii::app()->end();
}
$newFileName = Yii::getPathOfAlias('webroot') . '/public/' . time() . '_' . $_FILES['file']['name'];
$newFileUrl = '/public/' . time() . '_' . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $newFileName);
$s = getimagesize($newFileName);
echo CJSON::encode(array('status' => 'ok', 'name' => $newFileUrl, 'path' => $newFileName, 'size' => $s[0] . 'x' . $s[1]));
Yii::app()->end();
}
if (!empty($_REQUEST['Banner'])) {
$model->setAttributes($_REQUEST['Banner']);
$model->save();
}
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
}
$modelColumns = array_keys($model->tableSchema->columns);
//
// if ( $model->asa('AdminBehavior') ) {
// $columns = $model->getColumnSettingsForAdminPanel();
// } else {
// $columns = array($model->tableSchema->primaryKey, $modelColumns[1]);
// }
$columns = array('bannerId', 'dateFrom', 'dateTo');
// var_dump($this->params);
// exit();
$buttonColumn = array('template' => '{delete}', 'class' => 'CButtonColumn', 'deleteButtonUrl' => '"/admin/".$this->grid->owner->params["path"]."/delete/".$data->primaryKey');
if (Yii::app()->request->isPostRequest) {
echo $this->render('banner', array('model' => $model, 'columns' => $columns, 'buttonColumn' => $buttonColumn), true);
Yii::app()->end();
} else {
$this->render('banner', array('model' => $model, 'columns' => $columns, 'buttonColumn' => $buttonColumn));
}
}
示例10: run
public function run()
{
$criteria = new CDbCriteria();
$criteria->order = 't.sort ASC';
if ($this->view == 'animation') {
$criteria->with = array('images');
}
$models = Banner::model()->published()->cache($this->cacheTime)->findAll($criteria);
if (empty($models)) {
return;
}
$this->render($this->view, array('models' => $models));
}
示例11: actionView
public function actionView()
{
$previd = 0;
// 上一个品牌
$nextid = 0;
// 下一个品牌
$brand = null;
$prevname = '';
$nextname = '';
$products = null;
if (isset($_GET['id'])) {
$id = Yii::app()->request->getQuery('id');
// 浏览数量加1
$brandModel = Brand::model()->findByPk($id);
$brandModel->view_count += 1;
$brandModel->update();
$brand = Brand::model()->localized()->findByPk($id);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->compare('t.brand_id', $id);
$products = Product::model()->localized()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->compare('t.is_released', 1);
$criteria->order = 'sort_order ASC';
$brands = Brand::model()->localized()->findAll($criteria);
foreach ($brands as $key => $value) {
if ($value->brand_id == $id && $key != 0) {
$previd = isset($brands[$key - 1]) ? $brands[$key - 1]['brand_id'] : 0;
$nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
$prevname = isset($brands[$key - 1]) ? $brands[$key - 1]['title'] : '';
$nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
} else {
if ($value->brand_id == $id && $key == 0) {
$nextid = isset($brands[$key + 1]) ? $brands[$key + 1]['brand_id'] : 0;
$nextname = isset($brands[$key + 1]) ? $brands[$key + 1]['title'] : '';
}
}
}
}
if (empty($brand)) {
throw new CHttpException(404);
}
// 广告图
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 2);
$banner = Banner::model()->localized()->find($criteria);
$this->pageTitle = Yii::t('common', '品牌中心') . SEPARATOR . Setting::getValueByCode('inside_title', true);
$this->render('view', array('brand' => $brand, 'banner' => $banner, 'previd' => $previd, 'nextid' => $nextid, 'prevname' => $prevname, 'nextname' => $nextname, 'products' => $products));
}
示例12: actionIndex
/**
* 获取个人信息
*/
public function actionIndex()
{
if (!isset($_POST['uid']) || !$_POST['uid']) {
$this->_exit($this->_error['20007'], '20007');
}
if (!isset($_POST['page']) || !$_POST['page']) {
$this->_exit($this->_error['20019'], '20019');
}
if (!isset($_POST['mac']) || !$_POST['mac']) {
$this->_exit($this->_error['20028'], '20028');
}
$uid = trim($_POST['uid']);
$page = trim($_POST['page']);
$limit = 10;
$mac = trim($_POST['mac']);
$token = substr(md5($uid . $mac), 0, 16);
$r = User::model()->haveToken($uid);
if ($r['value'] != $token) {
$this->_exit($this->_error['20061'], '20061');
}
$res = UserInfo::model()->getUserCenter($uid, $page, $limit);
if ($res) {
if ($page == 1) {
$banner = Banner::model()->getBanners();
if (!empty($banner)) {
foreach ($banner as $k => $b) {
$banner[$k]['image'] = $b['image'] ? self::HOST_HTTP_BG_IMG . str_replace('\\', '/', $b['image']) : $b['image'];
}
$res['banner'] = $banner;
}
$res['Photo'] = $res['Photo'] ? self::HOST_HTTP_HEAD_IMG . str_replace('\\', '/', $res['Photo']) : $res['Photo'];
$res['bgimg'] = $res['bgimg'] ? self::HOST_HTTP_BG_IMG . str_replace('\\', '/', $res['bgimg']) : $res['bgimg'];
$res['Voice'] = $res['Voice'] ? self::HOST_HTTP_SOUND . str_replace('\\', '/', $res['Voice']) : $res['Voice'];
foreach ($res['trends'] as $key => $value) {
$res['trends'][$key]['image'] = $value['image'] ? self::HOST_HTTP_TRENDS . str_replace('\\', '/', $value['image']) : $value['image'];
}
} else {
foreach ($res as $key => $value) {
$res[$key]['image'] = $value['image'] ? self::HOST_HTTP_TRENDS . str_replace('\\', '/', $value['image']) : $value['image'];
}
}
$this->_exit($this->_error['20000'], '20000', $res, 'row');
}
$this->_exit($this->_error['21000'], '21000');
}
示例13: actionIndex
public function actionIndex()
{
$this->pageTitle = 'Мобильный мир - главная страница';
$this->menu = Category::model()->findAll();
$banner = Banner::model()->findAll();
$news = News::model()->findAll();
$topSales = Models::model()->findAll('top = 1');
if (Yii::app()->request->isAjaxRequest) {
Yii::app()->shoppingCart->put(Models::model()->findByPk($_POST['id']));
$data[0] = Yii::app()->shoppingCart->getCost();
$data[1] = Yii::app()->shoppingCart->getCount();
echo json_encode($data);
// Завершаем приложение
Yii::app()->end();
}
$novelty = Models::model()->findAll('novelty = 1');
$random = Models::randomId();
$this->render('index', array('banner' => $banner, 'news' => $news, 'topSales' => $topSales, 'novelty' => $novelty, 'random' => $random));
}
示例14: actionView
public function actionView()
{
// 当前新闻
if (isset($_GET['id'])) {
$id = Yii::app()->request->getQuery('id');
$server = Server::model()->localized()->findByPk($id);
} else {
$server = null;
}
if (empty($server)) {
throw new CHttpException(404);
}
$criteria = new CDbCriteria();
$criteria->compare('t.banner_position_id', 3);
$banner = Banner::model()->localized()->find($criteria);
$this->layout = 'main';
$this->pageTitle = $server->name . "-" . Yii::t('common', '服务中心');
$this->render('view', array('server' => $server, 'banner' => $banner));
}
示例15: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$lesson = $this->loadModel($id);
if ($lesson->is_active == 0) {
if ($lesson->owner_by != Yii::app()->user->getId() && !Yii::app()->user->checkAccess('adminLesson')) {
throw new CHttpException(403, Yii::t('yii', 'You are not authorized to perform this action.'));
}
}
$criteria = new CDbCriteria();
$criteria->addCondition(array('id_lesson' => $lesson->getPrimaryKey()));
$count = Question::model()->count($criteria);
$questionPages = new CPagination($count);
// results per page
$questionPages->pageSize = Yii::app()->params['nQuestionsInLessonPage'];
$questionPages->applyLimit($criteria);
$questions = Question::model()->findAll($criteria);
$banners = Banner::model()->findAll('is_active = 1');
$this->render('view', array('model' => $lesson, 'questions' => $questions, 'questionPages' => $questionPages, 'banners' => $banners));
}