Skip to content

Commit

Permalink
Merge branch 'release/1.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
GregLeBarbar committed Apr 3, 2019
2 parents a44073a + 30ce610 commit cca2767
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

*1.3.5* (2019-04-03)
- People Fix (#193)
- Add Tags to breadcrumb (#183)
- Fix php notices (#191)

*1.3.4* (2019-03-29)
- People Fix (#192)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.4
1.3.5
2 changes: 1 addition & 1 deletion inc/language.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* get_current_langage
* get_current_language
*/
function get_current_language ($default_lang='en') {
# fetch language
Expand Down
4 changes: 2 additions & 2 deletions menus/submenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function submenu_limit( $items, $args ) {

} else if ($submenu_type == 'all') {
$parent_menu_item = reset(wp_filter_object_list( $items, array( 'current_item_parent' => true ) ));
$siblings = submenu_get_direct_children_ids( $parent_menu_item->ID ?: 0 , $items );
$children = submenu_get_direct_children_ids( $current_menu_item->ID ?: 0 , $items );
$siblings = submenu_get_direct_children_ids( $parent_menu_item && $parent_menu_item->ID ? $parent_menu_item->ID : 0 , $items );
$children = submenu_get_direct_children_ids( $current_menu_item && $current_menu_item->ID ? $current_menu_item->ID : 0 , $items );
$selectedIds = array_merge($siblings, $children);
}

Expand Down
8 changes: 4 additions & 4 deletions shortcodes/epfl_people/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 4rth argument is number of arguments the function can accept
**/

add_action('epfl_people_action', 'renderPeople', 10, 2);
add_action('epfl_people_action', 'renderPeople', 10, 3);

function renderPeople ($persons, $nb_columns) {
function renderPeople ($persons, $nb_columns, $from) {

if (is_admin()) {

Expand All @@ -16,10 +16,10 @@ function renderPeople ($persons, $nb_columns) {
get_template_part('shortcodes/placeholder');

} else {


set_query_var('epfl_people_from', $from);
set_query_var('epfl_people_persons', $persons);
set_query_var('epfl_people_nb_columns', $nb_columns);
get_template_part('shortcodes/epfl_people/view');

}
}
8 changes: 4 additions & 4 deletions shortcodes/epfl_people/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function epfl_people_get_phones($person) {
/**
* Get person function
*/
function epfl_people_get_function($person) {
function epfl_people_get_function($person, $from) {
$function = '';
$nb_units = count((array)$person->unites);
foreach($person->unites as $current_unit) {
if ($current_unit->ordre == 1 || $nb_units == 1) {
if ($from == 'units' || ($from == 'scipers' && $current_unit->ordre == 1)) {
$language = get_current_language();
if ($language === 'fr') {
$function = $current_unit->fonction_fr;
Expand All @@ -44,11 +44,11 @@ function epfl_people_get_function($person) {
/**
* Get person room
*/
function epfl_people_get_room($person) {
function epfl_people_get_room($person, $from) {

$room = '';
foreach($person->unites as $current_unit) {
if ($current_unit->ordre == 1) {
if ($from == 'units' || ($from == 'scipers' && $current_unit->ordre == 1)) {
$room = $current_unit->rooms;
}
}
Expand Down
12 changes: 8 additions & 4 deletions shortcodes/epfl_people/view.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<?php
require_once('utils.php');
$persons = get_query_var('epfl_people_persons');
$from = get_query_var('epfl_people_from');

# $nb_column can be 1, 3 or 'list'
$nb_column = get_query_var('epfl_people_nb_columns');
?>
<div class="container my-3">
<?php if ($nb_column === 'list'): ?>
<div class="contact-list">
<?php

foreach($persons as $index => $person):

$photo_url = epfl_people_get_photo($person);
$phones = epfl_people_get_phones($person);
$function = epfl_people_get_function($person);
$room = epfl_people_get_room($person);
$function = epfl_people_get_function($person, $from);
$room = epfl_people_get_room($person, $from);
$room_url = epfl_people_get_room_url($room);
$people_url = epfl_people_get_people_url($person);
?>
Expand Down Expand Up @@ -40,8 +44,8 @@
foreach($persons as $index => $person):
$photo_url = epfl_people_get_photo($person);
$phones = epfl_people_get_phones($person);
$function = epfl_people_get_function($person);
$room = epfl_people_get_room($person);
$function = epfl_people_get_function($person, $from);
$room = epfl_people_get_room($person, $from);
$room_url = epfl_people_get_room_url($room);
$people_url = epfl_people_get_people_url($person);
?>
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI:
Author: Antistatique.net
Author URI: http://antistatique.net/
Description: Description
Version: 1.3.4
Version: 1.3.5
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: epfl
Expand Down
35 changes: 33 additions & 2 deletions template-parts/breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,41 @@
$crumbs[] = '
<li class="breadcrumb-item">
<a class="bread-link bread-home" href="' . get_epfl_home_url() . '" title="home">
<svg class="icon"><use xlink:href="#icon-home"></use></svg>
<svg class="icon" aria-hidden="true"><use xlink:href="#icon-home"></use></svg>
</a>
</li>';

if(function_exists('epfl_fetch_site_tags')) {
$custom_tags = [];
$custom_tags = epfl_fetch_site_tags();

# custom_tags should be like [["_id", "name_en", "url_en", "name_fr", "url_fr", "type"], ...]
if (!empty($custom_tags)) {
$ln = get_current_language();
$crumbs[] = "
<li class=\"breadcrumb-item breadcrumb-tags-wrapper\">";

foreach($custom_tags as $tag_item) {
if ($ln === 'fr') {
$tag_name = $tag_item->name_fr;
if(!empty($tag_item->url_fr)) {
$tag_url = $tag_item->url_fr;
} else {
$tag_url = $tag_item->url_en;
}
} else {
$tag_name = $tag_item->name_en;
$tag_url = $tag_item->url_en;
}

$crumbs[] = "
<a href=\"{$tag_url}\" class=\"tag tag-primary\">". esc_html($tag_name) . "</a>
";
}
$crumbs[] = "</li>";
}
}

$crumb_items = array();
for($crumb_item = $item;
$crumb_item;
Expand All @@ -59,7 +90,7 @@
foreach($crumb_items as $crumb_item) {
if ((int) $item->db_id === (int) $crumb_item->db_id) {
$crumbs[] = "
<li class=\"breadcrumb-item active\">
<li class=\"breadcrumb-item active\" aria-current=\"page\">
{$crumb_item->title}
</li>";
} else {
Expand Down

0 comments on commit cca2767

Please sign in to comment.