コード例 #1
0
ファイル: index.php プロジェクト: bwarbelton/BackpackPHP
function getChildren()
{
    $request = \Slim\Slim::getInstance()->request();
    $firstName = $request->params('firstName');
    $lastName = $request->params('lastName');
    $child = null;
    if ($firstName == null && $lastName == null) {
        $child = fetchChildren();
    } else {
        $child = fetchChildrenByName($firstName, $lastName);
    }
}
コード例 #2
0
ファイル: readFunctions.php プロジェクト: raedatoui/View
function fetchChildren($contentid, $depth, $level = 0)
{
    // this function is used by get children recursively
    global $arrChildIDs;
    // retrieve all children of $parent
    $sendParams = array();
    $sql = "SELECT content.id FROM content WHERE parentid = :contentid";
    $sendParams['contentid'] = $contentid;
    $result = queryDatabase($sql, $sendParams);
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
        $arrChildIDs[] = $row['id'];
        if ($depth == -1) {
            fetchChildren($row['id'], $level + 1);
        } else {
            if ($level + 1 < $depth) {
                fetchChildren($row['id'], $level + 1);
            }
        }
    }
}