예제 #1
0
 public function events()
 {
     $tCalendarData = [];
     $tCalendarData['success'] = 1;
     // Calendar has no time zone conversion AND has no concept of daylight savings time. :(
     $Offset = 6 * 60 * 60 * 1000;
     // TODO:  Add from / to restraints
     $tVacations = \App\VacationRequest::all();
     foreach ($tVacations as $objVacation) {
         $tResult = [];
         $tResult['id'] = $objVacation->id;
         if ($objVacation->type == \App\VacationRequest::TYPE_HOLIDAY) {
             $tResult['class'] = 'event-special';
             $tResult['url'] = "/admin/vacations/holidays/edit/{$objVacation->id}";
             $tResult['title'] = "HOLIDAY: {$objVacation->comments}";
         } else {
             if ($objVacation->status == \App\VacationRequest::STATUS_DENIED) {
                 continue;
             }
             $tResult['class'] = $objVacation->status == \App\VacationRequest::STATUS_PENDING ? 'event-warning' : 'event-success';
             $PreText = $objVacation->status == \App\VacationRequest::STATUS_PENDING ? 'PENDING VACATION REQUEST' : 'APPROVED VACATION REQUEST';
             $tResult['url'] = "/admin/vacations/edit/{$objVacation->id}";
             $tResult['title'] = "{$PreText}: {$objVacation->User->name}: {$objVacation->comments}";
         }
         $tResult['start'] = (int) strtotime($objVacation->from) . '000' + $Offset;
         $tResult['end'] = (int) strtotime($objVacation->to) . '000' + $Offset;
         $tCalendarData['result'][] = $tResult;
     }
     $tClients = \App\User::clients()->get();
     foreach ($tClients as $objClient) {
         $tResult = [];
         $tResult['id'] = $objClient->id;
         $tResult['class'] = 'event-info';
         $tResult['url'] = "/admin/users/edit/{$objClient->id}";
         $tResult['title'] = "New Client Signup:  {$objClient->name}";
         $tResult['start'] = (int) strtotime($objClient->created_at) . '000' + $Offset;
         $tResult['end'] = (int) strtotime($objClient->created_at) . '000' + $Offset;
         $tCalendarData['result'][] = $tResult;
     }
     $tBlogPosts = \App\BlogPost::all();
     foreach ($tBlogPosts as $objPost) {
         $tResult = [];
         $tResult['id'] = $objPost->id;
         $tResult['class'] = 'event-info';
         $tResult['url'] = "/admin/blog/edit/{$objPost->id}";
         $tResult['title'] = "New Blog Post:  {$objPost->title}";
         $tResult['start'] = (int) strtotime($objPost->created_at) . '000' + $Offset;
         $tResult['end'] = (int) strtotime($objPost->created_at) . '000' + $Offset;
         $tCalendarData['result'][] = $tResult;
     }
     echo json_encode($tCalendarData);
     die;
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // create $countryList
     $countriesCount = DB::table('countries')->count();
     $numRows = 6;
     $numInColmn = $countriesCount / $numRows;
     $countryList = [];
     for ($i = 0; $i < $numRows; $i++) {
         $countries[$i] = Country::whereBetween('id', array($i * $numInColmn, ($i + 1) * $numInColmn))->get();
         $iplus = $i + 1;
         $countryList["countries{$iplus}"] = $countries[$i];
     }
     // create $featuredBlogs
     $featuredBlogs = Blog::featured()->recent()->get();
     // create $recentPosts
     $recentPosts = BlogPost::recent()->get();
     return view('pages.index', compact('countryList', 'numRows', 'featuredBlogs', 'recentPosts'));
 }
예제 #3
0
 public function index()
 {
     $tUpcomingVacations = \App\VacationRequest::upcomingvacations()->get();
     $tUpcomingHolidays = \App\VacationRequest::upcomingholidays()->get();
     $tVacationRequests = \App\VacationRequest::requests()->get();
     $tNewInvoices = \App\Invoice::perminvoices($this->objLoggedInUser)->new()->get();
     $tActiveGalleryImages = \App\GalleryImage::all();
     $tAllClients = \App\User::clients()->get();
     $BlogCount = \App\BlogPost::count();
     $tNewClients = \App\User::newclients()->get();
     View::share('tUpcomingVacations', $tUpcomingVacations);
     View::share('tUpcomingHolidays', $tUpcomingHolidays);
     View::share('tVacationRequests', $tVacationRequests);
     View::share('tNewInvoices', $tNewInvoices);
     View::share('tActiveGalleryImages', $tActiveGalleryImages);
     View::share('tAllClients', $tAllClients);
     View::share('BlogCount', $BlogCount);
     View::share('tNewClients', $tNewClients);
     return view('admin.index');
 }
예제 #4
0
 function all_news()
 {
     $tAllPosts = \App\BlogPost::all();
     View::share('tAllPosts', $tAllPosts);
     return view('all_news_entry');
 }
예제 #5
0
 /**
  * SCOPES
  */
 public function scopeRecent($query)
 {
     $rows = BlogPost::orderBy('id', 'desc')->take(5);
     return $rows;
 }
예제 #6
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     // Hole bestimmten Blogpost
     $post = BlogPost::find($id);
     // TODO: return statement hinzufügen, $post an richtige show-View übergeben
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Blog $blog, BlogPost $blogPost)
 {
     $blogPost->delete();
     return Redirect::route('blog.edit', ['blog' => getUrlForThisName($blog)]);
 }
예제 #8
0
 public function store()
 {
     if (!$this->objLoggedInUser->HasPermission('Edit/Blog')) {
         abort('404');
     }
     $Input = Request::all();
     $File = Request::file('Image');
     $objPost = $Input['PostID'] ? \App\BlogPost::findOrFail($Input['PostID']) : new \App\BlogPost();
     if ($File) {
         $FileExtension = $File->getClientOriginalExtension();
         $FilePath = public_path() . '/img/blog_images/' . uniqid() . ".{$FileExtension}";
         $tPaths = explode('/', $FilePath);
         $Filename = array_pop($tPaths);
         $FileDir = implode('/', $tPaths);
         if ($File->move($FileDir, $Filename)) {
             if ($objPost->image_filename) {
                 // Remove old file
                 File::delete(public_path() . '/img/blog_images/' . $objPost->image_filename);
             }
             $objPost->image_filename = $Filename;
         }
     }
     $objPost->title = $Input['title'];
     $objPost->entry = $Input['entry'];
     $objPost->css = $Input['css'];
     $objPost->save();
     $Path = Request::get('submit') == 'Save' ? '' : "/edit/{$objPost->id}";
     return redirect("/admin/blog{$Path}")->with('FormResponse', ['ResponseType' => static::MESSAGE_SUCCESS, 'Content' => 'Blog saved successfully']);
 }