Skip to content

Commit 39d5032

Browse files
committed
Уведомления о невыполненных задачах в панели управления
1 parent ee46a97 commit 39d5032

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

TodoModule.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

models/Todo.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)