unanimated timer

This commit is contained in:
Ulf Gebhardt 2014-02-18 23:42:19 +01:00
parent 56b9cf834d
commit ed7020c347
4 changed files with 21 additions and 21 deletions

View File

@ -7,5 +7,5 @@ class UVOTE_GENERATE_VOTELIST extends \SYSTEM\DB\QP {
//pg
'',
//mys
'SELECT * FROM `uvote_votes` WHERE `group` = ?;'
'SELECT * FROM `uvote_votes` WHERE `group` = ? ORDER BY (time_end-time_start) ASC;'
);}}

View File

@ -65,7 +65,7 @@ class default_bulletin extends SYSTEM\PAGE\Page {
default: array('','','');
}
return '<h4>Stimme hier ab</h4>
return '<h4>Ändere deine bereits abgegebene Stimme hier ab</h4>
<a class="btn '.$classes[0].' btn-default btnvote_yes"
style="width: 70px"
poll_ID="${poll_ID}"><font

View File

@ -31,29 +31,24 @@ class default_page extends SYSTEM\PAGE\Page {
}
public function generate_votelist(){
$result = "";
$votes = votes::getAllVotesOfGroup(1);
$result = array('','');
$votes = votes::getAllVotesOfGroup(1);
foreach($votes as $vote){
$time_remain = strtotime($vote['time_end'])- microtime(true);
$time_span = strtotime($vote['time_end']) - strtotime($vote['time_start']);
$vote['vote_class'] = $this->tablerow_class(votes::getUserPollData($vote['ID']));
$vote['full_vote_btn'] = (strtotime($vote['time_end'])- microtime(true)) > 0 ? 'Abstimmen' : 'Ansehen';
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote);
$vote['full_vote_btn'] = $time_remain > 0 ? 'Abstimmen' : 'Ansehen';
$vote['time_left'] = round($time_remain/($time_span+1)*100,0);
$vote['time_done'] = 100-$vote['time_left'];
if($time_remain > 0){
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote);
} else {
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote);
}
}
return $result;
return $result[0].$result[1];
}
// public function generate_vote(){
// $result = "";
// $votes = votes::getAllVotesOfGroup(1);
//
// foreach($votes as $vote){
// new INFO (print_r($vote, TRUE));
// $vars = array('vote_title' => $vote['title'], 'vote_text' => $vote['text'], 'vote_init' => $vote['initiative'], 'poll_ID' => $vote['ID'], 'time_end' => $vote['time_end'], 'iframe_link' => $vote['iframe_link']);
// $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/full_vote.tpl'), $vars);
//
// }
// return $result;
// }
public function get_coverpage(){
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/cover.tpl'), array());}
@ -74,7 +69,6 @@ class default_page extends SYSTEM\PAGE\Page {
$vars['js'] = $this->js();
$vars['css'] = $this->css();
$vars['votelist'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->generate_votelist() : $this->get_coverpage() ;
// $vars['vote'] = $this->generate_vote();
$vars['registerform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->getloggedinform() : $this->exchange_registerform();
$vars['loginform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->exchange_loginform() : $this->getloginform() ;
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';

View File

@ -7,5 +7,11 @@
Nr.${ID}
</td>
<td class="${vote_class}" style="width: 20px; margin-top: 10px; border-left: 2px solid black;"></td>
<td style="margin: 0; padding: 0; width: 3px;" >
<table class="poll_time" time="${time_end}" style="width: 100%; height: 100%; margin: 0; padding: 0;">
<tr id="time_done" style="height: ${time_done}%; background: white; margin: 0; padding: 0;"><td style="width: 1px; margin: 0; padding: 0;"></td></tr>
<tr id="time_left" style="height: ${time_left}%; background: blue; margin: 0; padding: 0;"><td style="width: 1px; margin: 0; padding: 0;"></td></tr>
</table>
</td>
</tr>
</table>