Example #1
0
<?php

// Author: Miltos Nedelkos, nedelkosm at gmail dot com
// Project: E-nurse, find more at ...
function isCurrent($page)
{
    $current = $_SERVER['PHP_SELF'];
    if (strpos($current, $page) !== false) {
        return ' id = "menuButtonSelf"';
    } else {
        return "";
    }
}
echo '<div class="menu">
<ul>
<li class="menuButton"><a href="index.php"' . isCurrent("/index.php") . '>Αρχική Σελίδα</a></li>
<li class="menuButton"><a href="announcement.php"' . isCurrent("/announcement.php") . '>Ανακοινώσεις</a></li>';
if (isset($_SESSION["LoggedRole"])) {
    if ($_SESSION["LoggedRole"] == "client") {
        echo '<li class="menuButton"><a href="profile.php"' . isCurrent("/profile.php") . '>Προφίλ</a></li>
		<li class="menuButton"><a href="exercise.php"' . isCurrent("/exercise.php") . '>Άσκηση</a></li>
		<li class="menuButton"><a href="nutrition.php"' . isCurrent("/nutrition.php") . '>Διατροφή</a></li>';
    } else {
        if ($_SESSION["LoggedRole"] == "doctor") {
            echo '<li class="menuButton"><a href="doctor.php"' . isCurrent("/doctor.php") . '>Ασθενείς</a></li>';
        }
    }
}
echo '
</ul>
</div>';
Example #2
0
<body>

<div class="container">
    <div class="header clearfix">
        <nav>
            <ul class="nav nav-pills pull-right">
                <li role="presentation" <?php 
echo isCurrent('index.php') ? 'class="active"' : null;
?>
><a href="index.php">Home</a></li>
	            <li role="presentation" <?php 
echo isCurrent('oldGame.php') ? 'class="active"' : null;
?>
><a href="game.php">Old game</a></li>
                <li role="presentation" <?php 
echo isCurrent('game.php') ? 'class="active"' : null;
?>
><a href="game.php">Game</a></li>
	            <li role="presentation"><a href="plain-game.html">Game without PHP</a></li>
            </ul>
        </nav>
        <h3 class="text-muted">MFF Game</h3>
    </div>

<?php 
function isCurrent($page)
{
    return endsWith($_SERVER['PHP_SELF'], $page);
}
function endsWith($haystack, $needle)
{
Example #3
0
?>
><a id="gettingstartedtab" href="./index.php?mainContent=gettingstarted">Getting started</a></li>
			<li <?php 
isCurrent('tutorials');
?>
><a id="tutorialstab" href="./index.php?mainContent=tutorials">Tutorials</a></li>
			<li <?php 
isCurrent('documentation');
?>
><a id="referencetab" href="./index.php?mainContent=documentation">Documentation</a></li>			
			<li <?php 
isCurrent('profile');
?>
><a id="profiletab" href="./index.php?mainContent=profile">Profile</a></li>
			<li <?php 
isCurrent('contact');
?>
><a id="contacttab" href="./index.php?mainContent=contact">Contact</a></li>
		</ul>
	</div>
	
	<div id="wrap"> 

	<!-- content-wrap starts here -->	
		<div id="content-wrap">  
			<div id="maincontent">
				<?php 
include $mainContent . ".fragment.html";
?>
			</div>
		
function fbSearchPageEvents(&$fb, &$events, &$pages)
{
    syslog(LOG_DEBUG, 'fbSearchPageEvents');
    do {
        $batch = array();
        for ($i = 0; $i < 45; $i++) {
            if (empty($pages)) {
                break;
            }
            $pageId = array_shift($pages);
            $request = $fb->request('GET', $pageId . '/events?fields=id,name,start_time,place,' . 'attending_count,cover,description');
            array_push($batch, $request);
        }
        if (count($batch) <= 0) {
            // done
            break;
        }
        // Send request
        try {
            //syslog(LOG_DEBUG, 'fbBatchSearch: sending batch request');
            $responses = $fb->sendBatchRequest($batch);
        } catch (Facebook\Exceptions\FacebookResponseException $e) {
            // When Graph returns an error
            syslog(LOG_ERR, 'Graph returned an error: ' . $e->getMessage());
            exit;
        } catch (Facebook\Exceptions\FacebookSDKException $e) {
            // When validation fails or other local issues
            syslog(LOG_ERR, 'Facebook SDK returned an error: ' . $e->getMessage());
            exit;
        }
        // Read all events returned by facebook-page only once (one pagination only)
        foreach ($responses as $key => $response) {
            if ($response->isError()) {
                $e = $response->getThrownException();
                syslog(LOG_ERR, 'Error! Facebook SDK Said: ' . $e->getMessage());
            } else {
                // turn nodes into edges for pagination and iteration
                $feedEdge = $response->getGraphEdge();
                //syslog(LOG_DEBUG, print_r($feedEdge, TRUE));
                foreach ($feedEdge as $graphNode) {
                    $event = $graphNode;
                    /* Do only basic filtering, all other filtering happens in addEvent() javascript 
                     * function on the client side when this event gets retrieved.
                     */
                    if (isCurrent($events, $event) && !isPresent($events, $event)) {
                        array_push($events, $event);
                        //syslog(LOG_DEBUG, print_r($graphNode, TRUE));
                    }
                }
            }
        }
    } while (true);
}