Ejemplo n.º 1
0
 /**
  * /lists/popular
  *
  * @return string
  */
 public function actionPopular()
 {
     $language = null;
     $languageSlug = $this->request->getQueryParam('languageSlug');
     if ($languageSlug) {
         $language = Language::find()->where(['isHidden' => 0, 'slug' => $languageSlug])->limit(1)->one();
     }
     return $this->render('popular', ['language' => $language, 'list' => PopularSnippets::get($language)]);
 }
Ejemplo n.º 2
0
 /**
  * /snippets/language-slug[/snippet-slug]
  *
  * @return string
  */
 public function actionIndex()
 {
     $this->parseQueryParams(true);
     // Make sure at least language slug is there
     if (!$this->language) {
         return $this->goHome();
     }
     if ($this->snippet) {
         $this->snippet->updateCounters(['views' => 1]);
         return $this->render('snippet', ['language' => $this->language, 'snippet' => $this->snippet, 'commentModel' => new CommentForm()]);
     } else {
         return $this->render('language', ['language' => $this->language, 'latestSnippets' => LatestSnippets::getTopTen($this->language), 'popularSnippets' => PopularSnippets::getTopTen($this->language)]);
     }
 }
Ejemplo n.º 3
0
 /**
  * Site Homepage
  *
  * @return string
  */
 public function actionIndex()
 {
     return $this->render('index', ['latestSnippets' => LatestSnippets::getTopTen(), 'popularSnippets' => PopularSnippets::getTopTen()]);
 }