1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/sources/app/layout/nav_menu.phtml

307 lines
10 KiB
PHTML
Raw Normal View History

2014-07-23 15:52:50 +02:00
<?php
$actual_view = Minz_Request::param('output', 'normal');
?>
<div class="nav_menu">
<?php if ($actual_view === 'normal') { ?>
2014-09-27 10:10:43 +02:00
<a class="btn toggle_aside" href="#aside_flux"><?php echo _i('category'); ?></a>
2014-07-23 15:52:50 +02:00
<?php } ?>
<?php if ($this->loginOk) { ?>
2014-09-27 10:10:43 +02:00
<div id="nav_menu_actions" class="stick">
2014-07-23 15:52:50 +02:00
<?php
$url_state = $this->url;
if ($this->state & FreshRSS_Entry::STATE_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-read"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
2014-09-27 10:10:43 +02:00
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_read'); ?>">
<?php echo _i('read'); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_READ;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-unread"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
2014-09-27 10:10:43 +02:00
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_not_reads'); ?>">
<?php echo _i('unread'); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php
2014-09-27 10:10:43 +02:00
if ($this->state & FreshRSS_Entry::STATE_FAVORITE || $this->get_c == 's') {
2014-07-23 15:52:50 +02:00
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_FAVORITE;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-favorite"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
2014-09-27 10:10:43 +02:00
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_favorite'); ?>">
<?php echo _i('starred'); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_FAVORITE;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-not-favorite"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
2014-09-27 10:10:43 +02:00
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_not_favorite'); ?>">
<?php echo _i('non-starred'); ?>
2014-07-23 15:52:50 +02:00
</a>
<div class="dropdown">
<div id="dropdown-query" class="dropdown-target"></div>
2014-09-27 10:10:43 +02:00
<a class="dropdown-toggle btn" href="#dropdown-query"><?php echo _i('down'); ?></a>
2014-07-23 15:52:50 +02:00
<ul class="dropdown-menu">
<li class="dropdown-close"><a href="#close"></a></li>
2014-09-27 10:10:43 +02:00
<li class="dropdown-header">
<?php echo _t('queries'); ?>
<a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a>
</li>
2014-07-23 15:52:50 +02:00
<?php foreach ($this->conf->queries as $query) { ?>
2014-09-27 10:10:43 +02:00
<li class="item query">
2014-07-23 15:52:50 +02:00
<a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
</li>
<?php } ?>
<?php if (count($this->conf->queries) > 0) { ?>
<li class="separator no-mobile"></li>
<?php } ?>
<?php
$url_query = $this->url;
$url_query['c'] = 'configure';
$url_query['a'] = 'addQuery';
?>
2014-09-27 10:10:43 +02:00
<li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo _i('bookmark-add'); ?> <?php echo _t('add_query'); ?></a></li>
2014-07-23 15:52:50 +02:00
</ul>
</div>
</div>
<?php
$get = false;
2014-09-27 10:10:43 +02:00
$string_mark = _t('mark_all_read');
2014-07-23 15:52:50 +02:00
if ($this->get_f) {
$get = 'f_' . $this->get_f;
2014-09-27 10:10:43 +02:00
$string_mark = _t('mark_feed_read');
2014-07-23 15:52:50 +02:00
} elseif ($this->get_c && $this->get_c != 'a') {
if ($this->get_c === 's') {
$get = 's';
} else {
$get = 'c_' . $this->get_c;
}
2014-09-27 10:10:43 +02:00
$string_mark = _t('mark_cat_read');
2014-07-23 15:52:50 +02:00
}
$nextGet = $get;
2014-09-27 10:10:43 +02:00
if ($this->conf->onread_jump_next && strlen($get) > 2) {
2014-07-23 15:52:50 +02:00
$anotherUnreadId = '';
$foundCurrent = false;
switch ($get[0]) {
2014-09-27 10:10:43 +02:00
case 'c':
foreach ($this->cat_aside as $cat) {
if ($cat->id() == $this->get_c) {
$foundCurrent = true;
continue;
2014-07-23 15:52:50 +02:00
}
2014-09-27 10:10:43 +02:00
if ($cat->nbNotRead() <= 0) continue;
$anotherUnreadId = $cat->id();
if ($foundCurrent) break;
}
$nextGet = empty($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
break;
case 'f':
foreach ($this->cat_aside as $cat) {
if ($cat->id() == $this->get_c) {
foreach ($cat->feeds() as $feed) {
if ($feed->id() == $this->get_f) {
$foundCurrent = true;
continue;
2014-07-23 15:52:50 +02:00
}
2014-09-27 10:10:43 +02:00
if ($feed->nbNotRead() <= 0) continue;
$anotherUnreadId = $feed->id();
if ($foundCurrent) break;
2014-07-23 15:52:50 +02:00
}
2014-09-27 10:10:43 +02:00
break;
2014-07-23 15:52:50 +02:00
}
2014-09-27 10:10:43 +02:00
}
$nextGet = empty($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
break;
2014-07-23 15:52:50 +02:00
}
}
2014-09-21 12:12:35 +02:00
$p = isset($this->entries[0]) ? $this->entries[0] : null;
$idMax = $p === null ? (time() - 1) . '000000' : $p->id();
if ($this->order === 'ASC') { //In this case we do not know but we guess idMax
$idMax2 = (time() - 1) . '000000';
if (strcmp($idMax2, $idMax) > 0) {
$idMax = $idMax2;
}
2014-07-23 15:52:50 +02:00
}
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
$output = Minz_Request::param('output', '');
2014-09-27 10:10:43 +02:00
if ($output != '' && $this->conf->view_mode !== $output) {
2014-07-23 15:52:50 +02:00
$arUrl['params']['output'] = $output;
}
$markReadUrl = Minz_Url::display($arUrl);
2014-09-27 10:10:43 +02:00
Minz_Session::_param('markReadUrl', $markReadUrl);
2014-07-23 15:52:50 +02:00
?>
2014-09-27 10:10:43 +02:00
<form id="mark-read-menu" method="post" style="display: none"></form>
2014-07-23 15:52:50 +02:00
<div class="stick" id="nav_menu_read_all">
2014-09-27 10:10:43 +02:00
<?php $confirm = $this->conf->reading_confirm ? 'confirm' : ''; ?>
<button class="read_all btn <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo $markReadUrl; ?>"
type="submit"><?php echo _t('mark_read'); ?></button>
2014-07-23 15:52:50 +02:00
<div class="dropdown">
<div id="dropdown-read" class="dropdown-target"></div>
2014-09-27 10:10:43 +02:00
<a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
2014-07-23 15:52:50 +02:00
<ul class="dropdown-menu">
<li class="dropdown-close"><a href="#close"></a></li>
2014-09-27 10:10:43 +02:00
<li class="item">
<button class="as-link <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo $markReadUrl; ?>"
type="submit"><?php echo $string_mark; ?></button>
</li>
2014-07-23 15:52:50 +02:00
<li class="separator"></li>
<?php
2014-09-27 10:10:43 +02:00
$mark_before_today = $arUrl;
$mark_before_today['params']['idMax'] = $this->today . '000000';
$mark_before_one_week = $arUrl;
$mark_before_one_week['params']['idMax'] = ($this->today - 604800) . '000000';
2014-07-23 15:52:50 +02:00
?>
2014-09-27 10:10:43 +02:00
<li class="item">
<button class="as-link <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
type="submit"><?php echo _t('before_one_day'); ?></button>
</li>
<li class="item">
<button class="as-link <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
type="submit"><?php echo _t('before_one_week'); ?></button>
</li>
2014-07-23 15:52:50 +02:00
</ul>
</div>
</div>
<?php } ?>
<?php $url_output = $this->url; ?>
<div class="stick" id="nav_menu_views">
<?php $url_output['params']['output'] = 'normal'; ?>
2014-09-27 10:10:43 +02:00
<a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-normal"); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php $url_output['params']['output'] = 'global'; ?>
2014-09-27 10:10:43 +02:00
<a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-global"); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php $url_output['params']['output'] = 'reader'; ?>
2014-09-27 10:10:43 +02:00
<a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-reader"); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php
$url_output['params']['output'] = 'rss';
2014-09-21 12:12:35 +02:00
if ($this->conf->token) {
$url_output['params']['token'] = $this->conf->token;
}
2014-07-23 15:52:50 +02:00
?>
2014-09-27 10:10:43 +02:00
<a class="view_rss btn" target="_blank" title="<?php echo _t('rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i('rss'); ?>
2014-07-23 15:52:50 +02:00
</a>
</div>
<div class="item search">
2014-09-27 10:10:43 +02:00
<form action="<?php echo _url('index', 'index'); ?>" method="get">
<?php $search = Minz_Request::param('search', ''); ?>
<input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo _t('search_short'); ?>" />
2014-07-23 15:52:50 +02:00
2014-09-27 10:10:43 +02:00
<?php $get = Minz_Request::param('get', ''); ?>
2014-07-23 15:52:50 +02:00
<?php if($get != '') { ?>
<input type="hidden" name="get" value="<?php echo $get; ?>" />
<?php } ?>
2014-09-27 10:10:43 +02:00
<?php $order = Minz_Request::param('order', ''); ?>
2014-07-23 15:52:50 +02:00
<?php if($order != '') { ?>
<input type="hidden" name="order" value="<?php echo $order; ?>" />
<?php } ?>
2014-09-27 10:10:43 +02:00
<?php $state = Minz_Request::param('state', ''); ?>
2014-07-23 15:52:50 +02:00
<?php if($state != '') { ?>
<input type="hidden" name="state" value="<?php echo $state; ?>" />
<?php } ?>
</form>
</div>
<?php
if ($this->order === 'DESC') {
$order = 'ASC';
$icon = 'up';
$title = 'older_first';
} else {
$order = 'DESC';
$icon = 'down';
$title = 'newer_first';
}
$url_order = $this->url;
$url_order['params']['order'] = $order;
?>
2014-09-27 10:10:43 +02:00
<a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">
<?php echo _i($icon); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?>
2014-09-27 10:10:43 +02:00
<a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>"><?php echo _i('refresh'); ?></a>
2014-07-23 15:52:50 +02:00
<?php } ?>
</div>