Ejemplo n.º 1
0
 function __construct($name, $title, $value = '')
 {
     if (!$value) {
         $value = Geoip::visitor_country();
     }
     parent::__construct($name, $title, Geoip::getCountryDropDown(), $value);
 }
 public function __construct($name, $title = null, $source = array(), $value = "", $extraAttributes = null, $form = null, $emptyString = null)
 {
     if (is_array($extraAttributes)) {
         $this->extraAttributes = $extraAttributes;
     }
     parent::__construct($name, $title, $source, $value, $extraAttributes, $form, $emptyString);
 }
 public function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     if (!is_array($source)) {
         $source = ColorpaletteHelper::get_palette();
     }
     parent::__construct($name, $title === null ? $name : $title, $source, $value, $form);
 }
 public function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     $source = SiteConfig::current_site_config()->getCountriesList(true);
     parent::__construct($name, $title, $source, $value, $form);
     $this->setHasEmptyDefault(true);
     $this->setEmptyString(self::$defaultname);
 }
 public function __construct($name, $title, $sourceObject, $keyField = 'ID', $labelField = 'Title', $imageField = 'Image', $value = '', $form = null)
 {
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     $this->imageField = $imageField;
     parent::__construct($name, $title === null ? $name : $title, $sourceObject, $value, $form);
     $this->addExtraClass('dropdown');
 }
 /**
  * @param string $name
  * @param string $title
  * @param string $className 
  */
 function __construct($name, $title, $value = null, $form = null, $currentID = null, $currentTitle = null)
 {
     $optionArray = $this->_getOptions();
     $extraFields = array(array('value' => 'any', 'title' => 'Any Location'));
     $optionArray = array_merge($extraFields, $optionArray);
     //Debug::show($optionArray);
     parent::__construct($name, $title, $optionArray, $value, $form, null);
 }
 public function __construct($name, $title = null, $source = null, $value = '', $form = null, $emptyString = null)
 {
     // Get the regions from config.yml
     parent::__construct($name, $title === null ? $name : $title, $value, $form);
     if (!$source) {
         $this->setSource(self::$regions);
     }
 }
 public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null)
 {
     /**
      * enable the chzn javascript
      */
     $this->addExtraClass('dropdown');
     parent::__construct($name, $title === null ? $name : $title, $value, $form);
 }
 function __construct($name, $title = null, $timeFormat = "", $value = "", $form = null, $emptyString = null)
 {
     $source = $this->buildSource();
     $this->source = $source;
     if ($timeFormat) {
         $this->{$timeFormat} = $timeFormat;
     }
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
Ejemplo n.º 10
0
 /**
  * Creates a new dropdown field.
  * 
  * @param string $name The field name
  * @param string $title The field title
  * @param array $source An map of the dropdown items
  * @param string|array $value You can pass an array of values or a single value like a drop down to be selected
  * @param int $size Optional size of the select element
  * @param form The parent form
  */
 public function __construct($name, $title = '', $source = array(), $value = '', $size = null, $multiple = false)
 {
     if ($size) {
         $this->size = $size;
     }
     if ($multiple) {
         $this->multiple = $multiple;
     }
     parent::__construct($name, $title, $source, $value);
 }
Ejemplo n.º 11
0
 public function __construct($name, $title = null, $value = '', $form = null, $emptyString = null)
 {
     $this->addExtraClass('dropdown');
     $source = ColourSchemes::get()->sort('ID')->map('CSSColor', 'OPColor');
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
     $this->toggleStar();
     Requirements::css(OPCOLORWORKINGFOLDER . '/css/OpColorField.css');
     Requirements::javascript(OPCOLORWORKINGFOLDER . '/javascript/OpColorField.js');
     $this->hasEmptyDefault = true;
 }
 function __construct($name, $title = null, $value = '')
 {
     foreach (self::$font_families as $fontFamily) {
         foreach (self::$generic_families as $genericFamily) {
             $font = (strpos($fontFamily, ' ') ? "'{$fontFamily}'" : $fontFamily) . ", {$genericFamily}";
             $fonts[strtolower($font)] = $font;
         }
     }
     parent::__construct($name, $title, $fonts, $value);
 }
Ejemplo n.º 13
0
 /**
  * Creates a new dropdown field.
  * @param name The field name
  * @param title The field title
  * @param source An map of the dropdown items
  * @param value You can pass an array of values or a single value like a drop down to be selected
  * @param form The parent form
  */
 function __construct($name, $title = "", $source = array(), $value = array(), $size = null, $multiple = null, $form = null)
 {
     if ($size) {
         $this->size = $size;
     }
     if ($multiple) {
         $this->multiple = $multiple;
     }
     parent::__construct($name, $title, $source, $value, $form);
 }
 function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     if (!is_array($source)) {
         $source = Geoip::getCountryDropDown();
     }
     if (!$value) {
         $value = Geoip::visitor_country();
     }
     parent::__construct($name, $title === null ? $name : $title, $source, $value, $form);
 }
 function __construct($name, $title = null, $source = null, $value = "", $form = null, $emptyString = null)
 {
     if (!$source) {
         $source = self::$states;
     }
     if (!$emptyString) {
         $this->hasEmptyDefault = $this->stat('default_has_empty');
         $this->emptyString = $this->stat('default_empty_string');
     }
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
Ejemplo n.º 16
0
 /** 
  * Create a type dropdown field. 
  * @param string $name The field name 
  * @param string $title The field title 
  * @param string $className The class name of the related class 
  * @param int $value The current value 
  * @param Form $form The parent form 
  * @param boolean $includeNone Include 'None' in the dropdown 
  * @param string $titleField The field on the object to use as the title in the dropdown 
  */
 function __construct($name, $title, $className, $value = null, $form = null, $includeNone = true, $titleField = 'Title')
 {
     $options = DataObject::get($className);
     $optionArray = $includeNone ? array('0' => _t('TypeDropdown.NONE', 'None')) : array();
     if ($options) {
         foreach ($options as $option) {
             $optionArray[$option->ID] = $option->{$titleField};
         }
     }
     parent::__construct($name, $title, $optionArray, $value, $form);
 }
Ejemplo n.º 17
0
 /**
  * @param string $name
  * @param string $title
  * @param string $className 
  */
 function __construct($name, $title, $className, $value = null, $form = null, $emptyString = null)
 {
     $options = DataObject::get($className);
     $optionArray = array('0' => _t('TypeDropdown.NONE', 'None'));
     if ($options) {
         foreach ($options as $option) {
             $optionArray[$option->ID] = $option->{$this->titleFieldName};
         }
     }
     parent::__construct($name, $title, $optionArray, $value, $form, $emptyString);
 }
 public function __construct($name, $title = null, $source = array(), $value = '', $form = null, $emptyString = null)
 {
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
     if ($emptyString) {
         $this->freeTextItem = $emptyString;
     } else {
         $this->freeTextItem = _t('ComboField.FREETEXT', 'Enter a new value');
     }
     FormExtraJquery::include_jquery();
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/ComboField.js');
 }
 /**
  * Create drop down field for a product option, just ensures name of field 
  * is in the format Options[OptionClassName].
  * 
  * @param String $optionClass Class name of the product option
  * @param String $title
  * @param Array $source
  * @param String $value
  * @param Form $form
  * @param String $emptyString
  */
 function __construct($attributeID, $title = null, $optionSet = null, $value = "", $form = null, $emptyString = null)
 {
     //Pass in the attribute ID
     $name = "Options[{$attributeID}]";
     $source = array();
     if ($optionSet && $optionSet->exists()) {
         foreach ($optionSet as $option) {
             $source[$option->ID] = $option->Title;
         }
     }
     $this->addExtraClass('dropdown');
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
 /**
  * Creates a new silvercart language dropdown field.
  *
  * @param string $name        The fields name
  * @param string $title       The fields title
  * @param array  $source      An map of the dropdown items (will be 
  * @param string $value       Current value
  * @param Form   $form        Form
  * @param string $emptyString Empty string
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 27.04.2012
  */
 public function __construct($name, $title = null, $source = array(), $value = "", $form = null, $emptyString = null)
 {
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
     $this->setController($form->controller);
     $currentLocale = Translatable::get_current_locale();
     $translations = $this->getController()->getTranslations();
     $translationSource = array();
     $translationSource[$currentLocale] = array('title' => $this->getDisplayLanguage($currentLocale, $currentLocale), 'rel' => $this->getIso2($currentLocale));
     foreach ($translations as $translation) {
         $translationSource[$translation->Locale] = array('title' => $this->getDisplayLanguage($translation->Locale, $currentLocale), 'rel' => $this->getIso2($translation->Locale));
     }
     $this->setSource($translationSource);
 }
Ejemplo n.º 21
0
 public function __construct($name, $title = null, $value = '', $form = null, $emptyString = null)
 {
     $this->addExtraClass('dropdown');
     $source = ColourSchemes::get()->sort('ID')->map('CSSColor', 'OPColor');
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
     $this->CurrentTitle = '';
     if ($value != "") {
         $star = ColourSchemes::get()->where(array("\"CSSColor\" = '" . $value . "'"))->first();
         if ($star) {
             $this->CurrentTitle = $star->OPColor;
         }
     }
     Requirements::css(OPCOLORWORKINGFOLDER . '/css/OpColorField.css');
     Requirements::javascript(OPCOLORWORKINGFOLDER . '/javascript/OpColorField.js');
 }
Ejemplo n.º 22
0
 public function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     if (!is_array($source)) {
         // Get a list of countries from Zend
         $source = Zend_Locale::getTranslationList('territory', $this->locale(), 2);
         // We want them ordered by display name, not country code
         // PHP 5.3 has an extension that sorts UTF-8 strings correctly
         if (class_exists('Collator') && ($collator = Collator::create($this->locale()))) {
             $collator->asort($source);
         } else {
             asort($source);
         }
         // We don't want "unknown country" as an option
         unset($source['ZZ']);
     }
     parent::__construct($name, $title === null ? $name : $title, $source, $value, $form);
 }
 function __construct($name, $title = null, $source = null, $value = "", $form = null, $emptyString = null)
 {
     if (!$source) {
         $source = array();
     }
     if (is_string($source)) {
         // it should be the name of a list, lets get all its contents
         $dataList = DataObject::get_one('DataList', '"Title" = \'' . Convert::raw2sql($source) . '\'');
         $source = array();
         if ($dataList) {
             $items = $dataList->Items();
             foreach ($items as $item) {
                 $source[$item->Title] = $item->Title;
             }
         }
     }
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
 function __construct($name, $title = null, $source = null, $value = "", $form = null, $emptyString = null)
 {
     if (!$source) {
         $source = array();
     }
     if (is_string($source)) {
         // it should be the name of a list, lets get all its contents
         $dynamicList = DynamicList::get_dynamic_list($source);
         $source = array();
         if ($dynamicList) {
             $items = $dynamicList->Items();
             foreach ($items as $item) {
                 $source[$item->Title] = $item->Title;
             }
         }
     }
     $this->addExtraClass('dropdown');
     parent::__construct($name, $title, $source, $value, $form, $emptyString);
 }
 /**
  * @throws Exception
  *
  * @param string $name
  * @param string $title = null
  * @param SS_List $source = null
  * @param string $value = ''
  * @param Form $form = null
  * @param string $emptyString = null
  * @return FormField|false
  */
 public function __construct($name, $title = null, $source = null, $value = '', $form = null, $emptyString = null)
 {
     // if a source is given it should be a SS_List of TimeZone objects
     if (!is_null($source) && !is_a($source, 'SS_List')) {
         throw new Exception('$source must be null to use the provided values, or an SS_List of TimeZone objects');
         return false;
     }
     // if no source has been defined we assume the default time zones will be used
     if (!$source) {
         $source = TimeZoneData::get();
     }
     // default to setting defined in php configuration
     if ($defaultTZ = TimeZoneData::get()->where("Identifier='" . date_default_timezone_get() . "'")->First()) {
         if (!$emptyString) {
             parent::setEmptyString($defaultTZ->Title);
         }
     }
     // leave the actual field
     return parent::__construct($name, $title, $source->sort('Title')->map('Identifier', 'Title'), $value, $form, $emptyString);
 }
 public function __construct($name, $title = null, $source = null, $value = "", $form = null)
 {
     if (!is_array($source)) {
         // Get a list of countries from Zend
         $source = Zend_Locale::getTranslationList('territory', $this->locale(), 2);
         // We want them ordered by display name, not country code
         // PHP 5.3 has an extension that sorts UTF-8 strings correctly
         if (class_exists('Collator') && ($collator = Collator::create($this->locale()))) {
             $collator->asort($source);
         } else {
             asort($source);
         }
         // We don't want "unknown country" as an option
         unset($source['ZZ']);
         // We don't want a number of countries which have ceased to exist
         unset($source['SU']);
         // Soviet Union
         unset($source['BQ']);
         // British Antarctic Territory
         unset($source['CT']);
         // Canton and Enderbury Islands
         unset($source['NQ']);
         // Dronning Maud Land
         unset($source['FX']);
         // France, Metropolitan
         unset($source['FQ']);
         // French Southern and Antarctic Territories
         unset($source['NT']);
         // Iraq-Saudi-Arabia Neutral Zone
         unset($source['PZ']);
         // Panama Canal Zone
         unset($source['CS']);
         // Serbia and Montenegro
     }
     parent::__construct($name, $title === null ? $name : $title, $source, $value, $form);
 }
 /**
  * @param string $name
  * @param string $title
  * @param null|DataList $source
  * @param null|DataList $value
  */
 public function __construct($name, $title = '', $source = null, $value = null, $exclusions = array())
 {
     parent::__construct($name, $title, $source, $value);
     $this->exclusions = $exclusions;
 }
Ejemplo n.º 28
0
 function __construct($name, $title = "")
 {
     parent::__construct($name, $title, Permission::get_codes(true));
 }
 /**
  * @param string $name
  * @param string $title
  * @param array|SS_List $source
  * @param array|SS_List $value
  */
 public function __construct($name, $title = '', $source = array(), $value = array())
 {
     parent::__construct($name, $title, $source, $value);
 }
Ejemplo n.º 30
0
 /**
  * Creates a new optionset field.
  * @param name The field name
  * @param title The field title
  * @param source An map of the dropdown items
  * @param value The current value
  * @param form The parent form
  */
 function __construct($name, $title = "", $source = array(), $value = "", $form = null)
 {
     parent::__construct($name, $title, $source, $value, $form);
 }