00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 require_once dirname(__FILE__) . '/DataAccess.php';
00026
00027
00028
00029
00043
00044 class FF_Model {
00045
00046
00051 var $o_dataAccess;
00052
00057 var $id;
00058
00059
00060
00061
00068 function FF_Model()
00069 {
00070 $this->_initDataAccess();
00071 }
00072
00073
00074
00075
00082 function reset()
00083 {
00084
00085 }
00086
00087
00088
00089
00099 function remove($in_id = null)
00100 {
00101 $s_id = is_null($in_id) ? $this->getId() : $in_id;
00102 return $this->o_dataAccess->remove($s_id);
00103 }
00104
00105
00106
00107
00116 function save($in_isUpdate)
00117 {
00118 if ($in_isUpdate) {
00119 return $this->o_dataAccess->update($this->exportToArray());
00120 }
00121 else {
00122 $this->setId($this->o_dataAccess->getNextId());
00123 return $this->o_dataAccess->add($this->exportToArray());
00124 }
00125 }
00126
00127
00128
00129
00139 function importFromArray($in_data)
00140 {
00141
00142 }
00143
00144
00145
00146
00155 function exportToArray()
00156 {
00157
00158 }
00159
00160
00161
00162
00171 function fillById($in_id)
00172 {
00173 $this->reset();
00174 $a_data = $this->o_dataAccess->getDataByPrimaryKey($in_id);
00175 if (count($a_data) == 0) {
00176 return false;
00177 }
00178 else {
00179 $this->importFromArray($a_data);
00180 return true;
00181 }
00182 }
00183
00184
00185
00186
00193 function getId()
00194 {
00195 return $this->id;
00196 }
00197
00198
00199
00200
00209 function setId($in_id)
00210 {
00211 $this->id = $in_id;
00212 }
00213
00214
00215
00216
00223 function &getDataAccessObject()
00224 {
00225 return $this->o_dataAccess;
00226 }
00227
00228
00229
00230
00239 function _scalarToBool($in_value)
00240 {
00241 if (!is_bool($in_value)) {
00242 return ($in_value == 'T' || $in_value == 1) ? true : false;
00243 }
00244 else {
00245 return $in_value;
00246 }
00247 }
00248
00249
00250
00251
00258 function _initDataAccess()
00259 {
00260
00261 }
00262
00263
00264 }
00265 ?>