Author: Alex
Inheritance: extends MY_Controller
 public function run()
 {
     $s = new Slider();
     $s->slider_id = 0;
     $s->active = 1;
     $s->save();
 }
Example #2
5
 public function run()
 {
     if (!$this->images) {
         $slider = new Slider();
         $this->images = $slider->getActiveImages();
     }
     $this->render('widgetSlider_list', array('images' => $this->images, 'imgCount' => $this->imgCount));
 }
 public function storeSlider()
 {
     $slide = new Slider();
     $input = ["nom" => Input::get('nom'), "alt" => Input::get('alt')];
     $rules = array('nom' => 'required|max:255', 'alt' => 'required|max:255');
     $messages = array('required' => ":attribute est requis pour l'ajout d'une nouvelle image au carousel.", 'max' => ':attribute est trop long.');
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return Redirect::to(URL::previous())->withErrors($validator);
     } else {
         $uploadedImage = Input::file('image');
         // Création d'un nom aléatoire pour l'enregistrement
         $fileName = md5(time() + rand(0, 1000)) . '.jpg';
         $savePath = public_path() . '/uploads/slider/';
         $extension = strtolower($uploadedImage->getClientOriginalExtension());
         if ($extension == "jpg" || $extension == "jpeg" || $extension == "png") {
             // Si on a choisi de rendimensionner
             if (Input::get('resample') != null) {
                 // Récupération de la taille de l'image envoyée
                 list($uploadedWidth, $uploadedHeight) = getimagesize($uploadedImage);
                 // Nouvelles dimensions
                 $newWidth = 1165;
                 $newHeight = 350;
                 // Création d'une nouvelle image vide et sample de l'image envoyée
                 $newImage = imagecreatetruecolor($newWidth, $newHeight);
                 if ($extension == "jpg" || $extension == "jpeg") {
                     $uploadedImageSample = imagecreatefromjpeg($uploadedImage);
                 } else {
                     $uploadedImageSample = imagecreatefrompng($uploadedImage);
                 }
                 // Rendimensionnement et enregistrement de la nouvelle image
                 imagecopyresampled($newImage, $uploadedImageSample, 0, 0, 0, 0, $newWidth, $newHeight, $uploadedWidth, $uploadedHeight);
                 imagejpeg($newImage, $savePath . $fileName, 100);
             } else {
                 $uploadedImage->move($savePath, $fileName);
             }
             // Lien en BDD et position (max+1)
             $input['link'] = $fileName;
             $input['pos'] = Slider::get()->max('pos') + 1;
             Session::flash('flash_msg', "La nouvelle image a bien été ajoutée.");
             Session::flash('flash_type', "success");
             $slide->fill($input)->save();
             return Redirect::to("/admin/slider");
         } else {
             Session::flash('flash_msg', "Le fichier importé n'est pas valide (jpeg ou png uniquement).");
             Session::flash('flash_type', "fail");
             return Redirect::to("/admin/slider");
         }
     }
 }
Example #4
0
    /**
     * Renderize the view.
     *
     * @return null
     */
    public function render(Slider $slider)
    {
        ?>
  

    <p> 
        <?php 
        echo REQUIRED_FIELDS_TEXT;
        ?>
    </p>

	<form action="<?php 
        echo $this->generateURL('slider', 'edit', $slider->getIdSlider());
        ?>
" method="post">
    	
        <fieldset>
        
            <div class="row">

                <div class="col-md-6">  
                
                	<div>
                        <label for="title">
                            T&iacute;tulo <small>(*)</small>
                        </label>
                        <input name="title" type="text" required value="<?php 
        echo $slider->getTitle();
        ?>
" /> 
                    </div>

                </div>
               
                <div class="col-md-6">	

                    <div>
                        <input type="submit" value="Modificar" />
                    </div>
                
                </div>
            
            </div>
            
    	</fieldset>
        
    </form>

<?php 
    }
 public function change()
 {
     $slider = Slider::find(1);
     $slider->active = Input::get('slider');
     $slider->save();
     return Redirect::route('cms')->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Settings successfully changed</p>');
 }
 public function actionIndex()
 {
     $ModelSeo = new CmsvideoSettings();
     $DataSeo = $ModelSeo->DownloadSettings();
     $ModelCategories = CmsvideoCategories::model()->findAll();
     $ModelSlider = Slider::model()->findAll(array('order' => 'slider_id DESC'));
     $VideoLatest = CmsvideoVideo::model()->findAll(array('select' => 'video_id, video_title, video_description, video_thumb, video_views, video_alias', 'order' => 'video_id DESC', 'limit' => '4'));
     $VideoPopular = CmsvideoVideo::model()->findAll(array('select' => 'video_id, video_title, video_description, video_thumb, video_views, video_alias', 'order' => 'video_views DESC', 'limit' => '4'));
     foreach ($DataSeo as $Seoo) {
         $this->pageMetaRobots = $Seoo['settings_robots'];
         $this->pageMetaKeywords = $Seoo['settings_keywords'];
         $this->pageMetaDescription = $Seoo['settings_description'];
         $this->pageMetaOgTitle = $Seoo['settings_ogtitle'];
         $this->pageTitle = $Seoo['settings_ogtitle'];
         $this->pageMetaOgImage = $Seoo['settings_ogimage'];
         $this->slider_duration = $Seoo['slider_duration'];
         $this->slider_arrow = $Seoo['slider_arrow'];
         $this->slider_dragorientation = $Seoo['slider_dragorientation'];
         $this->slider_slidespacing = $Seoo['slider_slidespacing'];
         $this->slider_mindragoffsettoslide = $Seoo['slider_mindragoffsettoslide'];
         $this->slider_loop = $Seoo['slider_loop'];
         $this->slider_hwa = $Seoo['slider_hwa'];
         $this->slider_arrowkeynavigation = $Seoo['slider_arrowkeynavigation'];
         $this->slider_lazyloading = $Seoo['slider_lazyloading'];
     }
     //$id = 'page';
     $this->render('index', array('ModelCategories' => $ModelCategories, 'VideoLatest' => $VideoLatest, 'VideoPopular' => $VideoPopular, 'DataSlider' => $ModelSlider, 'DataSeo' => $DataSeo));
 }
Example #7
0
 public function delete()
 {
     if ($this->show->itemID) {
         Slider::delete($this->show->itemID);
         redirect(BASE_PATH . self::PATH);
     }
     redirect(BASE_PATH . self::PATH);
 }
Example #8
0
 public function home()
 {
     $link_pages = OnlineOrder::orderBy('id', 'ASC')->get();
     $slider_pages = Slider::orderBy('position', 'ASC')->get();
     $menu_sliders = Menu::orderBy('id', 'ASC')->get();
     $menu_pdf = Menupdf::orderBy('id', 'ASC')->get();
     return View::make('pages.index', ['slider_pages' => $slider_pages, 'link_pages' => $link_pages, 'menu_sliders' => $menu_sliders, 'menu_pdf' => $menu_pdf]);
 }
Example #9
0
 public function run()
 {
     if ($this->slider_id === null) {
         return;
     }
     $this->_slider = Slider::model()->with('slides', 'slides.captions')->find(array('condition' => 't.id = :id', 'params' => array(':id' => $this->slider_id), 'order' => 'sliderSlides.slide_order ASC, slideCaptions.caption_order ASC'));
     $this->render('nymediaSlider', array('slider' => $this->_slider));
 }
Example #10
0
 public function loadModel($id)
 {
     $model = Slider::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "active='1'";
     $criteria->order = "sequence ASC";
     $models = Slider::model()->findAll($criteria);
     $this->render('slider', array('models' => $models));
 }
 public static function _get($attributes = '')
 {
     // Extract
     extract($attributes);
     if (!isset($name)) {
         $name = '';
     }
     return Slider::get($name);
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->layout = 'sitio';
     $categorias = Categoria::model()->findAll();
     $sliders = Slider::model()->findAll();
     $ofertas = ProductoOferta::model()->with('producto')->findAll();
     $this->render('index', array('categorias' => $categorias, 'sliders' => $sliders, 'ofertas' => $ofertas));
 }
Example #14
0
 public function returnImageFancy($data, $tableId, $ignore = 0, $width = 150, $height = 80)
 {
     if ($ignore && $data->id == $ignore) {
         return '';
     }
     $url = Yii::app()->request->baseUrl . "/" . Slider::model()->sliderPath . "/" . $data->img;
     $options = array('class' => 'fancy');
     $img = CHtml::image(Yii::app()->request->baseUrl . "/" . Slider::model()->sliderPath . "/" . $data->getThumb($width, $height));
     return '<div align="center">' . CHtml::link($img, $url, $options) . '</div>';
 }
Example #15
0
 public function showWelcome()
 {
     $slides = Slider::where('status', 1)->get();
     $news = Post::where('type_id', Type::where('type', 'news')->first()->id)->orderBy('created_at', 'desc')->take(4)->get(array('text', 'image', 'name', 'slug'));
     foreach ($news as $key => $post) {
         $preview = HomeController::previewFirstSimbol($post->text, 500);
         $post->preview_text = $preview['text'];
     }
     $view = array('slides' => $slides, 'news' => $news);
     return View::make('home.index', $view);
 }
Example #16
0
 public function index()
 {
     $data_security = Post::where('type', 'security')->latest('id')->first();
     $data_consultancy = Post::where('type', 'consultancy')->latest('id')->first();
     $data_ict_workshop = Post::where('type', 'ict-workshop')->latest('id')->first();
     $ecies_overview = Post::where('type', 'ecies-overview')->latest('id')->first();
     $recent_work = RecentWork::latest('id')->take(4)->get();
     $slider = Slider::latest('id')->take(3)->get();
     $pageTitle = "Ecies | excellence in the training & consultancy services in UK ";
     return View::make('pages.index', compact('pageTitle', 'data_security', 'data_consultancy', 'data_ict_workshop', 'ecies_overview', 'recent_work', 'slider'));
 }
 public function delete($id)
 {
     try {
         SliderModel::find($id)->delete();
         $alert['msg'] = 'Slider has been deleted successfully';
         $alert['type'] = 'success';
     } catch (\Exception $ex) {
         $alert['msg'] = 'This Slider has been already used';
         $alert['type'] = 'danger';
     }
     return Redirect::route('company.slider')->with('alert', $alert);
 }
 public function tv($token)
 {
     $store = StoreModel::where('token', $token)->get();
     if (count($store) == 0) {
         return View::make('store.tv.invalid');
     } else {
         $param['token'] = $token;
         $store = StoreModel::where('token', $token)->first();
         $param['sliders'] = SliderModel::where('company_id', $store->company_id)->get();
         $param['setting'] = CompanySettingModel::where('company_id', $store->company_id)->first();
         return View::make('store.tv.index')->with($param);
     }
 }
Example #19
0
 /**
  * Run database migrations
  *
  * @return void
  */
 public static function run()
 {
     $database = \Database::getInstance();
     // Copy license key from extension repository
     if (!\Config::get('rocksolid_slider_license') && $database->tableExists('tl_repository_installs') && $database->fieldExists('lickey', 'tl_repository_installs') && $database->fieldExists('extension', 'tl_repository_installs')) {
         $result = $database->prepare('SELECT lickey FROM tl_repository_installs WHERE extension = \'rocksolid-slider-pro\'')->execute();
         if ($result && Slider::checkLicense((string) $result->lickey)) {
             \Config::getInstance()->add('$GLOBALS[\'TL_CONFIG\'][\'rocksolid_slider_license\']', (string) $result->lickey);
         }
     }
     // Fix the singleSRC data type for Contao 3.1 and below
     if (version_compare(VERSION, '3.2', '<') && $database->tableExists('tl_rocksolid_slide')) {
         $fields = $database->listFields('tl_rocksolid_slide');
         foreach ($fields as $field) {
             if ($field['name'] === 'singleSRC' && $field['type'] !== 'varchar') {
                 $database->query('ALTER TABLE tl_rocksolid_slide CHANGE singleSRC singleSRC varchar(255) NOT NULL default \'\'');
                 $database->query('UPDATE tl_rocksolid_slide SET singleSRC = trim(trailing CHAR(0x00) from singleSRC)');
             }
         }
     }
     // Update the multiSRC and orderSRC field from IDs to UUIDs
     if (version_compare(VERSION, '3.2', '>=') && $database->tableExists('tl_rocksolid_slider')) {
         $needUpdate = true;
         $result = $database->prepare('SELECT multiSRC FROM tl_rocksolid_slider WHERE multiSRC != \'\'')->execute();
         if (!$result->count()) {
             $needUpdate = false;
         }
         while ($result->next()) {
             foreach (deserialize($result->multiSRC, true) as $value) {
                 if (\Validator::isUuid($value)) {
                     $needUpdate = false;
                     break 2;
                 }
             }
         }
         if ($needUpdate) {
             \Database\Updater::convertMultiField('tl_rocksolid_slider', 'multiSRC');
             \Database\Updater::convertOrderField('tl_rocksolid_slider', 'orderSRC');
         }
     }
     // Update the singleSRC field from IDs to UUIDs
     if (version_compare(VERSION, '3.2', '>=') && $database->tableExists('tl_rocksolid_slide')) {
         $fields = $database->listFields('tl_rocksolid_slide');
         foreach ($fields as $field) {
             if ($field['name'] === 'singleSRC' && $field['type'] !== 'binary') {
                 \Database\Updater::convertSingleField('tl_rocksolid_slide', 'singleSRC');
             }
         }
     }
 }
Example #20
0
 public function __construct()
 {
     $this->data['messages'] = View::make('block.messages')->with('messages', $this->getMessage())->render();
     $this->data['setting'] = Setting::first();
     $this->data['sliderList'] = Slider::orderBy('sort')->get();
     $this->data['socialList'] = Social::orderBy('sort')->get();
     $this->data['categoryList'] = Category::where('main', 0)->orderBy('sort')->get();
     $this->data['groupList'] = Group::orderBy('sort')->get();
     $this->data['buildOwn'] = Product::where('is_build', 1)->first();
     $placeList = Place::all();
     foreach ($placeList as $place) {
         $this->data['place'][$place->name] = $place->pageList()->orderBy('sort')->get();
     }
     $this->data['seo'] = array('keywords' => 'Pepperino', 'title' => 'Pepperino', 'description' => 'Pepperino');
 }
Example #21
0
 public function DeleteSliderImage($id)
 {
     $Data = Slider::model()->find('slider_id=:id', array(':id' => $id));
     $FileImage = $Data->slider_image;
     $FileThumb = $Data->slider_thumb;
     if (file_exists($FileImage)) {
         unlink($FileImage);
     } else {
         echo 'Error deleting Image:' . $FileImage;
     }
     if (file_exists($FileThumb)) {
         unlink($FileThumb);
     } else {
         echo 'Error deleting Thumbnail: ' . $FileThumb;
     }
 }
Example #22
0
File: Page.php Project: kizz66/meat
 public function index()
 {
     if ($this->show->indexPage) {
         $oNewsPage = new Page();
         $oNewsPage->loadByID($this->show->Page);
         $this->show->Content = $oNewsPage->Content;
         $brand = new Catalog_Brand();
         $sub = new Catalog_Category();
         $this->show->subbrand = new object();
         $this->show->categorylist = $sub->getList(-1);
         $this->show->brand = $brand->getList();
         foreach ($this->show->brand as $item) {
             $this->show->subbrand[$item['Title']] = $sub->getList($item['BrandID']);
         }
         $this->show->sliders = Slider::getSlides();
     }
 }
 public function index()
 {
     //get imageslider
     $sliders = Slider::orderBy('created_at', 'desc')->take(5)->get();
     //affiche le post vedette sur la home page avec la categorie prédéfinis
     $headliner = Category::with(['posts' => function ($query) {
         $query->orderBy('published_at', 'DESC')->take(1)->get();
     }])->where('id', '=', '5')->get();
     //show 4 categories with only one post by Category
     $categories = Category::with(['posts' => function ($query) {
         $query->orderBy('published_at', 'DESC')->take(5)->get();
     }])->take(4)->get();
     //Category publicite show image with publicity link
     $pub = Category::orderBy('created_at', 'DESC')->where('id', '=', '6')->take(1)->get();
     //affichage des commentaires par posts
     $comments = Comment::orderBy('created_at', 'desc')->take(6)->get();
     //Retrun 2 post by category check model Category twicePost
     $postCat = Category::with(['posts' => function ($query) {
         // Note that you don't have to call get() here!
         $query->orderBy('published_at', 'desc')->latest();
     }])->take(4)->get();
     return View::make('home.index')->with(array('sliders' => $sliders, 'comments' => $comments, 'categories' => $categories, 'headliner' => $headliner, 'pub' => $pub, 'postCat' => $postCat));
 }
Example #24
0
 /**
  * Modify a slider saved in the database.
  *
  * @param Slider $slider
  * @return integer
  */
 public function editSlider(Slider $slider)
 {
     $sql = "UPDATE slider \n\t\t\tSET id_slider = '" . $slider->getIdSlider() . "', title = '" . replaceCharacters($slider->getTitle()) . "', body = '" . $this->formatBody(replaceCharacters($slider->getBody())) . "', link = '" . $slider->getLink() . "' WHERE id_slider = '" . $slider->getIdSlider() . "'";
     return DB::query($sql);
 }
Example #25
0
 public function delete()
 {
     $slider = Slider::find(Input::get('id'));
     if ($slider->delete()) {
         File::delete("assets/images/slider/" . $slider->slider);
         return Redirect::back()->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Successfully deleted</p>');
     } else {
         return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try after sometime</p>');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->slider->find($id)->delete();
     return Redirect::route('sliders.index');
 }
Example #27
0
 /**
  * Modify a slider saved in the database.
  *
  * @param Slider $slider
  * @return integer
  */
 public function editSlider(Slider $slider)
 {
     $sql = "UPDATE slider \n\t\t\tSET id_slider = '" . $slider->getIdSlider() . "', title = '" . replaceCharacters($slider->getTitle()) . "' WHERE id_slider = '" . $slider->getIdSlider() . "'";
     return DB::query($sql);
 }
Example #28
0
<html>
	<head>
		<title>
			Парсинг
		</title>
		<link href="/assets/styles.css" rel="stylesheet">
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
		<script src="/assets/scripts.js"></script>
	</head>
	<body>
		<?php 
include '/app/Slider.php';
$pathToJson = 'https://raw.githubusercontent.com/nickua/testtaskfiles/master/images.json';
$pathToXml = 'https://raw.githubusercontent.com/nickua/testtaskfiles/master/images.xml';
$slider = new Slider($pathToXml, 'xml');
$slider->renderSlider();
?>
	</body>
</html>
Example #29
0
 /**
  * @return mixed
  */
 public function all()
 {
     return $this->slider->where('lang', getLang())->orderBy('created_at', 'DESC')->get();
 }
/*
 * BOX for outputing sliders. Setting in admin-area modules, 
 * slider_caption = slider_category
 */
$box = new vamTemplate();
$box->assign('language', $_SESSION['language']);
$q = "SELECT s.*, sc.categories_id \nFROM slider s\nLEFT JOIN slider_to_categories sc ON sc.slider_id = s.slider_id \nWHERE slider_status = 1 \nAND s.slider_caption = 'slider_category'\nAND sc.categories_id = {$current_category_id}\nORDER BY s.slider_id DESC LIMIT 1;";
$qr = vam_db_query($q);
$rows = array();
$current_slider_id == 'none';
while ($r = vam_db_fetch_array($qr)) {
    $rows[$r['slider_id']] = $r;
    $s1 = $r;
}
require_once DIR_WS_INCLUDES . 'external/slider/Slider.class.inc.php';
$s = new Slider();
$simages = $s->grepIMGfromHTML($s1['slider_config']);
if ($_GET['dbg'] == 1) {
    print_r($simages);
}
// set cache ID
if (!CacheCheck()) {
    $cache = false;
    $box->caching = 0;
} else {
    $cache = true;
    $box->caching = 1;
    $box->cache_lifetime = CACHE_LIFETIME;
    $box->cache_modified_check = CACHE_CHECK;
    $cache_id = $_SESSION['language'] . $_SESSION['customers_status']['customers_status_id'] . $current_category_id;
}