Question

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:

O Q Chapter 4 C localhost: 8888/mab6/paintings.php Apps D2L Brightspace L... E Microsoft My Account JourneyEd.com: Di... Ba mported HIBuyfoam S computer science... B MobileApps MDE K Home: Explore M Paintings Title Artist Year Genre Painting Summary 100 images /05030 jpg Death of Marat David, Jacques-Louis 793 Romanticism Death of Marat David, Jacques-Louis 1973 101 images/120010jpg Portrait of Eleanor of Toledo Bronzino, Agnolo 545 Mannerism Portrait of Eleanor of Toledo Bronzino, Agnolo 545 102 images/07020jpg Liberty Leading the People 830 Romanticism Leberty Leading the People Delacroix, Eugene Delacroix, Eugene 1830 103 images /13030jpg Arrangement in Grey and Black Whistler, James Abbott 1871 Realism Arrangement in Grey and Black Whistler, James Abbott 1871 104 images /06010jpg Mademoiselle Caroline Riviere ngres, Jean-Auguste 806 Neo-Classicism Modemoiselle Caroline Riviere Ingres, Jean-AUguste 1806 Zakaria Other Bookmarks

thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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;
}

Add a comment
Know the answer?
Add Answer to:
Please i need help with with this php files, the css does not have to look...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT