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; }
<tr><td id="td-effect" colspan=2> <div id="effect" class="ui-widget-content ui-corner-all"> <iframe id="preview" name="preview" class="preview"> </iframe> </div> </td></tr> </table> <table width=100%><tr><td id="td-lp"> <div id="learningPath" class='droptrue' > <?php session_start(); $trail = $_SESSION[DOKU_COOKIE]['trail']; //print_r($trail); $data = processTrailArrayForPrinting($trail); foreach ($data as $page) { print printTrailPage($page, '', 'onPreviewPage'); } ?> </div> </td></tr> </table> <hr> <h2>The Way to Enlightenment</h2> <div align="right"><i>"I only show you the door...you're the one who has to walk through it..." </i>Morpheus, <i>in "The Matrix"</i></div> <div id="finalPath" class='droptrue' style="width:100%;height:90px"> </div> <div align="right"> <table><tr><td style="padding-top:5px"> <div id="similarPaths" style="float:left">No similar paths found.</div> </td><td>
function driver_showLearningPath($render = true) { // show only if user is logged in. if (!isLoggedIn()) { return; } if (!isset($_SESSION[DOKU_COOKIE]['isTrailing'])) { return; } //get trail from SESSION $trail = $_SESSION[DOKU_COOKIE]['trail']; if (!isset($trail)) { // trail must be starting print "Trail not in session space."; } // parse id page names //print_r($trail); $data = processTrailArrayForPrinting($trail); // handle overflow // Count letters until reaches threshold. If beyond threshold, show last ones below visible threshold. $threshold = 100; // FIXME: Make configurable... $letters = 0; $printout = array(); while ($letters < $threshold && count($data) > 0) { $page = array_pop($data); $letters += strlen($page['name']); $printout[] = $page; } $printout = array_reverse($printout); $result = '<div class=trail>'; if ($letters > $threshold) { // overflow: showing only last ones. $result .= '<div class=trail_page></div>'; } foreach ($printout as $page) { $result .= printTrailPage($page); } $result .= '</div>'; if ($render) { print $result; } return $result; }
function buildSearchResultsPrintOut($results, $tagsSearched, $count = true, $applyRating = true, $match = 0, $target = '', $callback = '', $previewing = false) { // no results if (count($results) == 0) { if ($count) { print '<b>Found 0 learning paths.<br/>'; } return; } // results count if ($count) { print 'Found <b>' . count($results) . '</b> learning paths.<br/>'; } // getting logged in user to check rating $user = $_SESSION[DOKU_COOKIE]['auth']['user']; // produce output $resultsCounter = 0; foreach ($results as $contents) { // style for exact match found $isMatch = ''; if ($match == $contents['id']) { $isMatch = 'style="border: 2px solid #333333"'; } // processing resulting path into an array of metadata. $pages = processTrailArrayForPrinting($contents['path']); // composing result line using an html table print '<table cellpadding=0 cellspacing=0 width=100% >'; print '<tr>'; // printing tags print '<td><div style="font-size:9px;padding-top:5px">tags: '; $tags = explode(" ", trim($contents['tags'])); foreach ($tags as $tag) { // highlight tags if match searched if (array_search($tag, $tagsSearched) > -1) { print '<b>' . $tag . '</b> '; } else { print $tag . ' '; } } // printing overall rating print '</div></td><td align=right style="padding-top:5px">'; print printShowRatingTable($contents['id'], driverdb_getRating($contents['id'])); print '</td>'; print '</tr>'; // path printing print '<tr><td colspan=2><div class="searchResultBar" ' . $isMatch . '>'; foreach ($pages as $page) { if ($previewing) { print printTrailPage($page, $target, $callback, 'preview' . $resultsCounter); } else { print printTrailPage($page, $target, $callback); } } print '</div></td></tr>'; print '<tr>'; // toggle previewer if ($previewing) { print '<td>'; print '<input style="font-size:9px" id="previewButton' . $resultsCounter . '"'; print ' type="button" class="button" value="Show Previewer"'; print ' onClick="togglePreviewer(effect' . $resultsCounter . ', previewButton' . $resultsCounter . ')">'; print '</td>'; } // if user can rate result is enabled ($applyRating) if ($applyRating) { print '<td>'; print '<form action="applyRating.php">'; print printApplyRatingTable($contents['id'], $user); print '</form></td>'; } print '</tr>'; // printing previewer (hidden) if ($previewing) { print '<tr><td id="td-effect" colspan=2> <div id="effect' . $resultsCounter . '" class="effect"> <iframe id="preview' . $resultsCounter . '" name="preview" class="preview"> </iframe> </div> </td></tr>'; } print '</table>'; $resultsCounter++; } }