/
item.php
120 lines (120 loc) · 4.9 KB
/
item.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Open Source Social Network
*
* @package Open Source Social Network (OSSN)
* @author OSSN Core Team <info@openteknik.com>
* @copyright (C) OpenTeknik LLC
* @license Open Source Social Network License (OSSN LICENSE) http://www.opensource-socialnetwork.org/licence
* @link https://www.opensource-socialnetwork.org/
*/
if(isset($params['items'])) {
foreach ($params['items'] as $fields) {
if(isset($fields['text'])) {
foreach ($fields['text'] as $item) {
if(!isset($item['params'])) {
$item['params'] = array();
}
$args = array();
$args['name'] = $item['name'];
$args['value'] = '';
if(isset($item['value'])) {
$args['value'] = $item['value'];
}
$args['placeholder'] = ossn_print("{$item['name']}");
if(isset($item['class'])) {
$args['class'] = 'form-control ' . $item['class'];
} else {
$args['class'] = 'form-control ';
}
$vars = array_merge($args, $item['params']);
echo "<div class='text'>";
//[E]make the label arg assigned to any label of user/field #1646
if(isset($item['label']) && !is_bool($item['label'])) {
echo '<label>' . $item['label'] . '</label>';
} elseif((isset($item['label']) && $item['label'] === true) || (isset($params['label']) && $params['label'] === true)) {
echo '<label>' . ossn_print("{$item['name']}") . '</label>';
}
echo ossn_plugin_view('input/text', $vars);
echo '</div>';
}
}
if(isset($fields['textarea'])) {
foreach ($fields['textarea'] as $item) {
if(!isset($item['params'])) {
$item['params'] = array();
}
$args = array();
$args['name'] = $item['name'];
$args['value'] = '';
if(isset($item['value'])) {
$args['value'] = $item['value'];
}
$args['placeholder'] = ossn_print("{$item['name']}");
if(isset($item['class'])) {
$args['class'] = 'form-control ' . $item['class'];
} else {
$args['class'] = 'form-control ';
}
$vars = array_merge($args, $item['params']);
echo "<div class='text'>";
//[E]make the label arg assigned to any label of user/field #1646
if(isset($item['label']) && !is_bool($item['label'])) {
echo '<label>' . $item['label'] . '</label>';
} elseif((isset($item['label']) && $item['label'] === true) || (isset($params['label']) && $params['label'] === true)) {
echo '<label>' . ossn_print("{$item['name']}") . '</label>';
}
echo ossn_plugin_view('input/textarea', $vars);
echo '</div>';
}
}
if(isset($fields['dropdown'])) {
foreach ($fields['dropdown'] as $item) {
$vars = array();
$vars['name'] = $item['name'];
$args = array_merge($vars, $item);
echo "<div class='dropdown-block'>";
//[E]make the label arg assigned to any label of user/field #1646
if(isset($item['label']) && !is_bool($item['label'])) {
echo '<label>' . $item['label'] . '</label>';
} elseif((isset($item['label']) && $item['label'] === true) || (isset($params['label']) && $params['label'] === true)) {
echo '<label>' . ossn_print("{$item['name']}") . '</label>';
}
echo ossn_plugin_view('input/dropdown', $args);
echo '</div>';
}
}
if(isset($fields['radio'])) {
foreach ($fields['radio'] as $item) {
$vars = array();
$vars['name'] = $item['name'];
$args = array_merge($vars, $item);
echo "<div class='radio-block-container'>";
//[E]make the label arg assigned to any label of user/field #1646
if(isset($item['label']) && !is_bool($item['label'])) {
echo '<label>' . $item['label'] . '</label>';
} elseif((isset($item['label']) && $item['label'] === true) || (isset($params['label']) && $params['label'] === true)) {
echo '<label>' . ossn_print("{$item['name']}") . '</label>';
}
echo ossn_plugin_view('input/radio', $args);
echo '</div>';
}
}
if(isset($fields['checkbox'])) {
foreach ($fields['checkbox'] as $item) {
echo "<div class='checkbox-block-container'>";
$vars = array();
$vars['name'] = $item['name'];
$args = array_merge($vars, $item);
//[E]make the label arg assigned to any label of user/field #1646
if(isset($item['label']) && !is_bool($item['label'])) {
echo '<label>' . $item['label'] . '</label>';
} elseif((isset($item['label']) && $item['label'] === true) || (isset($params['label']) && $params['label'] === true)) {
echo '<label>' . ossn_print("{$item['name']}") . '</label>';
}
echo ossn_plugin_view('input/checkbox', $args);
echo '</div>';
}
}
}
}