function get_users_count_in_package($package)
{
    $count = 0;
    $tariff_plans_ids = Mysql::getInstance()->from('package_in_plan')->where(array('optional' => 0, 'package_id' => $package['id']))->get()->all('plan_id');
    $tariff_plans = Mysql::getInstance()->from('tariff_plan')->in('id', $tariff_plans_ids)->get()->all();
    foreach ($tariff_plans as $tariff) {
        $count += get_users_count_in_tariff($tariff);
    }
    $count += Mysql::getInstance()->from('user_package_subscription')->where(array('package_id' => $package['id']))->count()->get()->counter();
    return $count;
}
Exemplo n.º 2
0
                    <td><?php 
echo _('Title');
?>
</td>
                    <td><?php 
echo _('Total users');
?>
</td>
                    <td>&nbsp;</td>
                </tr>
                <?php 
foreach ($tariff_plans as $plan) {
    echo '<tr ' . ($plan['user_default'] == 1 ? 'style="background-color: #ecffec;"' : '') . '>';
    echo '<td>' . $plan['external_id'] . '</td>';
    echo '<td>' . $plan['name'] . '</td>';
    echo '<td style="color: #555">' . get_users_count_in_tariff($plan) . '</td>';
    echo '<td>';
    echo '<a href="?edit=1&id=' . $plan['id'] . '">edit</a>&nbsp;';
    echo '<a href="?del=1&id=' . $plan['id'] . '" onclick="if(confirm(\'' . _('Do you really want to delete this record?') . '\')){return true}else{return false}">del</a>';
    echo '</td>';
    echo '</tr>';
}
?>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center">
            <br>
            <br>
            <form method="POST">