-
Notifications
You must be signed in to change notification settings - Fork 1
/
aj.tariff.php
106 lines (94 loc) · 3.06 KB
/
aj.tariff.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
include_once('UserControl/userControl.php');
include_once('LowLevel/emailSend.php');
include_once('UserControl/userTariff.php');
if (isset($_POST['action']))
{
echo (string)UserTariff::GetSoWorkersCount();
}
if (isset($_POST['emailAdd']))
{
$result = array();
$iUserKey = (int)UserControl::IsLoginExistReturnId($_POST['emailAdd']);
$sEmail = $_POST['emailAdd'];
if ($iUserKey==-1)
{
if(!UserTariff::IsDoubleAddEmail($_POST['emailAdd']))
{
Email::CommunicationNewmail($sEmail, 'Приглашение ARM2009', 'Вас пригласили в Арм2009.');
UserTariff::SetSoWorkerEmail($sEmail);
$sDiv = userTariffPage::getDiv($sEmail);
$result['email'] =$sDiv;
}
else
{
$result['error'] = 'exist';
}
}
else
{
if(!UserTariff::IsDoubleAddKey($iUserKey))
{
$sEmail = UserTariff::SetSoWorker($iUserKey);
$sDiv = userTariffPage::getDiv($sEmail, 'none', $iUserKey);
$result['user'] = $sDiv;
}
else
{
$result['error'] = 'exist';
}
}
if (UserTariff::IsCanAddSoWorkers()=='false') {$result['full'] = 'true';}
echo json_encode($result);
}
if (isset($_POST['userDel']))
{
UserTariff::DelSoWorker($_POST['userDel']);
echo (string)UserTariff::IsCanAddSoWorkers();
}
if (isset($_POST['emailDel']))
{
UserTariff::DelSoWorkerEmail($_POST['emailDel']);
echo UserTariff::IsCanAddSoWorkers();
}
if (isset($_POST['checkLogin']))
{
echo UserControl::GetUserFieldValue("sName");
}
class userTariffPage
{
function getDiv($sEmail,$sVisible = 'none', $sValue=-1)
{
if ($sValue==-1)
{
return '<div style="display: '.$sVisible.';" class="block block_left_round block_right_round block_mail pointer block_delete" value ="'.$sEmail.'" title="Отозвать приглашение" id="popup" onClick="deleteDivEmail(this)">'.$sEmail.'<br /><span class="comment">Не зарегистрирован как пользователь АРМ 2009 и получил приглашение от Вашего имени</span></div>';
}
else
{
return '<div style="display: '.$sVisible.';" class="block block_left_round block_right_round block_user pointer block_delete" value ="'.$sValue.'" title="Отозвать приглашение" id="popup" onClick="deleteDivUser(this)">'.UserControl::GetUserName($sValue).'<br /><span class="comment">Зарегистрирован в АРМ 2009 и имеет полный доступ к Вашему информационному пространству</span></div>';
}
}
public static function getDivs()
{
$vResult = UserTariff::GetSoWorkersResult();
$sResult = '';
//$vResult = mysql_fetch_assoc($vResult);
if (mysql_num_rows($vResult) > 0)
{
while($vRow = mysql_fetch_array($vResult))
{
if((int)$vRow['idChild'] > 0)
{
$sNameUser = UserControl::GetUserName($vRow['idChild']);
$sResult = $sResult.userTariffPage::getDiv($sNameUser, "yes", $vRow['idChild']);
}
else
{
$sResult = $sResult.userTariffPage::getDiv($vRow['sEmail'], "yes");
}
}
}
return $sResult;
}
}
?>