Skip to content

Commit

Permalink
changes #9 and #10
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jul 23, 2018
1 parent 8c51eca commit 640acf5
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 9 deletions.
24 changes: 18 additions & 6 deletions classes/filter_operators.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@

$fieldsSearch = array();

$fieldsSearch['name'] = array (
$fieldsSearch['user_id'] = array (
'type' => 'text',
'trans' => 'Name',
'trans' => 'User',
'required' => false,
'valid_if_filled' => false,
'filter_type' => 'like',
'filter_table_field' => 'name',
'validation_definition' => new ezcInputFormDefinitionElement (
ezcInputFormDefinitionElement::OPTIONAL, 'string'
'filter_type' => 'filter',
'filter_table_field' => 'user_id',
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 1)
)
);

$fieldsSearch['bot_id'] = array (
'type' => 'text',
'trans' => 'Bot',
'required' => false,
'valid_if_filled' => false,
'filter_type' => 'filter',
'filter_table_field' => 'bot_id',
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 1)
)
);

Expand Down
11 changes: 9 additions & 2 deletions design/lhctelegramtheme/tpl/lhtelegram/operators.tpl.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<h1><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Telegram operators');?></h1>

<?php if (isset($items)) : ?>
<?php include(erLhcoreClassDesign::designtpl('lhtelegram/parts/filter.tpl.php')); ?>

<?php if (isset($items)) : ?>
<table cellpadding="0" cellspacing="0" class="table" width="100%">
<thead>
<tr>
Expand All @@ -18,7 +19,13 @@
<?php foreach ($items as $item) : ?>
<tr>
<td><?php echo htmlspecialchars($item->id)?></td>
<td><?php echo htmlspecialchars($item->user)?></td>
<td>
<?php if (is_object($item->user)) : ?>
<?php echo htmlspecialchars($item->user->name_official)?>
<?php else : ?>
-
<?php endif; ?>
</td>
<td><?php echo htmlspecialchars($item->bot)?></td>
<td><?php echo htmlspecialchars($item->chat_id)?></td>
<td><?php echo $item->confirmed?></td>
Expand Down
39 changes: 39 additions & 0 deletions design/lhctelegramtheme/tpl/lhtelegram/parts/filter.tpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

<form action="<?php echo erLhcoreClassDesign::baseurl('telegram/operators')?>" method="get" name="SearchFormRight">

<input type="hidden" name="doSearch" value="1">

<div class="row">
<div class="col-md-3">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Bot');?></label>
<?php echo erLhcoreClassRenderHelper::renderCombobox( array (
'input_name' => 'bot_id',
'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Choose bot'),
'selected_id' => $input->bot_id,
'css_class' => 'form-control',
'display_name' => 'bot_username',
'list_function' => 'erLhcoreClassModelTelegramBot::getList'
)); ?>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','User');?></label>
<?php echo erLhcoreClassRenderHelper::renderCombobox( array (
'input_name' => 'user_id',
'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Select user'),
'selected_id' => $input->user_id,
'css_class' => 'form-control',
'display_name' => 'name_official',
'list_function' => 'erLhcoreClassModelUser::getUserList'
)); ?>
</div>
</div>
<div class="col-md-2">
<div><label>&nbsp;</label></div>
<input type="submit" name="doSearch" class="btn btn-default" value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Search');?>" />
</div>
</div>

</form>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Select operator'),
'selected_id' => $item->user_id,
'css_class' => 'form-control',
'display_name' => 'name_official',
'list_function' => 'erLhcoreClassModelUser::getUserList',
'list_function_params' => array(),
)); ?>
Expand Down
2 changes: 1 addition & 1 deletion modules/lhtelegram/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

$ViewList['operators'] = array(
'params' => array(),
'uparams' => array(),
'uparams' => array('user_id','bot_id'),
'functions' => array('use_admin'),
);

Expand Down

0 comments on commit 640acf5

Please sign in to comment.