Example #1
0
 public static function canAccess($level)
 {
     return $level <= Session::getAccessLevel();
 }
Example #2
0
<li><a href="<?php 
            echo $doc->data;
            ?>
" target="_blank"><?php 
            echo $name;
            ?>
</a></li><?php 
        }
        ?>
</div><?php 
    }
    ?>
        <div class="article-nav">
            <?php 
    $nextArticle = Article::model()->orderBy("id", Article::ORDER_ASC)->limit(1)->find("(createDate > ?) AND (accessLevel <= ?) AND (published = 1) AND (unlisted = 0)", $article->createDate, Session::getAccessLevel());
    $prevArticle = Article::model()->orderBy("id", Article::ORDER_DESC)->limit(1)->find("(createDate < ?) AND (accessLevel <= ?) AND (published = 1) AND (unlisted = 0)", $article->createDate, Session::getAccessLevel());
    if ($prevArticle) {
        ?>
<a href="<?php 
        echo $prevArticle->getPermalink();
        ?>
"><input type="button" value="EDELLINEN ARTIKKELI"></a>&nbsp;<?php 
    }
    if ($nextArticle) {
        ?>
<a href="<?php 
        echo $nextArticle->getPermalink();
        ?>
"><input type="button" value="SEURAAVA ARTIKKELI"></a><?php 
    }
    ?>
Example #3
0
<?php

require_once "inc/init.php";
require "views/head.php";
$sectionTitle = "Kyberkoulutus";
require "views/header.php";
$activeNav = "index";
require "views/sidebar.php";
?>

    <div class="main">
        <div class="main-wrapper">
            <div class="container">
<?php 
// get access level of the session
$accessLevel = Session::getAccessLevel();
// get the most recent five published articles that the user is allowed to view
$articles = Article::model()->orderBy("createDate", Article::ORDER_DESC)->findAll("published = 1 AND accessLevel <= ? AND unlisted = 0", $accessLevel);
foreach ($articles as $article) {
    require "views/articlepreview.php";
}
?>
            </div>
        </div>
    </div>
<?php 
require "views/footer.php";
require "views/foot.php";
Example #4
0
    exit(0);
}
$category = Category::model()->findByPk($_GET["id"]);
if (!$category) {
    CommonUtil::redirect("index");
    exit(0);
}
require "views/head.php";
$sectionTitle = "Kategoria";
$subsectionTitle = $category->name;
require "views/header.php";
$activeNav = "category-" . $_GET["id"];
require "views/sidebar.php";
?>

    <div class="main">
        <div class="main-wrapper">
            <div class="container">
<?php 
$articles = Article::model()->orderBy("createDate", Article::ORDER_DESC)->findAll("category = ? AND accessLevel <= ? AND unlisted = 0 AND published = 1", $_GET["id"], Session::getAccessLevel());
foreach ($articles as $article) {
    require "views/articlepreview.php";
}
?>

            </div>
        </div>
    </div>
<?php 
require "views/footer.php";
require "views/foot.php";