File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -90,4 +90,21 @@ public function getNavigation()
9090 ],
9191 ];
9292 }
93+
94+ public function checkSelf ()
95+ {
96+ $ messages = [];
97+ $ count = Todo::model ()->countUnfinished ();
98+
99+ if (!$ count ) {
100+ return false ;
101+ }
102+
103+ $ messages [WebModule::CHECK_NOTICE ][] = [
104+ 'type ' => WebModule::CHECK_NOTICE ,
105+ 'message ' => CHtml::link ('Невыполненных задач - ' . $ count , ['/todo/todoBackend/index ' ]),
106+ ];
107+
108+ return $ messages ;
109+ }
93110}
Original file line number Diff line number Diff line change @@ -73,4 +73,14 @@ public function search()
7373 ]
7474 ]);
7575 }
76+
77+ /**
78+ * Count all unfinished tasks
79+ *
80+ * @return int
81+ */
82+ public function countUnfinished ()
83+ {
84+ return self ::model ()->count ('status != :status ' , [':status ' => TodoStatusHelper::STATUS_DONE ]);
85+ }
7686}
You can’t perform that action at this time.
0 commit comments