Revize 1973
Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)
freenetis/branches/1.1/db_upgrades/upgrade_1.1.0~alpha34.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/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* This upgrade is not equal to any of previous upgrades
|
||
*
|
||
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
|
||
*/
|
||
$upgrade_equal_to['1.1.0~alpha34'] = array();
|
||
|
||
/**
|
||
* Adds table for automatical notification message activation.
|
||
*
|
||
* @author Ondřej Fibich
|
||
*/
|
||
$upgrade_sql['1.1.0~alpha34'] = array
|
||
(
|
||
"CREATE TABLE `messages_automatical_activations` (
|
||
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||
`message_id` INT NOT NULL, `type` SMALLINT NOT NULL,
|
||
`attribute` VARCHAR(255) NULL DEFAULT NULL,
|
||
`redirection_enabled` TINYINT(1) NOT NULL DEFAULT '0',
|
||
`email_enabled` TINYINT(1) NOT NULL DEFAULT '0',
|
||
`sms_enabled` TINYINT(1) NOT NULL DEFAULT '0',
|
||
FOREIGN KEY `message_id_fk` (`message_id`) REFERENCES `messages` (`id`) ON DELETE CASCADE
|
||
) ENGINE = InnoDB;",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `name`) SELECT MAX(id)+1, 'Messages_Controller', 'auto_config', 'Messages auto activation configuration' FROM axo",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('38', 'Messages_Controller', 'auto_config')"
|
||
);
|
freenetis/branches/1.1/media/css/installation.css | ||
---|---|---|
float: right;
|
||
margin-top: 5px;
|
||
margin-right: 5px;
|
||
font-size: 95%;
|
||
font-size: 90%;
|
||
}
|
||
|
||
p.forgotten_password_link {
|
||
float: right;
|
||
margin-top: 25px;
|
||
margin-right: 5px;
|
||
font-size: 95%;
|
||
font-size: 90%;
|
||
}
|
||
|
||
div#error {
|
freenetis/branches/1.1/application/i18n/cs_CZ/validation.php | ||
---|---|---|
'unknown_error' => 'Unknown validation error while validating the %s field.',
|
||
'required' => 'Pole %s musí být vyplněno.',
|
||
'min_length' => 'Pole %s musí obsahovat min. %d znaků.',
|
||
'min_value' => 'Pole %s musí mít hodnotu minimálně %d.',
|
||
'max_length' => 'Pole %s musí obsahovat max. %d znaků.',
|
||
'max_value' => 'Pole %s musí mít hodnotu maximálně %d.',
|
||
'exact_length' => 'Pole %s musí obsahovat přesně %d znaků.',
|
||
'in_array' => 'Pole %s musí být vybráno ze seznamu.',
|
||
'matches' => 'Pole %s se musí shodovat s polem %s.',
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add admin to redirection module' => 'Přidat správce do modulu přesměrování',
|
||
'add address point' => 'Přidat adresní bod',
|
||
'add all records' => 'Přidávat všechny záznamy',
|
||
'add automatical activation rule' => 'Přidat pravidlo pro automatickou aktivaci',
|
||
'add backup' => 'Přidat zálohu',
|
||
'add comment' => 'Přidat komentář',
|
||
'add comment to financial state of member' => 'Přidat komentář k finančnímu stavu člena',
|
||
... | ... | |
'after you will solve previous problems, you can turn them on in' => 'Až vyřešíte přecházející problémy, můžete je zapnout v',
|
||
'after you\'ve done that, click login' => 'Poté, co to dokončíte, klikněte na "Přihlásit".',
|
||
'after you\'ve done that, you can continue' => 'Poté, co tak učiníte, můžete pokračovat.',
|
||
'after deduction of fees' => 'po strhnutí příspěvků',
|
||
'agree' => 'Souhlas',
|
||
'air' => 'vzduch',
|
||
'algorithm for generation of variable symbols' => 'Algoritmus pro generování variabilních symbolů',
|
||
... | ... | |
'at least one interface or port still uses this link' => 'Ještě nejméně jedno rozhraní nebo port používá tuto linku.',
|
||
'at least one item still has this address point' => 'Ještě nejméně jedna položka používá tento adresní bod.',
|
||
'at least one member still has this address point' => 'Alespoň jeden člen má tento adresní bod.',
|
||
'attribute' => 'Atribut',
|
||
'auditing comittee' => 'Revizní komise',
|
||
'august' => 'Srpen',
|
||
'author' => 'Autor',
|
||
'author fee' => 'Autorský poplatek',
|
||
'autocomplete of gps coords' => 'Automatické doplnění GPS souřadnic',
|
||
'automatic actions' => 'Automatické akce',
|
||
'automatical activation settings' => 'Nastavení automatické aktivace',
|
||
'automatically deduction is enabled, this operation should be use only if automatical deduction has failed' => 'Automatické strhávání je aktivní, tato operace by měla být použita pouze v případě selhání automatického strhávání.',
|
||
'automatically fill in gps coordinates' => 'Automaticky doplnit GPS souřadnice',
|
||
'automatically import admins' => 'Automaticky přidat správce oblastí',
|
||
... | ... | |
'currently clean urls are turn off' => 'V současné době jsou čistá URL vypnuta.',
|
||
'czk' => 'Kč',
|
||
'daily' => 'denně',
|
||
'daily on working days' => 'V pracovních dnech',
|
||
'database' => 'Databáze',
|
||
'database has been successfully updated' => 'Databáze byla úspěšně upravena.',
|
||
'database host' => 'Hostitel databáze',
|
||
... | ... | |
'date to (last day in month)' => 'Datum do (poslední den v měsíci)',
|
||
'date vat' => 'Datum uskutečnění zdanitelného plnění',
|
||
'day' => 'Den',
|
||
'day book' => 'Účetní deník',
|
||
'day of month' => 'Den v měsíci',
|
||
'day of week' => 'Den v týdnu',
|
||
'days' => 'Dní',
|
||
'day book' => 'Účetní deník',
|
||
'db' => 'DŽ',
|
||
'db schema revision' => 'Revize struktury DB',
|
||
'deactivate' => 'Deaktivovat',
|
||
... | ... | |
'error - cannot update device admin' => 'Chyba - nelze aktualizovat správce zařízení.',
|
||
'error - cannot update speed class' => 'Chyba - nelze upravit třídu rychlosti',
|
||
'error - cannot update vote to locked item' => 'Chyba - nelze aktualizovat hlas k uzamčené položce.',
|
||
'error - cant add message automatical activation settings rule' => 'Chyba - nelze přidat pravidlo pro automatickou aktivaci zprávy',
|
||
'error - cant add contacts' => 'Chyba - nelze přidat kontakt.',
|
||
'error - cant add country to contact' => 'Chyba - nelze přidat relaci mezi zemí a kontaktem.',
|
||
'error - cant add new account' => 'Chyba - nelze vytvořit účet.',
|
||
... | ... | |
'error - cant delete device' => 'Chyba - nelze smazat zařízení.',
|
||
'error - cant delete interface' => 'Chyba - nelze smazat rozhraní.',
|
||
'error - cant delete ip address' => 'Chyba - nelze smazat IP adresu.',
|
||
'error - cant delete message automatical activation settings rule' => 'Chyba - nelze smazat pravidlo pro automatickou aktivaci zprávy',
|
||
'error - cant delete port' => 'Chyba - nelze smazat port.',
|
||
'error - cant delete private phone contacts' => 'Chyba - nelze smazat soukromý telefonní kontakt.',
|
||
'error - cant delete subnet' => 'Chyba - nelze smazat podsíť.',
|
||
... | ... | |
'error - some fees have not been recounted' => 'Chyba - některé členské příspěvky nebyly přepočítány.',
|
||
'error - some fees have not been deducted' => 'Chyba - některé členské příspěvky nebyly strženy.',
|
||
'error - voip not enabled' => 'Chyba - VoIP není povoleno',
|
||
'error during automatic activation of notification messages' => 'Chyba během automatické aktivace upozorňovacích zpráv',
|
||
'error during automatical deduction of members fees, please use manual deduction of fees' => 'Chyba během automatického strhávání členských příspěvků, proveďte prosím stržení manuálně',
|
||
'error during automatical deduction of entrance fees, please use manual deduction of fees' => 'Chyba během automatického strhávání vstupních příspěvků, proveďte prosím stržení manuálně',
|
||
'error during automatical deduction of device fees, please use manual deduction of fees' => 'Chyba během automatického strhávání splátek zařízení, proveďte prosím stržení manuálně',
|
||
... | ... | |
'horizontal and vertical' => 'horizontální a vertikální',
|
||
'host' => 'Hostitel',
|
||
'hostname' => 'Název hostitele',
|
||
'hour' => 'Hodina',
|
||
'hourly' => 'každou hodinu',
|
||
'hours' => 'Hodin',
|
||
'hours2' => 'Hodiny',
|
||
'htaccess file has been successfully created' => 'Soubor .htaccess byl úspěšně vytvořen.',
|
||
... | ... | |
'membership transfers' => 'Převody členství',
|
||
'memory consumed' => 'Spotřeba paměti',
|
||
'message' => 'Zpráva',
|
||
'message automatical activation setting rule has been succesfully added' => 'Pravidlo pro automatickou aktivaci zprávy bylo úspěšně přidáno',
|
||
'message automatical activation setting rule has been succesfully deleted' => 'Pravidlo pro automatickou aktivaci zprávy bylo úspěšně smazáno',
|
||
'message for user' => 'Zpráva pro uživatele',
|
||
'message has been activated' => 'Zpráva byla aktivována',
|
||
'message has been successfully added' => 'Zpráva byla úspěšně přidána',
|
||
... | ... | |
'not found' => 'Nenalezeno',
|
||
'not set' => 'Nenastaveno',
|
||
'note' => 'Poznámka',
|
||
'notification message "%s" has been automatically activated' => 'Upozorňovací zpráva "%s" byla automaticky aktivována',
|
||
'notification setting' => 'Nastavení upozornění',
|
||
'notification setting of cloud' => 'Nastavení upozornění pro oblast',
|
||
'notification setting of member' => 'Nastavení upozornění pro člena',
|
||
... | ... | |
'number of months' => 'Počet měsíců',
|
||
'number of the hours' => 'počet hodin',
|
||
'numbers' => 'Čísla',
|
||
'numeric value required' => 'Vyžadována číselná hodnota',
|
||
'o' => 'V',
|
||
'object' => 'Objekt',
|
||
'object id' => 'ID objektu',
|
||
... | ... | |
'redirection logo url' => 'URL pro logo na stránce přesměrování',
|
||
'redirection logs' => 'Logy přesměrování',
|
||
'redirection "%s" for %d ip addresses have been activated' => 'Přesměrování "%s" pro %d IP adres bylo aktivováno.',
|
||
'redirection of devices enabled' => 'Přesměrování zařízení povoleno',
|
||
'redirection of ip address' => 'Přesměrování IP adresy',
|
||
'redirection preview' => 'Náhled přesměrování',
|
||
'redirection records' => 'Záznamy přesměrování',
|
||
... | ... | |
'self-cancelable message' => 'Samozrušitelná zpráva',
|
||
'self-registration' => 'Samo-registrace',
|
||
'sending message failed' => 'Odeslání zprávy selhalo',
|
||
'sending of e-mail messages enabled' => 'Zasílání e-mailů povoleno',
|
||
'sending of sms messages enabled' => 'Zasílání SMS zpráv povoleno',
|
||
'send again' => 'Odeslat znovu',
|
||
'send date' => 'Datum odeslání',
|
||
'send e-mail' => 'Pošli e-mail',
|
||
... | ... | |
'set state closed' => 'Nastavit stav na uzavřený',
|
||
'settings' => 'Nastavení',
|
||
'settings for configuration files has been successfully updated' => 'Nastavení pro kofigurační soubory bylo úspěšně upraveno',
|
||
'setup automatical activation' => 'Nastavení automatické aktivace',
|
||
'setup config' => 'Nastavení konfigurace',
|
||
'setup config done' => 'Nastavení konfigurace dokončeno',
|
||
'seventh-degree certified engineers' => 'Certifikování technici sedmého stupně',
|
||
... | ... | |
'value' => 'Hodnota',
|
||
'value for earning' => 'Hodnota pro příjem',
|
||
'value has not been entered' => 'Hodnota nebyla zadána.',
|
||
'value in range since' => 'hodnota v rozmezí od',
|
||
'variable symbol' => 'Variabilní symbol',
|
||
'variable symbol settings' => 'Nastavení variabilních symbolů',
|
||
'variable_symbol' => 'Variabilní symbol',
|
freenetis/branches/1.1/application/helpers/callback.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Field for deleting messages. Only user messages are allowed to be deleted.
|
||
*
|
||
* @author Jiri Svitak
|
||
* @param object $item
|
||
* @param string $name
|
||
*/
|
||
public static function message_delete_field($item, $name)
|
||
{
|
||
$message = new Message_Model($item->id);
|
||
|
||
if ($message->type == Message_Model::USER_MESSAGE)
|
||
{
|
||
echo html::anchor('messages/delete/'.$message->id, __('Delete'));
|
||
}
|
||
else
|
||
{
|
||
echo ' ';
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback function to print preview link of redirection message
|
||
*
|
||
* @author Michal Kliment
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Message auto activation settings type field
|
||
*
|
||
* @param object $item
|
||
* @param string $name
|
||
*/
|
||
public function message_auto_setting_type($item, $name)
|
||
{
|
||
echo strtolower(Messages_automatical_activation_Model::get_type_message($item->$name));
|
||
}
|
||
|
||
/**
|
||
* Message auto activation settings attribute field
|
||
*
|
||
* @param object $item
|
||
* @param string $name
|
||
*/
|
||
public function message_auto_setting_attribute($item, $name)
|
||
{
|
||
$at = Messages_automatical_activation_Model::get_attribute_type($item->type);
|
||
echo $item->$name . (isset($at['title']) ? ' (' . __($at['title'], array(), 1) . ')' : '');
|
||
}
|
||
|
||
|
||
/**
|
||
* Callback for object of log
|
||
*
|
freenetis/branches/1.1/application/helpers/condition.php | ||
---|---|---|
return ($item->state == Vote_Model::STATE_NEW);
|
||
}
|
||
|
||
/**
|
||
* Checks whether the given notification message may be activated automatically.
|
||
*
|
||
* @param object $item
|
||
* @return boolean
|
||
*/
|
||
public static function is_message_automatical_config($item)
|
||
{
|
||
return Message_Model::can_be_activate_automatically($item->type);
|
||
}
|
||
|
||
/**
|
||
* Checks whether the given notification message is user message.
|
||
*
|
||
* @param object $item
|
||
* @return boolean
|
||
*/
|
||
public static function is_message_type_of_user($item)
|
||
{
|
||
return ($item->type == Message_Model::USER_MESSAGE);
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/helpers/notification.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/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* Helper for some useful methods that are frequently used during notification.
|
||
*
|
||
* @author Ondrej Fibich
|
||
* @package Helper
|
||
*/
|
||
class notification
|
||
{
|
||
/**
|
||
* Build stats string for activated notification.
|
||
*
|
||
* @param array $stats Stats of count of added (keys redirection, email, sms)
|
||
* @param boolean $activate_redir
|
||
* @param boolean $activate_email
|
||
* @param boolean $activate_sms
|
||
* @param boolean $remove_redir
|
||
* @return array Translated stat messages
|
||
*/
|
||
public static function build_stats_string($stats, $activate_redir = TRUE,
|
||
$activate_email = TRUE, $activate_sms = TRUE, $remove_redir = TRUE)
|
||
{
|
||
$info_messages = array();
|
||
|
||
if ($remove_redir)
|
||
{
|
||
$m = 'Redirection has been deactivated for %s IP addresses';
|
||
$info_messages[] = __($m, $stats['redirection_removed']).'.';
|
||
}
|
||
|
||
if ($activate_redir)
|
||
{
|
||
$m = 'Redirection has been activated for %s IP addresses';
|
||
$info_messages[] = __($m, $stats['redirection']).'.';
|
||
}
|
||
|
||
if ($activate_email)
|
||
{
|
||
$m = 'E-mail has been sent for %s e-mail addresses';
|
||
$info_messages[] = __($m, $stats['email']).'.';
|
||
}
|
||
|
||
if ($activate_sms)
|
||
{
|
||
$m = 'SMS message has been sent for %d phone numbers';
|
||
$info_messages[] = __($m, $stats['sms']).'.';
|
||
}
|
||
|
||
return $info_messages;
|
||
}
|
||
}
|
freenetis/branches/1.1/application/models/messages_automatical_activation.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is release 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/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* Auto activation settings of notifiation messages.
|
||
*
|
||
* @author Onřej Fibich
|
||
* @package Model
|
||
* @property integer $id
|
||
* @property integer $message_id
|
||
* @property Message_Model $message
|
||
* @property integer $type
|
||
* @property mixed $attribute An attribute to settings with type by type field.
|
||
* @property boolean $redirection_enabled
|
||
* @property boolean $email_enabled
|
||
* @property boolean $sms_enabled
|
||
*/
|
||
class Messages_automatical_activation_Model extends TimeActivityRule
|
||
{
|
||
|
||
/**
|
||
* Gets all setting rules of the given message.
|
||
*
|
||
* @param integer $message_id
|
||
* @return array[Messages_automatical_activation_Model]
|
||
*/
|
||
public function get_message_settings($message_id)
|
||
{
|
||
return $this->where('message_id', $message_id)->find_all();
|
||
}
|
||
|
||
/*
|
||
* @Override
|
||
*/
|
||
public function getAttribute()
|
||
{
|
||
return $this->attribute;
|
||
}
|
||
|
||
/*
|
||
* @Override
|
||
*/
|
||
public function getType()
|
||
{
|
||
return $this->type;
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/models/message.php | ||
---|---|---|
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
|
||
... | ... | |
public static function can_be_activate_automatically($type)
|
||
{
|
||
return (
|
||
$type != self::DEBTOR_MESSAGE ||
|
||
$type != self::PAYMENT_NOTICE_MESSAGE
|
||
$type == self::DEBTOR_MESSAGE ||
|
||
$type == self::PAYMENT_NOTICE_MESSAGE
|
||
);
|
||
}
|
||
|
||
... | ... | |
*
|
||
* @author Jiri Svitak
|
||
* @param integer $message_id
|
||
* @return integer Count of deactivated IPs
|
||
*/
|
||
public function deactivate_message($message_id)
|
||
{
|
||
$count = $this->db->query("
|
||
SELECT COUNT(*) AS count
|
||
FROM messages_ip_addresses
|
||
WHERE message_id = ?
|
||
", $message_id)->current()->count;
|
||
|
||
$this->db->query("
|
||
DELETE FROM messages_ip_addresses
|
||
WHERE message_id = ?
|
||
", $message_id);
|
||
|
||
return $count;
|
||
}
|
||
|
||
/**
|
freenetis/branches/1.1/application/models/log_queue.php | ||
---|---|---|
$created_at = date('Y-m-d H:i:s');
|
||
}
|
||
|
||
if ($exception_backtrace instanceof Exception)
|
||
{
|
||
$exception_backtrace = $exception_backtrace->getTraceAsString();
|
||
}
|
||
|
||
try
|
||
{
|
||
$log_queue = new Log_queue_Model();
|
freenetis/branches/1.1/application/controllers/notifications.php | ||
---|---|---|
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Activate notification of message for the given memebers and given
|
||
* restrictions.
|
||
*
|
||
* This method checks internally if redir/e-mail/sms are enabled.
|
||
*
|
||
* @author Ondrej Fibich
|
||
* @param Message_Model $message Message that should be notified
|
||
* @param array $members Array of memmbers object (Database_Result or
|
||
* Member_model) that contains properties
|
||
* member_id, whitelisted
|
||
* @param integer $user_id Who notify or on empty association main user [optional]
|
||
* @param boolean $activate_redir Should be redirection activated [optional]
|
||
* @param boolean $activate_email Should be e-mail activated [optional]
|
||
* @param boolean $activate_sms Should be SMS activated [optional]
|
||
* @param boolean $remove_redir Should be all redirection of this type removed
|
||
* before adding [optional]
|
||
* @return array stats of count of added (keys redirection, email, sms)
|
||
* @throws Exception On any error with translated message
|
||
*/
|
||
public static function notify(Message_Model $message, $members, $user_id = NULL,
|
||
$activate_redir = TRUE, $activate_email = TRUE,
|
||
$activate_sms = TRUE, $remove_redir = FALSE)
|
||
{
|
||
// variables
|
||
$error_prefix = __('Error during automatic activation of notification messages');
|
||
$ip_model = new Ip_address_Model();
|
||
$uc_model = new Users_contacts_Model();
|
||
$removed_redr = $added_redr = $added_email = $added_sms = 0;
|
||
|
||
// not set user => association action
|
||
if (empty($user_id))
|
||
{
|
||
$association = new Member_Model(Member_Model::ASSOCIATION);
|
||
$user_id = $association->get_main_user();
|
||
unset($association);
|
||
}
|
||
|
||
// activate redirection
|
||
if (Settings::get('redirection_enabled') && $activate_redir)
|
||
{
|
||
try
|
||
{
|
||
// deactivate first if enabled
|
||
if ($remove_redir)
|
||
{
|
||
$removed_redr = $message->deactivate_message($message->id);
|
||
}
|
||
// activate
|
||
foreach ($members as $member)
|
||
{
|
||
// check whitelist
|
||
if ($member->whitelisted && !$message->ignore_whitelist)
|
||
continue;
|
||
// get all redirected IPs
|
||
$ips = $ip_model->get_ip_addresses_of_member($member->member_id);
|
||
// set new redirection
|
||
$added_redr += Message_Model::activate_redirection(
|
||
$message, $ips, $user_id
|
||
);
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$m = $error_prefix . ': ' . __('redirection', array(), 1)
|
||
. ' (' . __($message->name) . ')';
|
||
throw new Exception($m, 0, $e);
|
||
}
|
||
}
|
||
// activate e-mail notification
|
||
if (Settings::get('email_enabled') && $activate_email)
|
||
{
|
||
try
|
||
{
|
||
foreach ($members as $member)
|
||
{
|
||
// gets all contacts of member
|
||
$contacts = $uc_model->get_contacts_by_member_and_type(
|
||
$member->member_id, Contact_Model::TYPE_EMAIL,
|
||
$message->ignore_whitelist
|
||
);
|
||
// send email
|
||
$added_email += Message_Model::send_emails(
|
||
$message, $contacts
|
||
);
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$m = $error_prefix . ': e-mail (' . __($message->name) . ')';
|
||
throw new Exception($m, 0, $e);
|
||
}
|
||
}
|
||
// activate SMS notification
|
||
if (Settings::get('sms_enabled') && $activate_sms)
|
||
{
|
||
try
|
||
{
|
||
foreach ($members as $member)
|
||
{
|
||
// gets all contacts of member
|
||
$contacts = $uc_model->get_contacts_by_member_and_type(
|
||
$member->member_id, Contact_Model::TYPE_PHONE,
|
||
$message->ignore_whitelist
|
||
);
|
||
// send email
|
||
$added_email += Message_Model::send_sms_messages(
|
||
$message, $contacts, $user_id
|
||
);
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$m = $error_prefix . ': SMS (' . __($message->name) . ')';
|
||
throw new Exception($m, 0, $e);
|
||
}
|
||
}
|
||
// return stats
|
||
return array
|
||
(
|
||
'redirection' => $added_redr,
|
||
'redirection_removed' => $removed_redr,
|
||
'email' => $added_email,
|
||
'sms' => $added_sms
|
||
);
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/controllers/scheduler.php | ||
---|---|---|
* @package Controller
|
||
*/
|
||
class Scheduler_Controller extends Controller
|
||
{
|
||
{
|
||
// Constants that represents count of minutes in which an action is
|
||
// performed. These constants are not directly written in code because
|
||
// of avoiding of overlaping of action in order to performance issues
|
||
// (action should not be started in the same time).
|
||
|
||
/** Activation Minute for member fees (long action but triggered only monthly) */
|
||
const AM_MEMBER_FEES = '03';
|
||
/** Activation Minute for entrance fees (take some time but triggered only monthly) */
|
||
const AM_ENTRANCE_FEES = '05';
|
||
/** Activation Minute for device fees (not oftenly used) */
|
||
const AM_DEVICE_FEES = '06';
|
||
/** Activation Minute for bank statements downloading (long action) */
|
||
const AM_BANK_STATEMENTS = '07';
|
||
/** Activation Minute for connection test (daily action) */
|
||
const AM_CONNECTION_TEST = '09';
|
||
/** Activation Minute for notification (long action) */
|
||
const AM_NOTIFICATION = '10';
|
||
|
||
/**
|
||
* Log scheduler error
|
||
*
|
||
... | ... | |
Log::add('error', $text);
|
||
}
|
||
|
||
/** Time at calling of the controller */
|
||
private $t;
|
||
|
||
/**
|
||
* Set up time
|
||
*/
|
||
public function __construct()
|
||
{
|
||
parent::__construct();
|
||
$this->t = time();
|
||
}
|
||
|
||
/**
|
||
* Redirect to index
|
||
*/
|
||
public function index()
|
||
... | ... | |
|
||
// daily actions
|
||
|
||
if ((date('H:i') == '00:00'))
|
||
if (date('H:i', $this->t) == '00:00')
|
||
{
|
||
|
||
try
|
||
... | ... | |
{
|
||
if (Settings::get('ulogd_enabled') == '1')
|
||
{
|
||
self::members_traffic_partitions_daily();
|
||
$this->members_traffic_partitions_daily();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
try
|
||
{
|
||
// first day in month (per month)
|
||
if (date('m') == '01' && Settings::get('ulogd_enabled') == '1')
|
||
if (date('m', $this->t) == '01' && Settings::get('ulogd_enabled') == '1')
|
||
{
|
||
self::members_traffic_partitions_montly();
|
||
$this->members_traffic_partitions_montly();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
{
|
||
if (Settings::get('action_logs_active') == '1')
|
||
{
|
||
self::logs_partitions_daily();
|
||
$this->logs_partitions_daily();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
}
|
||
}
|
||
|
||
/* Each day at 5 */
|
||
if (date('H:i') == '05:00')
|
||
/* Each day at 5:xx */
|
||
if (date('H:i', $this->t) == '05:' . self::AM_CONNECTION_TEST)
|
||
{
|
||
try
|
||
{
|
||
self::update_applicant_connection_test();
|
||
$this->update_applicant_connection_test();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
... | ... | |
}
|
||
|
||
/*
|
||
if (date('H:i') == "01:00")
|
||
if (date('H:i', $this->t) == "01:00")
|
||
{
|
||
if (Settings::get('fio_import_daily') == '1')
|
||
{
|
||
self::fio_import_daily();
|
||
$this->fio_import_daily();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
... | ... | |
|
||
// send emails
|
||
|
||
try
|
||
{
|
||
if (Settings::get('email_enabled'))
|
||
self::send_quened_emails();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
self::log_error('send_quened_emails', $e);
|
||
}
|
||
// try
|
||
// {
|
||
// if (Settings::get('email_enabled'))
|
||
// $this->send_quened_emails();
|
||
// }
|
||
// catch (Exception $e)
|
||
// {
|
||
// self::log_error('send_quened_emails', $e);
|
||
// }
|
||
//
|
||
// // SMS should be down there because they can take a while
|
||
//
|
||
// try
|
||
// {
|
||
// if (Settings::get('sms_enabled') && Sms::enabled())
|
||
// {
|
||
// //send quened SMS
|
||
// $this->send_quened_sms();
|
||
//
|
||
// //receive SMS
|
||
// self::receive_sms();
|
||
// }
|
||
// }
|
||
// catch (Exception $e)
|
||
// {
|
||
// self::log_error('send_quened_sms|receive_sms', $e);
|
||
// }
|
||
|
||
// SMS should be down there because they can take a while
|
||
|
||
try
|
||
{
|
||
if (Settings::get('sms_enabled') && Sms::enabled())
|
||
{
|
||
//send quened SMS
|
||
self::send_quened_sms();
|
||
|
||
//receive SMS
|
||
self::receive_sms();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
self::log_error('send_quened_sms|receive_sms', $e);
|
||
}
|
||
|
||
// update allowed subnets
|
||
|
||
try
|
||
{
|
||
if (Settings::get('allowed_subnets_enabled'))
|
||
{
|
||
self::update_allowed_subnets();
|
||
$this->update_allowed_subnets();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
}
|
||
|
||
// update local subnets
|
||
self::update_local_subnets();
|
||
$this->update_local_subnets();
|
||
|
||
if (Settings::get('monitoring_enabled'))
|
||
{
|
||
// send notification from monitoring
|
||
self::monitoring_notification();
|
||
$this->monitoring_notification();
|
||
}
|
||
|
||
// update ulogd
|
||
... | ... | |
{
|
||
if (Settings::get('ulogd_enabled'))
|
||
{
|
||
self::update_ulogd();
|
||
$this->update_ulogd();
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
self::log_error('update_ulogd', $e);
|
||
}
|
||
|
||
// automatic notification messages activation
|
||
$this->notification_activation();
|
||
|
||
// fee deduction (monthly)
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
// fee deduction (monthly)
|
||
self::fee_deduction();
|
||
$this->fee_deduction();
|
||
}
|
||
|
||
// set state of module (last activation time)
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Auto activation of notification messages
|
||
*
|
||
* @author Ondrej Fibich
|
||
*/
|
||
private function notification_activation()
|
||
{
|
||
$error_prefix = __('Error during automatic activation of notification messages');
|
||
|
||
try
|
||
{
|
||
// models and data
|
||
$member_model = new Member_Model();
|
||
$messages_aa = new Messages_automatical_activation_Model();
|
||
$messages = ORM::factory('message')->find_all();
|
||
|
||
// for each message
|
||
foreach ($messages as $message)
|
||
{
|
||
// auto activation possible?
|
||
if (!Message_Model::can_be_activate_automatically($message->type))
|
||
{
|
||
continue; // No!
|
||
}
|
||
// find rules
|
||
$rules = $messages_aa->get_message_settings($message->id);
|
||
// activate flags
|
||
$a_redir = $a_email = $a_sms = FALSE;
|
||
// get all rules that match
|
||
$filtered_rules = TimeActivityRule::filterRules(
|
||
$rules, self::AM_NOTIFICATION, $this->t
|
||
);
|
||
// check all rules if redir/email/sms should be activated now
|
||
foreach ($filtered_rules as $rule)
|
||
{
|
||
$a_redir = $a_redir || $rule->redirection_enabled;
|
||
$a_email = $a_email || $rule->email_enabled;
|
||
$a_sms = $a_sms || $rule->sms_enabled;
|
||
}
|
||
// global options
|
||
$a_redir = $a_redir && Settings::get('redirection_enabled');
|
||
$a_email = $a_email && Settings::get('email_enabled');
|
||
$a_sms = $a_sms && Settings::get('sms_enabled');
|
||
// do not do next if nothing should be made
|
||
if (!$a_redir && !$a_email && !$a_sms)
|
||
{
|
||
continue;
|
||
}
|
||
// get all members for messages
|
||
$members = $member_model->get_members_to_messages($message->type);
|
||
// activate notification
|
||
try
|
||
{
|
||
// notify
|
||
$stats = Notifications_Controller::notify(
|
||
$message, $members, NULL, $a_redir,
|
||
$a_email, $a_sms, $a_redir
|
||
);
|
||
// info messages
|
||
$info_messages = notification::build_stats_string(
|
||
$stats, $a_redir, $a_email, $a_sms, $a_redir
|
||
);
|
||
// log action
|
||
if (count($info_messages))
|
||
{
|
||
$m = __('Notification message "%s" has been automatically activated',
|
||
array(__($message->name)));
|
||
Log_queue_Model::info($m, implode("\n", $info_messages));
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
self::log_error($e->getMessage(), $e, FALSE);
|
||
Log_queue_Model::error($e->getMessage(), $e);
|
||
}
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
self::log_error($error_prefix, $e, FALSE);
|
||
Log_queue_Model::error($error_prefix, $e);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Deduct all fees automatically if enabled
|
||
*
|
||
* @author Ondrej Fibich
|
||
*/
|
||
private static function fee_deduction()
|
||
private function fee_deduction()
|
||
{
|
||
if (Settings::get('deduct_fees_automatically_enabled') &&
|
||
intval(date('j')) == intval(Settings::get('deduct_day')))
|
||
intval(date('j', $this->t)) == intval(Settings::get('deduct_day')))
|
||
{
|
||
// preparations
|
||
$association = new Member_Model(Member_Model::ASSOCIATION);
|
||
$user_id = $association->get_main_user();
|
||
|
||
// members fees (at deduct date 3 minutes after midnight)
|
||
if (date('H:i') == '00:03')
|
||
if (date('H:i', $this->t) == '00:' . self::AM_MEMBER_FEES)
|
||
{
|
||
try
|
||
{
|
||
// perform
|
||
$c = Transfers_Controller::worker_deduct_members_fees(
|
||
date('m'), date('Y'), $user_id
|
||
date('m', $this->t), date('Y', $this->t), $user_id
|
||
);
|
||
// info to logs
|
||
$m = __('Member fees deducted automatically (in sum %d)', $c);
|
||
... | ... | |
}
|
||
|
||
// entrance fees (at deduct date 5 minutes after midnight)
|
||
if (date('H:i') == '00:05')
|
||
if (date('H:i', $this->t) == '00:' . self::AM_ENTRANCE_FEES)
|
||
{
|
||
try
|
||
{
|
||
... | ... | |
}
|
||
|
||
// device deduct fees (at deduct date 7 minutes after midnight)
|
||
if (date('H:i') == '00:07')
|
||
if (date('H:i', $this->t) == '00:' . self::AM_DEVICE_FEES)
|
||
{
|
||
try
|
||
{
|
||
... | ... | |
* @see Logs_Controller
|
||
* @author Ondřej Fibich
|
||
*/
|
||
private static function logs_partitions_daily()
|
||
private function logs_partitions_daily()
|
||
{
|
||
$model_log = new Log_Model();
|
||
// remove log partition
|
||
... | ... | |
*
|
||
* @author Ondřej Fibich
|
||
*/
|
||
private static function members_traffic_partitions_daily()
|
||
private function members_traffic_partitions_daily()
|
||
{
|
||
$model_members_traffic_daily = new Members_traffic_Model();
|
||
// remove log partition
|
||
... | ... | |
*
|
||
* @author Ondřej Fibich
|
||
*/
|
||
private static function members_traffic_partitions_montly()
|
||
private function members_traffic_partitions_montly()
|
||
{
|
||
$model_members_traffic_montly = new Members_traffic_Model();
|
||
// remove log partition
|
||
... | ... | |
*
|
||
* @author Michal Kliment
|
||
*/
|
||
private static function update_ulogd()
|
||
private function update_ulogd()
|
||
{
|
||
// it's time to update
|
||
if ((
|
||
... | ... | |
|
||
// finding of avarage
|
||
$avg = $members_traffic_model->avg_daily_traffics(
|
||
date('Y-m-d'), Settings::get('ulogd_active_type')
|
||
date('Y-m-d', $this->t), Settings::get('ulogd_active_type')
|
||
);
|
||
|
||
if (($ulogd_active_min = Settings::get('ulogd_active_min')) != '')
|
||
... | ... | |
$members_traffic_model->update_active_members(
|
||
$avg, $ulogd_active_count,
|
||
Settings::get('ulogd_active_type'),
|
||
date('Y-m-d')
|
||
date('Y-m-d', $this->t)
|
||
);
|
||
|
||
// updates variable
|
||
... | ... | |
*
|
||
* @author Ondrej Fibich
|
||
*/
|
||
private static function update_applicant_connection_test()
|
||
private function update_applicant_connection_test()
|
||
{
|
||
if (Settings::get('self_registration') &&
|
||
(Settings::get('applicant_connection_test_duration') > 0))
|
||
... | ... | |
*
|
||
* @author Michal Kliment
|
||
*/
|
||
private static function send_quened_emails()
|
||
private function send_quened_emails()
|
||
{
|
||
$email_queue_model = new Email_queue_Model();
|
||
|
||
... | ... | |
* @author Michal Kliment
|
||
* @return type
|
||
*/
|
||
private static function update_local_subnets()
|
||
private function update_local_subnets()
|
||
{
|
||
// it's time to update
|
||
if ((
|
||
... | ... | |
*
|
||
* @author Michal Kliment
|
||
*/
|
||
static function monitoring_notification()
|
||
private function monitoring_notification()
|
||
{
|
||
if (Settings::get('email_enabled') && (
|
||
Settings::get('monitoring_notification_update_last') +
|
freenetis/branches/1.1/application/controllers/messages.php | ||
---|---|---|
->callback('callback::message_deactivate_field');
|
||
}
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
if ($this->acl_check_edit('Messages_Controller', 'message'))
|
||
{
|
||
$grid->action_field('id')
|
||
->label('Edit')
|
||
->url('messages/edit')
|
||
->action('Edit');
|
||
$actions->add_conditional_action()
|
||
->condition('is_message_automatical_config')
|
||
->icon_action('settings_auto')
|
||
->url('messages_auto_settings/show')
|
||
->label('Setup automatical activation');
|
||
|
||
$actions->add_action()
|
||
->icon_action('edit')
|
||
->url('messages/edit');
|
||
}
|
||
|
||
if ($this->acl_check_delete('Messages_Controller', 'message'))
|
||
{
|
||
$grid->callback_field('id')
|
||
->label('Delete')
|
||
->callback('callback::message_delete_field');
|
||
$actions->add_conditional_action()
|
||
->condition('is_message_type_of_user')
|
||
->icon_action('delete')
|
||
->url('messages/delete')
|
||
->class('delete_link');
|
||
}
|
||
|
||
if (!$hide_grid)
|
||
... | ... | |
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'))
|
||
!Settings::get('finance_enabled'))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
freenetis/branches/1.1/application/controllers/phone_operators.php | ||
---|---|---|
}
|
||
else
|
||
{
|
||
status::error('Error - cant delete this phone operator.', $e);
|
||
status::error('Error - cant delete this phone operator.');
|
||
}
|
||
|
||
// redirect to show all
|
freenetis/branches/1.1/application/controllers/messages_auto_settings.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/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* Controller manages automatical notification of the notification message.
|
||
*
|
||
* @package Controller
|
||
* @author Ondřej Fibich
|
||
*/
|
||
class Messages_auto_settings_Controller extends Controller
|
||
{
|
||
|
||
/**
|
||
* Shows all settings of the given message.
|
||
*/
|
||
public function show($message_id = NULL)
|
||
{
|
||
// check param
|
||
if (!intval($message_id))
|
||
{
|
||
self::warning(PARAMETER);
|
||
}
|
||
|
||
$message = new Message_Model($message_id);
|
||
$message_aa = new Messages_automatical_activation_Model();
|
||
|
||
// check if exists
|
||
if (!$message || !$message->id ||
|
||
!Message_Model::can_be_activate_automatically($message->type))
|
||
{
|
||
self::error(RECORD);
|
||
}
|
||
|
||
// access check
|
||
if (!$this->acl_check_view('Messages_Controller', 'auto_config'))
|
||
{
|
||
self::error(ACCESS);
|
||
}
|
||
|
||
// gets data
|
||
$query = $message_aa->get_message_settings($message->id);
|
||
|
||
// grid
|
||
$grid = new Grid('messages_auto_settings', null, array
|
||
(
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
));
|
||
|
||
if ($this->acl_check_new('Messages_Controller', 'auto_config'))
|
||
{
|
||
$grid->add_new_button(
|
||
'messages_auto_settings/add/' . $message->id,
|
||
__('Add new rule'), array('class' => 'popup_link')
|
||
);
|
||
}
|
||
|
||
$grid->field('id')
|
||
->label('ID');
|
||
|
||
$grid->callback_field('type')
|
||
->callback('callback::message_auto_setting_type');
|
||
|
||
$grid->callback_field('attribute')
|
||
->callback('callback::message_auto_setting_attribute');
|
||
|
||
if (Settings::get('redirection_enabled'))
|
||
{
|
||
$grid->callback_field('redirection_enabled')
|
||
->callback('callback::boolean')
|
||
->label('Redirection');
|
||
}
|
||
|
||
if (Settings::get('email_enabled'))
|
||
{
|
||
$grid->callback_field('email_enabled')
|
||
->callback('callback::boolean')
|
||
->label('E-mail');
|
||
}
|
||
|
||
if (Settings::get('sms_enabled'))
|
||
{
|
||
$grid->callback_field('sms_enabled')
|
||
->callback('callback::boolean')
|
||
->label('SMS');
|
||
}
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
if ($this->acl_check_delete('Messages_Controller', 'auto_config'))
|
||
{
|
||
$actions->add_action()
|
||
->icon_action('delete')
|
||
->url('messages_auto_settings/delete')
|
||
->class('delete_link');
|
||
}
|
||
|
||
// load datasource
|
||
$grid->datasource($query);
|
||
|
||
// bread crumbs
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('messages/show_all', 'Messages',
|
||
$this->acl_check_view('Messages_Controller', 'message'))
|
||
->text($message->name)
|
||
->text('Automatical activation settings')
|
||
->html();
|
||
|
||
// main view
|
||
$view = new View('main');
|
||
$view->title = __('Automatical activation settings');
|
||
$view->content = new View('show_all');
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content->headline = __('Automatical activation settings');
|
||
$view->content->table = $grid;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Adds a new rule
|
||
*
|
||
* @param integer $message_id
|
||
*/
|
||
public function add($message_id = NULL)
|
||
{
|
||
// check param
|
||
if (!$message_id || !is_numeric($message_id))
|
||
{
|
||
self::warning(PARAMETER);
|
||
}
|
||
|
||
// check access
|
||
if (!$this->acl_check_new('Messages_Controller', 'auto_config'))
|
||
{
|
||
self::error(ACCESS);
|
||
}
|
||
|
||
// load model
|
||
$message = new Message_Model($message_id);
|
||
$messages = Messages_automatical_activation_Model::get_type_messages();
|
||
|
||
// check exists
|
||
if (!$message->id ||
|
||
!Message_Model::can_be_activate_automatically($message->type))
|
||
{
|
||
self::error(RECORD);
|
Také k dispozici: Unified diff
freenetis_1.1.0~alpha34
Novinky:
- closes #467: Aktivace upozorneni a strhavani cronem
Opravy:
- logovani exception (chyba v pretypovani)