Beispiel #1
0
 /**
  * @return $this
  */
 protected function _prepareCollection()
 {
     $collection = $this->_bannerFactory->create()->getCollection();
     $this->setCollection($collection);
     parent::_prepareCollection();
     return $this;
 }
Beispiel #2
0
 public function init()
 {
     $this->view->headTitle(Standart_Main::translate('infoPagesHeadTitle'));
     $this->view->banner(Banners::getPositions(-2));
     $this->view->newsHeading = News::getHeading();
     $this->view->placeholder('rssLink')->set($this->view->feedLink());
 }
Beispiel #3
0
 public static function getInstance()
 {
     if (!self::$banners_instance) {
         self::$banners_instance = new Banners();
     }
     return self::$banners_instance;
 }
Beispiel #4
0
 /**
  * Returns the data model based on the primary key given in the GET variable
  * If the data model is not found, an HTTP exception will be raised
  * @param $id the ID of the model to be loaded
  *
  * @throws CHttpException
  * @return model
  * @internal param the $integer ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Banners::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #5
0
 public function savebanner()
 {
     $banner = Banners::find(Input::get('bannerid'));
     $banner->title = Input::get('title');
     $banner->url = Input::get('url');
     $banner->image_url = Input::get('image_url');
     $banner->save();
     return Redirect::to('backend/banners')->withMessage($this->notifyView(Lang::get('banners::messages.banner_saved'), 'success'));
 }
Beispiel #6
0
 /**
  * @param BannersBanner|XoopsObject $obj
  */
 public function __construct(BannersBanner &$obj)
 {
     $xoops = Xoops::getInstance();
     $helper = Banners::getInstance();
     if ($obj->isNew()) {
         $blank_img = 'blank.gif';
         $html_banner = 0;
     } else {
         if (substr_count($obj->getVar('banner_imageurl'), $xoops_upload_url . '/banners/') == 0) {
             $blank_img = 'blank.gif';
         } else {
             $namefile = substr_replace($obj->getVar('banner_imageurl'), '', 0, strlen($xoops_upload_url . '/banners/'));
             $pathfile = $xoops_root_path . '/uploads/banners/' . $namefile;
             if (is_file($pathfile)) {
                 $blank_img = str_replace($xoops_upload_url . '/banners/', '', $obj->getVar('banner_imageurl', 'e'));
             } else {
                 $blank_img = 'blank.gif';
             }
         }
         $html_banner = $obj->getVar('banner_htmlbanner');
     }
     $title = $obj->isNew() ? sprintf(_AM_BANNERS_BANNERS_ADD) : sprintf(_AM_BANNERS_BANNERS_EDIT);
     parent::__construct($title, 'form', 'banners.php', 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $client_Handler = $helper->getHandlerBannerclient();
     $client_select = new Xoops\Form\Select(_AM_BANNERS_CLIENTS_NAME, 'cid', $obj->getVar('banner_cid'));
     $client_select->addOptionArray($client_Handler->getList());
     $this->addElement($client_select, true);
     $imptotal = new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMPRESSIONSP, 'imptotal', 1, 255, $obj->getVar('banner_imptotal'));
     //$imptotal->setPattern('^[0-9]*[0-9]+$|^[0-9]+[0-9]*$', _AM_BANNERS_BANNERS_IMPRESSIONSP_PATTERN);
     $this->addElement($imptotal, true);
     $imgtray_img = new Xoops\Form\ElementTray(_AM_BANNERS_BANNERS_IMAGE, '<br /><br />');
     $imgtray_img->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMGURL, 'imageurl', 8, 255, $obj->getVar('banner_imageurl')));
     $imgpath_img = sprintf(_AM_BANNERS_BANNERS_IMAGE_PATH, $xoops_upload_path . '/banners/');
     $imageselect_img = new Xoops\Form\Select($imgpath_img, 'banners_imageurl', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray($xoops_upload_path . '/banners');
     $imageselect_img->addOption("{$blank_img}", $blank_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $imageselect_img->setExtra('onchange="showImgSelected(\'xo-banners-img\', \'banners_imageurl\', \'banners\', \'\', \'' . $xoops_upload_url . '\' )"');
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/banners/" . $blank_img . "' name='image_img' id='xo-banners-img' alt='' />"));
     $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new Xoops\Form\File(_AM_BANNERS_BANNERS_UPLOADS, 'banners_imageurl'), false);
     $fileseltray_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_img);
     $this->addElement($imgtray_img);
     $this->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_CLICKURL, 'clickurl', 5, 255, $obj->getVar('banner_clickurl')), false);
     $this->addElement(new Xoops\Form\RadioYesNo(_AM_BANNERS_BANNERS_USEHTML, 'htmlbanner', $html_banner));
     $this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_BANNERS_CODEHTML, 'htmlcode', $obj->getVar('banner_htmlcode'), 5, 5), false);
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('bid', $obj->getVar('banner_bid')));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #7
0
 static function cachedIn($ids = array())
 {
     //        $ids = implode(",",$ids);
     $banners = Cache::remember('banners_' . Config::get('cms.currlang.code'), 60, function () use($ids) {
         //            return Banners::whereRaw("id IN ({$ids})")->get();
         return Banners::find($ids);
     });
     return $banners;
 }
 /**
  * Удаляет баннер и возвращает на страницу баннеров с сообщением о результате
  */
 public function actionDelete($id)
 {
     self::checkAdmin();
     if (isset($id)) {
         $result = Banners::removeBanner($id);
         $res = isset($result) ? 'suc_banner_delete' : 'fail_banner_delete';
     } else {
         $res = 'fail_banner_delete';
     }
     header('Location:' . Config::ADDRESS . 'admin/banners/?res=' . $res);
 }
Beispiel #9
0
/**
* Get the html code for a random banner of the given zone
*/
function get_wpads($the_zone)
{
    global $doing_rss;
    if ($the_zone == "") {
        return;
    }
    // No ads in RSS feeds
    if ($doing_rss) {
        return;
    }
    // are we in wp-admin editing the post?
    if (strstr($_SERVER['PHP_SELF'], 'post.php')) {
        // **TODO**: show placeholders
        return;
    }
    $banners = new Banners();
    $donate = get_option('wpads_donate');
    $theBanner = $banners->getZoneBanner($the_zone, $donate);
    $banners->addView($theBanner->banner_id);
    return $theBanner->banner_html;
}
Beispiel #10
0
 /**
  *	Отображает страницу FAQ
  */
 public function actionIndex()
 {
     $listBanners = Banners::getBannersOnSite('rand');
     //если существует дневной бонус то пересчитываем его
     if (isset($_SESSION['dailyBonus'])) {
         Site::changeDailyBonus();
     }
     //получаем баланс и бонус
     $balance = isset($_SESSION['id']) ? Site::getBalance() : 0;
     $bonus = isset($_SESSION['id']) ? $_SESSION['bonus'] : 0;
     require_once ROOT . '/' . Config::VIEW . 'faq/index.php';
     return true;
 }
 /**
  * Delete page by Pk
  */
 public function actionDelete()
 {
     if (Yii::app()->request->isPostRequest) {
         $model = Banners::model()->findAllByPk($_REQUEST['id']);
         if (!empty($model)) {
             foreach ($model as $page) {
                 $page->delete();
             }
         }
         if (!Yii::app()->request->isAjaxRequest) {
             $this->redirect('index');
         }
     }
 }
Beispiel #12
0
 public function actionRemoveImage()
 {
     $response = array("status" => "fail");
     if (isset($_REQUEST['id']) && isset($_REQUEST['field']) && isset($_REQUEST['model'])) {
         $id = $_REQUEST['id'];
         $field = $_REQUEST['field'];
         $modelName = $_REQUEST['model'];
         switch ($modelName) {
             case 'news':
                 $model = News::model()->findByPk($id);
                 break;
             case 'articles':
                 $model = Articles::model()->findByPk($id);
                 break;
             case 'articles_categories':
                 $model = ArticlesCategories::model()->findByPk($id);
                 break;
             case 'clinics':
                 $model = Clinics::model()->findByPk($id);
                 break;
             case 'experts':
                 $model = Experts::model()->findByPk($id);
                 break;
             case 'book_pages':
                 $model = BookPages::model()->findByPk($id);
                 break;
             case 'comments':
                 $model = Comments::model()->findByPk($id);
                 break;
             case 'banners':
                 $model = Banners::model()->findByPk($id);
                 break;
             default:
                 $model = false;
                 break;
         }
         if (is_object($model) && isset($model->{$field})) {
             $imagePath = Yii::app()->basePath . "/.." . $model->{$field};
             if (is_file($imagePath)) {
                 unlink($imagePath);
                 $model->{$field} = '';
                 if ($model->save()) {
                     $response = array("status" => "success");
                 }
             }
         }
     }
     echo json_encode($response);
 }
Beispiel #13
0
 function banner_filter($vars)
 {
     $banners = new Banners();
     //set defaults
     $collection = false;
     $quantity = 5;
     $template = 'default';
     if (isset($vars[0])) {
         //collection ID
         $collection = $vars[0];
     } else {
         return false;
         // there is nothing to display
     }
     //set quantity
     if (isset($vars[1])) {
         $quantity = $vars[1];
     }
     //set tempalte
     if (isset($vars[2])) {
         $template = $vars[2];
     }
     return $banners->show_collection($collection, $quantity, $template);
 }
Beispiel #14
0
 /**
  * Отоюражает и обрабатывает страницу Contact
  */
 public function actionIndex()
 {
     $listBanners = Banners::getBannersOnSite('rand');
     $msg = false;
     //если существует дневной бонус то пересчитываем его
     if (isset($_SESSION['dailyBonus'])) {
         Site::changeDailyBonus();
     }
     //получаем баланс и бонус
     $balance = isset($_SESSION['id']) ? Site::getBalance() : 0;
     $bonus = isset($_SESSION['id']) ? $_SESSION['bonus'] : 0;
     //если пришла форма, то обрабатываем ее и отправляем письмо
     if (isset($_POST['email'])) {
         $msg = Contact::sendMail($_POST);
     }
     require_once ROOT . '/' . Config::VIEW . 'contact/index.php';
     return true;
 }
 protected function renderContent()
 {
     $module = strtolower(Yii::app()->controller->module->id);
     $controller = strtolower(Yii::app()->controller->id);
     $action = strtolower(Yii::app()->controller->action->id);
     $currentAction = strtolower(Yii::app()->controller->id . '/' . Yii::app()->controller->action->id);
     //import model
     Yii::import('application.modules.banner.models.Banners');
     Yii::import('application.modules.banner.models.BannerCategory');
     $criteria = new CDbCriteria();
     $criteria->condition = 'publish = :publish AND (expired_date >= curdate() OR published_date >= curdate())';
     $criteria->params = array(':publish' => 1);
     $criteria->order = 'published_date DESC';
     if ($this->category != null) {
         $criteria->compare('cat_id', $this->category);
     }
     $model = Banners::model()->findAll($criteria);
     $this->render('front_banner_recent', array('model' => $model, 'category' => $category));
 }
Beispiel #16
0
 public function actionIndex()
 {
     //проверяем залогинин игрок или нет, если нет то переход на главную
     if (!isset($_SESSION['id'])) {
         header('Location: ' . Config::ADDRESS);
     }
     //если существует дневной бонус то пересчитываем его
     if (isset($_SESSION['dailyBonus'])) {
         Site::changeDailyBonus();
     }
     //получаем баланс и бонус
     $balance = isset($_SESSION['id']) ? Site::getBalance() : 0;
     $bonus = isset($_SESSION['id']) ? $_SESSION['bonus'] : 0;
     //получаем данные последнего платежа для страницы акаунта из базы, а не из сессии, т.к. если админ произведет изменения, они не будут отображены в текущей сессии
     $lastPay = Account::getLastPay();
     //получаем баннеры
     $listBanners = Banners::getBannersOnSite('rand');
     require_once ROOT . '/' . Config::VIEW . 'account/index.php';
     return true;
 }
Beispiel #17
0
 /**
  * Отображает главную страницу сайта
  */
 public function actionIndex()
 {
     $listBanners = Banners::getBannersOnSite('rand');
     //если существует дневной бонус то пересчитываем его
     if (isset($_SESSION['dailyBonus'])) {
         Site::changeDailyBonus();
     }
     //получаем баланс и бонус
     $balance = isset($_SESSION['id']) ? Site::getBalance() : 0;
     $bonus = isset($_SESSION['id']) ? $_SESSION['bonus'] : 0;
     //проверяем истекло ли время до следующей игры и создаем новую игру
     if (isset($_SESSION['pauseGame']) && empty($_SESSION['numChance']) && !empty(Validate::checkPauseGame($_SESSION['pauseGame']))) {
         $dataGame = Games::loadGame();
         User::sessionUser($dataGame);
     }
     //задаем данные для боксов
     $dataBox = isset($_SESSION['dataBox']) ? $_SESSION['dataBox'] : Games::getDataBox('bag-opened', 'bag');
     require_once ROOT . '/' . Config::VIEW . 'site/index.php';
     return true;
 }
Beispiel #18
0
 public function run()
 {
     $this->htmlOptions['style'] = 'width: ' . $this->width . 'px; height: ' . $this->height . 'px;';
     $banner = Banners::model()->findByPK($this->banner_id);
     $images = $banner->images;
     $this->htmlOptions['id'] = "slider_banner_" . $banner->id;
     if ($images) {
         foreach ($images as $image) {
             $this->images[] = array('src' => $image->getUrl($this->width . "x" . $this->height, 'cropFromCenter'), 'caption' => $image->title, 'url' => $image->link);
         }
     }
     $this->render('index');
     if (!count($this->config)) {
         $config = array('effect' => 'random', 'slices' => 25, 'animSpeed' => 500, 'pauseTime' => 6000, 'startSlide' => 0, 'directionNav' => true, 'directionNavHide' => true, 'controlNav' => true, 'keyboardNav' => true, 'pauseOnHover' => true, 'manualAdvance' => false, 'captionOpacity' => 0.5);
     } else {
         $config = $this->config;
     }
     $config = CJavaScript::encode($config);
     Yii::app()->getClientScript()->registerScript(__CLASS__, "\n\t\t\t\$('#" . $this->htmlOptions['id'] . "').nivoSlider({$config});\n\t\t");
 }
Beispiel #19
0
 protected function renderContent()
 {
     $module = strtolower(Yii::app()->controller->module->id);
     $controller = strtolower(Yii::app()->controller->id);
     $action = strtolower(Yii::app()->controller->action->id);
     $currentAction = strtolower(Yii::app()->controller->id . '/' . Yii::app()->controller->action->id);
     $currentModule = strtolower(Yii::app()->controller->module->id . '/' . Yii::app()->controller->id);
     $currentModuleAction = strtolower(Yii::app()->controller->module->id . '/' . Yii::app()->controller->id . '/' . Yii::app()->controller->action->id);
     //import model
     Yii::import('application.modules.banner.models.Banners');
     Yii::import('application.modules.banner.models.BannerCategory');
     $criteria = new CDbCriteria();
     $criteria->condition = 'publish = :publish AND ((expired_date >= curdate() OR published_date >= curdate()) OR ((expired_date = :date OR expired_date = :datestr) OR published_date >= curdate()))';
     $criteria->params = array(':publish' => 1, ':date' => '0000-00-00', ':datestr' => '1970-01-01');
     $criteria->order = 'expired_date ASC';
     if ($this->category != null) {
         $criteria->compare('cat_id', $this->category);
     }
     $model = Banners::model()->find($criteria);
     $this->render('banner_main', array('module' => $module, 'controller' => $controller, 'action' => $action, 'currentAction' => $currentAction, 'currentModule' => $currentModule, 'currentModuleAction' => $currentModuleAction, 'model' => $model, 'category' => $category));
 }
Beispiel #20
0
 public function actionIndex()
 {
     //если существует дневной бонус то пересчитываем его
     if (isset($_SESSION['dailyBonus'])) {
         Site::changeDailyBonus();
     }
     //проверяем если нет бонусов и временных денег, то перенаправим на главную
     if (empty($_SESSION['bonus']) && empty($_SESSION['amountBonus'])) {
         header('Location: ' . Config::ADDRESS);
     }
     //проверяем если бонусов нет, но есть временные деньги у игрока, то перенаправляем на экшен Claim для автоматического перевода денег в баланс
     if (empty($_SESSION['bonus']) && !empty($_SESSION['amountBonus'])) {
         header('Location: ' . Config::ADDRESS . 'bonus/claim');
     }
     //получаем баланс и бонус
     $balance = isset($_SESSION['id']) ? Site::getBalance() : 0;
     $bonus = isset($_SESSION['id']) ? $_SESSION['bonus'] : 0;
     //устанавливаем временный выйгрыш в бонусной игре
     $amountBonus = isset($_SESSION['amountBonus']) ? $_SESSION['amountBonus'] : 0;
     //формируем массивы баннеров
     $listBanners = Banners::getBannersOnSite('rand');
     //получаем рекламу
     $reclameList = Reclama::getReclamaOnSite('rand');
     //формируем текст сообщения для окна баннеров
     //$text = time() < $_SESSION['pauseBonus'] ? "Please wait..." : 'Click on a banner and benefit from '.Config::AMOUNT_BONUS_1.' to '.Config::AMOUNT_BONUS_2.' '.Config::COIN;
     $text = time() < $_SESSION['pauseBonus'] ? "Please wait..." : '';
     //формируем первое видео и список последующих видео
     $videoList = Video::getVideoOnSite('rand');
     if (!empty($videoList)) {
         $video = $videoList[0];
         unset($videoList[0]);
         $playList = implode(',', $videoList);
     }
     //устанавливаем время до следующей игры
     $timeNextGame = time() < $_SESSION['pauseBonus'] ? $_SESSION['pauseBonus'] - time() : Config::PAUSE_BONUS;
     //если установлено время до следующей игры, то запускаем таймер
     $start = time() < $_SESSION['pauseBonus'] ? '.start()' : '';
     require_once ROOT . '/' . Config::VIEW . 'bonus/index.php';
     return true;
 }
Beispiel #21
0
    /**
     * Draw top banners code
     * 		@param $banner_image
     * 		@param $show_always
     * 		@param $draw
     */
    public static function DrawBannersTop(&$banner_image, $show_always = true, $draw = true)
    {
        global $objLogin;
        $default_banner_image = '';
        $nl = "\n";
        if (Modules::IsModuleInstalled('banners')) {
            $is_banners_active = ModulesSettings::Get('banners', 'is_active');
            $rotate_delay = ModulesSettings::Get('banners', 'rotate_delay');
            $rotation_type = ModulesSettings::Get('banners', 'rotation_type');
            $caption_html = ModulesSettings::Get('banners', 'slideshow_caption_html');
            if ($is_banners_active == 'yes') {
                $objBanners = new Banners();
                if ($rotation_type == 'slide show') {
                    $arrBanners = $objBanners->GetBannersArray();
                    if ($show_always || !$show_always && Application::Get('page') == 'home' && !$objLogin->IsLoggedIn()) {
                        $output = '<script src="' . APPHP_BASE . 'modules/cslide/jquery.cross-slide.min.js" type="text/javascript"></script>' . $nl;
                        $output .= '<script type="text/javascript">' . $nl;
                        $output .= 'jQuery(function() {
							jQuery(\'#slideshow\').crossSlide({
							  sleep: ' . $rotate_delay . ', fade: 2,variant: true
							}, [						
						';
                        $ind = '0';
                        foreach ($arrBanners as $key => $val) {
                            if ($ind == '0') {
                                $default_banner_image = 'images/banners/' . $val['image_file'];
                            } else {
                                $output .= ',';
                            }
                            $output .= '{ src: \'images/banners/' . $val['image_file'] . '\', alt: \'' . encode_text($val['image_text']) . ($val['link_url'] != '' ? '##' . $val['link_url'] : '') . '\', to:\'up\' }';
                            $ind++;
                        }
                        $output .= '], function(idx, img, idxOut, imgOut) {
							var img_alt_split = img.alt.split(\'##\');
							var caption_width = jQuery(\'div#slideshow\').width() - 20;						
							if(idxOut == undefined){							
							  /* starting single image phase, put up caption */
							  if(img.alt != \'\'){
								jQuery(\'div.slideshow-caption\').click(function(){ if(img_alt_split[1] != undefined && img_alt_split[1] != \'\') appGoToPage(img_alt_split[1]); });
								jQuery(\'div.slideshow-caption\').' . ($caption_html == 'yes' ? 'html' : 'text') . '(img_alt_split[0]).animate({ opacity: .7 })
								jQuery(\'div.slideshow-caption\').fadeIn();
								if(caption_width != null) jQuery(\'div.slideshow-caption\').width(caption_width);
							  }
							}else{
							  // starting cross-fade phase, take out caption
							  jQuery(\'div.slideshow-caption\').click(function() { });
							  jQuery(\'div.slideshow-caption\').fadeOut();
							}}) });';
                        $output .= '</script>' . $nl;
                        if ($ind == 1) {
                            $banner_image = '<div class="banners-box-random" id="slideshow">' . $objBanners->GetRandomBanner() . '</div>';
                        } else {
                            if ($draw) {
                                echo $output;
                            } else {
                                return $output;
                            }
                            $banner_image = '<div class="banners-box-slideshow" id="slideshow"></div><div class="slideshow-caption"></div>';
                        }
                    }
                } else {
                    if ($show_always || !$show_always && Application::Get('page') == 'home' && !$objLogin->IsLoggedIn()) {
                        $banner_image = '<div class="banners-box-random" id="slideshow">' . $objBanners->GetRandomBanner() . '</div>';
                    }
                }
            }
        }
    }
Beispiel #22
0
 //            }
 //        }
 //        else{
 //             if ($this->banner_type == TOP || $this->banner_type == BOTTOM) {
 //                $ImageProcessing->file = $this->large_image;
 //                $ImageProcessing->thumbs = self::$aSizeBannerTop;    //resize Of banner
 //                $ImageProcessing->create_thumbs();
 //             }
 //             else{
 //                 $ImageProcessing->file = $this->large_image;
 //                $ImageProcessing->thumbs = self::$aSizeBannerMiddle;    //resize Of banner
 //                $ImageProcessing->create_thumbs();
 //             }
Beispiel #23
0
 public function actionDelete($id)
 {
     $model = Banners::model()->findByPk($id)->delete();
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect('/admin/banners/');
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Banners::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Phrase::trans(193, 0));
     }
     return $model;
 }
Beispiel #25
0
 public function getModulo()
 {
     dd(Banners::getImage('publicaciones'));
 }
Beispiel #26
0
*/
use Xoops\Core\Request;
/**
 * banners module
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         banners
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id: $
 */
include __DIR__ . '/header.php';
// Get main instance
$xoops = Xoops::getInstance();
$helper = Banners::getInstance();
$xoops_upload_path = \XoopsBaseConfig::get('uploads-path');
$xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
$xoops_url = \XoopsBaseConfig::get('url');
// Parameters
$nb_banners = $helper->getConfig('banners_pager');
$mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'application/x-shockwave-flash');
$upload_size = 500000;
// Get Action type
$op = Request::getCmd('op', 'list');
// Get handler
$banner_Handler = $helper->getHandlerBanner();
$client_Handler = $helper->getHandlerBannerclient();
// Call header
$xoops->header('admin:banners/banners_admin_banners.tpl');
// Get start pager
Beispiel #27
0
<?php

/** Display pages list **/
$this->pageHeader = Yii::t('BannersModule.core', 'Баннеры');
$this->breadcrumbs = array('Home' => $this->createUrl('/admin'), Yii::t('BannersModule.core', 'Баннеры'));
$this->topButtons = $this->widget('application.modules.admin.widgets.SAdminTopButtons', array('template' => array('create'), 'elements' => array('create' => array('link' => $this->createUrl('create'), 'title' => Yii::t('BannersModule.core', 'Создать Баннер'), 'options' => array('icons' => array('primary' => 'ui-icon-plus'))))));
$this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'id' => 'pagesListGrid', 'filter' => $model, 'columns' => array(array('class' => 'CCheckBoxColumn'), array('class' => 'SGridIdColumn', 'name' => 'id'), array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), array("update", "id"=>$data->id))'), array('name' => 'status', 'value' => 'CHtml::encode($data->statusLabel)', 'filter' => Banners::statuses()), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
Beispiel #28
0
<?php

/* @var $banner Banner */
if ($banner) {
    ?>
	<?php 
    Yii::app()->clientScript->registerScript('top-banner', "\r\t\t\$('#bn-list').bxSlider({\r\t\t\tmode: 'fade',\r\t\t\tauto: true,\r\t\t\tpager: false,\r\t\t\tcontrols: false,\r\t\t\tpause: 3000,\r\t\t\tpreloadImages: 'visible'\r\t\t});\r\t");
    $Allbanner = Banners::getAdsBannerByType(TOP);
    $allImg = '';
    if (count($Allbanner) > 0 && is_array($Allbanner)) {
        foreach ($Allbanner as $key => $banner) {
            $i = $key + 1;
            $img = InputHelper::holderImage($banner->getImageUrl2(728, 90), 728, 90);
            $allImg .= sprintf('<a href="%s" target="_blank">%s</a>', $banner->link, $img);
        }
    }
    ?>
    <div class="bn-advers">	
		<div id="bn-list"><?php 
    echo $allImg;
    ?>
</div>         
    </div>
 <?php 
}
 public function saveBannerInfo()
 {
     $id = Input::get('id');
     $title = Input::get('title');
     $content = Input::get('content');
     $images = Input::file('images');
     if (empty($id)) {
         if (empty($images)) {
             return Redirect::Route('getBanners')->with('fail', 'Please choose a picture to upload.');
         } else {
             $iname = str_random(112) . '.' . $images->getClientOriginalExtension();
             $move = Image::make($images->getRealPath())->resize('750', '750')->save('images/' . $iname);
             if ($move) {
                 $getInformation = new Banners();
                 $getInformation['title'] = $title;
                 $getInformation['content'] = $content;
                 $getInformation['img'] = $iname;
                 if ($getInformation->save()) {
                     return Redirect::Route('getBanners')->with('success', 'Information successfully added.');
                 }
             } else {
                 return Redirect::Route('getBanners')->with('fail', 'Error Uploading! Please try again.');
             }
         }
     } else {
         if (empty($images)) {
             $getInformation = Banners::find($id);
             $getInformation['title'] = $title;
             $getInformation['content'] = $content;
             if ($getInformation->save()) {
                 return Redirect::Route('getBanners')->with('success', 'Information successfully added.');
             }
         } else {
             $iname = str_random(112) . '.' . $images->getClientOriginalExtension();
             $move = Image::make($images->getRealPath())->resize('750', '750')->save('images/' . $iname);
             if ($move) {
                 $getInformation = Banners::find($id);
                 $getInformation['title'] = $title;
                 $getInformation['content'] = $content;
                 $getInformation['img'] = $iname;
                 if ($getInformation->save()) {
                     return Redirect::Route('getBanners')->with('success', 'Information successfully added.');
                 }
             } else {
                 return Redirect::Route('getBanners')->with('fail', 'Error Uploading! Please try again.');
             }
         }
     }
 }
Beispiel #30
0
 public function actionToggleActivity()
 {
     if (isset($_REQUEST['pk'])) {
         $model = Banners::model()->findByPk($_REQUEST['pk']);
         if (is_object($model)) {
             $model->is_active = $model->is_active ? 0 : 1;
             if ($model->save()) {
                 return true;
             }
         }
     }
     return false;
 }