Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Chithra-J committed May 12, 2016
1 parent 6554c1a commit ba7731b
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 68 deletions.
20 changes: 4 additions & 16 deletions app/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace P4\Http\Controllers;
require __DIR__ . '/../../../vendor/autoload.php';
//require __DIR__ . '/../../../vendor/danielboendergaard/phantom-pdf/src/PdfGenerator.php';
use P4\Http\Controllers\Controller;
use Illuminate\Http\Request;
use P4\Http\Requests;
use Auth;
use Knp\Snappy\Pdf;


use Illuminate\Support\Facades\Input;

class EventsController extends Controller {
public function getEventsProfile() {
Expand All @@ -28,20 +29,7 @@ public function getViewEvent($id) {
-> with('events', $events)
-> with('child', $child);
}
public function getEventsReport($id) {
$path=public_path().'\assets\reports\github.pdf';
$parent = \P4\User::find(Auth::user() -> id);
$view = view('parents.create') -> with(['parent' => $parent]);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$bin_path=base_path().'\vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf.exe';
} else if (strtoupper(substr(PHP_OS, 0, 3)) === 'LINUX') {
$bin_path=base_path().'\vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf.exe';
}
dump($bin_path);
$myProjectDirectory = '/path/to/my/project';
$snappy = new Pdf($bin_path);
$snappy->generateFromHtml('<p>Some content</p>', 'test.pdf');
}

public function getCreateEvent($id) {
$child = \P4\Child::find($id);
return view('events.create')
Expand Down
1 change: 0 additions & 1 deletion app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
Route::get('/events/confirm-removeEvent/{id?}', 'EventsController@getRemoveEvent');
Route::get('/events/removeEvent/{id?}', 'EventsController@postRemoveEvent');

Route::get('/events/createEventsReport/{id?}', 'EventsController@getEventsReport');


});
5 changes: 3 additions & 2 deletions public/assets/js/events/view.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
$(document).ready(function() {
$("footer div.navbar.nav-footer").removeClass("navbar-fixed-bottom");
$("ul.nav > li >").find(".active").removeClass("active");
$('#editEvent').addClass("active");
$('#editEvent').addClass("active");
});
$('#sidebar').affix({
offset : {
top : 100
}
});

$(".btn[data-toggle='collapse']").click(function() {
if ($(this).text() == 'Less Details') {
$(this).text('More Details');
} else {
$(this).text('Less Details');
}
});
});
55 changes: 39 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
# Laravel PHP Framework
# Dynamic Web Applications - Project P4

[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)
[![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework)
[![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)
Project P4 is bring together a fully functioning web application that uses PHP, Laravel, and a database.

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
1. Creating a new Laravel web application.

Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
1.1 "Clap Event" are focused for parent who want to track their kid's accomplishments. This website gives the user to create profile for themself, their children
and the events that they are participating. Parents have the flexibility to record events that happened in past or create events that are upcoming to tracks. The events can be anything that he child
participates in, it could be an academic event or sports or something else.

## Official Documentation
2. Installing and using Composer packages.

2.1 kartik-v/bootstrap-fileinput for uploading profile picture.

Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
3. Routing basics - Used routes with basic routes parameters passed to the controller. The controller have the methods implemented that was reffered in the routes file.
HTTP request is used to get current instance of request and validation is applied before executing post.

4. Views: Blade templates used for rendering of web pages.

4.1 In addition used
4.1.1 Bootstrap for the advanced styling and faster responsiveness
4.1.2 jQuery is used to handle dynamic content delivery
4.4.2.1 handle profile picture upload.
4.4.2.2 handle accordion toggle event for showing different event a child participate.

5. Database CRUD operation: Performed for the following action upon 3 tables (Users, Children and Events)

5.1 A new user is created when they register through the site and they can update their profile with profile picture
5.2 Every logged user can add new child, edit and remove from their profile
5.3 Events can be created, updated, deleted and displayed(read).

## Contributing
6. Refrences
5.1 Foobook web application from this course
5.2 Image for default user profile picture is from www.relevantmagazine.com

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
7. Deploying a Laravel app on a live server.

## Security Vulnerabilities
#### NOTE: The profile picture will be stored based on the user id under public/assets/uploads/ . For fresh install, make sure that directory is writeable.

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at [email protected]. All security vulnerabilities will be promptly addressed.
## Live URL of the project

## License
Live URL of the project can be found [here](http://P4.chanchika.me/).

The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
## Demo

Link to screencast demo can be found [here](http://www.screencast.com/users/Chithra_Jayakumar/folders/DWA/media/07a44d4f-3d25-4eae-9425-39126c83d896).
67 changes: 67 additions & 0 deletions resources/views/events/report.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@extends('layouts.master')

@section('title')
Clap Events - Deleting Event for {{ $child_firstname }}
@stop

@section('header')

@stop

@section('content')
<section>
<div class="container">
<input type='hidden' name='_token' value='{{ csrf_token() }}'>
<div class="col-sm-10">
<br>
<div class="panel">
<div class="panel-heading">
<h3 class="panel-title">Removing {{ $event->event_name }} event from {{ $child_firstname }}'s profile </h3>
</div>
<div class="panel-body">
<div class="row">
<div class=" col-md-12 col-lg-12 ">
<table class="child-table table table-user-information">
<thead>
<tr>
<td>FirstName</td>
<td>Event Name</td>
<td>Event Date</td>
<td>Level</td>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $child_firstname }}</td>
<td>{{ $event->event_name }}</td>
<td>{{ $event->event_date }}</td>
<td>{{ $event->level }}</td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="center-text col-md-12 ">
<p><strong>
Are you sure you want to remove this event for <em>{{$child_firstname}}</em>?
</strong></p>
<p>
<strong><a href='/events/removeEvent/{{$event->id}}' class="btn btn-primary btn-sm ">
&nbsp;&nbsp;&nbsp;Yes, remove&nbsp;</a></strong>
</p>
<p>
<a href='{{ url('/events/create') }}' class="btn btn-primary btn-sm" id="btn-next">No, I want to keep this event for <em>{{$child_firstname}}!</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@stop

@section('body')
<script src="/assets/js/events/remove.js"></script>
@stop
27 changes: 12 additions & 15 deletions resources/views/events/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,18 @@
<a href='{{ url('/events/create') }}' class="btn btn-primary btn-sm" id="btn-next">Go Back</a>
&nbsp;&nbsp;&nbsp;
<a href="/events/createEvent/{{$child->id}}" class="btn btn-primary btn-sm" >Add an Event
</a>&nbsp;&nbsp;&nbsp;
<!-- strech goal
<a href="/events/createEventsReport/{{$child->id}}" class="btn btn-primary btn-sm" >Create PDF Report
</a>-->

</div>

</div>

<br>

<br>

</a>&nbsp;&nbsp;&nbsp;
</div>
</div>
<br>
<br>
<div class="col-md-12">
<p><strong>
Click on the event (if any listed below) to see the details of the event for <em>{{$child->firstname}}</em>
</strong></p>
<?php $id_count = 1; ?>
<?php
$id_count = 1;
?>
<div class="accordion" id="accordionid">
<div class="accordion-group">
@foreach ($events as $event)
Expand Down Expand Up @@ -106,7 +100,9 @@
</div>
<br>
<?php $id_count++; ?>
@endforeach
@endforeach


</div>
</div>
</div>
Expand All @@ -115,6 +111,7 @@
</div>
</div>
</div>

</section>
@stop

Expand Down
19 changes: 1 addition & 18 deletions resources/views/parents/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,7 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password:</label>
<div class="col-md-8">
<input class="form-control" type="password" name='password' value=''>
<div class='error'>
{{ $errors->first('password') }}
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Confirm password:</label>
<div class="col-md-8">
<input class="form-control" type="password" name='confirm_password' value=''>
<div class='error'>
{{ $errors->first('confirm_password') }}
</div>
</div>
</div>

<div class="form-group">
<div class="col-md-11 center-text">
<input type="submit" class="btn btn-primary" value="Save Changes">
Expand Down

0 comments on commit ba7731b

Please sign in to comment.