SimplePortal

SimplePortal => Site Discussion => Topic started by: α¢αηѕ on May 25, 2010, 03:42:40 AM

Title: Project Tools Block
Post by: α¢αηѕ on May 25, 2010, 03:42:40 AM
I was looking over the most boards here as well as the search feature and i cannot find a topic about the Project Tools block on the front page.

Will this block be released? or only for SP.net
Title: Re: Project Tools Block
Post by: Masterd on May 19, 2011, 01:05:27 PM
I'm also interested in it.
Title: Re: Project Tools Block
Post by: [SiNaN] on May 20, 2011, 06:41:41 AM
It was posted in the Blocks and Modifications board but here is the latest code:

Code: [Select]
global $context, $settings, $project, $txt;

$block_parameters = array();

if ($return_parameters)
return $block_parameters;

loadLanguage('Project');

$project = 1;
$num_issues = 5;
$order = 'i.updated DESC';

$issues = getIssueList(0, $num_issues, $order, '1 = 1');

echo '
<table class="bordercolor issuetable" cellspacing="0">';

foreach ($issues as $issue)
{
echo '
<tr>
<td class="windowbg sp_center issue_', $issue['status']['name'], '" style="width: 24px; border-bottom: 1px solid #FFF;">
<img src="', $settings['images_url'], '/', $issue['tracker']['image'], '" alt="', $issue['tracker']['name'], '" />
</td>
<td class="info issue_', $issue['status']['name'], '" style="border-bottom: 1px solid #FFF;">
', !empty($issue['category']['link']) ? '[' . $issue['category']['link'] . '] ' : '', $issue['link'], ' ';

if ($issue['new'] && $context['user']['is_logged'])
echo '
<a href="', $issue['new_href'], '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';

echo '
<br /><span class="smalltext">', !empty($issue['version']['link']) ? '[' . $issue['version']['link'] . '] ' : '', $txt['issue_status_' . $issue['status']['name']], $issue['is_assigned'] ? ' (' . $issue['assigned']['link'] . ')' : '', '</span>
</td>
</tr>';
}

echo '
</table>';
Title: Re: Project Tools Block
Post by: Masterd on May 20, 2011, 12:34:03 PM
Thanks, [SiNaN]!
Title: Re: Project Tools Block
Post by: Masterd on May 27, 2011, 01:11:25 PM
It's not working.
Title: Re: Project Tools Block
Post by: [SiNaN] on May 27, 2011, 02:33:01 PM
I know some people think I'm an amazing person. But still I can't figure out what the problem is only with that single unexplanatory sentence. I'm sure that is the exact code we are using here, since I directly copied from that block.
Title: Re: Project Tools Block
Post by: grafitus on May 27, 2011, 02:48:05 PM
The code works perfectly. But you can use the following for a better view:
Code: [Select]
global $context, $settings, $project, $txt;

loadLanguage('Project');

$project = 1;
$num_issues = 5;
$order = 'i.updated DESC';

$issues = getIssueList(0, $num_issues, $order, '1 = 1');

echo '
<table class="bordercolor" style="width: 100%;" cellspacing="0">';

foreach ($issues as $issue)
{
echo '
<tr>
<td class="windowbg sp_center issue_', $issue['status']['name'], '" style="width: 24px; border-bottom: 1px solid #FFF;">
<img src="', $settings['images_url'], '/', $issue['tracker']['image'], '" alt="', $issue['tracker']['name'], '" />
</td>
<td class="info issue_', $issue['status']['name'], '" style="border-bottom: 1px solid #FFF;">
', !empty($issue['category']['link']) ? '[' . $issue['category']['link'] . '] ' : '', $issue['link'], ' ';

if ($issue['new'] && $context['user']['is_logged'])
echo '
<a href="', $issue['new_href'], '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';

echo '
<br /><span class="smalltext">', !empty($issue['version']['link']) ? '[' . $issue['version']['link'] . '] ' : '', $txt['issue_status_' . $issue['status']['name']], $issue['is_assigned'] ? ' (' . $issue['assigned']['link'] . ')' : '', '</span>
</td>
</tr>';
}

echo '
</table>';

And copy this code to your the end of your index.css file:
Code: [Select]
.issue_new
{
background-color: #FFCCCC;
}
.issue_feedback
{
background-color: #FF50A8;
}
.issue_confirmed
{
background-color: #FFFFB0;
}
.issue_assigned
{
background-color: #C8C8FF;
}
.issue_resolved
{
background-color: #CCFFCC;
}
.issue_closed
{
background-color: #E8E8E8;
}
Title: Re: Project Tools Block
Post by: Masterd on May 28, 2011, 08:43:59 AM
My bad. Now it's working perfectly. How can I add more than just one project?
Title: Re: Project Tools Block
Post by: grafitus on May 28, 2011, 04:13:49 PM
Sorry, getIssueList() does not support fetching multi-projects at a time. Or you can use this:
Code: [Select]
global $context, $settings, $project, $txt;

loadLanguage('Project');

$projects = array(1, 2); // blah, blah, blah
$num_issues = 5;
$order = 'i.updated DESC';

echo '
<table class="bordercolor" style="width: 100%;" cellspacing="0">';
foreach ($projects as $project)
{
$issues = getIssueList(0, $num_issues, $order, '1 = 1');

foreach ($issues as $issue)
{
echo '
<tr>
<td class="windowbg sp_center issue_', $issue['status']['name'], '" style="width: 24px; border-bottom: 1px solid #FFF;">
<img src="', $settings['images_url'], '/', $issue['tracker']['image'], '" alt="', $issue['tracker']['name'], '" />
</td>
<td class="info issue_', $issue['status']['name'], '" style="border-bottom: 1px solid #FFF;">
', !empty($issue['category']['link']) ? '[' . $issue['category']['link'] . '] ' : '', $issue['link'], ' ';

if ($issue['new'] && $context['user']['is_logged'])
echo '
<a href="', $issue['new_href'], '"><img src="', $settings['lang_images_url'], '/new.gif" alt="', $txt['new'], '" /></a>';

echo '
<br /><span class="smalltext">', !empty($issue['version']['link']) ? '[' . $issue['version']['link'] . '] ' : '', $txt['issue_status_' . $issue['status']['name']], $issue['is_assigned'] ? ' (' . $issue['assigned']['link'] . ')' : '', '</span>
</td>
</tr>';
}
}
echo '
</table>';
Title: Re: Project Tools Block
Post by: Alpay on December 06, 2012, 10:44:07 AM
Hi guys ;

I need your help a subject

Code: [Select]
<a href="', $issue['new_href'], '"><span><img src="', $settings['images_url'], '/', $issue['tracker']['image'], '" alt="', $issue['tracker']['name'], '" />[ ', $issue['category']['name'], ' ] - [ ', $issue['version']['name'], ' ] -', $issue['name'], '';echo'</span></a>
[ ScTr ] - [ ] -Footer

 ', $issue['version']['name'], '
 ', $issue['version']['link'], '


The version number does not seem to result ?

Sample :
[ ScTr ] - [ 2.1.9 ] -Footer
Title: Re: Project Tools Block
Post by: ѕησω on August 19, 2013, 10:32:16 AM
I've checked back after all these years... It works great!

However there's one issue, the number of issues listed is multiplied by the number of projects. Having two projects listed with 5 issues makes a total of 10 that show, 3 p x 5 i = 15, etc.

Anybody know a quick fix for this?
Title: Re: Project Tools Block
Post by: [SiNaN] on August 19, 2013, 10:49:05 AM
Which code are you using? You can use the code I pasted in the third post changing the $project variable to 0 make it list issues from all projects.
Title: Re: Project Tools Block
Post by: ѕησω on August 19, 2013, 11:36:04 AM
Winnah, Was using Grafitus last post.

Thank's Sinan!
Title: Re: Project Tools Block
Post by: [SiNaN] on August 19, 2013, 01:08:05 PM
You're welcome! ;)
SimplePortal 2.3.8 © 2008-2024, SimplePortal