Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2215

Přidáno uživatelem Ondřej Fibich před asi 11 roky(ů)

Novinky:
- closes #783: Individualni nastaveni aktivace upozorneni

Zobrazit rozdíly:

freenetis/branches/1.1/application/controllers/members.php
);
}
if ($this->acl_check_edit('Members_Controller', 'notification_settings', $member->id))
{
$member_links[] = html::anchor(
'members/settings/'.$member->id,
__('Edit member settings'),
array
(
'class' => 'popup_link'
)
);
}
if (!$is_applicant)
{
if (!$is_former)
......
$view->content->link_back = '';
$view->render(TRUE);
} // end of edit function
/**
* Enables to edid member settings (e.g. notification settings).
*
* @param integer $member_id Member ID
*/
public function settings($member_id = NULL)
{
// bad parameter
if (!isset($member_id) || !is_numeric($member_id))
self::warning(PARAMETER);
$member = new Member_Model($member_id);
// member doesn't exist
if (!$member->id)
self::error(RECORD);
if (!$this->acl_check_edit('Members_Controller', 'notification_settings', $member_id))
self::error(ACCESS);
// form
$form = new Forge('members/settings/'.$member->id);
$form->hidden('checkbox_hack');
$ns_group = $form->group(__('Notification settings') . ' ' .
help::hint('notification_member_settings'));
$ns_group->checkbox('notification_by_redirection')
->label('Enable notification by redirection')
->checked($member->notification_by_redirection);
$ns_group->checkbox('notification_by_email')
->label('Enable notification by e-mail')
->checked($member->notification_by_email);
$ns_group->checkbox('notification_by_sms')
->label('Enable notification by SMS messages')
->checked($member->notification_by_sms);
$form->submit('Edit');
// form validation
if($form->validate())
{
$form_data = $form->as_array();
try
{
$member->transaction_start();
$member->notification_by_redirection = $form_data['notification_by_redirection'];
$member->notification_by_email = $form_data['notification_by_email'];
$member->notification_by_sms = $form_data['notification_by_sms'];
$member->save_throwable();
$member->transaction_commit();
status::success('Member settings has been successfully updated.');
$this->redirect('members/show/', $member_id);
}
catch (Exception $e)
{
$member->transaction_rollback();
status::error('Error - cant update member settings.', $e);
}
}
$headline = __('Edit member settings');
// breadcrumbs navigation
$breadcrumbs = breadcrumbs::add()
->link('members/show_all', 'Members',
$this->acl_check_view(get_class($this), 'members'))
->disable_translation()
->link('members/show/'.$member->id,
"ID $member->id - $member->name",
$this->acl_check_view(
get_class($this), 'members', $member->id
)
)
->text($headline);
$view = new View('main');
$view->breadcrumbs = $breadcrumbs->html();
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline . ' ' . $member->name;
$view->content->form = $form->html();
$view->content->link_back = '';
$view->render(TRUE);
}
/**
* Function ends membership of member.
*
freenetis/branches/1.1/application/controllers/messages.php
if (($message->id == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->id == Message_Model::DEBTOR_MESSAGE ||
$message->id == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE) && !Settings::get('finance_enabled'))
$message->id == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE) &&
!Settings::get('finance_enabled'))
{
Controller::error(ACCESS);
}
......
->type('dropdown')
->options(notification::redirection_form_array())
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
freenetis/branches/1.1/application/controllers/notifications.php
if (module::e('redirection'))
{
$selected = Notifications_Controller::ACTIVATE;
if (!$member->notification_by_redirection)
{
$selected = Notifications_Controller::KEEP;
}
$form->dropdown('redirection')
->options(notification::redirection_form_array());
->options(notification::redirection_form_array())
->selected($selected);
}
if (module::e('email'))
{
$selected = Notifications_Controller::ACTIVATE;
if (!$member->notification_by_email)
{
$selected = Notifications_Controller::KEEP;
}
$form->dropdown('email')
->label('E-mail')
->options(notification::redirection_form_array(TRUE));
->options(notification::redirection_form_array(TRUE))
->selected($selected);
}
if (module::e('sms'))
{
$selected = Notifications_Controller::ACTIVATE;
if (!$member->notification_by_sms)
{
$selected = Notifications_Controller::KEEP;
}
$form->dropdown('sms')
->label('SMS message')
->options(notification::redirection_form_array(TRUE));
->options(notification::redirection_form_array(TRUE))
->selected($selected);
}
$form->submit('Send');
......
->enable_translation()
->text('Notification setting');
// member settings properties info
$mediums = array();
if (!$member->notification_by_redirection && module::e('redirection'))
{
$mediums[] = __('redirection', array(), 1);
}
if (!$member->notification_by_email && module::e('email'))
{
$mediums[] = 'e-mail';
}
if (!$member->notification_by_sms && module::e('sms'))
{
$mediums[] = 'SMS';
}
if (count($mediums))
{
status::info('This member do not want to be notified by: %s',
TRUE, implode(', ', $mediums));
}
// view
$view = new View('main');
$view->breadcrumbs = $breadcrumbs;
$view->title = $headline;
......
$filter_form->as_sql()
);
$grid = new Grid('notifications/subnet', '', array
$grid = new Grid('notifications/members', '', array
(
'use_paginator' => false,
'use_selector' => false,
......
->type('dropdown')
->options(notification::redirection_form_array())
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
Log_queue_Model::info($m, implode("\n", $info_messages));
}
// redirect
url::redirect('members/show_all');
url::redirect('members/show_all/'.server::query_string());
}
}
}
......
->type('dropdown')
->options(notification::redirection_form_array())
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array())
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
);
}
......
$this->acl_check_view('Devices_Controller', 'devices',$device->user->member_id))
->enable_translation()
->text('Notification setting');
$view = new View('main');
$view->breadcrumbs = $breadcrumbs;
$view->title = $headline;
......
->type('dropdown')
->options(notification::redirection_form_array())
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
->type('dropdown')
->options(notification::redirection_form_array(TRUE))
->callback(
'callback::notification_form_field',
$message->type, $message->ignore_whitelist
'callback::notification_form_field', $message
)->class('center');
}
......
* @param integer $notification_type Defines type of notification:
* - notification to members (members arrays contains member IDs) [default]
* - notification to users (members arrays contains user IDs)
* @param boolean $ignore_member_notif_settings Should be member notification setting ignored?
* @return array stats of count of added (keys redirection, email, sms)
* @throws Exception On any error with translated message
*/
......
$activate_sms = TRUE, $truncate_redir = FALSE,
$remove_redir = FALSE, $notify_former_members = FALSE,
$notify_interrupted_members = FALSE,
$notification_type = self::TYPE_MEMBER)
$notification_type = self::TYPE_MEMBER,
$ignore_member_notif_settings = FALSE)
{
// variables
$error_prefix = __('Error during automatic activation of notification messages');
......
unset($association);
}
// member notification settings only enabled for self cancel messages
$ignore_mnotif_settings = $ignore_member_notif_settings || !$message->self_cancel;
// get member IDs or user IDS array
$member_ids = array();
......
{
if ($notification_type == self::TYPE_USER)
{
$member_ips = $ip_model->get_ip_addresses_of_user($member_ids);
$member_ips = $ip_model->get_ip_addresses_of_user(
$member_ids, NULL, NULL, $ignore_mnotif_settings
);
}
else
{
$member_ips = $ip_model->get_ip_addresses_of_member($member_ids);
$member_ips = $ip_model->get_ip_addresses_of_member(
$member_ids, NULL, NULL, $ignore_mnotif_settings
);
}
foreach ($member_ips as $member_ip)
......
$contacts = $uc_model->get_contacts_by_user_and_type(
$member_ids, Contact_Model::TYPE_EMAIL,
$message->ignore_whitelist, $notify_former_members,
$notify_interrupted_members
$notify_interrupted_members, $ignore_mnotif_settings
);
}
else
......
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_ids, Contact_Model::TYPE_EMAIL,
$message->ignore_whitelist, $notify_former_members,
$notify_interrupted_members
$notify_interrupted_members, $ignore_mnotif_settings
);
}
// send email
......
$contacts = $uc_model->get_contacts_by_user_and_type(
$member_ids, Contact_Model::TYPE_PHONE,
$message->ignore_whitelist, $notify_former_members,
$notify_interrupted_members
$notify_interrupted_members, $ignore_mnotif_settings
);
}
else
......
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_ids, Contact_Model::TYPE_PHONE,
$message->ignore_whitelist, $notify_former_members,
$notify_interrupted_members
$notify_interrupted_members, $ignore_mnotif_settings
);
}
// send email
......
$stats[] = self::notify(
$message, $dis_redir_assoc, $user_id, $comment,
FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE,
$notification_type
$notification_type, TRUE
);
/* make new redirection */
......
$stats[] = self::notify(
$message, $en_redir_assoc, $user_id, $comment,
TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
$notification_type
$notification_type, TRUE
);
/* send email notification */
......
$stats[] = self::notify(
$message, $em_notif_assoc, $user_id, $comment,
FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE,
$notification_type
$notification_type, TRUE
);
/* send SMS notification */
......
$stats[] = self::notify(
$message, $sms_notif_assoc, $user_id, $comment,
FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE,
$notification_type
$notification_type, TRUE
);
/* sum stats from all parts */
freenetis/branches/1.1/application/controllers/settings.php
else
{
$issaved = FALSE;
$message = __('Cannot open .htaccess for writing');
$message = __('Cannot open %s for writing', '.htaccess');
// if not saved to htaccess do not save to database
unset($form_data['suffix']);
......
else
{
$issaved = FALSE;
$message = __('Failed to read from .htaccess');
$message = __('Failed to read from %s', '.htaccess');
// if not saved to htaccess do not save to database
unset($form_data['suffix']);
......
else
{
$issaved = FALSE;
$message = __('File .htaccess does not exists and cannot be created');
$message = __('File %s does not exists and cannot be created', '.htaccess');
// if not saved to htaccess do not save to database
unset($form_data['suffix']);
freenetis/branches/1.1/application/helpers/callback.php
public static function notification_form_field ($item, $name, $input, $args = array())
{
$selected = Notifications_Controller::KEEP;
$message_type = $args[0];
$ignore_whitelist = $args[1];
$message = $args[0];
switch ($message_type)
// valid message?
if ($message instanceof Message_Model && $message && $message->id)
{
case Message_Model::DEBTOR_MESSAGE:
if ($item->balance < Settings::get('debtor_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $ignore_whitelist))
switch ($message->type)
{
case Message_Model::DEBTOR_MESSAGE:
if ($item->balance < Settings::get('debtor_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $message->ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
case Message_Model::PAYMENT_NOTICE_MESSAGE:
if ($item->balance >= Settings::get('debtor_boundary')
&& $item->balance < Settings::get('payment_notice_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $message->ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
case Message_Model::USER_MESSAGE:
if (!$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $message->ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
}
// member notification settings if message is self cancelable
// overrides global settings
if ($selected == Notifications_Controller::ACTIVATE &&
$message->self_cancel != Message_Model::SELF_CANCEL_DISABLED)
{
switch ($name)
{
$selected = Notifications_Controller::ACTIVATE;
case 'redirection':
if (isset($item->notification_by_redirection) &&
!$item->notification_by_redirection)
{
$selected = Notifications_Controller::KEEP;
$input->title(__('Disabled in member settings'));
}
break;
case 'email':
if (isset($item->notification_by_email) &&
!$item->notification_by_email)
{
$selected = Notifications_Controller::KEEP;
$input->title(__('Disabled in member settings'));
}
break;
case 'sms':
if (isset($item->notification_by_sms) &&
!$item->notification_by_sms)
{
$selected = Notifications_Controller::KEEP;
$input->title(__('Disabled in member settings'));
}
break;
}
break;
case Message_Model::PAYMENT_NOTICE_MESSAGE:
if ($item->balance >= Settings::get('debtor_boundary')
&& $item->balance < Settings::get('payment_notice_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
case Message_Model::USER_MESSAGE:
if (!$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
}
$input->selected($selected);
echo $input->html();
}
$input->selected($selected);
echo $input->html();
}
/**
freenetis/branches/1.1/application/i18n/cs_CZ/help.php
'monthly_member_fee' => 'Zobrazuje výši aktuálního měsíčního členského příspěvku člena. Tato částka je každý měsíc členovi stržena z kreditu.',
'multiple_dropdown' => 'Více hodnot lze vybrat označení myší se stiknutou klávesou CTRL.',
'never_redirect' => 'Zapnete-li tuto volbu, pak nebude možné tuto IP adresu nikdy přesměrovat běžným přesměrováním. Toto je vhodné zejména pro významné partnery jako jsou úřady, školy atd.',
'notification_member_settings' => 'Možnost povolit/zakázat aktivaci upozorňovacích zpráv, které jsou samozrušitelné.',
'notification_settings' => 'Na této stránce můžete nastavit přesměrování a posílání zpráv členům.<br>Aktivovat - povolit přesměrování nebo odeslání zprávy členovi.<br>Beze změny - neměnit nastavení přesměrování nebo zakázání posílání zpráv.<br>Deaktivovat - zakázat přesměrování člena.<br>Text v políčku komentář nahradí tag {comment} v SMS a E-mailové zprávě.',
'old_upgrade_system' => 'Zastaralý systém pro zvýšení databáze detekován, řešení lze nalézt v <a href="http://wiki.freenetis.org/index.php/Automatická_změna_struktury_databáze#P.C5.99echod_ze_star.C5.A1.C3.AD_verze_mechanismu">dokumentaci</a>.',
'other_subaccounts' => 'Ostatní podúčty jsou vlastně již všechny ostatní používané účty ve Freenetisu, které se vnitřně nijak nedělí. Jde například o účet přijatých členských příspěvků nebo pokladny a tak dále. Freenetis pochopitelně nevyužívá celou účetní osnovu ČR, vzhledem k charakteru občanského sdružení.',
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'cannot load heading of invoice' => 'Nemohu načíst hlavičku faktury',
'cannot load mac address, reason' => 'Nemohu načíst MAC adresu, důvod',
'cannot load services - data missing' => 'Nemohu načíst služby - data chybí',
'cannot open %s for writing' => 'Nelze otevřít %s v režimu pro zápis',
'cannot open uploaded bank listing file!' => 'Nelze otevřít nahraný soubor s bankovním výpisem!',
'cannot parse fio listing header!' => 'Nelze parsovat hlavičku Fio výpisu!',
'cannot reject connection request' => 'Nelze zamítnout požadavek k připojení.',
......
'directory "upload" is not writable, change access rights to be able upload your own logo' => 'Adresář "upload" není zapisovatelný, změňte přístupové práva pro možnost nahrát vlastní logo.',
'disable this subnet' => 'Zakázat tuto podsíť',
'disabled' => 'Vypnuto',
'disabled in member settings' => 'Zakázáno v nastavení člena',
'disagree' => 'Nesouhlas',
'discount private services from phone keepers credit account' => 'Strhnout soukromé služby z kreditního účtu držitelů telefonů',
'discounted from credit accounts' => 'Strženo z kreditních účtů',
......
'edit maximum count of allowed subnets of member' => 'Upravit maximální počet povolených podsítí člena',
'edit member' => 'Upravit člena',
'edit member limit' => 'Upravit limit člena',
'edit member settings' => 'Upravit nastavení člena',
'edit membership transfer' => 'Upravit převod členství',
'edit message' => 'Upravit zprávu',
'edit monitoring parameter of device' => 'Upravit parametry monitoringu zařízení',
......
'enable integrity test (all numbers in invoice has to be in extended statement)' => 'Povolit test na celistvost (každé číslo ve faktuře musí být v podrobném výpisu)',
'enable mysql event scheduler' => 'Povolit MySQL plánovač akcí',
'enable monitoring' => 'Povolit monitoring',
'enable notification by redirection' => 'Povolit upozornění přesměrováním',
'enable notification by e-mail' => 'Povolit upozornění e-mailem',
'enable notification by sms messages' => 'Povolit upozornění SMS zprávami',
'enable qos' => 'Povolit QoS',
'enable this subnet' => 'Povolit tuto podsíť',
'enable ulogd' => 'Zapnout ulogd',
......
'error - cant update account' => 'Chyba - nelze upravit účet.',
'error - cant update additional contacts' => 'Chyba - nelze upravit další kontakty.',
'error - cant update member' => 'Chyba - nelze upravit člena.',
'error - cant update member settings.' => 'Chyba - nelze upravit nastavení člena',
'error - cant update private phone contacts' => 'Chyba - nelze upravit soukromý telefonní kontakt.',
'error - cant update template' => 'Chyba - nelze upravit šablonu.',
'error - cant update transfer' => 'Chyba - nelze upravit převod.',
......
'facility' => 'Služba',
'failed' => 'Selhání',
'failed polls' => 'Neúspěšných pokusů',
'failed to read from %s' => 'Selhalo čtení z %s',
'file %s does not exists and cannot be created' => 'Soubor %s neexistuje a nemůže být vytvořen',
'fatal error' => 'Kritická chyba',
'favourites' => 'Oblíbené',
'favourite page has been saved' => 'Oblíbená stránka byla uložena',
......
'january' => 'Leden',
'june' => 'Červen',
'july' => 'Červenec',
'keep' => 'Ponechat',
'key' => 'Klíč',
'key has been successfully added' => 'Klíč byl úspěšně přidán.',
'key has been successfully deleted' => 'Klíč byl úspěšně smazán.',
......
'member has been successfully updated' => 'Člen byl úspěšně upraven.',
'member id' => 'ID člena',
'member name' => 'Jméno člena (organizace)',
'member settings has been successfully updated' => 'Nastavení člena byla úspěšně upravena',
'member_name' => 'Jméno člena (organizace)',
'members' => 'Členové',
'members account' => 'Účet člena',
......
'this mac is in collision with other interfaces on the same subnet' => 'Tato MAC adresa je v kolizi s jiným rozhraním na stejné podsíti',
'this member has already set up this fee type for this interval' => 'Tento člen má již nastaven tento typ poplatku pro tento interval.',
'this member has default system member fee %d %s' => 'Tento člen má výchozí systémový členský příspěvek %d %s.',
'this member do not want to be notified by: %s' => 'Tento člen nechce být upozorňován pomocí: %s',
'this message was redirected to you from your account at %s' => 'Tato zpráva byla přesměrována z vašeho účtu na %s',
'this month has been already deducted!' => 'Tento měsíc už byl stržen!',
'this month traffic' => 'Provoz za tento měsíc',
freenetis/branches/1.1/application/i18n/en_US/help.php
'monthly_member_fee' => 'Shows value current monthly member fee of member. This amount is every month deducted from member\'s credit.',
'multiple_dropdown' => 'More values can be selected by mouse with triggered CTRL key.',
'never_redirect' => 'When you turn on this option, it is not possible to redirect an IP address never ordinary redirection. This is particularly suitable for major partners such as offices, schools, etc.',
'notification_member_settings' => 'Enables to disable/enable activation of notification messages that are self cancelable.',
'notification_settings' => 'On this page you can set redirection and sending messages to members.<br>Activate - enable redirection or sending messages to member.<br>Without change - don\'t change redirection setting or disable sending messages.<br>Deactivate - disable redirection for member.<br>Text in comment field will replace {comment} tag in SMS and E-mail message.',
'old_upgrade_system' => 'Old upgrade system detected, please see <a href="http://wiki.freenetis.org/index.php/Automatická_změna_struktury_databáze#P.C5.99echod_ze_star.C5.A1.C3.AD_verze_mechanismu">documentation</a> for solution.',
'other_subaccounts' => 'Other sub-accounts are in fact already used by all other accounts in Freenetisu that no internally dividing. These include the account taken of contributions or the box office and so on. Freenetis obviously does not use a chart of accounts Republic, given the nature of the civic association.',
freenetis/branches/1.1/application/models/device_admin.php
1 AS sms, dam.id AS member_id, dam.type as member_type,
whitelisted, IF(mi.id IS NOT NULL, 1, 0) AS interrupt,
dam.name AS member_name, dau.id AS dau_id,
CONCAT(dau.name, ' ', dau.surname) AS dau_name
CONCAT(dau.name, ' ', dau.surname) AS dau_name,
m.notification_by_redirection, m.notification_by_email,
m.notification_by_sms
$select_cloud_iface
FROM devices d
JOIN users u ON d.user_id = u.id
freenetis/branches/1.1/application/models/ip_address.php
* @param integer|array $member_id Member ID or array of member IDs
* @param integer $subnet_id
* @param integer $cloud_id
* @param boolean $ignore_member_notif_settings Should be member notification setting ignored?
* @return Mysql_Result
*/
public function get_ip_addresses_of_member($member_id, $subnet_id = NULL, $cloud_id = NULL)
public function get_ip_addresses_of_member($member_id, $subnet_id = NULL,
$cloud_id = NULL, $ignore_member_notif_settings = TRUE)
{
$where = "";
$cloud_subnets = "";
......
. "LEFT JOIN clouds_subnets cs ON cs.subnet_id = s.id";
}
/* member whitelist - member notification settings */
if (!$ignore_member_notif_settings)
{
$where .= " AND m.notification_by_redirection > 0 ";
}
return $this->db->query("
SELECT ip.*, i.device_id
FROM ip_addresses ip
......
LEFT JOIN ifaces i ON i.id = ip.iface_id
LEFT JOIN devices d ON d.id = i.device_id
LEFT JOIN users u ON u.id = d.user_id
LEFT JOIN members m ON m.id = IFNULL(u.member_id, ip.member_id)
WHERE $where
");
}
......
* @param integer|array $user_id User ID or array of user IDs
* @param integer $subnet_id
* @param integer $cloud_id
* @param boolean $ignore_member_notif_settings Should be member notification setting ignored?
* @return Mysql_Result
*/
public function get_ip_addresses_of_user($user_id, $subnet_id = NULL, $cloud_id = NULL)
public function get_ip_addresses_of_user($user_id, $subnet_id = NULL,
$cloud_id = NULL, $ignore_member_notif_settings = TRUE)
{
$where = "";
$cloud_subnets = "";
......
. "LEFT JOIN clouds_subnets cs ON cs.subnet_id = s.id";
}
/* member whitelist - member notification settings */
if (!$ignore_member_notif_settings)
{
$where .= " AND m.notification_by_redirection > 0 ";
}
return $this->db->query("
SELECT ip.*, i.device_id
FROM ip_addresses ip
$cloud_subnets
LEFT JOIN ifaces i ON i.id = ip.iface_id
LEFT JOIN devices d ON d.id = i.device_id
LEFT JOIN users u ON u.id = d.user_id
LEFT JOIN members m ON m.id = IFNULL(u.member_id, ip.member_id)
WHERE $where
");
}
freenetis/branches/1.1/application/models/member.php
* @property ORM_Iterator $membership_interrupts
* @property ORM_Iterator $connection_requests
* @property ORM_Iterator $members_whitelists
* @property boolean $notification_by_redirection
* @property boolean $notification_by_email
* @property boolean $notification_by_sms
*/
class Member_Model extends ORM
{
......
a_comment, a_comments_thread_id, type, entrance_date, leaving_date,
redirect_type_id, GROUP_CONCAT(DISTINCT redirect_type SEPARATOR ', ') AS redirect,
GROUP_CONCAT(DISTINCT redirect_type_text SEPARATOR ', \n') AS redirect_text,
notification_by_redirection, notification_by_email, notification_by_sms,
whitelisted, interrupt, 1 AS redirection, 1 AS email, 1 AS sms $select_cloud
FROM
(
......
a.comments_thread_id AS a_comments_thread_id,
m.type, m.entrance_date, m.leaving_date, redirect_type,
redirect_type_id, redirect_type_text, whitelisted,
interrupt $select_cloud
m.notification_by_redirection, m.notification_by_email,
m.notification_by_sms, interrupt $select_cloud
FROM
(
SELECT m.id,
......
IF(mi.id IS NOT NULL, 1, 0) AS interrupt,
m.organization_identifier, m.vat_organization_identifier,
m.comment, m.entrance_date, m.leaving_date,
m.entrance_fee, m.speed_class_id
m.entrance_fee, m.speed_class_id, m.notification_by_redirection,
m.notification_by_email, m.notification_by_sms
FROM members m
LEFT JOIN enum_types e ON m.type = e.id
LEFT JOIN translations t ON e.value = t.original_term AND lang = ?
freenetis/branches/1.1/application/models/message.php
{
return (
$type == self::USER_MESSAGE ||
$type == self::INTERRUPTED_MEMBERSHIP_MESSAGE ||
$type == self::DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE
$type == self::PAYMENT_NOTICE_MESSAGE ||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE
);
}
......
return false;
}
// member notification settings only enabled for self cancel messages
$ignore_mnotif_settings = !$message->self_cancel;
// send emails
if (Settings::get('email_enabled') &&
$email == Notifications_Controller::ACTIVATE)
{
// find email addresses of debtors
$emails = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, $message->ignore_whitelist
$member_id, Contact_Model::TYPE_EMAIL,
$message->ignore_whitelist, FALSE, FALSE,
$ignore_mnotif_settings
);
// send emails for finded emails
self::send_emails($message, $emails, $comment);
......
{
// find phone numbers of debtors
$smss = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_PHONE, $message->ignore_whitelist
$member_id, Contact_Model::TYPE_PHONE,
$message->ignore_whitelist, FALSE, FALSE,
$ignore_mnotif_settings
);
// send SMS messages for finded phone numbers
self::send_sms_messages($message, $smss, $user_id, $comment);
freenetis/branches/1.1/application/models/users_contacts.php
* @param boolean $ignore_whitelisted
* @param boolean $notify_former_members Can be former members notified?
* @param boolean $notify_interrupted_members Can be interrupted members notified?
* @param boolean $ignore_member_notif_settings Should be member notification setting ignored?
* @return Mysql_Result
*/
public function get_contacts_by_member_and_type (
$member_id, $type, $ignore_whitelisted = FALSE,
$notify_former_members = FALSE, $notify_interrupted_members = FALSE)
$notify_former_members = FALSE, $notify_interrupted_members = FALSE,
$ignore_member_notif_settings = FALSE)
{
/* where */
if (!is_array($member_id))
......
)";
}
/* member whitelist - member notification settings */
$member_whitelisted = '';
if (!$ignore_member_notif_settings)
{
switch ($type)
{
case Contact_Model::TYPE_EMAIL:
$member_whitelisted = " AND m.notification_by_email > 0 ";
break;
case Contact_Model::TYPE_PHONE:
$member_whitelisted = " AND m.notification_by_sms > 0 ";
break;
}
}
/* former members */
$former = '';
......
JOIN contacts c ON uc.contact_id = c.id AND c.type = ?
LEFT JOIN contacts_countries cc ON cc.contact_id = c.id
LEFT JOIN countries cou ON cou.id = cc.country_id
WHERE $where $former $whitelisted $interrupted
WHERE $where $former $whitelisted $member_whitelisted $interrupted
GROUP BY c.id
", $type);
}
......
* @param boolean $ignore_whitelisted
* @param boolean $notify_former_members Can be former members notified?
* @param boolean $notify_interrupted_members Can be interrupted members notified?
* @param boolean $ignore_member_notif_settings Should be member notification setting ignored?
* @return Mysql_Result
*/
public function get_contacts_by_user_and_type (
$user_id, $type, $ignore_whitelisted = FALSE,
$notify_former_members = FALSE, $notify_interrupted_members = FALSE)
$notify_former_members = FALSE, $notify_interrupted_members = FALSE,
$ignore_member_notif_settings = FALSE)
{
/* where */
if (!is_array($user_id))
......
)";
}
/* member whitelist - member notification settings */
$member_whitelisted = '';
if (!$ignore_member_notif_settings)
{
switch ($type)
{
case Contact_Model::TYPE_EMAIL:
$member_whitelisted = " AND m.notification_by_email > 0 ";
break;
case Contact_Model::TYPE_PHONE:
$member_whitelisted = " AND m.notification_by_sms > 0 ";
break;
}
}
/* former members */
$former = '';
......
JOIN contacts c ON uc.contact_id = c.id AND c.type = ?
LEFT JOIN contacts_countries cc ON cc.contact_id = c.id
LEFT JOIN countries cou ON cou.id = cc.country_id
WHERE $where $former $whitelisted $interrupted
WHERE $where $former $whitelisted $member_whitelisted $interrupted
GROUP BY c.id
", $type);
}
freenetis/branches/1.1/application/views/js/__pieces/notification_activate.php
if (!$this.hasClass("dispNone"))
{
var title = notif_dd_img_title[val];
if ($this.attr('title'))
{
title = $this.attr('title');
}
$this.addClass("dispNone").parent()
.attr("class", "state_change center")
.attr("id", "state_change_" + id)
.append("<img src='" + notif_dd_img_src[val] + "' title='" + notif_dd_img_title[val] +
.append("<img src='" + notif_dd_img_src[val] + "' title='" + title +
"' class='state_change_image' id='state_change_image_" + id + "'>");
}
else
freenetis/branches/1.1/db_upgrades/upgrade_1.1.0~alpha59.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Adds column and AXO for member notification settings,
*
* @author Ondřej Fibich
*/
$upgrade_sql['1.1.0~alpha59'] = array
(
// columns
"ALTER TABLE `members` ADD `notification_by_redirection` TINYINT NOT NULL DEFAULT '1',
ADD `notification_by_email` TINYINT NOT NULL DEFAULT '1',
ADD `notification_by_sms` TINYINT NOT NULL DEFAULT '1'",
// disable notification for association
"UPDATE `members` SET notification_by_redirection = 0 AND
notification_by_email = 0 AND notification_by_sms = 0
WHERE id = 1",
// AXO
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`)
SELECT MAX(id)+1, 'Members_Controller', 'notification_settings', 'Member notification settings' FROM axo",
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES
('38', 'Members_Controller', 'notification_settings')",
);
freenetis/branches/1.1/version.php
* The current version of FreenetIS.
* This value must be changed by developers in a new release of FreenetIS.
*/
define('FREENETIS_VERSION', '1.1.0~alpha58');
define('FREENETIS_VERSION', '1.1.0~alpha59');

Také k dispozici: Unified diff