Location: PHPKode > projects > Jarida > jarida_1.0/classes/Smilie.php
<?php
                                                                                                                       
/*
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Smilie Class
      A class to be used to handle Smilies.
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Developer
      Name -- Haddad Said.
      Date -- 24-08-2004
      Version -- 0.2
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Member Functions
     
      2.edit
      3.delete
      4.view
      5.setCode
      6.getCode
      7.setFile
      8.getFile
     

-------------------------------------------------------------------------
                                                                                                                             
*/


class Smilie extends Entry
{

  //Vars to hold attributes of the smilie
  var $code;
  var $file;



  /*

-------------------------------------------------------------------------
Class Constructor
      
Parameters:
      &db
      id


Notes:
      

Example Usage:
     
-------------------------------------------------------------------------

  */

  function Smilie(&$db, $id)
  {
    parent::Entry($db, $id);
    $query = "SELECT smilie_code, smilie_file FROM tblSmilie WHERE smilie_id = " . $this->getId();

    if($this->result = $this->db->doQuery($query))
      {
	$row = $this->result->getArray();
	$this->setCode($row['smilie_code']);
	$this->setFile($row['smilie_file']);
      }
    else
      {
	return false;
      }
  }



  /*

-------------------------------------------------------------------------
Function edit
      
Parameters:
     

Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */

  function edit()
  {
    $query = "UPDATE tblsmilie SET smilie_code = '" . $this->getCode() . "', smilie_file = '" . $this->getFile() ."'
              WHERE smilie_id = ". $this->getId();

    if($this->result = $this->db->doQuery($query))
      {
	return true;
      }
    else
      {
	return false;
      }
  }


  /*

-------------------------------------------------------------------------
Function delete
      
Parameters:


Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */

  function delete()
  {
    if(unlink("../img/" . $this->getFile()))
      {
		return(parent::delete("tblsmilie", "smilie_id"));
      }
    else
      {
		return false;
      }
  }



  /*

-------------------------------------------------------------------------
Function setCode
      
Parameters:
      code

Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */

  function setCode($code)
  {
    $this->code = $code;
  }


  /*

-------------------------------------------------------------------------
Function getCode
      
Parameters:
      

Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */

  function getCode()
  {
    return $this->code;
  }



  /*

-------------------------------------------------------------------------
Function setFile
      
Parameters:
      file

Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */

  function setFile($file)
  {
    $this->file = $file;
  }



  /*

-------------------------------------------------------------------------
Function getFile
      
Parameters:
      

Notes:
      

Example Usage:

-------------------------------------------------------------------------

  */


  function getFile()
  {
    return $this->file;
  }



}



?>
Return current item: Jarida