Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1879

Přidáno uživatelem Michal Kliment před více než 11 roky(ů)

Upravy:

- fixes #512 - Moznost povoleni/zakazani VoIP

Zobrazit rozdíly:

freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'mode is required' => 'Mód je povinný.',
'module settings' => 'Nastavení modulů',
'module status timeout' => 'Časová hranice stavu modulů',
'modules' => 'Moduly',
'monitoring' => 'Monitoring',
'monitoring detail of device' => 'Detail monitoringu zařízení',
'monitoring error' => 'Monitoring chyba',
......
'voicemail has been successfully changed' => 'Hlasová schránka byla úspěšně změněna.',
'voip account' => 'VoIP účet',
'voip admins' => 'VoIP správci',
'voip enabled' => 'VoIP povoleno',
'voip information' => 'VoIP informace',
'voip not enabled at this moment' => 'VoIP není v současné době povoleno',
'voip number' => 'VoIP číslo',
freenetis/branches/1.1/application/i18n/cs_CZ/help.php
'login_name' => 'Přihlašovací jméno do systému je nutné k přihlášení. Přihlašovací jmémo může obsahovat znaky anglické abecedy, čísla, těčku a podtržítko, minimální délka jména je 5 znaků.',
'mail_to_field' => 'Políčko bere jako vstup login uživatele, kterému chcete odeslat zprávu. Příjemců můžete uvést více, oddělte je čárkou.',
'member_name' => 'Vyplňujte v případě přidávání nějaké organizace. Pokud připojujete běžného člena, tak jako výsledné jméno člena se použije jeho jméno a příjmení.',
'modules' => 'Modul přidává některé nové funkce do systému. Moduly zde mohou být povoleny/zakázány.',
'monitoring_email_to' => 'E-mailová adresa, na kterou se budou odesílat informace z monitoringu.',
'monitoring_notification_down_host_interval' => 'Určuje do kolika minut od výpadku zařízení se bude zasílat upozornění. Výchozí hodnota je 10, pro zakázání zasílání nastavte 0.',
'monitoring_notification_up_host_interval' => 'Určuje do kolika minut od znovu funkčnosti zařízení se bude zasílat upozornění. Výchozí hodnota je 5, pro zakázání zasílání nastavte 0.',
freenetis/branches/1.1/application/i18n/en_US/help.php
'login_name' => 'Login name is necessary for login to system. Login name can contains letters from english alphabet, numbers and dot. It has to contains at least 5 letters.',
'mail_to_field' => 'The box takes as input the user login you want to send a message. You can specify multiple recipients, separate them with commas.',
'member_name' => 'Fill in the case of adding an organization. If you connect a regular member, as the final name of the member uses his name and surname.',
'modules' => 'Module adds some new functionality to system. Modules can be enabled/disabled here.',
'monitoring_notification_down_host_interval' => 'It determines for how many minutes from host failure will be send notification. Default valueis 10, to disable of sending notifications set 0.',
'monitoring_notification_up_host_interval' => 'It determines for how many minutes from host funcionality again will be send notification. Default valueis 5, to disable of sending notifications set 0.',
'monitoring_notification_interval' => 'It is interval of loop of notification in minutes. Default value is (notification will be every minute).',
freenetis/branches/1.1/application/controllers/web_interface.php
*/
public function callback($user = null, $pass = null, $number = null)
{
// VoIP is not enabled, quit
if (!Settings::get('voip_enabled'))
return;
if ($user == null || $pass == null || $number == null)
{
echo 'No input data';
freenetis/branches/1.1/application/controllers/users.php
$arr_contact_types[$i] = $enum_type_model->get_value($contact->type);
}
$voip_sip = new Voip_sip_Model();
$voip = $voip_sip->get_record_by_user_limited($user_id);
if ($voip->count() == 0)
// voip is enabled
if (Settings::get('voip_enabled'))
{
$voip = '<span style="color:red;">'.__('Nonactive').'</span> - '
.html::anchor('voip/add/'.$user_id, __('Activate'));
$voip_sip = new Voip_sip_Model();
$voip = $voip_sip->get_record_by_user_limited($user_id);
if ($voip->count() == 0)
{
$voip = '<span style="color:red;">'.__('Nonactive').'</span> - '
.html::anchor('voip/add/'.$user_id, __('Activate'));
}
else
{
$voip = html::anchor(
'voip/show/'.$voip->current()->user_id,
$voip->current()->name
);
}
}
else
{
$voip = html::anchor(
'voip/show/'.$voip->current()->user_id,
$voip->current()->name
);
}
$aro_groups = $user->get_aro_groups_of_user($user_id);
......
$view->content->user_data = $user;
$view->content->contacts = $contacts;
$view->content->contact_types = $arr_contact_types;
$view->content->voip = $voip;
$view->content->voip = Settings::get('voip_enabled') ? $voip : '';
$view->content->aro_groups = $aro_groups;
$view->content->admin_devices_grid = $admin_devices_grid;
$view->content->engineer_devices_grid = $engineer_devices_grid;
freenetis/branches/1.1/application/controllers/voip.php
class VoIP_Controller extends Controller
{
/**
* Only check whether is VoIP enabled
*
* @author Michal Kliment
*/
public function __construct()
{
parent::__construct();
// voip is not enabled, quit
if (!Settings::get('voip_enabled'))
Controller::error (ACCESS);
}
/**
* Redirects to show all
*/
public function index()
freenetis/branches/1.1/application/controllers/members.php
}
/******** VoIP ***********/
if (Settings::get('voip_enabled'))
{
// VoIP SIP model
$voip_sip = new Voip_sip_Model();
// Gets sips
$voip = $voip_sip->get_all_record_by_member_limited($member->id);
// Has driver?
$has_driver = Billing::instance()->has_driver();
// Account
$b_account = null;
// Check account only if have SIP
if ($voip->count())
{
$b_account = Billing::instance()->get_account($member->id);
}
// VoIP SIP model
$voip_sip = new Voip_sip_Model();
// Gets sips
$voip = $voip_sip->get_all_record_by_member_limited($member->id);
// Has driver?
$has_driver = Billing::instance()->has_driver();
// Account
$b_account = null;
// Check account only if have SIP
if ($voip->count())
{
$b_account = Billing::instance()->get_account($member->id);
}
$voip_grid = new Grid('members', null, array
(
'separator' => '<br /><br />',
'use_paginator' => false,
'use_selector' => false
));
$voip_grid = new Grid('members', null, array
(
'separator' => '<br /><br />',
'use_paginator' => false,
'use_selector' => false
));
$voip_grid->field('id')
->label('ID');
$voip_grid->field('id')
->label('ID');
$voip_grid->field('callerid')
->label(__('Number'));
$actions = $voip_grid->grouped_action_field();
$actions->add_action('user_id')
->icon_action('phone')
->url('voip/show')
->label('Show VoIP account');
$actions->add_action('user_id')
->icon_action('member')
->url('users/show')
->label('Show user who own this VoIP account');
$voip_grid->datasource($voip);
$voip_grid->field('callerid')
->label(__('Number'));
if ($has_driver && $b_account)
{
$voip_grid->add_new_button(
'voip_calls/show_by_member/'.$member->id,
__('List of all calls')
);
if ($member->id != 1)
{
$voip_grid->add_new_button(
'transfers/add_voip/'.$account->id,
__('Recharge VoIP credit')
);
}
}
$actions = $voip_grid->grouped_action_field();
$actions->add_action('user_id')
->icon_action('phone')
->url('voip/show')
->label('Show VoIP account');
$actions->add_action('user_id')
->icon_action('member')
->url('users/show')
->label('Show user who own this VoIP account');
$voip_grid->datasource($voip);
if ($has_driver && $b_account)
{
$voip_grid->add_new_button(
'voip_calls/show_by_member/'.$member->id,
__('List of all calls')
);
if ($member->id != 1)
{
$voip_grid->add_new_button(
'transfers/add_voip/'.$account->id,
__('Recharge VoIP credit')
);
}
}
}
// finds date of expiration of member fee
$expiration_date = (isset($account)) ? self::get_expiration_date($account) : '';
......
$view->content->user_name = $user_name;
$view->content->users_grid = $users_grid;
$view->content->redir_grid = $redir_grid;
$view->content->voip_grid = $voip_grid;
$view->content->voip_grid = (Settings::get('voip_enabled')) ? $voip_grid : '';
$view->content->membership_interrupts_grid = $membership_interrupts_grid;
$view->content->contacts = $contacts;
$view->content->contact_types = $contact_types;
......
$view->content->domicile_gps = $domicile_gps;
$view->content->town = (isset($town)) ? $town : '';
$view->content->country = (isset($country)) ? $country : '';
$view->content->billing_has_driver = $has_driver;
$view->content->billing_account = $b_account;
$view->content->count_voip = count($voip);
$view->content->billing_has_driver = (Settings::get('voip_enabled')) ? $has_driver : FALSE;
$view->content->billing_account = (Settings::get('voip_enabled')) ? $b_account : NULL;
$view->content->count_voip = (Settings::get('voip_enabled')) ? count($voip) : 0;
$view->content->total_traffic = @$total_traffic;
$view->content->today_traffic = @$today_traffic;
$view->content->month_traffic = @$month_traffic;
freenetis/branches/1.1/application/controllers/voip_calls.php
class VoIP_calls_Controller extends Controller
{
/**
* Only check whether is VoIP enabled
*
* @author Michal Kliment
*/
public function __construct()
{
parent::__construct();
// voip is not enabled, quit
if (!Settings::get('voip_enabled'))
Controller::error (ACCESS);
}
/**
* Redirects to show all
*/
public function index()
freenetis/branches/1.1/application/controllers/settings.php
{
parent::__construct();
$this->sections = array
(
'info' => __('Info'),
'system' => __('System'),
'approval' => __('Approval'),
'email' => __('Email'),
'sms' => __('SMS'),
'voip' => __('VoIP'),
'notifications' => __('Notifications'),
'qos' => __('QoS'),
'monitoring' => __('Monitoring'),
'logging' => __('Logging'),
'registration_export' => __('Export of registration')
);
$this->sections = array();
$this->sections['info'] = __('Info');
$this->sections['system'] = __('System');
$this->sections['approval'] = __('Approval');
$this->sections['email'] = __('Email');
$this->sections['sms'] = __('SMS');
// is voip enabled
if (Settings::get('voip_enabled'))
$this->sections['voip'] = __('VoIP');
$this->sections['notifications'] = __('Notifications');
// is QoS enabled
if (Settings::get('qos_enabled'))
$this->sections['qos'] = __('QoS');
// is monitoring enabled
if (Settings::get('monitoring_enabled'))
$this->sections['monitoring'] = __('Monitoring');
$this->sections['logging'] = __('Logging');
$this->sections['registration_export'] = __('Export of registration');
}
/**
......
$this->form->input('currency')
->rules('length[3,40]|required')
->value(Settings::get('currency'));
$this->form->group(__('Modules').' '.help::hint('modules'));;
// self-registration
$this->form->radio('self_registration')
......
->label('Forgotten password')
->options(arr::bool())
->default(Settings::get('forgotten_password'));
// VoIP
$this->form->radio('voip_enabled')
->label('VoIP')
->options(arr::bool())
->default(Settings::get('voip_enabled'));
// QoS
$this->form->radio('qos_enabled')
->label('QoS')
->options(arr::bool())
->default(Settings::get('qos_enabled'));
// Monitoring
$this->form->radio('monitoring_enabled')
->label('Monitoring')
->options(arr::bool())
->default(Settings::get('monitoring_enabled'));
$this->form->group('E-mail settings');
......
public function qos()
{
// access control
if (!$this->acl_check_edit('Settings_Controller', 'system'))
if (!Settings::get('qos_enabled') || !$this->acl_check_edit('Settings_Controller', 'system'))
Controller::error(ACCESS);
// creating of new forge
$this->form = new Forge('settings/qos');
$this->form->group('Variables for QoS');
$this->form->checkbox('qos_enabled')
->value('1')
->label('Enable QoS');
if (Settings::get('qos_enabled') == 1)
$this->form->qos_enabled->checked('checked');
$this->form->input('qos_total_speed')
->rules('valid_speed_size')
......
public function voip()
{
// access control
if (!$this->acl_check_edit(get_class($this), 'system'))
if (!Settings::get('voip_enabled') || !$this->acl_check_edit(get_class($this), 'system'))
Controller::error(ACCESS);
// creating of new forge
......
public function monitoring()
{
// access control
if (!$this->acl_check_edit('Settings_Controller', 'system'))
if (!Settings::get('monitoring_enabled') || !$this->acl_check_edit('Settings_Controller', 'system'))
Controller::error(ACCESS);
// creating of new forge
......
$this->form->group('Variables for monitoring');
$this->form->checkbox('monitoring_enabled')
->value('1')
->label('Enable monitoring');
if (Settings::get('monitoring_enabled') == 1)
$this->form->monitoring_enabled->checked('checked');
$this->form->input('monitoring_server_ip_address')
->rules('valid_ip_address')
->value(Settings::get('monitoring_server_ip_address'))
freenetis/branches/1.1/application/views/members/show.php
<td><?php echo number_format((float)$member->debt_payment_rate, 2, ',', ' ').' '.$this->settings->get('currency') ?></td>
</tr>
<?php } ?>
<?php if ($billing_has_driver && ($billing_account != null))
<?php if (Settings::get('voip_enabled') && $billing_has_driver && ($billing_account != null))
{ ?>
<tr>
<th colspan="2"><?php echo __('VoIP information') ?></th>
......
<br />
<?php } ?>
<?php if (Settings::get('voip_enabled')): ?>
<h3><?php echo __('VoIP')?></h3>
<?php echo $voip_grid ?>
<br />
<?php endif ?>
<h3><?php echo __('Membership interrupts')?></h3>
<?php echo $membership_interrupts_grid ?>
freenetis/branches/1.1/application/views/menu.php
</li>
<?php endif ?>
<?php if ($this->user_has_voip): ?>
<?php if (Settings::get('voip_enabled') && $this->user_has_voip): ?>
<li><?php echo html::anchor('voip_calls/show_by_user/'.$this->user_id, __('My VoIP calls')) ?></li>
<?php endif ?>
......
<li><?php echo html::anchor('links/show_all', __('Links')) ?></li>
<li><?php echo html::anchor('vlans/show_all', __('Vlans')) ?></li>
<?php if ($this->acl_check_view('VoIP_Controller', 'voip')): ?>
<?php if (Settings::get('voip_enabled') && $this->acl_check_view('VoIP_Controller', 'voip')): ?>
<li><?php echo html::anchor('voip/show_all', __('VoIP')) ?></li>
<?php endif ?>
freenetis/branches/1.1/application/views/users/show.php
</table>
<table class="extended" cellspacing="0" style="float:left; margin-left:10px; width:360px;">
<?php if ($user_data->id != 1) { ?>
<?php if (Settings::get('voip_enabled') && $user_data->id != 1) { ?>
<tr>
<th colspan="2"><?php echo __('VoIP') ?></th>
</tr>

Také k dispozici: Unified diff