public function __construct($name = '', $title = null, $value = '', $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
     $this->setAttribute('class', 'text');
     $this->setAttribute('type', 'text');
     $this->setAttribute('data-type', 'input');
 }
 /**
  * Returns an input field, class="text" and type="text" with an optional
  * maxlength
  */
 public function __construct($name, $title = null, $value = "")
 {
     if (count(func_get_args()) > 3) {
         Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments', Deprecation::SCOPE_GLOBAL);
     }
     parent::__construct($name, $title, $value);
 }
Example #3
0
 /**
  * @author Jeff Ober
  * @param string $label the field's text label
  * @param int $size the field's size attribute
  * @param int $max_length the maximum size in characters
  * @param callback $hash_function a (string) function or array (instance, string method) callback
  * @param array $validators a list of callbacks to validate the field data
  * @param array $attributes a list of key/value pairs representing HTML attributes
  **/
 public function __construct($label, $size, $max_length, $hash_function, array $validators = array(), array $attributes = array())
 {
     $this->max_length = $max_length;
     $this->hash_function = $hash_function;
     $attributes['size'] = $size;
     parent::__construct($label, $validators, $attributes);
 }
Example #4
0
 public function __construct($name, $title = null, $value = "")
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldType = new OptionsetField("{$name}[Type]", _t('HtmlEditorField.LINKTO', 'Link to'), array('Internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), 'External' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), 'Email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), 'File' => _t('HtmlEditorField.LINKFILE', 'Download a file')), 'Internal');
     $this->fieldLink = new CompositeField($this->internalField = WTTreeDropdownField::create("{$name}[Internal]", _t('HtmlEditorField.Internal', 'Internal'), 'SiteTree', 'ID', 'Title', true), $this->externalField = TextField::create("{$name}[External]", _t('HtmlEditorField.URL', 'URL'), 'http://'), $this->emailField = EmailField::create("{$name}[Email]", _t('HtmlEditorField.EMAIL', 'Email address')), $this->fileField = WTTreeDropdownField::create("{$name}[File]", _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), $this->extraField = TextField::create("{$name}[Extra]", 'Extra(optional)')->setDescription('Appended to url. Use to add sub-urls/actions or query string to the url, e.g. ?param=value'), $this->anchorField = TextField::create("{$name}[Anchor]", 'Anchor (optional)'), $this->targetBlankField = CheckboxField::create("{$name}[TargetBlank]", _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')));
     if ($linkableDataObjects = WTLink::get_data_object_types()) {
         if (!($objects = self::$linkable_data_objects)) {
             $objects = array();
             foreach ($linkableDataObjects as $className) {
                 $classObjects = array();
                 //set the format for DO value -> ClassName-ID
                 foreach (DataList::create($className) as $object) {
                     $classObjects[$className . '-' . $object->ID] = $object->Title;
                 }
                 if (!empty($classObjects)) {
                     $objects[singleton($className)->i18n_singular_name()] = $classObjects;
                 }
             }
         }
         if (count($objects)) {
             $this->fieldType->setSource(array_merge($this->fieldType->getSource(), array('DataObject' => _t('WTLinkField.LINKDATAOBJECT', 'Data Object'))));
             $this->fieldLink->insertBefore("{$name}[Extra]", $this->dataObjectField = GroupedDropdownField::create("{$name}[DataObject]", _t('WTLinkField.LINKDATAOBJECT', 'Link to a Data Object'), $objects));
         }
         self::$linkable_data_objects = $objects;
     }
     $this->extraField->addExtraClass('no-hide');
     $this->anchorField->addExtraClass('no-hide');
     $this->targetBlankField->addExtraClass('no-hide');
     parent::__construct($name, $title, $value);
 }
 /**
  * Constructor saves the format difference. Timefields shouldn't 
  * have a problem with length as times can only be represented in on way.
  * 
  * @param $name string The name of the field
  * @param $title string The Title of the field
  * @param $value string the value for the field
  * @param $timeformat string The Time format in date php format e.g. G:ia
  */
 function __construct($name, $title = null, $value = "", $timeformat = null)
 {
     parent::__construct($name, $title, $value);
     if ($timeformat) {
         $this->timeformat = $timeformat;
     }
 }
 public function __construct($name, $title = null, $value = "", $extraAttributes = null, $maxLength = null, $form = null)
 {
     if (is_array($extraAttributes)) {
         $this->extraAttributes = $extraAttributes;
     }
     parent::__construct($name, $title, $value, $maxLength, $form);
 }
 public function __construct($name, $title = null, $value = "", $form = null)
 {
     /*
     $monthValue = '';
     $yearValue = '';
     if(strlen($this->value) == 4) {
     	$monthValue = substr($value, 0, 2);
     	$yearValue = "20".substr($value, 2, 2);
     }
     $this->children = new FieldList(
     	$monthField = new DropdownField(
     		"{$name}[month]",
     		"",
     		$this->makeSelectList($this->monthArray(), $monthValue)
     	),
     	$yearField = new DropdownField(
     		"{$name}[year]",
     		"",
     		$this->makeSelectList($this->yearArray(), $yearValue)
     	)
     );
     $monthField->addExtraClass("");
     $yearField->addExtraClass("");
     // disable auto complete
     foreach($this->children as $child) {
     	$child->setAttribute('autocomplete', 'off');
     }
     */
     parent::__construct($name, $title, null, $form);
     $this->setValue($value);
 }
Example #8
0
 function __construct($name, $restrictedField, $restrictedTable, $restrictedMessage, $title = null, $value = "", $maxLength = null)
 {
     $this->maxLength = $maxLength;
     $this->restrictedField = $restrictedField;
     $this->restrictedTable = $restrictedTable;
     $this->restrictedMessage = $restrictedMessage;
     parent::__construct($name, $title, $value);
 }
 public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
     $this->setTemplate('CustomizableInputField');
     $this->setAttribute('class', 'text');
     $this->setAttribute('data-value', 'true');
     $this->setAttribute('type', 'hidden');
 }
 public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
     Requirements::javascript(TAGGABLE_DIR . '/assets/build/js/lib.js');
     Requirements::javascript(TAGGABLE_DIR . '/assets/build/js/tagfield.js');
     Requirements::css(TAGGABLE_DIR . '/assets/build/css/main.css');
     $this->addExtraClass('text');
 }
 /**
  * @param string $name
  * @param null $title
  * @param string $value
  * @param null $form
  */
 public function __construct($name, $title = null, $value = '', $form = null)
 {
     parent::__construct($name, $title, $value, 7, $form);
     Requirements::css(SILVERSTRIPE_COLOR_FIELD . '/css/colorpicker.css');
     Requirements::javascript(SILVERSTRIPE_COLOR_FIELD . '/javascript/lib/colorpicker.min.js');
     Requirements::javascript(SILVERSTRIPE_COLOR_FIELD . '/javascript/colorpicker.init.js');
     $this->addExtraClass('text');
 }
 public function __construct($name, $title, $restrictedField, $restrictedTable, $value = "", $maxLength = null, $validationURL = null, $restrictedRegex = null)
 {
     $this->maxLength = $maxLength;
     $this->restrictedField = $restrictedField;
     $this->restrictedTable = $restrictedTable;
     $this->validateURL = $validationURL;
     $this->restrictedRegex = $restrictedRegex;
     parent::__construct($name, $title, $value);
 }
 /**
  * SimpleCaptchaField constructor.
  * @param string $name
  * @param null $title
  * @param string $form
  */
 public function __construct($name, $title = null, $form)
 {
     Requirements::css(SIMPLE_FORM_CAPTCHA_DIR . '/css/form.css');
     Requirements::javascript(SIMPLE_FORM_CAPTCHA_DIR . '/js/SimpleCaptchaField.js');
     parent::__construct($name, $title, null, null, $form);
     $formName = $form->getName();
     $form->addExtraClass($formName);
     Requirements::customScript(sprintf("var SIMPLECAPTCHAFORM = '%s'", $formName));
 }
Example #14
0
 public function __construct($name, $title = null, $value = "")
 {
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldType = new OptionsetField("{$name}[Type]", _t('HtmlEditorField.LINKTO', 'Link to'), array('Internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), 'External' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), 'Email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), 'File' => _t('HtmlEditorField.LINKFILE', 'Download a file')), 'Internal');
     $this->fieldLink = new CompositeField($this->internalField = new WTTreeDropdownField("{$name}[Internal]", _t('HtmlEditorField.Internal', 'Internal'), 'SiteTree', 'ID', 'Title', true), $this->externalField = new TextField("{$name}[External]", _t('HtmlEditorField.URL', 'URL'), 'http://'), $this->emailField = new EmailField("{$name}[Email]", _t('HtmlEditorField.EMAIL', 'Email address')), $this->fileField = new WTTreeDropdownField("{$name}[File]", _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), $this->anchorField = new TextField("{$name}[Anchor]", 'Anchor (optional)'), $this->targetBlankField = new CheckboxField("{$name}[TargetBlank]", _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')));
     $this->anchorField->addExtraClass('no-hide');
     $this->targetBlankField->addExtraClass('no-hide');
     parent::__construct($name, $title, $value);
 }
 public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
     Requirements::javascript(ABC_VENDOR_PATH . '/jquery.colorpicker/jquery.colorpicker.js');
     Requirements::customScript(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . ABC_PATH . '/javascript/ColourPickerField.js'));
     Requirements::css(ABC_VENDOR_PATH . '/jquery.colorpicker/jquery.colorpicker.css');
     Requirements::css(ABC_PATH . '/css/ColourPickerField.css');
     $this->addExtraClass('text');
 }
 function __construct($name, $title = null, $value = "", $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $form);
     $this->addExtraClass('zenautocompletefield text');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript('zenautocompletefield/javascript/zenautocompletefield.js');
 }
 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     if (!$this->getConfig('dateformat')) {
         $this->setConfig('dateformat', i18n::get_date_format());
     }
     parent::__construct($name, $title, $value, $form, $rightTitle);
 }
 public function __construct($name, $title = null, $value = null)
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(SIGNATURE_MODULE_DIR . "/bower_components/signature_pad/signature_pad.js");
     Requirements::javascript(SIGNATURE_MODULE_DIR . "/javascript/signature_pad.init.js");
     Requirements::css(SIGNATURE_MODULE_DIR . "/css/signature.css");
     $this->addExtraClass('signature no-sigpad');
     parent::__construct($name, $title, $value);
 }
 function __construct($name, $title = null, $value = '#000000')
 {
     parent::__construct($name, $title, $value);
     Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     Requirements::javascript(self::get_source_file_location() . 'farbtastic.js');
     Requirements::javascript(self::get_source_file_location() . 'colorfield.js');
     Requirements::css(self::get_source_file_location() . 'ColorField.css');
     Requirements::css(self::get_source_file_location() . 'farbtastic.css');
     //echo $this->value;
 }
 function __construct($name, $title = null, $value = "")
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     if (!$this->getConfig('timeformat')) {
         $this->setConfig('timeformat', i18n::get_time_format());
     }
     parent::__construct($name, $title, $value);
 }
 public function __construct($arrAttributes = null)
 {
     parent::__construct($arrAttributes);
     $GLOBALS['TL_CSS'][] = 'composer/vendor/eternicode/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css';
     array_unshift($GLOBALS['TL_JAVASCRIPT'], 'system/modules/bootstrap-datepicker/assets/jquery.noconflict.js');
     $jquery_src = 'assets/jquery/core/' . reset(scandir(TL_ROOT . '/assets/jquery/core', 1)) . '/jquery.min.js';
     array_unshift($GLOBALS['TL_JAVASCRIPT'], $jquery_src);
     $GLOBALS['TL_JAVASCRIPT'][] = 'composer/vendor/eternicode/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js';
     $GLOBALS['TL_JAVASCRIPT'][] = 'composer/vendor/eternicode/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js';
 }
 /**
  * Constructor for AutoCompleteField
  * @param string $name The name of the field
  * @param string $title The label for the field
  * @param string $url A function or a URL for the results callback
  * @param string $val A default value (will be knocked out on focus)
  */
 public function __construct($name, $title, $url = "autocomplete", $val = null)
 {
     parent::__construct($name, $title, $val);
     if (!stristr($url, '/')) {
         // url was passed as a function name.. use the current controller
         $url = Controller::curr()->Link($url);
     }
     $this->addExtraClass("autocomplete_input");
     $this->addExtraClass("{'url' : '{$url}'}");
 }
 /**
  * GeoCodeField constructor.
  * @param string $name
  * @param null $title
  */
 public function __construct($name, $title = null)
 {
     parent::__construct($name, $title);
     $this->identifier = uniqid();
     $this->setTemplate('GeoCodeField');
     $this->setLon('Lon' . $this->Identifier());
     $this->setLat('Lat' . $this->Identifier());
     $this->setAddress('Address' . $this->Identifier());
     $this->setAttribute('type', 'hidden');
     $this->setAttribute('data-valuefield', 'true');
 }
 public function __construct($name, $title = null, $value = "")
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     $this->config = $this->config()->default_config;
     if (!$this->getConfig('timeformat')) {
         $this->setConfig('timeformat', Config::inst()->get('i18n', 'time_format'));
     }
     parent::__construct($name, $title, $value);
 }
 public function __construct($name, $title = null, $GoogleMapsKey = null, $value = '', $form = null)
 {
     //If we haven't been provided with a Google Maps API Key, throw an error.
     if ($GoogleMapsKey == null) {
         user_error("You neglected to provide a Google Maps API key in your use of AddressTextField", E_USER_WARNING);
         exit;
     }
     //Construct the form field
     parent::__construct($name, $title, $value, $form);
     //Include the Google Maps API Javascript
     self::include_js($GoogleMapsKey);
 }
 function __construct($name, $title = null, $value = "", $form = null)
 {
     /*
     if($has_manys = $controller->stat('has_many')) {
     	foreach($has_manys as $relation => $value) {
     		$name = $relation;
     		$sourceClass = $value;
     		break;
     	}
     }
     */
     parent::__construct($name, $title, $value, null, $form);
 }
 function __construct($name, $title = null, $value = '', $sourceList = null, $sourceField = null, $refField = '', $valField = '')
 {
     // set source
     $this->sourceList = $sourceList;
     $this->sourceField = $sourceField;
     if ($refField) {
         $this->refField = $refField;
     }
     if ($valField) {
         $this->valField = $valField;
     }
     // construct the TextField
     parent::__construct($name, $title, $value);
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->attributes['session_name'] = session_name();
     $this->attributes['session_id'] = session_id();
     $this->attributes['file_types'] = array('jpg', 'png', 'gif', 'swf');
     if (!isset($this->attributes['file_source'])) {
         $this->attributes['file_source'] = 'upload/';
     }
     $this->attributes['file_types_description'] = \WellCommerce\Translation::get('TXT_FILE_TYPES_IMAGE');
     $this->attributes['upload_url'] = App::getURLAdressWithAdminPane() . 'files/add/' . base64_encode($this->attributes['file_source']);
     $this->attributes['load_handler'] = 'xajax_LoadFiles_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('LoadFiles_' . $this->_id, $this, 'LoadFiles'));
     $this->attributes['delete_handler'] = 'xajax_DeleteFile_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('deleteFile_' . $this->_id, $this, 'deleteFile'));
     $this->attributes['type_icons'] = array('cdup' => DESIGNPATH . '_images_panel/icons/filetypes/cdup.png', 'unknown' => DESIGNPATH . '_images_panel/icons/filetypes/unknown.png', 'directory' => DESIGNPATH . '_images_panel/icons/filetypes/directory.png', 'gif' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'png' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'jpg' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'bmp' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'txt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'doc' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'rtf' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'odt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'htm' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'html' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'php' => DESIGNPATH . '_images_panel/icons/filetypes/document.png');
 }
 /**
  * @param string $name
  * @param string $title
  * @param mixed $value
  */
 public function __construct($name, $title = null, $value = null)
 {
     $this->addressField = new TextField("{$name}[Address]", $title);
     $this->manualToggle = new HiddenField("{$name}[ManualAddress]");
     $this->manualFields = new FieldList();
     for ($i = 1; $i < 4; $i++) {
         $this->manualFields->push(new TextField("{$name}[PostalLine{$i}]", _t("AddressFinderField.POSTALLINE{$i}", "Postal Line {$i}")));
     }
     for ($i = 4; $i < 7; $i++) {
         $this->manualFields->push(new HiddenField("{$name}[PostalLine{$i}]"));
     }
     $this->manualFields->push(new HiddenField("{$name}[Longitude]"));
     $this->manualFields->push(new HiddenField("{$name}[Latitude]"));
     $this->manualFields->push(new TextField("{$name}[Suburb]", _t("AddressFinderField.SUBURB", "Suburb")));
     $this->manualFields->push(new TextField("{$name}[City]", _t("AddressFinderField.CITY", "City")));
     $this->manualFields->push(new NumericField("{$name}[Postcode]", _t("AddressFinderField.POSTCODE", "Postcode")));
     parent::__construct($name, $title, $value);
 }
 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
 {
     if (!$this->locale) {
         $this->locale = i18n::get_locale();
     }
     if (!$this->getConfig('dateformat')) {
         $this->setConfig('dateformat', i18n::get_date_format());
     }
     foreach (self::$default_config as $defaultK => $defaultV) {
         if ($defaultV) {
             if ($defaultK == 'locale') {
                 $this->locale = $defaultV;
             } else {
                 $this->setConfig($defaultK, $defaultV);
             }
         }
     }
     parent::__construct($name, $title, $value, $form, $rightTitle);
 }