[3526] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * eGroupWare - Addressbook - importexport |
---|
| 4 | * |
---|
| 5 | * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
---|
| 6 | * @package addressbook |
---|
| 7 | * @subpackage importexport |
---|
| 8 | * @link http://www.egroupware.org |
---|
| 9 | * @author Cornelius Weiss <nelius@cwtech.de>, Knut Moeller <k.moeller@metaways.de> |
---|
| 10 | * @copyright Cornelius Weiss <nelius@cwtech.de>, Knut Moeller <k.moeller@metaways.de> |
---|
| 11 | * @version $Id: class.phpgw_addressbook_record.inc.php 22827 2006-11-10 15:35:35Z nelius_weiss $ |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | require_once(PHPGW_INCLUDE_ROOT. '/importexport/inc/class.iface_phpgw_record.inc.php'); |
---|
| 15 | require_once(PHPGW_INCLUDE_ROOT. '/timesheet/inc/class.botimesheet.inc.php'); |
---|
| 16 | |
---|
| 17 | /** |
---|
| 18 | * class phpgw_addressbook_record |
---|
| 19 | * compability layer for iface_phpgw_record needet for importexport |
---|
| 20 | */ |
---|
| 21 | class phpgw_timesheet_record implements iface_phpgw_record |
---|
| 22 | { |
---|
| 23 | |
---|
| 24 | private $identifier = ''; |
---|
| 25 | private $timesheetentry = array(); |
---|
| 26 | private $botimesheet; |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | /** |
---|
| 31 | * constructor |
---|
| 32 | * reads record from backend if identifier is given. |
---|
| 33 | * |
---|
| 34 | * @param string $_identifier |
---|
| 35 | */ |
---|
| 36 | public function __construct( $_identifier='' ){ |
---|
| 37 | $this->identifier = $_identifier; |
---|
| 38 | $this->botimesheet = new botimesheet(); |
---|
| 39 | $this->timesheetentry = $this->botimesheet->read($this->identifier); |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * magic method to set attributes of record |
---|
| 44 | * |
---|
| 45 | * @param string $_attribute_name |
---|
| 46 | */ |
---|
| 47 | public function __get($_attribute_name) { |
---|
| 48 | |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | /** |
---|
| 52 | * magig method to set attributes of record |
---|
| 53 | * |
---|
| 54 | * @param string $_attribute_name |
---|
| 55 | * @param data $data |
---|
| 56 | */ |
---|
| 57 | public function __set($_attribute_name, $data) { |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * converts this object to array. |
---|
| 63 | * @abstract We need such a function cause PHP5 |
---|
| 64 | * dosn't allow objects do define it's own casts :-( |
---|
| 65 | * once PHP can deal with object casts we will change to them! |
---|
| 66 | * |
---|
| 67 | * @return array complete record as associative array |
---|
| 68 | */ |
---|
| 69 | public function get_record_array() { |
---|
| 70 | return $this->timesheetentry; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | /** |
---|
| 74 | * gets title of record |
---|
| 75 | * |
---|
| 76 | *@return string title |
---|
| 77 | */ |
---|
| 78 | public function get_title() { |
---|
| 79 | // TODO get_record gibts nicht ? |
---|
| 80 | // if (empty($this->timesheetentry)) { |
---|
| 81 | // $this->get_record(); |
---|
| 82 | // } |
---|
| 83 | return $this->timesheetentry['ts_project'] . ' - ' . $this->timesheetentry['ts_title']; |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * sets complete record from associative array |
---|
| 88 | * |
---|
| 89 | * @todo add some checks |
---|
| 90 | * @return void |
---|
| 91 | */ |
---|
| 92 | public function set_record(array $_record){ |
---|
| 93 | $this->timesheetentry = $_record; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | * gets identifier of this record |
---|
| 98 | * |
---|
| 99 | * @return string identifier of current record |
---|
| 100 | */ |
---|
| 101 | public function get_identifier() { |
---|
| 102 | return $this->identifier; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * saves record into backend |
---|
| 107 | * |
---|
| 108 | * @return string identifier |
---|
| 109 | */ |
---|
| 110 | public function save ( $_dst_identifier ) { |
---|
| 111 | |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | /** |
---|
| 115 | * copies current record to record identified by $_dst_identifier |
---|
| 116 | * |
---|
| 117 | * @param string $_dst_identifier |
---|
| 118 | * @return string dst_identifier |
---|
| 119 | */ |
---|
| 120 | public function copy ( $_dst_identifier ) { |
---|
| 121 | |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | /** |
---|
| 125 | * moves current record to record identified by $_dst_identifier |
---|
| 126 | * $this will become moved record |
---|
| 127 | * |
---|
| 128 | * @param string $_dst_identifier |
---|
| 129 | * @return string dst_identifier |
---|
| 130 | */ |
---|
| 131 | public function move ( $_dst_identifier ) { |
---|
| 132 | |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | /** |
---|
| 136 | * delets current record from backend |
---|
| 137 | * |
---|
| 138 | */ |
---|
| 139 | public function delete () { |
---|
| 140 | |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | /** |
---|
| 144 | * destructor |
---|
| 145 | * |
---|
| 146 | */ |
---|
| 147 | public function __destruct() { |
---|
| 148 | unset ($this->botimesheet); |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | } // end of phpgw_timesheet_record |
---|
| 152 | ?> |
---|