SMF Projects recent bugs/features Block
[Made by Blue][I hope you like it =D]
Description: A fully customizable block that shows recent bugs/features posted in the Issue Tracker.
Requirements:
- SMF 2.0 GOLD
- SMF Projects 0.5.3
- Simple Portal 2.3.3
SETUP INSIDE:
+ You can choose how many bugs/features you want to output
+ Show replies or not
+ Show Project Category or not
+ Show who posted or not
+ Show status color or not
+ You can translate it to your own language with $txt inside
Author Notes:
Code Updated to Simple Portal 2.3.3 and SMF Projects 0.5.3
Screenshot:
(this pictures has every option ON - you can turn some OFF)
(http://img404.imageshack.us/img404/9444/screenshotuti.png)
<?php
/*
Block: SMF Projects Recent bugs/features Block
Author: Blue @ Chrome
Requirements:
- SMF 2.0 RC1+
- SMF Projects
- Simple Portal 2.2.1+
*/
/* [SETUP WHAT YOU WANT HERE] */
// How many recent bugs/feature do you want to output?
$limit = 5;
// Do you want to show Replies? YES = 1 | NO = 0
$show_replies = 1;
// Do you want to show Project Category? YES = 1 | NO = 0
$show_category = 1;
// Do you want to Show who Posted? YES = 1 | NO = 0
$show_posted = 1;
// Do you want to Show color status? YES = 1 | NO = 0
$show_color = 1;
// Do you want to translate it to your own language? :P
$txt['projects_false'] = 'SMF Projects not found';
$txt['sportal_false'] = 'Simple Portal not found';
$txt['project_cat'] = 'In';
$txt['who'] = 'by';
$txt['replies'] = 'Replies';
$txt['status'] = 'Status';
$txt['new'] = 'New';
$txt['feedback'] = 'Feedback';
$txt['confirmed'] = 'Confirmed';
$txt['assigned'] = 'Assigned';
$txt['resolved'] = 'Resolved';
$txt['closed'] = 'Closed';
/* [STOP!] - THIS IS THE END OF SETUP */
//Only code from now on ;)
global $smcFunc, $scripturl, $settings, $sourcedir;
// Lets see if you are using SMF Projects and Simple Portal. If not...well...go get them :D
if (!file_exists($sourcedir . '/Project.php'))
{
echo $txt['projects_false'];
return;
}
if (!file_exists($sourcedir . '/PortalBlocks.php'))
{
echo $txt['sportal_false'];
return;
}
// Permission check :P
isAllowedTo('project_access');
// Let's grab some database results
$dbresult = $smcFunc['db_query']('', "
SELECT
i.id_issue, i.subject, i.id_project, i.status, i.id_tracker, i.id_reporter, i.replies, m.real_name, m.id_member, p.name
FROM {db_prefix}issues AS i
LEFT JOIN {db_prefix}members AS m ON (i.id_reporter = m.id_member)
LEFT JOIN {db_prefix}projects AS p ON (i.id_project = p.id_project)
ORDER BY id_issue DESC
LIMIT $limit");
while ($blue = $smcFunc['db_fetch_assoc']($dbresult))
{
echo'
<ul class="sp_list">
<li class="sp_list_top">';
if ($blue['id_tracker'] == '1') {
echo'<img src="', $settings['images_url'], '/bug.png" alt="', $blue['id_tracker'], '" />'; }
else {
echo'<img src="', $settings['images_url'], '/feature.png" alt="', $blue['id_tracker'], '" />'; }
echo'<a href="', $scripturl, '?issue=', $blue['id_issue'], '"> ', $blue['subject'], '</a>
</li>
<li class="sp_list_indent sp_list_bottom smalltext">';
// If, if, if, if, if, xD
if ($show_category == 1)
{
echo'
', $txt['project_cat'], ' <a href="' . $scripturl .'?project=', $blue['id_project'], '">[', $blue['name'], ']</a>';
}
if ($show_posted == 1)
{
echo'
', $txt['who'], ' <a href="' . $scripturl .'?action=profile;u=', $blue['id_member'], '">', $blue['real_name'], '</a>';
}
if ($show_replies == 1)
{
echo
$txt['replies'], ': ', $blue['replies'];
}
if ($show_color == 1)
{
if($blue['status'] == 1) {
echo
' | ', $txt['status'], ':<span style="background-color:#FFCCCC"> ', $txt['new'], ' </span>';
} elseif ($blue['status'] == 2) {
echo
' | ', $txt['status'], ':<span style="background-color:#FF50A8"> ', $txt['feedback'], ' </span>';
} elseif ($blue['status'] == 3) {
echo
' | ', $txt['status'], ':<span style="background-color:#FFFFB0"> ', $txt['confirmed'], ' </span>';
} elseif($blue['status'] == 4) {
echo
' | ', $txt['status'], ':<span style="background-color:#C8C8FF"> ', $txt['assigned'], ' </span>';
} elseif($blue['status'] == 5) {
echo
' | ', $txt['status'], ':<span style="background-color:#CCFFCC"> ', $txt['resolved'], ' </span>';
} else {
echo
' | ', $txt['status'], ':<span style="background-color:#E8E8E8"> ', $txt['closed'], ' </span>';
}
}
echo'
</li>
</ul>';
}
$smcFunc['db_free_result']($dbresult);
?>
Edited: This document was successfully checked as XHTML 1.0 Transitional!