2009-04-17 02:26:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2015-09-11 10:20:06 +12:00
|
|
|
* Base Class for EditableOption Fields such as the ones used in
|
2009-04-17 02:26:40 +00:00
|
|
|
* dropdown fields and in radio check box groups
|
2015-09-11 10:20:06 +12:00
|
|
|
*
|
2009-04-17 02:26:40 +00:00
|
|
|
* @package userforms
|
|
|
|
*/
|
|
|
|
|
|
|
|
class EditableOption extends DataObject {
|
2015-09-11 10:20:06 +12:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $default_sort = "Sort";
|
2009-04-17 02:26:40 +00:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $db = array(
|
2009-07-05 07:14:03 +00:00
|
|
|
"Name" => "Varchar(255)",
|
|
|
|
"Title" => "Varchar(255)",
|
2009-04-17 02:26:40 +00:00
|
|
|
"Default" => "Boolean",
|
|
|
|
"Sort" => "Int"
|
|
|
|
);
|
2015-09-11 10:20:06 +12:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $has_one = array(
|
2009-04-17 02:26:40 +00:00
|
|
|
"Parent" => "EditableMultipleOptionField",
|
|
|
|
);
|
2015-09-11 10:20:06 +12:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $extensions = array(
|
2009-09-23 01:36:52 +00:00
|
|
|
"Versioned('Stage', 'Live')"
|
|
|
|
);
|
2009-04-17 02:26:40 +00:00
|
|
|
|
2015-07-24 14:37:48 +12:00
|
|
|
private static $summary_fields = array(
|
|
|
|
'Title',
|
|
|
|
'Default'
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Member $member
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function canEdit($member = null) {
|
|
|
|
return ($this->Parent()->canEdit($member));
|
|
|
|
}
|
2014-07-06 17:35:46 +12:00
|
|
|
|
2015-07-24 14:37:48 +12:00
|
|
|
/**
|
|
|
|
* @param Member $member
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function canDelete($member = null) {
|
|
|
|
return ($this->Parent()->canDelete($member));
|
|
|
|
}
|
2014-07-06 17:35:46 +12:00
|
|
|
|
2015-07-24 14:37:48 +12:00
|
|
|
public function getEscapedTitle() {
|
|
|
|
return Convert::raw2att($this->Title);
|
|
|
|
}
|
2013-05-08 10:08:21 +03:00
|
|
|
}
|