public function createUrl($route, $params = array(), $ampersand = '&') { if (empty($params['language']) && Yii::app()->language !== 'ru') { $params['language'] = Yii::app()->language; } if (!isset(Yii::app()->controller->module->id)) { if (!strstr($route, 'register')) { if (isset($_POST['city'])) { $cookie = new CHttpCookie('city', $_POST['city']); Yii::app()->request->cookies['city'] = $cookie; $cookie->expire = time() + 3600; $c = City::model()->localized('ru')->findByPk($_POST['city'])->name; $params['city'] = Settings::toLatin($c); } elseif (isset(Yii::app()->request->cookies['city'])) { $c = City::model()->localized('ru')->findByPk(Yii::app()->request->cookies['city']->value)->name; $params['city'] = Settings::toLatin($c); } else { unset($params['city']); } } else { unset($params['city']); } } /*if (!strstr($route,'/')) { $route = '/cat/'.$route; }*/ return Yii::app()->request->hostInfo . parent::createUrl($route, $params, $ampersand); }
public function actionIndex() { $urls = array(); // Actions $urls[] = $this->createUrl('actions/index'); $actions = Actions::model()->findAll('t.picture != "" AND t.date_end <= ' . date('Y-m-d')); if (count($actions) > 0) { foreach ($actions as $action) { $urls[] = $this->createUrl('actions/view', array('id' => $action->id)); } } // Tenders $urls[] = $this->createUrl('tenders/index'); $tenders = Tenders::model()->findAll('t.date_end <= ' . date('Y-m-d')); if (count($tenders) > 0) { foreach ($tenders as $tender) { $urls[] = $this->createUrl('tenders/view', array('id' => $tender->id)); } } // Freefoto $urls[] = $this->createUrl('freefoto/index'); // Static Pages $urls[] = $this->createUrl('page/hmagent'); $urls[] = $this->createUrl('page/advertisment'); $urls[] = $this->createUrl('page/help_us'); $urls[] = $this->createUrl('page/about'); $urls[] = $this->createUrl('page/accounts'); // News $urls[] = $this->createUrl('page/news'); $news = News::model()->findAll('t.title != "" AND t.intro_text != ""'); if (count($news) > 0) { foreach ($news as $item) { $urls[] = $this->createUrl('page/news', array('id' => $item->id)); } } // Categories $cats = Occupation::model()->localized('ru')->findAll(array('condition' => 't.name!="" AND t.active=1', 'order' => 't.cat_id ASC')); if (count($cats) > 0) { foreach ($cats as $cat) { $urls[] = $this->createUrl('/cat/view', array('id' => 'c' . $cat->id . '_' . Settings::toLatin($cat->name))); } } // Users $users = Users::model()->findAll('t.name!="" AND t.activate=1'); if (count($users) > 0) { foreach ($users as $user) { if ($user->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) { $urls[] = '/id' . $user->id; // Photo albums if ($user->occupation_id == 1) { $alb = Portfolio::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1)); if (count($alb) > 0) { foreach ($alb as $item) { if ($item->filesCount > 0) { $urls[] = $this->createUrl('user/album', array('id' => $item->id)); } } } } // Video albums if ($user->occupation_id == 2) { $vid = Video::model()->findAllByAttributes(array('uid' => $user->id, 'visible' => 1)); if (count($vid) > 0) { foreach ($vid as $item) { if ($item->filesCount > 0) { $urls[] = $this->createUrl('user/videoalbum', array('id' => $item->id)); } } } } } } } // Photo albums $users_alb = Users::model()->findAll('t.name!="" AND t.activate=1 AND t.occupation_id=1'); if (count($users_alb) > 0) { foreach ($users_alb as $user_alb) { if ($user_alb->filesCount >= 4 || $user->videosCount >= 4 || $user->floCount >= 4) { $urls[] = '/id' . $user->id; } } } /*// Страницы $pages = Page::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($posts as $page){ $urls[] = $this->createUrl('page/view', array('alias'=>$page->alias)); } // Новости $news = News::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($news as $new){ $urls[] = $this->createUrl('news/view', array('id'=>$new->id)); } // Работы портфолио $works = Work::model()->findAll(array( 'condition' => 't.public = 1'; )); foreach ($works as $work){ $urls[] = $this->createUrl('work/view', array('id'=>$work->id)); } // Товары $products = Product::model()->findAll(array( 'condition' => 't.public = 1 AND t.count > 0'; )); foreach ($products as $product){ $urls[] = $this->createUrl('product/view', array('category'=>$product->category->alias, 'id'=>$product->id)); } // ...*/ $host = Yii::app()->request->hostInfo; echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; echo '<url> <loc>' . $host . '</loc> <changefreq>daily</changefreq> <priority>0.5</priority> </url>'; if (count($urls) > 0) { foreach ($urls as $url) { echo '<url> <loc>' . $host . $url . '</loc> <changefreq>daily</changefreq> <priority>0.5</priority> </url>'; } } echo '</urlset>'; Yii::app()->end(); }
<?php /* @var $this ProfileController */ $this->breadcrumbs = array(Occupation::getName($model->occupation_id) => $this->createUrl('cat/view', array('alias' => Settings::toLatin(Occupation::getName($model->occupation_id)))), $model->name); if (!Yii::app()->user->isGuest) { if (Yii::app()->user->id != $model->id) { Users::addHit($model->id); } } else { Users::addHit($model->id); } Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.nanoscroller.min.js'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.stellar.min.js'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.fancybox.pack.js'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/min/jquery.tooltipster.min.js'); Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/masked.js'); ?> <script> $(document).ready(function(){ $("#phone").mask("+38(999) 999-99-99"); $("#phone_user").click(function(){ $.ajax({ url: '<?php echo $this->createUrl('/user/getphone'); ?> ', type: "POST", data: {'id':$('#phone_user').attr('data-phone')}, success: function (data) {
foreach ($list as $k => $v) { //if($i%8==0) { // echo '</ul></li>'; // echo ' <li class="dropdownmenu__item"> // <ul class="dropdownmenu__item__list">'; //} echo '<li class="dropdownmenu__item__list__item"><h3 class="dropdownmenu__item__list__item__title">' . $v->name . '</h3></li>'; $model = new Occupation(); $list1 = $model->localized('ru')->findAll('cat_id=:cid', array(':cid' => $v->id)); $i = 1; foreach ($list1 as $k1 => $v1) { //echo '<li class="dropdownmenu__item__list__item"><a href="" class="dropdownmenu__item__list__item__link">Воздушные акробаты<span class="dropdown__link__col"> (25)</span></a></li>'; if ($v1->alias != '') { $alias = $v1->alias; } else { $alias = Settings::toLatin($v1->name); Occupation::model()->updateByPk($v1->id, array('alias' => $alias)); } if (Yii::app()->getRequest()->getParam('id') == $v1->id && Yii::app()->controller->id == 'cat') { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link dropdownmenu__item__list__item__link--current">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; } else { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; } //$i++; } } ?> </ul> </li> </ul> </div>