Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 169

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

Vylepsena metoda ip_info - nyni vypada lip a zobrazuje vice informaci.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
'fee or penalty comment'=> 'Komentář k poplatku/pokutě',
'from/to'=> 'Od/komu',
'from'=> 'Od',
'gateway ip address' => 'IP adresa brány',
'gateway ip address' => 'IP adresa brány',
'gateway name' => 'Jméno brány',
'gps' => 'GPS souřadnice',
'regular member'=> 'Řádný člen',
'change'=> 'Změnit',
......
'in database can be only one operating account.'=> 'V databázi může být pouze jeden operační účet.',
'in database can be only one suppliers account.'=> 'V databázi může být pouze jeden účet dodavatelů.',
'in database can be only one unidentified account.'=> 'V databázi může být pouze jeden neidentifikovaný účet.',
'information' => 'Informace',
'information' => 'Informace',
'informations about device' => 'Informace o zařízení',
'informations about gateway' => 'Informace o bráně',
'infrastructure account' => 'Účet infrastruktury',
'interface detail' => 'Detail rozhraní',
'interface is successfully saved' => 'Rozhraní bylo úspěšně uloženo.',
......
'login to' => 'Přihlášení',
'login' => 'Přihlásit',
'logout' => 'Odhlásit',
'mac' => 'MAC',
'mac' => 'MAC',
'mac address' => 'MAC adresa',
'map' => 'Mapa',
'master bank account'=> 'Hlavní bankovní účet sdružení',
'member'=> 'Člen',
freenetis/trunk/kohana/application/controllers/redirect.php
}
function ip_info()
function ip_info($ip_address = NULL)
{
$ip_address = server::remote_addr();
if (!$ip_address) $ip_address = server::remote_addr();
$ip_address_model = new Ip_address_Model();
$this_ip = $ip_address_model->where('IP_address',$ip_address)->find();
$device_name = '';
$device_type = '';
$engineer_names = '';
$mac = '';
$user_name = '';
$count_engineers = 0;
if ($this_ip->id)
{
$mac = $this_ip->iface->MAC;
$device_name = $this_ip->iface->device->name;
$enum_type_model = new Enum_type_Model();
$device_type = $enum_type_model->get_value($this_ip->iface->device->type);
$device_engineer_model = new Device_engineer_Model();
$engineers = $device_engineer_model->where('device_id',$this_ip->iface->device->id)->find_all();
$arr_engineers = array();
foreach ($engineers as $engineer) $arr_engineers[] = $engineer->user->name.' '.$engineer->user->surname;
$count_engineers = count($arr_engineers);
$engineer_names = implode(', ',$arr_engineers);
$user_name = $this_ip->iface->device->user->name.' '.$this_ip->iface->device->user->surname;
}
$ip = ip2long($ip_address);
$subnet_model = new Subnet_Model();
......
$arr_ip[3]++;
$gateway_ip = implode('.',$arr_ip);
$ip_model = new Ip_address_Model();
$ap = $ip_model->where('IP_address',$gateway_ip)->find();
$ap = $ip_address_model->where('IP_address',$gateway_ip)->find();
if ($ap->iface_id!=NULL)
{
$segment_name = $ap->iface->segment->name;
$gateway_name = $ap->iface->device->name;
$device_id = $ap->iface->device->id;
$vlan_iface_name = '';
}
else if ($ap->vlan_iface_id!=NULL)
{
$segment_name = $ap->vlan_iface->iface->segment->name;
//$segment_name = $ap->vlan_iface->iface->segment->name;
$segment_name = '';
$gateway_name = $ap->vlan_iface->iface->device->name;
$device_id = $ap->vlan_iface->iface->device->id;
$vlan_iface_name = $ap->vlan_iface->name;
}
$device_admin_model = new Device_admin_Model();
......
$view->header->menu = Controller::Render_menu();
$view->content = new View('redirect/ip_info');
$view->content->ip_address = $ip_address;
$view->content->mac = $mac;
$view->content->user_name = $user_name;
$view->content->count_engineers = $count_engineers;
$view->content->engineer_names = $engineer_names;
$view->content->device_name = $device_name;
$view->content->device_type = $device_type;
$view->content->subnet_name = $subnet->name;
$view->content->segment_name = $segment_name;
$view->content->gateway_name = $gateway_name;
$view->content->gateway_ip = $gateway_ip;
$view->content->vlan_iface_name = $vlan_iface_name;
$view->content->admins = $admins;
$view->content->contacts = $contacts;
$view->content->contact_types = $contact_type_names;
freenetis/trunk/kohana/application/views/redirect/ip_info.php
<h2><?php echo url_lang::lang('texts.Information') ?></h2><br />
<b><?php echo url_lang::lang('texts.IP address') . ':' ?></b> <?php echo $ip_address ?><br />
<table class="extended" style="width: 300px;">
<tr>
<th colspan="2"><?php echo url_lang::lang('texts.Informations about device') ?></th>
</tr>
<?php if ($device_name!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.Name') ?>:</th>
<td><?php echo $device_name ?></td>
</tr>
<?php endif ?>
<?php if ($device_type!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.Type') ?>:</th>
<td><?php echo $device_type ?></td>
</tr>
<?php endif ?>
<tr>
<th><?php echo url_lang::lang('texts.IP address') ?>:</th> +<td><?php echo $ip_address ?></td>
</tr>
<?php if ($mac!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.MAC address') ?>:</th>
<td><?php echo $mac ?></td>
</tr>
<?php endif ?>
<?php if ($user_name!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.User') ?>:</th>
<td><?php echo $user_name ?></td>
</tr>
<?php endif ?>
<?php if ($engineer_names!=''): ?>
<tr>
<th><?php echo ($count_engineers>1) ? url_lang::lang('texts.Engineers') : url_lang::lang('texts.Engineer') ?>:</th>
<td><?php echo $engineer_names ?></td>
</tr>
<?php endif ?>
</table>
<b><?php echo url_lang::lang('texts.Subnet name') . ':' ?></b> <?php echo $subnet_name ?><br />
<br />
<b><?php echo url_lang::lang('texts.Gateway name') . ':' ?></b> <?php echo $gateway_name ?><br />
<table class="extended" style="width: 300px;">
<tr>
<th colspan="2"><?php echo url_lang::lang('texts.Informations about gateway') ?></th>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Gateway name') ?>:</th>
<td><?php echo $gateway_name ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.IP address') ?>:</th>
<td><?php echo $gateway_ip ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Subnet name') ?>:</th>
<td><?php echo $subnet_name ?></td>
</tr>
<?php if ($segment_name!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.Segment name') ?>:</th>
<td><?php echo $segment_name ?></td>
</tr>
<?php endif ?>
<?php if ($vlan_iface_name!=''): ?>
<tr>
<th><?php echo url_lang::lang('texts.Vlan interface name') ?>:</th>
<td><?php echo $vlan_iface_name ?></td>
</tr>
<?php endif ?>
</table>
<b><?php echo url_lang::lang('texts.Gateway IP address') . ':' ?></b> <?php echo $gateway_ip ?><br />
<b><?php echo url_lang::lang('texts.Segment name') . ':' ?></b> <?php echo $segment_name ?><br /><br />
<?php echo (count($admins)>0) ? '<h3>'.url_lang::lang('texts.Admins').'</h3>' : '' ?>
<?php echo (count($admins)>0) ? '<br /><h3>'.url_lang::lang('texts.Admins').'</h3><br />' : '' ?>
<?php foreach ($admins as $admin): ?>
<b><?php echo $admin->surname . ' '. $admin->name ?></b><br />
<?php echo $admin->member->street ?> <?php echo $admin->member->street_number ?>, <?php echo $admin->member->town ?><br />
<?php echo url_lang::lang('texts.Phone') ?>: <?php echo $admin->phone ?><br />
E-mail: <?php echo $admin->email ?><br />
<table class="extended" style="width: 300px;">
<tr>
<th colspan="2"><?php echo $admin->surname . ' '. $admin->name ?></th>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Address') ?>:</th><td><?php echo $admin->member->street ?> <?php echo $admin->member->street_number ?>, <?php echo $admin->member->town ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Phone') ?>:</th><td><?php echo $admin->phone ?></td>
</tr>
<tr>
<th>E-mail: </th><td><?php echo $admin->email ?></td>
</tr>
<?php foreach ($contacts[$admin->id] as $contact): ?>
<?php echo $contact_types[$contact->type] ?>: <?php echo $contact->value ?><br />
<tr>
<th><?php echo $contact_types[$contact->type] ?>:</th><td><?php echo $contact->value ?></td>
</tr>
<?php endforeach ?>
</table>
<br />
<?php endforeach ?>

Také k dispozici: Unified diff