Esempio n. 1
0
 /**
  * Create a new tree dropdown field.
  * @param name The name of the field.
  * @param title The label of the field.
  * @param sourceObject The object-type to list in the tree.  Must be a 'hierachy' object.
  * @param keyField The column of that object-type to return as the field value.  Defaults to ID
  * @param labelField The column to show as the human-readable value in the tree.  Defaults to Title
  */
 function __construct($name, $title, $sourceObject = "Group", $keyField = "ID", $labelField = "Title")
 {
     $this->sourceObject = $sourceObject;
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     parent::__construct($name, $title);
 }
Esempio n. 2
0
 /**
  * Create a new textarea field.
  * 
  * @param $name Field name
  * @param $title Field title
  * @param $value The current value
  */
 public function __construct($name, $title = null, $value = '')
 {
     if (count(func_get_args()) > 3) {
         Deprecation::notice('3.0', 'Use setRows() and setColumns() instead of constructor arguments');
     }
     parent::__construct($name, $title, $value);
 }
 /**
  * Constructor
  * 
  * @param string  $name      Name of the field
  * @param string  $title     Title of the field
  * @param SS_List $dataList  DataList to use
  * @param array   $fieldList List of fields to use
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 22.03.2013
  */
 public function __construct($name, $title, SS_List $dataList, $fieldList = null)
 {
     parent::__construct($name, $title);
     $this->setTemplate('SilvercartTableField');
     $this->setDataList($dataList);
     $this->setFieldList($fieldList ? $fieldList : singleton($dataList->dataClass())->summaryFields());
 }
 public function __construct($name, $title = null, $value = '', $extension = null, $areaCode = null, $countryCode = null)
 {
     $this->areaCode = $areaCode;
     $this->ext = $extension;
     $this->countryCode = $countryCode;
     parent::__construct($name, $title, $value);
 }
 /**
  * @param string $name      The name of the field
  * @param string $title     The field label
  * @param GoogleMap $mapObject [description]
  */
 public function __construct($name, $title, $mapObject = null)
 {
     if ($mapObject) {
         $this->setMap($mapObject);
     }
     parent::__construct($name, $title);
 }
 function __construct($name, $title = null, $value = "", $form = null)
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->xField = new NumericField("{$name}[x]", _t('GeoCoordinateField.X', 'Longitude'));
     $this->yField = new NumericField("{$name}[y]", _t('GeoCoordinateField.Y', 'Latitude'));
     parent::__construct($name, $title, $value, $form);
 }
Esempio n. 7
0
 public function __construct($name, $title = null, $value = "")
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldAmount = new NumericField("{$name}[Amount]", _t('MoneyField.FIELDLABELAMOUNT', 'Amount'));
     $this->fieldCurrency = $this->FieldCurrency($name);
     parent::__construct($name, $title, $value);
 }
 /**
  * @param string $name Field name
  * @param null|string $text Short help link description
  * @param string $uid UniqueIdentifier for AdminHelp
  * @param string|boolean $inline Whether to open this item in a new window
  */
 public function __construct($name, $text, $uid, $newWindow = 'default')
 {
     $this->text = $text;
     $this->uid = $uid;
     $this->newWindow = $newWindow;
     parent::__construct($name);
 }
 /**
  * @param string $name
  * @param string $title
  * @param callable $dataSource
  * @param array $userConfig
  * @param mixed $value
  */
 public function __construct($name, $title = null, $dataSource, $userConfig = array(), $value = null)
 {
     $this->setName($name);
     $this->setDataSource($dataSource)->setConfig($userConfig)->setupChildren();
     parent::__construct($name, $title, $value);
     $this->getRawField()->setTitle($title);
 }
 public function __construct($name, $title = null, $value = null, $form = null)
 {
     // Create a callable function that returns an array of options for the DependentDropdownField.
     // When the value of the field it depends on changes, this function is called passing the
     // updated value as the first parameter ($val)
     $getanchors = function ($page_id) {
         // Copied from HtmlEditorField_Toolbar::getanchors()
         if (($page = Page::get()->byID($page_id)) && !empty($page)) {
             //			if (!$page->canView()) { /* ERROR? */ }
             // Similar to the regex found in HtmlEditorField.js / getAnchors method.
             if (preg_match_all("/\\s(name|id)=\"([^\"]+?)\"|\\s(name|id)='([^']+?)'/im", $page->Content, $matches)) {
                 //					var_dump(array_filter(array_merge($matches[2], $matches[4])));
                 $anchors = array_filter(array_merge($matches[2], $matches[4]));
                 return array_combine($anchors, $anchors);
             }
         }
     };
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldCustomURL = new TextField("{$name}[CustomURL]", '', '', 300, $form);
     $this->fieldShortcode = new TextField("{$name}[Shortcode]", '', '', 300, $form);
     $this->fieldPageID = new TreeDropdownField("{$name}[PageID]", '', 'SiteTree', 'ID', 'MenuTitle');
     $this->fieldPageID->setForm($form);
     //		$this->fieldPageAnchor = new DropdownField("{$name}[PageAnchor]", 'Anchor:',array(), '', $form);
     // The DependentDropdownField, setting the source as the callable function
     // and setting the field it depends on to the appropriate field
     $this->fieldPageAnchor = DependentDropdownField::create("{$name}[PageAnchor]", 'Text-anchor:', $getanchors, $form)->setEmptyString('Page anchor: (none)')->setDepends($this->fieldPageID);
     $this->fieldFileID = new TreeDropdownField("{$name}[FileID]", '', 'File', 'ID', 'Name');
     $this->fieldFileID->addExtraClass('filetree');
     $this->fieldFileID->setForm($form);
     $this->fieldTitle = new TextField("{$name}[Title]", 'Title: ', '', 300, $form);
     $this->fieldLinkmode = new DropdownField("{$name}[Linkmode]", 'Type: ', array('Page' => 'Page', 'URL' => 'URL', 'File' => 'File', 'Email' => 'Email', 'Shortcode' => 'Shortcode'), '', $form);
     $this->fieldLinkmode->addExtraClass('LinkModePicker');
     parent::__construct($name, $title, $value, $form);
 }
Esempio n. 11
0
 /**
  * Create a new action button.
  * @param action The method to call when the button is clicked
  * @param title The label on the button
  * @param form The parent form, auto-set when the field is placed inside a form 
  * @param extraData A piece of extra data that can be extracted with $this->extraData.  Useful for
  *                  calling $form->buttonClicked()->extraData()
  * @param extraClass A CSS class to apply to the button in addition to 'action'
  */
 function __construct($action, $title = "", $form = null, $extraData = null, $extraClass = '')
 {
     $this->extraData = $extraData;
     $this->extraClass = ' ' . $extraClass;
     $this->action = "action_{$action}";
     parent::__construct($this->action, $title, null, $form);
 }
 public function __construct($name, $title = null, $value = null, $form = null)
 {
     $allowed_types = $this->stat('allowed_types');
     $field_types = $this->stat('field_types');
     if (empty($allowed_types)) {
         $allowed_types = array_keys($field_types);
     }
     $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
     $field->setEmptyString('Please choose the Link Type');
     $this->composite_fields['Type'] = $field;
     foreach ($allowed_types as $type) {
         $def = $field_types[$type];
         $field_name = "{$name}[{$type}]";
         switch ($def['field']) {
             case 'TreeDropdownField':
                 $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
                 break;
             default:
                 $field = new TextField($field_name, '');
                 break;
         }
         $field->setDescription($def['description']);
         $field->addExtraClass('FlexiLinkCompositeField');
         $this->composite_fields[$type] = $field;
     }
     $this->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
 public function __construct($parent, $name)
 {
     if (!$parent->hasExtension('MetadataExtension')) {
         throw new Exception('The parent class must have the metadata extension.');
     }
     $this->parent = $parent;
     parent::__construct($name);
 }
 /**
  * @param string $name The field name
  * @param string $title The field title
  * @param array|ArrayAccess $source A map of the dropdown items
  * @param mixed $value The current value
  */
 public function __construct($name, $title = null, $source = array(), $value = null)
 {
     $this->setSource($source);
     if (!isset($title)) {
         $title = $name;
     }
     parent::__construct($name, $title, $value);
 }
Esempio n. 15
0
 /**
  * Create new input field
  * @param string $type
  * @param string $name
  * @param string $value
  */
 function __construct($type, $name = '', $value = '')
 {
     if (!in_array($type, self::$allowedTypes)) {
         throw new \InvalidArgumentException('Unknown Type for input field: ' . $type);
     }
     $this->type = $type;
     parent::__construct($name, $value);
 }
Esempio n. 16
0
 /**
  * CAVEAT: for search to work properly $labelField must be a database field, 
  * or you need to setSearchFunction.
  *
  * @param string $name the field name
  * @param string $title the field label
  * @param sourceObject The object-type to list in the tree.  Must be a 
  *		{@link Hierarchy} subclass.  Alternatively, you can set this to an 
  *		array of key/value pairs, like a {@link DropdownField} source.  In 
  *		this case, the field will act like show a flat list of tree items, 
  *		without any hierarchy. This is most useful in conjunction with 
  *		{@link TreeMultiselectField}, for presenting a set of checkboxes in 
  *		a compact view.
  *
  * @param string $keyField to field on the source class to save as the 
  *		field value (default ID).
  * @param string $labelField the field name to show as the human-readable 
  *		value on the tree (default Title).
  * @param bool $showSearch enable the ability to search the tree by 
  *		entering the text in the input field.
  */
 public function __construct($name, $title = null, $sourceObject = 'Group', $keyField = 'ID', $labelField = 'Title', $showSearch = false)
 {
     $this->sourceObject = $sourceObject;
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     $this->showSearch = $showSearch;
     parent::__construct($name, $title);
 }
Esempio n. 17
0
 /**
  * Create a new file field.
  * 
  * @param string $name The internal field name, passed to forms.
  * @param string $title The field label.
  * @param int $value The value of the field.
  * @param Form $form Reference to the container form
  * @param string $rightTitle Used in SmallFieldHolder() to force a right-aligned label
  * @param string $folderName Folder to upload files to
  */
 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null, $folderName = null)
 {
     if (isset($folderName)) {
         $this->folderName = $folderName;
     }
     $this->upload = new Upload();
     parent::__construct($name, $title, $value, $form, $rightTitle);
 }
Esempio n. 18
0
 public function __construct($name, $title = null, $value = null, $object = null, $form = null)
 {
     $this->object = $object;
     foreach (DBField::config()->composite_db as $point => $type) {
         $this->children[$point] = \HiddenField::create($name . '[' . $point . ']')->addExtraClass('focusarea-point focusarea-point--' . $point)->setForm($form);
     }
     parent::__construct($name, $title, $value, $form);
 }
 public function __construct($name, $title = null, $value = null, $form = null)
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldCustomURL = new TextField("{$name}[CustomURL]", ' URL', '', 300, $form);
     $this->fieldPageID = new TreeDropdownField("{$name}[PageID]", '', 'SiteTree', 'ID', 'Title');
     $this->fieldPageID->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
 public function __construct($name, $title = null, $value = "", $form = null)
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldLatitude = $this->FieldLatitude($name);
     $this->fieldLongditude = $this->FieldLongditude($name);
     parent::__construct($name, $title, null, $form);
     $this->setValue($value);
 }
 /**
  * @param string $name The name of the field
  * @param string $title The title of the field
  */
 public function __construct($name, $title = null, DataObject $data)
 {
     $this->data = $data;
     // setup the option defaults
     $this->options = array('map' => $this->config()->map_options, 'draw' => $this->config()->draw_options);
     $this->setupChildren($name);
     parent::__construct($name, $title, $data->{$name});
 }
 function __construct($name, $title = null, $value = null)
 {
     parent::__construct($name, $title, $value);
     // do not need a fallback title if none was defined.
     if (empty($title)) {
         $this->title = '';
     }
 }
 /**
  * Creates a new Recaptcha 2 field.
  * @param {string} $name The internal field name, passed to forms.
  * @param {string} $title The human-readable field label.
  * @param {mixed} $value The value of the field (unused)
  */
 public function __construct($name, $title = null, $value = null)
 {
     parent::__construct($name, $title, $value);
     $this->title = $title;
     $this->_captchaTheme = self::config()->default_theme;
     $this->_captchaType = self::config()->default_type;
     $this->_captchaSize = self::config()->default_size;
 }
 public function __construct($name, $title = null, $value = null, $settings = [])
 {
     parent::__construct($name, $title, $value);
     $this->settings = array_merge((array) $this->config()->default_options, $this->settings, $settings);
     if ($this->form) {
         $this->form->addExtraClass('.rangeslider-display--form');
     }
 }
 /**
  * @param DataObject $data The controlling dataobject
  * @param string $title The title of the field
  * @param array $options Various settings for the field
  */
 public function __construct(DataObject $data, $title, $options = array())
 {
     $this->data = $data;
     // Set up fieldnames
     $this->setupOptions($options);
     $this->setupChildren();
     parent::__construct($this->getName(), $title);
 }
Esempio n. 26
0
 /**
  * Create a new tree dropdown field.
  * @param name The name of the field.
  * @param title The label of the field.
  * @param sourceObject The object-type to list in the tree.  Must be a 'hierachy' object.
  * @param keyField The column of that object-type to return as the field value.  Defaults to ID
  * @param labelField The column to show as the human-readable value in the tree.  Defaults to Title
  */
 function __construct($name, $title, $sourceObject = "Group", $keyField = "ID", $labelField = "Title")
 {
     $this->sourceObject = $sourceObject;
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     Requirements::css('sapphire/css/TreeDropdownField.css');
     parent::__construct($name, $title);
 }
Esempio n. 27
0
 function __construct($name, $title = null, $value = "")
 {
     $this->config = self::$default_config;
     $this->dateField = Object::create('DateField', $name . '[date]', false);
     $this->timeField = Object::create('TimeField', $name . '[time]', false);
     $this->timezoneField = new HiddenField($this->Name() . '[timezone]');
     parent::__construct($name, $title, $value);
 }
 public function __construct($name, $title = null, $value = "")
 {
     $this->config = $this->config()->default_config;
     $this->dateField = DateField::create($name . '[date]', false)->addExtraClass('fieldgroup-field');
     $this->timeField = TimeField::create($name . '[time]', false)->addExtraClass('fieldgroup-field');
     $this->timezoneField = new HiddenField($this->getName() . '[timezone]');
     parent::__construct($name, $title, $value);
 }
 /**
  *
  * @param String $name
  * @param String $title
  * @param Image $value
  * @param array $params
  *			Any additional parameters that should be sent back to the save handler when pixlr calls us back
  * @param String $targetUrl
  *			The URL that pixlr returns data back to
  * @param String $exitUrl
  *			The URL called if pixlr is closed without saving any data
  */
 public function __construct($name, $title = '', $value = '', $returnParams = array(), $targetUrl = '', $exitUrl = '')
 {
     $this->label = $title;
     $this->targetUrl = $targetUrl;
     $this->exitUrl = $exitUrl;
     $this->returnParams = $returnParams;
     parent::__construct($name, '', $value);
 }
 public function __construct($args = array())
 {
     $args = PSU::params($args);
     $this->fileid = 0;
     $this->adodb_type = 'N';
     parent::__construct($args);
     $this->type->value = 'file';
 }