Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1235

Přidáno uživatelem Ondřej Fibich před asi 13 roky(ů)

Novinky:

- tlacitka akci v gridu nyni umoznuji vlozit zobrazovaci podminku

Upravy:

- pridani nove vlastnosti tlacitek ke controllerum
- protriden a procisten kod v helperu callback

Opravy:

- oprava pomaleho nacitani FreeNetISu na localhostu pri odpojeni od netu (nacitani javascriptu googlejsapi).

Zobrazit rozdíly:

freenetis/branches/testing/application/helpers/callback.php
/**
* Callback for balance field in accounts.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function balance_field($item, $name)
{
$balance = ($item->balance != 0) ? number_format((float)$item->balance, 2, ',', ' ') : $item->balance;
$balance = $item->balance;
if ($item->balance != 0)
{
$balance = number_format((float)$item->balance, 2, ',', ' ');
}
$color = '';
if ($item->balance > 0)
$color = 'green';
{
$color = ' style="color:green"';
}
elseif ($item->balance < 0)
$color = 'red';
{
$color = ' style="color:red"';
}
echo "<span". ((isset($color)) ? " style='color:$color'" : "") . ">$balance</span>";
echo "<span$color>$balance</span>";
if (isset($item->a_comment) && $item->a_comment != '')
{
echo "<span class='help' title='".$item->a_comment."'><img src='".url::base()."media/images/icons/comment.png'></span>";
echo "<span class='help' title='".$item->a_comment."'>";
echo "<img src='".url::base()."media/images/icons/comment.png'>";
echo "</span>";
}
if (isset($item->member_id) && $item->member_id != 1)
{
echo ' '.html::anchor((($item->a_comments_thread_id) ? 'comments/add/'.$item->a_comments_thread_id : 'comments_threads/add/account/'.$item->aid), html::image(array('src' => url::base().'media/images/ico_add.gif')), array('title' => __('Add comment to financial state of member')));
echo ' '.html::anchor(
($item->a_comments_thread_id) ?
'comments/add/'.$item->a_comments_thread_id :
'comments_threads/add/account/'.$item->aid, html::image(array
(
'src' => url::base().'media/images/ico_add.gif'
)), array
(
'title' => __('Add comment to financial state of member')
)
);
}
}
/**
* Callback for amount field in transfers of account.
* Callback for amount field in transfers of account
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function amount_field($item, $name)
{
if ($item->amount > 0)
echo '<span style="color:green">'.number_format((float)$item->amount, 2, ',', ' ').'</span>';
elseif ($item->amount < 0)
echo '<span style="color:red">'.number_format((float)$item->amount, 2, ',', ' ').'</span>';
{
echo '<span style="color:green">'
. number_format((float)$item->amount, 2, ',', ' ')
. '</span>';
}
else if ($item->amount < 0)
{
echo '<span style="color:red">'
. number_format((float)$item->amount, 2, ',', ' ')
. '</span>';
}
else
{
echo $item->amount;
}
}
/**
* Static function for origin account callback field.
* @param $item
* @param $name
*
* @param object $item
* @param string $name
*/
public static function origin_account_field($item, $name)
{
......
/**
* Static function for destination account callback field.
* @param $item
* @param $name
*
* @param object $item
* @param string $name
*/
public static function destination_account_field($item, $name)
{
......
/**
* Callback field for redirection.
* @param unknown_type $item
* @param unknown_type $name
*
* @param object $item
* @param string $name
*/
public static function redirect_field($item, $name)
{
echo "<span class='help' title='".$item->redirect_text."'>".$item->redirect."</span>";
echo "<span class='help' title='$item->redirect_text'>$item->redirect</span>";
}
/**
* Makes abbreviation of member type.
*
* @author Jiri Svitak
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function member_type_name_field($item, $name)
{
$abbreviation = '';
$words = explode(' ', $item->type_name);
foreach($words as $word)
{
$abbreviation .= mb_substr($word, 0, 1, 'UTF-8');
}
echo mb_strtoupper($abbreviation, 'UTF-8');
}
/**
* Callback field for member name. Leaves blank name if needed.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function member_field($item, $name, $args = array())
{
if ($item->member_id)
{
echo html::anchor("members/show/$item->member_id", $item->member_name);
}
elseif (isset($args[0]))
{
echo $args[0];
}
else
{
echo '&nbsp';
}
}
/**
* Callback field for subnet name. Leaves blank name if needed.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function subnet_field($item, $name)
{
if (isset($item->subnet_id) && $item->subnet_id)
{
echo html::anchor("subnets/show/$item->subnet_id", $item->subnet_name);
}
else
{
echo $item->subnet_name;
}
}
/**
* Callback field for ip address. Leaves blank ip if needed.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function ip_address_field($item, $name, $args = array())
{
$class = '';
$title = '';
$ip_address = (isset($args[0]) && $args[0]) ? $item->ip_address.'/'.$item->subnet_range : $item->ip_address;
$ip_address = (isset($args[0]) && $args[0]) ?
$item->ip_address.'/'.$item->subnet_range :
$item->ip_address;
if (isset($item->ip_addresses))
$title = $item->ip_addresses;
......
/**
* Callback field for segment.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function segment_field($item, $name)
{
if ($item->segment_id)
{
echo html::anchor("segments/show/$item->segment_id", $item->segment_name);
}
else
{
echo '&nbsp';
}
}
/**
* Callback for device field.
*
* @author Jiri Svitak
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function device_field($item, $name)
{
if ($item->device_id)
{
echo html::anchor("devices/show/$item->device_id", $item->device_name);
}
else if ($item->device_name != '')
{
echo $item->device_name;
}
else if (!$item->ip_address_id)
{
echo '<span style="color: green">'.__('Free').'</span>';
}
}
/**
* Callback for device type field.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function device_type_field($item, $name)
{
......
}
/**
* Price field prints green amount of price of device in case that device is already repaid. Otherwise price is red.
* Price field prints green amount of price of device in case that device
* is already repaid. Otherwise price is red.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
*/
public static function device_price_field($item, $name)
{
if (!$item->price)
return;
if ($item->total_amount >= $item->price)
echo '<span style="color:green;">'.$item->price.'</span>';
else
echo '<span style="color:red;">'.$item->price.'</span>';
if ($item->price)
{
if ($item->total_amount >= $item->price)
{
echo '<span style="color:green;">'.$item->price.'</span>';
}
else
{
echo '<span style="color:red;">'.$item->price.'</span>';
}
}
}
/**
* Interface field prints mac address. Leaves blank text if needed.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function iface_field($item, $name)
{
if ($item->iface_id)
{
echo html::anchor("ifaces/show/$item->iface_id", $item->mac);
}
else
{
echo '&nbsp;';
}
}
/**
* Callback field for user name.
*
* @author Jiri Svitak
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function user_field($item, $name)
{
......
/**
* Callback field for user login.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function user_login_field($item, $name)
{
echo html::anchor("users/show/$item->user_id", $item->user_login);
}
/**
* Callback field for user login.
*
* @author Jiri Svitak
* @param object $item
* @param string $name
*/
public static function redirection_preview_field($item, $name)
{
echo html::anchor(url::base().'redirection/?ip_address='.$item->ip_address, __('Show'));
}
/**
* Callback field for canceling redirection of one IP address on member's profile screen.
* Callback field for canceling redirection of
* one IP address on member's profile screen.
*
* @author Jiri Svitak
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function cancel_redirection_of_member($item, $name)
{
......
/**
* Callback field for correct view of whitelisted option of ip address.
*
* @author Jiri Svitak
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function whitelisted_field($item, $name)
{
......
/**
* Callback fields prints either translated system message or
* user message for redirection.
*
* @author Jiri Svitak
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function message_field($item, $name)
{
......
/**
* Callback for message type, it distinguishes between system and user redirection messages.
*
* @author Jiri Svitak
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function message_type_field($item, $name)
{
if ($item->type == 0)
{
echo __('User message');
}
else
{
echo __('System message');
}
}
/**
* Activates multiple redirections. All interrupted members, all debtors
* with credit below debtor boundary and all should-pay members with
* credit below payment notice boundary may be redirected.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
static function message_activate_field($item, $name)
public static function message_activate_field($item, $name)
{
$message = new Message_Model($item->id);
if ($message->type == Message_Model::CONTACT_INFORMATION
|| $message->type == Message_Model::CANCEL_MESSAGE
|| $message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE)
if ($message->type == Message_Model::CONTACT_INFORMATION ||
$message->type == Message_Model::CANCEL_MESSAGE ||
$message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE)
{
echo '&nbsp;';
}
......
/**
* Deactivates all activated redirections for given message.
* @param <type> $item
* @param <type> $name
*
* @author Jiri Svitak
* @param object $item
* @param string $name
*/
static function message_deactivate_field($item, $name)
public static function message_deactivate_field($item, $name)
{
$message = new Message_Model($item->id);
if ($message->type == Message_Model::CONTACT_INFORMATION
|| $message->type == Message_Model::CANCEL_MESSAGE
|| $message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE)
if ($message->type == Message_Model::CONTACT_INFORMATION ||
$message->type == Message_Model::CANCEL_MESSAGE ||
$message->type == Message_Model::UNKNOWN_DEVICE_MESSAGE)
{
echo '&nbsp;';
}
......
/**
* Field for deleting messages. Only user messages are allowed to be deleted.
*
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
static function message_delete_field($item, $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'));
......
* @param unknown_type $item
* @param unknown_type $name
*/
static function message_preview_field($item, $name)
public static function message_preview_field($item, $name)
{
$message = new Message_Model($item->id);
echo html::anchor(url::base().'redirection/?id='.$message->id, __('Preview'), array('target' => '_blank'));
echo html::anchor(
url::base().'redirection/?id='.$message->id,
__('Preview'), array('target' => '_blank')
);
}
/**
* Callback for locked private field in phone invoices
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_invoice_private_field_locked($item, $name)
{
......
/**
* Callback for showing state of invoice
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_invoice_user_state($item, $name)
{
if ($item->locked == 1)
{
$title = __('Locked by admin');
echo Html::image(array('src' => 'media/images/states/readonly_16x16.png', 'title' => $title));
$src = 'media/images/states/readonly_16x16.png';
}
else if ($item->filled == 1)
{
$title = __('Already filled in');
echo Html::image(array('src' => 'media/images/states/good_16x16.png', 'title' => $title));
$src = 'media/images/states/good_16x16.png';
}
else
{
$title = __('Not filled in');
echo Html::image(array('src' => 'media/images/icons/publish_x.png', 'title' => $title));
$src = 'media/images/icons/publish_x.png';
}
echo Html::image(array
(
'src' => $src,
'title' => $title
));
}
/**
* Callback for showing state of invoice
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_invoice_user_state2($item, $name)
{
if ($item->filled == 1)
{
$title = __('Already filled in');
echo Html::image(array('src' => 'media/images/states/good_16x16.png', 'title' => $title));
echo Html::image(array
(
'src' => 'media/images/states/good_16x16.png',
'title' => __('Already filled in')
));
}
else
{
$title = __('Not filled in');
echo Html::image(array('src' => 'media/images/icons/publish_x.png', 'title' => $title));
echo Html::image(array
(
'src' => 'media/images/icons/publish_x.png',
'title' => __('Not filled in')
));
}
}
/**
* Callback for phone period field
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_period_field($item, $name)
{
......
/**
* Callback for price field in phone invoices.
* If price is lower than zero, price is painted by red color
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_price_field($item, $name)
{
......
/**
* Callback for phone field in phone invoices
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param object $item
* @param string $name
*/
public static function phone_number_field($item, $name)
{
static $phone_invoice_user_model_stat = null;
static $pucontact = null;
if ($phone_invoice_user_model_stat == null)
if ($pucontact == null)
{
$phone_invoice_user_model_stat = new Phone_invoice_user_Model();
$pucontact = new Private_users_contact_Model();
}
$pucontact_id = Private_phone_contacts_Controller::private_contacts_cache($item->user_id, $item->number);
......
if ($pucontact_id > 0)
{
$pucontact = ORM::factory('private_users_contact', $pucontact_id);
$pucontact = $pucontact->find($pucontact_id);
if ($user->id && $user->member_id == $_SESSION['member_id'])
{
......
$pucontact->description . '</span> ';
echo html::anchor(
url_lang::base() . 'private_phone_contacts/edit/' . $pucontact_id,
'private_phone_contacts/edit/' . $pucontact_id,
html::image(array('src' => 'media/images/icons/gtk_edit.png')),
array('rel' => 'dialog', 'class' => 'link_private_contact_edit',
'title' => __('Edit'))
);
echo ' ' . html::anchor(
url_lang::base() . 'private_phone_contacts/delete/' . $pucontact_id,
'private_phone_contacts/delete/' . $pucontact_id,
html::image(array('src' => 'media/images/icons/delete.png')),
array('rel' => 'dialog', 'class' => 'link_private_contact_delete',
'title' => __('Delete'))
......
if ($pucontact->user_id)
{
echo ' ' . html::anchor(
url_lang::base() . 'phone_invoices/show_history/' .
'phone_invoices/show_history/' .
$pucontact->user_id . '/' . $item->number . '/' . $item->phone_invoice_user_id,
html::image(array('src' => 'media/images/icons/history.png')),
array('rel' => 'dialog', 'class' => 'link_private_contact_delete',
......
{
echo html::anchor(
url_lang::base() . 'private_phone_contacts/add/' . $item->user_id . '/' . $item->number,
'private_phone_contacts/add/' . $item->user_id . '/' . $item->number,
html::image(array('src' => 'media/images/ico_add.gif')),
array('rel' => 'dialog', 'class' => 'link_private_contact_add',
'title' => __('Add'))
......
if ($item->user_id)
{
echo ' ' . html::anchor(
url_lang::base() . 'phone_invoices/show_history/' .
'phone_invoices/show_history/' .
$item->user_id . '/' . $item->number . '/' . $item->phone_invoice_user_id,
html::image(array('src' => 'media/images/icons/history.png')),
array('rel' => 'dialog', 'class' => 'link_private_contact_delete',
......
/**
* Callback for private checkbox field in phone invoices
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
* @param unknown_type $input Checkbox
* @param object $item
* @param string $name
* @param object $input Checkbox
*/
public static function phone_private_checkbox($item, $name, $input)
{
......
}
/**
* Callback for delete field in phone invoices
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
*/
public static function phone_invoice_delete_field($item, $name)
{
if ($item->locked == 0)
{
echo html::anchor(
url_lang::base() . 'phone_invoices/delete/' .
$item->id, __('Delete'),
array('class' => 'delete_link')
);
}
else
{
echo '<span style="color: red;">' . __('Locked') . '</span>';
}
}
/**
* Callback for edit field in phone invoices
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
*/
public static function phone_invoice_edit_field($item, $name)
{
echo html::anchor(
url_lang::base() . 'phone_invoices/show/' .
$item->id, __('' . (($item->locked == 1) ? 'Show' : 'Edit')),
array('class' => 'a_edit')
);
}
/**
* Callback for edit field in show_by_user of phone invoice
* @author Ondřej Fibich
* @param unknown_type $item
* @param unknown_type $name
*/
public static function phone_invoice_user_edit_field($item, $name)
{
if ($item->locked == 0 && $item->filled == 0)
{
echo html::anchor(
url_lang::base() . 'phone_invoices/show_details/' .
$item->id, __('Edit'),
array('class' => 'a_show_details')
);
}
else
{
echo '<span style="color: red;">' . __('Locked') . '</span>';
}
}
/**
* Callback field for user name of user given by id.
*
* @author Ondřej Fibich
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function user_id_log_field($item, $name)
{
......
if ($user->id)
{
echo html::anchor(
'users/show/'.$user->id,
$user->name . ' ' . $user->surname
);
echo ' ' . html::anchor(
'logs/show_by_user/'.$user->id,
html::image(array('src' => 'media/images/icons/history.png',
'title' => __('Show user actions')))
);
echo html::anchor('users/show/'.$user->id, $user->get_full_name());
echo ' ';
echo html::anchor('logs/show_by_user/'.$user->id, html::image(array
(
'src' => 'media/images/icons/history.png',
'title' => __('Show user actions')
)));
}
else
{
......
/**
* Callback for action of log
*
* @author Ondřej Fibich
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function log_action_field($item, $name)
{
......
/**
* Callback for object of log
*
* @author Ondřej Fibich
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function object_log_field($item, $name)
{
......
/**
* Callback for values of log
*
* @author Ondřej Fibich
* @param $item
* @param $name
* @param object $item
* @param string $name
*/
public static function value_log_field($item, $name)
{
......
/**
* Callback for display GPS
*
* @author Ondřej Fibich
* @param unknown_type $item
* @param object $item
* @param string $name
*/
public static function gps_field($item, $name)
......
* Callback for order number field in grid
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function order_number_field($item, $name, $args = array())
{
......
* Callback for traffic field
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function traffic_field($item, $name)
{
......
* Callback to draw active/inactive image in grid field
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function active_field($item, $name)
{
......
break;
}
echo html::image(array('src' => url::base().'media/images/'.$state.'.png', 'title' => __(''.$state)));
echo html::image(array
(
'src' => url::base().'media/images/'.$state.'.png',
'title' => __(''.$state)
));
}
/**
* Callback to print caller
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function voip_caller($item, $name, $args = array())
{
$number = VoIP_calls_Controller::parse_number(substr($item->caller, 4, strlen($item->caller) - 4));
$number = VoIP_calls_Controller::parse_number(
substr($item->caller, 4, strlen($item->caller) - 4)
);
echo VoIP_calls_Controller::number($number, $args[0], $args[1]);
}
......
* Callback to print called
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function voip_callcon($item, $name, $args = array())
{
$number = VoIP_calls_Controller::parse_number(substr($item->callcon, 4, strlen($item->callcon) - 4),$item->area);
$number = VoIP_calls_Controller::parse_number(
substr($item->callcon, 4, strlen($item->callcon) - 4), $item->area
);
echo VoIP_calls_Controller::number($number, $args[0], $args[1]);
}
......
* Callback to print value of used (e. g. used of ip addresses in subnet)
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function used_field ($item, $name)
{
......
if ($item->used < 20)
$color = 'green';
echo ($color != '') ? '<span style="color: '.$color.'">'.$item->used.' %</span>' : $item->used.' %';
echo ($color != '') ?
'<span style="color: '.$color.'">'.$item->used.' %</span>' :
$item->used.' %';
}
/**
* Callback to print Iface or VLAN iface to which belong ip address
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function iface_vlan_iface_field ($item, $name)
{
if ($item->iface_id)
echo html::anchor ('ifaces/show/'.$item->iface_id, $item->iface_name, array('title' => __('Show interface')));
{
echo html::anchor(
'ifaces/show/'.$item->iface_id, $item->iface_name,
array('title' => __('Show interface'))
);
}
else
echo html::anchor ('vlan_ifaces/show/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => __('Show VLAN interface')));
{
echo html::anchor(
'vlan_ifaces/show/'.$item->vlan_iface_id, $item->vlan_iface_name,
array('title' => __('Show VLAN interface'))
);
}
}
/**
* Callback to print vlan
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function vlan_field ($item, $name)
{
echo html::anchor ('vlans/show/'.$item->vlan_id, $item->vlan_name, array('title' => __('Show VLAN')));
echo html::anchor(
'vlans/show/'.$item->vlan_id, $item->vlan_name,
array('title' => __('Show VLAN'))
);
}
/**
* Callback to print VLAN interface
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function vlan_iface_field ($item, $name)
{
if (url_lang::current(TRUE) == 'devices')
echo html::anchor ('devices/show_vlan_iface/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => __('Show VLAN interface')));
{
echo html::anchor(
'devices/show_vlan_iface/'.$item->vlan_iface_id,
$item->vlan_iface_name,
array('title' => __('Show VLAN interface'))
);
}
else
echo html::anchor ('vlan_ifaces/show/'.$item->vlan_iface_id, $item->vlan_iface_name, array('title' => __('Show VLAN interface')));
{
echo html::anchor(
'vlan_ifaces/show/'.$item->vlan_iface_id,
$item->vlan_iface_name,
array('title' => __('Show VLAN interface'))
);
}
}
/**
* Callback to print port
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function port_field ($item, $name)
{
echo html::anchor ('ports/show/'.$item->port_id, $item->port_name, array('title' => __('Show port')));
echo html::anchor(
'ports/show/'.$item->port_id, $item->port_name,
array('title' => __('Show port'))
);
}
/**
* Callback to print ID of interface
*
* @author MIchal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function iface_id_field ($item, $name)
{
echo html::anchor ('devices/show_iface/'.$item->iface_id, $item->iface_id, array('title' => __('Show interface')));
echo html::anchor(
'devices/show_iface/'.$item->iface_id, $item->iface_id,
array('title' => __('Show interface'))
);
}
/**
* Callback to print edit field
*
* @author
* @param <type> $item
* @param <type> $name
* @param array $args
*/
public static function edit_field ($item, $name, $args = array())
{
if (Session::instance()->get('user_id') == $item->user_id)
echo html::anchor ($args[0].'/edit/'.$item->id, __('Edit'));
}
/**
* Callback to print delete field
*
*@author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param array $args
*/
public static function delete_field ($item, $name, $args = array())
{
if (Session::instance()->get('user_id') == $item->user_id)
echo html::anchor ($args[0].'/delete/'.$item->id, __('Delete'), array('class' => 'delete_link'));
}
/**
* Callback to print comments count with comments as title
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function comments_field ($item, $name)
{
echo $item->comments_count;
if ($item->comments_count)
echo "<span title='$item->comments' class='help'><img src='".url::base()."media/images/icons/comment.png'></span>";
echo $item->comments_count;
if ($item->comments_count)
{
echo "<span title='$item->comments' class='help'>";
echo "<img src='".url::base()."media/images/icons/comment.png'>";
echo "</span>";
}
}
/**
* Callback to print vote state with vote comments as title
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function vote_state_field ($item, $name)
{
......
* Callback to print segment medium
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function segment_medium_field ($item, $name)
{
......
* Callback to print enable/disable image
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function enabled_field($item, $name, $args = array())
{
......
}
if (isset($args[0]) && $args[0] != '')
echo html::anchor (
$args[0].$item->id, html::image(
array(
'src' => url::base().'media/images/'.$state.'.png', 'title' => __(''.$state))
)
);
{
echo html::anchor($args[0] . $item->id, html::image(array
(
'src' => url::base() . 'media/images/' . $state . '.png',
'title' => __('' . $state))
));
}
else
echo html::image(
array(
'src' => url::base().'media/images/'.$state.'.png', 'title' => __(''.$state))
);
{
echo html::image(array
(
'src' => url::base() . 'media/images/' . $state . '.png',
'title' => __('' . $state)
));
}
}
/**
* Callback function to print traffic field in ulogd
*
*@author Michal Kliment
* @param <type> $item
* @param <type> $name
* @author Michal Kliment
* @param object $item
* @param string $name
*/
public static function ulogd_traffic_field($item, $name)
{
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address)) echo " class='red'";
echo ">";
self::traffic_field($item, $name);
echo "</span>";
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address))
echo " class='red'";
echo ">";
self::traffic_field($item, $name);
echo "</span>";
}
/**
* Callback function to print order number field in ulogd
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function ulogd_order_number_field($item, $name, $args = array())
{
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address)) echo " class='red'";
echo ">";
self::order_number_field($item, $name, $args);
echo "</span>";
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address))
echo " class='red'";
echo ">";
self::order_number_field($item, $name, $args);
echo "</span>";
}
/**
* Callback function to print ip address field in ulogd
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function ulogd_ip_address_field($item, $name)
{
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address)) echo " class='red'";
echo ">";
echo $item->ip_address;
echo "</span>";
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address))
echo " class='red'";
echo ">";
echo $item->ip_address;
echo "</span>";
}
/**
* Callback function to print member field in ulogd
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param <type> $args
* @param object $item
* @param string $name
* @param array $args
*/
public static function ulogd_member_field($item, $name, $args = array())
{
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address)) echo " class='red'";
echo ">";
self::member_field($item, $name, $args);
echo "</span>";
echo "<span";
if (!$item->member_id && network::ip_address_in_ranges($item->ip_address))
echo " class='red'";
echo ">";
self::member_field($item, $name, $args);
echo "</span>";
}
/**
* Callback function to print type of members address points
*
* @author Michal Kliment
* @param <type> $item
* @param <type> $name
* @param object $item
* @param string $name
*/
public static function address_point_member_field ($item, $name)
public static function address_point_member_field($item, $name)
{
switch ($item->type)
{
// it's domicile of member
case 1:
echo __('Domicile'). ' '.help::hint('address_point_member_domicile');
break;
// it's only connecting place of member, he has domicile on another address point
case 2:
echo __('Connecting place'). ' '.help::hint('address_point_member_connecting_place');
break;
}
switch ($item->type)
{
// it's domicile of member
case 1:
echo __('Domicile'). ' '.help::hint('address_point_member_domicile');
break;
// it's only connecting place of member, he has domicile on another address point
case 2:
echo __('Connecting place'). ' '.help::hint('address_point_member_connecting_place');
break;
}
}
/**
......
switch ($item->type)
{
case 'account':
echo __('Financial state of member').' '.html::anchor('members/show/'.$item->member_id, $item->member_name, array('title' => __('Show member')));
echo __('Financial state of member') . ' ' . html::anchor(
'members/show/'.$item->member_id, $item->member_name,
array('title' => __('Show member'))
);
break;
case 'job':
echo html::anchor('works/show/'.$item->work_id, __('Work'), array('title' => __('Show work'))).' '.__('of user').' '.html::anchor('users/show/'.$item->work_user_id, $item->work_user_name, array('title' => __('Show user')));
echo html::anchor(
'works/show/'.$item->work_id, __('Work'),
array('title' => __('Show work'))
).' '.__('of user').' '.html::anchor(
'users/show/'.$item->work_user_id,
$item->work_user_name,
array('title' => __('Show user'))
);
break;
}
}
......
* Callback function to print week
*
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function week_field ($item, $name)
{
echo '<span title="'.date::start_of_week($item->week, $item->year). ' - ' . date::end_of_week($item->week, $item->year).'">'.$item->week.'.</span>';
$start = date::start_of_week($item->week, $item->year);
$end = date::end_of_week($item->week, $item->year);
echo '<span title="'.$start. ' - ' . $end.'">'.$item->week.'.</span>';
}
/**
* Callback function to print name of month
*
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function month_field ($item, $name)
{
......
* Callback function to print network address in CIDR format
*
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function cidr_field ($item, $name)
{
......
* Callback function to print bitrate of segment
*
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function bitrate_field ($item, $name)
{
......
* Callback function to print mac address
*
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function mac_address_field ($item, $name)
{
if (url_lang::current(1) == 'devices')
echo html::anchor('devices/show_iface/'.$item->iface_id, $item->mac, array('title' => $item->iface_name));
{
echo html::anchor(
'devices/show_iface/'.$item->iface_id, $item->mac,
array('title' => $item->iface_name)
);
}
else
echo html::anchor('ifaces/show/'.$item->iface_id, $item->mac, array('title' => $item->iface_name));
{
echo html::anchor(
'ifaces/show/'.$item->iface_id, $item->mac,
array('title' => $item->iface_name)
);
}
}
/**
* @author Michal Kliment
* @param type $item
* @param type $name
* @param object $item
* @param string $name
*/
public static function items_count_field ($item, $name)
{
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff