Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1950

Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)

Upravy:
- procisteni kodu v aktivaci presmerovani
- pridany nove typy presmerovadi do seznamu clenu
- callback pro notofication uz pocita se zpravou s ignorovanou bilou listinou
- refs #584: dokonceni
- rozdelane automaticke presmerovani (typy akci v modelu message - nivemu nevadi tak jsem je tam uz dal)

Opravy:
refs #519: Moznost povoleni/zakazani E-mailu (zapomenuta casti v notifikaci e-mailu)

Zobrazit rozdíly:

freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'cash' => 'Pokladna',
'cash flow' => 'Peněžní tok',
'cash drawn' => 'Výběry hotovosti',
'ce' => 'PV',
'cellphone number' => 'Mobilní číslo',
'cellphone operator' => 'Mobilní operátor',
'centralized logging' => 'Centralizované logování',
......
'connection request has been succesfully approved' => 'Žádost o připojení byla úspěšně schválena.',
'connection requests' => 'Požadavky na připojení',
'connection requests are not enabled' => 'Požadavky na připojení nejsou povoleny.',
'connection test expired' => 'Testovací připojení vypršelo',
'connections' => 'Připojení',
'constant symbol' => 'Konstantní symbol',
'contact is owned by another user' => 'Kontakt je vlastněn jiným uživatelem',
freenetis/branches/1.1/application/helpers/callback.php
/**
* Callback function to print form field for notification action
*
* @param type $item
* @param type $name
* @param type $input
......
public static function notification_form_field ($item, $name, $input, $args = array())
{
$selected = Notifications_Controller::KEEP;
switch ($args[0])
$message_type = $args[0];
$ignore_whitelist = $args[1];
switch ($message_type)
{
case Message_Model::DEBTOR_MESSAGE:
if ($item->balance < Settings::get('debtor_boundary')
&& !$item->whitelisted
&& (!$item->whitelisted || $ignore_whitelist)
&& (!$item->interrupt || ($name == 'redirection' && $item->interrupt))
&& ($item->type != Member_Model::TYPE_FORMER || ($name == 'redirection' && $item->type == Member_Model::TYPE_FORMER)))
{
......
&& $item->balance < Settings::get('payment_notice_boundary')
&& (!$item->interrupt || ($name == 'redirection' && $item->interrupt))
&& ($item->type != Member_Model::TYPE_FORMER || ($name == 'redirection' && $item->type == Member_Model::TYPE_FORMER))
&& !$item->whitelisted)
&& (!$item->whitelisted || $ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
......
case Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE:
if ($item->interrupt)
if ($item->interrupt) // ignore whitelist
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
case Message_Model::USER_MESSAGE:
if ((!$item->interrupt || ($name == 'redirection' && $item->interrupt)) && (!$item->whitelisted || ($item->whitelisted && $args[1]==1)))
if ((!$item->interrupt || ($name == 'redirection' && $item->interrupt)) &&
(!$item->whitelisted || $ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
freenetis/branches/1.1/application/models/message.php
private static $self_cancel_messages = array
(
self::SELF_CANCEL_DISABLED => 'Disabled',
self::SELF_CANCEL_MEMBER => 'Possibility of canceling redirection to all IP addresses of member',
self::SELF_CANCEL_IP => 'Possibility of canceling redirection to only current IP address'
self::SELF_CANCEL_MEMBER => 'Possibility of canceling redirection to all IP addresses of member',
self::SELF_CANCEL_IP => 'Possibility of canceling redirection to only current IP address'
);
// constants that represent types of automatical activation of notification
/**
* auto activation each week, attributes:
*
* - day (day of activation with value 1..7)
*/
const AUTO_ACTIVATION_WEEKLY = 1;
/**
* auto activation each month, attibutes:
*
* - day (day of activation with value 1..31, if the current month
* has less days than setted attribute - e.g. 27.2. - notification
* is activated on last of this date)
*
*/
const AUTO_ACTIVATION_MONTHLY = 2;
/**
* auto activation each day, attributes:
*
* - hour (hour of activation with value from 0..23)
*/
const AUTO_ACTIVATION_DAILY = 3;
/**
* auto activation each working day, attributes:
*
* - hour (hour of activation with value from 0..23)
*/
const AUTO_ACTIVATION_DAILY_WD = 4;
/**
* auto activation in the deduction day in the specified hour, attributes:
*
* - hour (hour of activation with value from 0..23)
*/
const AUTO_ACTIVATION_AFTER_DEDUCTION = 5;
/**
* auto activation each hour, empty attributes.
*/
const AUTO_ACTIVATION_HOURLY = 6;
/**
* Auto activation mesasages
*
* @author Ondřej Fibich
* @var array
*/
private static $auto_activation_messsages = array
(
self::AUTO_ACTIVATION_WEEKLY => 'Weekly',
self::AUTO_ACTIVATION_MONTHLY => 'Monthly',
self::AUTO_ACTIVATION_DAILY => 'Daily',
self::AUTO_ACTIVATION_DAILY_WD => 'Daily on working days',
self::AUTO_ACTIVATION_AFTER_DEDUCTION => 'After deduction of fees',
self::AUTO_ACTIVATION_HOURLY => 'Hourly',
);
/**
* Auto activation attributes types
*
* @author Ondřej Fibich
* @var array
*/
private static $auto_activation_attributes = array
(
self::AUTO_ACTIVATION_WEEKLY => array
(
'type' => 'integer',
'name' => 'day',
'title' => 'day of week',
'range_from' => 1,
'range_to' => 7,
),
self::AUTO_ACTIVATION_MONTHLY => array
(
'type' => 'integer',
'title' => 'day of month',
'title' => 'day of month',
'range_from' => 1,
'range_to' => 31,
),
self::AUTO_ACTIVATION_DAILY => array
(
'type' => 'integer',
'name' => 'hour',
'title' => 'hour',
'range_from' => 0,
'range_to' => 23,
),
self::AUTO_ACTIVATION_DAILY_WD => array
(
'type' => 'integer',
'name' => 'hour',
'title' => 'hour',
'range_from' => 0,
'range_to' => 23,
),
self::AUTO_ACTIVATION_AFTER_DEDUCTION => array
(
'type' => 'integer',
'name' => 'hour',
'title' => 'hour',
'range_from' => 1,
'range_to' => 24,
),
self::AUTO_ACTIVATION_HOURLY => array
(
'type' => FALSE,
),
);
/**
* Returns all message's types
*
* @author Michal Kliment
......
}
/**
* Gets set of self cancel messages
*
* @author Ondřej Fibich
* @param bool $translate Translate messages
* @return array
*/
public static function get_auto_activation_messages($translate = TRUE)
{
if ($translate)
{
return array_map('__', self::$auto_activation_messsages);
}
return self::$auto_activation_messsages;
}
/**
* Gets attribute of the given automatical activation type
*
* @param integer $aa_type Automatical activation type
* @return null|array
*/
public static function get_auto_activation_attribute_type($aa_type)
{
if (array_key_exists($aa_type, self::$auto_activation_attributes))
{
return self::$auto_activation_attributes[$aa_type];
}
return NULL;
}
/**
* Check if message may be self cancable.
*
* @author Ondřej Fibich
......
}
/**
* Check if message can be activated manually.
*
* @param integer $type Message type
* @return boolean
*/
public static function can_be_activate_automatically($type)
{
return (
$type != self::DEBTOR_MESSAGE ||
$type != self::PAYMENT_NOTICE_MESSAGE
);
}
/**
* Counts all activated redirections from junction table messages_ip_addresses.
*
* @author Jiri Svitak, Ondrej Fibich
freenetis/branches/1.1/application/models/member.php
(
SELECT DISTINCT
ms.type AS redirect_type_id,
IF(ms.type = 4, ? ,IF(ms.type = 5, ?, IF(ms.type = 6, ?, IF(ms.type = 7, ?, ?)))) AS redirect_type,
IF(ms.type = 4, ?,IF(ms.type = 5, ?, IF(ms.type = 6, ?, IF(ms.type = 7, ?, ?)))) AS redirect_type_text,
IF(ms.type = 4, ?,IF(ms.type = 5, ?, IF(ms.type = 6, ?, IF(ms.type = 7, ?, IF(ms.type = 16, ?, ?))))) AS redirect_type,
IF(ms.type = 4, ?,IF(ms.type = 5, ?, IF(ms.type = 6, ?, IF(ms.type = 7, ?, IF(ms.type = 16, ?, ?))))) AS redirect_type_text,
IFNULL(u.member_id,ms.member_id) AS member_id
FROM
(
......
__('DB'),
__('PN'),
__('UCP'),
__('CE'),
__('UM'),
__('Membership interrupt'),
__('Debtor'),
__('Payment notice'),
__('Unallowed connecting place'),
__('Connection test expired'),
__('User message')
));
}
......
*
* @author Jiri Svitak
* @param integer $subnet_id
* @param string $order_by
* @return Mysql_Result
*/
public function get_members_of_subnet($subnet_id, $order_by = 'id', $order_by_direction = 'asc')
public function get_members_of_subnet($subnet_id, $order_by = 'id')
{
return $this->db->query("
SELECT
......
*
* @param integer $cloud_id
* @param string $order_by
* @param string $order_by_direction
* @return Mysql_Result
*/
public function get_members_of_cloud($cloud_id, $order_by = 'id', $order_by_direction = 'asc')
public function get_members_of_cloud($cloud_id, $order_by = 'id')
{
return $this->db->query("
SELECT
freenetis/branches/1.1/application/controllers/notifications.php
$headline = __('Notification setting of member').' '.$member->name;
// gets all user messages
$messages = ORM::factory('message')->find_all();
$arr_messages = array();
foreach ($messages as $message)
{
if ($message->type == Message_Model::USER_MESSAGE)
{
$arr_messages[$message->id] = $message->name;
}
}
$arr_messages = array
(
NULL => '----- '.__('select message').' -----'
) + $arr_messages;
) + ORM::factory('message')->where('type', Message_Model::USER_MESSAGE)->select_list();
$form = new Forge('notifications/member/'.$member->id);
......
));
}
$form->dropdown('email')
->label(__('E-mail').':')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
));
if (Settings::get('email_enabled'))
{
$form->dropdown('email')
->label(__('E-mail').':')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
));
}
if (Settings::get('sms_enabled'))
{
......
$mia_model = new Messages_ip_addresses_Model();
$uc_model = new Users_contacts_Model();
// check type
if ($message->type != Message_Model::USER_MESSAGE)
self::error(RECORD);
// needed data
$user_id = $this->session->get('user_id');
$comment = $form_data['comment'];
......
/* Redirection */
if (Settings::get('redirection_enabled') &&
Message_Model::has_redirection_content($message->type) &&
($form_data['redirection'] == self::ACTIVATE ||
$form_data['redirection'] == self::DEACTIVATE))
{
......
/* Email */
if ($form_data['email'] == self::ACTIVATE)
if (Settings::get('email_enabled') &&
Message_Model::has_email_content($message->type) &&
$form_data['email'] == self::ACTIVATE)
{
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
......
/* SMS messages */
if (Settings::get('sms_enabled') &&
if (Settings::get('sms_enabled') &&
Message_Model::has_sms_content($message->type) &&
$form_data['sms'] == self::ACTIVATE)
{
// gets all contacts of member
......
$headline = __('Notification setting of members');
if (!$message_id)
{
$input = $_REQUEST;
{
// gets all user messages
$messages = ORM::factory('message')
->find_all();
$arr_messages = array();
foreach ($messages as $message)
{
if ($message->type == Message_Model::USER_MESSAGE)
{
$arr_messages[$message->id] = $message->name;
}
}
$arr_messages = array
(
NULL => '----- '.__('Select message').' -----'
) + $arr_messages;
) + ORM::factory('message')->where('type', Message_Model::USER_MESSAGE)->select_list();
$form = new Forge(url::base().url::current(TRUE));
......
$form_data = $form->as_array();
$message_id = arr::remove('message_id', $form_data);
url::redirect(url_lang::base().'notifications/members/'.$message_id.'/'.server::query_string());
url::redirect('notifications/members/'.$message_id.'/'.server::query_string());
}
$breadcrumbs = breadcrumbs::add()
......
$message = new Message_Model($message_id);
// message doesn't exist
if (!$message->id)
if (!$message->id && $message->type != Message_Model::USER_MESSAGE)
Controller::error(RECORD);
if (!isset($_POST) || !isset($_POST["ids"]))
{
switch ($message->type)
{
case Message_Model::DEBTOR_MESSAGE:
case Message_Model::PAYMENT_NOTICE_MESSAGE:
$order_by = 'balance';
$order_by_direction = 'ASC';
break;
case Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE:
$order_by = 'interrupt';
$order_by_direction = 'DESC';
break;
default:
$order_by = 'id';
$order_by_direction = 'ASC';
break;
}
if (!isset($_POST) || !isset($_POST['ids']))
{
$member_model = new Member_Model();
$filter_form = Members_Controller::create_filter_form();
......
$members = $member_model
->get_all_members(
0, $total_members,
$order_by, $order_by_direction,
0, $total_members, 'id', 'ASC',
$filter_form->as_sql()
);
$grid = new Grid(url_lang::base().'notifications/subnet', '', array
$grid = new Grid('notifications/subnet', '', array
(
'use_paginator' => false,
'use_selector' => false,
'total_items' => count ($members)
));
//$grid->field('id')
// ->label(__('ID'));
$grid->callback_field('member_id')
->label(__('Name'))
->callback('callback::member_field');
......
$grid->callback_field('balance')
->callback('callback::balance_field');
if ($message->type == Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE ||
$message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
{
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
}
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
$grid->callback_field('whitelisted')
->label(__('Whitelist'))
->callback('callback::whitelisted_field')
->class('center');
if (Settings::get('redirection_enabled'))
if (Settings::get('redirection_enabled') &&
Message_Model::has_redirection_content($message_id))
{
$grid->form_field('redirection')
->label(__('Redirection'))
......
$message->ignore_whitelist
)->class('center');
}
if ($message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
if (Settings::get('email_enabled') &&
Message_Model::has_email_content($message_id))
{
$grid->form_field('email')
->label(__('E-Mail'))
......
$message->type,
$message->ignore_whitelist
)->class('center');
}
if (Settings::get('sms_enabled'))
{
$grid->form_field('sms')
->label(__('SMS'))
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
)->class('center');
}
if (Settings::get('sms_enabled') &&
Message_Model::has_sms_content($message_id))
{
$grid->form_field('sms')
->label(__('SMS'))
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
)->class('center');
}
$grid->form_extra_buttons = array
......
}
}
foreach ($emails as $member_id => $email)
// only if e-mail is enabled
if (Settings::get('email_enabled'))
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
foreach ($emails as $member_id => $email)
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
}
}
// info message
......
if (!$message_id)
{
// gets all user messages
$messages = ORM::factory('message')
->find_all();
$arr_messages = array();
foreach ($messages as $message)
{
if ($message->type == Message_Model::USER_MESSAGE)
{
$arr_messages[$message->id] = $message->name;
}
}
$arr_messages = array
(
NULL => '----- '.__('select message').' -----'
) + $arr_messages;
) + ORM::factory('message')->where('type', Message_Model::USER_MESSAGE)->select_list();
$form = new Forge('notifications/subnet/'.$subnet->id);
$form->dropdown('message_id')
->label(__('Message').':')
->label('Message')
->options($arr_messages)
->rules('required');
......
if ($form->validate())
{
$form_data = $form->as_array();
url::redirect(url_lang::base().'notifications/subnet/'.$subnet_id.'/'.$form_data["message_id"]);
url::redirect('notifications/subnet/'.$subnet_id.'/'.$form_data['message_id']);
}
$subnet_text = $subnet->name." ($subnet->network_address/"
......
$message = new Message_Model($message_id);
// message doesn't exist
if (!$message->id)
if (!$message->id || $message->type != Message_Model::USER_MESSAGE)
Controller::error(RECORD);
if (!isset($_POST) || !isset($_POST["ids"]))
{
switch ($message->type)
{
case Message_Model::DEBTOR_MESSAGE:
case Message_Model::PAYMENT_NOTICE_MESSAGE:
$order_by = 'whitelisted DESC, balance ASC';
break;
$order_by = 'whitelisted DESC, id ASC';
case Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE:
$order_by = 'whitelisted DESC, interrupt DESC';
break;
default:
$order_by = 'whitelisted DESC, id ASC';
break;
}
$member_model = new Member_Model();
$members = $member_model->get_members_of_subnet(
......
'total_items' => count ($members)
));
//$grid->field('id')
// ->label(__('ID'));
$grid->callback_field('member_id')
->label(__('Name'))
->callback('callback::member_field');
......
$grid->callback_field('balance')
->callback('callback::balance_field');
if ($message->type == Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE ||
$message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
{
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
}
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
if ($message->type == Message_Model::USER_MESSAGE)
{
$grid->callback_field('allowed')
->label(__('Allowed subnet'))
->callback('callback::active_field')
->class('center');
}
$grid->callback_field('allowed')
->label(__('Allowed subnet'))
->callback('callback::active_field')
->class('center');
$grid->callback_field('whitelisted')
->label(__('Whitelist'))
->callback('callback::whitelisted_field')
->class('center');
if (Settings::get('redirection_enabled'))
if (Settings::get('redirection_enabled') &&
Message_Model::has_redirection_content($message->type))
{
$grid->form_field('redirection')
->label(__('Redirection'))
......
)->class('center');
}
if ($message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
// only if e-mail is enabled
if (Settings::get('email_enabled') &&
Message_Model::has_email_content($message->type))
{
$grid->form_field('email')
->label(__('E-Mail'))
......
$message->type,
$message->ignore_whitelist
)->class('center');
if (Settings::get('sms_enabled'))
{
$grid->form_field('sms')
->label(__('SMS'))
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
)->class('center');
}
}
if (Settings::get('sms_enabled') &&
Message_Model::has_sms_content($message->type))
{
$grid->form_field('sms')
->label(__('SMS'))
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
)->class('center');
}
$grid->form_extra_buttons = array
(
......
}
}
foreach ($emails as $member_id => $email)
// only if e-mail is enabled
if (Settings::get('email_enabled'))
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
foreach ($emails as $member_id => $email)
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
}
}
// info message
......
if (!$message_id)
{
// gets all user messages
$messages = ORM::factory('message')->find_all();
$arr_messages = array();
foreach ($messages as $message)
{
if ($message->type == Message_Model::USER_MESSAGE)
{
$arr_messages[$message->id] = $message->name;
}
}
$arr_messages = array
(
NULL => '----- '.__('select message').' -----'
) + $arr_messages;
) + ORM::factory('message')->where('type', Message_Model::USER_MESSAGE)->select_list();
$form = new Forge('notifications/cloud/'.$cloud->id);
......
if ($form->validate())
{
$form_data = $form->as_array();
url::redirect(url_lang::base().'notifications/cloud/'.$cloud_id.'/'.$form_data["message_id"]);
url::redirect('notifications/cloud/'.$cloud_id.'/'.$form_data['message_id']);
}
$name = $cloud->name . ' (' . $cloud_id . ')';
......
$message = new Message_Model($message_id);
// message doesn't exist
if (!$message->id)
if (!$message->id || $message->type != Message_Model::USER_MESSAGE)
Controller::error(RECORD);
if (!isset($_POST) || !isset($_POST["ids"]))
if (!isset($_POST) || !isset($_POST['ids']))
{
switch ($message->type)
{
case Message_Model::DEBTOR_MESSAGE:
case Message_Model::PAYMENT_NOTICE_MESSAGE:
$order_by = 'whitelisted DESC, balance ASC';
break;
$order_by = 'whitelisted DESC, id ASC';
case Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE:
$order_by = 'whitelisted DESC, interrupt DESC';
break;
default:
$order_by = 'whitelisted DESC, id ASC';
break;
}
$member_model = new Member_Model();
$members = $member_model->get_members_of_cloud($cloud->id, $order_by);
......
'total_items' => count($members)
));
//$grid->field('id')
// ->label(__('ID'));
$grid->callback_field('member_id')
->label('Name')
->callback('callback::member_field');
......
$grid->callback_field('balance')
->callback('callback::balance_field');
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
if ($message->type == Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE ||
$message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
{
$grid->callback_field('interrupt')
->label(__('Membership interrupt'))
->callback('callback::active_field')
->class('center');
}
if ($message->type == Message_Model::USER_MESSAGE)
{
$grid->callback_field('allowed')
->label('Allowed subnet')
->callback('callback::active_field')
->class('center');
}
$grid->callback_field('allowed')
->label('Allowed subnet')
->callback('callback::active_field')
->class('center');
$grid->callback_field('whitelisted')
->label('Whitelist')
->callback('callback::whitelisted_field')
->class('center');
if (Settings::get('redirection_enabled'))
if (Settings::get('redirection_enabled') &&
Message_Model::has_redirection_content($message->type))
{
$grid->form_field('redirection')
->label('Redirection')
......
$message->type, $message->ignore_whitelist);
}
if ($message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::USER_MESSAGE)
// only if e-mail is enabled
if (Settings::get('email_enabled') &&
Message_Model::has_email_content($message->type))
{
$grid->form_field('email')
->label('E-Mail')
......
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback('callback::notification_form_field', $message->type, $message->ignore_whitelist);
->callback('callback::notification_form_field',
$message->type, $message->ignore_whitelist);
}
if (Settings::get('sms_enabled'))
{
$grid->form_field('sms')
->label('SMS')
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
);
}
if (Settings::get('sms_enabled') &&
Message_Model::has_sms_content($message->type))
{
$grid->form_field('sms')
->label('SMS')
->type('dropdown')
->options(array
(
self::ACTIVATE => __('Activate'),
self::KEEP => __('Without change')
))
->callback(
'callback::notification_form_field',
$message->type,
$message->ignore_whitelist
);
}
$grid->form_extra_buttons = array
......
}
}
foreach ($emails as $member_id => $email)
// only if e-mail is enabled
if (Settings::get('email_enabled'))
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
foreach ($emails as $member_id => $email)
{
if ($email == self::KEEP)
continue;
// gets all contacts of member
$contacts = $uc_model->get_contacts_by_member_and_type(
$member_id, Contact_Model::TYPE_EMAIL, TRUE
);
// send email
$sent_emails += Message_Model::send_emails(
$message, $contacts, $comment
);
}
}
// info message
freenetis/branches/1.1/application/controllers/members.php
Message_Model::DEBTOR_MESSAGE => __('Debtor'),
Message_Model::PAYMENT_NOTICE_MESSAGE => __('Payment notice'),
Message_Model::UNALLOWED_CONNECTING_PLACE_MESSAGE => __('Unallowed connecting place'),
Message_Model::CONNECTION_TEST_EXPIRED => __('Connection test expired'),
Message_Model::USER_MESSAGE => __('User message')
))->table('ms');
}
freenetis/branches/1.1/application/controllers/messages.php
$form->group('Basic information');
if ($message->type == 0)
if ($message->type == Message_Model::USER_MESSAGE)
{
$form->input('name')
->label('Message name')
......
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);
}
......
{
if (!isset($_POST) || !isset($_POST['ids']))
{
$order_by = 'whitelisted DESC, id ASC';
$member_model = new Member_Model();
$members = $member_model->get_members_to_messages($message->type);
......
$view->content = new View('show_all');
$view->content->headline = $headline;
$view->content->table = $grid;
$view->content->status_message_info = url_lang::lang('help.notification_settings');
$view->render(TRUE);
}
else
......
$deleted_redr = 0;
$sent_emails = 0;
$sent_sms = 0;
$info_messages = array();
foreach ($redirections as $member_id => $redirection)
......
url::redirect('messages/show_all');
}
/**
* Callback function to validate e-mail or sms notification
*
freenetis/branches/1.1/application/views/forge_template.php
?>
<tr<?php echo ($tr_class != '') ? " class='$tr_class'" : '' ?>>
<th class="<?php echo $input->name(); echo (in_array('required', $input->rules())) ? ' label_required' : '' ?>"><?php if ($input->type != 'checkbox') echo $input->label().'&nbsp;'.$input->help() ?><?php /*echo (in_array('required', $input->rules())) ? ' *' : ''*/ ?></th>
<td class="<?php echo $input->name() ?>"<?php if ($input->name() == 'password'): ?> style="widht: 100%;"<?php endif ?>>
<td class="<?php echo $input->name() ?>"<?php if ($input->name() == 'password'): ?> style="width: 100%;"<?php endif ?>>
<?php
endif;
......
endforeach;
if (!strstr($input->class, 'join1')):
if (!strstr($input->class, 'join1') && !strstr($input->class, 'join_multiple')):
?>
</td>
</tr>

Také k dispozici: Unified diff