Skip to content
Permalink
Browse files
Уведомления о невыполненных задачах в панели управления
  • Loading branch information
sabian committed Jan 30, 2016
1 parent ee46a97 commit 39d5032b30ddf6229c506a2787983ff25cf501ae
Showing with 27 additions and 0 deletions.
  1. +17 −0 TodoModule.php
  2. +10 −0 models/Todo.php
@@ -90,4 +90,21 @@ public function getNavigation()
],
];
}

public function checkSelf()
{
$messages = [];
$count = Todo::model()->countUnfinished();

if(!$count) {
return false;
}

$messages[WebModule::CHECK_NOTICE][] = [
'type' => WebModule::CHECK_NOTICE,
'message' => CHtml::link('Невыполненных задач - ' . $count, ['/todo/todoBackend/index']),
];

return $messages;
}
}
@@ -73,4 +73,14 @@ public function search()
]
]);
}

/**
* Count all unfinished tasks
*
* @return int
*/
public function countUnfinished()
{
return self::model()->count('status != :status', [':status' => TodoStatusHelper::STATUS_DONE]);
}
}

0 comments on commit 39d5032

Please sign in to comment.