Documentation is available at customer.php
- <?php
- /**
- * Class helpdeskUser, helpdeskCustomer
- * @package helpdesk
- * Copyright OSI 2005. All rights reserved.
- * It is expected that version 1.0 will be GPLed, but this interim work
- * is kept closed until 1.0 is ready.
- */
- $_customer_saved_er = error_reporting(E_ALL || E_STRICT) ;
- /**
- * import ancillary functions
- */
- require_once("misc.php") ;
- /**
- * Helpdesk user implementation
- * @package helpdesk
- */
- class helpdeskUser
- {
- public $uid ; // Link to core user object
- public $uidCustomer ; // Link to helpdeskCustomer managing the user
- public $customerName;
- /**
- * initialize properties from uid for existing HD user
- * @param int $uid
- * @return void
- */
- function init($uid)
- {
- if (($this->uid == $uid) && (isset($this->uidCustomer)))
- {
- // No need to reload
- return ;
- }
- $this->uid = $uid ;
- $q = '
- SELECT
- u.uid, u.name
- FROM
- {hd_user} hdu
- LEFT JOIN {users} u ON hdu.uidcustomer = u.uid
- WHERE
- hdu.uid = %d
- ' ;
- $res = db_query($q, $uid);
- $o = db_fetch_object($res);
- if (is_object($o) && isset($o->uid))
- {
- $this->uidCustomer = $o->uid;
- $this->customerName = $o->name;
- }
- unset($o);
- unset($res);
- }
- }
- /**
- * Helpdesk customer implementation
- * @package helpdesk
- */
- class helpdeskCustomer extends helpdeskUser
- {
- /**
- * @return array
- * @desc Returns the nids of all contracts attached to the customer
- */
- function nidContracts ()
- {
- $ret = helpdeskContract::getContractsByUid($this->uid) ;
- return $ret ;
- }
- /**
- * gets the list of users bound to a customer account
- * @return array uid/name pairs
- */
- function uidUsers ()
- {
- $q = '
- SELECT
- u.uid, u.name
- FROM
- {hd_user} hdu
- LEFT JOIN {users} u ON hdu.uid = u.uid
- WHERE
- hdu.uidcustomer = %d
- ORDER BY
- 2, 1
- ';
- $res = db_query($q, $this->uid);
- while ($o = db_fetch_object($res))
- {
- // Assigning directly in the while() instruction would add one loop pass with a null value
- $ret[] = $o;
- }
- return $ret ;
- }
- }
- error_reporting($_customer_saved_er) ;
- unset($_customer_saved_er) ;
- ?>
Documentation generated on Tue, 01 Nov 2005 23:14:59 +0100 by phpDocumentor 1.3.0RC3