finished basic npc_vendor_template display, missing edit abilities
This commit is contained in:
parent
f7f8bade45
commit
5e5f3d4e0d
@ -20,4 +20,16 @@ function init_saimod_mojotrollz_npc_vendor_template(){
|
||||
comments: $('#input_search_comments').val()}
|
||||
system.load('mojotrollz_npc_vendor_template;search.'+JSON.stringify(search),true);
|
||||
});
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_npc_vendor_template_vendor(){
|
||||
$('#btn_search').click(function(){
|
||||
entry = $(this).attr('entry');
|
||||
search = { item: $('#input_search_item').val(),
|
||||
maxcount: $('#input_search_maxcount').val(),
|
||||
incrtime: $('#input_search_incrtime').val(),
|
||||
extendedcost: $('#input_search_extendedcost').val(),
|
||||
condition_id: $('#input_search_condition_id').val()}
|
||||
system.load('mojotrollz_npc_vendor_template_vendor;entry.'+entry+';search.'+JSON.stringify(search),true);
|
||||
});
|
||||
}
|
||||
@ -5,8 +5,64 @@ class saimod_mojotrollz_npc_vendor_template extends \SYSTEM\SAI\SaiModule {
|
||||
\SQL\NPC_VENDOR_TEMPLATE_COMMENT::QI(array($entry,$comment));
|
||||
return \JsonResult::ok();
|
||||
}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_vendor($entry){
|
||||
return 'test';
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template_action_vendor($entry,$search='{}',$page=0){
|
||||
$vars = array();
|
||||
$vars['search_item'] = $vars['search_maxcount'] = $vars['search_incrtime'] = $vars['search_extendedcost'] = $vars['search_condition_id'] = '';
|
||||
$query = 'SELECT * '.
|
||||
'FROM npc_vendor_template WHERE entry = ?';
|
||||
$query_vars = array($entry);
|
||||
$search_ = \json_decode($search,true);
|
||||
if(\is_array($search_)){
|
||||
if(\array_key_exists('item', $search_) && $search_['item'] != ''){
|
||||
$query .= ' AND item = ?';
|
||||
$query_vars[] = $search_['item'];
|
||||
$vars['search_item'] = $search_['item'];
|
||||
}
|
||||
if(\array_key_exists('maxcount', $search_) && $search_['maxcount'] != ''){
|
||||
$query .= ' AND maxcount = ?';
|
||||
$query_vars[] = $search_['maxcount'];
|
||||
$vars['search_maxcount'] = $search_['maxcount'];
|
||||
}
|
||||
if(\array_key_exists('incrtime', $search_) && $search_['incrtime'] != ''){
|
||||
$query .= ' AND incrtime = ?';
|
||||
$query_vars[] = $search_['incrtime'];
|
||||
$vars['search_incrtime'] = $search_['incrtime'];
|
||||
}
|
||||
if(\array_key_exists('extendedcost', $search_) && $search_['extendedcost'] != ''){
|
||||
$query .= ' AND extendedcost = ?';
|
||||
$query_vars[] = $search_['extendedcost'];
|
||||
$vars['search_extendedcost'] = $search_['extendedcost'];
|
||||
}
|
||||
if(\array_key_exists('condition_id', $search_) && $search_['condition_id'] != ''){
|
||||
$query .= ' AND condition_id = ?';
|
||||
$query_vars[] = $search_['condition_id'];
|
||||
$vars['search_condition_id'] = $search_['condition_id'];
|
||||
}
|
||||
}
|
||||
$query_count = 'SELECT COUNT(*) as count FROM ('.$query.') t1';
|
||||
$con = new \SYSTEM\DB\Connection(new \SQL\mangos_one_world_test());
|
||||
$count = $con->prepare('count_npc_vendor_template_vendor',$query_count,$query_vars)->next()['count'];
|
||||
$res = $con->prepare('select_npc_vendor_template_vendor', $query, $query_vars);
|
||||
|
||||
$vars['entries'] = '';
|
||||
$count_filtered = 0;
|
||||
$res->seek(100*$page);
|
||||
while(($row = $res->next()) && ($count_filtered < 100)){
|
||||
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_vendor_entry.tpl'), $row);
|
||||
$count_filtered++;
|
||||
}
|
||||
$vars['pagination'] = '';
|
||||
$vars['page'] = $page;
|
||||
$vars['page_last'] = ceil($count/100)-1;
|
||||
for($i=0;$i < ceil($count/100);$i++){
|
||||
$data = array('entry' => $entry, 'page' => $i,'search' => $search, 'active' => ($i == $page) ? 'active' : '');
|
||||
$vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_vendor_pagination.tpl'), $data);
|
||||
}
|
||||
$vars['search'] = htmlentities($search);
|
||||
$vars['count'] = $count_filtered.'/'.$count;
|
||||
$vars['entry'] = $entry;
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('basic'));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_vendor.tpl'), $vars);
|
||||
}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_npc_vendor_template($search='{}',$page=0){
|
||||
$vars = array();
|
||||
@ -65,7 +121,7 @@ class saimod_mojotrollz_npc_vendor_template extends \SYSTEM\SAI\SaiModule {
|
||||
$data = array('page' => $i,'search' => $search, 'active' => ($i == $page) ? 'active' : '');
|
||||
$vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template_pagination.tpl'), $data);
|
||||
}
|
||||
$vars['search'] = $search;
|
||||
$vars['search'] = htmlentities($search);
|
||||
$vars['count'] = $count_filtered.'/'.$count;
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('basic'));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_mojotrollz_npc_vendor_template/tpl/npc_vendor_template.tpl'), $vars);
|
||||
|
||||
@ -2,4 +2,7 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5301, 42, 3, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'search', 'JSON');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5302, 42, 3, 0, '_SAI_saimod_mojotrollz_npc_vendor_template', 'page', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5310, 42, 2, 5300, 'comment', 'entry', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5311, 42, 2, 5300, 'comment', 'comment', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5311, 42, 2, 5300, 'comment', 'comment', 'STRING');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5320, 42, 2, 5300, 'vendor', 'entry', 'INT');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5321, 42, 3, 5300, 'vendor', 'search', 'JSON');
|
||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5322, 42, 3, 5300, 'vendor', 'page', 'INT');
|
||||
@ -1 +1,2 @@
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (530, 42, 'mojotrollz_npc_vendor_template', 'mojotrollz_npc_vendor_template', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&search=${search}&page=${page}', 'init_saimod_mojotrollz_npc_vendor_template', '\\SAI\\saimod_mojotrollz_npc_vendor_template');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (530, 42, 'mojotrollz_npc_vendor_template', 'mojotrollz_npc_vendor_template', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&search=${search}&page=${page}', 'init_saimod_mojotrollz_npc_vendor_template', '\\SAI\\saimod_mojotrollz_npc_vendor_template');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (531, 42, 'mojotrollz_npc_vendor_template_vendor', 'mojotrollz_npc_vendor_template_vendor', -1, 0, 0, '#content', './sai.php?sai_mod=.SAI.saimod_mojotrollz_npc_vendor_template&action=vendor&entry=${entry}&search=${search}&page=${page}', 'init_saimod_mojotrollz_npc_vendor_template_vendor', '\\SAI\\saimod_mojotrollz_npc_vendor_template');
|
||||
@ -0,0 +1,43 @@
|
||||
<button id="btn_back" onClick="system.back();" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ${basic_back}</button>
|
||||
<h6>${basic_rows}: ${count} ${basic_page}: ${page}</h6>
|
||||
<table class="sai_table" style="width: 100%;">
|
||||
<tr>
|
||||
<th>entry</th>
|
||||
<th>item</th>
|
||||
<th>maxcount</th>
|
||||
<th>incrtime</th>
|
||||
<th>ExtendedCost</th>
|
||||
<th>condition_id</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<input class="input-medium search-query action-control" id="input_search_item" type="text" placeholder="${basic_placeholder_search}" size="20" value="${search_item}"/>
|
||||
</td>
|
||||
<td>
|
||||
<input class="input-medium search-query action-control" id="input_search_maxcount" type="text" placeholder="${basic_placeholder_search}" size="20" value="${search_maxcount}"/>
|
||||
</td>
|
||||
<td>
|
||||
<input class="input-medium search-query action-control" id="input_search_incrtime" type="text" placeholder="${basic_placeholder_search}" size="20" value="${search_incrtime}"/>
|
||||
</td>
|
||||
<td>
|
||||
<input class="input-medium search-query action-control" id="input_search_extendedcost" type="text" placeholder="${basic_placeholder_search}" size="20" value="${search_extendedcost}"/>
|
||||
</td>
|
||||
<td>
|
||||
<input class="input-medium search-query action-control" id="input_search_condition_id" type="text" placeholder="${basic_placeholder_search}" size="20" value="${search_condition_id}"/>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn-sm btn btn-success" id="btn_search" entry="${entry}" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> ${basic_search}</button>
|
||||
</td>
|
||||
</tr>
|
||||
${entries}
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry};search.${search};page.0">«</a></li>
|
||||
${pagination}
|
||||
<li><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry};search.${search};page.${page_last}">»</a></li>
|
||||
</ul>
|
||||
<br>
|
||||
<button id="btn_back" onClick="system.back();" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ${basic_back}</button>
|
||||
@ -0,0 +1,10 @@
|
||||
<tr>
|
||||
<td><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry}">${entry}</a></td>
|
||||
<td>${item}</td>
|
||||
<td>${maxcount}</td>
|
||||
<td>${incrtime}</td>
|
||||
<td>${ExtendedCost}</td>
|
||||
<td>${condition_id}</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
@ -0,0 +1 @@
|
||||
<li class="${active}"><a href="#!mojotrollz_npc_vendor_template_vendor;entry.${entry};search.${search};page.${page}">${page}</a></li>
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user