Getting more work done on custom navigation
This commit is contained in:
parent
8db64d903d
commit
3df5324732
@ -16,15 +16,7 @@ hesk_session_start();
|
|||||||
hesk_dbConnect();
|
hesk_dbConnect();
|
||||||
hesk_isLoggedIn();
|
hesk_isLoggedIn();
|
||||||
|
|
||||||
//hesk_checkPermission('can_man_email_tpl');
|
//hesk_checkPermission('can_man_custom_nav');
|
||||||
|
|
||||||
// Are we performing an action?
|
|
||||||
$showEditPanel = false;
|
|
||||||
if (isset($_GET['action'])) {
|
|
||||||
if ($_GET['action'] == 'edit') {
|
|
||||||
$showEditPanel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Are we saving?
|
// Are we saving?
|
||||||
if (isset($_POST['action'])) {
|
if (isset($_POST['action'])) {
|
||||||
@ -52,21 +44,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<?php if ($showEditPanel): ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h4>EDIT CUSTOM NAV ELEMENT[!]</h4>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<form action="manage_custom_nav_elements.php" method="post">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<?php
|
<?php
|
||||||
@ -149,7 +126,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
echo 'INVALID!!';
|
echo 'INVALID!!';
|
||||||
} ?>
|
} ?>
|
||||||
</td>
|
</td>
|
||||||
<td>EDIT, DELETE</td>
|
<td>
|
||||||
|
<a href="manage_custom_nav_elements.php?edit=<?php echo $row['id'];?>">
|
||||||
|
<i class="fa fa-pencil icon-link orange"
|
||||||
|
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
||||||
|
</a>
|
||||||
|
<a href="manage_custom_nav_elements.php?delete=<?php echo $row['id']; ?>">
|
||||||
|
<i class="fa fa-times icon-link red"
|
||||||
|
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -158,12 +144,37 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
if ($showEditPanel):
|
||||||
|
?>
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h1 class="box-title">
|
||||||
|
Edit Custom Navigation Menu Element
|
||||||
|
</h1>
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||||
|
<i class="fa fa-minus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<form action="manage_custom_nav_elements.php" method="post">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<section id="table-row-template" style="display: none">
|
||||||
|
<tr>
|
||||||
|
<td data-property="id"></td>
|
||||||
|
<td data-property="text"></td>
|
||||||
|
<td data-property="subtext"></td>
|
||||||
|
<td data-property="icon-url"></td>
|
||||||
|
<td data-property="place"></td>
|
||||||
|
<td data-property="action"></td>
|
||||||
|
</tr>
|
||||||
|
</section>
|
||||||
<?php
|
<?php
|
||||||
require_once(HESK_PATH . 'inc/footer.inc.php');
|
require_once(HESK_PATH . 'inc/footer.inc.php');
|
||||||
exit();
|
|
||||||
|
|
||||||
function save()
|
|
||||||
{
|
|
||||||
}
|
|
@ -9,6 +9,7 @@ use BusinessLogic\Emails\EmailSenderHelper;
|
|||||||
use BusinessLogic\Emails\EmailTemplateParser;
|
use BusinessLogic\Emails\EmailTemplateParser;
|
||||||
use BusinessLogic\Emails\EmailTemplateRetriever;
|
use BusinessLogic\Emails\EmailTemplateRetriever;
|
||||||
use BusinessLogic\Emails\MailgunEmailSender;
|
use BusinessLogic\Emails\MailgunEmailSender;
|
||||||
|
use BusinessLogic\Navigation\CustomNavElementHandler;
|
||||||
use BusinessLogic\Security\BanRetriever;
|
use BusinessLogic\Security\BanRetriever;
|
||||||
use BusinessLogic\Security\UserContextBuilder;
|
use BusinessLogic\Security\UserContextBuilder;
|
||||||
use BusinessLogic\Security\UserToTicketChecker;
|
use BusinessLogic\Security\UserToTicketChecker;
|
||||||
@ -30,6 +31,7 @@ use DataAccess\Files\FileDeleter;
|
|||||||
use DataAccess\Files\FileReader;
|
use DataAccess\Files\FileReader;
|
||||||
use DataAccess\Files\FileWriter;
|
use DataAccess\Files\FileWriter;
|
||||||
use DataAccess\Logging\LoggingGateway;
|
use DataAccess\Logging\LoggingGateway;
|
||||||
|
use DataAccess\Navigation\CustomNavElementGateway;
|
||||||
use DataAccess\Security\BanGateway;
|
use DataAccess\Security\BanGateway;
|
||||||
use DataAccess\Security\UserGateway;
|
use DataAccess\Security\UserGateway;
|
||||||
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
||||||
@ -41,6 +43,9 @@ use DataAccess\Tickets\VerifiedEmailGateway;
|
|||||||
class ApplicationContext {
|
class ApplicationContext {
|
||||||
public $get;
|
public $get;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ApplicationContext constructor.
|
||||||
|
*/
|
||||||
function __construct() {
|
function __construct() {
|
||||||
$this->get = array();
|
$this->get = array();
|
||||||
|
|
||||||
@ -50,6 +55,10 @@ class ApplicationContext {
|
|||||||
// API Checker
|
// API Checker
|
||||||
$this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]);
|
$this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]);
|
||||||
|
|
||||||
|
// Custom Navigation
|
||||||
|
$this->get[CustomNavElementGateway::class] = new CustomNavElementGateway();
|
||||||
|
$this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]);
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
$this->get[LoggingGateway::class] = new LoggingGateway();
|
$this->get[LoggingGateway::class] = new LoggingGateway();
|
||||||
|
|
||||||
|
24
api/BusinessLogic/Navigation/CustomNavElement.php
Normal file
24
api/BusinessLogic/Navigation/CustomNavElement.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Navigation;
|
||||||
|
|
||||||
|
|
||||||
|
class CustomNavElement {
|
||||||
|
/* @var $id int*/
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/* @var $text string[string] */
|
||||||
|
public $text;
|
||||||
|
|
||||||
|
/* @var $subtext string[string]|null */
|
||||||
|
public $subtext;
|
||||||
|
|
||||||
|
/* @var $imageUrl string|null */
|
||||||
|
public $imageUrl;
|
||||||
|
|
||||||
|
/* @var $fontIcon string|null */
|
||||||
|
public $fontIcon;
|
||||||
|
|
||||||
|
/* @var $place int */
|
||||||
|
public $place;
|
||||||
|
}
|
32
api/BusinessLogic/Navigation/CustomNavElementHandler.php
Normal file
32
api/BusinessLogic/Navigation/CustomNavElementHandler.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Navigation;
|
||||||
|
|
||||||
|
// TODO Test!
|
||||||
|
use DataAccess\Navigation\CustomNavElementGateway;
|
||||||
|
|
||||||
|
class CustomNavElementHandler {
|
||||||
|
/* @var $customNavElementGateway CustomNavElementGateway */
|
||||||
|
private $customNavElementGateway;
|
||||||
|
|
||||||
|
function __construct($customNavElementGateway) {
|
||||||
|
$this->customNavElementGateway = $customNavElementGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getAllCustomNavElements($heskSettings) {
|
||||||
|
return $this->customNavElementGateway->getAllCustomNavElements($heskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCustomNavElement() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveCustomNavElement() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCustomNavElement() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
api/BusinessLogic/Navigation/CustomNavElementPlace.php
Normal file
10
api/BusinessLogic/Navigation/CustomNavElementPlace.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Navigation;
|
||||||
|
|
||||||
|
|
||||||
|
class CustomNavElementPlace {
|
||||||
|
const HOMEPAGE_BLOCK = 1;
|
||||||
|
const CUSTOMER_NAVIGATION = 2;
|
||||||
|
const ADMIN_NAVIGATION = 3;
|
||||||
|
}
|
@ -61,7 +61,6 @@ class UserContext {
|
|||||||
* @return UserContext the built user context
|
* @return UserContext the built user context
|
||||||
*/
|
*/
|
||||||
static function fromDataRow($dataRow) {
|
static function fromDataRow($dataRow) {
|
||||||
var_dump($dataRow);
|
|
||||||
$userContext = new UserContext();
|
$userContext = new UserContext();
|
||||||
$userContext->id = intval($dataRow['id']);
|
$userContext->id = intval($dataRow['id']);
|
||||||
$userContext->username = $dataRow['user'];
|
$userContext->username = $dataRow['user'];
|
||||||
|
17
api/Controllers/Navigation/CustomNavElementController.php
Normal file
17
api/Controllers/Navigation/CustomNavElementController.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Controllers\Navigation;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Navigation\CustomNavElementHandler;
|
||||||
|
|
||||||
|
class CustomNavElementController {
|
||||||
|
static function getAll() {
|
||||||
|
global $applicationContext, $hesk_settings;
|
||||||
|
|
||||||
|
/* @var $handler CustomNavElementHandler */
|
||||||
|
$handler = $applicationContext->get[CustomNavElementHandler::class];
|
||||||
|
|
||||||
|
output($handler->getAllCustomNavElements($hesk_settings));
|
||||||
|
}
|
||||||
|
}
|
22
api/DataAccess/Navigation/CustomNavElementGateway.php
Normal file
22
api/DataAccess/Navigation/CustomNavElementGateway.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DataAccess\Navigation;
|
||||||
|
|
||||||
|
|
||||||
|
use DataAccess\CommonDao;
|
||||||
|
|
||||||
|
class CustomNavElementGateway extends CommonDao {
|
||||||
|
function getAllCustomNavElements($heskSettings) {
|
||||||
|
$this->init();
|
||||||
|
|
||||||
|
$rs = hesk_dbQuery("SELECT `t2`.`id` AS `xref_id`, `t2`.*, `t1`.* FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element` AS `t1`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element_to_text` AS `t2`
|
||||||
|
ON `t1`.`id` = `t2`.`nav_element_id`");
|
||||||
|
|
||||||
|
while ($row = hesk_dbFetchAssoc($rs)) {
|
||||||
|
var_dump($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->close();
|
||||||
|
}
|
||||||
|
}
|
@ -186,6 +186,8 @@ Link::all(array(
|
|||||||
/* Internal use only routes */
|
/* Internal use only routes */
|
||||||
// Resend email response
|
// Resend email response
|
||||||
'/v1-internal/staff/tickets/{i}/resend-email' => \Controllers\Tickets\ResendTicketEmailToCustomerController::class,
|
'/v1-internal/staff/tickets/{i}/resend-email' => \Controllers\Tickets\ResendTicketEmailToCustomerController::class,
|
||||||
|
// Custom Navigation
|
||||||
|
'/v1-internal/custom-navigation' => \Controllers\Navigation\CustomNavElementController::class . '::getAll',
|
||||||
|
|
||||||
// Any URL that doesn't match goes to the 404 handler
|
// Any URL that doesn't match goes to the 404 handler
|
||||||
'404' => 'handle404'
|
'404' => 'handle404'
|
||||||
|
@ -52,6 +52,7 @@ $hesklang['resend_email_notification'] = 'Re-send Email Notification';
|
|||||||
$hesklang['email_notification_sent'] = 'Email notification sent!';
|
$hesklang['email_notification_sent'] = 'Email notification sent!';
|
||||||
$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
|
$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
|
||||||
$hesklang['edit_category'] = 'Edit Category';
|
$hesklang['edit_category'] = 'Edit Category';
|
||||||
|
$hesklang['custom_nav_element_deleted'] = 'Custom Navigation Element Deleted!';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
|
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
|
||||||
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #
|
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #
|
||||||
|
Loading…
x
Reference in New Issue
Block a user