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

199 lines
7.2 KiB
PHTML
Raw Normal View History

2015-02-08 18:55:48 +01:00
<?php $actual_view = Minz_Request::actionName(); ?>
2014-07-23 15:52:50 +02:00
<div class="nav_menu">
<?php if ($actual_view === 'normal') { ?>
2015-02-08 18:55:48 +01:00
<a class="btn toggle_aside" href="#aside_feed"><?php echo _i('category'); ?></a>
2014-07-23 15:52:50 +02:00
<?php } ?>
2015-02-08 18:55:48 +01:00
<?php if (FreshRSS_Auth::hasAccess()) { ?>
2014-09-27 10:10:43 +02:00
<div id="nav_menu_actions" class="stick">
2014-07-23 15:52:50 +02:00
<?php
2015-02-08 18:55:48 +01:00
$states = array(
'read' => FreshRSS_Entry::STATE_READ,
'unread' => FreshRSS_Entry::STATE_NOT_READ,
'starred' => FreshRSS_Entry::STATE_FAVORITE,
'non-starred' => FreshRSS_Entry::STATE_NOT_FAVORITE,
);
foreach ($states as $state_str => $state) {
$state_enabled = FreshRSS_Context::isStateEnabled($state);
$url_state = Minz_Request::currentRequest();
$url_state['params']['state'] = FreshRSS_Context::getRevertState($state);
2014-07-23 15:52:50 +02:00
?>
2015-02-08 18:55:48 +01:00
<a id="toggle-<?php echo $state_str; ?>"
class="btn <?php echo $state_enabled ? 'active' : ''; ?>"
aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>"
title="<?php echo _t('index.menu.' . $state_str); ?>"
href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a>
<?php } ?>
2014-07-23 15:52:50 +02:00
<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">
2015-02-08 18:55:48 +01:00
<?php echo _t('index.menu.queries'); ?>
2014-09-27 10:10:43 +02:00
<a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a>
</li>
2014-07-23 15:52:50 +02:00
2015-02-08 18:55:48 +01:00
<?php foreach (FreshRSS_Context::$user_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 } ?>
2015-02-08 18:55:48 +01:00
<?php if (count(FreshRSS_Context::$user_conf->queries) > 0) { ?>
2014-07-23 15:52:50 +02:00
<li class="separator no-mobile"></li>
<?php } ?>
<?php
2015-02-08 18:55:48 +01:00
$url_query = Minz_Request::currentRequest();;
2014-07-23 15:52:50 +02:00
$url_query['c'] = 'configure';
$url_query['a'] = 'addQuery';
?>
2015-02-08 18:55:48 +01:00
<li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo _i('bookmark-add'); ?> <?php echo _t('index.menu.add_query'); ?></a></li>
2014-07-23 15:52:50 +02:00
</ul>
</div>
</div>
2014-09-21 12:12:35 +02:00
2015-02-08 18:55:48 +01:00
<?php
$get = FreshRSS_Context::currentGet();
$string_mark = _t('index.menu.mark_all_read');
if ($get[0] == 'f') {
$string_mark = _t('index.menu.mark_feed_read');
} elseif ($get[0] == 'c') {
$string_mark = _t('index.menu.mark_cat_read');
2014-07-23 15:52:50 +02:00
}
2015-02-08 18:55:48 +01:00
$mark_read_url = array(
'c' => 'entry',
'a' => 'read',
'params' => array(
'get' => $get,
'nextGet' => FreshRSS_Context::$next_get,
'idMax' => FreshRSS_Context::$id_max,
)
);
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">
2015-02-08 18:55:48 +01:00
<?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm' : ''; ?>
2014-09-27 10:10:43 +02:00
<button class="read_all btn <?php echo $confirm; ?>"
form="mark-read-menu"
2015-02-08 18:55:48 +01:00
formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
type="submit"><?php echo _t('gen.action.mark_read'); ?></button>
2014-09-27 10:10:43 +02:00
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"
2015-02-08 18:55:48 +01:00
formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
2014-09-27 10:10:43 +02:00
type="submit"><?php echo $string_mark; ?></button>
</li>
2014-07-23 15:52:50 +02:00
<li class="separator"></li>
<?php
2015-02-08 18:55:48 +01:00
$today = @strtotime('today');
$mark_before_today = $mark_read_url;
$mark_before_today['params']['idMax'] = $today . '000000';
$mark_before_one_week = $mark_read_url;
$mark_before_one_week['params']['idMax'] = ($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); ?>"
2015-02-08 18:55:48 +01:00
type="submit"><?php echo _t('index.menu.before_one_day'); ?></button>
2014-09-27 10:10:43 +02:00
</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); ?>"
2015-02-08 18:55:48 +01:00
type="submit"><?php echo _t('index.menu.before_one_week'); ?></button>
2014-09-27 10:10:43 +02:00
</li>
2014-07-23 15:52:50 +02:00
</ul>
</div>
</div>
<?php } ?>
2015-02-08 18:55:48 +01:00
<?php $url_output = Minz_Request::currentRequest(); ?>
2014-07-23 15:52:50 +02:00
<div class="stick" id="nav_menu_views">
2015-02-08 18:55:48 +01:00
<?php $url_output['a'] = 'normal'; ?>
<a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('index.menu.normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
2014-09-27 10:10:43 +02:00
<?php echo _i("view-normal"); ?>
2014-07-23 15:52:50 +02:00
</a>
2015-02-08 18:55:48 +01:00
<?php $url_output['a'] = 'global'; ?>
<a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('index.menu.global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
2014-09-27 10:10:43 +02:00
<?php echo _i("view-global"); ?>
2014-07-23 15:52:50 +02:00
</a>
2015-02-08 18:55:48 +01:00
<?php $url_output['a'] = 'reader'; ?>
<a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('index.menu.reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
2014-09-27 10:10:43 +02:00
<?php echo _i("view-reader"); ?>
2014-07-23 15:52:50 +02:00
</a>
<?php
2015-02-08 18:55:48 +01:00
$url_output['a'] = 'rss';
if (FreshRSS_Context::$user_conf->token) {
$url_output['params']['token'] = FreshRSS_Context::$user_conf->token;
2014-09-21 12:12:35 +02:00
}
2014-07-23 15:52:50 +02:00
?>
2015-02-08 18:55:48 +01:00
<a class="view_rss btn" target="_blank" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
2014-09-27 10:10:43 +02:00
<?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">
2015-02-08 18:55:48 +01:00
<input type="search" name="search" class="extend" value="<?php echo FreshRSS_Context::$search; ?>" placeholder="<?php echo _t('index.menu.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
2015-02-08 18:55:48 +01:00
if (FreshRSS_Context::$order === 'DESC') {
2014-07-23 15:52:50 +02:00
$order = 'ASC';
$icon = 'up';
2015-02-08 18:55:48 +01:00
$title = 'index.menu.older_first';
2014-07-23 15:52:50 +02:00
} else {
$order = 'DESC';
$icon = 'down';
2015-02-08 18:55:48 +01:00
$title = 'index.menu.newer_first';
2014-07-23 15:52:50 +02:00
}
2015-02-08 18:55:48 +01:00
$url_order = Minz_Request::currentRequest();
2014-07-23 15:52:50 +02:00
$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>
2015-02-08 18:55:48 +01:00
<?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous_refresh) { ?>
<a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>" title="<?php echo _t('gen.action.actualize'); ?>"><?php echo _i('refresh'); ?></a>
2014-07-23 15:52:50 +02:00
<?php } ?>
</div>