-
Notifications
You must be signed in to change notification settings - Fork 16
/
SoundBattLevel.php
34 lines (29 loc) · 1.17 KB
/
SoundBattLevel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* Сценарий для Majordomo
* Голосовые оповещение об уровне заряда батареи телефона
* @author Alex Sokolov <[email protected]>
* @copyright Alex Sokolov http://blog.gelezako.com (c)
* @version 0.1 ([Sep 14, 2017])
**/
// $params['battlevel'] (ex 'заряд');
//вычисление окончание слова "процент"
function humidity($battlevel){
if($battlevel >= 11 and $battlevel <= 14){
$percent=" процентов ";
}
else{
while ($battlevel > 9){
$battlevel=$battlevel%10;
}
if($battlevel == 0 or $battlevel >= 5 and $battlevel <= 9){
$percent= процентов ; }
if($battlevel == 1){
$percent= процент ; }
if($battlevel >= 2 and $battlevel <= 4){
$percent= процента ; }
}
return $percent;
}
(int)$battlevel=gg("Alex.Battlevel");
say("Уровень заряда батареи телефона ".$battlevel." ".humidity($battlevel),2);
if($battlevel<=20)say("Батарею телефона немешало бы подзарядить",2);