| 72 | | * <b>FIXME: dead code? Never referenced in ActiveRecord</b><br> |
| 73 | | * <b>FIXME: static should be after protected</b><br> |
| 74 | | * <b>FIXME: static variables $rows_per_page, $page, $offset are |
| 75 | | * not declared. Declaring them would provide a good place to |
| 76 | | * document them. On the other hand, if the intent is to give |
| 77 | | * the user the ability to page through a result set, these |
| 78 | | * variables need to go in $_SESSION.</b> |
| 79 | | */ |
| 80 | | static protected $inflector = null; # object to do class inflection |
| 81 | | |
| 82 | | /** |
| | 203 | * Date format for use with auto timestamping |
| | 204 | * |
| | 205 | * The format for this should be compatiable with the php date() function. |
| | 206 | * http://www.php.net/date |
| | 207 | * @var string |
| | 208 | */ |
| | 209 | protected $date_format = "Y-m-d"; |
| | 210 | |
| | 211 | /** |
| | 212 | * Time format for use with auto timestamping |
| | 213 | * |
| | 214 | * The format for this should be compatiable with the php date() function. |
| | 215 | * http://www.php.net/date |
| | 216 | * @var string |
| | 217 | */ |
| | 218 | protected $time_format = "H:i:s"; |
| | 219 | |
| | 220 | /** |
| | 221 | * Whether to keep date/datetime fields NULL if not set |
| | 222 | * |
| | 223 | * true => If date field is not set it try to preserve NULL |
| | 224 | * false => Don't try to preserve NULL if field is already NULL |
| | 225 | * @var boolean |
| | 226 | */ |
| | 227 | protected $preserve_null_dates = true; |
| | 228 | |
| | 229 | /** |
| 1556 | | if(($field_info['name'] == $field) && ($field_info['type'] == "datetime")) { |
| 1557 | | if($this->new_record && in_array($field, $this->auto_create_timestamps)) { |
| 1558 | | return date("Y-m-d H:i:s"); |
| 1559 | | } elseif(!$this->new_record && in_array($field, $this->auto_update_timestamps)) { |
| 1560 | | return date("Y-m-d H:i:s"); |
| | 1572 | if(($field_info['name'] == $field) && stristr($field_info['type'], "date")) { |
| | 1573 | $format = ($field_info['type'] == "date") ? $this->date_format : "{$this->date_format} {$this->time_format}"; |
| | 1574 | if($this->new_record) { |
| | 1575 | if(in_array($field, $this->auto_create_timestamps)) { |
| | 1576 | return date($format); |
| | 1577 | } elseif($this->preserve_null_dates && is_null($value) && !stristr($field_info['flags'], "not_null")) { |
| | 1578 | return 'NULL'; |
| | 1579 | } |
| | 1580 | } elseif(!$this->new_record) { |
| | 1581 | if(in_array($field, $this->auto_update_timestamps)) { |
| | 1582 | return date($format); |
| | 1583 | } elseif($this->preserve_null_dates && is_null($value) && !stristr($field_info['flags'], "not_null")) { |
| | 1584 | return 'NULL'; |
| | 1585 | } |