7 * Use ANSI color codes for output coloring
14 * @var \Console_Color2
18 public function render($arEvents)
21 $this->cc = new \Console_Color2();
24 $tbl = new \Console_Table(
25 CONSOLE_TABLE_ALIGN_LEFT,
26 array('sect' => '', 'rule' => '-', 'vert' => ''),
29 $tbl->setAlign(0, CONSOLE_TABLE_ALIGN_RIGHT);
30 $tbl->setAlign(1, CONSOLE_TABLE_ALIGN_RIGHT);
34 array('Days', 'Age', 'Name', 'Event', 'Date', 'Day'),
38 $tbl->setBorderVisibility(
48 foreach ($arEvents as $event) {
50 if ($event->days == 0) {
58 wordwrap($event->title, 30, "\n", true),
59 wordwrap($event->type, 20, "\n", true),
61 strftime('%a', strtotime($event->localDate))
67 return $tbl->getTable();
70 protected function ansiWrap($data, $colorCode = null)
72 if (!$this->ansi || $colorCode === null) {
76 foreach ($data as $k => &$value) {
77 $value = $this->cc->convert(
78 $colorCode . $value . '%n'