Пример #1
0
 public function render($row)
 {
     $maxLenght = $this->getColumn()->getStringLimit() ? $this->getColumn()->getStringLimit() : 250;
     $text = parent::_getValue($row);
     $suffix = $this->getColumn()->getSuffix() ? $this->getColumn()->getSuffix() : '...';
     if (strlen($text) > $maxLenght) {
         return substr($text, 0, $maxLenght) . $suffix;
     } else {
         return $text;
     }
 }
Пример #2
0
 /**
  * Renders grid column
  *
  * @param Core_Object $row
  * @return mixed
  */
 public function _getValue($row)
 {
     $format = $this->getColumn()->getFormat();
     $defaultValue = $this->getColumn()->getDefault();
     if (is_null($format)) {
         // If no format and it column not filtered specified return data as is.
         $data = parent::_getValue($row);
         $string = is_null($data) ? $defaultValue : $data;
         return htmlspecialchars($string);
     } elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
         // Parsing of format string
         $formatedString = $format;
         foreach ($matches[0] as $matchIndex => $match) {
             $value = $row[$matches[1][$matchIndex]];
             $formatedString = str_replace($match, $value, $formatedString);
         }
         return $formatedString;
     } else {
         return htmlspecialchars($format);
     }
 }
Пример #3
0
 public function renderCss()
 {
     return parent::renderCss() . ' a-right';
 }