function jkbanners_display_banners($atts) { $a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts); $output = array(); // $banners = array(); $banners = Banner::getAll(); if ($a['filter_menu_order']) { foreach ($banners as $bk => $banner) { if ($banner->post->menu_order != $a['filter_menu_order']) { unset($banners[$bk]); } } } // $bannerTemplate = new Template(); //One random banner if ($a['template'] == 'random-single') { //get a random item $banner = $banners[array_rand($banners)]; //show single banner $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner)); $output[] = $bannerTemplateResponse; } //List all banners if ($a['template'] == 'list') { $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners)); $output[] = $bannerTemplateResponse; } // $output = implode("\n", $output); return $output; }
/** * 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)); }
public function loadModel($id) { if (($model = Banner::model()->findByPk($id)) === null) { throw new CHttpException(404, 'Страница не найдена'); } return $model; }
/** * */ public function prueba() { $banner = new Banner('55c10856a8269769ac822f9a'); $banner->getData(); $vista = $banner->getView(); return view($vista, ['data' => $banner->getData()]); }
public function actionManage($is_big) { $model = new Banner('search'); $model->unsetAttributes(); if (isset($_GET['Banner'])) { $model->attributes = $_GET['Banner']; } $this->render('manage', array('model' => $model, 'is_big' => $is_big)); }
public function alterar(Banner $banner) { $banner->setUltimaModificacao(); $idAntigo = $banner->id; $this->bannerRepository->update($banner); $this->uploadBanner($idAntigo); return "Banner alterado com sucesso!"; // return $this->bannerRepository->findById($idAntigo); }
function delete($id) { $banners = new Banner($id); if (!$banners->exists()) { show_404(); } if ($banners->delete()) { flash_message('success', 'Thành công. Thao tác đã được thực hiện.'); redirect($_SERVER['HTTP_REFERER']); } }
/** * Administration view for banner */ function click_action($id) { $banner = Banner::find($id); $banner->clicks += 1; $banner->store(); $this->redirect($banner->getLink()); }
public function Edit() { $input = Input::all(); $banner_id = $input['id']; $banner = Banner::find($banner_id); return View::make('admin.banner.add')->with('banner', $banner); }
public function run() { Banner::truncate(); Website::truncate(); $user = User::create(array("username" => "danheyman", "name" => "Daniel Heyman", "email" => "*****@*****.**", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now())); for ($x = 0; $x < 20; $x++) { $website = new Website(); $website->url = "http://listviral.com"; $website->enabled = true; $website->credits = 10000; $website->views = 0; $website->days = array(); $website->hours = array(); $user->websites()->save($website); $banner = new Banner(); $banner->banner = "http://brisksurf.com/banner.png"; $banner->url = "http://brisksurf.com"; $banner->enabled = true; $banner->credits = 10000; $banner->views = 0; $banner->days = array(); $banner->hours = array(); $user->banners()->save($banner); } }
function AdminBanner($row) { Module::Module($row); if (User::is_admin()) { switch (Url::get('cmd')) { case 'remove_banner': $id = Url::get('id', 0); if (empty($id)) { Url::redirect_url('admin_banner.html'); exit; } Banner::delete_banner($id); Url::redirect_url('admin_banner.html'); break; case 'edit_banner': require_once 'forms/EditBanner.php'; $this->add_form(new EditBannerForm()); break; case 'list_banner': require_once 'forms/ListBanner.php'; $this->add_form(new ListBannerForm()); break; default: require_once 'forms/ListBanner.php'; $this->add_form(new ListBannerForm()); break; } } else { Url::access_denied(); } }
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)); }
public function directorio($directorioCategoria) { $rolusuarioLogueado = ''; $mailusuarioLogueado = ''; $nombreusuarioLogueado = ''; if (Auth::check()) { $authuser = Auth::user(); $usu = Usuario::find($authuser->id); $mailusuarioLogueado = $authuser->email; $nombreusuarioLogueado = $authuser->nombre; $rolusuarioLogueado = DB::table('usuario_tiene_rol2')->where('usuario_id', '=', $authuser->id)->first(); $rolusuarioLogueado = UsuarioRol::find($rolusuarioLogueado->rol_id)->rol; } $anuncios = Anuncio::all(); $bannersizquierda = DB::table('banners')->whereRaw("seccion='DIRECTORIO-IZQUIERDA' and habilitar=1")->orderBy('id', 'asc')->get(); $bannersderecha = DB::table('banners')->whereRaw("seccion='DIRECTORIO-DERECHA' and habilitar=1")->orderBy('id', 'asc')->get(); $bannersindexarriba = Banner::where('seccion', '=', 'INDEX-ARRIBA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get(); $categorias = DB::table('proveedor_tipo')->get(); $listaProveedores = DB::select('select * from proveedor_tipo,proveedores,proveedor_detalle where proveedor_tipo.id=proveedores.proveedor_tipo_idproveedor_tipo and proveedores.id=proveedor_detalle.proveedores_idproveedor'); if ($directorioCategoria == 'all') { $listaCategoria = DB::select("select * from proveedor_tipo,proveedores,proveedor_detalle where proveedor_tipo.id=proveedores.proveedor_tipo_idproveedor_tipo and proveedores.id=proveedor_detalle.proveedores_idproveedor"); } else { $listaCategoria = DB::select("select * from proveedor_tipo,proveedores,proveedor_detalle where proveedor_tipo.id=proveedores.proveedor_tipo_idproveedor_tipo and proveedores.id=proveedor_detalle.proveedores_idproveedor and proveedor_tipo.tipo='{$directorioCategoria}'"); } //$proveedores = DB::table('proveedores')->where('nombre_usuario', '=', "$nombre_usuario")->first(); //$proveedores_detalle = Proveedor_detalle::where('proveedores_idproveedor', '=', $proveedores->id)->first(); //$galeria = DB::table('proveedor_galeria')->where('proveedores_idproveedor', '=', $proveedores->id)->get(); //return View::make('index.index')->with(array('proveedores'=>$proveedores,'proveedores_detalle'=>$proveedores_detalle,'galeria'=>$galeria)); return View::make('index.directorio')->with(array('bannersizquierda' => $bannersizquierda, 'bannersderecha' => $bannersderecha, 'categorias' => $categorias, 'listaProveedores' => $listaProveedores, 'directorioCategoria' => $directorioCategoria, 'listaCategoria' => $listaCategoria, 'username' => $mailusuarioLogueado, 'nameuser' => $nombreusuarioLogueado, 'roluser' => $rolusuarioLogueado, 'anuncios' => $anuncios, 'bannersindexarriba' => $bannersindexarriba)); // }
public function directorio($directorioCategoria) { $anuncios = Anuncio::all(); $categoriasClasif = ClasificadoCategoria::all(); if ($directorioCategoria == 'all') { $listaClasificadosPremium = Clasificado::where('premium', '=', 1)->where('habilitar', '=', 1)->orderBy('fecha_publicacion', 'DESC')->get(); $listaClasificadosNormales = Clasificado::where('premium', '=', 0)->where('habilitar', '=', 1)->orderBy('fecha_publicacion', 'DESC')->get(); } else { $categoria = ClasificadoCategoria::find($directorioCategoria); //$clasificados = $categoria->clasificados; $listaClasificadosPremium = Clasificado::where('categoria_id', '=', $directorioCategoria)->where('premium', '=', 1)->where('habilitar', '=', 1)->orderBy('fecha_publicacion', 'DESC')->get(); $listaClasificadosNormales = Clasificado::where('categoria_id', '=', $directorioCategoria)->where('premium', '=', 0)->where('habilitar', '=', 1)->orderBy('fecha_publicacion', 'DESC')->get(); } $bannersizquierda = Banner::where('seccion', '=', 'CLASIFICADOS-IZQUIERDA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get(); $bannersderecha = Banner::where('seccion', '=', 'CLASIFICADOS-DERECHA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get(); $bannersindexarriba = Banner::where('seccion', '=', 'INDEX-ARRIBA')->where('habilitar', '=', 1)->orderBy('id', 'asc')->get(); $rolusuarioLogueado = ''; $mailusuarioLogueado = ''; $nombreusuarioLogueado = ''; if (Auth::check()) { $authuser = Auth::user(); $usu = Usuario::find($authuser->id); $mailusuarioLogueado = $authuser->email; $nombreusuarioLogueado = $authuser->nombre; $rolusuarioLogueado = DB::table('usuario_tiene_rol2')->where('usuario_id', '=', $authuser->id)->first(); $rolusuarioLogueado = UsuarioRol::find($rolusuarioLogueado->rol_id)->rol; } return View::make('index.directorioClasificados')->with(array('anuncios' => $anuncios, 'categoriasClasif' => $categoriasClasif, 'listaClasificadosPremium' => $listaClasificadosPremium, 'directorioCat' => $directorioCategoria == 'all' ? 'Todos los clasificados' : $categoria->categoria, 'listaClasificadosNormales' => $listaClasificadosNormales, 'bannersizquierda' => $bannersizquierda, 'bannersderecha' => $bannersderecha, 'bannersindexarriba' => $bannersindexarriba, 'username' => $mailusuarioLogueado, 'nameuser' => $nombreusuarioLogueado, 'roluser' => $rolusuarioLogueado)); // }
public function delete($id) { $banner = Banner::find($id); $banner->delete(); Session::flash('success', 'Banner deleted'); return Redirect::to('admin/banners'); }
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(); } }
/** * 录入 * */ public function actionCreate() { parent::_acl('banner_create'); $model = new Banner(); if (isset($_POST['Banner'])) { $file = XUpload::upload($_FILES['attach']); $model->attributes = $_POST['Banner']; if (is_array($file)) { $model->image = $file['pathname']; } if ($model->save()) { AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入banner,ID:' . $model->id)); $this->redirect(array('index')); } } $this->render('create', array('model' => $model)); }
public function banner($params = array()) { //获取最新banner图片列表 $images = Banner::model()->getBannerList(); //获取通卡信息列表 $cards = Yii::app()->params['cards']; return $this->notice('OK', 0, '成功', ['images' => $images, 'cards' => $cards]); }
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)); }
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); }
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)); } }
protected function getImageBanner(Banner $banner, $width = null, $height = null) { $clickUrl = $banner->getClickUrl(); $htmlOptions = array("class" => 'thumbnail'); if ($width != null) { $htmlOptions['width'] = $width; } if ($height != null) { $htmlOptions['height'] = $height; } $htmlOptions = array('width' => $width, 'height' => $height); $code = CHtml::image($banner->getShowUrl(), $banner->alt, $htmlOptions); $code .= CHtml::openTag("div", array("class" => 'caption')) . CHtml::tag("h5", array(), $banner->alt, true) . CHtml::closeTag("div"); if (($link = $banner->link) != null && $link != 'http://') { $link = "#"; } $code = CHtml::link($code, $clickUrl, array('title' => $banner->alt, 'class' => 'thumbnails')); return $code; }
public function index() { $title = Lang::get('admin/news/title.blog_management'); $news = $this->news; $news = $news->paginate(10); $big_news = \BigNews::first(); $big_news = is_null($big_news) ? $this->news->first() : $big_news->news; $banners = \Banner::where('view_in_news', true)->take(2)->get(); return View::make('news/index', compact('news', 'big_news', 'title', 'banners')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function imprimir($posicion) { $banner = DB::table('banners')->where('posicion', '=', $posicion)->orderBy('visitas', 'asc')->first(); $id = $banner->id; $banner = Banner::find($id); $banner->visitas++; $banner->save(); $url = '/publicidades/' . $banner->file; $devolver = array($url, $banner->link); return $devolver; }
/** * Adds the settings for the academy page */ public function settings() { $meta_box = new_cmb2_box(array('id' => 'yoastcom_page_academy_settings', 'title' => __('Page Academy Settings', 'yoastcom'), 'object_types' => array('page'), 'show_on' => array('key' => 'page-template', 'value' => 'page-template-academy.php'))); $this->add_blocks($meta_box, array('block' => __('Left', 'yoastcom'), 'name' => 'left')); $this->add_blocks($meta_box, array('block' => __('Middle', 'yoastcom'), 'name' => 'middle')); $this->add_blocks($meta_box, array('block' => __('Right', 'yoastcom'), 'name' => 'right')); $this->add_blocks($meta_box, array('block' => __('Bottom', 'yoastcom'), 'name' => 'bottom')); $meta_box->add_field(array('name' => __('Announcement Banner Text', 'yoastcom'), 'id' => 'announcement_text', 'type' => 'text')); $meta_box->add_field(array('name' => __('Announcement Banner Link', 'yoastcom'), 'id' => 'announcement_link', 'type' => 'text_url')); $meta_box->add_field(array('name' => __('Announcement Banner Image', 'yoastcom'), 'id' => 'announcement_image', 'type' => 'select', 'show_option_none' => true, 'options' => Banner::options())); }
public function index() { // latest / fresh $data['page'] = ''; $data['video'] = Featuredvideo::find(1); $data['banners'] = Banner::orderBy('id')->get(); $data['freshpost'] = Post::orderBy('created_at', 'desc')->take(5)->get(); $data['featuredpost'] = FeaturedPost::orderBy('id', 'desc')->take(10)->with('post')->get(); $data['trendingpost'] = Post::select('posts.*', DB::raw('count(votes.id) as total'))->leftJoin('votes', 'posts.id', '=', 'votes.post_id')->groupBy('posts.id')->orderBy('total', 'desc')->take(6)->get(); return View::make('main2')->with($data); }
public function testBanner() { $this->startCodeCoverage(); $banner = new Banner(); ob_start(); $result = $banner->SetText('banner'); $output = ob_get_contents(); ob_end_clean(); if ($result) { $this->fail('SetText() should return false when ProjectId is -1'); return 1; } if (strpos($output, 'Banner::SetText(): no ProjectId specified') === false) { $this->fail("'no ProjectId specified' not found from SetText()"); return 1; } //set a reasonable project id $banner->SetProjectId(1); //test insert $banner->SetText('banner'); //test update $banner->SetText('banner'); if ($banner->GetText() != 'banner') { $this->fail("GetText() should have returned 'banner'."); return 1; } $this->pass('Passed'); $this->stopCodeCoverage(); return 0; }
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)); } }
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)); }
function draw() { global $display; $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); $id = intval(trim(Url::get('id', 0))); if (!empty($id)) { $banner = Banner::get_banner($id); $display->add('banner', $banner); } $error_message = $this->getErrorMessage('admin/banner/error'); $display->add('error_message', $error_message); $display->output('EditBanner'); $this->endForm(); }