logoWebbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserv1-dice/exercises/dice7/

CDice.php
CDiceImage.php
CHistogram.php
css.css
dice-7.php
dicefaces_32x32.jpg

CDiceImage.php

43 lines ASCII Unix (LF)
<?php
/**
 * A CDiceImage class to show the dice with an image.
 *
 */
class CDiceImage extends CDice {

  
/**
   * Properties
   *
   */
  
const FACES = 6;

 
/**
  * Contructor
  */
 
public function __construct() {
   echo 
__METHOD__;
   
parent::__construct(self::FACES);
 }
 
 
/**
  * Destructor
  */
 
public function __destruct() {
   echo 
__METHOD__;
 }

  
/**
   * Get the rolls as a serie of images.
   *
   */
  
public function GetRollsAsImageList() {
    
$html = "<ul class='dice'>";
    foreach(
$this->rolls as $val) {
      
$html .= "<li class='dice-{$val}'></li>";
    }
    
$html .= "</ul>";
    return 
$html;
  }
}
?>