Commit a5b58856 authored by Simonas's avatar Simonas

PHP code update

parent 397eeb38
......@@ -24,13 +24,14 @@
}
}
.c-search--col { position: relative; flex: 1 1 auto; background-color: #FFFFFF;
@media (--max--medium) {
flex: 0 0 60px;
}
.awesomplete { position: absolute; top: 0; right: 0; left: 0; height: 100%; display: flex; flex-direction: column; }
ul { top: 60px; padding-top: 10px; }
ul { top: 57px; padding-top: 10px; overflow-x: hidden; max-height: 350px; overflow-y: auto; }
li { padding: 10px 15px; margin-bottom: 10px; cursor: pointer;
&:hover { color: #000; }
}
......
......@@ -59,6 +59,7 @@
&copy; 2012-<?php echo date('Y'); ?> BIURO.
</div>
</div><!-- l-inner -->
</footer><!-- .l-footer -->
<?php
......@@ -87,8 +88,12 @@
<?php
endif;
?>
<script src="/wp-content/themes/biuro/js/main-63c39ea0.min.js" async></script>
<script src="/wp-content/themes/biuro/js/main-fd6ce50b.min.js" async></script>
<?php
global $time_start;
delog((microtime(true) - $time_start), 'Lorem ipsum');
?>
<?php wp_footer(); ?>
</body>
</html>
......@@ -128,4 +128,9 @@
</main><!-- .l-main -->
</div><!-- #content -->
<?php
// global $time_start;
// delog((microtime(true) - $time_start), 'Lorem ipsum');
?>
<?php get_footer();
......@@ -512,29 +512,29 @@ add_action( 'rest_api_init', function () {
'methods' => WP_REST_Server::READABLE,
'callback' => 'getDivisions',
'args' => array(
'lang' => array(
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
)
'lang' => array(
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
)
)
));
register_rest_route( 'api/v1', '/contacts', array(
'methods' => WP_REST_Server::READABLE,
'callback' => 'Biuro_Contacts_Public::getContacts',
'args' => [
'from' => [
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
],
'by' => [
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
]
'from' => [
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
],
'by' => [
'validate_callback' => function($param, $request, $key) {
return is_string( $param );
}
]
]
));
});
......@@ -722,3 +722,28 @@ endif;
wp_reset_query();
define('positionsPage', $positionsPage);
function getRecords($type) {
global $wpdb;
$langs = pll_the_languages(array('raw'=>1));
$langID = $langs[pll_current_language('slug')]['id'];
$prefix = $wpdb->prefix;
$today = date('Y-m-d');
$order = ($type == 'city') ? 'no DESC' : 'total DESC';
$sql = "SELECT * FROM (SELECT term.name, count(*) as total, CAST(`{$prefix}termmeta`.`meta_value` as INT) as no, `{$prefix}termpage`.`meta_value` as pageID
FROM `{$prefix}posts` AS `t`
LEFT JOIN `{$prefix}postmeta` AS `valid` ON `valid`.`meta_key` = 'valid' AND `valid`.`post_id` = `t`.`ID`
LEFT JOIN `{$prefix}term_relationships` AS `rel_term` ON `rel_term`.`object_id` = `t`.`ID`
INNER JOIN `{$prefix}term_taxonomy` AS `rel_tt_term` ON `rel_tt_term`.`taxonomy` = '{$type}' AND `rel_tt_term`.`term_taxonomy_id` = `rel_term`.`term_taxonomy_id`
LEFT JOIN `{$prefix}terms` AS `term` ON `term`.`term_id` = `rel_tt_term`.`term_id`
LEFT JOIN `{$prefix}termmeta` AS `{$prefix}termmeta` ON {$prefix}termmeta.term_id = term.term_id AND {$prefix}termmeta.meta_key = 'order'
LEFT JOIN `{$prefix}termmeta` AS `{$prefix}termpage` ON {$prefix}termpage.term_id = term.term_id AND {$prefix}termpage.meta_key = 'page-id'
LEFT JOIN `{$prefix}term_relationships` AS `polylang_languages` ON `polylang_languages`.`object_id` = `t`.`ID` AND `polylang_languages`.`term_taxonomy_id` = $langID
WHERE ( ( `valid`.`meta_value` >= '{$today}' ) AND ( `t`.`post_type` = 'job' ) AND ( `polylang_languages`.`object_id` IS NOT NULL ) AND ( `t`.`post_status` IN ( 'publish' ) ) )
GROUP BY term.name) records
ORDER BY $order, name ASC";
return $wpdb->get_results($sql, ARRAY_A);
}
<!DOCTYPE html>
<?php
global $time_start;
$time_start = microtime(true);
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
......@@ -25,7 +28,7 @@
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-500.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-regular.woff2" crossorigin="anonymous" >
<style><?php include 'css/core-436f550003.min.css'; ?></style>
<style><?php include 'css/core-2c5fc4a3fd.min.css'; ?></style>
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-300.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-700.woff2" crossorigin="anonymous" >
......
......@@ -250,49 +250,22 @@ function initDivisionsMap (node, data) {
return;
}
const search = document.getElementById('search');
const query = document.getElementById('search-query');
const cityBox = new Awesomplete(city, {
minChars: 0,
maxItems: 1000,
sort: false
// data: (item, input) => {
// console.error('----------');
// console.dir(item);
// console.dir(input);
// return { label: item.value, value: item.name };
// },
// replace: function(text) {
// console.error('text');
// console.dir(text);
// // var hidden = document.querySelector('[name="' + this.input.dataset.name + '"]');
// // this.input.value = text.label;
// // if (!hidden) {
// // return;
// // }
// // hidden.value = text.value;
// // if (hidden.classList.contains('js-trigger-datalist')) {
// // hidden.dispatchEvent(new Event('change', {
// // 'bubbles': true,
// // 'cancelable': true
// // }));
// // }
// // hidden.dispatchEvent(event);
// }
// });
});
city.addEventListener('focus', () => {
cityBox.evaluate();
});
const search = document.getElementById('search');
const query = document.getElementById('search-query');
const queryBox = new Awesomplete(query, {
minChars: 0,
maxItems: 1000,
sort: false
});
......
This diff is collapsed.
......@@ -116,7 +116,7 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
$classCSS = 'c-jobs-section';
$isClosed = count($res) > 6;
$isClosed = count($res) > 3;
if ($isClosed):
......@@ -164,7 +164,6 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
endif;
endif;
getSiteTree( 'city', __('City', 'biuro'), $searchQuery );
?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment