Esempio n. 1
0
 /**
  * Retrieves the sort options for this attribute which is used in recordlists
  * and search actions.
  *
  * @param ColumnConfig $columnConfig The config that contains options for
  *                                   extended sorting and grouping to a
  *                                   recordlist.
  * @param string $fieldprefix The prefix of the attribute
  * @param DataGrid $grid The grid that this attribute lives on.
  *
  * @return string HTML
  */
 public function sortOptions($columnConfig, $fieldprefix = '', $grid = null)
 {
     if (!$this->hasFlag(self::AF_TOTAL) && $columnConfig->totalizable()) {
         // if we are not the sumcolumn itself, but there are totalcolumns present, we can perform subtotalling
         $cmd = $columnConfig->hasSubTotal($this->fieldName()) ? 'unsubtotal' : 'subtotal';
         if ($grid == null) {
             return Tools::href(Config::getGlobal('dispatcher') . '?' . $columnConfig->getUrlCommand($this->fieldName(), $cmd), Tools::atktext('column_' . $cmd)) . ' ';
         } else {
             $call = $grid->getUpdateCall($columnConfig->getUrlCommandParams($this->fieldName(), $cmd));
             return '<a href="javascript:void(0)" onclick="' . htmlentities($call) . '">' . $this->text('column_' . $cmd) . '</a>';
         }
     }
     return '';
 }