Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
        </div></td>
    </tr>
	<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">
Ejemplo n.º 3
0
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++;
    }
}