Example #1
0
 public function swapWithModel(self $model)
 {
     $orderColumn = $this->determineOrderColumnName();
     $oldOrderOfOtherModel = $model->{$orderColumn};
     $model->{$orderColumn} = $this->{$orderColumn};
     $model->save();
     $this->{$orderColumn} = $oldOrderOfOtherModel;
     $this->save();
     return $this;
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('quizzes')->truncate();
     $media = new Media();
     $media->user_id = 1;
     $media->type = 'image';
     $media->mime = 'image/jpeg';
     $media->width = '1920';
     $media->height = '1080';
     $media->hash = '01233456789abcdefghijklmnopqrstuvwxyz';
     $media->save();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
Example #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(MediaRequest $request)
 {
     $fileExte = $request->file('file')->getClientOriginalExtension();
     $fileName = time() . "." . $fileExte;
     $media = new Media();
     $media->mediaName = $fileName;
     $media->mediaType = $fileExte;
     $media->mediaCaption = $request->get('caption');
     if ($media->save()) {
         $upload = $request->file('file')->move("uploads/", $fileName);
         return redirect('media')->with('message', 'Image uploaded.');
     } else {
         return redirect('media')->with('error', 'Something went wrong.');
     }
 }
Example #4
0
 /**
  * Update the rating field on the provided media id via ajax request.
  * 
  * @param Request $request
  * @param string $mediaId
  */
 public function updateRating(Request $request, $mediaId)
 {
     $rating = $request->except('_token', '_method');
     $media = Media::findOrFail($mediaId);
     $this->authorize('updateRating', $media);
     $media->update(['rating' => last($rating)]);
 }
Example #5
0
 /**
  * Approve a photo for the front page
  * @param  integer $mediaID
  * @param  boolean $isApproved
  * @return VIEW
  */
 public static function approveMedia($mediaID, $isApproved)
 {
     $media = Media::find($mediaID);
     $media->approved = $isApproved;
     $media->processed = true;
     $media->save();
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Like::creating(function ($attribute) {
         // -1 like_left for media
         $media = Media::findOrFail($attribute->media_id);
         $media->likes_left = $media->likes_left - 1;
         $media->save();
         // +1 credit for liker of media
         $user = User::findOrFail($attribute->user_id);
         if ($user->pro_user) {
             $user->credit = $user->credit + 3;
             //for pro user
         } else {
             $user->credit = $user->credit + 1;
         }
         $user->save();
     });
     Follow::creating(function ($attribute) {
         // -1 like_left for media
         $user = User::findOrFail($attribute->follow_id);
         $user->followers_left = $user->followers_left - 1;
         $user->save();
         // +1 credit for liker of media
         $user = User::findOrFail($attribute->user_id);
         if ($user->pro_user) {
             $user->credit = $user->credit + 3;
             //for pro user
         } else {
             $user->credit = $user->credit + 1;
         }
         $user->save();
     });
 }
 public function addImage(Request $request)
 {
     $files = $request->file('file');
     foreach ($files as $file) {
         $destinationPath = 'public/images/';
         // upload path
         $filename = str_random(40) . '_' . $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         // getting image extension
         Storage::disk('local')->put($filename, File::get($file));
         $media = new Media();
         $media->location = $filename;
         $media->extension = $extension;
         $media->type = 'image';
         $media->save();
     }
     return back()->withInput();
 }
 public function edit($id)
 {
     $pl_data = \App\PerangkatLunak::find($id);
     $medias = \App\Media::lists('nama_media', 'id');
     $licenses = \App\License::lists('nama_license', 'id');
     $jenises = \App\Jenis::lists('nama_jenis', 'id');
     $companies = \App\Company::lists('nama_company', 'id');
     return view('perangkat_lunak.edit', ['pl_data' => $pl_data, 'medias' => $medias, 'licenses' => $licenses, 'jenises' => $jenises, 'companies' => $companies]);
 }
Example #9
0
    public function run()
    {
        Oglas::insert([['naziv' => 'Гусле од јавора', 'slug' => 'gusle-od-javora', 'cena' => 32000, 'vrsta_proizvoda_id' => 1, 'stanje_proizvoda_id' => 1, 'korisnici_id' => 1, 'opis' => 'За продају Гусле израдјене пред пар година од стране мајстора Бранета Станишића из Нове Пазове , који је досад израдио преко 100 гусала . Гусле су масивне и богато украсене имају одличан звук . Струна на гуслама је од најлона а на гудалу од коњске длаке . За све сто вас интересује слободно питајте . Посетите нас на фејсбук страници израда и рестаурација гусала .
Za prodaju Gusle izradjene pred par godina od strane majstora Braneta Stanišića iz Nove Pazove , koji je dosad izradio preko 100 gusala . Gusle su masivne i bogato ukrasene imaju odličan zvuk . Struna na guslama je od najlona a na gudalu od konjske dlake . Za sve sto vas interesuje slobodno pitajte . Posetite nas na fejsbuk stranici izrada i restauracija gusala .', 'foto' => '/img/prodavnica/prodavnica-1-1-1450881799743-0.jpg'], ['naziv' => 'Гусле од јавора', 'slug' => 'gusle-od-javora-1', 'cena' => 13000, 'vrsta_proizvoda_id' => 1, 'stanje_proizvoda_id' => 1, 'korisnici_id' => 1, 'opis' => 'За продају Гусле израдјене пред пар година од стране мајстора Бранета Станишића из Нове Пазове , који је досад израдио преко 100 гусала . Гусле су масивне и богато украсене имају одличан звук . Струна на гуслама је од најлона а на гудалу од коњске длаке . За све сто вас интересује слободно питајте . Za prodaju Gusle izradjene pred par godina od strane majstora Braneta Stanišića iz Nove Pazove , koji je dosad izradio preko 100 gusala . Gusle su masivne i bogato ukrasene imaju odličan zvuk . Struna na guslama je od najlona a na gudalu od konjske dlake . Za sve sto vas interesuje slobodno pitajte .', 'foto' => '/img/prodavnica/prodavnica-1-2-1450881799743-0.jpg'], ['naziv' => 'Гусле', 'slug' => 'gusle', 'cena' => '8999', 'vrsta_proizvoda_id' => 1, 'stanje_proizvoda_id' => 1, 'korisnici_id' => 2, 'opis' => 'Руцно радјење Гусле одлицног квалитета и глас , Радим гусле по зељи сам нарудјбини .
Rucno radjenje Gusle odlicnog kvaliteta i glas , Radim gusle po zelji sam narudjbini .', 'foto' => '/img/prodavnica/prodavnica-2-3-1450881799743-0.jpg'], ['naziv' => 'Држач за оловке у дуборезу', 'slug' => 'drzac-za-olovke-u-duborezu', 'cena' => '270', 'vrsta_proizvoda_id' => 8, 'stanje_proizvoda_id' => 3, 'korisnici_id' => 3, 'opis' => 'Прелеп Држач за оловке , израђен од дрвета у дуборезу сам прелакиран . Донет својевремено из Сплита , добро оцуван , без оштећења . Срећн Чувар ОЛОВАКА рекла БиХ , јер су оловке писале само добре и лепе & куот ; & куот ;. Свари Продаје се због вишка ствари у кући .Димензије :Висина : Око 8 цм ,Пречник : око 5,5 цм ,Пречник , унутрашњи (исто посудице ) : око 4,5 цм .Prelep Držač za olovke , izrađen od drveta u duborezu sam prelakiran . Donet svojevremeno iz Splita , dobro ocuvan , bez oštećenja . Srećn Čuvar OLOVAKA rekla BiH , jer su olovke pisale samo dobre i lepe & kuot ; & kuot ;. Svari Prodaje se zbog viška stvari u kući .Dimenzije :Visina : Oko 8 cm ,Prečnik : oko 5,5 cm ,Prečnik , unutrašnji (isto posudice ) : oko 4,5 cm ', 'foto' => '/img/prodavnica/prodavnica-3-4-1450881799743-0.jpg'], ['naziv' => 'ДВА ОРЛА ДУБОРЕЗ', 'slug' => 'dva-orla-duborez', 'cena' => '5000', 'vrsta_proizvoda_id' => 6, 'stanje_proizvoda_id' => 2, 'korisnici_id' => 3, 'opis' => 'Два орла у дуборезу ручно радјени , врхунски рад руских мајстора .ВИСИНА 33цм , СИРИНА19цм . Dva orla u duborezu ručno radjeni , vrhunski rad ruskih majstora .VISINA 33cm , SIRINA19cm .', 'foto' => '/img/prodavnica/prodavnica-3-5-1450881799743-0.jpg'], ['naziv' => 'Продајем фруле, ШТИМОВАНЕ, професионалне', 'slug' => 'prodajem-frule-stimovane-profesionalne', 'cena' => '7500', 'vrsta_proizvoda_id' => 2, 'stanje_proizvoda_id' => 1, 'korisnici_id' => 2, 'opis' => 'Продајем фруле , ШТИМОВАНЕ , професионалне , СВИХ ТОНАЛИТЕТА
Prodajem frule , ŠTIMOVANE , profesionalne , SVIH TONALITETA', 'foto' => '/img/prodavnica/prodavnica-2-6-1450881799743-0.jpg'], ['naziv' => 'Моецк Флаута дрвена', 'slug' => 'moeck-flauta-drvena', 'cena' => '1200', 'vrsta_proizvoda_id' => 2, 'stanje_proizvoda_id' => 2, 'korisnici_id' => 1, 'opis' => 'Моецк Флаута дрвена у супер стању .
Moeck Flauta drvena u super stanju .', 'foto' => '/img/prodavnica/prodavnica-1-7-1450881799743-0.jpg'], ['naziv' => 'Икона Свети Архангел Михаило Дуборез', 'slug' => 'ikona-sveti-arhangel-mihailo-duborez', 'cena' => '13000', 'vrsta_proizvoda_id' => 3, 'stanje_proizvoda_id' => 1, 'korisnici_id' => 2, 'opis' => 'Икона у дуборезу руцни рад , уникат , бајцована сам заштићена СА пцелињим воском димензија 40 пута 30 цм , шаљем брзом постом после уплате ор даунлоудовање лицно .
Ikona u duborezu rucni rad , unikat , bajcovana sam zaštićena SA pcelinjim voskom dimenzija 40 puta 30 cm , šaljem brzom postom posle uplate or daunloudovanje licno .', 'foto' => '/img/prodavnica/prodavnica-2-8-1450881799743-0.jpg']]);
        Media::insert([['src' => '/img/prodavnica/prodavnica-1-1-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-1-1-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-1-1-1450881799743-2.jpg'], ['src' => '/img/prodavnica/prodavnica-1-1-1450881799743-3.jpg'], ['src' => '/img/prodavnica/prodavnica-1-2-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-1-2-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-1-2-1450881799743-2.jpg'], ['src' => '/img/prodavnica/prodavnica-1-2-1450881799743-3.jpg'], ['src' => '/img/prodavnica/prodavnica-1-2-1450881799743-4.jpg'], ['src' => '/img/prodavnica/prodavnica-2-3-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-2-3-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-2-3-1450881799743-2.jpg'], ['src' => '/img/prodavnica/prodavnica-3-4-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-3-4-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-3-5-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-3-5-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-3-5-1450881799743-2.jpg'], ['src' => '/img/prodavnica/prodavnica-2-6-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-2-6-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-1-7-1450881799743-0.jpg'], ['src' => '/img/prodavnica/prodavnica-1-7-1450881799743-1.jpg'], ['src' => '/img/prodavnica/prodavnica-2-8-1450881799743-0.jpg']]);
    }
Example #10
0
 public function show($id)
 {
     $event = \App\Event::where('id', $id)->get()->toArray();
     if (empty($event)) {
         App:
         abort(404);
     }
     $event = $event[0];
     $media = \App\Media::join('event_media', 'media.id', '=', 'event_media.mediaID')->where('event_media.eventID', $id)->get()->toArray();
     return view('show/event')->with(['event' => $event, 'media' => $media]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //Get the Media from given URL
     $media = Media::where('url', $request->url)->first();
     if (!$media) {
         return response()->json(['success' => false, 'message' => "No such media in our DB"]);
     }
     if (!$media->publishable) {
         return response()->json(['success' => false, 'message' => "You cannot like this media"]);
     }
     return response()->json(['success' => true, 'message' => "Successfully liked", 'like' => Like::create(['user_id' => User::getCurrentUserId(), 'media_id' => $media->id])]);
 }
Example #12
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     try {
         $isInstalled = Setting::where('name', 'is_installed')->firstOrFail();
     } catch (ModelNotFoundException $e) {
         $isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']);
     }
     if ($isInstalled->setting != 'yes') {
         return Redirect::route('install');
     }
     $data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()];
     return view('home')->with($data);
 }
Example #13
0
 public function index()
 {
     $totalNumber = 5;
     // number of items to take for each section
     $data = ["events" => Event::where('end_datetime', '>', date(time()))->get()->take($totalNumber), "partners" => Partner::all()->take($totalNumber), "news" => News::all()->take($totalNumber), "media" => Media::where('processed', 0)->get()->take($totalNumber * 2)->chunk(3), "staffs" => User::where('is_staff', 1)->get(), "locations" => Location::all()->take($totalNumber)];
     $i = 0;
     foreach ($data['events'] as $event) {
         $mediaCount = count(Media::where('processed', false)->where('event_id', $event->id)->get());
         $data['events'][$i]->mediaCount = $mediaCount;
         $i++;
     }
     return View::make('admin.index')->with($data);
 }
Example #14
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required|max:90', 'body' => 'required', 'price' => 'required', 'category' => 'required', 'community' => 'required', 'city_id' => 'required']);
     $post = new Post();
     $post->title = $request->title;
     $post->body = $request->body;
     $post->user_id = Auth::user()->id;
     $post->price = $request->price;
     $post->category_id = $request->category;
     $post->community_id = $request->community;
     $post->city_id = $request->city_id;
     $post->save();
     $files = $request->file('filefield');
     $file_count = count($files);
     $uploadcount = 0;
     foreach ($files as $file) {
         // Validate each file
         $rules = array('filefield' => 'required|mimes:png,gif,jpeg');
         //'required|mimes:png,gif,jpeg,txt,pdf,doc'
         $validator = Validator::make(array('filefield' => $file), $rules);
         if ($validator->passes()) {
             $file = $file;
             $name = time() . '-' . $file->getClientOriginalName();
             $upload_success = $file->move(public_path() . '/uploads/', $name);
             $media = new Media();
             $media->name = $name;
             $media->post_id = $post->id;
             $media->save();
             $uploadcount++;
         }
     }
     if ($uploadcount == $file_count) {
         return Redirect('/')->with('message', 'Post created');
     } else {
         $post->delete();
         return Redirect::to('/post/create')->withInput()->withErrors($validator);
     }
 }
Example #15
0
 public static function ukloniMOglasa($oglasId, $mediaId)
 {
     $src = Media::where('src', 'like', '/img/prodavnica/prodavnica-' . Auth::user()->id . '-' . $oglasId . '-%')->where('id', $mediaId)->get(['src'])->first();
     if ($src) {
         $src = $src->src;
     } else {
         return 0;
     }
     $test = Media::where('src', 'like', '/img/prodavnica/prodavnica-' . Auth::user()->id . '-' . $oglasId . '-%')->where('id', $mediaId)->delete();
     if ($test > 0) {
         unlink(substr($src, 1));
     }
     return $test;
 }
Example #16
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Media::firstOrCreate(['file_location' => '/images/sample_images/hotels/1.jpg', 'event_id' => 1, 'description' => 'A photo description', 'name' => 'Photo 1', 'view_count' => 20, 'approved' => false, 'processed' => false, 'user_id' => 5]);
     Media::firstOrCreate(['file_location' => '/images/sample_images/hotels/2.jpg', 'event_id' => 2, 'description' => 'A photo description', 'name' => 'Photo 2', 'view_count' => 5, 'approved' => false, 'processed' => false, 'user_id' => 5]);
     Media::firstOrCreate(['file_location' => '/images/sample_images/hotels/3.jpg', 'event_id' => 3, 'description' => 'A photo description', 'name' => 'Photo 3', 'view_count' => 570, 'approved' => false, 'processed' => false, 'user_id' => 5]);
     ///////////////////////
     // UNPROCESSED MEDIA //
     ///////////////////////
     for ($i = 1; $i <= 12; $i++) {
         Media::firstOrCreate(['file_location' => '/images/sample_images/event_photos/' . $i . '.jpg', 'event_id' => 3, 'description' => 'A photo description', 'name' => 'Event Photo ' . $i, 'view_count' => 0, 'approved' => true, 'processed' => true, 'user_id' => 5]);
     }
     for ($i = 1; $i <= 12; $i++) {
         Media::firstOrCreate(['file_location' => '/images/sample_images/event_photos/' . $i . '.jpg', 'event_id' => 3, 'description' => 'A photo description', 'name' => 'Event Photo ' . $i, 'view_count' => 0, 'approved' => false, 'processed' => false, 'user_id' => 5]);
     }
 }
 public function editForm()
 {
     $eventNames = \App\Event::get()->pluck('name', 'id')->toArray();
     $mediaNames = \App\Media::get()->pluck('name', 'id')->toArray();
     $eventIDs = \App\Event::get()->pluck('id')->toArray();
     $mediaIDs = \App\Media::get()->pluck('id')->toArray();
     $mediaToEvents = array();
     $eventToMedia = array();
     foreach ($eventIDs as $eventID) {
         $eventToMedia[$eventID] = \App\Media::join('event_media', 'media.id', '=', 'event_media.mediaID')->where('event_media.eventID', $eventID)->get()->pluck('name', 'id')->toArray();
     }
     foreach ($mediaIDs as $mediaID) {
         $mediaToEvents[$mediaID] = \App\Event::join('event_media', 'events.id', '=', 'event_media.eventID')->where('event_media.mediaID', $mediaID)->get()->pluck('name', 'id')->toArray();
     }
     return view('forms/editRelationships')->with(['eventNames' => $eventNames, 'mediaNames' => $mediaNames, 'eventToMedia' => $eventToMedia, 'mediaToEvents' => $mediaToEvents]);
 }
Example #18
0
 public function index()
 {
     /* Get data for timeline */
     $eventDates = \App\Event::select('timelineDate')->distinct()->get()->pluck('timelineDate')->toArray();
     $mediaDates = \App\Media::select('timelineDate')->distinct()->get()->pluck('timelineDate')->toArray();
     $dates = array_unique(array_merge($eventDates, $mediaDates), SORT_REGULAR);
     usort($dates, array('\\App\\Http\\Controllers\\TimelineController', 'dateCompare'));
     $media = array();
     $events = array();
     foreach ($dates as $date) {
         $eventsForThisDate = \App\Event::get()->where('timelineDate', $date)->toArray();
         $mediaForThisDate = \App\Media::get()->where('timelineDate', $date)->toArray();
         usort($eventsForThisDate, array('\\App\\Http\\Controllers\\TimelineController', 'itemCompare'));
         usort($mediaForThisDate, array('\\App\\Http\\Controllers\\TimelineController', 'itemCompare'));
         $media[$date] = $mediaForThisDate;
         $events[$date] = $eventsForThisDate;
     }
     /* Get data for filters */
     $mediums = \App\Media::select('medium')->distinct()->get()->pluck('medium')->toArray();
     $tags = \App\EventTag::select('tag')->distinct()->get()->pluck('tag')->toArray();
     $series = \App\Series::get()->pluck('seriesAbbreviation');
     sort($mediums);
     sort($tags);
     $eventIDToTags = array();
     $eventIDs = \App\Event::get()->pluck('id');
     foreach ($eventIDs as $eventID) {
         $eventIDToTags[$eventID] = \App\EventTag::select('tag')->where('eventID', $eventID)->get()->pluck('tag')->toArray();
     }
     $seriesToCollections = array();
     foreach ($series as $thisSeries) {
         $seriesToCollections[$thisSeries] = \App\Media::select('collection')->where('series', $thisSeries)->distinct()->get()->pluck('collection')->toArray();
     }
     /* Get event-media relationships */
     $eventMediaPairs = \App\EventMedia::get(array('eventID', 'mediaID'))->toArray();
     return view('timeline')->with(['seriesToCollections' => $seriesToCollections, 'eventMediaPairs' => $eventMediaPairs, 'eventIDToTags' => $eventIDToTags, 'mediums' => $mediums, 'events' => $events, 'dates' => $dates, 'media' => $media, 'tags' => $tags]);
 }
 public function add()
 {
     $path = base_path() . '/www/media/';
     $viewBag = array('permission' => \Auth::user()->permission->name, 'files' => Media::getFiles($path));
     return \View::make('backend.slider.show', $viewBag);
 }
Example #20
0
 public function aumentarHits($uri)
 {
     /*********** Hits section ************/
     $modulo = new cms_section();
     $modulo->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para categoria ******/
     $categories = new cms_category();
     $categories->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para documents ******/
     $document = new cms_document();
     $document->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para med_albums ******/
     $media = new Media();
     $media->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para med_pictures ******/
     $media = new Item();
     $media->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para med_pictures ******/
     $directory = new Directory();
     $directory->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
     /*********** Hits para med_pictures ******/
     $file = new ItemFiles();
     $file->whereuri($uri)->whereactive(1)->increment('hits');
     /****************************/
 }
Example #21
0
 public function add_lesson(Request $request)
 {
     $inputs = Input::all();
     $rules = array('name' => 'required', 'content' => 'required');
     $validation = Validator::make($inputs, $rules);
     if ($validation->fails()) {
         exit('erreur');
     }
     $lesson = new Lesson();
     $lesson->user_id = Auth::user()->id;
     $lesson->name = e($request->input('name'));
     $lesson->date_start = e($request->input('date_start'));
     $lesson->content = $request->input('content');
     $lesson->category_id = e($request->input('category'));
     $lesson->save();
     $files = Input::file('images');
     $file_count = count($files);
     // start count how many uploaded
     $uploadcount = 0;
     foreach ($files as $file) {
         $rules = array('file' => 'required');
         //'required|mimes:png,gif,jpeg,txt,pdf,doc'
         $validator = Validator::make(array('file' => $file), $rules);
         if (!$validator->fails()) {
             $destinationPath = 'uploads';
             $extension = $file->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(11111, 99999) . '.' . $extension;
             // renameing image
             $upload_success = $file->move($destinationPath, $fileName);
             $uploadcount++;
             $media = new Media();
             $media->lesson_id = $lesson->id;
             $media->path = $fileName;
             $media->name = e($request->input('title_document'));
             $media->save();
         }
     }
     return Redirect::to('lessons/list');
 }
Example #22
0
                    <div style="margin:10px;">
                        {!! $entry->log !!}
                    </div>
                </div>
            </div>
        @endif
        <div>
            <div style="!important;text-align:left;background:#f7f7f7;margin:5px;border-bottom:2px solid #ccc;box-shadow:0 0 8px rgba(0, 0, 0, 0.1);">
                <h4 style="padding:10px;background-color:#2D8633;color:#fff;">Images</h4>
                <div style="padding:5px;">
                    @if(isset($entry->images))
                        <?php 
$images = \App\Media::getFiles("media/" . $entry['images']);
$c = 0;
foreach ($images as $image) {
    if (\App\Media::checkIfImage($image->getPath() . '/' . $image->getFilename())) {
        if ($c == 0) {
            echo '<div>';
        }
        ?>
                                <div style="margin:2px;width:calc(33.3333333333% - 4px);float:left;">
                                    <a class="image" style="width:100%;width:100%;" rel="group"
                                       href="{{URL::asset('/' . $image->getPath() . '/' . $image->getFilename())}}">
                                        <img style="width:100%;width:100%;"
                                             src="{{URL::asset('/' . $image->getPath() . '/' . $image->getFilename())}}"/>

                                        <div class="overlay"></div>
                                    </a>
                                </div>
                                <?php 
        if (++$c >= 3) {
 public function getImages()
 {
     $path = Input::get('path');
     if (Media::checkPath('media/' . $path)) {
         $it = Media::getFiles('media/' . $path);
         $result = array();
         foreach ($it as $file) {
             if (Media::checkIfImage($file->getPath() . '/' . $file->getFilename())) {
                 array_push($result, $file->getPath() . '/' . $file->getFilename());
             }
         }
         return response()->json($result);
     }
     return response()->json(false);
 }
Example #24
0
 public function delete($id)
 {
     \App\Media::where('id', $id)->delete();
     \App\EventMedia::where('mediaID', $id)->delete();
     \App\Series::leftJoin('media', 'series.seriesAbbreviation', '=', 'media.series')->where('media.series', NULL)->delete();
     return redirect('/');
 }
Example #25
0
 public static function getOglas($username = null, $slug)
 {
     $podaci = [];
     $podaci['oglas'] = Proizvod::join('stanje_proizvoda as s', 's.id', '=', 'proizvod.stanje_proizvoda_id')->join('korisnici as k', 'k.id', '=', 'proizvod.korisnici_id')->join('grad as g', 'g.id', '=', 'k.grad_id')->where('slug', $slug)->get(['proizvod.id', 'proizvod.naziv', 'slug', DB::raw('cena-(cena*popust/100) as cena'), 'kolicina', 'narudzba', 'zamena', 'vrsta_proizvoda_id', 's.naziv as stanje', 'korisnici_id', 'opis', 'proizvod.foto', 'username', 'prezime', 'ime', 'g.naziv as grad', 'k.telefon', 'stanje_oglasa_id'])->first();
     Pregledi::pregledanOglas($podaci['oglas']->id, ProdavnicaKO::getIP());
     $podaci['foto'] = Media::where('src', 'like', '/img/prodavnica/prodavnica-' . $podaci['oglas']->korisnici_id . '-' . $podaci['oglas']->id . '-%')->get();
     if (Auth::check()) {
         $podaci = $podaci + ['master' => 'administracija.master.osnovni', 'zelim' => ListaZelja::where('korisnici_id', Auth::user()->id)->where('proizvod_id', $podaci['oglas']->id)->where('aktivan', 1)->exists(), 'username' => Auth::user()->username, 'prijavljen' => 1];
     } else {
         $podaci = $podaci + ['master' => null, 'username' => null, 'prijavljen' => null, 'zelim' => null];
     }
     return view('oglas')->with($podaci);
 }
        <div class="two">
            <div id="imageSelector"></div>
            <script type="text/javascript">createMediaSelector('imageSelector', 'image', function() {
                    closeModal('imageModal') ;
                });
            </script>
        </div>
        <div class="two">
            <img class="imageview" style="max-width: 60%;max-height: 250px;padding-left:0%;" src="@if(isset($entry)){{URL('/media/' . $entry['image'])}}@else {{URL('images/empty.png')}}@endif" />
            <button class="Toevoegen" onclick="addMediaFolder();closeModal('imageModal');return false;" style="margin-top:15px;">Add</button>
            <button class="close" style="margin-top: 15px;" onclick="closeModal('imageModal');return false;">Cancel</button>
        </div>
    </div>
    <div id="imagesDiv">
        @if(isset($entry) && $entry['images'])
            <?php 
$images = \App\Media::getFiles("media/" . $entry['images']);
?>
            @foreach($images as $image)
                @if(\App\Media::checkIfImage($image->getPath() . '/' . $image->getFilename()))
                <div style="margin:2px;width:calc(33.3333333333% - 4px);float:left;">
                    <a class="image" rel="group" href="{{URL::asset('/' . $image->getPath() . '/' . $image->getFilename())}}">
                        <img style="width:100%;width:100%;" src="{{URL::asset('/' . $image->getPath() . '/' . $image->getFilename())}}" />
                        <div class="overlay"></div>
                    </a>
                </div>
                @endif
            @endforeach
        @endif
    </div>
</div>
Example #27
0
 public function store(Request $request)
 {
     $publish = 0;
     $private = 0;
     $id_parent = 0;
     $uri = "";
     $id_menu = $request['id_menu'];
     if ($request['publish'] == 'on') {
         $publish = 1;
     } else {
         $publish = 0;
     }
     if ($request['id_parent'] != "") {
         $id_parent = $request['id_parent'];
     }
     /******************************************************/
     switch ($request['option']) {
         case 'LinkTo':
             if ($request['uri'] != "") {
                 $uri = $request['uri'];
             }
             break;
         case 'LinkToSec':
             $id_section = $request['id_section_menu'];
             $Section = \App\cms_section::find($id_section);
             if ($id_section > 0) {
                 $uri = "Sec/" . $Section->uri;
             }
             break;
         case 'LinkToCatList':
             $id_section = $request['id_section_menu'];
             $Section = \App\cms_section::find($id_section);
             if ($id_section != "") {
                 $uri = "CatList/" . $Section->uri;
             }
             break;
         case 'LinkToCat':
             $id_category = $request['id_category_menu'];
             $Category = \App\cms_category::find($id_category);
             if ($id_category > 0) {
                 $uri = "Cat/" . $Category->uri;
             }
             break;
         case 'LinkToDocList':
             $id_category = $request['id_category_menu'];
             $Category = \App\cms_category::find($id_category);
             if ($id_category != "") {
                 $uri = "DocList/" . $Category->uri;
             }
             break;
         case 'LinkToDoc':
             $id_document = $request['id_document_menu'];
             $Document = \App\cms_document::find($id_document);
             if ($id_document > 0) {
                 $uri = "Doc/" . $Document->uri;
             }
             break;
         case 'LinkToGalList':
             $id_galleries = 1;
             $uri = "Galleries";
             break;
         case 'LinkToGallery':
             $id_galleries = $request['id_galleries'];
             $Gallery = \App\Media::find($id_galleries);
             if ($id_galleries > 0) {
                 $uri = "Gal/" . $Gallery->uri;
             }
             break;
         default:
             return null;
     }
     /*******************************************************/
     $file = $request->file('file');
     if ($file != "") {
         $path = 'store/MEN/' . uniqid() . '.' . $file->getClientOriginalExtension();
         //indicamos que queremos guardar un nuevo archivo en el disco local
         Storage::disk('local')->put($path, File::get($file));
         $ext = $file->getClientOriginalExtension();
     } else {
         $path = "";
         $ext = "";
     }
     if ($request['ChekPrivado'] == "on") {
         $private = 1;
     }
     /*******************************************************/
     $level = $request['level'];
     $size = $request['size'];
     //obtenemos el campo file definido en el formulario
     $flag = 1;
     $orderBy = DB::table('men_items')->where('active', '=', $flag)->where('id_menu', '=', $id_menu)->where('id_parent', '=', $id_parent)->max('order_by') + 1;
     \App\ItemMenu::create(['id_menu' => $id_menu, 'id_parent' => $id_parent, 'title' => $request['title'], 'description' => '', 'size' => $size, 'target' => $request['target'], 'uri' => $uri, 'img' => $path, 'ext' => $ext, 'level' => $level, 'order_by' => $orderBy, 'private' => $private, 'publish' => $publish, 'active' => '1', 'register_by' => Auth::User()->id, 'modify_by' => Auth::User()->id]);
     return redirect('/admin/itemmenu/' . $id_menu . '/' . $id_parent);
 }
 public function export2($project)
 {
     // increase group_concat maxinum length in mysql
     \DB::statement(\DB::raw("SET SESSION group_concat_max_len = 120000;"));
     //$anscolumns = \DB::select(\DB::raw("SELECT GROUP_CONCAT(CONCAT('GROUP_CONCAT(IF(ans.akey=\"',qa.slug,'\",ans.value,NULL)) AS ',QUOTE(`qa`.`akey`))) AS ans FROM questions qs,qanswers qa WHERE project_id=$project->id AND qa.qid=qs.id;"));
     $anscolumns = \DB::select(\DB::raw("SELECT GROUP_CONCAT(DISTINCT CASE WHEN (qa.type='radio') THEN qs.qnum ELSE qa.akey END) AS qkey, GROUP_CONCAT(CONCAT('ans.akey=\"',qa.slug,'\"') SEPARATOR ' OR ') AS ans FROM questions qs,qanswers qa WHERE project_id={$project->id} AND qa.qid=qs.id GROUP BY CASE WHEN (qa.type='radio') THEN qs.id ELSE qa.id END;"));
     //dd($anscolumns);
     $query = ['pcode.id', 'pcode.pcode', 'pcode.state', 'pcode.district', 'pcode.township', 'pcode.village', 'results.incident_id as response'];
     foreach ($anscolumns as $anscol) {
         $query[] = \DB::raw("GROUP_CONCAT(IF({$anscol->ans},ans.value,NULL)) AS '" . $anscol->qkey . "'");
     }
     //dd($query);
     $project_id = $project->id;
     $org_id = $project->org_id;
     $status = \App\PLocation::select($query)->where('pcode.org_id', '=', "{$project->org_id}")->leftjoin('results', function ($results) use($project) {
         $results->on('pcode.id', '=', 'results.resultable_id')->where('results.project_id', '=', $project->id);
     })->leftjoin('questions as qs', function ($questions) use($project) {
         $questions->where('qs.project_id', '=', $project->id);
     })->leftjoin('answers as ans', function ($answers) {
         $answers->on('ans.status_id', '=', 'results.id')->on('ans.qid', '=', 'qs.id');
     })->groupBy('pcode', 'response')->orderBy('pcode', 'ASC')->orderBy('response', 'ASC')->get();
     $status = $status->toArray();
     //dd($status);
     $filename = preg_filter('/[^\\d\\w\\s\\.]/', ' ', $project->name . Carbon::now());
     $file = Excel::create(str_slug($filename), function ($excel) use($status) {
         $excel->sheet('Sheetname', function ($sheet) use($status) {
             $sheet->fromArray($status);
         });
     });
     $store = $file->store('xls', false, true);
     // dd($store);
     //$file->setUseBOM(true);
     $storecsv = $file->store('csv', false, true);
     $media = Media::firstOrNew(['filename' => $store['title'], 'filedir' => $store['full']]);
     $media->filename = $store['title'];
     $media->filedir = $store['full'];
     $media->file = json_encode($store);
     $media->status = 1;
     $current_user = auth()->user();
     $media->owner()->associate($current_user);
     $media2 = Media::firstOrNew(['filename' => $storecsv['title'], 'filedir' => $storecsv['full']]);
     $media2->filename = $storecsv['title'];
     $media2->filedir = $storecsv['full'];
     $media2->file = json_encode($storecsv);
     $media2->status = 1;
     $media2->owner()->associate($current_user);
     $media2->save();
     if ($media->save()) {
         //return $file->download('xls');
         return true;
     }
     throw new GeneralException('There was a problem creating export data. Please try again.');
 }
Example #29
0
 public function order($id, $orderBy, $no)
 {
     // Actualizamos el registro con id
     $flag = 1;
     $this->setOrderItem($flag, $orderBy, $no);
     $media = \App\Media::find($id);
     $media->order_by = $no;
     $media->save();
     Session::flash('message', 'Ordén del Albúm actualizado');
     return redirect('/admin/media')->with('message', 'store');
 }
Example #30
0
            <input type="submit" value="All" name="filter" />
            <input type="submit" value="Mods" name="filter" />
            <input type="submit" value="Maps" name="filter" />
            <input type="submit" value="Scripts" name="filter" />
            <input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
        </form>
    </div>
    @if($entry->isEmpty())
        <h1 style="line-height:70px;font-size:23px;font-weight:100;">There's currently nothing to show here...</h1>
    @else
        @foreach ($entry as $project)
            <?php 
$images = \App\Media::getFiles("media/" . $project['images']);
$header = $images->getPath() . "/" . $images->getFilename();
foreach ($images as $img) {
    if (\App\Media::checkIfImage($img->getPath() . "/" . $img->getFilename())) {
        $header = $img->getPath() . "/" . $img->getFilename();
        break;
    }
}
?>
            <div class="three">
                <div class="panel">
                    <div class="panel-img">
                        <div style="height:200px;background:url({{URL::asset('/' . $header)}}) center center;background-size:cover;background-repeat:no-repeat;"></div>
                    </div>
                    <div class="panel-body" style="padding:5px;padding-bottom:5px;">
                        <h4><a id="{{$project->id}}">{{$project->title}}</a></h4>
                        <p>{!!str_limit($project->desc, 55, "...")!!}</p>
                    </div>
                    <a href="{{ URL::route('show_projects', ['name' => $project->name]) }}"><button>View</button></a>