コード例 #1
0
ファイル: recommend.php プロジェクト: nunoflores/driver
function driver_getRecommendation($lastJump)
{
    $currentPage = $lastJump['page'];
    if (isset($lastJump['section'])) {
        $currentPage = $lastJump['page'] . '#' . sectionId($lastJump['section']) . '=' . $lastJump['section'];
    }
    $output = '';
    $output .= '<div id=driver_recommendation class=driver_rbox>';
    //$output .= '<table class=driver_rbox_table>';
    //$output .= '<tr><td class=driver_rbox_table_title_column>Try these...</td></tr>';
    //$output .= '<tr><td class=driver_rbox_table_column >';
    if (!page_exists($currentPage)) {
        $output .= '<div align="center" style="font-style:italic"> nowhere yet...</div>';
        $output .= '</div>';
        return $output;
    }
    error_log("currentPage: " . print_r($currentPage, true));
    $recommend = driverdb_getMostNextSteps($currentPage);
    error_log("recommend: " . print_r($recommend, true));
    foreach ($recommend as $page => $count) {
        unset($trailPage);
        // is it section?
        $pageParts = explode("#", $page);
        if (sizeof($pageParts) > 1) {
            //its section, then parse title
            $sectionParts = explode("=", $pageParts[1]);
            $trailPage['section'] = $sectionParts[1];
        }
        $trailPage['id'] = $pageParts[0];
        $trailPage['name'] = trimPageTitle(get_first_heading($pageParts[0]), 40);
        $output .= printTrailPage($trailPage, '_parent', '', '', 'trail_page_recommend', $count);
    }
    //$output .= '</td></tr>';
    //$output .='</table>';
    $output .= '</div>';
    return $output;
}
コード例 #2
0
ファイル: db.php プロジェクト: nunoflores/driver
function driverdb_printout()
{
    $db = driverdb_startDb();
    print "<h2>recommend</h2>";
    print_r(driverdb_getMostNextSteps('start'));
    print "<h2>test</h2>";
    $lp = 3;
    $order = 0;
    $resultSet = $db->executeQuery("SELECT pageid, ord AS x FROM step WHERE lp=2 AND x=1");
    $resultSet->dump();
    print "<h2>lp</h2>";
    $resultSet = $db->executeQuery("SELECT * FROM lp");
    $resultSet->dump();
    print "<h2>steps</h2>";
    $resultSet = $db->executeQuery("SELECT * FROM step");
    $resultSet->dump();
    print "<h2>rating</h2>";
    $resultSet = $db->executeQuery("SELECT * FROM rating");
    $resultSet->dump();
}