Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2478

Přidáno uživatelem Ondřej Fibich před více než 9 roky(ů)

Opravy: refs #1001: Hybridni metody v PHP 5.6 (staticke volani konstruktoru)

Zobrazit rozdíly:

freenetis/branches/1.2/application/controllers/comments_threads.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* 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/
*
*/
/**
* Handles relation between comment and other table in database, which has to
* contains column comments_thread_id.
*
* @see Comments_Controller
* @author Michal Kliment
* @package Controller
*/
class Comments_threads_Controller extends Controller
{
/**
* Adds new comment thread to type and foreign key
*
* @author Michal Kliment
* @param string $type
* @param integer $fk_id
*/
public function add($type = NULL, $fk_id = NULL)
{
// bad parameter
if (!$type || !$fk_id || !is_numeric($fk_id))
Controller::warning(PARAMETER);
// creates model name
$model = ucfirst($type) . '_Model';
// this model doesn't exist
if (!class_exists($model))
Controller::error(RECORD);
$object = new $model($fk_id);
// record doesn't exist or doesn't support comment thread
if (!$object->id || !$object->property_exists('comments_thread_id'))
Controller::error(RECORD);
// comment thread doesn't exist
if (!$object->comments_thread_id)
{
$comments_thread = new Comments_thread_Model();
$comments_thread->type = $type;
$comments_thread->save();
$object->comments_thread_id = $comments_thread->id;
$object->save();
}
Comments_Controller::add($object->comments_thread_id);
}
}
freenetis/branches/1.2/application/controllers/comments.php
}
/**
* Handles relation between comment and other table in database, which has
* to contains column comments_thread_id.
*
* Adds new comment thread to type and foreign key.
*
* @author Michal Kliment
* @param string $type
* @param integer $fk_id
*/
public function add_thread($type = NULL, $fk_id = NULL)
{
// bad parameter
if (!$type || !$fk_id || !is_numeric($fk_id))
Controller::warning(PARAMETER);
// creates model name
$model = ucfirst($type) . '_Model';
// this model doesn't exist
if (!class_exists($model))
Controller::error(RECORD);
$object = new $model($fk_id);
// record doesn't exist or doesn't support comment thread
if (!$object->id || !$object->property_exists('comments_thread_id'))
Controller::error(RECORD);
// comment thread doesn't exist
if (!$object->comments_thread_id)
{
$comments_thread = new Comments_thread_Model();
$comments_thread->type = $type;
$comments_thread->save();
$object->comments_thread_id = $comments_thread->id;
$object->save();
}
$this->add($object->comments_thread_id);
}
/**
* Edits comment
*
* @author Michal Kliment
freenetis/branches/1.2/application/controllers/connection_requests.php
$url = ($cr_model->comments_thread_id) ?
'comments/add/'.$cr_model->comments_thread_id :
'comments_threads/add/connection_request/'.$cr_model->id;
'comments/add_thread/connection_request/'.$cr_model->id;
if ($this->acl_check_edit('Connection_Requests_Controller', 'request'))
{
freenetis/branches/1.2/application/controllers/devices.php
$base_grid->field('type');
$base_grid->link_field('iface_id')
->link('devices/show_iface', 'mac');
->link('ifaces/show', 'mac');
$base_grid->callback_field('connected_to_device')
->callback('callback::device_connected_to_device')
......
}
/**
* Shows iface
*
* @author Michal Kliment
* @param integer $iface_id
*/
public function show_iface($iface_id = NULL)
{
Ifaces_Controller::show($iface_id);
}
/**
*
* Shows IP address
*
* @author Michal Kliment
* @param integer $ip_address_id
*/
public function show_ip_address($ip_address_id = NULL)
{
Ip_addresses_Controller::show($ip_address_id);
}
/**
* Create grids of interfaces and ip addresses of given device.
*
* @param Device_Model $device
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
freenetis/branches/1.2/application/controllers/ifaces.php
{
$actions->add_action()
->icon_action('show')
->url('devices/show_ip_address');
->url('ip_addresses/show');
}
if ($this->acl_check_edit(
......
{
$actions->add_action('id')
->icon_action('show')
->url('devices/show_iface')
->url('ifaces/show')
->class('popup_link');
}
......
)
)
->link(
'devices/show_iface/'.$iface->id,
'ifaces/show/'.$iface->id,
$name, $this->acl_check_view(
'Ifaces_Controller', 'iface',
$iface->device->user->member->id
freenetis/branches/1.2/application/controllers/ip_addresses.php
}
else
{
if (url_lang::current(TRUE) == 'devices')
if (url::slice(url_lang::uri(Path::instance()->previous()), 0, 1) != 'ip_addresses')
{
$iface = $ip_address->iface;
$device_name = $iface->device->name;
......
)
)
->link(
'devices/show_iface/'.$iface->id,
'ifaces/show/'.$iface->id,
$iface_name, $this->acl_check_view(
'Ifaces_Controller', 'iface',
$iface->device->user->member_id
freenetis/branches/1.2/application/controllers/log_queues.php
{
$url = ($lq_model->comments_thread_id) ?
'comments/add/'.$lq_model->comments_thread_id :
'comments_threads/add/log_queue/'.$lq_model->id;
'comments/add_thread/log_queue/'.$lq_model->id;
$comments_grid->add_new_button(
$url, 'Add comment',
freenetis/branches/1.2/application/controllers/redirect.php
)
)
->link(
'devices/show_iface/'.$iface->id,
'ifaces/show/'.$iface->id,
$iface_name,
$this->acl_check_view(
'Ifaces_Controller',
......
)
->disable_translation()
->link(
'devices/show_ip_address/'.$ip->id,
'ip_addresses/show/'.$ip->id,
$ip->ip_address,
$this->acl_check_view(
'Ip_addresses_Controller',
freenetis/branches/1.2/application/controllers/requests.php
$url = ($request->comments_thread_id) ?
'comments/add/'.$request->comments_thread_id :
'comments_threads/add/request/'.$request->id;
'comments/add_thread/request/'.$request->id;
$comments_grid->add_new_button(
$url, __('Add comment to request'),
freenetis/branches/1.2/application/controllers/transfers.php
$url = ($account->comments_thread_id) ?
'comments/add/' . $account->comments_thread_id :
'comments_threads/add/account/' . $account->id;
'comments/add_thread/account/' . $account->id;
$comments_grid->add_new_button(
$url, __('Add comment to financial state of member')
freenetis/branches/1.2/application/controllers/users.php
} // end of change password function
/**
* Shows login logs of user
*
* @author Michal Kliment
* @param integer $user_id
*/
public function show_login_logs($user_id = NULL)
{
Login_logs_Controller::show_by_user($user_id);
}
/**
* Gets list of users
*/
public function get_users()
freenetis/branches/1.2/application/controllers/works.php
$url = ($work->comments_thread_id) ?
url_lang::base().'comments/add/'.$work->comments_thread_id :
url_lang::base().'comments_threads/add/job/'.$work->id;
url_lang::base().'comments/add_thread/job/'.$work->id;
$comments_grid->add_new_button($url, __('Add comment to work'));
......
$url = ($work->comments_thread_id) ?
'comments/add/'.$work->comments_thread_id :
'comments_threads/add/job/'.$work->id;
'comments/add_thread/job/'.$work->id;
$comments_grid->add_new_button($url, __('Add comment to work'));
freenetis/branches/1.2/application/helpers/callback.php
echo ' '.html::anchor(
($item->a_comments_thread_id) ?
'comments/add/'.$item->a_comments_thread_id :
'comments_threads/add/account/'.$item->aid,
'comments/add_thread/account/'.$item->aid,
html::image('media/images/icons/ico_add.gif'), array
(
'title' => __('Add comment to financial state of member')
......
{
$url = (isset($item->a_comments_thread_id) && $item->a_comments_thread_id) ?
'comments/add/'.$item->a_comments_thread_id :
'comments_threads/add/connection_request/'.$item->id;
'comments/add_thread/connection_request/'.$item->id;
echo html::anchor($url, html::image('media/images/icons/ico_add.gif'), array
(
......
if (url_lang::current(1) == 'devices')
{
echo html::anchor(
"devices/show_ip_address/$item->ip_address_id",
"ip_addresses/show/$item->ip_address_id",
$ip_address, array('class' => $class, 'title' => $title)
);
}
......
{
$url = (isset($item->a_comments_thread_id) && $item->a_comments_thread_id) ?
'comments/add/'.$item->a_comments_thread_id :
'comments_threads/add/log_queue/'.$item->id;
'comments/add_thread/log_queue/'.$item->id;
echo ' ' . html::anchor($url, html::image('media/images/icons/ico_add.gif'), array
(
freenetis/branches/1.2/application/vendors/axo_doc/axo_doc.xml
<axo usage_type="access-partial" section="Comments_Controller" value="works" action="delete" own="true"></axo>
<axo usage_type="access-partial" section="Comments_Controller" value="requests" action="edit" own="false"></axo>
</method></object>
<object name="comments_threads" type="controller" comment-en="Comment threads" comment-cs="Vlákna komentářů">
<method name="add" comment-en="Add a new item" comment-cs="Přidání položky"></method>
</object>
<object name="connection_requests" type="controller" comment-en="Connection requests" comment-cs="Požadavky o připojení">
<method name="index" hide="true"></method>
<method name="show_all" comment-en="Show all items" comment-cs="Zobrazuje všechny položky">
......
<axo usage_type="breadcrumbs" section="Devices_Controller" value="devices" action="edit" own="true"></axo>
</method>
<method name="get_map"></method>
<method name="show_iface"></method>
<method name="show_ip_address"></method>
<method name="topology">
<axo usage_type="access" section="Devices_Controller" value="topology" action="view" own="true"></axo>
<axo usage_type="breadcrumbs" section="Members_Controller" value="members" action="view" own="false"></axo>
freenetis/branches/1.2/application/vendors/unit_tester/unit_testing_config.xml
</input>
</values>
</method></controller>
<controller name="comments_threads">
<method name="add" autogenerate="off">
<attributes>
<attribute name="type" default_value=""/>
<attribute name="fk_id" default_value=""/>
</attributes>
<values>
<input/>
<input>
<param value=""/>
</input>
<input>
<param value=""/>
<param value=""/>
</input>
<input>
<param value="job"/>
</input>
<input>
<param value="job"/>
<param value="1"/>
</input>
</values>
</method></controller>
<controller name="connection_requests">
<method name="index" autogenerate="on">
<attributes></attributes>
......
<input></input>
</values>
</method>
<method name="show_iface" autogenerate="off">
<attributes>
<attribute name="iface_id" default_value=""/>
</attributes>
<values>
<input/>
<input>
<param value=""/>
</input>
<input>
<param value="1"/>
</input>
<input>
<param value="'"/>
</input>
</values>
</method>
<method name="show_ip_address" autogenerate="on">
<attributes>
<attribute name="ip_address_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="topology" autogenerate="on">
<attributes>
<attribute name="device_id" default_value="" />
freenetis/branches/1.2/application/views/ip_addresses/show.php
<?php if (url_lang::current(TRUE) == 'devices'): ?>
<tr>
<th><?php echo __('Interface') ?></th>
<td><?php echo html::anchor('devices/show_iface/'.$iface->id, $iface_name) ?></td>
<td><?php echo html::anchor('ifaces/show/'.$iface->id, $iface_name) ?></td>
</tr>
<?php else: ?>
<tr>
freenetis/branches/1.2/application/views/members/show.php
}
if ($this->acl_check_view ('Members_Controller','comment',$member->id))
echo html::anchor(($account->comments_thread_id ? (url_lang::base().'comments/add/'.$account->comments_thread_id) : (url_lang::base().'comments_threads/add/account/'.$account->id)), html::image(array('src' => url::base().'media/images/icons/comment_add.png', 'width' => 16, 'height' => 16)), array('title' => __('Add comment to financial state of member'), 'class' => 'action-icon popup_link'));
echo html::anchor(($account->comments_thread_id ? (url_lang::base().'comments/add/'.$account->comments_thread_id) : (url_lang::base().'comments/add_thread/account/'.$account->id)), html::image(array('src' => url::base().'media/images/icons/comment_add.png', 'width' => 16, 'height' => 16)), array('title' => __('Add comment to financial state of member'), 'class' => 'action-icon popup_link'));
?>
</td>
</tr>
freenetis/branches/1.2/application/views/users/show.php
$links[] = html::anchor('users/change_application_password/'.$user_data->id, __('Change application password'), array('class' => 'popup_link'));
if ($this->acl_check_view('Login_logs_Controller', 'logs', $user_data->member_id))
$links[] = html::anchor('users/show_login_logs/'.$user_data->id, __('Show login logs'));
$links[] = html::anchor('login_logs/show_by_user/'.$user_data->id, __('Show login logs'));
echo implode (' | ', $links);

Také k dispozici: Unified diff