Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/app/code/community/Zendesk/Zendesk/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public function getUrl($object = '', $id = null, $format = 'old')
{
$protocol = 'https://';
$domain = Mage::getStoreConfig('zendesk/general/domain');
$root = ($format === 'old') ? '' : '/agent/#';
$root = ($format === 'old') ? '' : '/agent';

$base = $protocol . $domain . $root;
$hc = $protocol . $domain . '/hc';

switch($object) {
case '':
Expand All @@ -42,6 +43,10 @@ public function getUrl($object = '', $id = null, $format = 'old')
case 'raw':
return $protocol . $domain . '/' . $id;
break;

case 'request':
return $hc . '/requests/' . $id;
break;
}
}

Expand Down Expand Up @@ -292,6 +297,19 @@ public function getTicketUrl($row, $link = false)
return '<a href="' . $url . '" target="_blank">' . Mage::helper('core')->escapeHtml($subject) . '</a>';
}

public function getRequestUrl($row, $link = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@buheryfi This function looks a lot like getTicketUrl() , is there any way you can change it so that there wouldn't be too much repetition?
Thanks for this!

{
$path = Mage::getSingleton('admin/session')->getUser() ? 'adminhtml/zendesk/login' : '*/sso/login';
$url = Mage::helper('adminhtml')->getUrl($path, array("return_url" => Mage::helper('core')->urlEncode(Mage::helper('zendesk')->getUrl('request', $row['id']))));

if ($link)
return $url;

$subject = $row['subject'] ? $row['subject'] : $this->__('No Subject');

return '<a href="' . $url . '" target="_blank">' . Mage::helper('core')->escapeHtml($subject) . '</a>';
}

public function getStatusMap()
{
return array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<?php foreach($tickets as $ticket): ?>
<?php $t = Mage::getModel('zendesk/api_tickets')->get($ticket['id'], true); ?>
<tr class="border">
<td><?php echo Mage::helper('zendesk')->getTicketUrl($ticket); ?></td>
<td><?php echo Mage::helper('zendesk')->getRequestUrl($ticket); ?></td>
<td><?php echo Mage::helper('core')->formatDate($ticket['created_at'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></td>
<td><?php echo Mage::helper('core')->formatDate($ticket['updated_at'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true); ?></td>
<td><?php echo ucwords($ticket['status']); ?></td>
Expand Down