/**
  * Get the requested (POST or GET) value of a field
  *
  * Method will search through all the POST and GET array values are return the field
  * value if found. Method will the POST and GET arrays in order based on the PHP INI
  * value 'variables_order' (the GPC order)
  *
  * @access public
  * @return mixed The value of the form field, if found. Empty string if not found
  */
 public function getFieldRequestValue()
 {
     $options = parent::getFieldRequestValue();
     if (is_array($options)) {
         $options = array_filter($options);
         $options = array_values($options);
     }
     return $options;
 }
 /**
  * Get the requested (POST or GET) value of a field
  *
  * Method will search through all the POST and GET array values are return the field
  * value if found. Method will the POST and GET arrays in order based on the PHP INI
  * value 'variables_order' (the GPC order)
  *
  * @access public
  * @return mixed The value of the form field, if found. Empty string if not found
  */
 public function getFieldRequestValue()
 {
     $day = parent::getFieldRequestValue('Day');
     $month = parent::getFieldRequestValue('Month');
     $year = parent::getFieldRequestValue('Year');
     if ($day == '' || $month == '' || $year == '') {
         return '';
     } else {
         return date('Y-m-d', mktime(1, 1, 1, $month, $day, $year));
     }
 }
Exemplo n.º 3
0
 /**
  * Build the frontend HTML for the form field
  *
  * Method will build and return the frontend HTML of the loaded form field. The form field must be
  * loaded before hand
  *
  * @access public
  * @return string The frontend form field HTML if the form field was loaded beforehand, FALSE if not
  */
 public function loadForFrontend()
 {
     if (!$this->isLoaded()) {
         return false;
     }
     $args = array();
     $tmpArgs = $this->extraInfo;
     unset($tmpArgs['defaultvalue']);
     /**
      * Add in the needed formfield class name
      */
     if (!isset($tmpArgs['class'])) {
         $tmpArgs['class'] = '';
     }
     $tmpArgs['class'] = trim($tmpArgs['class'] . ' FormField');
     /**
      * Create all the form element arguments
      */
     foreach ($tmpArgs as $arg => $val) {
         if ($val == '') {
             continue;
         }
         $args[] = $arg . '="' . isc_html_escape($val) . '"';
     }
     if ($this->value == '' && $this->extraInfo['defaultvalue'] !== '') {
         $defaultValue = $this->extraInfo['defaultvalue'];
     } else {
         $defaultValue = $this->value;
     }
     /**
      * If we are in the admin then we need to actually display the password in plain text
      */
     $templateFile = '';
     if (defined('ISC_ADMIN_CP') && ISC_ADMIN_CP) {
         $templateFile = 'singleline';
         $GLOBALS['FormFieldValue'] = isc_html_escape($defaultValue);
         /**
          * Else because this can be left unchanged without passing a value to it (frontend only),
          * then we cannot really set this as required if we originally have a value for it
          */
     } else {
         $alreadySet = parent::getFieldRequestValue('AlreadySet');
         if ($this->valueSetFromDB || $alreadySet == '1') {
             $this->addExtraHiddenArgs('AlreadySet', '1', 'AlreadySet');
         }
     }
     /**
      * Are we displaying the 'leave password blank' message?
      */
     if (!$this->setLeaveBlankLabel) {
         $GLOBALS['FormFieldHidePasswordMsg'] = 'none';
     }
     $GLOBALS['FormFieldDefaultArgs'] = implode(' ', $args);
     $GLOBALS['FormFieldDefaultArgs'] .= ' id="' . isc_html_escape($this->getFieldId()) . '" name="' . isc_html_escape($this->getFieldName()) . '" ';
     return $this->buildForFrontend($templateFile);
 }