Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/View.tar

Article/Html.php000064400000004363151165450300007552 0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Article;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSL\Utils\Database as DatabaseUtils;
use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property \OSSolution\HelpdeskPro\Site\Model\Article $model
 */
class Html extends HtmlView
{
	protected function beforeRender()
	{
		$this->item = $this->model->getData();

		if (empty($this->item->id))
		{
			throw new \Exception(Text::_('HDP_ARTICLE_NOT_FOUND'), 404);
		}

		$config = HelpdeskproHelper::getConfig();

		// Update hits
		$this->model->hits();

		if ($config->highlight_code)
		{
			HelpdeskproHelper::loadHighlighter();
		}

		// Pathway
		$pathway = $this->container->app->getPathway();

		// Get category title
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$db    = $this->model->getDbo();
		$query = $db->getQuery(true);
		$query->select('title')
			->from('#__helpdeskpro_categories')
			->where('id = ' . $this->item->category_id);

		if ($fieldSuffix)
		{
			DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
		}
		$db->setQuery($query);
		$categoryTitle = $db->loadResult();
		$pathway->addItem($categoryTitle,
Route::_('index.php?option=com_helpdeskpro&view=articles&filter_category_id='
. $this->item->category_id . '&Itemid=' .
$this->Itemid));
		$pathway->addItem($this->item->title);

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories', 'articles', 'article'));

		if (!$params->get('page_title'))
		{
			$params->set('page_title', $this->item->title);
		}

		HelpdeskproHelperHtml::prepareDocument($params, $this->item);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}Article/tmpl/default.php000064400000001072151165450300011240
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

// no direct access

defined( '_JEXEC' ) or die ;
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
$this->item->title; ?></h1>
	<div class="hdp-article-detail <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
		<?php echo $this->item->text; ?>
	</div>
</div>Articles/Html.php000064400000004220151165450310007726
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Articles;

use HelpdeskProHelperBootstrap;
use OSL\Utils\Database as DatabaseUtils;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Html extends ListView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		// Add articles to route
		RouteHelper::addArticles($this->items);

		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$rows = HelpdeskproHelperDatabase::getAllCategories('title',
array(), $fieldSuffix, 2);

		$this->lists['id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->state->id,
'id', 'class="input-large form-select"
onchange="submit();"', $rows);

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories', 'articles'));

		$category = null;

		if ($this->state->filter_category_id)
		{
			$db    = $this->model->getDbo();
			$query = $db->getQuery(true);
			$query->select('title')
				->from('#__helpdeskpro_categories')
				->where('id = ' .
$this->state->filter_category_id);

			if ($fieldSuffix)
			{
				DatabaseUtils::getMultilingualFields($query, array('title'),
$fieldSuffix);
			}

			$db->setQuery($query);
			$categoryTitle = $db->loadResult();

			if (!$params->get('page_title') && $categoryTitle)
			{
				$params->set('page_title', $categoryTitle);
			}

			// Pathway
			$pathway = $this->container->app->getPathway();
			$pathway->addItem($categoryTitle);
		}

		HelpdeskproHelperHtml::prepareDocument($params);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}Articles/tmpl/default.php000064400000004265151165450310011433
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

$ordering = $this->state->filter_order == 'tbl.ordering';

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
Text::_('HDP_ARTICLES'); ?></h1>
	<form action="<?php echo
htmlspecialchars(Uri::getInstance()->toString()); ?>"
method="post" name="adminForm" id="adminForm"
class="form-inline">
		<fieldset class="filters btn-toolbar <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
			<div class="btn-group">
				<input type="text" name="filter_search"
id="filter_search" value="<?php echo
$this->escape($this->state->filter_search); ?>"
class="search-query input-xlarge"
onchange="document.adminForm.submit();"
placeholder="<?php echo
Text::_('HDP_ARTICLES_SEARCH_PLACEHOLDER'); ?>" />
			</div>
			<div class="btn-group pull-right">
				<?php echo $this->lists['id']; ?>
			</div>
		</fieldset>
	</form>
	<table class="table table-striped table-bordered
table-condensed">
		<thead>
			<tr>
				<th>
					<?php echo Text::_('HDP_TITLE'); ?>
				</th>
				<th>
					<?php echo Text::_('HDP_HITS'); ?>
				</th>
			</tr>
		</thead>
		<tbody>
		<?php
			foreach($this->items as $item)
			{
			?>
				<tr>
					<td>
						<a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&view=article&id='.$item->id.'&Itemid='.$this->Itemid);
?>"><?php echo $item->title;?></a>
					</td>
					<td>
						<spsn class="badge badge-info"><?php echo
$item->hits; ?></spsn>
					</td>
				</tr>
			<?php
			}
		?>
		</tbody>
		<?php
		if ($this->pagination->total > $this->pagination->limit)
		{
		?>
			<tfoot>
				<tr>
					<td colspan="2"><?php echo
$this->pagination->getPagesLinks();?></td>
				</tr>
			</tfoot>
		<?php
		}
		?>
	</table>
</div>Categories/Html.php000064400000001770151165450310010254
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Categories;

use HelpdeskProHelperBootstrap;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

class Html extends ListView
{
	protected function beforeRender()
	{
		parent::beforeRender();

		foreach ($this->items as $item)
		{
			RouteHelper::addArticles($item->articles);
		}

		// Handle page title
		$active = $this->container->app->getMenu()->getActive();
		$params = HelpdeskproHelperHtml::getViewParams($active,
array('categories'));
		HelpdeskproHelperHtml::prepareDocument($params);

		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}Categories/tmpl/default.php000064400000004357151165450310011754
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

$params = Factory::getApplication()->getParams();
$numberColumns = $params->get('number_columns', 2);
$spanClass          = 'span' . intval(12 / $numberColumns);
?>
<div id="hdp_container" class="container-fluid">
	<h1 class="hdp_title"><?php echo
Text::_('HDP_ARTICLE_CATEGORIES'); ?></h1>
	<div class="hdp-categories-list clearfix">
		<div class="row-fluid">
			<?php
			$i = 0;
			$numberCategories = count($this->items);
			foreach ($this->items as $item)
			{
				$i++;
				$link = Route::_(RouteHelper::getArticlesRoute($item->id,
$this->Itemid, Factory::getLanguage()->getTag()));
			?>
				<div class="hpd-category-wrapper <?php echo $spanClass;
?>">
					<h3>
						<i class="icon-folder-open"></i><a
title="<?php echo
Text::sprintf('HDP_VIEW_ALL_ARTICLES_IN_CATEGORY',
$item->title);?>" href="<?php echo $link;
?>"><?php echo $item->title; ?></a><span
class="hdp-articles-count badge badge-info"><?php echo
$item->total_articles; ?></span>
					</h3>
					<?php 
						if ($item->description)
						{
						?>
							<div class="hdp-category-description
clearfix"><?php echo $item->description; ?></div>
						<?php			
						}
					?>
					<ul class="hp-category-posts">
						<?php
							foreach($item->articles as $article)
							{
							?>
								<li class="format-standard">
									<i class="icon-list-alt"></i><a
title="<?php echo $article->title; ?>"
href="<?php echo
Route::_(RouteHelper::getArticleRoute($article->id,
$article->category_id, $this->Itemid,
JFactory::getLanguage()->getTag()));?>"><?php echo
$article->title; ?></a>
								</li>
							<?php
							}
						?>
					</ul>
				</div>
				<?php
				if ($i % $numberColumns == 0 && $i < $numberCategories)
				{
				?>
					</div>
					<div class="clearfix row-fluid">
				<?php
				}
			}
			?>
		</div>
	</div>
</div>common/tmpl/ticket_add_comment.php000064400000005263151165450310013345
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;

if (!$canComment)
{
    return;
}

if ($captchaInvalid)
{
    $style = '';
}
else
{
    $style = ' style="display:none;"';
}

if ($config->enable_attachment)
{
	echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_upload_attachments.php');
}

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = HelpdeskProHelperBootstrap::getInstance();
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<tr id="tr_message_id" <?php echo $style; ?>>
    <td>
        <?php
        if ($config->use_html_editor)
        {
            echo $editor->display( 'message',  $message,
'100%', '250', '75', '10' );
        }
        else
        {
        ?>
            <textarea rows="10" class="hdp_fullwidth
form-control" cols="75" class="hdp_fullwidth"
name="message" id="message"><?php echo $message;
?></textarea>
        <?php
        }
        if ($config->enable_attachment)
        {
        ?>
            <div class="clearfix"></div>
            <table width="100%">
                <tr>
                    <th><?php echo
Text::_('HDP_ATTACHMENTS'); ?></th>
                </tr>
                <tr>
                    <td>
                        <div id="hdp_ticket_attachments"
class="dropzone needsclick dz-clickable">

                        </div>
                    </td>
                </tr>
            </table>
            <?php
        }
        if ($config->enable_captcha && !empty($captcha))
        {
        ?>
            <table>
                <tr>
                    <td class="title_cell">
                        <?php echo Text::_('HDP_CAPTCHA');
?><span class="required">*</span>
                    </td>
                    <td>
                        <?php echo $captcha; ?>
                    </td>
                </tr>
            </table>
            <?php
        }
        ?>
        <div class="clearfix"></div>
        <input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_SUBMIT_COMMENT');
?>" onclick="addComment(this.form);" />
        <input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_COMMENT_AND_CLOSE');
?>" onclick="addCommentAndClose(this.form);" />
    </td>
</tr>
common/tmpl/ticket_comments.php000064400000014676151165450310012730
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

defined('_JEXEC') or die;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
$iconEdit        =
$bootstrapHelper->getClassMapping('icon-edit');
$iconTrash       =
$bootstrapHelper->getClassMapping('icon-trash');
$btn             = $bootstrapHelper->getClassMapping('btn');
$btnSmall        =
$bootstrapHelper->getClassMapping('btn-small');

if (count($messages))
{
	$imageFileTypes = array('gif', 'jpg',
'jpeg', 'png', 'csv', 'bmp',
'txt');
	$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';
?>
	<tr>
		<td>
			<div class="hdp_ticket_comments">
				<ul>
					<?php
					foreach($messages as $message)
					{
					?>
						<li id="mesage-<?php echo $message->id;
?>">
							<table class="admintable <?php echo
$bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-condensed">
								<tr>
									<td class="hdp_ticket_icon_user">
										<div class="hdp_ticket-images">
											<?php
											$avatarUrl = $rootUri .
'/media/com_helpdeskpro/assets/images/icons/icon-user.jpeg';

											if ($message->user_id)
											{
												$avatar =
HelpdeskproHelper::getUserAvatar($message->user_id);
												if ($avatar)
												{
													$avatarUrl = $rootUri . '/' . $avatar;
												}
											}
											?>
											<img width="60" height="60"
src="<?php echo $avatarUrl; ?>" title="<?php echo
$message->name; ?>">
										</div>
									</td>
									<td class="hdp_ticket_comments">
										<div class="hdp_ticket_comments_body">
											<div class="hdp_ticket_arrow"></div>
											<div class="hdp_ticket_commenter-name">
													<span class="hdp_ticket_name">
														<?php
														if ($message->user_id)
														{
															echo $message->name;
														}
														else
														{
															echo $item->name;
														}
														?>
                                                        - <a
href="#<?php echo $message->id; ?>">[#<?php echo
$message->id; ?>]</a>
													</span>
													<span class="hdp_ticket_date_time">
														<?php
														if ($message->user_id)
														{
															echo HTMLHelper::_('date',
$message->date_added, $config->date_format);
														}
														else
														{
															echo  HTMLHelper::_('date',
$message->date_added, $config->date_format);
														}
														if (HelpdeskproHelper::canUpdateComment($user,
$message->id))
														{
														?>
															<button type="button" class="<?php echo
$btn . ' ' . $btnSmall; ?>  edit_comment"
id="<?php echo $message->id; ?>" title="<?php
echo Text::_('HDP_EDIT_THIS_COMMENT'); ?>"><i
class="<?php echo $iconEdit;
?>"></i></button>
														<?php
														}

														if (HelpdeskproHelper::canDeleteComment($user,
$message->id))
														{
														?>
															<button type="button" class="<?php echo
$btn . ' ' . $btnSmall; ?> remove_comment"
id="<?php echo $message->id; ?>" title="<?php
echo Text::_('HDP_DELETE_THIS_COMMENT'); ?>"><i
class="<?php echo $iconTrash;
?>"></i></button>
														<?php
														}
														?>
													</span>
											</div>
											<div class="hdp_ticket_comment-text">
												<div data-title="Enter Your Comment"
class="hd-edit-table" id="hdp_ticket_edit-text-<?php echo
$message->id; ?>">
													<?php
													if ($config->process_bb_code)
													{
														echo HelpdeskproHelper::processBBCode($message->message);
													}
													else
													{
														if ($config->use_html_editor)
														{
															echo $message->message;
														}
														else
														{
															echo nl2br($message->message);
														}
													}
													?>
												</div>
												<?php
												if ($message->attachments)
												{
													$originalFileNames = explode('|',
$message->original_filenames);
													$attachments = explode('|',
$message->attachments);;
													?>
														<div class="hdp_ticket_comment-file">
															<ul>
																<?php
																	$i = 0 ;
																	foreach($originalFileNames as $fileName)
																	{
																		$actualFileName = $attachments[$i++];
																		if (!file_exists($attachmentsPath . '/' .
$actualFileName))
																		{
																			continue;
																		}

																		$icon = substr($fileName, strrpos($fileName,
'.') + 1);
																		$icon = strtolower($icon);
																		if (!file_exists(JPATH_SITE .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"))
																		{
																			$icon = "default";
																		}
																		if (in_array($icon, $imageFileTypes))
																		{
																		?>
																			<li><a class="hdp-modal"
href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"
?>" ><?php echo $fileName ?></a></li>
																		<?php
																		}
																		else
																		{
																		?>
																			<li><a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png"
?>" ><?php echo $fileName ?></a></li>
																		<?php
																		}
																	}
																?>
															</ul>
														</div>
													<?php
												}
												?>
											</div>
										</div>
									</td>
								</tr>
							</table>
						</li>
					<?php
					}
					?>
				</ul>
			</div>
		</td>
	</tr>
	<?php
}common/tmpl/ticket_customer_info.php000064400000006641151165450310013750
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

defined('_JEXEC') or die;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = HelpdeskProHelperBootstrap::getInstance();
$config              = HelpdeskproHelper::getConfig();
?>
<table class="admintable <?php echo
$bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-condensed">
	<tr>
		<th colspan="2"><?php echo
Text::_('HPD_TICKET_DETAIL'); ?></th>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_ID'); ?>
		</td>
		<td>
			<?php echo $item->id; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_CATEGORY'); ?>
		</td>
		<td>
			<?php echo $item->category_title ; ?>
		</td>
	</tr>
	<?php
	if ($item->user_id > 0)
	{
	?>
		<tr>
			<td>
				<?php echo Text::_('HDP_USER'); ?>
			</td>
			<td>
				<?php echo $item->username; ?>[<?php echo
$item->user_id; ?>]
			</td>
		</tr>
	<?php
	}
	?>
	<tr>
		<td>
			<?php echo Text::_('HDP_NAME'); ?>
		</td>
		<td>
			<?php echo $item->name; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_EMAIl'); ?>
		</td>
		<td>
			<a href="mailto:<?php echo $item->email;
?>"><?php echo $item->email; ?></a>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_STATUS'); ?>
		</td>
		<td>
			<?php echo $item->status ; ?>
		</td>
	</tr>
	<?php
	if ($config->get('enable_rating', 1) &&
$item->rating)
	{
		switch ($item->rating)
		{
			case 1:
				$img = 'unsatisfactory.png';
				$title = Text::_('HDP_VERY_POOR');
				break ;
			case 2:
				$img = 'poor.png';
				$title = Text::_('HDP_FAIR');
				break ;
			case 3:
				$img = 'average.png';
				$title = Text::_('HDP_AVERAGE');
				break ;
			case 4:
				$img = 'good.png';
				$title = Text::_('HDP_GOOD');
				break ;
			case 5:
				$img = 'great.png';
				$title = Text::_('HDP_EXCELLENT');
				break ;
		}
		?>
			<tr>
				<td>
					<?php echo Text::_('HDP_RATING'); ?>
				</td>
				<td>
					<img src="<?php echo $rootUri .
'/media/com_helpdeskpro/feedback/' . $img; ?>"
title="<?php echo $title; ?>" />
				</td>
			</tr>
		<?php
	}
	?>
	<tr>
		<td>
			<?php echo Text::_('HDP_TICKET_PRIORITY'); ?>
		</td>
		<td>
			<?php echo $item->priority ; ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_CREATED_DATE'); ?>
		</td>
		<td>
			<?php echo HTMLHelper::_('date', $item->created_date,
$config->date_format); ?>
		</td>
	</tr>
	<tr>
		<td>
			<?php echo Text::_('HDP_MODIFIED_DATE'); ?>
		</td>
		<td>
			<?php echo HTMLHelper::_('date', $item->modified_date,
$config->date_format); ?>
		</td>
	</tr>
	<?php
	if (count($fields))
	{
	?>
		<tr><th colspan="2"><?php echo
Text::_('HPD_EXTRA_INFORMATION'); ?></th></tr>
		<?php
		foreach($fields as $field)
		{
		    if (in_array($field->fieldtype, ['Heading',
'Message']))
            {
                continue;
		    }
		?>
			<tr>
				<td>
					<?php echo $field->title ; ?>
				</td>
				<td>
					<?php echo @$fieldValues[$field->id]; ?>
				</td>
			</tr>
		<?php
		}
	}

	if (!empty($results))
	{
		foreach($results as $result)
		{
			echo $result ;
		}
	}
	?>
</table>
common/tmpl/ticket_detail.php000064400000004314151165450310012331
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Router\Route;

$imageFileTypes = array('gif', 'jpg', 'jpeg',
'png', 'csv', 'bmp', 'txt');
$attachmentsPath = JPATH_ROOT .
'/media/com_helpdeskpro/attachments';
?>
<div class="hdp_ticket_description-body">
	<?php
	if ($config->process_bb_code)
	{
		echo HelpdeskproHelper::processBBCode($item->message);
	}
	else
	{
		if ($config->use_html_editor)
		{
			echo $item->message;
		}
		else
		{
			echo nl2br($item->message);
		}
	}
	if ($item->attachments)
	{
		$originalFileNames = explode('|',
$item->original_filenames);
		$attachments = explode('|', $item->attachments);;
		?>
		<div class="hdp_ticket_description-file">
			<ul>
				<?php
				$i = 0 ;
				foreach($originalFileNames as $fileName)
				{
					$actualFileName = $attachments[$i++];

					if (!file_exists($attachmentsPath . '/' . $actualFileName))
					{
						continue;
					}

					$icon = substr($fileName, strrpos($fileName, '.') + 1);
					$icon = strtolower($icon);

					if
(!file_exists(JPATH_SITE."/media/com_helpdeskpro/assets/images/icons/$icon.png"))
					{
						$icon="default";
					}

					if (in_array($icon, $imageFileTypes))
					{
					?>
						<li><a class="hdp-modal" href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png";
?>" ><?php echo $fileName ?></a></li>
					<?php
					}
					else
					{
					?>
						<li><a href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.download_attachment&filename='.$actualFileName.'&original_filename='.$fileName);
?>"><img height="16" width="16"
src="<?php echo $rootUri .
"/media/com_helpdeskpro/assets/images/icons/$icon.png";
?>" ><?php echo $fileName ?></a></li>
					<?php
					}
				}
				?>
			</ul>
		</div>
		<?php
	}
	?>
</div>
common/tmpl/ticket_upload_attachments.php000064400000003413151165450310014745
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

$config = HelpdeskproHelper::getConfig();

$allowedExtensions = $config->allowed_file_types;
$maxNumberOfFiles  = (int) $config->max_number_attachments ?: 1;

if (!$allowedExtensions)
{
	$allowedExtensions =
'doc|docx|ppt|pptx|pdf|zip|rar|bmp|gif|jpg|jepg|png|swf|zipx';
}

$allowedExtensions = explode('|', $allowedExtensions);

for ($i = 0, $n = count($allowedExtensions); $i < $n; $i++)
{
	$allowedExtensions[$i] = '.' .
strtolower(trim($allowedExtensions[$i]));
}

$token    = JSession::getFormToken() . '=' . 1;
$maxFileSize = 'null';

if ($config->max_file_size > 0)
{
	switch ($config->max_filesize_type)
	{
		case 1:
			$maxFileSize = (int) ($config->max_file_size / 1024 * 1024);
            break;
		case 2:
			$maxFileSize = (int) ($config->max_file_size / 1024);
	        break;
		case 3:
			$maxFileSize = (int) $config->max_file_size;
			break;
	}
}

$document = Factory::getDocument();
$rootUri  = Uri::root(true);
$document->addScript($rootUri .
'/media/com_helpdeskpro/js/ticket-upload-attachments.js');
$document->addScriptOptions('maxFiles', $maxNumberOfFiles);
$document->addScriptOptions('acceptedFiles',
implode(',', $allowedExtensions));
$document->addScriptOptions('maxFilesize', $maxFileSize);

Text::script('HDP_DROP_FILES_TO_UPLOAD', true);
$document->addScriptOptions('uploadProcessUrl',
Uri::base(true) .
'/index.php?option=com_helpdeskpro&task=ticket.upload&' .
$token);common/tmpl/toolbar.php000064400000010037151165450320011166
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
$btnPrimary      = $bootstrapHelper->getClassMapping('btn
btn-primary');
$config          = HelpdeskproHelper::getConfig();
?>
<div class="btn-toolbar hdp_toolbar">
	<?php
	if ($user->authorise('helpdeskpro.changeticketcategory',
'com_helpdeskpro') && count($categories) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_CATEGORY'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($categories as $category)
				{
				?>
					<li><a
href="javascript:HDP.changeTicketCategory(<?php echo
$category->id; ?>)"><?php echo $category->treename;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if ($user->authorise('helpdeskpro.changeticketstatus',
'com_helpdeskpro') && count($rowStatuses) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_STATUS'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($rowStatuses as $rowStatus)
				{
				?>
					<li><a href="javascript:HDP.changeTicketStatus(<?php
echo $rowStatus->id; ?>);"><?php echo
$rowStatus->title; ?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if (count($rowPriorities) && count($rowPriorities) > 1)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_CHANGE_TICKET_PRIORITY'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<?php
				foreach ($rowPriorities as $rowPriority)
				{
				?>
					<li><a
href="javascript:HDP.changeTicketPriority(<?php echo
$rowPriority->id; ?>)"><?php echo $rowPriority->title;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}

	if ($config->get('enable_rating', 1) && $isCustomer
&& !$item->rating)
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_TICKET_RATING'); ?> <span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<li><a
href="javascript:HDP.ticketRating(1)"><?php echo
Text::_('HDP_VERY_POOR'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(2)"><?php echo
Text::_('HDP_FAIR'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(3)"><?php echo
Text::_('HDP_AVERAGE'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(4)"><?php echo
Text::_('HDP_GOOD'); ?></a></li>
				<li><a
href="javascript:HDP.ticketRating(5)"><?php echo
Text::_('HDP_EXCELLENT'); ?></a></li>
			</ul>
		</div>
	<?php
	}

	if (!empty($rowLabels))
	{
	?>
		<div class="btn-group">
			<button class="<?php echo $btnPrimary; ?>
dropdown-toggle" data-toggle="dropdown"><?php echo
Text::_('HDP_APPLY_LABEL'); ?><span
class="caret"></span></button>
			<ul class="dropdown-menu">
				<li><a
href="javascript:HDP.applyTicketLabel(0)"><?php echo
Text::_('HDP_NO_LABEL'); ?></a></li>
				<?php
				foreach ($rowLabels as $rowLabel)
				{
				?>
					<li><a href="javascript:HDP.applyTicketLabel(<?php
echo $rowLabel->id; ?>)"><?php echo $rowLabel->title;
?></a></li>
				<?php
				}
				?>
			</ul>
		</div>
	<?php
	}
	if (!empty($convertToKb))
	{
	?>
		<div class="btn-group">
			<input type="button" class="<?php echo
$bootstrapHelper->getClassMapping('btn'); ?>
btn-success" value="<?php echo
Text::_('HDP_CONVERT_TO_KB'); ?>"
onclick="convertToArticle(this.form)"
style="margin-left:20px;" />
		</div>
	<?php
	}
	?>
</div>
<?php
fieldlayout/checkboxes.php000064400000003530151165450320011717
0ustar00<?php
/**
 * @package            Joomla
 * @subpackage         Event Booking
 * @author             Tuan Pham Ngoc
 * @copyright          Copyright (C) 2010 - 2018 Ossolution Team
 * @license            GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$size          = (int) $row->size ?: 1;
$span          = intval(12 / $size);
$i             = 0;
$numberOptions = count($options);

$rowFluid        = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('row-fluid') :
'row-fluid';
$spanClass       = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('span' . $span) :
'span' . $span;
$clearFixClass   = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('clearfix') :
'clearfix';
$ukFieldsetClass = $bootstrapHelper ?
$bootstrapHelper->getFrameworkClass('uk-fieldset', 2) :
'';
?>
<fieldset id="<?php echo $name; ?>" class="<?php
echo $ukFieldsetClass . $clearFixClass; ?>
hdp-checkboxes-container">
    <div class="<?php echo $rowFluid . ' ' .
$clearFixClass; ?>">
		<?php
		foreach ($options as $option)
		{
		$i++;
		$checked = in_array($option, $selectedOptions) ? 'checked' :
'';
		?>
            <div class="<?php echo $spanClass ?>">
                <label class="checkbox">
                    <input type="checkbox" id="<?php
echo $name.$i; ?>"
                           name="<?php echo $name; ?>[]"
                           value="<?php echo
htmlspecialchars($option, ENT_COMPAT, 'UTF-8') ?>"
                        <?php echo $checked.$attributes; ?>
                    /><?php echo $option; ?>
                </label>
            </div>
		<?php
            if ($i % $size == 0 && $i < $numberOptions)
            {
            ?>
                </div>
                <div class="<?php echo $rowFluid . ' '
. $clearFixClass; ?>">
            <?php
            }
		}
		?>
    </div>
</fieldset>
fieldlayout/controlgroup.php000064400000002321151165450320012333
0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$controlGroupClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-group') :
'control-group';
$controlLabelClass = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-label') :
'control-label';
$controlsClass     = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('controls') :
'controls';

if ($tableLess)
{
?>
    <div class="<?php echo $controlGroupClass; ?>"
<?php echo $controlGroupAttributes ?>>
        <div class="<?php echo $controlLabelClass
?>">
			<?php echo $label; ?>
        </div>
        <div class="<?php echo $controlsClass; ?>">
			<?php echo $input; ?>
        </div>
    </div>
<?php
}
else
{
?>
    <tr <?php echo $controlGroupAttributes; ?>>
        <td class="key">
			<?php
			echo $row->title;

			if ($row->required)
			{
				?>
                <span class="required">*</span>
				<?php
			}
			?>
        </td>
        <td>
			<?php echo $input; ?>
        </td>
    </tr>
<?php
}


fieldlayout/heading.php000064400000000603151165450320011176
0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;

?>
<h3 class="hdp-heading" <?php echo $controlGroupAttributes;
?>><?php echo Text::_($title); ?></h3>
fieldlayout/label.php000064400000001616151165450320010663 0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

$class      = '';
$useTooltip = false;

if (!empty($description))
{
	HTMLHelper::_('bootstrap.tooltip');
	Factory::getDocument()->addStyleDeclaration(".hasTip{display:block
!important}");
	$useTooltip = true;
	$class = 'hasTooltip hasTip';
}
?>
<label id="<?php echo $name; ?>-lbl" for="<?php
echo $name; ?>"<?php if ($class) echo ' class="'
. $class . '"' ?> <?php if ($useTooltip) echo '
title="' . HTMLHelper::tooltipText(trim($title, ':'),
$description, 0) . '"'; ?>>
	<?php
	echo $title;

	if ($row->required)
	{
	?>
		<span class="required">*</span>
	<?php
	}
	?>
</label>fieldlayout/message.php000064400000000750151165450320011226
0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$controlGroup = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('control-group') :
'control-group';
?>
<div class="<?php echo $controlGroup; ?> hdp-message"
<?php echo $controlGroupAttributes; ?>><?php echo $description;
?></div>
fieldlayout/radio.php000064400000003542151165450320010702 0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

$size          = (int) $row->size ?: 1;
$span          = intval(12 / $size);
$i             = 0;
$numberOptions = count($options);

$rowFluid        = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('row-fluid') :
'row-fluid';
$spanClass       = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('span' . $span) :
'span' . $span;
$clearFixClass   = $bootstrapHelper ?
$bootstrapHelper->getClassMapping('clearfix') :
'clearfix';
$ukFieldsetClass = $bootstrapHelper ?
$bootstrapHelper->getFrameworkClass('uk-fieldset', 2) :
'';
?>
<fieldset id="<?php echo $name; ?>" class="<?php
echo $ukFieldsetClass . $clearFixClass; ?>
hdp-radio-container">
	<div class="<?php echo $rowFluid . ' ' .
$clearFixClass; ?>">
		<?php
        $value = trim($value);

        foreach ($options as $option)
		{
            $i++;
            $checked = (trim($option) == $value) ? 'checked' :
'';
		?>
            <div class="<?php echo $spanClass ?>">
                <label class="radio">
                    <input type="radio" id="<?php echo
$name.$i; ?>"
                           name="<?php echo $name; ?>"
                           value="<?php echo
htmlspecialchars($option, ENT_COMPAT, 'UTF-8') ?>"
                        <?php echo $checked.$attributes; ?>
                    /><?php echo $option; ?>
                </label>
            </div>
		<?php
            if ($i % $size == 0 && $i < $numberOptions)
            {
            ?>
                </div>
                <div class="<?php echo $rowFluid . ' '
. $clearFixClass; ?>">
            <?php
            }
		}
		?>
	</div>
</fieldset>
fieldlayout/text.php000064400000000616151165450320010567 0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;
?>
<input type="<?php echo $type; ?>"
       name="<?php echo $name; ?>" id="<?php echo
$name; ?>"
       value=""<?php echo $attributes; ?> />

fieldlayout/textarea.php000064400000000652151165450320011420
0ustar00<?php
/**
 * @package        Joomla
 * @subpackage     OSMembership
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2012 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;
?>
<textarea name="<?php echo $name; ?>"
          id="<?php echo $name; ?>"<?php echo
$attributes; ?>><?php echo htmlspecialchars($value, ENT_COMPAT,
'UTF-8'); ?></textarea>
Ticket/Html.php000064400000024543151165450320007416 0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Ticket;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Captcha\Captcha;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use OSL\View\HtmlView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;
use OSSolution\HelpdeskPro\Site\Helper\Jquery as HelpdeskproHelperJquery;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property \OSSolution\HelpdeskPro\Admin\Model\Ticket $model
 */
class Html extends HtmlView
{
	protected function beforeRender()
	{
		// Load jQuery validation engine
		HelpdeskproHelperJquery::validateForm();

		// Remove the uploaded files data from section
		$this->container->session->clear('hdp_uploaded_files');
		$this->container->session->clear('hdp_uploaded_files_original_names');
		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();

		$layout = $this->getLayout();

		if ($layout == 'form')
		{
			$this->beforeRenderTicketForm();

			return;
		}

		HelpdeskproHelper::loadEditable();

		/* @var \JApplicationSite $app */
		$app         = $this->container->app;
		$user        = $this->container->user;
		$config      = HelpdeskproHelper::getConfig();
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();
		$item        = $this->model->getData();

		if (!$item->id)
		{
			$app->enqueueMessage(Text::_('HDP_TICKET_NOT_EXISTS'));
			$app->redirect(Route::_(RouteHelper::getTicketsRoute(), false));
		}

		// Require users to login if they try to access support ticket via public
link
		if (!$config->allow_public_user_submit_ticket &&
$item->is_ticket_code)
		{
			$redirectUrl = RouteHelper::getTicketRoute($item->id);

			if ($user->id)
			{
				$app->redirect(Route::_($redirectUrl, false));
			}
			else
			{
				$app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='
. base64_encode($redirectUrl)));
			}
		}

		$canAccess = HelpdeskproHelper::checkTicketAccess($item);

		if (!$canAccess)
		{
			if (!$user->id && !$item->is_ticket_code)
			{
				$app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString())));
			}
			else
			{
				$app->enqueueMessage(Text::_('HDP_INVALID_TICKET'),
'warning');
				$app->redirect(Uri::root());
			}
		}

		$rows = HelpdeskproHelperDatabase::getAllCategories(
			'ordering',
			['access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')'],
			$fieldSuffix
		);

		$children = [];

		if ($rows)
		{
			// first pass - collect children
			foreach ($rows as $v)
			{
				$pt   = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : [];
				array_push($list, $v);
				$children[$pt] = $list;
			}
		}

		$categories = HTMLHelper::_('menu.treerecurse', 0,
'', [], $children, 9999, 0, 0);

		$rowStatuses =
HelpdeskproHelperDatabase::getAllStatuses('ordering',
$fieldSuffix);

		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if ($user->id == $item->user_id || $item->is_ticket_code)
		{
			$isCustomer = 1;
		}
		else
		{
			$isCustomer = 0;
		}

		if ($isCustomer && ($item->status_id ==
$config->closed_ticket_status))
		{
			$canComment = false;
		}
		else
		{
			$canComment = true;
		}

		$message = $this->input->getHtml('message');

		if ($config->highlight_code)
		{
			HelpdeskproHelper::loadHighlighter();
		}

		$this->loadCaptcha($app, $config);

		// Add js variables
		$maxNumberOfFiles = $config->max_number_attachments ? (int)
$config->max_number_attachments : 1;

		$siteUrl = Uri::root();
		$this->container->document->addScriptDeclaration("
			var maxAttachment = $maxNumberOfFiles;
			var currentCategory = 0;
			var currentNumberAttachment = 1;
			var currentStatus = 0;
			var hdpSiteUrl = '$siteUrl';
			var jItemId = " . (int) $this->Itemid . ";
		");

		PluginHelper::importPlugin('helpdeskpro');

		//Trigger plugins
		$results =
$this->container->app->triggerEvent('onViewTicket',
[$item]);

		// Pathway
		$pathway = $app->getPathway();
		$pathway->addItem(Text::sprintf('HDP_TICKET_NUMBER',
$item->id));

		$this->fields        =
HelpdeskproHelper::getFields($item->category_id);
		$this->messages      = $this->model->getMessages();
		$this->fieldValues   = $this->model->getFieldsValue();
		$this->rowStatuses   = $rowStatuses;
		$this->rowPriorities = $rowPriorities;
		$this->categories    = $categories;
		$this->config        = $config;
		$this->item          = $item;
		$this->isCustomer    = $isCustomer;
		$this->canComment    = $canComment;
		$this->message       = $message;
		$this->results       = $results;
	}

	/**
	 * Prepare data to render submit ticket form
	 *
	 * @throws \Exception
	 */
	private function beforeRenderTicketForm()
	{
		/* @var \JApplicationSite $app */
		$app         = $this->container->app;
		$user        = $this->container->user;
		$config      = HelpdeskproHelper::getConfig();
		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();
		$userId      = $user->get('id');
		$active      = $app->getMenu()->getActive();

		if ($active && isset($active->query['view'],
$active->query['layout'])
			&& $active->query['view'] == 'ticket'
&& $active->query['layout'] == 'form')
		{
			$params = $active->getParams();
		}
		else
		{
			$params = new Registry;
		}

		$categoryId = $this->input->getInt('category_id', (int)
$params->get('default_category_id'));

		$priorityId = $this->input->getInt('priority_id', 0);

		if (!$userId && !$config->allow_public_user_submit_ticket)
		{
			//Redirect user to login page
			$app->enqueueMessage(Text::_('HDP_LOGIN_TO_SUBMIT_TICKET'));
			$app->redirect('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString()));
		}

		$filters = ['access IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')'];

		if ($params->get('category_ids'))
		{
			$categoryIds =
array_filter(ArrayHelper::toInteger(explode(',',
$params->get('category_ids'))));

			if (count($categoryIds))
			{
				$filters[] = ['id IN (' . implode(',',
$categoryIds) . ')'];
			}
		}

		$rows = HelpdeskproHelperDatabase::getAllCategories(
			'ordering',
			$filters,
			$fieldSuffix
		);

		$lists['category_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown(
			$categoryId,
			'category_id',
			'class="uk-select form-control input-xlarge form-select
validate[required]"
onchange="HDP.showFields(this.form);"',
			$rows
		);

		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if (count($rowPriorities))
		{
			$options              = [];
			$options[]            = HTMLHelper::_('select.option',
'', Text::_('HDP_CHOOSE_PRIORITY'), 'id',
'title');
			$options              = array_merge($options, $rowPriorities);
			$lists['priority_id'] =
HTMLHelper::_('select.genericlist', $options,
'priority_id',
				[
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="uk-select
input-large validate[required] form-select"',
					'list.select'        => $priorityId > 0 ? $priorityId
: $config->default_ticket_priority_id]);
		}

		// Custom fields
		$rowFields = HelpdeskproHelper::getAllFields();
		$form      = new \HDPForm($rowFields);

		$relation = HelpdeskproHelper::getFieldCategoryRelation();
		$form->prepareFormField($categoryId, $relation);

		$fieldJs = "fields = new Array();\n";
		foreach ($relation as $catId => $fieldList)
		{
			$fieldJs .= ' fields[' . $catId . '] = new
Array("' . implode('","', $fieldList) .
'");' . "\n";
		}

		$this->container->document->addScriptDeclaration($fieldJs);

		$data = $this->input->getData();

		if ($this->input->getMethod() == 'POST')
		{
			$useDefault = false;
		}
		else
		{
			$useDefault = true;
		}

		$form->bind($data, $useDefault);

		$this->loadCaptcha($app, $config);

		$maxNumberOfFiles = $config->max_number_attachments ? (int)
$config->max_number_attachments : 1;

		$this->container->document->addScriptDeclaration("
			var maxAttachment = $maxNumberOfFiles;
			var currentCategory = $categoryId;
			var currentNumberAttachment = 1; 
		");

		// Pathway
		$pathway = $app->getPathway();
		$pathway->addItem(Text::_('HDP_NEW_TICKET'));

		$this->lists         = $lists;
		$this->config        = $config;
		$this->userId        = $userId;
		$this->form          = $form;
		$this->categoryId    = $categoryId;
		$this->params        = $params;
		$this->rowCategories = $rows;
	}

	/**
	 * Load captcha for submit ticket and add comment form
	 *
	 * @param   \JApplicationSite   $app
	 * @param   \OSL\Config\Config  $config
	 */
	protected function loadCaptcha($app, $config)
	{
		// Captcha
		$showCaptcha = 0;
		$user        = $this->container->user;

		if (!$config->enable_captcha || ($user->id &&
$config->enable_captcha == '2'))
		{
			$enableCaptcha = false;
		}
		else
		{
			$enableCaptcha = true;
		}

		if ($enableCaptcha)
		{
			$captchaPlugin = $app->get('captcha',
$this->container->appConfig->get('captcha'));

			if (!$captchaPlugin)
			{
				// Hardcode to recaptcha, reduce support request
				$captchaPlugin = 'recaptcha';
			}

			// Check to make sure Captcha is enabled
			$plugin = PluginHelper::getPlugin('captcha', $captchaPlugin);

			if ($plugin)
			{
				$showCaptcha   = 1;
				$this->captcha =
Captcha::getInstance($captchaPlugin)->display('dynamic_recaptcha_1',
'dynamic_recaptcha_1', 'required');
			}
			else
			{
				$app->enqueueMessage(Text::_('EB_CAPTCHA_NOT_ACTIVATED_IN_YOUR_SITE'),
'error');
			}
		}

		$this->showCaptcha = $showCaptcha;
	}
}Ticket/tmpl/default.php000064400000014175151165450320011112
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.keepalive');

if (!HelpdeskproHelper::isJoomla4())
{
	HTMLHelper::_('behavior.modal', 'a.hdp-modal');
}

$document = Factory::getDocument();
$rootUri  = Uri::root(true);

if (!$this->config->use_html_editor &&
$this->config->process_bb_code)
{
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/jquery.selection.js');
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/helpdeskpro.bbcode.js');
}

$document->addScript($rootUri .
'/media/com_helpdeskpro/js/site-ticket-default.js');

Text::script('HDP_ENTER_COMMENT_FOR_TICKET', true);

$cbIntegration    = file_exists(JPATH_ROOT .
'/components/com_comprofiler/comprofiler.php');
$editor           =
Editor::getInstance(Factory::getConfig()->get('editor'));
$user             = Factory::getUser();
$maxNumberOfFiles = $this->config->max_number_attachments ?
$this->config->max_number_attachments : 1;

if ($this->input->getMethod() == 'POST')
{
	$this->captchaInvalid = true;
}
else
{
	$this->captchaInvalid = false;
}

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = $this->bootstrapHelper;
$formHorizontalClass = $bootstrapHelper->getClassMapping('form
form-horizontal');
$rowFluidClass       =
$bootstrapHelper->getClassMapping('row-fluid');
$controlGroupClass   =
$bootstrapHelper->getClassMapping('control-group');
$controlLabelClass   =
$bootstrapHelper->getClassMapping('control-label');
$controlsClass       =
$bootstrapHelper->getClassMapping('controls');
$span3Class          =
$bootstrapHelper->getClassMapping('span3');
$span9Class          =
$bootstrapHelper->getClassMapping('span9');
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<h1 class="hdp_title"><?php echo
Text::_('HDP_VIEW_TICKET'); ?></h1>
<div id="hdp_container" class="container-fluid">
<form action="<?php echo
Route::_('index.php?option=com_helpdeskpro&view=ticket&Itemid='.$this->Itemid);
?>" method="post" name="adminForm"
id="adminForm" enctype="multipart/form-data">
<!--Toolbar buttons-->	
<div class="row-fluid admintable">
	<?php
		$layoutData = array(
			'categories'    => $this->categories,
			'rowStatuses'   => $this->rowStatuses,
			'rowPriorities' => $this->rowPriorities,
			'isCustomer'    => $this->isCustomer,
			'item'          => $this->item,
			'user'          => $user
		);
		echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/toolbar.php',
$layoutData);
	?>
</div>
<div class="row-fluid">
	<div id="hdp_left_panel" class="span9">					
		<table class="adminform">		
			<tr>
				<td>
					<strong>
						[#<?php echo $this->item->id ?>] - <?php echo
$this->escape($this->item->subject); ?>
					</strong>
				</td>
			</tr>					
			<tr>
				<td>
					<?php
						$layoutData = array(
							'item'          => $this->item,
							'rootUri'       => $rootUri,
							'config'        => $this->config
						);

						echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_detail.php',
$layoutData);
					?>						
				</td>
			</tr>
			<tr>
				<th>					
					<h2 class="hdp_heading hdp_comments_heading"><?php
echo Text::_('HDP_COMMENTS'); ?>
                        <?php
                            if ($this->canComment)
                            {
                            ?>
                                <a
href="javascript:HDP.showMessageBox();">
                                    <span
id="hdp_add_comment_link"><?php echo
Text::_('HDP_ADD_COMMENT'); ?></span>
                                    <img width="32"
height="32" src="<?php echo
$rootUri.'/media/com_helpdeskpro/assets/images/icons/icon_add.jpg'?>">
                                </a>
                            <?php
                            }
                        ?>
					</h2>													
				</th>
			</tr>
			<?php
				$layoutData = array(
					'canComment' => $this->canComment,
					'captchaInvalid' => $this->captchaInvalid,
					'config'    => $this->config,
					'maxNumberOfFiles' => $maxNumberOfFiles,
					'rootUri' => $rootUri,
					'editor' => $editor,
					'message' => $this->message,
					'captcha' => isset($this->captcha) ? $this->captcha
: ''
				);

				// Comment form
				echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_add_comment.php',
$layoutData);

				// List of comments
				$layoutData = array(
					'messages'      => $this->messages,
					'user'          => $user,
					'cbIntegration' => $cbIntegration,
					'rootUri'       => $rootUri,
					'config'        => $this->config
				);
				echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_comments.php',
$layoutData);
			?>
	</table>			
</div>		
<div id="hdp_right_panel" class="<?php echo
$span9Class; ?>">
	<?php
		// Customer information
		$layoutData = array(
			'item'        => $this->item,
			'fields'      => $this->fields,
			'fieldValues' => $this->fieldValues,
			'rootUri'     => $rootUri,
			'config'      => $this->config,
			'results'     => $this->results
		);

		echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_customer_info.php',
$layoutData);
	?>
</div>
</div>
	<input type="hidden" name="id" value="<?php
echo $this->item->id; ?>" />
	<input type="hidden" name="task" value=""
/>				
	<input type="hidden" name="new_value"
value="0" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
	
	<?php
		if ($this->item->is_ticket_code) {
		?>
			<input type="hidden" name="ticket_code"
value="<?php echo $this->item->ticket_code ?>" />
		<?php	
		}
	?>		
	<?php echo HTMLHelper::_( 'form.token' ); ?>
</form>
</div>Ticket/tmpl/form.php000064400000015724151165450320010432
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;

HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.keepalive');

$document = Factory::getDocument();
$rootUri = Uri::root();

$editor =
Editor::getInstance(Factory::getConfig()->get('editor'));

if (!$this->config->use_html_editor &&
$this->config->process_bb_code)
{
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/jquery.selection.js');
	$document->addScript($rootUri .
'/media/com_helpdeskpro/assets/js/helpdeskpro.bbcode.js');
}

$document->addScript($rootUri .
'/media/com_helpdeskpro/js/site-ticket-form.js');

/* @var HelpdeskproViewTicketHtml $this */
$role = HelpdeskproHelper::getUserRole($this->userId);

/* @var $bootstrapHelper HelpdeskProHelperBootstrap */
$bootstrapHelper     = $this->bootstrapHelper;
$formHorizontalClass = $bootstrapHelper->getClassMapping('form
form-horizontal');
$rowFluidClass       =
$bootstrapHelper->getClassMapping('row-fluid');
$controlGroupClass   =
$bootstrapHelper->getClassMapping('control-group');
$controlLabelClass   =
$bootstrapHelper->getClassMapping('control-label');
$controlsClass       =
$bootstrapHelper->getClassMapping('controls');
$btnClass            =
$bootstrapHelper->getClassMapping('btn');
$btnPrimaryClass     = $bootstrapHelper->getClassMapping('btn
btn-primary');
?>
<div class="container-fluid">
<h1 class="hdp_title title"><?php echo
$this->params->get('page_heading') ?:
Text::_('HDP_NEW_TICKET'); ?></h1>
<form class="<?php echo $formHorizontalClass; ?>"
name="hdp_form" id="hdp_form" action="<?php
echo
Route::_('index.php?option=com_helpdeskpro&Itemid='.$this->Itemid);
?>" method="post"
enctype="multipart/form-data">
<?php
	if (!$this->userId)
	{
	?>
		<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="name"><?php echo Text::_('HDP_NAME');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			<input type="text" id="name"
name="name" class="input-xlarge form-control
validate[required]" value="<?php echo
$this->escape($this->input->getString('name'));
?>" />
    		</div>			
		</div>
		<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="email"><?php echo Text::_('HDP_EMAIL');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			<input type="text" id="email"
name="email" class="input-xlarge form-control
validate[required,custom[email]]" value="<?php echo
$this->escape($this->input->getString('email'));
?>" />
    		</div>			
		</div>
	<?php	
	}

	if (count($this->rowCategories) > 1)
    {
    ?>
        <div class="<?php echo $controlGroupClass;
?>">
            <label class="<?php echo $controlLabelClass;
?>" for="category_id"><?php echo
Text::_('HDP_CATEGORY'); ?><span
class="required">*</span></label>
            <div class="<?php echo $controlsClass;
?>">
			    <?php echo $this->lists['category_id'] ; ?>
            </div>
        </div>
    <?php
    }
?>
	<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="subject"><?php echo Text::_('HDP_SUBJECT');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
      			   <input type="text" id="subject"
name="subject" class="input-xlarge form-control
validate[required]" value="<?php echo
$this->escape($this->input->getString('subject'));
?>" size="50" />
    		</div>			
	</div>
	<?php
		if (isset($this->lists['priority_id']))
		{
		?>
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass; ?>"
for="priority_id"><?php echo
Text::_('HDP_PRIORITY'); ?><span
class="required">*</span></label>
				<div class="<?php echo $controlsClass; ?>">
					<?php echo $this->lists['priority_id'] ; ?>
				</div>
			</div>
		<?php
		}

		$fields = $this->form->getFields();

		/* @var HDPFormField $field*/
		foreach ($fields as $field)
		{
			echo $field->getControlGroup(true, $this->bootstrapHelper);
		}
	?>
	<div class="<?php echo $controlGroupClass; ?>">
			<label class="<?php echo $controlLabelClass; ?>"
for="message"><?php echo Text::_('HDP_MESSAGE');
?><span class="required">*</span></label>
			<div class="<?php echo $controlsClass; ?>">
				<?php 
					if ($this->config->use_html_editor)
					{						
						echo $editor->display( 'message', 
$this->input->getHtml('message'), '100%',
'250', '75', '10' );
					}
					else 
					{
					?>
						<textarea rows="10" cols="70"
class="hdp_fullwidth form-control validate[required]"
name="message" id="message"><?php echo
$this->escape($this->input->getString('message'));
?></textarea>
					<?php	
					}
				?>										   			    
    		</div>						
	</div>

	<?php
	    if ($this->config->enable_attachment)
		{
		?>
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass;
?>"><?php echo Text::_('HDP_ATTACHMENTS');
?></label>
				<div class="<?php echo $controlsClass; ?>">
                    <div id="hdp_ticket_attachments"
class="dropzone needsclick dz-clickable">

                    </div>
	    		</div>						
			</div>	
		<?php	
		}
		if ($this->showCaptcha)
		{
		?>			
			<div class="<?php echo $controlGroupClass; ?>">
				<label class="<?php echo $controlLabelClass;
?>"><?php echo Text::_('HDP_CAPTCHA');
?><span class="required">*</span></label>
				<div class="<?php echo $controlsClass; ?>">
					<?php echo $this->captcha; ?>			
				</div>
			</div>	
		<?php							
		}
	?>	
	<div class="form-actions">
		<input type="button" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_CANCEL'); ?>"
onclick="HDP.ticketList();" />
		<input type="submit" name="btnSubmit"
class="<?php echo $btnPrimaryClass; ?>"
value="<?php echo Text::_('HDP_SUBMIT_TICKET');
?>" />
	</div>
    <?php
        if ($this->config->enable_attachment)
        {
	        echo
HelpdeskproHelperHtml::loadCommonLayout('common/tmpl/ticket_upload_attachments.php');
        }
    ?>
	<input type="hidden" name="option"
value="com_helpdeskpro" />
	<input type="hidden" name="task"
value="ticket.save" />
	<input type="hidden" name="Itemid"
value="<?php echo $this->Itemid; ?>" />
    <?php
        if (count($this->rowCategories) == 1)
        {
            $categoryId = $this->rowCategories[0]->id;
        ?>
            <input type="hidden" name="category_id"
value="<?php echo $categoryId; ?>" />
        <?php
        }
    ?>

	<?php echo HTMLHelper::_( 'form.token' ); ?>
</form>	
</div>Tickets/Html.php000064400000014403151165450320007573
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

namespace OSSolution\HelpdeskPro\Site\View\Tickets;

use HelpdeskProHelperBootstrap;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use OSL\View\ListView;
use OSSolution\HelpdeskPro\Site\Helper\Database as
HelpdeskproHelperDatabase;
use OSSolution\HelpdeskPro\Site\Helper\Helper as HelpdeskproHelper;
use OSSolution\HelpdeskPro\Site\Helper\Html as HelpdeskproHelperHtml;

defined('_JEXEC') or die;

/**
 * Class Html
 *
 * @property-read \OSSolution\HelpdeskPro\Admin\Model\Tickets $model
 */
class Html extends ListView
{
	protected $lists = array();

	protected function beforeRender()
	{
		parent::beforeRender();

		$user = $this->container->user;

		if (!$user->id)
		{
			$redirectUrl =
Route::_('index.php?option=com_users&view=login&return='
. base64_encode(Uri::getInstance()->toString()));
			$this->container->app->enqueueMessage(Text::_('HDP_PLEASE_LOGIN_TO_CONTINUE'));
			$this->container->app->redirect($redirectUrl);
		}

		$config = HelpdeskproHelper::getConfig();

		// Category filter
		$filters = array();

		$role = 'admin';

		if (!$user->authorise('core.admin',
'com_helpdeskpro'))
		{
			$userId = $user->get('id');
			$email  = $user->get('email');

			$role               = HelpdeskproHelper::getUserRole();
			$managedCategoryIds =
HelpdeskproHelper::getTicketCategoryIds($user->get('username'));
			$managedCategoryIds = ArrayHelper::toInteger($managedCategoryIds);

			if (count($managedCategoryIds))
			{
				$filters[] = '(id IN (' . implode(',',
$managedCategoryIds) . ') OR id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.staff_id =' . $userId .
'))';
			}
			elseif ($role == 'staff')
			{
				$filters[] = 'id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.staff_id =' . $userId .
')';
			}
			else
			{

				$db        = $this->model->getDbo();
				$filters[] = 'id IN (SELECT DISTINCT category_id FROM
#__helpdeskpro_tickets AS t WHERE t.user_id = ' . $userId . ' OR
t.email = ' . $db->quote($email) . ')';
			}

			$filters[] = '`access` IN (' . implode(',',
$user->getAuthorisedViewLevels()) . ')';
		}

		$fieldSuffix = HelpdeskproHelper::getFieldSuffix();

		$rows = HelpdeskproHelperDatabase::getAllCategories('ordering',
$filters, $fieldSuffix);

		$this->lists['filter_category_id'] =
HelpdeskproHelperHtml::buildCategoryDropdown($this->state->filter_category_id,
'filter_category_id', 'class="input-large
form-select" onchange="submit();"', $rows);

		// Ticket status filter
		$rowStatuses =
HelpdeskproHelperDatabase::getAllStatuses('ordering',
$fieldSuffix);

		if (count($rowStatuses))
		{
			$options   = array();
			$options[] = HTMLHelper::_('select.option', -1,
Text::_('HDP_TICKET_STATUS'), 'id',
'title');
			$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_ALL_STATUSES'), 'id', 'title');
			$options   = array_merge($options, $rowStatuses);

			$this->lists['filter_status_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_status_id',
				array(
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="input-medium
form-select" onchange="submit();"',
					'list.select'        =>
$this->state->filter_status_id));
		}

		$statusList = array();

		foreach ($rowStatuses as $status)
		{
			$statusList[$status->id] = $status->title;
		}

		// Ticket priority filter
		$rowPriorities =
HelpdeskproHelperDatabase::getAllPriorities('ordering',
$fieldSuffix);

		if (count($rowPriorities))
		{
			$options   = array();
			$options[] = HTMLHelper::_('select.option', 0,
Text::_('HDP_ALL_PRIORITIES'), 'id',
'title');
			$options   = array_merge($options, $rowPriorities);

			$this->lists['filter_priority_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_priority_id',
				array(
					'option.text.toHtml' => false,
					'option.text'        => 'title',
					'option.key'         => 'id',
					'list.attr'          => 'class="input-medium
form-select" onchange="submit();"',
					'list.select'        =>
$this->state->filter_priority_id));
		}

		$priorityList = array();

		foreach ($rowPriorities as $priority)
		{
			$priorityList[$priority->id] = $priority->title;
		}

		if (PluginHelper::isEnabled('helpdeskpro',
'assignticket') && in_array($role, ['admin',
'manager']))
		{
			$staffDisplayField = $config->get('staff_display_field',
'username') ?: 'username';

			$staffs                         =
HelpdeskproHelperDatabase::getAllStaffs($config->staff_group_id);
			$options                        = array();
			$options[]                      =
HTMLHelper::_('select.option', 0,
Text::_('HDP_SELECT_STAFF'), 'id',
$staffDisplayField);
			$options                        = array_merge($options, $staffs);
			$this->lists['filter_staff_id'] =
HTMLHelper::_('select.genericlist', $options,
'filter_staff_id', ' class="input-medium
form-select" onchange="submit();" ', 'id',
$staffDisplayField, $this->state->filter_staff_id);

			$rowStaffs = array();

			foreach ($staffs as $staff)
			{
				$rowStaffs[$staff->id] = $staff->{$staffDisplayField};
			}

			$this->staffs          = $rowStaffs;
			$this->showStaffColumn = true;
		}

		$active = Factory::getApplication()->getMenu()->getActive();

		if ($active && isset($active->query['view'])
&& $active->query['view'] == 'tickets')
		{
			$params = $active->getParams();
		}
		else
		{
			$params = new Registry;
		}

		$this->fields          =
HelpdeskproHelperDatabase::getFieldsOnListView($fieldSuffix);
		$this->fieldValues     =
$this->model->getFieldsData($this->fields);
		$this->statusList      = $statusList;
		$this->priorityList    = $priorityList;
		$this->config          = $config;
		$this->params          = $params;
		$this->bootstrapHelper = HelpdeskProHelperBootstrap::getInstance();
	}
}Tickets/tmpl/default.php000064400000021660151165450320011272
0ustar00<?php
/**
 * @version        4.3.0
 * @package        Joomla
 * @subpackage     Helpdesk Pro
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2013 - 2021 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

defined( '_JEXEC' ) or die ;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use OSSolution\HelpdeskPro\Site\Helper\Route as RouteHelper;

$ordering = $this->state->filter_order == 'tbl.ordering';

HTMLHelper::_('bootstrap.tooltip', '.hasTooltip',
array('placement' => 'top'));
$cols = 4;

$centerClass =
$this->bootstrapHelper->getClassMapping('center');
$pullLeft    =
$this->bootstrapHelper->getClassMapping('pull-left');
?>
<div id="hdp_container" class="container-fluid">
    <h1 class="hdp_title"><?php echo
$this->params->get('page_heading') ?:
Text::_('HDP_MY_TICKETS'); ?>
        <span class="newticket_link"><a
href="<?php echo
Route::_('index.php?option=com_helpdeskpro&task=ticket.add&Itemid='.$this->Itemid);
?>"><i class="icon-new"></i><?php echo
Text::_('HDP_SUBMIT_TICKET'); ?></a></span>
    </h1>
    <form action="<?php echo
Route::_(RouteHelper::getTicketsRoute()); ?>"
method="post" name="adminForm"
id="adminForm">
        <fieldset class="filters btn-toolbar <?php echo
$this->bootstrapHelper->getClassMapping('clearfix');
?>">
            <div class="filter-search btn-group <?php echo
$pullLeft; ?>>">
                <input type="text"
name="filter_search" id="filter_search"
placeholder="<?php echo Text::_('JSEARCH_FILTER');
?>" value="<?php echo
$this->escape($this->lists['search']); ?>"
class="hasTooltip" title="<?php echo
HTMLHelper::tooltipText('HDP_FILTER_SEARCH_TICKETS_DESC');
?>" />
            </div>
            <div class="btn-group <?php echo
$this->bootstrapHelper->getClassMapping('pull-left');
?>">
                <button type="submit" class="btn
hasTooltip" title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_SUBMIT');
?>"><span class="<?php echo
$this->bootstrapHelper->getClassMapping('icon-search');
?>"></span></button>
                <button type="button" class="btn
hasTooltip" title="<?php echo
HTMLHelper::tooltipText('JSEARCH_FILTER_CLEAR'); ?>"
onclick="document.getElementById('filter_search').value='';this.form.submit();"><span
class="<?php echo
$this->bootstrapHelper->getClassMapping('icon-remove');
?>"></span></button>
            </div>
            <div class="btn-group <?php echo $pullLeft;
?>">
				<?php
				echo $this->lists['filter_category_id'];

				if (isset($this->lists['filter_status_id']))
				{
					echo $this->lists['filter_status_id'];
				}

				if (isset($this->lists['filter_priority_id']))
				{
					echo $this->lists['filter_priority_id'];
				}

				if (isset($this->lists['filter_staff_id']))
				{
					echo $this->lists['filter_staff_id'];
				}
				?>
            </div>
        </fieldset>
        <table class="<?php echo
$this->bootstrapHelper->getClassMapping('table table-striped
table-bordered'); ?> table-hover">
            <thead>
            <tr>
                <th style="text-align: left;">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_TITLE'), 'tbl.subject',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
				<?php
					foreach ($this->fields as $field)
					{
					    $cols++;

					?>
                        <th>
	                        <?php
	                        if ($field->is_searchable)
	                        {
		                        echo HTMLHelper::_('grid.sort',
Text::_($field->title), 'tbl.' . $field->name,
$this->state->filter_order_Dir, $this->state->filter_order);
	                        }
	                        else
	                        {
		                        echo $field->title;
	                        }
	                        ?>
                        </th>
					<?php
					}
				?>
                <th class="<?php echo $centerClass;
?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_CREATED_DATE'), 'tbl.created_date',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
                <th class="<?php echo $centerClass;
?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_MODIFIED_DATE'), 'tbl.modified_date',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
                <?php
                if (isset($this->lists['filter_status_id']))
                {
                    $cols++;
                ?>
                    <th width="8%">
                        <?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_STATUS'), 'tbl.status_id',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                    </th>
                <?php
                }

                if
(isset($this->lists['filter_priority_id']))
                {
                    $cols++;
                ?>
                    <th width="8%">
                        <?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_PRIORITY'), 'tbl.priority_id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
                    </th>
                <?php
                }

                if (!empty($this->showStaffColumn))
				{
					$cols++;
				?>
                    <th width="10%">
						<?php echo HTMLHelper::_('grid.sort',
Text::_('HDP_ASSIGNED_TO'), 'tbl.staff_id',
$this->state->filter_order_Dir, $this->state->filter_order);
?>
                    </th>
				<?php
				}
				?>
                <th width="2%" class="<?php echo
$centerClass; ?>">
					<?php echo HTMLHelper::_('grid.sort', 
Text::_('HDP_ID'), 'tbl.id',
$this->state->filter_order_Dir, $this->state->filter_order );
?>
                </th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="<?php echo $cols +
count($this->fields); ?>">
                    <div class="pagination"><?php echo
$this->pagination->getListFooter(); ?></div>
                </td>
            </tr>
            </tfoot>
            <tbody>
			<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)
			{
				$row = $this->items[$i];
				$link 	= Route::_(RouteHelper::getTicketRoute($row->id), false);
				?>
                <tr class="<?php echo "row$k"; ?>
hdp-ticket-status-<?php echo $row->status_id; ?>">
                    <td>
                        <a href="<?php echo $link;
?>"><?php echo $this->escape($row->subject) ;
?></a>	<br />
                        <small><?php echo
Text::_('HDP_CATEGORY'); ?>: <strong><?php echo
$row->category_title ; ?></strong></small>
                    </td>
					<?php
					if(count($this->fields))
					{
						foreach ($this->fields as $field)
						{
						?>
                            <td>
								<?php echo
isset($this->fieldValues[$row->id][$field->id]) ?
$this->fieldValues[$row->id][$field->id] : '';?>
                            </td>
						<?php
						}
					}
					?>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo HTMLHelper::_('date', $row->created_date,
$this->config->date_format); ?>
                    </td>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo HTMLHelper::_('date', $row->modified_date,
$this->config->date_format); ?>
                    </td>
                    <?php
                        if
(isset($this->lists['filter_status_id']))
                        {
                        ?>
                            <td>
		                        <?php echo
@$this->statusList[$row->status_id]; ?>
                            </td>
                        <?php
                        }

                        if
(isset($this->lists['filter_priority_id']))
                        {
                        ?>
                            <td>
		                        <?php echo
@$this->priorityList[$row->priority_id]; ?>
                            </td>
                        <?php
                        }

                        if (!empty($this->showStaffColumn))
                        {
                        ?>
                            <td>
                                <?php echo
$this->staffs[$row->staff_id]; ?>
                            </td>
                        <?php
                        }
					?>
                    <td class="<?php echo $centerClass;
?>">
						<?php echo $row->id; ?>
                    </td>
                </tr>
				<?php
				$k = 1 - $k;
			}
			?>
            </tbody>
        </table>
        <input type="hidden" name="task"
value="" />
        <input type="hidden" name="boxchecked"
value="0" />
        <input type="hidden" name="filter_order"
value="<?php echo $this->state->filter_order; ?>"
/>
        <input type="hidden" name="filter_order_Dir"
value="<?php echo $this->state->filter_order_Dir; ?>"
/>
		<?php echo HTMLHelper::_( 'form.token' ); ?>
    </form>
</div>