hasValue() 공개 메소드

Prueft, ob eine Spalte im Resultset vorhanden ist.
public hasValue ( string $feldname ) : boolean
$feldname string Name der Spalte
리턴 boolean
 $files->setQuery($qry);
 print '<tbody>';
 for ($i = 0; $i < $files->getRows(); $i++) {
     $file_id = $files->getValue('file_id');
     $file_name = $files->getValue('filename');
     $file_oname = $files->getValue('originalname');
     $file_title = $files->getValue('title');
     $file_type = $files->getValue('filetype');
     $file_size = $files->getValue('filesize');
     $file_stamp = rex_formatter::format($files->getValue('updatedate'), "strftime", "datetime");
     $file_updateuser = $files->getValue('updateuser');
     $encoded_file_name = urlencode($file_name);
     // Eine titel Spalte schätzen
     $alt = '';
     foreach (array('title', 'med_description') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $alt = htmlspecialchars($files->getValue($col));
             break;
         }
     }
     // Eine beschreibende Spalte schätzen
     $desc = '';
     foreach (array('med_description') as $col) {
         if ($files->hasValue($col) && $files->getValue($col) != '') {
             $desc = htmlspecialchars($files->getValue($col));
             break;
         }
     }
     if ($desc != '') {
         $desc .= '<br />';
     }
 /**
  * return array with the meta name & values
  * it test if the form is posted or not and add the necessary values
  * @return array
  */
 public function getMetaValues()
 {
     global $REX;
     $returnArray = array();
     $this->sqlFields->reset();
     for ($i = 0; $i < $this->sqlFields->getRows(); $i++, $this->sqlFields->next()) {
         $fieldName = $this->sqlFields->getValue('name');
         $fieldType = $this->sqlFields->getValue('type');
         $fieldAttributes = $this->sqlFields->getValue('attributes');
         $postValue = rex_post($fieldName, 'array', null);
         // Wert aus der DB nehmen, falls keiner extern und keiner im POST angegeben
         if ($postValue === null && $this->sql->getRows() == 1 && $this->sql->hasValue($fieldName)) {
             $postValue = $this->sql->getValue($fieldName);
         }
         // dont save restricted fields
         $attrArray = rex_split_string($fieldAttributes);
         if (isset($attrArray['perm'])) {
             if (!$REX['USER']->hasPerm($attrArray['perm'])) {
                 continue;
             }
             unset($attrArray['perm']);
         }
         // handle date types with timestamps
         if (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day']) && isset($postValue['hour']) && isset($postValue['minute'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
             } else {
                 $saveValue = 0;
             }
         } elseif (is_array($postValue) && isset($postValue['year']) && isset($postValue['month']) && isset($postValue['day'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime(0, 0, 0, (int) $postValue['month'], (int) $postValue['day'], (int) $postValue['year']);
             } else {
                 $saveValue = 0;
             }
         } elseif (is_array($postValue) && isset($postValue['hour']) && isset($postValue['minute'])) {
             if (isset($postValue['active'])) {
                 $saveValue = mktime((int) $postValue['hour'], (int) $postValue['minute'], 0, 0, 0, 0);
             } else {
                 $saveValue = 0;
             }
         } else {
             if (count($postValue) > 1) {
                 // Mehrwertige Felder
                 $saveValue = '|' . implode('|', $postValue) . '|';
             } else {
                 $postValue = is_array($postValue) && isset($postValue[0]) ? $postValue[0] : $postValue;
                 if ($fieldType == REX_A62_FIELD_SELECT && strpos($fieldAttributes, 'multiple') !== false || $fieldType == REX_A62_FIELD_CHECKBOX) {
                     // Mehrwertiges Feld, aber nur ein Wert ausgewählt
                     $saveValue = '|' . $postValue[0] . '|';
                 } else {
                     // Einwertige Felder
                     $saveValue = $postValue;
                 }
             }
         }
         // Wert in SQL zum speichern
         $returnArray[$fieldName] = $saveValue;
     }
     return $returnArray;
 }