TP Integration of Web Application
TP Integration of Web Application
كلية التكنولوجيا
1
TP-1-
A series of checkbox items are used to select weather values in Arrays. (Those values
are: rain, sunshine, clouds, hail, snow, TS.)
a) Write a php page “p01_cls.php” that displays all elements of the given array with
checkboxes values.
c) When a user selects the weather phenomena and click the button bulletin
2
TP-2-
a) Create an array called $months in (“p02_cls.php”). Use the names of the
months as keys, and the number of days for each month as values. This
page should also contains two functions:
b) Once again, you might be requesting the user to choose a particular month
the lists of months. Create a form “p02_frm.php” to a certain user through
which he can select a month.
c) Once he clicks on the button check it!, the page “p02_trt.php” displays the
following statement: "The month of January has 31 days.
3
TP-3-
a) Create a php page “p03_cls.php” that calculates the Surface Area of a Circle, this
page contains a class that is constituted of data and functions:
class MyCircle
{
// ----------------DATA-------------------------
public $radius;
// ----------------Functions--------------------
public function __construct
public function setRadius ($radius)
public function getRadius()
public function getArea()
}
b) Create a form “p03_frm.php” for a certain user through which he can input a
radius value with a button “get surface” as shown in the following figure:
c) Once he clicks on the button “get surface”, the page “p03_trt.php” uses
class MyCircle in order to calculate the area of a given circle’s radius.
Moreover, this page should return the following result.
4
TP-4-
The first page “p04_cls.php” contains the following class:
a) The second php page “p04_frm.php” should contain form with text box and
function JS: showID(student)
5
c) TP-5-
Given the following emp table:
c) Use the below interface p05_frm.php” through which a user can Insert,
calculate the Sum of salaries by job and Search by ID for an employee as
was given in the following figure:
a. Do net check box at first window during set up about developer mode as shown
below:
7
b. In the setting window choose:
Click next…
9
10
Part 1: Create user Application
1. php artisan serve
http://127.0.0.1:8000
2. http://127.0.0.1:8000/login
Error: Pages are not registered in the web.php file
4. http://127.0.0.1:8000/login
login page is well displayed
6. .env: Modify the first line to “sqlite” and delete the others
C:\p1_wissam_init\website_wissam\
After configure the “.env” file re type the above command and you should get the following result
in C:\Prof\p1_wissam\website_wissam\database\migrations
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (0.02 seconds)
11
Part 2: Create Tasks Application
7. Modify the two mentioned Models (User&Tasks) so as : User has many Tasks:
User.php: public function manytasks() {
return $this->hasMany(tasks::class);
}
Tasks.php : public function oneUser(){
return $this->belongsTo(User::class);
}
9. LoginController.php and RegisterController.php
On around Line 28, you will find code
“protected $redirectTo = ‘/home’; Change it to “protected $redirectTo = ‘/’;”
Note: in the next section of the tutorial each views that have been programmed, in order to
test it, you should start form the login / logout views.
12
Part 3: Programing
TasksController.php
5_Display.blade
13
6_Add.blade.php: Add Tasks for a certain user
Web.php:
TasksController.php
6_Add.blade
Web.php:
TasksController.php
14
7_Update.blade.php: Modify Tasks for a certain user
Note in : 5_Display.blade
Web.php:
TasksController.php
7_Update.blade.php
Web.php:
TasksController.php
15