Example #1
0
function drawImage($value, $isLocalPath = false)
{
    if ($value == '') {
        return '';
    }
    return Html::a(Html::img($value, ['class' => 'thumbnail']), FileUpload::getOriginal($value, $isLocalPath), ['target' => '_blank']);
}
Example #2
0
 protected function insertGetValue($value, $field)
 {
     $name = $field[self::POS_DB_NAME];
     if (isset($field[self::POS_RULE])) {
         if ($field[self::POS_RULE] != '') {
             if ($field[self::POS_RULE] == 'file') {
                 return FileUpload::onInsert($value, $field, $this);
             }
         }
     }
     if (isset($field[self::POS_RULE])) {
         if ($field[self::POS_RULE] != '') {
             if ($field[self::POS_RULE] == 'date') {
                 $format = ArrayHelper::getValue($field, BaseForm::POS_PARAMS . '.format', '');
                 if ($format != '') {
                     if (StringHelper::startsWith($format, 'php:')) {
                         $format = substr($format, 4);
                         if (!is_null($this->{$name})) {
                             if ($this->{$name} != '') {
                                 $date = \DateTime::createFromFormat($format, $this->{$name}, new \DateTimeZone('UTC'));
                                 return $date->format('Y-m-d');
                             }
                         }
                     }
                 }
                 return '';
             }
         }
     }
     return $this->{$name};
 }