Commit e2fde3a9 authored by Shakarim Sapa's avatar Shakarim Sapa

- Внесены изменения в input-ы отвечающие за передачу параметров условий....

- Внесены изменения в input-ы отвечающие за передачу параметров условий. Теперь они сгруппированы таким образом что их можно обработать в модели.
parent c00b0960
...@@ -47,9 +47,11 @@ class ConditionBase { ...@@ -47,9 +47,11 @@ class ConditionBase {
} }
/** /**
* @return array|string * @param $group_key
* @param $condition_key
* @return array
*/ */
public function getParams(){ public function getParams($group_key, $condition_key){
$result = []; $result = [];
if (isset($this->config['params'])) { if (isset($this->config['params'])) {
foreach($this->config['params'] as $name=>$param) { foreach($this->config['params'] as $name=>$param) {
...@@ -57,7 +59,7 @@ class ConditionBase { ...@@ -57,7 +59,7 @@ class ConditionBase {
switch($type) { switch($type) {
case 'text': case 'text':
default: default:
$result[] = '<input type="text" name="Conditions[]['.$name.']" class="form-control" style="margin-top: 5px;" placeholder="'.((isset($param['placeholder'])) ? $param['placeholder'] : '').'"/>'; $result[] = '<input type="text" name="Conditions['.$group_key.']['.$this->getId().$condition_key.']['.$name.']" class="form-control" style="margin-top: 5px;" placeholder="'.((isset($param['placeholder'])) ? $param['placeholder'] : '').'"/>';
break; break;
} }
} }
......
<?php use \common\modules\triggers\components\conditions\Conditions; ?> <?php use \common\modules\triggers\components\conditions\Conditions; ?>
<?php $condition_key = rand(100,999); ?>
<div class="alert alert-info alert-dismissible" role="alert"> <div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Условие: <?php echo $object->getName(); ?></strong> <strong>Условие: <?php echo $object->getName(); ?></strong>
<input type="hidden" name="Conditions[<?php echo $key; ?>][<?php echo $object->getId().$condition_key; ?>][id]" value="<?php echo $object->getId(); ?>"/>
<?php <?php
foreach($object->getParams() as $param) { foreach($object->getParams($key, $condition_key) as $param) {
echo $param; echo $param;
} }
?> ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment