forked from friendica/friendica-addons
randomise page results of desired
This commit is contained in:
parent
4cdf19966d
commit
9c4f69cf7f
3 changed files with 20 additions and 5 deletions
BIN
page.tgz
BIN
page.tgz
Binary file not shown.
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#page-settings-label {
|
#page-settings-label, #page-random-label {
|
||||||
float: left;
|
float: left;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-max-pages {
|
#page-max-pages, #page-random {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,13 @@ function page_uninstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function page_getpage($uid) {
|
function page_getpage($uid,$randomise = false) {
|
||||||
|
|
||||||
|
|
||||||
$pagelist = array();
|
$pagelist = array();
|
||||||
|
|
||||||
|
$random = (($randomise) ? ' order by rand ' : ' order by name asc ');
|
||||||
|
|
||||||
$contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
|
$contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact`
|
||||||
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
|
WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d
|
||||||
order by name asc ",
|
order by name asc ",
|
||||||
|
@ -89,7 +91,9 @@ function page_network_mod_init($a,$b) {
|
||||||
$show_total = intval(get_pconfig(local_user(),'page','max_pages'));
|
$show_total = intval(get_pconfig(local_user(),'page','max_pages'));
|
||||||
if($show_total === false)
|
if($show_total === false)
|
||||||
$show_total = 6;
|
$show_total = 6;
|
||||||
$contacts = page_getpage($a->user['uid']);
|
$randomise = intval(get_pconfig(local_user(),'page','randomise'));
|
||||||
|
|
||||||
|
$contacts = page_getpage($a->user['uid'],$randomise);
|
||||||
|
|
||||||
$total_shown = 0;
|
$total_shown = 0;
|
||||||
$more = false;
|
$more = false;
|
||||||
|
@ -116,6 +120,8 @@ function page_plugin_settings_post($a,$post) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
set_pconfig(local_user(),'page','max_pages',intval($_POST['page_max_pages']));
|
set_pconfig(local_user(),'page','max_pages',intval($_POST['page_max_pages']));
|
||||||
|
set_pconfig(local_user(),'page','randomise',intval($_POST['page_random']));
|
||||||
|
|
||||||
info( t('Page settings updated.') . EOL);
|
info( t('Page settings updated.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +141,10 @@ function page_plugin_settings(&$a,&$s) {
|
||||||
if($max_pages === false)
|
if($max_pages === false)
|
||||||
$max_pages = 6;
|
$max_pages = 6;
|
||||||
|
|
||||||
|
$randomise = intval(get_pconfig(local_user(),'page','randomise'));
|
||||||
|
$randomise_checked = (($randomise) ? ' checked="checked" ' : '');
|
||||||
|
|
||||||
|
|
||||||
/* Add some HTML to the existing form */
|
/* Add some HTML to the existing form */
|
||||||
|
|
||||||
$s .= '<div class="settings-block">';
|
$s .= '<div class="settings-block">';
|
||||||
|
@ -142,7 +152,12 @@ function page_plugin_settings(&$a,&$s) {
|
||||||
$s .= '<div id="page-settings-wrapper">';
|
$s .= '<div id="page-settings-wrapper">';
|
||||||
$s .= '<label id="page-settings-label" for="page-max-pages">' . t('How many forums to display on sidebar without paging') . '</label>';
|
$s .= '<label id="page-settings-label" for="page-max-pages">' . t('How many forums to display on sidebar without paging') . '</label>';
|
||||||
$s .= '<input id="page-max-pages" type="text" name="page_max_pages" value="' . intval($max_pages) . '" ' . '/>';
|
$s .= '<input id="page-max-pages" type="text" name="page_max_pages" value="' . intval($max_pages) . '" ' . '/>';
|
||||||
$s .= '</div><div class="clear"></div>';
|
$s .= '<div class="clear"></div>';
|
||||||
|
$s .= '<label id="page-random-label" for="page-random">' . t('Randomise Page/Forum list') . '</label>';
|
||||||
|
$s .= '<input id="page-random" type="checkbox" name="page_random" value="1" ' . $randomise_checked . '/>';
|
||||||
|
$s .= '<div class="clear"></div>';
|
||||||
|
|
||||||
|
$s .= '</div>';
|
||||||
|
|
||||||
/* provide a submit button */
|
/* provide a submit button */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue