| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* @package helpdesk
|
| 4 |
* Copyright OSI 2005. Licensed under GPL version 2.
|
| 5 |
* $Id$
|
| 6 |
*/
|
| 7 |
|
| 8 |
abstract class helpdeskObject
|
| 9 |
{
|
| 10 |
/**
|
| 11 |
* initialize existing class instance from passed values
|
| 12 |
*
|
| 13 |
* @param object $node Node from which data is taken (always nid, the rest depending on $fromDB)
|
| 14 |
* @param boolean $fromDB Is data to be taken from the DB or from $node ?
|
| 15 |
* @return void
|
| 16 |
*/
|
| 17 |
abstract function init($node, $fromDB);
|
| 18 |
|
| 19 |
/**
|
| 20 |
* implement the equivalent of hook_view for the class, but return the produced HTML
|
| 21 |
* instead of modifying the node
|
| 22 |
* @return string HTML for the class representation
|
| 23 |
*
|
| 24 |
*/
|
| 25 |
abstract function view();
|
| 26 |
|
| 27 |
/**
|
| 28 |
* implement the equivalent of hook_form for the class
|
| 29 |
* @param object $node
|
| 30 |
* @return string HTML for the class edition form
|
| 31 |
*
|
| 32 |
*/
|
| 33 |
abstract function form();
|
| 34 |
|
| 35 |
/**
|
| 36 |
* implementation of hook_node_name for HD content objects
|
| 37 |
* @return string
|
| 38 |
*/
|
| 39 |
function node_name()
|
| 40 |
{
|
| 41 |
|
| 42 |
$className = get_class($this);
|
| 43 |
if (HELPDESKDEBUGALLFUNCTIONS == TRUE)
|
| 44 |
{ echo "<pre>HD $className::node_name ()</pre>" ; }
|
| 45 |
|
| 46 |
switch ($className)
|
| 47 |
{
|
| 48 |
case 'helpdeskContract': $ret = HELPDESKNODECONTRACT ; break ;
|
| 49 |
case 'helpdeskTicket': $ret = HELPDESKNODETICKET ; break ;
|
| 50 |
case 'helpdeskFollowup': $ret = HELPDESKNODEFOLLOWUP ; break ;
|
| 51 |
default:
|
| 52 |
die("node_name method invoked for instance of class $className, should not happen.") ;
|
| 53 |
}
|
| 54 |
return $ret;
|
| 55 |
}
|
| 56 |
}
|
| 57 |
|
| 58 |
?>
|