Пример #1
0
 /**
  * Formats cell's content.
  * @param  mixed
  * @param  DibiRow|array
  * @return string
  */
 public function formatContent($value, $data = NULL)
 {
     if ((int) $value == NULL || empty($value)) {
         return 'N/A';
     }
     $value = parent::formatContent($value, $data);
     $value = is_numeric($value) ? (int) $value : ($value instanceof DateTime ? $value->format('U') : strtotime($value));
     return strftime($this->format, $value);
 }
Пример #2
0
 public function getFilters($source)
 {
     $filters = array();
     // Apply same filters on each column
     foreach ($this->joinColumns as $columnName) {
         $tempFilters = parent::getFilters($source);
         foreach ($tempFilters as $filter) {
             $filter->setColumnName($columnName);
         }
         $filters = array_merge($filters, $tempFilters);
     }
     return $filters;
 }
Пример #3
0
 /**
  * @param string $caption column's textual caption
  * @param string $format date format supported by $func
  * @param string $func function to format date
  */
 public function __construct($caption = NULL, $format = '%x', $func = 'strftime')
 {
     parent::__construct($caption);
     $this->format = $format;
     $this->func = \Nette\Utils\Callback::check($func);
 }
Пример #4
0
 /**
  * @param string $caption column's textual caption
  */
 public function __construct($caption = NULL)
 {
     throw new \Nette\NotImplementedException('Class was not implemented yet.');
     parent::__construct($caption);
 }
 public function testTextColumnsModule()
 {
     $module = TextColumnsModule::create();
     $module->ContentTitle = 'Test';
     $module->write();
     $this->assertTrue($module->ID > 0);
     $i = TextColumn::create();
     $i->Title = 'Test';
     $i->Text = 'Text';
     $i->Sort = 4;
     $i->write();
     $module->Columns()->add($i);
     $this->assertEquals($module->Columns()->count(), 1);
 }
Пример #6
0
 public function testTooLong()
 {
     $this->expectException(ColumnException::class);
     $column = new TextColumn('foo', 'text');
     $column->check(str_repeat('a', 65536));
 }