ad parent paramter to pis

This commit is contained in:
stubbfel
2013-10-16 11:16:46 +02:00
parent 4494bf9c5c
commit 9f263bc454
5 changed files with 70 additions and 11 deletions

View File

@@ -61,7 +61,7 @@ class PisSqlManager extends SQLManager {
* @var string
*/
private static $orderByTerm = " ORDER BY pid, iName";
/**
* String for like-Statement fo iValue field
* @var string
@@ -74,6 +74,12 @@ class PisSqlManager extends SQLManager {
*/
private static $pidTerm = "pid = ";
/**
* String for the parent part of the query
* @var string
*/
private static $parentTerm = "parent = ";
/**
* String for the iName part of the query
* @var string
@@ -105,7 +111,7 @@ class PisSqlManager extends SQLManager {
* @param array $queryArgs
* @return array [num][assoc]
*/
public function sendPisQuery($pidList, $iNameList, $iPatter = "*") {
public function sendPisQuery($pidList, $parentId, $iNameList, $iPatter = "*") {
// build query string
$query = self::$selectTerm;
@@ -117,6 +123,13 @@ class PisSqlManager extends SQLManager {
return null;
}
if ($parentId != "*" && \utiliy\StringManager::validInt($parentId)) {
if ($query != self::$selectTerm) {
$query .= self::$andTerm;
}
$query .= self::$parentTerm . "$parentId";
}
if (count($iNameList) > 0 && \utiliy\ArrayManager::validAlphaNumList($iNameList)) {
if ($query != self::$selectTerm) {
$query .= self::$andTerm;
@@ -130,15 +143,15 @@ class PisSqlManager extends SQLManager {
if ($query != self::$selectTerm) {
$query .= self::$andTerm;
}
$query .= self::$iValueLikeTerm ."'%$iPatter%'";
$query .= self::$iValueLikeTerm . "'%$iPatter%'";
}
if ($query == self::$selectTerm) {
$query = self::$selectAllTerm;
}
$query .= self::$orderByTerm;
// send query
return $this->query($query);
}