Commit 3c5c4a33 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлены методы для обработки и получения параметров конкретного условия;

parent 529aa700
...@@ -86,6 +86,55 @@ class Conditions { ...@@ -86,6 +86,55 @@ class Conditions {
return null; return null;
} }
/**
* @param $id
* @return null
*/
public function getConfigById($id){
foreach(self::$config as $key=>$condition) {
$class = $condition['class']::init();
if ($class::CONDITION_ID==$id)
return [$key => $condition];
}
return null;
}
/**
* @param $id
* @return array
*/
public function getParamsById($id){
$result = [];
foreach(self::$config as $key=>$condition) {
$class = $condition['class']::init();
if ($class::CONDITION_ID==$id)
if (isset($condition['params']) && count($condition['params'])>0) {
foreach($condition['params'] as $param_key=>$param_value) {
$result[$param_key] = $param_value;
}
}
}
return $result;
}
/**
* @param $param
* @return string
*/
public function getParamInput($param){
if (empty($param['type']))
return '<input type="text" class="form-control" style="margin-top: 5px;" placeholder="'.((isset($param['placeholder'])) ? $param['placeholder'] : '').'"/>';
switch($param['type']) {
case 'text':
$result = '<input type="text" class="form-control" style="margin-top: 5px;" placeholder="'.((isset($param['placeholder'])) ? $param['placeholder'] : '').'"/>';
break;
default:
$result = '<input type="text" class="form-control" style="margin-top: 5px;" placeholder="'.((isset($param['placeholder'])) ? $param['placeholder'] : '').'"/>';
break;
}
return $result;
}
/** /**
* @return string * @return string
*/ */
......
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