dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse

This website has run out of funding so feel free to contribute if you can afford it (see footer)

Author Topic: SimplePortal SimpleDesk Interface [Custom php Block]  (Read 2722 times)

Offline Chip (OP)

  • Server Admin
  • Hero Member
  • *****
  • Administrator
  • *****
  • Join Date: Dec 2014
  • Location: Australia
  • Posts: 6648
  • Reputation Power: 0
  • Chip has hidden their reputation power
  • Gender: Male
  • Last Login:Yesterday at 05:53:23 PM
  • Deeply Confused Learner
  • Profession: IT Engineer
SimplePortal SimpleDesk Interface [Custom php Block]
« on: August 23, 2016, 05:39:30 PM »
http://simpleportal.net/index.php?topic=14166.0

Code: [Select]
<?php

/**
 * @block SimpleDesk
 * @author Rhode Fey (Sayaka Maizono)
 * @version 1.0.0
 * @for SimpleDesk 2.0.0
*/

global $context$modSettings$txt$sourcedir;

$txt['shd_not_installed'] = 'Simple Desk is not currently installed!';

if (!
file_exists($sourcedir '/sd_source/SimpleDesk.php'))
{
echo '
<span class="smalltext" style="color: red;">
$txt['shd_not_installed']  . '
</span>'
;

return;
}

if (empty(
$modSettings['helpdesk_active']) || !empty($modSettings['shd_maintenance_mode']))
{
echo '
<span class="smalltext" style="color: red;">
$txt['shd_inactive'] . '
</span>'
;

return;
}

require_once(
$sourcedir '/sd_source/Subs-SimpleDesk.php');
require_once(
$sourcedir '/sd_source/SimpleDesk-SSI.php');

$is_staff false;
$staff_members shd_members_allowed_to('shd_staff');

if (
in_array($context['user']['id'], $staff_members))
$is_staff true;

if (
$is_staff)
show_tickets();
else
show_own_tickets();

function 
show_tickets()
{
global $context$scripturl$settings$txt;

$number_to_show 5;

$assigned_tickets ssi_staffAssignedTickets($context['user']['id'], $number_to_show'array');
$remaining_tickets ssi_getSDTickets('hdt.id_member_assigned != {int:assigned} AND hdt.status != {int:closed}', array('assigned' => $context['user']['id'], 'closed' => 6), $number_to_show'hdt.status ASC''array');

$tickets array_merge($assigned_tickets$remaining_tickets);
$tickets array_slice($tickets0$number_to_show);

ksort($tickets);
$ticket_count count($tickets);
$count 0;

if (empty($tickets))
{
echo '
<span class="smalltext" style="color: red;">
$txt['shd_error_no_tickets'] . '
</span>'
;

return;
}

echo '
<table class="sp_fullwidth">'
;

foreach ($tickets as $ticket)
{
if ($ticket['assigned']['id'] == $context['user']['id'])
{
$assigned true;
$icon '<img src="' $settings['default_images_url'] . '/simpledesk/assign.png" alt="Assigned to ' $context['user']['name'] . '" />';
}
else
{
$assigned false;
$icon '<img src="' $settings['default_images_url'] . '/simpledesk/unread.png" alt="Ticket" />';
}

echo '
<tr>
<td style="width: 24px; text-align: center;"><a href="' 
$ticket['href'] . '">' $icon '</a></td>
<td style="padding: 5px 0; vertical-align: bottom; '
$ticket_count != ++$count ' border-bottom: 1px dashed #AAA;' '''">';

echo '
<a href="' 
$scripturl '?action=helpdesk;sa=ticket;ticket=' $ticket['id'] . '">' $ticket['subject'] . '</a><br />';

echo '
<div style="padding-top: 3px; font-size: 9px">'
;

echo '
$txt['shd_ticket_status'] . ': ' $ticket['status_text'] . '<br />';

echo '
$txt['shd_ticket_urgency'] . ': ' $ticket['urgency_string'] . '<br />';

echo '
$txt['shd_ticket_started_by'] . ': ' $ticket['opener']['link'] . '<br />';

echo '
$ticket['start_time'] . '<br />';

echo '
</div>'
;

echo '
</td>
</tr>'
;
}

echo '
</table>'
;
}

function 
show_own_tickets()
{
global $context$scripturl$settings$txt;

$number_to_show 3;

$tickets ssi_userTickets($context['user']['id'], $number_to_show'array');

ksort($tickets);
$ticket_count count($tickets);
$count 0;

if (empty($tickets))
{
echo '
<span class="smalltext" style="color: red;">
$txt['shd_error_no_tickets'] . '
</span>'
;

return;
}

echo '
<table class="sp_fullwidth">'
;

foreach ($tickets as $ticket)
{
$icon '<img src="' $settings['default_images_url'] . '/simpledesk/unread.png" alt="Ticket" />';

echo '
<tr>
<td style="width: 24px; text-align: center;"><a href="' 
$ticket['href'] . '">' $icon '</a></td>
<td style="padding: 5px 0; vertical-align: bottom; '
$ticket_count != ++$count ' border-bottom: 1px dashed #AAA;' '''">';

echo '
<a href="' 
$scripturl '?action=helpdesk;sa=ticket;ticket=' $ticket['id'] . '">' $ticket['subject'] . '</a><br />';

echo '
<div style="padding-top: 3px; font-size: 9px">'
;

echo '
$txt['shd_ticket_status'] . ': ' $ticket['status_text'] . '<br />';

echo '
$ticket['start_time'] . '<br />';

echo '
</div>'
;

echo '
</td>
</tr>'
;
}

echo '
</table>'
;
}

?>
« Last Edit: August 26, 2016, 12:39:10 AM by chipper »
friendly
0
funny
0
informative
0
agree
0
disagree
0
like
0
dislike
0
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
No reactions
Our Discord Server invitation link is https://discord.gg/jB2qmRrxyD

Tags:
 


dopetalk does not endorse any advertised product nor does it accept any liability for it's use or misuse





TERMS AND CONDITIONS

In no event will d&u or any person involved in creating, producing, or distributing site information be liable for any direct, indirect, incidental, punitive, special or consequential damages arising out of the use of or inability to use d&u. You agree to indemnify and hold harmless d&u, its domain founders, sponsors, maintainers, server administrators, volunteers and contributors from and against all liability, claims, damages, costs and expenses, including legal fees, that arise directly or indirectly from the use of any part of the d&u site.


TO USE THIS WEBSITE YOU MUST AGREE TO THE TERMS AND CONDITIONS ABOVE


Founded December 2014
SimplePortal 2.3.6 © 2008-2014, SimplePortal