Commit a5b58856 authored by Simonas's avatar Simonas

PHP code update

parent 397eeb38
...@@ -24,13 +24,14 @@ ...@@ -24,13 +24,14 @@
} }
} }
.c-search--col { position: relative; flex: 1 1 auto; background-color: #FFFFFF; .c-search--col { position: relative; flex: 1 1 auto; background-color: #FFFFFF;
@media (--max--medium) { @media (--max--medium) {
flex: 0 0 60px; flex: 0 0 60px;
} }
.awesomplete { position: absolute; top: 0; right: 0; left: 0; height: 100%; display: flex; flex-direction: column; } .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; li { padding: 10px 15px; margin-bottom: 10px; cursor: pointer;
&:hover { color: #000; } &:hover { color: #000; }
} }
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
&copy; 2012-<?php echo date('Y'); ?> BIURO. &copy; 2012-<?php echo date('Y'); ?> BIURO.
</div> </div>
</div><!-- l-inner --> </div><!-- l-inner -->
</footer><!-- .l-footer --> </footer><!-- .l-footer -->
<?php <?php
...@@ -87,8 +88,12 @@ ...@@ -87,8 +88,12 @@
<?php <?php
endif; 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(); ?> <?php wp_footer(); ?>
</body> </body>
</html> </html>
...@@ -128,4 +128,9 @@ ...@@ -128,4 +128,9 @@
</main><!-- .l-main --> </main><!-- .l-main -->
</div><!-- #content --> </div><!-- #content -->
<?php
// global $time_start;
// delog((microtime(true) - $time_start), 'Lorem ipsum');
?>
<?php get_footer(); <?php get_footer();
...@@ -512,29 +512,29 @@ add_action( 'rest_api_init', function () { ...@@ -512,29 +512,29 @@ add_action( 'rest_api_init', function () {
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => 'getDivisions', 'callback' => 'getDivisions',
'args' => array( 'args' => array(
'lang' => array( 'lang' => array(
'validate_callback' => function($param, $request, $key) { 'validate_callback' => function($param, $request, $key) {
return is_string( $param ); return is_string( $param );
} }
)
) )
)
)); ));
register_rest_route( 'api/v1', '/contacts', array( register_rest_route( 'api/v1', '/contacts', array(
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => 'Biuro_Contacts_Public::getContacts', 'callback' => 'Biuro_Contacts_Public::getContacts',
'args' => [ 'args' => [
'from' => [ 'from' => [
'validate_callback' => function($param, $request, $key) { 'validate_callback' => function($param, $request, $key) {
return is_string( $param ); return is_string( $param );
} }
], ],
'by' => [ 'by' => [
'validate_callback' => function($param, $request, $key) { 'validate_callback' => function($param, $request, $key) {
return is_string( $param ); return is_string( $param );
} }
]
] ]
]
)); ));
}); });
...@@ -722,3 +722,28 @@ endif; ...@@ -722,3 +722,28 @@ endif;
wp_reset_query(); wp_reset_query();
define('positionsPage', $positionsPage); 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(); ?>> <html <?php language_attributes(); ?>>
<head> <head>
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php bloginfo( 'charset' ); ?>">
...@@ -25,7 +28,7 @@ ...@@ -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-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" > <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-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" > <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) { ...@@ -250,49 +250,22 @@ function initDivisionsMap (node, data) {
return; return;
} }
const search = document.getElementById('search');
const query = document.getElementById('search-query');
const cityBox = new Awesomplete(city, { const cityBox = new Awesomplete(city, {
minChars: 0, minChars: 0,
maxItems: 1000,
sort: false 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', () => { city.addEventListener('focus', () => {
cityBox.evaluate(); cityBox.evaluate();
}); });
const search = document.getElementById('search');
const query = document.getElementById('search-query');
const queryBox = new Awesomplete(query, { const queryBox = new Awesomplete(query, {
minChars: 0, minChars: 0,
maxItems: 1000,
sort: false sort: false
}); });
......
This diff is collapsed.
...@@ -116,7 +116,7 @@ function getSiteTree($taxonomy, $section, $searchQuery) { ...@@ -116,7 +116,7 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
$classCSS = 'c-jobs-section'; $classCSS = 'c-jobs-section';
$isClosed = count($res) > 6; $isClosed = count($res) > 3;
if ($isClosed): if ($isClosed):
...@@ -164,7 +164,6 @@ function getSiteTree($taxonomy, $section, $searchQuery) { ...@@ -164,7 +164,6 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
endif; endif;
endif; endif;
getSiteTree( 'city', __('City', 'biuro'), $searchQuery ); 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