SELECT *, IF(`salon_product`.`salon_id` IS NULL, 0, 1) AS `mark`
FROM `salon_product`
ORDER BY `mark` DESC
$c = new CDbCriteria();
$c->select = '*, , IF(`sp`.`salon_id` IS NULL, 0, 1) AS `mark` ';
$c->join = 'LEFT JOIN `SalonProduct` `sp` ON `t`.`id` = `sp`.`product_id`';
$c->order = '`mark` DESC';
$products = Product::model()->findAll($c);
try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
server {
server_name mysite.ru www.mysite.ru;
listen 178.100.100.97;
charset UTF-8;
disable_symlinks if_not_owner from=$root_path;
set $root_path /var/www/mysite/data/www/mysite.ru;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/mysite isp;
access_log /var/www/httpd-logs/mysite.ru.access.log ;
error_page 404 = @fallback;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://178.100.100.97:81;
proxy_redirect http://178.100.100.97:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass http://178.100.100.97:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic "Restricted area";
auth_basic_user_file /var/www/mysite/data/etc/31337.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
$('<селектор шапки>').offset().top
function offset(el) {
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
}
$('.dop').on('click', function () {
var $btn = $(this);
$('#filter').toggle(400, function () {
if ($(this).is(':hidden')) {
$btn.html('Показать дополнительные параметры поиска');
}
if ($(this).is(':visible')) {
$btn.html('Скрыть дополнительные параметры поиска');
}
});
});
<?php
use DiDom\Document;
class Task_VKparse extends Minion_Task {
protected static $_timeout = 1;
protected function _execute(array $params) {
//Получаем id матчей
$html = new Document('http://www.gosugamers.net/dota2/gosubet', TRUE);
$elements = $html->find('div.box')[0]->find('table tbody tr');
$matches = array();
foreach ($elements as $el) {
$gg_link = $el->find('td a')[0]->attr('href');
//Преобразование данных
$match = array(
'gg_link' => $gg_link,
);
$matches[] = $match;
}
// Переход на страницу матча
foreach ($matches as &$match) {
// Получение html кода страницы матча
$html = new Document('http://www.gosugamers.net' . $match['gg_link'], TRUE);
$format = $html->find('p.bestof')[0]->text();
$streams = $html->find('span.match-stream-tab');
$match['format'] = (new GG)->format($format);
$match['team1'] = $html->find('div.opponent1 h3')[0]->text();
$match['team2'] = $html->find('div.opponent2 h3')[0]->text();
$match['tournament'] = $html->find('fieldset legend a')[0]->text();
$match['stream_ru'] = (new GG)->stream_ru($streams);
$match['stream_en'] = (new GG)->stream_en($streams);
// Minion_CLI::write(var_dump($matches));
}
// Запись результата в БД
foreach ($matches as $match) {
$match_orm = new Model_Match;
// Загрузка матча, если он уже есть в БД
$match_orm->where('gg_link', '=', $match['gg_link'])->find();
// Внесение новых данных о матче
$match_orm->values($match);
$match_orm->save();
}
}
}
vagrant plugin install vagrant-vbguest
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"