Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 563

Přidáno uživatelem Jiří Sviták před téměř 15 roky(ů)

vylepseni orientace v ip adresach a rozhranich

Zobrazit rozdíly:

freenetis/trunk/kohana/application/models/iface.php
return self::$db->count_records('ifaces');
}
public function get_ifaces_of_segment($segment_id)
{
return self::$db->query("
SELECT i.id, i.mac, d.name AS device_name
FROM ifaces i
JOIN devices d ON d.id = i.device_id
WHERE i.segment_id = $segment_id
");
}
/**
* Function gets count of specified mac address. Used for testing existence of that mac.
* @param $mac searched mac address
freenetis/trunk/kohana/application/controllers/segments.php
$enum_type_model = new Enum_type_Model();
$translation_model = new Translation_Model();
$medium = $translation_model->get_translation($enum_type_model->get_value($segment->medium_id));
// interfaces of segment
$iface_model = new Iface_Model();
$ifaces = $iface_model->get_ifaces_of_segment($segment_id);
$grid = new Grid(url_lang::base().'subnets/show/'.$segment_id, url_lang::lang('texts.Interfaces'), array(
'use_paginator' => false,
'use_selector' => false
));
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('device_name')->label(url_lang::lang('texts.Device name'));
$grid->field('mac')->label(url_lang::lang('texts.MAC'));
$grid->action_field('id')->label(url_lang::lang('texts.Interface'))->url(url_lang::base().'ifaces/show')->action(url_lang::lang('texts.Show'))->class('center');
$grid->datasource($ifaces);
$headline = url_lang::lang('texts.Segment detail').' - '.$segment->name;
$view = new View('main');
......
$view->content = new View('segments_show');
$view->content->segment = $segment;
$view->content->medium = $medium;
$view->content->grid = $grid;
$view->content->link_back = html::anchor(url_lang::base().'segments/show_all', url_lang::lang('texts.Back to segments list'));
$view->content->headline = $headline;
$view->render(TRUE);
freenetis/trunk/kohana/application/views/ifaces_show.php
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Segment name') ?></th>
<td><?php echo $iface->segment->name ?></td>
<td><?php echo html::anchor(url_lang::base().'segments/show/'.$iface->segment_id, $iface->segment->name) ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.MAC') ?></th>
freenetis/trunk/kohana/application/views/ip_addresses_show.php
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Subnet name') ?></th>
<td><?php echo $ip_address->subnet->name ?></td>
<td><?php echo html::anchor(url_lang::base().'subnets/show/'.$ip_address->subnet_id, $ip_address->subnet->name) ?></td>
</tr>
<tr>
<th><?php echo url_lang::lang('texts.Subnet network address') ?></th>
freenetis/trunk/kohana/application/views/segments_show.php
<td><?php echo $segment->comment ?></td>
</tr>
</table><br />
</table>
<br />
<br />
<?php echo $grid ?>

Také k dispozici: Unified diff