Skip to content

Commit

Permalink
Allows custom email address to be specified instead of {username}@rhi…
Browse files Browse the repository at this point in the history
…nosupport.com, and the ticketUrl() method is now public since it's a useful method for making custom support elements and views.
  • Loading branch information
bmcclure committed Sep 26, 2011
1 parent 3e5c244 commit c251390
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions View/Helper/RhinoSupportHelper.php
Expand Up @@ -18,8 +18,19 @@ class RhinoSupportHelper extends AppHelper {
'black' => 7,
);

public function mailLink($text = 'Support', $options = array()) {
return $this->Html->link($text, 'mailto:'.$username.'@rhinosupport.com', $options);
public function mailLink($text = null, $options = array()) {
if (isset($options['address'])) {
$address = $options['address'];
unset($options['address']);
} else {
$address = $this->username.'@rhinosupport.com';
}

if ($text = null) {
$text = $address;
}

return $this->Html->link($text, 'mailto:'.$address, $options);
}

public function link($text = 'Contact Us', $options = array()) {
Expand All @@ -30,7 +41,7 @@ public function link($text = 'Contact Us', $options = array()) {
'target' => '_blank',
);

return $this->Html->link($text, $this->_ticketUrl(), array_merge($linkOptions, $options));
return $this->Html->link($text, $this->ticketUrl(), array_merge($linkOptions, $options));
}

public function scroller($type = 'feedback', $color = 'blue') {
Expand All @@ -40,7 +51,7 @@ public function scroller($type = 'feedback', $color = 'blue') {

$image = $this->Html->image($imageUrl, array('border' => 0, 'alt' => ''));

$link = $this->Html->link($image, $this->_ticketUrl(), array('target' => '_blank', 'onclick' => $onClick));
$link = $this->Html->link($image, $this->ticketUrl(), array('target' => '_blank', 'onclick' => $onClick));

$output = $this->Html->div(null, $link, array('style' => array(
'display' => 'scroll',
Expand All @@ -58,13 +69,13 @@ public function iframe($options = array()) {
'height' => 600,
'frameborder' => 0,
'scrolling' => 'no',
'src' => $this->_ticketUrl(array('frames' => 'true')),
'src' => $this->ticketUrl(array('frames' => 'true')),
);

return $this->Html->tag('iframe', null, array_merge($iframeOptions, $options));
}

protected function _ticketUrl($params = array()) {
public function ticketUrl($params = array()) {
return 'https://'.$this->username.'.rhinosupport.com/create-ticket.php'.$this->_buildQueryParams($params);
}

Expand Down

0 comments on commit c251390

Please sign in to comment.