Exemplo n.º 1
0
 /**
  * Export one row
  * @param Array $AssociativeRowArray - array containing fieldName=>fieldValue
  */
 function exportRow($AssociativeRowArray)
 {
     if (!$this->filter->filter($AssociativeRowArray)) {
         $this->hasLines = true;
         $width = 20;
         if ($this->rows == 0) {
             $this->toReturn .= "<tr class=\"tbHRow\">";
             $column = 0;
             foreach ($AssociativeRowArray as $field => $value) {
                 if (!in_array($field, $this->ignoredFields)) {
                     if ($this->columnSizes != null) {
                         if ($this->columnSizes[$column]) {
                             $width = $this->columnSizes[$column];
                         } else {
                             $width = 11;
                         }
                     }
                     $this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . Utils::translate("label.tc." . $field) . "</td>";
                     $column++;
                 }
             }
             if ($this->columnSizes != null) {
                 $width = $this->columnSizes[count($this->columnSizes) - 1];
             }
             $this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . Utils::translate("selected") . "</td>";
             $this->toReturn .= "</tr>";
         }
         $this->rows++;
         $this->toReturn .= "<tr class=\"tbRow\">";
         $column = 0;
         $id = -1;
         foreach ($AssociativeRowArray as $field => $value) {
             $this->rows++;
             if ($field == $this->idField) {
                 $id = $value;
                 if ($this->cellRenderer != null) {
                     $this->cellRenderer->setAName($id);
                 }
             }
             if (!in_array($field, $this->ignoredFields)) {
                 if ($this->columnSizes != null) {
                     if ($this->columnSizes[$column]) {
                         $width = $this->columnSizes[$column];
                     } else {
                         $width = 11;
                     }
                 }
                 $renderedValue = $value;
                 if ($this->cellRenderer != null) {
                     $renderedValue = $this->cellRenderer->render($field, $value);
                 }
                 $this->toReturn .= "<td class=\"tbCell\" style=\"width:{$width}%;\">" . $renderedValue . "</td>";
                 $column++;
             }
         }
         $this->toReturn .= "<td class=\"tbCell\"><input type=\"checkbox\" class=\"cb-element\" value=\"{$id}\" onclick=\"addToDelete({$id});\"/></td>";
         $this->toReturn .= "</tr>";
     } else {
         // row filtered
     }
 }