public static function get() { if (Yii::$app->user->identity->id) { $user_id = Yii::$app->user->identity->id; return PopularDomains::find()->where(['user_id' => $user_id])->orderBy(['date' => SORT_DESC])->select('domain')->distinct()->all(); } else { $ip = $_SERVER['REMOTE_ADDR']; return PopularDomains::find()->where(['ip' => $ip])->orderBy(['date' => SORT_DESC])->select('domain')->distinct()->all(); } }
public function actionCharts($url = false) { $this->type = 'charts'; if ($url && PopularDomains::checkPopular($url)) { $this->url = $url; Yii::$app->session->set('url', $url); $webmeup = new Webmeup(); $webmeup->addCookie($url); $this->page_title = "Backlink profile report - " . $url . ', ' . $webmeup->get_title($url); $result = $webmeup->prepearResponce($webmeup->getResponce($url), $url); ksort($result['stock_market_index']['images']); ksort($result['stock_market_index']['nofollow']); ksort($result['stock_market_index']['dofollow']); if (count($result['stock_market_index']['images']) == 0 && count($result['stock_market_index']['nofollow']) == 0 && count($result['stock_market_index']['dofollow']) == 0) { $result = false; } return $this->render('main', ['result' => $result, 'conclusion' => $this->renderPartial('conclusion', ['result' => $webmeup->conclusion($url)])]); } return $this->render('empty_main'); }
<div class="row"> <div class="col-md-12"> <div class="panel panel-default panel-more-shadow margin-lr--30"> <div class="panel-body panel-body-primary"> <div class="input-group input-group-lg"> <label for="" class="control-label custom-label">Site Explorer</label> <input id="domain-search-imput" type="text" class="form-control index_search_input" value='<?php echo $url; ?> ' placeholder="Search for specific question, answer or topic..."> <div class="input-group-btn"> <span for="" class="select-custom"> <select name="" id="visites" class="form-control input-lg"> <option value="">Popular</option> <?php foreach (PopularDomains::get() as $domain) { ?> <option <?php echo $url != "" && $url == $domain->domain ? "selected" : ""; ?> value="<?php echo $domain->domain; ?> "><?php echo $domain->domain; ?> </option> <?php } ?> </select>