@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if ($form->load(Yii::$app->request->post()) && $form->validate()) { |
40 | 40 | $form->compiled_behaviors = $form->compileBehaviors(); |
41 | 41 | |
42 | - if(sizeof($form->compiled_behaviors) === 0) { |
|
42 | + if (sizeof($form->compiled_behaviors) === 0) { |
|
43 | 43 | return $this->redirect(['view']); |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | return $this->redirect(['questions']); |
51 | 51 | } else { |
52 | - $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
52 | + $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
53 | 53 | return $this->render('index', [ |
54 | 54 | 'categories' => Yii::$container->get(CategoryInterface::class)::$categories, |
55 | 55 | 'model' => $form, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $date = Yii::$container->get(TimeInterface::class)->getLocalDate(); |
65 | 65 | |
66 | 66 | $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date); |
67 | - if(count($user_behaviors) === 0) { |
|
67 | + if (count($user_behaviors) === 0) { |
|
68 | 68 | return $this->redirect(['view']); |
69 | 69 | } |
70 | 70 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $form->deleteToday(); |
75 | 75 | |
76 | 76 | $behaviors = $user_behavior->findAll($form->getUserBehaviorIds()); |
77 | - if($result = $form->saveAnswers($behaviors)) { |
|
77 | + if ($result = $form->saveAnswers($behaviors)) { |
|
78 | 78 | |
79 | - if(Yii::$app->user->identity->send_email) { |
|
80 | - if(Yii::$app->user->identity->sendEmailReport($date)) { |
|
79 | + if (Yii::$app->user->identity->send_email) { |
|
80 | + if (Yii::$app->user->identity->sendEmailReport($date)) { |
|
81 | 81 | Yii::$app->session->setFlash('success', 'Your check-in is complete. A notification has been sent to your report partners.'); |
82 | 82 | } else { |
83 | 83 | Yii::$app->session->setFlash('success', 'Your check-in is complete.'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $raw_pie_data = $user_behavior::decorateWithCategory($user_behavior->getBehaviorsWithCounts()); |
132 | 132 | $answer_pie = $user_behavior->getBehaviorsByCategory($raw_pie_data); |
133 | 133 | |
134 | - $pie_data = [ |
|
134 | + $pie_data = [ |
|
135 | 135 | "labels" => array_column($answer_pie, "name"), |
136 | 136 | "datasets" => [[ |
137 | 137 | "data" => array_map('intval', array_column($answer_pie, "count")), |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | $checkins = $user_behavior->getCheckInBreakdown($period); |
167 | 167 | |
168 | 168 | $accum = []; |
169 | - foreach($checkins as $date => $cats) { |
|
170 | - for($i = 1; $i <= 7; $i ++) { |
|
169 | + foreach ($checkins as $date => $cats) { |
|
170 | + for ($i = 1; $i <= 7; $i++) { |
|
171 | 171 | $accum[$i][] = array_key_exists($i, $cats) ? $cats[$i]['count'] : []; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | 175 | $bar_datasets = []; |
176 | - foreach($accum as $idx => $data) { |
|
176 | + foreach ($accum as $idx => $data) { |
|
177 | 177 | $bar_datasets[] = [ |
178 | 178 | 'label' => ($category::getCategories())[$idx], |
179 | 179 | 'backgroundColor' => $category::$colors[$idx]['color'], |