Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 626

Přidáno uživatelem Roman Ševčík před více než 14 roky(ů)

Přidány další funkce pro lBilling PHP API a zobraqzení výpisu hovorů, opraveno mnoho chyb.
Do Gridu přidána možnost calbacku.
Přidán helper resource, který slouží pro lehčí správu médií.

Zobrazit rozdíly:

freenetis/trunk/kohana/media/images/flags/LICENCE.txt
http://www.33ff.com/flags/
Copyright Notice
This freeware images may be used as long as they remain intact
and you add a courtesy link to this page in your website or blog.
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
$lang = array
(
'0 means unlimited limit' => '0 znamená neomezený limit.',
'access rights' => 'Přístupová práva',
'access to system' => 'Přístup do systému',
'according to freenetis' => 'podle freenetisu',
......
'add new user' => 'Přidat nového uživatele',
'add new vlan interface' => 'Přidat nové VLAN rozhraní',
'add new vlan' => 'Přidat nový VLAN',
'add new voip transfer' => 'Přidat nový VoIP převod',
'add new whole device' => 'Přidat nové celé zařízení',
'add new whole device for user' => 'Přidat nové celé zařízení pro uživatele',
'add new work' => 'Přidat novou práci',
......
'billing settings' => 'Nastavení Billingu',
'birthday' => 'Datum narození',
'bitrate' => 'Rychlost přenosu',
'caller' => 'Volající',
'callcon' => 'Volaný',
'cannot delete, there are other records depending on this one' => 'Nelze smazat, na položce jsou závislé jiné záznamy',
'cash' => 'Pokladna',
'cash flow' => 'Peněžní tok',
......
'dependent transfer' => 'Závislý převod',
'deposit' => 'Vklad',
'description' => 'Popis',
'destination' => 'Destinace',
'destination account' => 'Cílový účet',
'destination bank account' => 'Cílový bankovní účet',
'destination credit account' => 'Cílový kreditní účet',
......
'edit ip address' => 'Upravit IP adresu',
'edit ip address redirection' => 'Upravit přesměrování IP adresy',
'edit member' => 'Upravit člena',
'edit member limit' => 'Upravit limit člena',
'edit port' => 'Úprava portu',
'edit redirection message' => 'Úprava zprávy přesměrování',
'edit registrations' => 'Upravit přihlášky',
......
'error - cant edit fee' => 'Chyba - nelze upravit poplatek.',
'error - cant end membership' => 'Chyba - nelze ukončit členství.',
'error - cant change password' => 'Chyba - nelze změnit heslo.',
'error - cant change limit' => 'Chyba - nelze změnit limit.',
'error - cant restore membership' => 'Chyba - nelze obnovit členství.',
'error - cant set redirection' => 'Chyba - nelze nastavit přesměrování.',
'error - cant update account' => 'Chyba - nelze upravit účet.',
......
'last time login' => 'Poslední čas přihlášení',
'leaving date' => 'Datum vystoupení',
'leaving_date' => 'Datum vystoupení',
'length' => 'Délka',
'license' => 'Licence',
'linenr' => 'Počet řádků',
'limit has been successfully changed' => 'Limit byl úspěšně změněn.',
'list of all address points' => 'Seznam všech adresních bodů',
'list of all backups' => 'Seznam všech záloh konfigurací',
'list of all calls' => 'Výpis všech hovorů',
'list of all clouds' => 'Seznam všech oblastí',
'list of all confirmed works' => 'Seznam všech potvrzených prací',
'list of all invoices' => 'Seznam všech faktur',
......
'origin account' => 'Zdrojový účet',
'origin bank account' => 'Zdrojový bankovní účet',
'original term' => 'Původní výraz',
'originating call' => 'Odchozí volání',
'ospf area id' => 'OSPF area ID',
'other' => 'Ostatní',
'other phones' => 'další telefony',
......
'registered applicants' => 'Registrovaní zájemci',
'registration' => 'Přihláška',
'registration in association' => 'registrace ve sdružení',
'registration will be activated after midnight' => 'Registrace bude aktivní po půlnoci.',
'registrations' => 'Přihlášky',
'registration form' => 'Registrační formulář',
'regular member' => 'Řádný člen',
'regular members' => 'Řádní členové',
'recharge voip credit' => 'Dobít VoIP kredit',
'recharging of voip credit' => 'Dobití VoIP kreditu',
'recharge' => 'Dobít',
'remove' => 'Odebrat',
'remove broadcast ip address' => 'Odebrat IP adresu broadcastu',
'remove network ip address' => 'Odebrat IP adresu sítě',
......
'save' => 'Uložit',
'save wireless setting' => 'Uložit bezdrátové nastavení',
'search' => 'Hledat',
'second-degree certified engineers' => 'Certifikovaní technici druhého stupně',
'second-degree certified engineers' => 'Certifikovaní technici druhého stupně',
'secondary dns' => 'Sekundární DNS.',
'section' => 'Sekce',
'send' => 'Odeslat',
......
'send sms' => 'Pošli SMS',
'send sms message' => 'Poslat SMS zprávu',
'send to member' => 'Pošli členovi',
'september' => 'Září',
'september' => 'Září',
'service' => 'Služba',
'settings' => 'Nastavení',
'settings for configuration files has been successfully updated' => 'Nastavení pro kofigurační soubory bylo úspěšně upraveno',
......
'show works' => 'Zobrazit práce',
'signature of applicant member' => 'podpis žadatele - člena',
'signature and stamp' => 'Podpis a razítko',
'sixth-degree certified engineers' => 'Certifikování technici šestého stupně',
'sixth-degree certified engineers' => 'Certifikování technici šestého stupně',
'smokeping menu parent' => 'Rodič v menu smokepingu',
'smokeping monitoring' => 'Monitorování smokepingem',
'smokeping record has been successfully added' => 'Záznam smokepingu byl úspěšně přidán',
......
'start amount' => 'Počáteční částka',
'static ip' => 'Statická IP',
'state' => 'Stav',
'stats' => 'Statistiky',
'stats' => 'Statistiky',
'street' => 'Ulice',
'street already exists' => 'Ulice již existuje',
'street detail' => 'Detail ulice',
......
'system variables' => 'Systémové proměnné',
'system variables have been successfully updated' => 'Systémové proměnné byly úspěšně aktualizovány',
'system variables havent been updated' => 'Systémové proměnné nebyly úspěšně aktualizovány',
'table' => 'Tabulka',
'table' => 'Tabulka',
'tag_802_1q' => 'tag 802.1Q',
'target website' => 'Cílový web pro přesměrování',
'technology' => 'Technologie',
......
'template has been successfully added' => 'Šablona byla úspěšně přidána.',
'template has been successfully updated' => 'Šablona byla úspěšně upravena.',
'template name' => 'Název šablony',
'tenth-degree certified engineers' => 'Certifikování technici desátého stupně',
'tenth-degree certified engineers' => 'Certifikování technici desátého stupně',
'terminating call' => 'Příchozí volání',
'tertiary dns' => 'Terciární DNS.',
'testing driver' => 'Test ovladače',
'the first bank account information' => 'Údaje o prvním bankovním účtu',
'the parsed account is unknown' => 'Parsovaný účet je neznámý',
'the transfer successfully done' => 'Převod úspěšně dokončen',
'there are no items yet' => 'Neobsahuje žádné záznamy.',
'third-degree certified engineers' => 'Certifikovaní technici třetího stupně',
'third-degree certified engineers' => 'Certifikovaní technici třetího stupně',
'this account does not exist' => 'Tento účet neexistuje.',
'this month has been already deducted!' => 'Tento měsíc už byl stržen!',
'time' => 'Čas',
'time deposits' => 'Termínované vklady',
'time deposits nr' => 'Počet termínovaných vkladů',
'time deposits drawn' => 'Term. vklady (stažené)',
'time deposits drawn nr' => 'Počet term. vkladů (stažené)',
'timestamp' => 'Čas',
'title' => 'Titul',
'time deposits drawn' => 'Term. vklady (stažené)',
'time deposits drawn nr' => 'Počet term. vkladů (stažené)',
'timestamp' => 'Čas',
'title' => 'Titul',
'to' => 'Komu',
'tools' => 'Nástroje',
'total inbound' => 'Celkem příchozí',
'tools' => 'Nástroje',
'total inbound' => 'Celkem příchozí',
'total items' => 'Celkem položek',
'total outbound' => 'Celkem odchozí',
'total outbound' => 'Celkem odchozí',
'town' => 'Město',
'town already exists' => 'Město již existuje.',
'town detail' => 'Detail města',
......
'transfer has been successfully updated' => 'Převod byl úspěšně upraven.',
'transfer id' => 'ID převodu',
'transfer information' => 'Informace o převodu',
'transfer will be effected within 15 minutes' => 'Převod bude uskutečněn během 15 minut.',
'transfers' => 'Převody',
'transfers of bank account' => 'Převody na bankovním účtu',
'transfers of credit account' => 'Převody na kreditním účtu',
......
'voip number must be 9 characters long' => 'VoIP číslo musí obsahovat 9 znaků',
'voip number must be a number' => 'VoIP číslo musí být číslo',
'voip settings' => 'Nastavení VoIP',
'waiting for registration' => 'Čekám na registraci',
'warning' => 'Varování',
'website after redirection' => 'Webová stránka po přesměrování',
'without change' => 'Beze změny',
freenetis/trunk/kohana/application/vendors/billing/lbilling/perl/lbilling-set_account_limit.pl
#!/usr/bin/perl
use strict;
use DBI;
use Getopt::Std;
use Data::Dumper;
use warnings;
if ($#ARGV != 3) {
print "Wrong number of parameters", "\n";
exit 0;
}
use SOAP::Lite +autodispatch =>
uri => "http://sip.nfx.czf/lBilling",
proxy => 'https://'.$ARGV[0].':'.$ARGV[1].'@sip.nfx.czf/cgi-bin/admin/lbilling/soap.pl';
my $lbilling = lBilling->new();
unless ( $lbilling ) {
print "Could not create SOAP instance", "\n";
exit 0;
}
my $result;
my $i;
my $account = {"billingid" => $ARGV[2], "limit" => $ARGV[3]};
if ( $result = $lbilling->set_account_limit($account) ) {
#print $result->{"billingid"}, ";";
#print $result->{"from"}, ";";
#print $result->{"to"}, "\n";
Dumper($result);
exit 1;
} else {
my $error = $lbilling->get_error();
my $errcount = @{$lbilling->get_error()};
for ($i=0; $i<$errcount; $i++)
{
print $lbilling->get_error()->[$i], "\n";
}
exit 0;
}
freenetis/trunk/kohana/application/helpers/resource.php
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Cookie resource class.
*
*
*
* @package Core
* @author Bonerek
* @copyright (c) 2007-2008 Kohana Team
* @license http://kohanaphp.com/license.html
*/
class resource_Core {
public static function voip($state)
{
switch($state)
{
case 'originating':
return url::base().'media/images/voip-originating.png';
case 'terminating':
return url::base().'media/images/voip-terminating.png';
default;
return '';
}
}
public static function flag($state)
{
switch($state)
{
case 'cs':
return url::base().'media/images/flags/cs.png';
default;
return '';
}
}
} // End resource
freenetis/trunk/kohana/application/controllers/members.php
$mi_grid->action_field('id') ->label(url_lang::lang('texts.Membership interrupts'))->url(url_lang::base().'membership_interrupts/delete')->action(url_lang::lang('texts.Delete'));
$mi_grid->datasource($mis);
$voip_sip = new Voip_sip_Model();
$voip = $voip_sip->get_all_record_by_member_limited($member_id);
$voip_grid = new Grid(url_lang::base().'members', null, array(
$billing = new Billing();
$has_driver = $billing->has_driver();
$b_account = $billing->get_account($member_id);
$voip_sip = new Voip_sip_Model();
$voip = $voip_sip->get_all_record_by_member_limited($member_id);
$voip_grid = new Grid(url_lang::base().'members', null, array(
'separator' => '<br /><br />',
'use_paginator' => false,
'use_selector' => false,
......
'variables' => $member_id.'/'
));
//$voip_grid->order_field('id')->label('ID');
$voip_grid->field('name')->label(url_lang::lang('texts.Number'));
$voip_grid->action_field('user_id')->label(url_lang::lang('texts.Account'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
$voip_grid->action_field('user_id')->label(url_lang::lang('texts.User'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
$voip_grid->datasource($voip);
$voip_grid->field('name')->label(url_lang::lang('texts.Number'));
$voip_grid->action_field('user_id')->label(url_lang::lang('texts.Account'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
$voip_grid->action_field('user_id')->label(url_lang::lang('texts.User'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
$voip_grid->datasource($voip);
$billing = new Billing();
if ($has_driver && ($b_account != null))
{
$voip_grid->add_new_button(url_lang::base().'voip_calls/show_by_member/'.$member_id, url_lang::lang('texts.List of all calls'));
$voip_grid->add_new_button(url_lang::base().'transfers/add_voip/'.$account->id, url_lang::lang('texts.Recharge VoIP credit'));
}
// view
$view = new View('main');
$view->title = url_lang::lang('texts.Display member');
......
$view->content->account = $account;
$view->content->users = $user_grid;
$view->content->voip = $voip_grid;
$view->content->billing_has_driver = $billing->has_driver();
$view->content->billing_account = $billing->get_account($member_id);
$view->content->count_voip = count($voip);
$view->content->billing_has_driver = $has_driver;
$view->content->billing_account = $b_account;
$view->content->mis = $mi_grid;
foreach($member_data as $key=>$val)
{
freenetis/trunk/kohana/application/controllers/voip_calls.php
url::redirect(url_lang::base().'voip_call/show_all');
}
function show_by_member($member_id = null, $from = null, $to = null, $limit_results = 100, $order_by = 'user_id', $order_by_direction = 'asc', $page_word = null, $page = 1)
function show_by_member($member_id = null, $from = null, $to = null, $limit_results = 100, $order_by = 'type', $order_by_direction = 'asc', $page_word = null, $page = 1)
{
if (!$this->acl_check_view('VoIP_Controller', 'voip'))
Controller::error(ACCESS);
......
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
// parameters control
$allowed_order_type = array('id', 'name', 'user_id');
$allowed_order_type = array('type', 'callee');
if (!in_array(strtolower($order_by), $allowed_order_type))
$order_by = 'user_id';
$order_by = 'type';
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
$order_by_direction = 'asc';
......
'limit_results' => $limit_results,
'message' => $this->session->get_once('message')
));
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
$grid->order_field('type')->label(url_lang::lang('texts.Type'));
$grid->order_field('callee')->label(url_lang::lang('texts.Number'));
$grid->callback_field('type')->label(url_lang::lang('texts.Type'))->callback('VoIP_calls_Controller::type');
$grid->callback_field('caller')->label(url_lang::lang('texts.Caller'))->callback('VoIP_calls_Controller::caller');
$grid->callback_field('callcon')->label(url_lang::lang('texts.Callcon'))->callback('VoIP_calls_Controller::callcon');
$grid->callback_field('callcon')->label(url_lang::lang('texts.Destination'))->callback('VoIP_calls_Controller::destination');
$grid->field('start_date')->label(url_lang::lang('texts.Date'));
$grid->callback_field('end_date')->label(url_lang::lang('texts.Length'))->callback('VoIP_calls_Controller::call_length');
$grid->callback_field('rate_sum')->label(url_lang::lang('texts.Price'))->callback('VoIP_calls_Controller::price');;
//$grid->action_field('id')->label(url_lang::lang('texts.VoIP'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
//$grid->action_field('callee')->label(url_lang::lang('texts.Account'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
//$grid->action_field('callee')->label(url_lang::lang('texts.Account'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
//$grid->action_field('user_id')->label(url_lang::lang('texts.User'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
$grid->datasource($calls);
$grid->datasource(array_reverse($calls));
$view = new View('main');
$view->title = $headline;
$view->content = $grid;
$view->render(TRUE);
}
public static function caller($item, $name)
{
$n = substr($item->caller, 4, strlen($item->caller) - 4);
echo VoIP_calls_Controller::parse_number($n);
}
public static function callcon($item, $name)
{
$n = substr($item->callcon, 4, strlen($item->callcon) - 4);
if (($item->area == 'ENUM'))
echo $n;
else
{
echo VoIP_calls_Controller::parse_number($n);
}
}
public static function parse_number($sip_uri)
{
$sip_uri = explode('@', $sip_uri);
if (valid::digit($sip_uri[0]))
{
if (strlen($sip_uri[0]) == 12)
return '00'.$sip_uri[0];
elseif (strlen($sip_uri[0]) == 14)
return $sip_uri[0];
else
return '00420'.$sip_uri[0];
}
}
public static function price($item, $name)
{
echo $item->rate_sum.' '.$item->currency;
}
public static function call_length($item, $name)
{
$sek=strtotime($item->end_date)-strtotime($item->start_date);
if ($sek == 0)
echo '00:00:00';
else
{
$min=floor($sek/60);
$sek=$sek%60;
$hod=floor($min/60);
$min=$min%60;
if (strlen($sek) == 1)
$sek = '0'.$sek;
if (strlen($min) == 1)
$min = '0'.$min;
if (strlen($hod) == 1)
$hod = '0'.$hod;
echo $hod.':'.$min.':'.$sek;
}
}
public static function type($item, $name)
{
if ($item->type == 'originating')
echo '<div style="text-align:center;">'.html::image(array('src' => resource::voip('originating'), 'alt' => url_lang::lang('texts.Originating call'), 'title' => url_lang::lang('texts.Originating call'))).'</div>';
elseif ($item->type == 'terminating')
echo '<div style="text-align:center;">'.html::image(array('src' => resource::voip('terminating'), 'alt' => url_lang::lang('texts.Terminating call'), 'title' => url_lang::lang('texts.Terminating call'))).'</div>';
else
echo '?';
}
public static function destination($item, $name)
{
//$title = url_lang::lang('texrs.'.$item->area);
$title = $item->area;
echo '<div style="text-align:center;">'.html::image(array('src' => resource::flag('cs'), 'alt' => url_lang::lang('texts.CS'), 'title' => $title)).'</div>';
}
}
freenetis/trunk/kohana/application/controllers/settings.php
// page title
$this->form->input('title')->label(url_lang::lang('texts.Page title').':')->rules('length[3,40]|required')->value($this->setting->title);
// currency
$this->form->input('currency')->label(url_lang::lang('texts.Currency').':')->rules('length[3,40]|required')->value($this->setting->currency);
// currency
$this->form->input('currency')->label(url_lang::lang('texts.Currency').':')->rules('length[3,40]|required')->value($this->setting->currency);
// self-registration
$this->form->radio('self_registration')->label(url_lang::lang('texts.Self-registration').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default($this->setting->self_registration);
// self-registration
$this->form->radio('self_registration')->label(url_lang::lang('texts.Self-registration').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default($this->setting->self_registration);
$this->form->group('')->label(url_lang::lang('texts.E-mail settings'));
freenetis/trunk/kohana/application/controllers/transfers.php
url::redirect(url_lang::base().'transfers/show_by_account/'.$origin_account);
}
}
if ($this->acl_check_view('Members_Controller','members', $origin_acc->member_id))
$links[] = html::anchor(url_lang::base().'members/show/'.$origin_acc->member_id, url_lang::lang('texts.Back to the member'));
$links[] = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account, url_lang::lang('texts.Back to transfers of account'));
$headline = url_lang::lang('texts.Add new transfer');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->content->link_back = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account, url_lang::lang('texts.Back to transfers of account'));
$view->render(TRUE);
$view->content->link_back = implode (' | ', $links);
$view->render(TRUE);
}
/**
......
$account= ORM::factory('account')->where('id', $origin_account)->find();
if (!$billing->has_driver() || ($billing->get_account($account->member_id) == null))
Controller::error(RECORD);
Controller::error(RECORD);
if (isset($origin_account)) { // transfer from specific account ?
$this->origin = $origin_account; // save for callback function valid_amount_to_send
......
url::redirect(url_lang::base().'transfers/show_by_account/'.$origin_account);
}
}
$headline = url_lang::lang('texts.Add new transfer');
if ($this->acl_check_view('Members_Controller','members', $account->member_id))
$links[] = html::anchor(url_lang::base().'members/show/'.$account->member_id, url_lang::lang('texts.Back to the member'));
$links[] = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account, url_lang::lang('texts.Back to transfers of account'));
$headline = url_lang::lang('texts.Add new VoIP transfer');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->content->link_back = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account, url_lang::lang('texts.Back to transfers of account'));
$view->content->link_back = implode (' | ', $links);
$view->content->aditional_info = url_lang::lang('texts.Information').' : '.url_lang::lang('texts.Transfer will be effected within 15 minutes.');
$view->render(TRUE);
}
/**
freenetis/trunk/kohana/application/controllers/voip.php
else
$link_status = false;
$view = new View('main');
$view->title = url_lang::lang('texts.Show VoIP');
$view->content = new View('voip/show');
$view->content->headline = url_lang::lang('texts.Show VoIP');
$view->content->voip = $voip;
$view = new View('main');
$view->title = url_lang::lang('texts.Show VoIP');
$view->content = new View('voip/show');
$view->content->headline = url_lang::lang('texts.Show VoIP');
$view->content->voip = $voip;
$view->content->sip_server = $sip_server;
$view->content->link_status = $link_status;
$view->content->ipaddr = $voip->ipaddr;
......
}
}
function edit_member_limit($member_id = NULL)
function edit_member_limit($member_id = NULL)
{
if (!isset($member_id))
Controller::warning(PARAMETER);
if (!is_numeric($member_id))
Controller::error(RECORD);
Controller::error(RECORD);
$model_members = new Member_Model();
$member = ORM::factory('member')->find($member_id);
if (count($member) == 0)
Controller::error(RECORD);
$member = ORM::factory('member')->find($member_id);
$billing = new Billing();
if (count($member) == 0)
Controller::error(RECORD);
$has_driver = $billing->has_driver();
$b_account = $billing->get_account($member_id);
$form = new Forge(url_lang::base()."voip/edit_member_limit/".$member_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->input('limit')->label(url_lang::lang('texts.Limit').':')->rules('required|length[1,5]|valid_digit')->value($member->voip_billing_limit);
if (!$has_driver || ($b_account == null))
Controller::error(RECORD);
$form = new Forge(url_lang::base()."voip/edit_member_limit/".$member_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->input('limit')->label(url_lang::lang('texts.Limit').':')->rules('length[1,6]|valid_digit')->value($member->voip_billing_limit)->callback(array($this,'valid_timit'));;
$form->submit('submit')->value(url_lang::lang('texts.Change'));
special::required_forge_style($form, ' *', 'required');
if($form->validate())
{
$form_data = $form->as_array();
$member->voip_billing_limit = $form_data['limit'];
$member->voip_billing_limit = $form_data['limit'];
if ($member->save())
{
......
}
else
{
if ($this->acl_check_view('Members_Controller','members', $member_id))
$links[] = html::anchor(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
$message = $this->session->get_once('message');
$headline = url_lang::lang('texts.Edit member limit');
$view = new View('main');
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->content->member_id = $member_id;
$view->content->link_back = implode (' | ', $links);
if ($message)
$view->content->message = $message;
$view->content->aditional_info = url_lang::lang('texts.Information').' : '.url_lang::lang('texts.0 means unlimited limit.');
$view->render(TRUE);
}
}
function edit_member_type($member_id = NULL)
{
if (!isset($member_id))
Controller::warning(PARAMETER);
if (!is_numeric($member_id))
Controller::error(RECORD);
//if (!$this->acl_check_view('VoIP_Controller', 'voip'))
Controller::error(ACCESS);
$member = ORM::factory('member')->find($member_id);
if (count($member) == 0)
Controller::error(RECORD);
$form = new Forge(url_lang::base()."voip/edit_member_type/".$member_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$types = array('prepaid' => url_lang::lang('texts.Prepaid'), 'postpaid' => url_lang::lang('texts.Postpaid'));
$form->dropdown('type')->label(url_lang::lang('texts.Type').':')->options($types)->selected($member->voip_billing_type);
$form->submit('submit')->value(url_lang::lang('texts.Change'));
if($form->validate())
{
$form_data = $form->as_array();
$member->voip_billing_type = $form_data['type'];
if ($member->save())
{
$this->session->set_flash('message', url_lang::lang('texts.Type has been successfully changed.'));
}
else
{
$this->session->set_flash('message', url_lang::lang('texts.Error - cant change type.'));
}
url::redirect(url_lang::base().'voip/edit_member_type/'.$member_id);
}
else
{
$view = new View('main');
$view->title = url_lang::lang('texts.Edit member limit');
$view->content = new View('voip/edit_member_limit');
$view->title = url_lang::lang('texts.Edit member type');
$view->content = new View('voip/edit_member_type');
$view->content->form = $form->html();
$view->content->member_id = $member_id;
$view->content->message = $this->session->get_once('message');
......
}
}
function edit($user_id = NULL)
{
if (!isset($user_id))
......
if(!valid::email($input->value) == true)
$input->add_error('required', url_lang::lang('texts.Must be a valid e-mail'));
}
/**
* Function validates amount of limit.
* @param $input
* @return unknown_type
*/
function valid_timit($input)
{
if ($input->value < 0)
{
$input->add_error('required', url_lang::lang('texts.Error - amount has to be positive.'));
}
}
}
freenetis/trunk/kohana/application/libraries/Order_callback_field.php
<?php
class Order_Callback_Field_Core extends Order_Field
{
public $callback;
public function __construct($name)
{
$this->name = $name;
}
public function __call($method, $args)
{
$this->$method = $args[0];
return $this;
}
public function render()
{
return '<strong>'.ucfirst($this->label).'</strong>';
}
public function __toString()
{
return $this->name;
}
}
freenetis/trunk/kohana/application/libraries/Callback_field.php
<?php
class Callback_Field_Core extends Field
{
public $callback;
public function __construct($name)
{
$this->name = $name;
}
public function __call($method, $args)
{
$this->$method = $args[0];
return $this;
}
public function render()
{
return '<strong>'.ucfirst($this->label).'</strong>';
}
public function __toString()
{
return $this->name;
}
}
freenetis/trunk/kohana/application/libraries/MY_Controller.php
*/
class Controller extends Controller_Core
{
public $gacl_class;
public $arr;
public $setting = NULL;
public $gacl_class;
public $arr;
public $setting = NULL;
public $current_svn_db_schema_version = 0;
private $ICON_ERROR = 1;
freenetis/trunk/kohana/application/views/members_show.php
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Current credit') ?></th>
<td><?php echo $billing_account->ballance.' '.$billing_account->currency ?></td>
<td><?php echo $billing_account->ballance.' '.$billing_account->currency.'&nbsp;&nbsp;-&nbsp;&nbsp;'.html::anchor(url_lang::base().'transfers/add_voip/'.$account->id, url_lang::lang('texts.Recharge')); ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Limit') ?></th>
......
<th><?php echo url_lang::lang('texts.Type') ?></th>
<td><?php echo ($billing_account->type == 'prepaid') ? url_lang::lang('texts.Prepaid') : url_lang::lang('texts.Postpaid') ?></td>
</tr>
<?php }
elseif ($count_voip != 0)
{ ?>
<tr>
<th colspan="2"><?php echo url_lang::lang('texts.VoIP information') ?></th>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.State') ?></th>
<td><?php echo '<b style="color:darkorange" title="'.url_lang::lang('texts.Registration will be activated after midnight.').'">'.url_lang::lang('texts.Waiting for registration').'</b>' ?></td>
</tr>
<?php } ?>
<?php if ($this->acl_check_view('Members_Controller', 'qos_ceil', $member_data->member_id) ||
$this->acl_check_view('Members_Controller', 'qos_rate', $member_data->member_id) ||
freenetis/trunk/kohana/application/views/voip/edit_member_type.php
<h2><?php echo url_lang::lang('texts.Edit member type') ?></h2><br />
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
<?php
$links = array();
$links[] = html::anchor(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
echo implode (' | ', $links)
?>
<br /><br />
<?php echo $form?>
freenetis/trunk/kohana/application/views/grid_template.php
</td>
<?php else: ?>
<?php
// standard field
// standard field
?>
<td <?php echo $class_td?>>
<?php
<?php
if ($field instanceof Callback_Field)
{
if (isset($field->callback))
call_user_func($field->callback, $item, $field->name);
else
echo $item->$field;
}
elseif ($field instanceof Order_Callback_Field)
{
if (isset($field->callback))
call_user_func($field->callback, $item, $field->name);
else
echo $item->$field;
}
// empty field
if (trim($item->$field) == '')
elseif (trim($item->$field) == '')
{
echo '&nbsp;';
}

Také k dispozici: Unified diff