(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@59922 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-06 03:31:42 +00:00
parent 5098600709
commit 50b536e2b8
2 changed files with 10 additions and 15 deletions

View File

@ -1182,7 +1182,7 @@ class DataObject extends ViewableData implements DataObjectInterface {
* generate this set. * generate this set.
* *
* <example> * <example>
* class MyCustomClass extends DataObject { * klass MyCustomClass extends DataObject {
* static $db = array('CustomProperty'=>'Boolean'); * static $db = array('CustomProperty'=>'Boolean');
* *
* public function getCMSFields() { * public function getCMSFields() {

View File

@ -1,4 +1,9 @@
<?php <?php
/**
* @package sapphire
* @subpackage model
*/
/** /**
* Represents a single year field. * Represents a single year field.
* *
@ -8,7 +13,7 @@
class Year extends DBField { class Year extends DBField {
function requireField() { function requireField() {
DB::requireField($this->tableName, $this->name, "year(4)"); DB::requireField($this->tableName, $this->name, "year");
} }
public function scaffoldFormField($title = null) { public function scaffoldFormField($title = null) {
@ -17,19 +22,9 @@ class Year extends DBField {
return $selectBox; return $selectBox;
} }
/** private function getDefaultOptions() {
* Returns a list of default options that can $start = (int)date('Y');
* be used to populate a select box, or compare against $end = 1900;
* input values. Starts by default at the current year,
* and counts back to 1900.
*
* @param int $start starting date to count down from
* @param int $end end date to count down to
* @return array
*/
private function getDefaultOptions($start=false, $end=false) {
if (!$start) $start = (int)date('Y');
if (!$end) $end = 1900;
$years = array(); $years = array();
for($i=$start;$i>=$end;$i--) { for($i=$start;$i>=$end;$i--) {
$years[] = $i; $years[] = $i;