@@ -13,13 +13,13 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | public static $categories = [ |
16 | - [ "id" => 1, "name" => "Restoration"], |
|
17 | - [ "id" => 2, "name" => "Forgetting Priorities"], |
|
18 | - [ "id" => 3, "name" => "Anxiety"], |
|
19 | - [ "id" => 4, "name" => "Speeding Up"], |
|
20 | - [ "id" => 5, "name" => "Ticked Off"], |
|
21 | - [ "id" => 6, "name" => "Exhausted"], |
|
22 | - [ "id" => 7, "name" => "Relapse/Moral Failure"], |
|
16 | + ["id" => 1, "name" => "Restoration"], |
|
17 | + ["id" => 2, "name" => "Forgetting Priorities"], |
|
18 | + ["id" => 3, "name" => "Anxiety"], |
|
19 | + ["id" => 4, "name" => "Speeding Up"], |
|
20 | + ["id" => 5, "name" => "Ticked Off"], |
|
21 | + ["id" => 6, "name" => "Exhausted"], |
|
22 | + ["id" => 7, "name" => "Relapse/Moral Failure"], |
|
23 | 23 | ]; |
24 | 24 | |
25 | 25 | public static $colors = [ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->groupBy('date, user_id') |
85 | 85 | ->having('user_id = :user_id'); |
86 | 86 | $temp_dates = $query->all(); |
87 | - foreach($temp_dates as $temp_date) { |
|
87 | + foreach ($temp_dates as $temp_date) { |
|
88 | 88 | $past_checkin_dates[] = $this->time->convertUTCToLocal($temp_date['date']); |
89 | 89 | } |
90 | 90 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $arr = array_reduce($behaviors, function($acc, $row) { |
143 | 143 | $cat_id = $row['behavior']['category']['id']; |
144 | - if(array_key_exists($cat_id, $acc)) { |
|
144 | + if (array_key_exists($cat_id, $acc)) { |
|
145 | 145 | $acc[$cat_id]['count'] += $row['count']; |
146 | 146 | } else { |
147 | 147 | $acc[$cat_id] = [ |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | public static function decorate(Array $uo, $with_category = false) { |
161 | - foreach($uo as &$o) { |
|
162 | - if($behavior = \common\models\Behavior::getBehavior('id', $o['behavior_id'])) { |
|
161 | + foreach ($uo as &$o) { |
|
162 | + if ($behavior = \common\models\Behavior::getBehavior('id', $o['behavior_id'])) { |
|
163 | 163 | $o['behavior'] = $behavior; |
164 | - if($with_category) { |
|
164 | + if ($with_category) { |
|
165 | 165 | $o['behavior']['category'] = \common\models\Category::getCategory('id', $o['behavior']['category_id']); |
166 | 166 | } |
167 | 167 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | ->having('user_id = :user_id') |
183 | 183 | ->orderBy('count DESC'); |
184 | 184 | |
185 | - if($limit instanceof \DateTime) { |
|
185 | + if ($limit instanceof \DateTime) { |
|
186 | 186 | list($start, $end) = $this->time->getUTCBookends($limit->format('Y-m-d')); |
187 | 187 | $query->params += [':start_date' => $start, ':end_date' => $end]; |
188 | 188 | $query->where('user_id=:user_id AND date > :start_date AND date <= :end_date'); |
189 | - } else if(is_int($limit)) { |
|
189 | + } else if (is_int($limit)) { |
|
190 | 190 | $query->limit($limit); |
191 | 191 | } |
192 | 192 |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function findByPasswordResetToken($token) |
143 | 143 | { |
144 | - if(!$this->isTokenCurrent($token)) { |
|
144 | + if (!$this->isTokenCurrent($token)) { |
|
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function findByVerifyEmailToken($token) |
161 | 161 | { |
162 | - if($this->isTokenConfirmed($token)) return null; |
|
162 | + if ($this->isTokenConfirmed($token)) return null; |
|
163 | 163 | |
164 | 164 | $user = $this->findOne([ |
165 | 165 | 'verify_email_token' => [$token, $token . self::CONFIRMED_STRING], |
166 | 166 | 'status' => self::STATUS_ACTIVE, |
167 | 167 | ]); |
168 | 168 | |
169 | - if($user) { |
|
170 | - if(!$this->isTokenConfirmed($token) && |
|
169 | + if ($user) { |
|
170 | + if (!$this->isTokenConfirmed($token) && |
|
171 | 171 | !$this->isTokenCurrent($token, 'user.verifyAccountTokenExpire')) { |
172 | 172 | return null; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function isTokenCurrent($token, String $paramPath = 'user.passwordResetTokenExpire') { |
187 | 187 | $expire = \Yii::$app->params[$paramPath]; |
188 | 188 | $parts = explode('_', $token); |
189 | - $timestamp = (int) end($parts); |
|
189 | + $timestamp = (int)end($parts); |
|
190 | 190 | if ($timestamp + $expire < time()) { |
191 | 191 | // token expired |
192 | 192 | return false; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param string $match the needle to search for |
202 | 202 | */ |
203 | 203 | public function isTokenConfirmed($token = null, String $match = self::CONFIRMED_STRING) { |
204 | - if(is_null($token)) $token = $this->verify_email_token; |
|
204 | + if (is_null($token)) $token = $this->verify_email_token; |
|
205 | 205 | return substr($token, -strlen($match)) === $match; |
206 | 206 | } |
207 | 207 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | public function isVerified() { |
229 | - if(is_null($this->verify_email_token)) { |
|
229 | + if (is_null($this->verify_email_token)) { |
|
230 | 230 | // for old users who verified their accounts before the addition of |
231 | 231 | // '_confirmed' to the token |
232 | 232 | return true; |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | public function sendEmailReport($date) { |
323 | - if(!$this->send_email) return false; // no partner emails set |
|
323 | + if (!$this->send_email) return false; // no partner emails set |
|
324 | 324 | list($start, $end) = $this->time->getUTCBookends($date); |
325 | - $user_behaviors = $this->getUserBehaviors($date); |
|
325 | + $user_behaviors = $this->getUserBehaviors($date); |
|
326 | 326 | $user_questions = $this->getUserQuestions($date); |
327 | 327 | |
328 | 328 | $messages = []; |
329 | - foreach($this->getPartnerEmails() as $email) { |
|
330 | - if($email) { |
|
329 | + foreach ($this->getPartnerEmails() as $email) { |
|
330 | + if ($email) { |
|
331 | 331 | $messages[] = Yii::$app->mailer->compose('checkinReport', [ |
332 | 332 | 'user' => $this, |
333 | 333 | 'email' => $email, |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'behaviors_list' => \common\models\Behavior::$behaviors, |
340 | 340 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
341 | 341 | ->setReplyTo($this->email) |
342 | - ->setSubject($this->email." has completed a Faster Scale check-in") |
|
342 | + ->setSubject($this->email . " has completed a Faster Scale check-in") |
|
343 | 343 | ->setTo($email); |
344 | 344 | } |
345 | 345 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | return \Yii::$app->mailer->compose('signupNotification') |
413 | 413 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
414 | 414 | ->setTo(\Yii::$app->params['adminEmail']) |
415 | - ->setSubject('A new user has signed up for '.\Yii::$app->name) |
|
415 | + ->setSubject('A new user has signed up for ' . \Yii::$app->name) |
|
416 | 416 | ->send(); |
417 | 417 | } |
418 | 418 | |
@@ -420,22 +420,22 @@ discard block |
||
420 | 420 | return \Yii::$app->mailer->compose('verifyEmail', ['user' => $this]) |
421 | 421 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
422 | 422 | ->setTo($this->email) |
423 | - ->setSubject('Please verify your '.\Yii::$app->name .' account') |
|
423 | + ->setSubject('Please verify your ' . \Yii::$app->name . ' account') |
|
424 | 424 | ->send(); |
425 | 425 | } |
426 | 426 | |
427 | 427 | public function sendDeleteNotificationEmail() { |
428 | - if($this->send_email) return false; // no partner emails set |
|
428 | + if ($this->send_email) return false; // no partner emails set |
|
429 | 429 | |
430 | 430 | $messages = []; |
431 | - foreach(array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
|
432 | - if($email) { |
|
431 | + foreach (array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
|
432 | + if ($email) { |
|
433 | 433 | $messages[] = Yii::$app->mailer->compose('partnerDeleteNotification', [ |
434 | 434 | 'user' => $this, |
435 | 435 | 'email' => $email |
436 | 436 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
437 | 437 | ->setReplyTo($this->email) |
438 | - ->setSubject($this->email." has deleted their The Faster Scale App account") |
|
438 | + ->setSubject($this->email . " has deleted their The Faster Scale App account") |
|
439 | 439 | ->setTo($email); |
440 | 440 | } |
441 | 441 | } |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | public function getUserQuestions($local_date = null) { |
447 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
447 | + if (is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
448 | 448 | $questions = $this->getQuestionData($local_date); |
449 | 449 | return $this->parseQuestionData($questions); |
450 | 450 | } |
451 | 451 | |
452 | 452 | public function getUserBehaviors($local_date = null) { |
453 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
453 | + if (is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
454 | 454 | |
455 | 455 | $behaviors = $this->getBehaviorData($local_date); |
456 | 456 | $behaviors = $this->user_behavior::decorateWithCategory($behaviors); |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | public function parseQuestionData($questions) { |
461 | - if(!$questions) return []; |
|
461 | + if (!$questions) return []; |
|
462 | 462 | |
463 | 463 | $question_answers = []; |
464 | - foreach($questions as $question) { |
|
464 | + foreach ($questions as $question) { |
|
465 | 465 | $behavior = $question['behavior']; |
466 | 466 | |
467 | 467 | $question_answers[$behavior['id']]['question'] = [ |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | } |
480 | 480 | |
481 | 481 | public function parseBehaviorData($behaviors) { |
482 | - if(!$behaviors) return []; |
|
482 | + if (!$behaviors) return []; |
|
483 | 483 | |
484 | 484 | $opts_by_cat = []; |
485 | - foreach($behaviors as $behavior) { |
|
485 | + foreach ($behaviors as $behavior) { |
|
486 | 486 | $indx = $behavior['behavior']['category_id']; |
487 | 487 | |
488 | 488 | $opts_by_cat[$indx]['category_name'] = $behavior['behavior']['category']['name']; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | return rtrim( |
575 | 575 | strtr( |
576 | 576 | base64_encode( |
577 | - hash('sha256', $this->id."::".$this->created_at, true) |
|
577 | + hash('sha256', $this->id . "::" . $this->created_at, true) |
|
578 | 578 | ), |
579 | 579 | '+/', '-_'), |
580 | 580 | '='); |
@@ -159,7 +159,9 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function findByVerifyEmailToken($token) |
161 | 161 | { |
162 | - if($this->isTokenConfirmed($token)) return null; |
|
162 | + if($this->isTokenConfirmed($token)) { |
|
163 | + return null; |
|
164 | + } |
|
163 | 165 | |
164 | 166 | $user = $this->findOne([ |
165 | 167 | 'verify_email_token' => [$token, $token . self::CONFIRMED_STRING], |
@@ -201,7 +203,9 @@ discard block |
||
201 | 203 | * @param string $match the needle to search for |
202 | 204 | */ |
203 | 205 | public function isTokenConfirmed($token = null, String $match = self::CONFIRMED_STRING) { |
204 | - if(is_null($token)) $token = $this->verify_email_token; |
|
206 | + if(is_null($token)) { |
|
207 | + $token = $this->verify_email_token; |
|
208 | + } |
|
205 | 209 | return substr($token, -strlen($match)) === $match; |
206 | 210 | } |
207 | 211 | |
@@ -320,7 +324,10 @@ discard block |
||
320 | 324 | } |
321 | 325 | |
322 | 326 | public function sendEmailReport($date) { |
323 | - if(!$this->send_email) return false; // no partner emails set |
|
327 | + if(!$this->send_email) { |
|
328 | + return false; |
|
329 | + } |
|
330 | + // no partner emails set |
|
324 | 331 | list($start, $end) = $this->time->getUTCBookends($date); |
325 | 332 | $user_behaviors = $this->getUserBehaviors($date); |
326 | 333 | $user_questions = $this->getUserQuestions($date); |
@@ -425,7 +432,10 @@ discard block |
||
425 | 432 | } |
426 | 433 | |
427 | 434 | public function sendDeleteNotificationEmail() { |
428 | - if($this->send_email) return false; // no partner emails set |
|
435 | + if($this->send_email) { |
|
436 | + return false; |
|
437 | + } |
|
438 | + // no partner emails set |
|
429 | 439 | |
430 | 440 | $messages = []; |
431 | 441 | foreach(array_merge([$this->email], $this->getPartnerEmails()) as $email) { |
@@ -444,13 +454,17 @@ discard block |
||
444 | 454 | } |
445 | 455 | |
446 | 456 | public function getUserQuestions($local_date = null) { |
447 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
457 | + if(is_null($local_date)) { |
|
458 | + $local_date = $this->time->getLocalDate(); |
|
459 | + } |
|
448 | 460 | $questions = $this->getQuestionData($local_date); |
449 | 461 | return $this->parseQuestionData($questions); |
450 | 462 | } |
451 | 463 | |
452 | 464 | public function getUserBehaviors($local_date = null) { |
453 | - if(is_null($local_date)) $local_date = $this->time->getLocalDate(); |
|
465 | + if(is_null($local_date)) { |
|
466 | + $local_date = $this->time->getLocalDate(); |
|
467 | + } |
|
454 | 468 | |
455 | 469 | $behaviors = $this->getBehaviorData($local_date); |
456 | 470 | $behaviors = $this->user_behavior::decorateWithCategory($behaviors); |
@@ -458,7 +472,9 @@ discard block |
||
458 | 472 | } |
459 | 473 | |
460 | 474 | public function parseQuestionData($questions) { |
461 | - if(!$questions) return []; |
|
475 | + if(!$questions) { |
|
476 | + return []; |
|
477 | + } |
|
462 | 478 | |
463 | 479 | $question_answers = []; |
464 | 480 | foreach($questions as $question) { |
@@ -479,7 +495,9 @@ discard block |
||
479 | 495 | } |
480 | 496 | |
481 | 497 | public function parseBehaviorData($behaviors) { |
482 | - if(!$behaviors) return []; |
|
498 | + if(!$behaviors) { |
|
499 | + return []; |
|
500 | + } |
|
483 | 501 | |
484 | 502 | $opts_by_cat = []; |
485 | 503 | foreach($behaviors as $behavior) { |
@@ -14,103 +14,103 @@ discard block |
||
14 | 14 | class Behavior extends \yii\base\BaseObject implements BehaviorInterface |
15 | 15 | { |
16 | 16 | public static $behaviors = [ |
17 | - ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | - ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | - ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | - ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | - ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | - ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | - ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | - ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | - ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | - ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | - ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | - ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | - ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | - ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | - ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | - ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | - ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | - ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | - ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | - ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | - ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | - ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | - ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | - ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | - ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | - ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | - ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | - ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | - ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | - ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | - ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | - ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | - ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | - ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | - ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | - ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | - ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | - ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | - ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | - ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | - ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | - ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | - ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | - ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | - ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | - ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | - ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | - ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | - ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | - ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | - ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | - ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | - ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | - ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | - ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | - ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | - ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | - ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | - ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | - ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | - ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | - ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | - ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | - ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | - ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | - ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | - ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | - ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | - ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | - ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | - ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | - ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | - ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | - ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | - ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | - ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | - ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | - ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | - ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | - ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | - ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | - ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | - ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | - ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | - ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | - ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | - ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | - ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | - ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | - ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | - ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | - ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | - ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | - ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | - ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | - ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | - ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
17 | + ['id' => 1, 'name' => 'no current secrets', 'category_id' => 1], |
|
18 | + ['id' => 2, 'name' => 'resolving problems', 'category_id' => 1], |
|
19 | + ['id' => 3, 'name' => 'identifying fears and feelings', 'category_id' => 1], |
|
20 | + ['id' => 4, 'name' => 'keeping commitments to meetings, prayer, family, church, people, goals, and self', 'category_id' => 1], |
|
21 | + ['id' => 5, 'name' => 'being open', 'category_id' => 1], |
|
22 | + ['id' => 6, 'name' => 'being honest', 'category_id' => 1], |
|
23 | + ['id' => 7, 'name' => 'making eye contact', 'category_id' => 1], |
|
24 | + ['id' => 8, 'name' => 'reaching out to others', 'category_id' => 1], |
|
25 | + ['id' => 9, 'name' => 'increasing in relationships with God and others', 'category_id' => 1], |
|
26 | + ['id' => 10, 'name' => 'accountability', 'category_id' => 1], |
|
27 | + ['id' => 11, 'name' => 'secrets', 'category_id' => 2], |
|
28 | + ['id' => 12, 'name' => 'bored', 'category_id' => 2], |
|
29 | + ['id' => 13, 'name' => 'less time/energy for God, meetings, and church', 'category_id' => 2], |
|
30 | + ['id' => 14, 'name' => 'avoiding support and accountability towards people', 'category_id' => 2], |
|
31 | + ['id' => 15, 'name' => 'superficial conversations', 'category_id' => 2], |
|
32 | + ['id' => 16, 'name' => 'sarcasm', 'category_id' => 2], |
|
33 | + ['id' => 17, 'name' => 'isolating yourself', 'category_id' => 2], |
|
34 | + ['id' => 18, 'name' => 'changes in goals', 'category_id' => 2], |
|
35 | + ['id' => 19, 'name' => 'flirting', 'category_id' => 2], |
|
36 | + ['id' => 20, 'name' => 'obsessed with relationships', 'category_id' => 2], |
|
37 | + ['id' => 21, 'name' => 'breaking promises/commitments', 'category_id' => 2], |
|
38 | + ['id' => 22, 'name' => 'neglecting family', 'category_id' => 2], |
|
39 | + ['id' => 23, 'name' => 'preoccupation with material things, television, or entertainment', 'category_id' => 2], |
|
40 | + ['id' => 24, 'name' => 'procrastination', 'category_id' => 2], |
|
41 | + ['id' => 25, 'name' => 'lying', 'category_id' => 2], |
|
42 | + ['id' => 26, 'name' => 'over-confidence', 'category_id' => 2], |
|
43 | + ['id' => 27, 'name' => 'hiding money', 'category_id' => 2], |
|
44 | + ['id' => 28, 'name' => 'worry', 'category_id' => 3], |
|
45 | + ['id' => 29, 'name' => 'using profanity', 'category_id' => 3], |
|
46 | + ['id' => 30, 'name' => 'being fearful', 'category_id' => 3], |
|
47 | + ['id' => 31, 'name' => 'being resentful', 'category_id' => 3], |
|
48 | + ['id' => 32, 'name' => 'replaying old, negative thoughts', 'category_id' => 3], |
|
49 | + ['id' => 33, 'name' => 'perfectionism', 'category_id' => 3], |
|
50 | + ['id' => 34, 'name' => 'judging others\' motives', 'category_id' => 3], |
|
51 | + ['id' => 35, 'name' => 'making goals and lists you can\'t complete', 'category_id' => 3], |
|
52 | + ['id' => 36, 'name' => 'poor planning', 'category_id' => 3], |
|
53 | + ['id' => 37, 'name' => 'mind reading', 'category_id' => 3], |
|
54 | + ['id' => 38, 'name' => 'fantasy', 'category_id' => 3], |
|
55 | + ['id' => 41, 'name' => 'co-dependent rescuing', 'category_id' => 3], |
|
56 | + ['id' => 42, 'name' => 'sleep problems', 'category_id' => 3], |
|
57 | + ['id' => 43, 'name' => 'trouble concentrating', 'category_id' => 3], |
|
58 | + ['id' => 44, 'name' => 'seeking/creating drama', 'category_id' => 3], |
|
59 | + ['id' => 45, 'name' => 'gossip', 'category_id' => 3], |
|
60 | + ['id' => 46, 'name' => 'using over-the-counter medication for pain, sleep, and weight control', 'category_id' => 3], |
|
61 | + ['id' => 47, 'name' => 'super busy', 'category_id' => 4], |
|
62 | + ['id' => 48, 'name' => 'workaholic', 'category_id' => 4], |
|
63 | + ['id' => 49, 'name' => 'can\'t relax', 'category_id' => 4], |
|
64 | + ['id' => 50, 'name' => 'driving too fast', 'category_id' => 4], |
|
65 | + ['id' => 51, 'name' => 'avoiding slowing down', 'category_id' => 4], |
|
66 | + ['id' => 52, 'name' => 'feeling driven', 'category_id' => 4], |
|
67 | + ['id' => 53, 'name' => 'in a hurry', 'category_id' => 4], |
|
68 | + ['id' => 54, 'name' => 'can\'t turn off thoughts', 'category_id' => 4], |
|
69 | + ['id' => 55, 'name' => 'skipping meals', 'category_id' => 4], |
|
70 | + ['id' => 56, 'name' => 'binge eating (usually at night)', 'category_id' => 4], |
|
71 | + ['id' => 57, 'name' => 'overspending', 'category_id' => 4], |
|
72 | + ['id' => 58, 'name' => 'can\'t identify own feelings/needs', 'category_id' => 4], |
|
73 | + ['id' => 59, 'name' => 'repetitive, negative thoughts', 'category_id' => 4], |
|
74 | + ['id' => 60, 'name' => 'irritable', 'category_id' => 4], |
|
75 | + ['id' => 61, 'name' => 'making excuses for "having to do it all"', 'category_id' => 4], |
|
76 | + ['id' => 62, 'name' => 'dramatic mood swings', 'category_id' => 4], |
|
77 | + ['id' => 63, 'name' => 'lust', 'category_id' => 4], |
|
78 | + ['id' => 64, 'name' => 'too much caffeine', 'category_id' => 4], |
|
79 | + ['id' => 65, 'name' => 'over exercising', 'category_id' => 4], |
|
80 | + ['id' => 66, 'name' => 'nervousness', 'category_id' => 4], |
|
81 | + ['id' => 67, 'name' => 'difficulty being alone or with people', 'category_id' => 4], |
|
82 | + ['id' => 68, 'name' => 'difficulty listening to others', 'category_id' => 4], |
|
83 | + ['id' => 69, 'name' => 'avoiding support', 'category_id' => 4], |
|
84 | + ['id' => 70, 'name' => 'procrastination causing crises in money, work, or relationships', 'category_id' => 5], |
|
85 | + ['id' => 71, 'name' => 'sarcasm', 'category_id' => 5], |
|
86 | + ['id' => 72, 'name' => 'black and white, all or nothing thinking', 'category_id' => 5], |
|
87 | + ['id' => 73, 'name' => 'feeling that no one understands', 'category_id' => 5], |
|
88 | + ['id' => 74, 'name' => 'overreacting', 'category_id' => 5], |
|
89 | + ['id' => 75, 'name' => 'road rage', 'category_id' => 5], |
|
90 | + ['id' => 76, 'name' => 'constant resentments', 'category_id' => 5], |
|
91 | + ['id' => 77, 'name' => 'pushing others away', 'category_id' => 5], |
|
92 | + ['id' => 78, 'name' => 'increased isolation', 'category_id' => 5], |
|
93 | + ['id' => 79, 'name' => 'blaming', 'category_id' => 5], |
|
94 | + ['id' => 80, 'name' => 'self pity', 'category_id' => 5], |
|
95 | + ['id' => 81, 'name' => 'arguing', 'category_id' => 5], |
|
96 | + ['id' => 82, 'name' => 'irrationality', 'category_id' => 5], |
|
97 | + ['id' => 83, 'name' => 'can\'t handle criticism', 'category_id' => 5], |
|
98 | + ['id' => 84, 'name' => 'defensive', 'category_id' => 5], |
|
99 | + ['id' => 85, 'name' => 'people are avoiding you', 'category_id' => 5], |
|
100 | + ['id' => 86, 'name' => 'having to be right', 'category_id' => 5], |
|
101 | + ['id' => 87, 'name' => 'digestive problems', 'category_id' => 5], |
|
102 | + ['id' => 88, 'name' => 'headaches', 'category_id' => 5], |
|
103 | + ['id' => 89, 'name' => 'obsessive (stuck) thoughts', 'category_id' => 5], |
|
104 | + ['id' => 90, 'name' => 'can\'t forgive', 'category_id' => 5], |
|
105 | + ['id' => 91, 'name' => 'feeling grandiose (superior)', 'category_id' => 5], |
|
106 | + ['id' => 92, 'name' => 'intimidation', 'category_id' => 5], |
|
107 | + ['id' => 93, 'name' => 'feeling aggressive', 'category_id' => 5], |
|
108 | + ['id' => 94, 'name' => 'depressed', 'category_id' => 6], |
|
109 | + ['id' => 95, 'name' => 'panicked', 'category_id' => 6], |
|
110 | + ['id' => 96, 'name' => 'confused', 'category_id' => 6], |
|
111 | + ['id' => 97, 'name' => 'hopeless', 'category_id' => 6], |
|
112 | + ['id' => 98, 'name' => 'sleeping too much or too little', 'category_id' => 6], |
|
113 | + ['id' => 99, 'name' => 'can\'t cope', 'category_id' => 6], |
|
114 | 114 | ['id' => 100, 'name' => 'overwhelmed', 'category_id' => 6], |
115 | 115 | ['id' => 101, 'name' => 'crying for "no reason"', 'category_id' => 6], |
116 | 116 | ['id' => 102, 'name' => 'can\'t think', 'category_id' => 6], |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | public function getCategories() { |
181 | 181 | $bhvrs_by_cat = AH::index(self::$behaviors, null, 'category_id'); |
182 | 182 | $cats = AH::index(\common\models\Category::$categories, "id"); |
183 | - foreach($cats as $id => &$cat) { |
|
183 | + foreach ($cats as $id => &$cat) { |
|
184 | 184 | $cat['behavior_count'] = count($bhvrs_by_cat[$id]); // add count of behaviors |
185 | 185 | $cat['category_id'] = $cat['id']; // rename id to category_id |
186 | 186 | unset($cat['id']); |