<?php
/*
-------------------------------------------------------------------------
Link Class
A class to be used to handle Links.
-------------------------------------------------------------------------
Developer
Name -- Haddad Said.
Date -- 20-08-2005
Version -- 1.0
-------------------------------------------------------------------------
Member Functions
1.edit
2.delete
3.setName
4.getName
5.setUrl
6.getUrl
7.setVisits
8.getVisits
-------------------------------------------------------------------------
*/
class Link extends Entry
{
//Vars to hold attributes of the smilie
var $name;
var $url;
var $visits;
/*
-------------------------------------------------------------------------
Class Constructor
Parameters:
&db
id
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function Link(&$db, $id)
{
parent::Entry($db, $id);
$query = "SELECT link_name, link_url, link_visits
FROM tblLink WHERE link_id = " . $this->getId();
if($this->result = $this->db->doQuery($query))
{
$row = $this->result->getArray();
$this->setName($row['link_name']);
$this->setUrl($row['link_url']);
$this->setVisits($row['link_visits']);
}
else
{
return false;
}
}
/*
-------------------------------------------------------------------------
Function edit
Parameters:
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function edit()
{
$query = "UPDATE tblLink SET link_name = '" . $this->getName() . "',
link_visits = '" . $this->getVisits() . "',
link_url = '" . $this->getUrl() ."'
WHERE link_id = ". $this->getId();
if($this->result = $this->db->doQuery($query))
{
return true;
}
else
{
return false;
}
}
/*
-------------------------------------------------------------------------
Function delete
Parameters:
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function delete()
{
return(parent::delete("tblLink", "link_id"));
}
/*
-------------------------------------------------------------------------
Function setName
Parameters:
name
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function setName($name)
{
$this->name = $name;
}
/*
-------------------------------------------------------------------------
Function getName
Parameters:
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function getName()
{
return $this->name;
}
/*
-------------------------------------------------------------------------
Function setUrl
Parameters:
url
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function setUrl($url)
{
$this->url = $url;
}
/*
-------------------------------------------------------------------------
Function getUrl
Parameters:
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function getUrl()
{
return $this->url;
}
/*
-------------------------------------------------------------------------
Function setVisits
Parameters:
visits
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function setVisits($visits)
{
$this->visits = $visits;
}
/*
-------------------------------------------------------------------------
Function getVisits
Parameters:
Notes:
Example Usage:
-------------------------------------------------------------------------
*/
function getVisits()
{
return $this->visits;
}
}
?>