File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99namespace skeeks \yii2 \scheduleInputWidget ;
1010
1111use yii \base \InvalidConfigException ;
12+ use yii \helpers \ArrayHelper ;
1213use yii \helpers \Html ;
1314use yii \widgets \InputWidget ;
1415
@@ -64,4 +65,39 @@ public function run()
6465 'hiddenInput ' => $ hiddenInput ,
6566 ]);
6667 }
68+
69+ /**
70+ * @param array $work_time
71+ * @return array
72+ */
73+ static public function getWorkingData ($ work_time = [])
74+ {
75+ $ daysLib = [
76+ 1 => "Пн " ,
77+ 2 => "Вт " ,
78+ 3 => "Ср " ,
79+ 4 => "Чт " ,
80+ 5 => "Пт " ,
81+ 6 => "Сб " ,
82+ 7 => "Вс " ,
83+ ];
84+ $ result = [];
85+ if ($ work_time ) {
86+ $ result = $ work_time ;
87+
88+ foreach ($ work_time as $ key => $ row ) {
89+ $ daysString = [];
90+ $ days = ArrayHelper::getValue ($ row , 'day ' );
91+ if ($ days ) {
92+ foreach ($ days as $ dayKey => $ day ) {
93+ $ daysString [$ day ] = $ daysLib [$ day ];
94+ }
95+ }
96+
97+ $ result [$ key ]['daysStrings ' ] = $ daysString ;
98+ }
99+ }
100+
101+ return $ result ;
102+ }
67103}
You can’t perform that action at this time.
0 commit comments