function wikiplugin_bloglist($data, $params)
{
    global $tikilib;
    extract($params, EXTR_SKIP);
    if (!isset($Id)) {
        $text = "<b>missing blog Id for BLOGLIST plugins</b><br />";
        $text .= wikiplugin_bloglist_help();
        return $text;
    }
    //	if (!isset($Field)) {
    //		$Field = 'heading';
    //	}
    $text = "<div class=\"blogtools\"><table><tr><th>" . tra("Date") . "</th><th>" . tra("Title") . "</th><th>" . tra("Author") . "</th></tr>\n";
    $query = "select `postId`, `title`, `user`, `created`  from `tiki_blog_posts` where `blogId`=? order by `created` desc";
    $result = $tikilib->query($query, array($Id));
    $i = 0;
    while (($res = $result->fetchRow()) && $i < $Items) {
        $text .= "<tr><td>" . TikiLib::date_format("%d/%M/%Y %H:%M", $res["created"]) . "</td>";
        $text .= "<td><a href=\"tiki-view_blog_post.php?blogId=" . $Id . "&postId=" . $res["postId"] . "\">" . $res["title"] . "</a></td>";
        $text .= "<td>" . $res["user"] . "</td></tr>\n";
        $i++;
    }
    $text .= "</table></div>\n";
    return $text;
}
Example #2
0
function wikiplugin_bloglist($data, $params)
{
    global $tikilib, $smarty;
    if (!isset($params['Id'])) {
        $text = "<b>missing blog Id for BLOGLIST plugins</b><br />";
        $text .= wikiplugin_bloglist_help();
        return $text;
    }
    if (!isset($params['max'])) {
        $params['max'] = -1;
    }
    if (!isset($params['offset'])) {
        $params['offset'] = 0;
    }
    if (!isset($params['sort_mode'])) {
        $params['sort_mode'] = 'created_desc';
    }
    if (!isset($params['find'])) {
        $params['find'] = '';
    }
    if (!isset($params['author'])) {
        $params['author'] = '';
    }
    $blogItems = $tikilib->list_posts($params['offset'], $params['max'], $params['sort_mode'], $params['find'], $params['Id'], $params['author']);
    $smarty->assign_by_ref('blogItems', $blogItems['data']);
    $ret = $smarty->fetch('wiki-plugins/wikiplugin_bloglist.tpl');
    return '~np~' . $ret . '~/np~';
}
function wikiplugin_bloglist($data, $params)
{
	global $tikilib, $smarty, $prefs;

	if (!isset($params['Id'])) {
		$text = ("<b>missing blog Id for BLOGLIST plugins</b><br />");
		$text .= wikiplugin_bloglist_help();
		return $text;
	}

	if (!isset($params['Items'])) $params['Items'] = -1;
	if (!isset($params['offset'])) $params['offset'] = 0;
	if (!isset($params['sort_mode'])) $params['sort_mode'] = 'created_desc';
	if (!isset($params['find'])) $params['find'] = '';
	if (!isset($params['author'])) $params['author'] = '';
	if (!isset($params['simpleList'])) $params['simpleList'] = 'y';
	if (!isset($params['isHtml'])) $params['isHtml'] = 'n';

	if (isset($params['dateStart'])) {
		$dateStartTS = strtotime($params['dateStart']);
	}
	if (isset($params['dateEnd'])) {
		$dateEndTS = strtotime($params['dateEnd']);
	}
	$dateStartTS = !empty($dateStartTS) ? $dateStartTS : 0;
	$dateEndTS = !empty($dateEndTS) ? $dateEndTS : $tikilib->now;

	if (!isset($params['containerClass'])) {
		$params['containerClass'] = 'wikiplugin_bloglist';
	}
	$smarty->assign('container_class', $params['containerClass']);
	
	if ($params['simpleList'] == 'y') {
		global $bloglib; require_once('lib/blogs/bloglib.php');
		$blogItems = $bloglib->list_posts($params['offset'], $params['Items'], $params['sort_mode'], $params['find'], $params['Id'], $params['author'], '', $dateStartTS, $dateEndTS);
		$smarty->assign_by_ref('blogItems', $blogItems['data']);
		$template = 'wiki-plugins/wikiplugin_bloglist.tpl';
	} else {
		global $bloglib; include_once('lib/blogs/bloglib.php');
		
		$blogItems = $bloglib->list_blog_posts($params['Id'], false, $params['offset'], $params['Items'], $params['sort_mode'], $params['find'], $dateStartTS, $dateEndTS);
		$temp_max = count($blogItems["data"]);
		for ($i = 0; $i < $temp_max; $i++) {
			$blogItems["data"][$i]["parsed_data"] = $tikilib->parse_data($bloglib->get_page($blogItems["data"][$i]["data"], 1), array('is_html' => ($params['isHtml'] === 'y')));
			if ($prefs['feature_freetags'] == 'y') { // And get the Tags for the posts
				global $freetaglib; include_once('lib/freetag/freetaglib.php');
				$blogItems["data"][$i]["freetags"] = $freetaglib->get_tags_on_object($blogItems["data"][$i]["postId"], "blog post");
			}
		}
		$smarty->assign('show_heading', 'n');
		$smarty->assign('use_author', 'y');
		$smarty->assign('add_date', 'y');
		$smarty->assign_by_ref('listpages', $blogItems['data']);
		$template = 'tiki-view_blog.tpl';
	}
	$ret = $smarty->fetch($template);
	return '~np~'.$ret.'~/np~';
}