コード例 #1
0
ファイル: TableModel.php プロジェクト: jjspider277/weddings
 public function getTransformedData($rowActions = array(RowActions::Editar, RowActions::Eliminar, RowActions::Detalles))
 {
     $records = $this->constructData();
     $iTotalRecords = $this->getTotalElements();
     $iDisplayStart = $this->container->get('request')->get('iDisplayStart');
     $iDisplayLength = $this->container->get('request')->get('iDisplayLength');
     $iDisplayLength = $iDisplayLength == -1 ? UtilRepository2::getTotalElements() : $iDisplayLength;
     $end = $iDisplayStart + $iDisplayLength;
     $end = count($this->datos);
     //        $cant = $end > $iTotalRecords ? $iTotalRecords : $end;
     $cant = $end;
     $start = $iDisplayStart;
     $result = array();
     $result["aaData"] = array();
     for ($i = 0; $i < $cant; $i++) {
         $row = $start + $i + 1;
         $tmpArray = array();
         if ($this->rowNumberColumn) {
             $tmpArray[] = $row;
         }
         if ($this->hasCheck()) {
             if (is_array($this->datos[$i])) {
                 $tmpArray[] = $this->getCheckBox($this->datos[$i][$this->id]);
             } else {
                 $tmpArray[] = $this->getCheckBox($this->datos[$i]->getId());
             }
         }
         $tmpArray = array_merge($tmpArray, $records[$i]);
         if (count($rowActions) > 0) {
             $tmpArray[] = $this->getRowActions($rowActions);
         }
         if (is_array($this->datos[$i])) {
             $tmpArray["DT_RowId"] = $this->datos[$i]['id'];
         } else {
             $tmpArray["DT_RowId"] = $this->tableId . "_" . $this->datos[$i]->getId();
         }
         $result["aaData"][] = $tmpArray;
     }
     $result["iTotalDisplayRecords"] = $iTotalRecords;
     $result["iTotalRecords"] = $iTotalRecords;
     $result["checkeds"] = $this->checkeds;
     $result["extraData"] = $this->detailData();
     return $result;
 }