$rowspan = 2; } } foreach ($group->getHeaders() as $header) { 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()))); } $headerCellHtml = '<th style="text-align: ' . $header->getTextAlignmentStyleForHeader() . '"' . ' rowspan="' . $rowspan . '">' . $headerCell->__toString() . "</th>\n"; if ($group->showHeader()) { $headerRow2 .= $headerCellHtml; } else { $headerRow1 .= $headerCellHtml; } } } ?> <thead> <tr><?php echo $headerRow1; ?>
} } 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> <tr><?php echo $headerRow1;
public function test__toString() { $this->assertEquals('<span class="headerCell">Heading</span>', $this->headerCell->__toString()); $this->headerCell->setProperties(array('label' => 'First Name')); $this->assertEquals('<span class="headerCell">First Name</span>', $this->headerCell->__toString()); }