public function test__toString() { $expectedHtml = '<a href="#" class="null">Heading</a>'; $this->assertEquals($expectedHtml, $this->sortableHeaderCell->__toString()); $this->sortableHeaderCell->setProperties(array('label' => 'Column 1', 'sortUrl' => 'index.php?sort=ASC', 'currentSortOrder' => 'DESC')); $expectedHtml = '<a href="index.php?sort=ASC" class="DESC">Column 1</a>'; $this->assertEquals($expectedHtml, $this->sortableHeaderCell->__toString()); }
// group without a header, set rowspan = 2. $rowspan = 2; } } foreach ($group->getHeaders() as $header) { $sortOrderStyle = 'null'; if ($header->isSortable()) { $nextSortOrder = $currentSortOrder == 'ASC' ? 'DESC' : 'ASC'; $nextSortOrder = $currentSortField == $header->getSortField() ? $nextSortOrder : 'ASC'; $sortOrderStyle = $currentSortOrder == '' ? 'null' : $currentSortOrder; $sortOrderStyle = $currentSortField == $header->getSortField() ? $sortOrderStyle : 'null'; $currentModule = sfContext::getInstance()->getModuleName(); $currentAction = sfContext::getInstance()->getActionName(); $sortUrl = public_path("index.php/{$currentModule}/{$currentAction}?sortField={$header->getSortField()}&sortOrder={$nextSortOrder}", true); $headerCell = new SortableHeaderCell(); $headerCell->setProperties(array('label' => __($header->getName()), 'sortUrl' => $sortUrl, 'currentSortOrder' => $sortOrderStyle)); } else { $headerCell = new HeaderCell(); $headerCell->setProperties(array('label' => __($header->getName()))); } $headerCellClassHtml = getHeaderCellClassHtml($header->isSortable(), $sortOrderStyle); $headerCellHtml = '<th rowspan="' . $rowspan . '" style="width:' . $header->getWidth() . '"' . $headerCellClassHtml . '>' . $headerCell->__toString() . "</th>\n"; if ($group->showHeader()) { $headerRow2 .= $headerCellHtml; } else { $headerRow1 .= $headerCellHtml; } } } ?> <thead>