Beispiel #1
0
 /**
  * Create a new VoteScore Table. Returns GWF_Votescore or false.
  * @param string $name tablename (not really used)
  * @param int $min Minimum votescore 
  * @param int $max
  * @param bool $allowGuests
  * @param int $expires
  * @param int $results
  * @return GWF_VoteScore
  */
 public static function installVoteScoreTable($name, $min = 1, $max = 10, $allowGuests = true, $expires = 0, $results = GWF_VoteScore::SHOW_RESULT_ALWAYS, $enabled = true)
 {
     if ($max < $min) {
         echo GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'max < min'));
         return false;
     }
     $options = 0;
     $options |= $enabled ? GWF_VoteScore::ENABLED : 0;
     $options |= $allowGuests ? GWF_VoteScore::GUEST_VOTES : 0;
     $options |= $results;
     //		var_dump($options);
     if (false === ($votes = GWF_VoteScore::newVoteScore($name, $min, $max, $expires, $options))) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     if (false === $votes->replace()) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     return $votes;
 }