Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2006

Přidáno uživatelem David Raška před více než 11 roky(ů)

closes #561 - Implementace odkazu vedoucich k logu akci u clena, zarizeni, rozhrani a ip adresy

Zobrazit rozdíly:

freenetis/branches/1.1/application/controllers/devices.php
$view = new View('main');
$view->title = __('Device').' '.$device->name;
$view->breadcrumbs = $breadcrumbs->html();
$view->action_logs = action_logs::object_last_modif($device, $device_id);
$view->content = new View('devices/show');
$view->content->device = $device;
$view->content->device_type = $device_type;
freenetis/branches/1.1/application/controllers/ifaces.php
$headline = __('Interface detail').' - '.$iface->name;
$view = new View('main');
$view->breadcrumbs = $breadcrumbs;
$view->action_logs = action_logs::object_last_modif($iface, $iface_id);
$view->title = $headline;
$view->content = new View('ifaces/show');
freenetis/branches/1.1/application/controllers/ip_addresses.php
$view = new View('main');
$view->title = __('IP address detail') . ' - ' . $ip_address->ip_address;
$view->breadcrumbs = $breadcrumbs->html();
$view->action_logs = action_logs::object_last_modif($ip_address, $ip_address_id);
$view->content = new View('ip_addresses/show');
$view->content->ip_address = $ip_address;
$view->content->member = $member;
freenetis/branches/1.1/application/controllers/members.php
$view = new View('main');
$view->title = $title;
$view->breadcrumbs = $breadcrumbs->html();
$view->action_logs = action_logs::object_last_modif($member, $member_id);
$view->content = new View('members/show');
$view->content->title = $title;
$view->content->member = $member;
freenetis/branches/1.1/application/helpers/action_logs.php
<?php defined('SYSPATH') OR die('No direct access allowed.');
/*
* 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/
*
*/
/**
* Action logs helper class.
*
* @author David Raska
*/
class action_logs {
/**
* Helper for showing last modification date and details of object
*
* @param ORM object
* @param int object ID
* @return string
*/
public static function object_last_modif($orm, $object_id)
{
// Action logs enabled?
if (Settings::get('action_logs_active') != 1)
{
return '';
}
$table = $orm->get_table_name();
$log_model = new Log_Model();
if ($log_model->count_all_object_logs($table, $object_id) == 0)
{
return '';
}
// get last modification time of object
$time = $log_model->get_object_last_modification($table, $object_id);
if (!Controller::instance()->acl_check_view('Logs_Controller', 'logs'))
{
// only last modification date
$html = html::image(array
(
'src' => 'media/images/icons/action_logs.png',
'title' => __('Last changed date')
)).
'&nbsp<span title="'.__('Last changed date').'">'.$time.'</span>';
}
else
{
// link to details
$html = html::anchor('logs/show_object/'.$table.'/'.$object_id,
html::image(array
(
'src' => 'media/images/icons/action_logs.png',
'title' => __('Show object action logs')
))).
'&nbsp<span title="'.__('Last changed date').'">'.$time.'</span>';
}
return $html;
}
}
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'show menu' => 'Zobrazit menu',
'show monitoring detail of device' => 'Zobrazit detail monitoringu zařízení',
'show more information about traffic of this member' => 'Zobrazit více informací o provozu tohoto člena',
'show object action logs' => 'Zobrazit logy akcí objektu',
'show parent for this message' => 'Zobrazit rodiče této zprávy',
'show redirection' => 'Zobrazit přesměrování',
'show request' => 'Zobrazit požadavek',
freenetis/branches/1.1/application/models/log.php
", $table_name, $object_id)->current()->count;
}
/**
* Gets last modification time of object
*
* @param string $table_name
* @param int $object_id
* @return string
*/
public function get_object_last_modification($table_name, $object_id)
{
return $this->db->query("
SELECT time FROM logs WHERE table_name = ? AND object_id = ? ORDER BY time DESC
", $table_name, $object_id)->current()->time;
}
}
freenetis/branches/1.1/application/views/main.php
<div id="content-padd">
<?php echo status::render() ?>
<?php if (isset($breadcrumbs)): ?>
<span class="breadcrumbs"><?php echo $breadcrumbs ?></span><br /><br />
<span class="breadcrumbs"><?php echo $breadcrumbs ?></span>
<?php endif ?>
<?php if (isset($action_logs)): ?>
<span class="action_logs"><?php echo $action_logs ?></span>
<?php endif ?>
<?php if(isset($breadcrumbs) || isset($action_logs)): ?>
<br /><br />
<?php endif ?>
<?php echo $content ?>
</div>
</div>
freenetis/branches/1.1/media/css/style.css
font-weight: bold;
}
.action_logs {
float: right;
}
.action_logs img {
vertical-align: middle;
}
.ip_box {
border: 1px solid black;
}
freenetis/branches/1.1/system/libraries/ORM.php
return $object;
}
/**
* Return name of current table
*
* @return string
*/
public function get_table_name()
{
return $this->table_name;
}
/**
* Binds another one-to-one object to this model. One-to-one objects

Také k dispozici: Unified diff