streams/include/page_widgets.php

40 lines
1 KiB
PHP
Raw Normal View History

2013-08-10 21:06:30 +00:00
<?php
// A basic toolbar for observers with write_pages permissions
2013-08-10 21:06:30 +00:00
function writepages_widget ($who,$which){
return replace_macros(get_markup_template('write_pages.tpl'), array(
2013-08-10 21:06:30 +00:00
'$new' => t('New Page'),
'$newurl' => "webpages/$who",
2013-09-26 17:26:03 +00:00
'$edit' => t('Edit'),
2013-08-10 21:06:30 +00:00
'$editurl' => "editwebpage/$who/$which"
));
}
// Chan is channel_id, $who is channel_address - we'll need to pass observer later too.
function pagelist_widget ($chan,$who){
$r = q("select * from item_id where uid = %d and service = 'WEBPAGE' order by sid asc",
intval($chan)
);
$pages = null;
// TODO - only list public pages. Doesn't matter for now, since we don't have ACL anyway.
if($r) {
$pages = array();
foreach($r as $rr) {
$pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
}
}
return replace_macros(get_markup_template('webpagelist.tpl'), array(
'$baseurl' => $url,
'$edit' => '',
'$pages' => $pages,
'$channel' => $who,
'$preview' => '',
'$widget' => 1,
));
}