25
hesk/theme/hesk3/customer/util/alerts.php
Normal file
25
hesk/theme/hesk3/customer/util/alerts.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// This guard is used to ensure that users can't hit this outside of actual HESK code
|
||||
if (!defined('IN_SCRIPT')) {
|
||||
die();
|
||||
}
|
||||
|
||||
function hesk3_show_messages($messages) {
|
||||
$style_to_class = array(
|
||||
'0' => 'white',
|
||||
'1' => 'green',
|
||||
'2' => 'blue', // Info has no CSS class
|
||||
'3' => 'orange',
|
||||
'4' => 'red'
|
||||
);
|
||||
foreach ($messages as $message):
|
||||
?>
|
||||
<div class="main__content notice-flash">
|
||||
<div class="notification <?php echo $style_to_class[$message['style']]; ?>">
|
||||
<p><b><?php echo $message['title']; ?></b></p>
|
||||
<?php echo $message['message']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
183
hesk/theme/hesk3/customer/util/custom-fields.php
Normal file
183
hesk/theme/hesk3/customer/util/custom-fields.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
// This guard is used to ensure that users can't hit this outside of actual HESK code
|
||||
if (!defined('IN_SCRIPT')) {
|
||||
die();
|
||||
}
|
||||
|
||||
function hesk3_output_custom_fields($customFields) {
|
||||
global $hesk_settings, $hesklang;
|
||||
|
||||
foreach ($customFields as $customField) {
|
||||
switch ($customField['type']) {
|
||||
case 'radio':
|
||||
?>
|
||||
<div class="form-group <?php echo $customField['iserror'] ? 'isError' : '' ?>">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
|
||||
<?php echo $customField['title']; ?>
|
||||
</label>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($customField['value']['options'] as $option):
|
||||
?>
|
||||
<div class="radio-custom">
|
||||
<input type="radio" name="<?php echo $customField['name'] ?>"
|
||||
id="<?php echo $customField['name'].$i; ?>"
|
||||
value="<?php echo $option['value']; ?>"
|
||||
<?php echo $option['selected'] ? 'checked' : ''; ?>>
|
||||
<label for="<?php echo $customField['name'].$i; ?>">
|
||||
<?php echo $option['value']; ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'select':
|
||||
?>
|
||||
<section class="param blue-select">
|
||||
<span class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['title']; ?></span>
|
||||
<div class="dropdown-select center out-close">
|
||||
<select name="<?php echo $customField['name']; ?>">
|
||||
<?php if (!empty($customField['value']['show_select'])): ?>
|
||||
<option value=""><?php echo $hesklang['select']; ?></option>
|
||||
<?php
|
||||
endif;
|
||||
$i = 0;
|
||||
foreach ($customField['value']['options'] as $option):
|
||||
?>
|
||||
<option value="<?php echo hesk_htmlentities($option['value']); ?>" <?php echo $option['selected'] ? 'selected' : '' ?>><?php echo $option['value']; ?></option>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
break;
|
||||
case 'checkbox':
|
||||
?>
|
||||
<section class="param checkboxs">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['title']; ?></label>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($customField['value']['options'] as $option):
|
||||
?>
|
||||
<div class="checkbox-custom">
|
||||
<input type="checkbox" id="<?php echo $customField['name'].$i; ?>"
|
||||
name="<?php echo $customField['name']; ?>[]" value="<?php echo $option['value']; ?>"
|
||||
<?php if ($customField['iserror']): ?>class="isError"<?php endif; ?>
|
||||
<?php echo $option['selected'] ? 'checked' : ''; ?>>
|
||||
<label for="<?php echo $customField['name'].$i; ?>"><?php echo $option['value']; ?></label>
|
||||
</div>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach;
|
||||
?>
|
||||
</section>
|
||||
<?php
|
||||
break;
|
||||
case 'textarea':
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['title']; ?></label>
|
||||
<textarea name="<?php echo $customField['name']; ?>"
|
||||
rows="<?php echo intval($customField['value']['rows']); ?>"
|
||||
cols="<?php echo intval($customField['value']['cols']); ?>"
|
||||
class="form-control <?php if ($customField['iserror']): ?><?php endif; ?>"
|
||||
<?php echo $customField['req'] ? 'required' : '' ?>><?php echo $customField['original_value']; ?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'date':
|
||||
?>
|
||||
<section class="param calendar">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>"><?php echo $customField['title']; ?></label>
|
||||
<div class="calendar--button">
|
||||
<button type="button">
|
||||
<svg class="icon icon-calendar">
|
||||
<use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-calendar"></use>
|
||||
</svg>
|
||||
</button>
|
||||
<input name="<?php echo $customField['name']; ?>"
|
||||
value="<?php echo $customField['original_value']; ?>"
|
||||
type="text"
|
||||
class="datepicker">
|
||||
</div>
|
||||
<div class="calendar--value" <?php if ($customField['original_value']) { ?>style="display: block"<?php } ?>>
|
||||
<span><?php echo $customField['original_value']; ?></span>
|
||||
<i class="close">
|
||||
<svg class="icon icon-close">
|
||||
<use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-close"></use>
|
||||
</svg>
|
||||
</i>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
break;
|
||||
case 'email':
|
||||
$suggest = $hesk_settings['detect_typos'] ?
|
||||
'onblur="HESK_FUNCTIONS.suggestEmail(\''.$customField['name'].'\', \''.$customField['name'].'_suggestions\', 0'.($customField['value']['multiple'] ? ',1' : '').')"' :
|
||||
'';
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
|
||||
<?php echo $customField['title']; ?>
|
||||
</label>
|
||||
<input type="email"
|
||||
id="<?php echo $customField['name']; ?>"
|
||||
class="form-control"
|
||||
value="<?php echo $customField['original_value']; ?>"
|
||||
name="<?php echo $customField['name']; ?>"
|
||||
<?php echo $customField['req'] ? 'required' : '' ?>
|
||||
<?php echo $suggest; ?>>
|
||||
<div id="<?php echo $customField['name']; ?>_suggestions"></div>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'hidden':
|
||||
?>
|
||||
<input type="hidden"
|
||||
name="<?php echo $customField['name']; ?>"
|
||||
value="<?php echo $customField['value']['default_value']; ?>">
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label class="label <?php echo $customField['req'] ? 'required' : '' ?>">
|
||||
<?php echo $customField['title']; ?>
|
||||
</label>
|
||||
<input type="text" class="form-control <?php if ($customField['iserror']) { ?>isError<?php } ?>"
|
||||
value="<?php echo $customField['value']['default_value']; ?>"
|
||||
name="<?php echo $customField['name']; ?>"
|
||||
<?php echo $customField['req'] ? 'required' : '' ?>>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hesk3_output_custom_fields_for_display($customFields) {
|
||||
foreach ($customFields as $customField)
|
||||
{
|
||||
switch ($customField['type'])
|
||||
{
|
||||
case 'email':
|
||||
$customField['value'] = '<a href="mailto:'.$customField['value'].'">'.$customField['value'].'</a>';
|
||||
break;
|
||||
case 'date':
|
||||
$customField['value'] = hesk_custom_date_display_format($customField['value'], $customField['date_format']);
|
||||
break;
|
||||
}
|
||||
|
||||
echo '
|
||||
<div>
|
||||
<span style="color: #959eb0">'.$customField['name:'].'</span>
|
||||
<span>'.$customField['value'].'</span>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
}
|
||||
91
hesk/theme/hesk3/customer/util/kb-search.php
Normal file
91
hesk/theme/hesk3/customer/util/kb-search.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
// This guard is used to ensure that users can't hit this outside of actual HESK code
|
||||
if (!defined('IN_SCRIPT')) {
|
||||
die();
|
||||
}
|
||||
|
||||
function displayKbSearch() {
|
||||
global $hesk_settings, $hesklang;
|
||||
|
||||
if ($hesk_settings['kb_search'] && $hesk_settings['kb_enable']): ?>
|
||||
<form action="knowledgebase.php" method="get" style="display: inline; margin: 0;" name="searchform">
|
||||
<div class="search__form">
|
||||
<div class="form-group">
|
||||
<button class="btn search__submit">
|
||||
<svg class="icon icon-search">
|
||||
<use xlink:href="<?php echo TEMPLATE_PATH; ?>customer/img/sprite.svg#icon-search"></use>
|
||||
</svg>
|
||||
</button>
|
||||
<input id="kb_search" name="search" class="form-control" type="text" placeholder="<?php echo $hesklang['search_for_articles']; ?>">
|
||||
<?php if ($hesk_settings['kb_search'] === 1): ?>
|
||||
<button id="search-button" type="submit" class="btn btn-full"><?php echo $hesklang['search']; ?></button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="kb-suggestions" style="margin: 0 auto; width: 100%; max-width: 752px; display: none">
|
||||
<div class="alert none">
|
||||
<div class="alert__inner">
|
||||
<div class="alert__head">
|
||||
<h6 class="alert__title"><?php echo $hesklang['sc']; ?>:</h6>
|
||||
</div>
|
||||
<ul id="kb-suggestion-list" class="type--list">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
function outputSearchStyling() {
|
||||
global $hesk_settings;
|
||||
|
||||
if (!$hesk_settings['kb_search'] || !$hesk_settings['kb_enable']) return;
|
||||
|
||||
if ($hesk_settings['kb_search'] === 1): ?>
|
||||
#kb_search {
|
||||
width: 70%;
|
||||
}
|
||||
#search-button {
|
||||
width: 30%;
|
||||
margin-left: 10px;
|
||||
height: inherit;
|
||||
}
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
function outputSearchJavascript() {
|
||||
global $hesk_settings, $hesklang;
|
||||
|
||||
if (!$hesk_settings['kb_search'] || !$hesk_settings['kb_enable']) return;
|
||||
|
||||
?>
|
||||
<script>
|
||||
var noArticlesFoundText = <?php echo json_encode($hesklang['nsfo']); ?>;
|
||||
|
||||
$(document).ready(function() {
|
||||
HESK_FUNCTIONS.getKbSearchSuggestions($('#kb_search'), function(data) {
|
||||
$('.kb-suggestions').show();
|
||||
var $suggestionList = $('#kb-suggestion-list');
|
||||
$suggestionList.html('');
|
||||
var format = '<li style="margin-bottom: 5px">' +
|
||||
'<a class="link" href="knowledgebase.php?article={0}">{1}</a>' +
|
||||
'<br>' +
|
||||
'{2}' +
|
||||
'</li>';
|
||||
var results = false;
|
||||
$.each(data, function() {
|
||||
results = true;
|
||||
$('#kb-suggestion-list').append(format.replace('{0}', this.id).replace('{1}', this.subject).replace('{2}', this.contentPreview));
|
||||
});
|
||||
|
||||
if (!results) {
|
||||
$suggestionList.append('<li>' + noArticlesFoundText + '</li>');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
21
hesk/theme/hesk3/customer/util/rating.php
Normal file
21
hesk/theme/hesk3/customer/util/rating.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// This guard is used to ensure that users can't hit this outside of actual HESK code
|
||||
if (!defined('IN_SCRIPT')) {
|
||||
die();
|
||||
}
|
||||
|
||||
function hesk3_get_customer_rating($num) {
|
||||
$rounded_num = intval(hesk_round_to_half($num) * 10);
|
||||
|
||||
return '
|
||||
<div class="star-rate rate-'. $rounded_num .'">
|
||||
<svg class="icon icon-star-stroke">
|
||||
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-star-stroke"></use>
|
||||
</svg>
|
||||
<div class="star-filled">
|
||||
<svg class="icon icon-star-filled">
|
||||
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-star-filled"></use>
|
||||
</svg>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
Reference in New Issue
Block a user