salve ragazzi , ho scaricato una classe per il datagrid , adesso succede che ,dovrei adattare la classe alle mie esigenze , che sarebbero modificare la connessione interna al database questa e l originale ,
Codice PHP:
private function getDataHTML()
{
$tmpHTML = "";
$db = new flor_db_process();
$db->resultSet = $this->resultSet;
$db->reset();
$gridHeaderComplete = false;
if (!$gridHeaderComplete)
{
$tmpHTML = $this->getHeaderHTML();
$gridHeaderComplete = true;
}
if ($this->resultSet)
{
$this->rowCount = $this->resultSet->num_rows;
if ($this->rowCount==0)
$tmpHTML .= $this->getTableHTML("NODATA");
else
{
while($tmpRow = $db->getRow2())
{
$this->curRowId++;
if ($this->pageByName)
{
$tmpCellVal = $tmpRow[$this->pageByName_field];
if (!$tmpCellVal)
continue; //skip row
$tmpStr1 = strtoupper(substr($tmpCellVal,0,1));
if (is_numeric($tmpStr1) && $this->curPgAlphaIndex == "0-9")
{
//is numeric value
}
elseif ($tmpStr1 != strtoupper($this->curPgAlphaIndex))
continue; //skip row
}
elseif($this->paging)
{
if ($this->curPgIndex == 1)
$lowRowID = 0;
else
$lowRowID = (($this->curPgIndex-1) * $this->paging_NoOfRows)+1;
$hiRowID = $this->curPgIndex * $this->paging_NoOfRows;
if ($this->curRowId >= $lowRowID &&
$this->curRowId <= $hiRowID)
{
//allow row.. it belongs to page
}
else
continue; //skip row.
}
$tmpHTML .= $this->getDataRowHTML($tmpRow);
}
}
}
else
$tmpHTML .= $this->getTableHTML("NODATA");
//echo "*".$this->rowCount."*".$this->columnCount."*";
//print_r($this->colInfo);
return $tmpHTML;
}
e qui e quella che ho modificato :
Codice PHP:
private function getDataHTML()
{
$tmpHTML = "";
$dbcore = new DB();
$dbcore->getnumrows = $this->resultSet;
echo '<pre>';
print_r($dbcore );
echo '</pre>';
$gridHeaderComplete = false;
if (!$gridHeaderComplete)
{
$tmpHTML = $this->getHeaderHTML();
$gridHeaderComplete = true;
}
if ($this->resultSet)
{
$this->rowCount = $this->resultSet->num_rows;
if ($this->rowCount==0)
$tmpHTML .= $this->getTableHTML("NODATA");
else
{
while($tmpRow = $dbcore->getlist())
{
$this->curRowId++;
if ($this->pageByName)
{
$tmpCellVal = $tmpRow[$this->pageByName_field];
if (!$tmpCellVal)
continue; //skip row
$tmpStr1 = strtoupper(substr($tmpCellVal,0,1));
if (is_numeric($tmpStr1) && $this->curPgAlphaIndex == "0-9")
{
//is numeric value
}
elseif ($tmpStr1 != strtoupper($this->curPgAlphaIndex))
continue; //skip row
}
elseif($this->paging)
{
if ($this->curPgIndex == 1)
$lowRowID = 0;
else
$lowRowID = (($this->curPgIndex-1) * $this->paging_NoOfRows)+1;
$hiRowID = $this->curPgIndex * $this->paging_NoOfRows;
if ($this->curRowId >= $lowRowID &&
$this->curRowId <= $hiRowID)
{
//allow row.. it belongs to page
}
else
continue; //skip row.
}
$tmpHTML .= $this->getDataRowHTML($tmpRow);
}
}
}
else
$tmpHTML .= $this->getTableHTML("NODATA");
//echo "*".$this->rowCount."*".$this->columnCount."*";
//print_r($this->colInfo);
return $tmpHTML;
}
ho fatto un print_r(); della mia classe , e mi da questo
codice:
DB Object
(
[dbcore] =>
[host] => localhost
[user] => root
[pass] => maurizio
[name] => vx
[getnumrows] => Array
(
[Id] => 8
[FirstName] => Chris
[LastName] => Rich
[BirthDate] => 2003-09-03
[Gender] => f
[Done] => 33
)
)
pero non fa il calcolo perche mi potreste dare una mano grazie mille