<?php $pages = new lhPaginator(); $pages->serverURL = erLhcoreClassDesign::baseurl('user/account') . '/(tab)/canned'; $pages->items_total = erLhcoreClassModelCannedMsg::getCount(array('filter' => array('user_id' => $user->id))); $pages->setItemsPerPage(10); $pages->paginate(); $cannedMessages = array(); if ($pages->items_total > 0) { $cannedMessages = erLhcoreClassModelCannedMsg::getList(array('filter' => array('user_id' => $user->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC')); } ?> <table class="twelve" cellpadding="0" cellspacing="0"> <thead> <tr> <th width="1%">ID</th> <th><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Message'); ?> </th> <th><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Delay'); ?> </th> <th><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Position'); ?> </th> <th width="1%"> </th> <th width="1%"> </th>
if (is_numeric($Params['user_parameters_unordered']['id']) && $Params['user_parameters_unordered']['action'] == 'delete') { // Delete selected canned message try { if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) { die('Invalid CSRF Token'); exit; } $Msg = erLhcoreClassChat::getSession()->load('erLhcoreClassModelCannedMsg', (int) $Params['user_parameters_unordered']['id']); if ($userDepartments === true || in_array($Msg->department_id, $userDepartments)) { $Msg->removeThis(); } } catch (Exception $e) { // Do nothing } erLhcoreClassModule::redirect('chat/cannedmsg'); exit; } $pages = new lhPaginator(); $pages->serverURL = erLhcoreClassDesign::baseurl('chat/cannedmsg'); $pages->items_total = erLhcoreClassModelCannedMsg::getCount($departmentParams); $pages->setItemsPerPage(20); $pages->paginate(); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelCannedMsg::getList(array_merge(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'), $departmentParams)); } $tpl->set('items', $items); $tpl->set('pages', $pages); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('chat/cannedmsg'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/cannedmsg', 'Canned messages'))); erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.cannedmsg_path', array('result' => &$Result));