public function run()
 {
     $this->registerClientAssets();
     $helper = new \plathir\smartblog\helpers\PostHelper();
     $posts = PostHelper::getMostVisitedPosts($this->posts_num);
     return $this->render('most_visited_posts_widget', ['posts' => $posts, 'widget' => $this]);
 }
Esempio n. 2
0
 public function run()
 {
     $this->registerClientAssets();
     $helper = new \plathir\smartblog\helpers\PostHelper();
     $topRated = PostHelper::getTopRated($this->posts_num);
     return $this->render('top_rated_posts_widget', ['posts' => $topRated, 'widget' => $this]);
 }
Esempio n. 3
0
 public function run()
 {
     $this->registerClientAssets();
     $helper = new \plathir\smartblog\helpers\PostHelper();
     $topAuthors = PostHelper::getTopAuthors($this->authors_num);
     return $this->render('top_authors', ['topAuthors' => $topAuthors, 'widget' => $this]);
 }
Esempio n. 4
0
 public function run()
 {
     //echo $this->getViewPath();
     // die();
     $this->registerClientAssets();
     $helper = new \plathir\smartblog\helpers\PostHelper();
     $posts = PostHelper::getLatestPosts($this->latest_num);
     return $this->render('latest_posts_widget', ['posts' => $posts, 'widget' => $this]);
 }
Esempio n. 5
0
 public function getTopAuthors($numOfAuthors)
 {
     $temp_topAuthors = (new \yii\db\Query())->select(['user_created as author', 'count(*) as cnt'])->from('Posts')->groupBy(['user_created'])->limit(10)->all();
     foreach ($temp_topAuthors as $Author) {
         $userid = $Author['author'];
         $username = PostHelper::getUserName($userid);
         $topAuthors[] = ['userid' => $userid, 'author' => $username, 'cnt' => $Author['cnt']];
     }
     if ($topAuthors) {
         return $topAuthors;
     } else {
         return null;
     }
 }
Esempio n. 6
0
/* @var $this yii\web\View */
use yii\helpers\Html;
use plathir\user\common\helpers\UserHelper;
use plathir\smartblog\helpers\PostHelper;
use plathir\smartblog\backend\widgets\LatestPosts;
use plathir\apps\models\AppsSearch;
use plathir\apps\helpers\AppsHelper;
$this->title = 'My Yii Application';
?>

<?php 
//echo Yii::$app->settings->test();
$comp = \Yii::$app->getModules();
$LatestUsers = UserHelper::getLatestUsers(5);
$LatestPosts = PostHelper::getLatestPosts(10);
$searchModel = new AppsSearch();
$applications = AppsHelper::getAppsList();
?>

<div class="row row-centered">

    <div class="col-md-12">
        <?php 
echo $this->render('apps.php', ['applications' => $applications]);
?>
        <?php 
echo '';
?>
    </div>
</div>