Please i need help with with this php files, the css does not have to look like in the screen shot in the button.
Create a file named paint.class.php and within it define a class named Paint, which has the following private properties:
imgName
title
artist
year
gender
paintID
Define a static member variable named id, which will be used to set each instance’s paintID value and then be incremented, all inside the class constructor.
Create a constructor that takes in imgName, title, artist, year and gender.
Implement __toString() method that should return this paints info (imgName, title, artist, year, paintID and gender).
Create getter and setter methods for all the variables, except for paintID create only getter method.
You are being given paintings.php (all in html) and painting.css. Edit paintinngs.php to make use of the Paint class. Inside paintings.php you will have to create five objects of the Paint class.
Note: You will have to add the last column (Painting Summary) to the table. The content of the column is the return value of __toString() method.
2 files to create,
paintings.php
paint.class.php
Here is a screen shot of how your final page will looks like:
thanks
paintings.php
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<title>Chapter 4</title>
<link rel="stylesheet" href="paintings.css"
/>
</head>
<body>
<div id="artistBox">
<table>
<caption>Paintings</caption>
<thead>
<tr>
<th colspan="2"></th>
<th scope="col">Title</th>
<th scope="col">Artist</th>
<th scope="col">Year</th>
<th scope="col">Genre</th>
<th>Painting Summary</th>
</tr>
</thead>
<tbody>
<?php
include
'paint.class.php';
$paint1 =
new Paint("images/05030.jpg", "Death of Marat", "David,
Jacques-Louis", "1793", "Romanticism");
$paint2 =
new Paint("images/120010.jpg", "Portrait of Eleanor of Toledo",
"Bronzino, Agnolo", "1545", "Mannerism");
$paint3 =
new Paint("images/07020.jpg", "Liberty Leading the People",
"Delacroix, Eugene", "1830", "Romanticism");
$paint4 =
new Paint("images/13030.jpg", "Arrangement in Grey and Black",
"Whistler, James Abbott", "1871", "Realism");
$paint5 =
new Paint("images/06010.jpg", "Mademoiselle Caroline Riviere",
"Ingres, Jean-Auguste ", "1806", "Neo-Classicism");
$paintingsArray = array($paint1, $paint2, $paint3, $paint4,
$paint5);
foreach
($paintingsArray as $painting)
{
$image = $painting->getImgName();
$title = $painting->getTitle();
$artist = $painting->getArtist();
$year= $painting->getYear();
$genre = $painting->getGenre();
$description = $painting->__toString();
$uid = $painting->getPaintID();
echo "<tr><td><input type='checkbox' name='index[]'
value='$uid' /></td>
<td scope='col'><img src=$image></td><td
id='italics' scope='col'>$title</td>
<td scope='col'>$artist</td><td
scope='col'>$year</td><td
scope='col'>$genre</td>
<td scope='col'>$description</td></tr>";
}
?>
</tbody>
</table>
</div>
</body>
</html>
paint.class.php
<?php
class Paint
{
private $imgName;
private $title;
private $artist;
private $year;
private $genre;
private $paintID;
public static $id = 100;
function __construct($imgName, $title,
$artist, $year, $genre)
{
$this->imgName = $imgName;
$this->title = $title;
$this->artist = $artist;
$this->year = $year;
$this->genre = $genre;
$this->paintID = self::$id;
self::$id++;
}
//Getter functions
public function getImgName() { return
$this->imgName; }
public function getTitle() { return
$this->title; }
public function getArtist() { return
$this->artist; }
public function getYear() {
return $this->year; }
public function getGenre() { return
$this->genre; }
public function getPaintID() { return
$this->paintID;}
//Setter functions
public function setImgName($imgName)
{$this->imgName = $imgName;}
public function setTitle($title)
{$this->title = $title;}
public function setArtist($artist)
{$this->artist = $artist;}
public function setYear($year) {$this->year =
$year;}
public function setGenre($genre)
{$this->genre = $genre;}
public function __toString()
{
$stringValue =
$this->getPaintID() . '<br>' . $this->getImgName() .
'<br>' . $this->getTitle() . '<br>' .
$this->getArtist() . '<br>' . $this->getYear();
return $stringValue;
}
}
?>
paintings.css
/* general text formatting */
h1, h2, h3, nav, footer {
font-family: Georgia, Cambria, "Times New Roman", serif;
}
body {
font-family: "Lucida Sans", Verdana, Arial,
sans-serif;
font-size: 80%;
}
div#searchBox, div#settingsBox, div#artistBox {
margin: 0.25em auto;
background-color: #EBF4FB;
padding: 1em;
border: 1pt solid #95BEF0;
width: 80%;
}
div#searchBox { margin-top: 1em; }
div#artistBox {
margin-top: 1em;
background-color: #FAFCFF;
}
table {
border: collapse;
border-spacing: 0;
}
#italics{font-style: italic;}
table tbody td{
border-top: 1pt solid #95BEF0;
line-height: 1.5em;
vertical-align: middle;
padding: 0.5em 0.75em;
}
table thead th {
text-align: left;
padding: 0.25em 0.75em;
}
table thead {
background-color: #EBF4FB ;
}
table tbody td:first-child {
text-align: center;
padding: 0.5em 0em;
}
caption {
background-color: #95BEF0;
padding: 0.5em 0.5em;
font-weight: bold;
font-size: 1.2em;
}
Please i need help with with this php files, the css does not have to look...