コード例 #1
0
 /**
  * Appends display field names to select statement.
  * @param string $selectStatement
  * @param DisplayField $displayField
  * @return string 
  */
 public function constructSelectClauseForDisplayField($selectStatement, $displayField)
 {
     $clause = $displayField->getName();
     if (KeyHandler::keyExists() && $displayField->getIsEncrypted()) {
         $clause = 'AES_DECRYPT(UNHEX(' . $displayField->getName() . '),"' . KeyHandler::readKey() . '")';
     }
     if ($displayField->getIsValueList()) {
         $clause = "GROUP_CONCAT(DISTINCT " . $clause . " SEPARATOR '|\\n|' ) ";
     }
     $fieldAlias = $displayField->getFieldAlias();
     if (!empty($fieldAlias)) {
         $clause = $clause . " AS " . $fieldAlias;
     }
     if (empty($selectStatement)) {
         $selectStatement = $clause;
     } else {
         $selectStatement .= ',' . $clause;
     }
     return $selectStatement;
 }