public function index()
 {
     Log::debug(__METHOD__);
     if (Input::has('book_id')) {
         $this->setCurrentBook(Input::get('book_id'));
     }
     if (Input::has('layout')) {
         $this->setLayout(Input::get('layout'));
     }
     if (Agent::isMobile()) {
         $user_name = Auth::user()->username;
         $get_task_counts = $this->getTaskCounts();
         $book_name = $this->getBookName();
         $current_book_id = $this->currentBook() ? $this->currentBook()->id : 0;
         $prefix = $this->getPrefix();
         $recent_done_now = 10;
         $books = $this->getAllBookCounts();
         $tasks = $this->getTasks('', $recent_done_now);
         return View::make('tasks.index', compact('user_name', 'book_name', 'current_book_id', 'prefix', 'recent_done_now', 'tasks', 'books'));
     } else {
         $this->tasks = $this->currentTasks();
         //        respond_to do |format|
         //            format.html
         //            format.csv { send_data(current_tasks.csv) }
         //            format.xls
         //        end
         return View::make('tasks.index');
     }
 }
 public function __construct()
 {
     if (Agent::isMobile()) {
         $this->_vista = 'mobile';
     } else {
         $this->_vista = 'index';
     }
     $this->_imagesInstagram = array();
     $this->_imagesTwitter = array();
     $instagram = new instagram(array('apiKey' => '09fd60952ea742d5abb761b6c6a137aa', 'apiSecret' => 'ee25063e91e74d6c9f257be054a44ec3', 'apiCallback' => 'http://viernesdezapatillas.pe/'));
     $tagInstagram = 'viernesdezapatillas';
     $numphotosInstagram = 15;
     $media = $instagram->getTagMedia($tagInstagram, $auth = false, array('count' => $numphotosInstagram));
     $response = json_decode(json_encode($media));
     foreach ($response->data as $data) {
         $this->_imagesInstagram[] = $data->images->thumbnail->url;
     }
     $max_id = 0;
     $totalTweets = 15;
     $responset = Twitter::getSearch(array('q' => '#viernesdezapatillas since:2015-07-01 filter:images', 'count' => $totalTweets, 'max_id' => $max_id, 'since_id' => 0));
     foreach ($responset->statuses as $tweet) {
         foreach ($tweet->entities->media as $url) {
             $this->_imagesTwitter[] = $url->media_url;
             // . ':thumb';
         }
     }
 }
 public function detail($idLook, $categoria, $name)
 {
     $producto = DB::table('looks')->where('looks.idlook', $idLook)->where('looks.estado', '>=', 1)->join('lookbook', 'lookbook.idlookbook', '=', 'looks.idlookbook')->select('looks.*', 'lookbook.nombre')->get();
     $subcate = $producto[0]->subcategoria;
     $ordensuperior = $producto[0]->orden2 + 1;
     $ordeninferior = $producto[0]->orden2 - 1;
     $numregistros = DB::table('looks')->where('looks.idlookbook', $categoria)->count();
     if ($ordensuperior > $numregistros) {
         $ordensuperior = 1;
     }
     if ($ordeninferior <= 1) {
         $ordeninferior = $numregistros;
     }
     $prodsiguiente = DB::table('looks')->where('looks.orden2', $ordensuperior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
     $prodanterior = DB::table('looks')->where('looks.orden2', $ordeninferior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
     /*$similares = DB::table('looks')
     		->where('looks.idlookbook', '=', $categoria)
     		->where('looks.estado', '=', 1)
     		->where('looks.idlook', '!=', $idLook)
     		->select('looks.*')
     		->orderBy('looks.orden2')
     		->take(4)
     		->get();*/
     $similares = DB::table('looks')->where('looks.idlookbook', '=', $categoria)->where('looks.estado', '>=', 1)->where('looks.idlook', '!=', $idLook)->where('looks.subcategoria', $subcate)->select('looks.*')->orderBy(DB::raw('RAND()'))->get();
     $isMobile = Agent::isMobile();
     if ($isMobile) {
         return View::make('mobile/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
     } else {
         return View::make('desktop/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
     }
 }
 public function index()
 {
     $isMobile = Agent::isMobile();
     //$isMobile=true;
     if ($isMobile) {
         return View::make('mobile/home');
     } else {
         return View::make('desktop/home');
     }
 }
 /**
  * Get the fully qualified location of the view.
  *
  * @param  string  $name
  * @return string
  */
 public function find($name)
 {
     //		Log::info('View Hook!! ' . $name);
     if (Agent::isMobile()) {
         try {
             return parent::find($name . '@phone');
         } catch (Exception $e) {
             Log::debug(__METHOD__ . ": not find {$name}@phone");
         }
     }
     return parent::find($name);
 }
 public function postSubirVideo()
 {
     $res = '';
     $ie = Input::get('ie');
     if (isset($_FILES['archivo'])) {
         $file = $_FILES['archivo'];
         $name = $file['name'];
         $tmp_name = $file['tmp_name'];
         $extension = explode('.', $name);
         $extension = strtolower(end($extension));
         $key = md5(uniqid());
         $tmp_file_name = "{$key}.{$extension}";
         $tmp_file_path = "../uploads/{$tmp_file_name}";
         move_uploaded_file($tmp_name, $tmp_file_path);
         $videos = new Videos();
         $videos->dni = trim(Input::get('dni'));
         $videos->archivo_original = $name;
         $videos->archivo = $key;
         $videos->extension = $extension;
         $videos->ip = Request::getClientIp(true);
         $videos->save();
         $res = '1';
     } else {
         $res = '0';
     }
     /*if (Agent::isMobile())
     			return View::make('mensaje.mobile');
     		if ($ie === '1') {
     			return View::make('mensaje');
     		} else {
     			return $res;
     		}*/
     if (Agent::isMobile()) {
         return View::make('mensajeMobile');
     } else {
         return View::make('mensaje');
     }
 }
 /**
  * get file's source
  *
  * @param string $url url
  * @param string $id  id
  *
  * @return void
  */
 public function fileSource($url, $id)
 {
     $file = File::find($id);
     /** @var \Xpressengine\Media\MediaManager $mediaManager */
     $mediaManager = \App::make('xe.media');
     if ($mediaManager->is($file) === true) {
         $dimension = 'L';
         if (\Agent::isMobile() === true) {
             $dimension = 'M';
         }
         $media = Image::getThumbnail($mediaManager->make($file), PageModule::THUMBNAIL_TYPE, $dimension);
     }
     header('Content-type: ' . $media->mime);
     echo $media->getContent();
 }
Example #8
0
 /**
  * get file's source
  *
  * @param string $url url
  * @param string $id  id
  * @return void
  */
 public function fileSource($url, $id)
 {
     $permission = $this->permissionHandler->get($this->boardId);
     if ($permission->unables(ACTION::READ) === true) {
         throw new AccessDeniedHttpException();
     }
     // permission 추가 해야 함.
     /** @var \Xpressengine\Storage\Storage $storage */
     $storage = app('xe.storage');
     $file = $storage->get($id);
     /** @var \Xpressengine\Media\MediaManager $mediaManager */
     $mediaManager = \App::make('xe.media');
     if ($mediaManager->is($file) === true) {
         /** @var \Xpressengine\Media\Handlers\ImageHandler $handler */
         $handler = $mediaManager->getHandler(\Xpressengine\Media\Spec\Media::TYPE_IMAGE);
         $dimension = 'L';
         if (\Agent::isMobile() === true) {
             $dimension = 'M';
         }
         $media = $handler->getThumbnail($mediaManager->make($file), Board::THUMBNAIL_TYPE, $dimension);
         $file = $media->getFile();
     }
     header('Content-type: ' . $file->mime);
     echo $storage->read($file);
 }
 /**
  * get file source
  *
  * @param EditorHandler $handler    editor handler
  * @param string        $instanceId instance id
  * @param string        $id         document id
  * @return void
  * @throws InvalidArgumentException
  */
 public function fileSource(EditorHandler $handler, $instanceId, $id)
 {
     if (empty($id)) {
         throw new InvalidArgumentException();
     }
     $file = File::find($id);
     /** @var \Xpressengine\Media\MediaManager $mediaManager */
     $mediaManager = app('xe.media');
     if ($mediaManager->is($file) === true) {
         $dimension = 'L';
         if (\Agent::isMobile() === true) {
             $dimension = 'M';
         }
         $media = Image::getThumbnail($mediaManager->make($file), EditorHandler::THUMBNAIL_TYPE, $dimension);
         header('Content-type: ' . $media->mime);
         echo $media->getContent();
     }
 }
Example #10
0
function isMobile()
{
    return Agent::isMobile() || Agent::isTablet();
}
Example #11
0
<?php

/**
 * Render form validation message.
 *
 * @return string
 */
Form::macro('validationMessage', function () {
    return '<span class="form-control-feedback" aria-hidden="true"></span><div class="help-block with-errors text-center"></div>';
});
/**
 * Render Google recaptcha.
 *
 * @return string
 */
Form::macro('recaptcha', function () {
    return sprintf('<div id="g-recaptcha" data-sitekey="%s" data-size="%s"></div>', env('RECAPTCHA_SITE_KEY', ''), Agent::isMobile() ? 'compact' : 'normal');
});
Example #12
0
function defineFolder()
{
    $isMobile = Agent::isMobile();
    $ips = array('190.234.106.195', '179.7.84.155');
    $ip = getIP();
    $folder = 'desktop/';
    if ($isMobile) {
        $folder = 'mobile/';
    }
    // Hack
    if (in_array($ip, $ips)) {
        $folder = 'mobile/';
    }
    return $folder;
}
 public function getView($slug)
 {
     if (Agent::isMobile() || Agent::isTablet()) {
         switch ($slug) {
             case "film":
                 return Redirect::to('film-mobile');
                 break;
             case "animation":
                 return Redirect::to('animation-mobile');
                 break;
             case "game-production":
                 return Redirect::to('game-mobile');
                 break;
             case "recording-arts":
                 return Redirect::to('recording-arts-mobile');
                 break;
             case "mp":
                 return Redirect::to('mp-mobile');
                 break;
             case "entertainment-business":
                 return Redirect::to('business-mobile');
                 break;
             case "entertainment-business-online":
                 return Redirect::to('entertainment-business-online-mobile');
                 break;
             case "digital-filmmaking":
                 return Redirect::to('digital-filmmaking-mobile');
                 break;
             case "military":
                 return Redirect::to('omni-mobile');
                 break;
             case "omni":
                 return Redirect::to('omni-mobile');
                 break;
         }
     } elseif (!Agent::isMobile() && !Agent::isTablet()) {
         switch ($slug) {
             case "film-mobile":
                 return Redirect::to('film');
                 break;
             case "animation-mobile":
                 return Redirect::to('animation');
                 break;
             case "game-mobile":
                 return Redirect::to('game-production');
                 break;
             case "recording-arts-mobile":
                 return Redirect::to('recording-arts');
                 break;
             case "mp-mobile":
                 return Redirect::to('mp');
                 break;
             case "business-mobile":
                 return Redirect::to('entertainment-business');
                 break;
             case "digital-filmmaking-mobile":
                 return Redirect::to('digital-filmmaking');
                 break;
             case "entertainment-business-online-mobile":
                 return Redirect::to('entertainment-business-online');
                 break;
             case "omni-mobile":
                 return Redirect::to('omni');
                 break;
         }
     }
     $landingpage = $this->landingpage->where('slug', '=', $slug)->first();
     // Check if the blog post exists
     if (is_null($landingpage)) {
         // If we ended up in here, it means that
         // a page or a blog post didn't exist.
         // So, this means that it is time for
         // 404 error page.
         //return App::abort(404);
         return 'DAMN!';
     }
     // Get variants
     $variants = $landingpage->variants($landingpage->id);
     $lpcount = $this->landingpage->sumallhits($landingpage->id);
     if ($lpcount == 0) {
         $lpcount = 100;
     }
     $v = array();
     foreach ($variants as $var) {
         $hit = $this->landingpage->sumhits($var->id);
         $varperc = $hit / $lpcount;
         $percent = $var->percent / 100;
         if ($varperc < $percent) {
             $vid = $var->id;
             break;
         }
         $v[] = $var->id;
     }
     if (empty($vid)) {
         $key = array_rand($v);
         $vid = $v[$key];
     }
     //echo $vid;
     $varclass = new Variant();
     $variant = $varclass->findOrFail($vid);
     $tempid = $variant->t_id;
     $variables = $varclass->getVariantVariables($vid);
     $key = array();
     $value = array();
     foreach ($variables as $var) {
         $key[] = str_replace(' ', '', $var->name);
         $value[] = $var->vartext;
     }
     $variab = array_combine($key, $value);
     $bladete = $varclass->getblade($tempid);
     $file = $bladete->blade;
     $filer = str_replace('.blade.php', '', $file);
     $view = 'uploads.' . $filer;
     $images = $varclass->getsliderimages($vid);
     $count = count($images);
     $sliderimages = '';
     $sliderbuttons = '';
     $slideritems = '';
     $i = 1;
     foreach ($images as $img) {
         $sliderimages .= ".iosSlider .slider #item" . $i . " \n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbackground: url('" . asset($img->path) . "') no-repeat 50% 0 ;\n\t\t\t\t\t\t\t\t\tbackground-size:100%;\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}";
         $sliderbuttons .= '<div class="button"></div>';
         $slideritems .= "<div class = 'item' id = 'item" . $i . "'>\n\n\t\t\t\t\t\t\t\t</div>";
         $i++;
     }
     $data = array('id' => $variant->id, 'lp_id' => $variant->lp_id, 'slug' => $slug);
     // return View::make($view)->with('variables', $variab);
     return View::make($view)->with('variables', $variab)->with('variant', $variant)->with('sliderimages', $sliderimages)->with('slideritems', $slideritems)->with('sliderbuttons', $sliderbuttons)->with('slug', $slug)->nest('form', 'forms.form', $data);
     // Get current user and check permission
     // Show the page
     //return View::make('site/blog/view_post', compact('post', 'comments', 'canComment'));
 }