Commit 0a94a4a7 authored by pkdille's avatar pkdille

[MOD] deploy pagination lins to some templates

parent 746b7671
......@@ -85,74 +85,72 @@
<br />
{* The links *}
{if $categ_info.allowSites eq 'y' and count($items) > 0}
<b>{tr}Links{/tr}</b><br />
<div class="dirlistsites">
<form method="post" action="tiki-directory_browse.php">
<input type="hidden" name="parent" value="{$parent|escape}" />
{tr}Sort by{/tr}: <select name="sort_mode">
<option value="name_desc" {if $sort_mode eq 'name_desc'}selected="selected"{/if}>{tr}name (desc){/tr}</option>
<option value="name_asc" {if $sort_mode eq 'name_asc'}selected="selected"{/if}>{tr}name (asc){/tr}</option>
<option value="hits_desc" {if $sort_mode eq 'hits_desc'}selected="selected"{/if}>{tr}hits (desc){/tr}</option>
<option value="hits_asc" {if $sort_mode eq 'hits_asc'}selected="selected"{/if}>{tr}hits (asc){/tr}</option>
<option value="created_desc" {if $sort_mode eq 'created_desc'}selected="selected"{/if}>{tr}creation date (desc){/tr}</option>
<option value="created_asc" {if $sort_mode eq 'created_asc'}selected="selected"{/if}>{tr}creation date (asc){/tr}</option>
<option value="lastModif_desc" {if $sort_mode eq 'lastModif_desc'}selected="selected"{/if}>{tr}last updated (desc){/tr}</option>
<option value="lastModif_asc" {if $sort_mode eq 'lastModif_asc'}selected="selected"{/if}>{tr}last updated (asc){/tr}</option>
</select>
<input type="submit" name="xx" value="{tr}sort{/tr}" />
</form>
<br />
{section name=ix loop=$items}
<div class="dirsite">
{if $prefs.directory_country_flag eq 'y'}
<img alt="flag" src="img/flags/{$items[ix].country}.gif" />
{/if}
<a class="dirsitelink" href="tiki-directory_redirect.php?siteId={$items[ix].siteId}" {if $prefs.directory_open_links eq 'n'}target='_blank'{/if}>{$items[ix].name}</a>
{if $tiki_p_admin_directory_sites eq 'y'} [<a class="dirsitelink" href="tiki-directory_admin_sites.php?parent={$parent}&amp;siteId={$items[ix].siteId}">{tr}Edit{/tr}</a>]{/if}
{if $prefs.cachepages eq 'y'}(<a class="dirsitelink" href="tiki-view_cache.php?url={$items[ix].url}" target="_blank">{tr}Cache{/tr}</a>){/if}
<br />
<span class="dirsitedesc">{$items[ix].description}</span><br />
{assign var=fsfs value=1}
<span class="dirsitecats">
{tr}Categories{/tr}:
{section name=ii loop=$items[ix].cats}
{if $fsfs}{assign var=fsfs value=0}{else}, {/if}
<a class="dirsublink" href="tiki-directory_browse.php?parent={$items[ix].cats[ii].categId}">{$items[ix].cats[ii].path}</a>
{/section}
</span><br />
<span class="dirsitetrail">{tr}Added{/tr}: {$items[ix].created|tiki_short_date} {tr}Last updated{/tr}: {$items[ix].lastModif|tiki_short_date} {tr}Hits{/tr}: {$items[ix].hits}</span>
</div>
{/section}
</div>
<br />
{* next and prev links *}
<div class="mini">
{if $prev_offset >= 0}
[<a class="prevnext" href="tiki-directory_browse.php?parent={$parent}&amp;find={$find}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}Prev{/tr}</a>]&nbsp;
{/if}
{tr}Page{/tr}: {$actual_page}/{$cant_pages}
{if $next_offset >= 0}
&nbsp;[<a class="prevnext" href="tiki-directory_browse.php?parent={$parent}&amp;find={$find}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}Next{/tr}</a>]
{/if}
{if $prefs.direct_pagination eq 'y'}
<br />
{section loop=$cant_pages name=foo}
{assign var=selector_offset value=$smarty.section.foo.index|times:$prefs.maxRecords}
<a class="prevnext" href="tiki-directory_browse.php?parent={$parent}&amp;find={$find}&amp;offset={$selector_offset*2}&amp;sort_mode={$sort_mode}"> {*selector_offset is calculated wrong internal; temporary bug fix by w-o-g*}
{$smarty.section.foo.index_next}</a>&nbsp;
{/section}
{/if}
</div>
{else}{tr}No records.{/tr}
<b>{tr}Links{/tr}</b><br />
<div class="dirlistsites">
<form method="post" action="tiki-directory_browse.php">
<input type="hidden" name="parent" value="{$parent|escape}" />
{tr}Sort by{/tr}:&nbsp;
<select name="sort_mode">
<option value="name_desc" {if $sort_mode eq 'name_desc'}selected="selected"{/if}>{tr}name (desc){/tr}</option>
<option value="name_asc" {if $sort_mode eq 'name_asc'}selected="selected"{/if}>{tr}name (asc){/tr}</option>
<option value="hits_desc" {if $sort_mode eq 'hits_desc'}selected="selected"{/if}>{tr}hits (desc){/tr}</option>
<option value="hits_asc" {if $sort_mode eq 'hits_asc'}selected="selected"{/if}>{tr}hits (asc){/tr}</option>
<option value="created_desc" {if $sort_mode eq 'created_desc'}selected="selected"{/if}>{tr}creation date (desc){/tr}</option>
<option value="created_asc" {if $sort_mode eq 'created_asc'}selected="selected"{/if}>{tr}creation date (asc){/tr}</option>
<option value="lastModif_desc" {if $sort_mode eq 'lastModif_desc'}selected="selected"{/if}>{tr}last updated (desc){/tr}</option>
<option value="lastModif_asc" {if $sort_mode eq 'lastModif_asc'}selected="selected"{/if}>{tr}last updated (asc){/tr}</option>
</select>
<input type="submit" name="xx" value="{tr}sort{/tr}" />
</form>
<br />
{section name=ix loop=$items}
<div class="dirsite">
{if $prefs.directory_country_flag eq 'y'}
<img alt="flag" src="img/flags/{$items[ix].country}.gif" />
{/if}
<a class="dirsitelink" href="tiki-directory_redirect.php?siteId={$items[ix].siteId}" {if $prefs.directory_open_links eq 'n'}target='_blank'{/if}>{$items[ix].name}</a>
{if $tiki_p_admin_directory_sites eq 'y'}
[<a class="dirsitelink" href="tiki-directory_admin_sites.php?parent={$parent}&amp;siteId={$items[ix].siteId}">{tr}Edit{/tr}</a>]
{/if}
{if $prefs.cachepages eq 'y'}
(<a class="dirsitelink" href="tiki-view_cache.php?url={$items[ix].url}" target="_blank">{tr}Cache{/tr}</a>)
{/if}
<br />
<span class="dirsitedesc">{$items[ix].description}</span>
<br />
{assign var=fsfs value=1}
<span class="dirsitecats">
{tr}Categories{/tr}:
{section name=ii loop=$items[ix].cats}
{if $fsfs}
{assign var=fsfs value=0}{else},&nbsp;
{/if}
<a class="dirsublink" href="tiki-directory_browse.php?parent={$items[ix].cats[ii].categId}">{$items[ix].cats[ii].path}</a>
{/section}
</span>
<br />
<span class="dirsitetrail">
{tr}Added{/tr}: {$items[ix].created|tiki_short_date} {tr}Last updated{/tr}: {$items[ix].lastModif|tiki_short_date} {tr}Hits{/tr}: {$items[ix].hits}
</span>
</div>
{/section}
</div>
{pagination_links cant=$cant_pages step=$prefs.directory_links_per_page offset=$offset}{/pagination_links}
{else}
{tr}No records.{/tr}
{/if}
{if count($related)>0}
<div class="dirrelated">
{tr}Related categories{/tr}<br /><br />
{section name=ix loop=$related}
<a class="dirlink" href="tiki-directory_browse.php?parent={$related[ix].relatedTo}">{$related[ix].path}</a><br />
{/section}
</div>
<div class="dirrelated">
{tr}Related categories{/tr}
<br /><br />
{section name=ix loop=$related}
<a class="dirlink" href="tiki-directory_browse.php?parent={$related[ix].relatedTo}">{$related[ix].path}</a>
<br />
{/section}
</div>
{/if}
{include file=tiki-directory_footer.tpl}
......@@ -60,25 +60,5 @@
{sectionelse}{tr}No records found.{/tr}
{/section}
</div>
<br />
{* next and prev links *}
<div class="mini">
{if $prev_offset >= 0}
[<a class="prevnext" href="tiki-directory_search.php?words={$words}&amp;how={$how}&amp;where={$where}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}Prev{/tr}</a>]&nbsp;
{/if}
{tr}Page{/tr}: {$actual_page}/{$cant_pages}
{if $next_offset >= 0}
&nbsp;[<a class="prevnext" href="tiki-directory_search.php?words={$words}&amp;how={$how}&amp;where={$where}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}Next{/tr}</a>]
{/if}
{if $prefs.direct_pagination eq 'y'}
<br />
{section loop=$cant_pages name=foo}
{assign var=selector_offset value=$smarty.section.foo.index|times:$prefs.maxRecords}
<a class="prevnext" href="tiki-directory_search.php?parent={$parent}&amp;words={$words}&amp;how={$how}&amp;where={$where}&amp;offset={$selector_offset}&amp;sort_mode={$sort_mode}">
{$smarty.section.foo.index_next}</a>&nbsp;
{/section}
{/if}
</div>
{pagination_links cant=$cant_pages step=$prefs.maxRecords offset=$offset}{/pagination_links}
......@@ -58,20 +58,5 @@ var CHECKBOX_LIST = [{section name=user loop=$items}'sites[{$items[user].siteId}
<input type="submit" name="validate" value="{tr}Validate{/tr}" />
{/if}
</form>
<div class="mini">
{if $prev_offset >= 0}
[<a class="prevnext" href="tiki-directory_validate_sites.php?find={$find}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}Prev{/tr}</a>]&nbsp;
{/if}
{tr}Page{/tr}: {$actual_page}/{$cant_pages}
{if $next_offset >= 0}
&nbsp;[<a class="prevnext" href="tiki-directory_validate_sites.php?find={$find}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}Next{/tr}</a>]
{/if}
{if $prefs.direct_pagination eq 'y'}
<br />
{section loop=$cant_pages name=foo}
{assign var=selector_offset value=$smarty.section.foo.index|times:$prefs.maxRecords}
<a class="prevnext" href="tiki-directory_validate_sites.php?find={$find}&amp;offset={$selector_offset}&amp;sort_mode={$sort_mode}">
{$smarty.section.foo.index_next}</a>&nbsp;
{/section}
{/if}
</div>
{pagination_links cant=$cant_pages step=$prefs.maxRecords offset=$offset}{/pagination_links}
......@@ -129,22 +129,10 @@ if ($categ_info['allowSites'] == 'y') {
$smarty->assign_by_ref('offset', $offset);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$smarty->assign('find', $find);
$items = $dirlib->dir_list_sites($_REQUEST['parent'], $offset, $prefs['directory_links_per_page'], $sort_mode, '', 'y');
$cant_pages = ceil($items["cant"] / $prefs['directory_links_per_page']);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $prefs['directory_links_per_page']));
if ($items["cant"] > ($offset + $prefs['directory_links_per_page'])) {
$smarty->assign('next_offset', $offset + $prefs['directory_links_per_page']);
} else {
$smarty->assign('next_offset', -1);
}
$items = $dirlib->dir_list_sites($_REQUEST['parent'], $offset, $prefs['directory_links_per_page'], $sort_mode, '', 'y');
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $prefs['directory_links_per_page']);
} else {
$smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
}
......
......@@ -59,21 +59,7 @@ if ($_REQUEST['where'] == 'all') {
$items = $dirlib->dir_search_cat($_REQUEST['parent'], $_REQUEST['words'], $_REQUEST['how'], $offset, $maxRecords, $sort_mode);
}
$cant_pages = ceil($items["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($items["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
......
......@@ -72,23 +72,9 @@ if (isset($_REQUEST["find"])) {
$smarty->assign_by_ref('offset', $offset);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$smarty->assign('find', $find);
// What are we paginating: items
$items = $dirlib->dir_list_invalid_sites($offset, $maxRecords, $sort_mode, $find);
$cant_pages = ceil($items["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
if ($items["cant"] > ($offset + $maxRecords)) {
$smarty->assign('next_offset', $offset + $maxRecords);
} else {
$smarty->assign('next_offset', -1);
}
if ($offset > 0) {
$smarty->assign('prev_offset', $offset - $maxRecords);
} else {
$smarty->assign('prev_offset', -1);
}
$items = $dirlib->dir_list_invalid_sites($offset, $maxRecords, $sort_mode, $find);
$smarty->assign_by_ref('cant_pages', $items["cant"]);
$smarty->assign_by_ref('items', $items["data"]);
......
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