Beispiel #1
0
 private function onUserVote(GWF_User $user)
 {
     if (false !== ($err = $this->votescore->onUserVoteSafe($this->score, $user->getID()))) {
         return $err;
     }
     return $this->onVoted($user);
 }
Beispiel #2
0
 private function statsVoteScore($vsid)
 {
     if (false === ($votescore = GWF_VoteScore::getByID($vsid))) {
         return $this->module->error('err_votescore');
     }
     $cnt = $votescore->getVar('vs_count');
     $avg = $votescore->getVar('vs_avg');
     $sum = $votescore->getVar('vs_sum');
     $min = $votescore->getVar('vs_min');
     $max = $votescore->getVar('vs_max');
     return sprintf('1:%s:%s:%s:%s:%s', $cnt, $avg, $sum, $min, $max);
 }
Beispiel #3
0
 public function execute()
 {
     // Single
     if (false !== ($vsid = Common::getGet('editvs'))) {
         // Validate
         if (false === ($vs = GWF_VoteScore::getByID($vsid))) {
             return $this->module->error('err_votescore');
         }
         // Edit
         if (false !== Common::getPost('editvs')) {
             return $this->onEdit($vs);
             # FIXME: {gizmore} missing method
         }
         // Single Template
         return $this->templateEdit($vs);
     }
     // Table
     return $this->templateVotes();
 }
Beispiel #4
0
 public static function templateVoteScoreS($votescore_id)
 {
     if (false === ($module = GWF_Module::getModule('Votes'))) {
         return '';
     }
     if (false === ($vs = GWF_VoteScore::getByID($votescore_id))) {
         return '';
     }
     return $module->templateVoteScore($vs);
 }
Beispiel #5
0
 /**
  * @return GWF_VoteScore
  */
 public function getVotesFun()
 {
     return GWF_VoteScore::getByID($this->getVar('site_vote_fun', 0));
 }