-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
134 lines (127 loc) · 6.34 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php if(!defined('PLX_ROOT')) exit; ?>
<?php
# Control du token du formulaire
plxToken::validateFormToken($_POST);
if(!empty($_POST)) {
var_dump($_POST);
$plxPlugin->setParam('dispTotalPg', plxUtils::getValue($_POST['dispTotalPg']), 'numeric');
$plxPlugin->setParam('dispFirstLink', plxUtils::getValue($_POST['dispFirstLink']), 'numeric');
$plxPlugin->setParam('dispPrevLink', plxUtils::getValue($_POST['dispPrevLink']), 'numeric');
$plxPlugin->setParam('dispPages', plxUtils::getValue($_POST['dispPages']), 'numeric');
$plxPlugin->setParam('dispHellip', plxUtils::getValue($_POST['dispHellip']), 'numeric');
$plxPlugin->setParam('dispNextLink', plxUtils::getValue($_POST['dispNextLink']), 'numeric');
$plxPlugin->setParam('dispLastLink', plxUtils::getValue($_POST['dispLastLink']), 'numeric');
$plxPlugin->setParam('numberPg', plxUtils::getValue($_POST['numberPg']), 'numeric');
$plxPlugin->saveParams();
header('Location: parametres_plugin.php?p=staticPagination');
exit;
}
$sel=' checked="checked"';
$dispTotalPg = ($plxPlugin->getParam('dispTotalPg')==1 OR $plxPlugin->getParam('dispTotalPg')=='')?$sel:'';
$dispFirstLink = ($plxPlugin->getParam('dispFirstLink')==1 OR $plxPlugin->getParam('dispFirstLink')=='')?$sel:'';
$dispPrevLink = ($plxPlugin->getParam('dispPrevLink')==1 OR $plxPlugin->getParam('dispPrevLink')=='')?$sel:'';
$dispPages = ($plxPlugin->getParam('dispPages')==1 OR $plxPlugin->getParam('dispPages')=='')?$sel:'';
$dispHellip = ($plxPlugin->getParam('dispHellip')==1 OR $plxPlugin->getParam('dispHellip')=='')?$sel:'';
$dispNextLink = ($plxPlugin->getParam('dispNextLink')==1 OR $plxPlugin->getParam('dispNextLink')=='')?$sel:'';
$dispLastLink = ($plxPlugin->getParam('dispLastLink')==1 OR $plxPlugin->getParam('dispLastLink')=='')?$sel:'';
$numberPg = $plxPlugin->getParam('numberPg') !=='' ? $plxPlugin->getParam('numberPg') : '5';
?>
<script type="text/javascript">
var head = document.getElementsByTagName("head")[0];
var css = document.createElement('link');
css.type = "text/css";
css.rel = "stylesheet";
css.href = "<?php echo PLX_PLUGINS ?>staticPagination/style.css";
css.media = "screen";
head.appendChild(css);
</script>
<form class="inline-form" id="form_staticPagination" action="parametres_plugin.php?p=staticPagination" method="post">
<fieldset class="withlabel">
<p><?php $plxPlugin->lang('L_PAGER_CHECK_LIB') ?></p>
<p>
<input<?php echo $dispFirstLink ?> type="checkbox" id="id_dispFirstLink" name="dispFirstLink" value="1" />
<label for="id_dispFirstLink"><?php echo L_PAGINATION_FIRST_TITLE ?> :</label>
<?php echo '<span class="p_first">'.L_PAGINATION_FIRST.'</span>' ?>
</p>
<p>
<input<?php echo $dispPrevLink ?> type="checkbox" id="id_dispPrevLink" name="dispPrevLink" value="1" />
<label for="id_dispPrevLink"><?php echo L_PAGINATION_PREVIOUS_TITLE ?> :</label>
<?php echo '<span class="p_prev">'.L_PAGINATION_PREVIOUS.'</span>' ?>
</p>
<p>
<input<?php echo $dispPages ?> type="checkbox" id="id_dispPages" name="dispPages" value="1" />
<label for="id_dispPages"><?php $plxPlugin->lang('L_PAGER_PAGES') ?> :</label>
<?php echo '<span class="p_page">1</span>' ?>
</p>
<p style="margin-left: 2em;">
<input<?php echo $dispHellip ?> type="checkbox" id="id_dispHellip" name="dispHellip" value="1" />
<label for="id_dispHellip"><?php $plxPlugin->lang('L_PAGER_INDICATOR') ?> :</label>
<?php echo '<span class="p_page">…</span>' ?>
</p>
<p>
<input<?php echo $dispNextLink ?> type="checkbox" id="id_dispNextLink" name="dispNextLink" value="1" />
<label for="id_dispNextLink"><?php echo L_PAGINATION_NEXT_TITLE ?> :</label>
<?php echo '<span class="p_next">'.L_PAGINATION_NEXT.'</span>' ?>
</p>
<p>
<input<?php echo $dispLastLink ?> type="checkbox" id="id_dispLastLink" name="dispLastLink" value="1" />
<label for="id_dispLastLink"><?php echo L_PAGINATION_LAST_TITLE ?> :</label>
<?php echo '<span class="p_last">'.L_PAGINATION_LAST.'</span>' ?>
</p>
<p>
<input<?php echo $dispTotalPg ?> type="checkbox" id="id_dispTotalPg" name="dispTotalPg" value="1" />
<label for="id_dispTotalPg"><?php $plxPlugin->lang('L_PAGER_NUM_PAGES') ?>:</label>
<?php printf('<span class="p_pager">'.ucfirst(L_PAGINATION).'</span>',4,10) ?>
</p>
<p>
<label for="id_numberPg"><?php $plxPlugin->lang('L_PAGER_NAX_PAGES') ?>:</label>
<input type="number" id="id_numberPg" name="numberPg" min="3" value="<?php echo $numberPg ?>" />
</p>
<p class="in-action-bar">
<?php echo plxToken::getTokenPostMethod() ?>
<input type="submit" name="submit" value="<?php $plxPlugin->lang('L_PAGER_SAVE') ?>" />
</p>
</fieldset>
</form>
<div id="pagination">
<p>
<?php
if($dispFirstLink!='')echo '<span class="p_first">'.L_PAGINATION_FIRST.'</span>';
if($dispPrevLink!='')echo '<span class="p_prev">'.L_PAGINATION_PREVIOUS.'</span>';
if($dispPages!='') {
$stop_p = 3 + round($numberPg/2) ;
if( $stop_p < $numberPg ) $stop_p = $numberPg;
if( $stop_p > 10 ) $stop_p = 10;
$start_p = $stop_p - $numberPg + 1;
if($dispHellip!='' and $start_p > 1)echo '<span class="p_page">…</span>';
if($start_p < 1 ) $start_p = 1;
for( $j = $start_p; $j <= $stop_p; $j++ ) {
($j == 4 ) ? $html_str = '<span class="p_current">4</span>' : $html_str = '<span class="p_page">'.$j.'</span>';
echo $html_str;
}
if($dispHellip!='' and $stop_p < 10) echo '<span class="p_page">…</span>';
} else {
echo '<span class="p_current">4</span>';
}
if($dispNextLink!='') echo '<span class="p_next">'.L_PAGINATION_NEXT.'</span>';
if($dispLastLink!='') echo '<span class="p_last">'.L_PAGINATION_LAST.'</span>';
?>
</p>
<?php
if($dispTotalPg!='') printf('<p class="p_pager">'.ucfirst(L_PAGINATION).'</p>',4,10);
?>
</div>
<p>
<?php $plxPlugin->lang('L_PAGER_CSS_DESCRIPTION') ?>
</p>
<ul>
<li>div#pagination : <?php $plxPlugin->lang('L_PAGER_CSS_CONTAINER') ?></li>
<li>div#pagination span : <?php $plxPlugin->lang('L_PAGER_CSS_SPAN') ?></li>
<li>.p_page : <?php $plxPlugin->lang('L_PAGER_CSS_ITEM') ?></li>
<li>.p_first : <?php $plxPlugin->lang('L_PAGER_CSS_FIRST') ?></li>
<li>.p_prev : <?php $plxPlugin->lang('L_PAGER_CSS_PREV') ?></li>
<li>.p_current : <?php $plxPlugin->lang('L_PAGER_CSS_CURRENT') ?></li>
<li>.p_next : <?php $plxPlugin->lang('L_PAGER_CSS_NEXT') ?></li>
<li>.p_last : <?php $plxPlugin->lang('L_PAGER_CSS_LAST') ?></li>
<li>.p_pager : <?php $plxPlugin->lang('L_PAGER_NUM_PAGES') ?></li>
</ul>