mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
move reception bar into own function
This commit is contained in:
parent
10058afdb7
commit
ec2d4c8c8d
|
|
@ -3314,6 +3314,35 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
return $content;
|
||||
} /* }}} */
|
||||
|
||||
function documentListRowReceptionBar($latestContent) { /* {{{ */
|
||||
$accessop = $this->params['accessobject'];
|
||||
|
||||
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
|
||||
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
|
||||
$allcomments = array('-1'=>array(), '1'=>array());
|
||||
foreach ($receiptStatus as $r) {
|
||||
$rstat[''.$r['status']]++;
|
||||
if($r['comment']) {
|
||||
// $allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
|
||||
$m5 = md5(trim($r['comment']));
|
||||
if(isset($allcomments[''.$r['status']][$m5]))
|
||||
$allcomments[''.$r['status']][$m5]['n']++;
|
||||
else
|
||||
$allcomments[''.$r['status']][$m5] = array('n'=>1, 'c'=>htmlspecialchars(trim($r['comment'])));
|
||||
}
|
||||
}
|
||||
$totalreceipts = $rstat['-1'] + $rstat['0'] + $rstat['1'];
|
||||
if($totalreceipts) {
|
||||
$content .= "
|
||||
<div class=\"progress\">
|
||||
<div class=\"bar bar-success\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['1'])), true) : "")."</div>
|
||||
<div class=\"bar bar-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['-1'])), true) : "")."</div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
} /* }}} */
|
||||
|
||||
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
|
||||
$user = $this->params['user'];
|
||||
$session = $this->params['session'];
|
||||
|
|
@ -3475,31 +3504,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
|
||||
$content .= "<td nowrap>";
|
||||
$content .= $this->documentListRowStatus($latestContent);
|
||||
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
|
||||
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
|
||||
$allcomments = array('-1'=>array(), '1'=>array());
|
||||
foreach ($receiptStatus as $r) {
|
||||
$rstat[''.$r['status']]++;
|
||||
if($r['comment']) {
|
||||
// $allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
|
||||
$m5 = md5(trim($r['comment']));
|
||||
if(isset($allcomments[''.$r['status']][$m5]))
|
||||
$allcomments[''.$r['status']][$m5]['n']++;
|
||||
else
|
||||
$allcomments[''.$r['status']][$m5] = array('n'=>1, 'c'=>htmlspecialchars(trim($r['comment'])));
|
||||
}
|
||||
}
|
||||
$totalreceipts = $rstat['-1'] + $rstat['0'] + $rstat['1'];
|
||||
if($totalreceipts) {
|
||||
$content .= "
|
||||
<div class=\"progress\">
|
||||
<div class=\"bar bar-success\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['1'])), true) : "")."</div>
|
||||
<div class=\"bar bar-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['-1'])), true) : "")."</div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
$content .= "</small></td>";
|
||||
// $content .= "<td>".$version."</td>";
|
||||
$content .= $this->documentListRowReceptionBar($latestContent);
|
||||
$content .= "</td>";
|
||||
$content .= "<td>";
|
||||
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
|
||||
$content .= "</td>";
|
||||
|
|
|
|||
|
|
@ -3288,6 +3288,36 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
return $content;
|
||||
} /* }}} */
|
||||
|
||||
function documentListRowReceptionBar($latestContent) { /* {{{ */
|
||||
$accessop = $this->params['accessobject'];
|
||||
|
||||
$content = '';
|
||||
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
|
||||
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
|
||||
$allcomments = array('-1'=>array(), '1'=>array());
|
||||
foreach ($receiptStatus as $r) {
|
||||
$rstat[''.$r['status']]++;
|
||||
if($r['comment']) {
|
||||
// $allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
|
||||
$m5 = md5(trim($r['comment']));
|
||||
if(isset($allcomments[''.$r['status']][$m5]))
|
||||
$allcomments[''.$r['status']][$m5]['n']++;
|
||||
else
|
||||
$allcomments[''.$r['status']][$m5] = array('n'=>1, 'c'=>htmlspecialchars(trim($r['comment'])));
|
||||
}
|
||||
}
|
||||
$totalreceipts = $rstat['-1'] + $rstat['0'] + $rstat['1'];
|
||||
if($totalreceipts) {
|
||||
$content .= "
|
||||
<div class=\"progress\">
|
||||
<div class=\"progress-bar bar bar-success bg-success\" role=\"progress-bar\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['1'])), true) : "")."</div>
|
||||
<div class=\"progress-bar bar bar-danger bg-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['-1'])), true) : "")."</div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
} /* }}} */
|
||||
|
||||
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
|
||||
$user = $this->params['user'];
|
||||
$session = $this->params['session'];
|
||||
|
|
@ -3448,31 +3478,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
|||
|
||||
$content .= "<td nowrap>";
|
||||
$content .= $this->documentListRowStatus($latestContent);
|
||||
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
|
||||
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
|
||||
$allcomments = array('-1'=>array(), '1'=>array());
|
||||
foreach ($receiptStatus as $r) {
|
||||
$rstat[''.$r['status']]++;
|
||||
if($r['comment']) {
|
||||
// $allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
|
||||
$m5 = md5(trim($r['comment']));
|
||||
if(isset($allcomments[''.$r['status']][$m5]))
|
||||
$allcomments[''.$r['status']][$m5]['n']++;
|
||||
else
|
||||
$allcomments[''.$r['status']][$m5] = array('n'=>1, 'c'=>htmlspecialchars(trim($r['comment'])));
|
||||
}
|
||||
}
|
||||
$totalreceipts = $rstat['-1'] + $rstat['0'] + $rstat['1'];
|
||||
if($totalreceipts) {
|
||||
$content .= "
|
||||
<div class=\"progress\">
|
||||
<div class=\"progress-bar bar bar-success bg-success\" role=\"progress-bar\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['1'])), true) : "")."</div>
|
||||
<div class=\"progress-bar bar bar-danger bg-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="fa fa-comment"></i>', implode('<br />', formatComment($allcomments['-1'])), true) : "")."</div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
$content .= "</small></td>";
|
||||
// $content .= "<td>".$version."</td>";
|
||||
$content .= $this->documentListRowReceptionBar($latestContent);
|
||||
$content .= "</td>";
|
||||
$content .= "<td>";
|
||||
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
|
||||
$content .= "</td>";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user