Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 939

Přidáno uživatelem Michal Kliment před více než 13 roky(ů)

Pridano zobrazeni nahledu komentaru na vypisu vsech nerozhodnutych, schvalenych a neschvalenych praci. Obdobnym zpusobem pridano i zobrazeni hlasu a jejich komentaru.

Zobrazit rozdíly:

freenetis/branches/comments/application/i18n/cs_CZ/texts.php
'comment has been successfully updated' => 'Komentář byl úspěšně aktualizován',
'comment of admin shown to user' => 'Komentář administrátora zobrazený uživateli',
'comments' => 'Komentáře',
'comments count' => 'Počet komentářů',
'company' => 'Firemní',
'configuration files' => 'Konfigurační soubory',
'confirm' => 'Potvrdit',
freenetis/branches/comments/application/helpers/callback.php
if (Session::instance()->get('user_id') == $item->user_id)
echo html::anchor (url_lang::base().$args[0].'/delete/'.$item->id, url_lang::lang('texts.Delete'), array('class' => 'delete_link'));
}
public function comments_field ($item, $name)
{
echo "<span title='$item->comments'>$item->comments_count</span>";
}
public static function vote_state_field ($item, $name)
{
echo "<span title='$item->vote_comments'>";
echo '<span style="color: green">'.$item->agree_count.'</span>';
echo '/';
echo '<span style="color: red">'.$item->disagree_count.'</span>';
echo '/';
echo $item->abstain_count;
echo "</span>";
}
}
freenetis/branches/comments/application/models/member.php
}
$where = implode(" AND ",$where);
$where = ($where!='') ? 'WHERE '.$where : '';
/*return $this->db->query("SELECT
m.id, m.registration, m.name,
s.street, ap.street_number, t.town, t.quarter,
m.variable_symbol, a.id AS aid,
a.balance,
m.redirect
FROM members m
LEFT JOIN address_points ap ON m.address_point_id = ap.id
LEFT JOIN streets s ON ap.street_id = s.id
LEFT JOIN towns t ON ap.town_id = t.id
LEFT JOIN accounts a ON a.member_id = m.id AND m.id <> 1
$where
ORDER BY $order_by $order_by_direction
LIMIT $limit_from, $limit_results"
);*/
return $this->db->query("
SELECT id, registration, name, street, street_number, town, quarter, variable_symbol, aid, balance, redirect, GROUP_CONCAT(a_comment SEPARATOR '\n\n') AS a_comment FROM
SELECT id, registration, name, street, street_number, town, quarter, variable_symbol, aid, balance, redirect, GROUP_CONCAT(a_comment SEPARATOR ', \n\n') AS a_comment FROM
(
SELECT
m.id, m.registration, m.name,
freenetis/branches/comments/application/models/job.php
return $this->db->query('SELECT q.*, (agree_count - disagree_count) AS approval_state FROM (SELECT j.*, CONCAT(u.name, \' \', u.surname) AS uname, v.vote, v.comment,
(SELECT COUNT(*) FROM votes WHERE vote = 1 AND votes.fk_id = j.id AND votes.type = 1) AS agree_count,
(SELECT COUNT(*) FROM votes WHERE vote = -1 AND votes.fk_id = j.id AND votes.type = 1) AS disagree_count,
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count,
(SELECT COUNT(*) FROM comments c WHERE j.comments_thread_id = c.comments_thread_id) AS comments_count,
(
SELECT GROUP_CONCAT(user, " (",SUBSTRING(c.datetime,1,10),"): \n",c.text SEPARATOR ", \n\n") FROM
(
SELECT c.*, CONCAT(u.surname," ",u.name) AS user FROM comments c
LEFT JOIN users u ON c.user_id = u.id
ORDER BY datetime DESC
) AS c WHERE c.comments_thread_id = j.comments_thread_id GROUP BY c.user_id
) AS comments,
(
SELECT GROUP_CONCAT(comment SEPARATOR ", \n\n") FROM
(
SELECT v.fk_id, v.type, CONCAT(u.surname," ",u.name," (",SUBSTRING(v.time,1,10),"): \n",IF(v.vote=1,"'.url_lang::lang('texts.Agree').'",IF(v.vote=-1,"'.url_lang::lang('texts.Disagree').'","'.url_lang::lang('texts.Abstain').'")), IF(v.comment NOT LIKE ""," - ",""), v.comment) AS comment FROM votes v
LEFT JOIN users u ON v.user_id = u.id
ORDER BY v.vote DESC
) AS v
WHERE v.fk_id = j.id AND v.type = 1
GROUP BY fk_id
) AS vote_comments
FROM jobs j
LEFT JOIN users u ON j.user_id = u.id
LEFT JOIN votes v ON j.id = v.fk_id AND v.type =1 AND v.user_id = '.Session::instance()->get('user_id').'
......
return $this->db->query('SELECT q.*, (agree_count - disagree_count) AS approval_state FROM (SELECT j.*, CONCAT(u.name,\' \', u.surname) AS uname,
(SELECT COUNT(*) FROM votes WHERE vote = 1 AND votes.fk_id = j.id AND votes.type = 1) AS agree_count,
(SELECT COUNT(*) FROM votes WHERE vote = -1 AND votes.fk_id = j.id AND votes.type = 1) AS disagree_count,
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count,
(SELECT COUNT(*) FROM comments c WHERE j.comments_thread_id = c.comments_thread_id) AS comments_count,
(
SELECT GROUP_CONCAT(user, " (",SUBSTRING(c.datetime,1,10),"): \n",c.text SEPARATOR ", \n\n") FROM
(
SELECT c.*, CONCAT(u.surname," ",u.name) AS user FROM comments c
LEFT JOIN users u ON c.user_id = u.id
ORDER BY datetime DESC
) AS c WHERE c.comments_thread_id = j.comments_thread_id GROUP BY c.user_id
) AS comments,
(
SELECT GROUP_CONCAT(comment SEPARATOR ", \n\n") FROM
(
SELECT v.fk_id, v.type, CONCAT(u.surname," ",u.name," (",SUBSTRING(v.time,1,10),"): \n",IF(v.vote=1,"'.url_lang::lang('texts.Agree').'",IF(v.vote=-1,"'.url_lang::lang('texts.Disagree').'","'.url_lang::lang('texts.Abstain').'")), IF(v.comment NOT LIKE ""," - ",""), v.comment) AS comment FROM votes v
LEFT JOIN users u ON v.user_id = u.id
ORDER BY v.vote DESC
) AS v
WHERE v.fk_id = j.id AND v.type = 1
GROUP BY fk_id
) AS vote_comments
FROM jobs j
LEFT JOIN users u ON j.user_id = u.id
WHERE j.state = 2 AND j.job_report_id IS NULL) AS q
......
return $this->db->query('SELECT q.*, (agree_count - disagree_count) AS approval_state FROM (SELECT j.*, CONCAT(u.name,\' \', u.surname) AS uname, t.amount as rating,
(SELECT COUNT(*) FROM votes WHERE vote = 1 AND votes.fk_id = j.id AND votes.type = 1) AS agree_count,
(SELECT COUNT(*) FROM votes WHERE vote = -1 AND votes.fk_id = j.id AND votes.type = 1) AS disagree_count,
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count
(SELECT COUNT(*) FROM votes WHERE vote = 0 AND votes.fk_id = j.id AND votes.type = 1) AS abstain_count,
(SELECT COUNT(*) FROM comments c WHERE j.comments_thread_id = c.comments_thread_id) AS comments_count,
(
SELECT GROUP_CONCAT(user, " (",SUBSTRING(c.datetime,1,10),"): \n",c.text SEPARATOR ", \n\n") FROM
(
SELECT c.*, CONCAT(u.surname," ",u.name) AS user FROM comments c
LEFT JOIN users u ON c.user_id = u.id
ORDER BY datetime DESC
) AS c WHERE c.comments_thread_id = j.comments_thread_id GROUP BY c.user_id
) AS comments,
(
SELECT GROUP_CONCAT(comment SEPARATOR ", \n\n") FROM
(
SELECT v.fk_id, v.type, CONCAT(u.surname," ",u.name," (",SUBSTRING(v.time,1,10),"): \n",IF(v.vote=1,"'.url_lang::lang('texts.Agree').'",IF(v.vote=-1,"'.url_lang::lang('texts.Disagree').'","'.url_lang::lang('texts.Abstain').'")), IF(v.comment NOT LIKE ""," - ",""), v.comment) AS comment FROM votes v
LEFT JOIN users u ON v.user_id = u.id
ORDER BY v.vote DESC
) AS v
WHERE v.fk_id = j.id AND v.type = 1
GROUP BY fk_id
) AS vote_comments
FROM jobs j
LEFT JOIN users u ON j.user_id = u.id
LEFT JOIN transfers t ON j.transfer_id = t.id
freenetis/branches/comments/application/controllers/works.php
$grid->order_field('hours')->label(url_lang::lang('texts.Hours'));
$grid->order_field('km')->label(url_lang::lang('texts.Km'));
$grid->order_callback_field('suggest_amount')->label(url_lang::lang('texts.Suggest amount'))->callback('Works_Controller::suggest_amount');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('Works_Controller::vote_state_field');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('callback::vote_state_field');
$grid->order_callback_field('comments_count')->label(url_lang::lang('texts.Comments count'))->callback('callback::comments_field');;
// user can vote -> show columns for form items
if ($can_vote)
......
$grid->order_field('hours')->label(url_lang::lang('texts.Hours'));
$grid->order_field('km')->label(url_lang::lang('texts.Km'));
$grid->order_callback_field('rating')->label(url_lang::lang('texts.Rating'))->callback('Works_Controller::rating');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('Works_Controller::vote_state_field');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('callback::vote_state_field');
$grid->order_callback_field('comments_count')->label(url_lang::lang('texts.Comments count'))->callback('callback::comments_field');
// access control
if ($this->acl_check_view('Users_Controller','work'))
......
$grid->order_field('hours')->label(url_lang::lang('texts.Hours'));
$grid->order_field('km')->label(url_lang::lang('texts.Km'));
$grid->order_callback_field('suggest_amount')->label(url_lang::lang('texts.Suggest amount'))->callback('Works_Controller::suggest_amount');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('Works_Controller::vote_state_field');
$grid->order_callback_field('approval_state')->label(url_lang::lang('texts.State'))->help(help::hint('approval_state'))->callback('callback::vote_state_field');
$grid->order_callback_field('comments_count')->label(url_lang::lang('texts.Comments count'))->callback('callback::comments_field');
// access control
if ($this->acl_check_view('Users_Controller','work'))
freenetis/branches/comments/application/libraries/MY_Controller.php
{
foreach ($paths as $id => $path)
{
if (url::base().url::previous() == $path[count($path)-1])
if (isset($path[count($path)-1]) && url::base().url::previous() == $path[count($path)-1])
{
$this->session->set('last_path_id', $id);
break;
freenetis/branches/comments/application/views/users_show.php
<th><?php echo url_lang::lang('texts.Birthday') ?></th>
<td><?php echo $user_data->birthday ?></td>
</tr>
<?php if ($this->acl_check_view('Users_Controller', 'application_password', $user_data->member->id)) { ?>
<tr>
<th><?php echo url_lang::lang('texts.Application password').'&nbsp;'.help::hint('application_password') ?></th>
<td>
......
<div class="clear"></div>
</td>
</tr>
<?php } ?>
<tr>
<th><?php echo url_lang::lang('texts.Comment') ?></th>
<td><?php echo trim($user_data->comment)!='' ? $user_data->comment : '&nbsp;'; ?></td>

Také k dispozici: Unified diff