Exemplo n.º 1
0
 function recImplode($glue, $array)
 {
     $res = '';
     $i = 0;
     $count = count($array);
     foreach ($array as $el) {
         $str = '';
         if (is_array($el)) {
             $str = recImplode('', $el);
         } else {
             $str = $el;
         }
         $res .= $str;
         if ($i < $count - 1) {
             $res .= $glue;
         }
         $i++;
     }
     return $res;
 }
Exemplo n.º 2
0
 public function displayValue()
 {
     $value = '';
     switch ($this->html) {
         case 'countryList':
             $value = fieldAdapterCsp::displayCountry($this->value);
             break;
         case 'statesList':
             $value = fieldAdapterCsp::displayState($this->value);
             break;
         case 'checkboxlist':
             $options = $this->getHtmlParam('optionsCsp');
             $value = array();
             if (!empty($options) && is_array($options)) {
                 foreach ($options as $opt) {
                     if (isset($opt['checked']) && $opt['checked']) {
                         $value[] = $opt['text'];
                     }
                 }
             }
             if (empty($value)) {
                 $value = langCsp::_('N/A');
             } else {
                 $value = implode('<br />', $value);
             }
             break;
         case 'selectbox':
         case 'radiobuttons':
             $options = $this->getHtmlParam('optionsCsp');
             if (!empty($options) && !empty($options[$this->value])) {
                 $value = $options[$this->value];
             } else {
                 $value = langCsp::_('N/A');
             }
             break;
         default:
             if ($this->value == '') {
                 $value = langCsp::_('N/A');
             } else {
                 if (is_array($this->value)) {
                     $options = $this->getHtmlParam('optionsCsp');
                     if (!empty($options) && is_array($options)) {
                         $valArr = array();
                         foreach ($this->value as $v) {
                             $valArr[] = $options[$v];
                         }
                         $value = recImplode('<br />', $valArr);
                     } else {
                         $value = recImplode('<br />', $this->value);
                     }
                 } else {
                     $value = $this->value;
                 }
             }
             break;
     }
     if ($echo) {
         echo $value;
     } else {
         return $value;
     }
 }