Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2491

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

Novinky:
refs #938: Pridani zobrazeni zdavatele bile listiny

Zobrazit rozdíly:

freenetis/branches/1.2/application/controllers/members_whitelists.php
->type('select')
->label('Whitelist')
->values(Ip_address_Model::get_whitelist_types());
$filter_form->add('user_name')
->label('Added by')
->type('combo')
->callback('json/user_fullname');
$filter_form->add('balance')
->type('number');
......
$grid->order_callback_field('whitelisted')
->label('Whitelist')
->callback('callback::whitelisted_field');
$grid->order_callback_field('user_name')
->label('Added by')
->callback('callback::user_field');
$grid->order_callback_field('balance')
->callback('callback::balance_field');
......
$grid->callback_field('active')
->callback('callback::active_field');
$grid->callback_field('user_name')
->label('Added by')
->callback('callback::user_field');
$grid->field('comment');
......
$mw->since = $form_data['since'];
$mw->until = $form_data['until'];
$mw->comment = $form_data['comment'];
$mw->user_id = $this->user_id;
$mw->save_throwable();
// reactivate messages
......
$mw->since = $form_data['since'];
$mw->until = $form_data['until'];
$mw->comment = $form_data['comment'];
$mw->user_id = $this->user_id;
$mw->save_throwable();
// reactivate messages
freenetis/branches/1.2/application/helpers/callback.php
}
/**
* Callback field for user name. Leaves blank name if needed.
*
* @author David Raska
* @param object $item
* @param string $name
*/
public static function user_field($item, $name, $args = array())
{
if ($item->user_id)
{
echo html::anchor("users/show/$item->user_id", $item->user_name);
}
elseif (isset($args[0]))
{
echo $args[0];
}
else
{
echo '&nbsp';
}
}
/**
* Callback field for member name. Leaves blank name if needed.
*
* @author Jiri Svitak
freenetis/branches/1.2/application/models/members_whitelist.php
* @property date $until
* @property bool $permanent
* @property string $comment
* @property integer $user_id
* @property User_model $user
*/
class Members_whitelist_Model extends ORM
{
protected $belongs_to = array('member');
protected $belongs_to = array('member','user');
/**
* Gets members whose are whitelisted.
......
m.id, IFNULL(f.translated_term, e.value) AS type,
m.name, m.name AS member_name, a.balance,
a.id AS aid, a.comments_thread_id AS a_comments_thread_id,
IF(mw.permanent > 0, 1, 2) AS whitelisted, a_comment
IF(mw.permanent > 0, 1, 2) AS whitelisted, a_comment,
CONCAT(u.name,' ',u.surname) AS user_name, u.id AS user_id
FROM members m
JOIN members_whitelists mw ON mw.member_id = m.id
LEFT JOIN accounts a ON a.member_id = m.id AND m.id <> 1
......
LEFT JOIN comments_threads ct ON a.comments_thread_id = ct.id
LEFT JOIN enum_types e ON m.type = e.id
LEFT JOIN translations f ON e.value = f.original_term AND lang = ?
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.since <= CURDATE() AND mw.until >= CURDATE()
) m
$where
......
SELECT
m.id, IFNULL(f.translated_term, e.value) AS type,
m.name AS member_name, a.balance,
IF(mw.permanent > 0, 1, 2) AS whitelisted
IF(mw.permanent > 0, 1, 2) AS whitelisted,
CONCAT(u.name,' ',u.surname) AS user_name
FROM members m
JOIN members_whitelists mw ON mw.member_id = m.id
LEFT JOIN accounts a ON a.member_id = m.id AND m.id <> 1
LEFT JOIN comments_threads ct ON a.comments_thread_id = ct.id
LEFT JOIN enum_types e ON m.type = e.id
LEFT JOIN translations f ON e.value = f.original_term AND lang = ?
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.since <= CURDATE() AND mw.until >= CURDATE()
) m
$where
......
public function get_member_whitelists($member_id)
{
return $this->db->query("
SELECT mw.*, IF(mw.since <= CURDATE() AND mw.until >= CURDATE(), 1, 0) AS active
SELECT
mw.*, IF(mw.since <= CURDATE() AND mw.until >= CURDATE(), 1, 0) AS active,
CONCAT(u.name,' ',u.surname) AS user_name, u.id AS user_id
FROM members_whitelists mw
LEFT JOIN users u ON mw.user_id = u.id
WHERE mw.member_id = ?
ORDER BY permanent DESC, until DESC, since DESC
", $member_id);
freenetis/branches/1.2/db_upgrades/upgrade_1.2.0~alpha7.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/
*
*/
/**
* Adds user_id column to members_whitelists tables
* for loging who adds/edits members whitelist.
*
* @author David Raška <jeffraska@gmail.com>
*/
$upgrade_sql['1.2.0~alpha7'] = array
(
"ALTER TABLE `members_whitelists` ADD `user_id` INT NULL,
ADD INDEX ( `user_id` );",
"ALTER TABLE `members_whitelists` ADD FOREIGN KEY ( `user_id` ) REFERENCES `users` (
`id`
) ON DELETE SET NULL ;"
); // end of $upgrade_sql['1.2.0~alpha7']
freenetis/branches/1.2/version.php
* The current version of FreenetIS.
* This value must be changed by developers in a new release of FreenetIS.
*/
define('FREENETIS_VERSION', '1.2.0~alpha6');
define('FREENETIS_VERSION', '1.2.0~alpha7');

Také k dispozici: Unified diff