1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Fix TimeIntervalOptionType

This commit is contained in:
Tim Düsterhus 2013-02-01 21:11:04 +01:00
parent c44067dfe0
commit 6d40e07fbe
3 changed files with 13 additions and 3 deletions

View File

@ -22,10 +22,20 @@ public function getData(\wcf\data\option\Option $option, $newValue) {
* @see \wcf\system\option\TextOptionType::getFormElement() * @see \wcf\system\option\TextOptionType::getFormElement()
*/ */
public function getFormElement(\wcf\data\option\Option $option, $value) { public function getFormElement(\wcf\data\option\Option $option, $value) {
$tmp = (int) ($value / 60); $tmp = '';
if ($value > 86400) {
$tmp = floor($value / 86400).'d';
$value -= floor($value / 86400) * 86400;
}
if ($value > 3600) {
$tmp .= floor($value / 3600).'h';
$value -= floor($value / 3600) * 3600;
}
$tmp .= floor($value / 60);
if ($value % 60 != 0) { if ($value % 60 != 0) {
$tmp .= ','.($value % 60).'s'; $tmp .= ','.($value % 60).'s';
} }
return parent::getFormElement($option, $tmp); return parent::getFormElement($option, $tmp);
} }
} }

View File

@ -75,7 +75,7 @@ public static function getDiedUsers() {
$stmt = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute(array('lastActivity', 'roomID', $time - 30)); $stmt->execute(array('lastActivity', 'roomID', $time - 30));
$users = array(); $users = array();
while ($users[] = $stmt->fetchArray()); while ($user = $stmt->fetchArray()) $users[] = $user;
return $users; return $users;
} }

View File

@ -72,7 +72,7 @@
</option> </option>
<option name="chat_log_archivetime"> <option name="chat_log_archivetime">
<categoryname>chat.log</categoryname> <categoryname>chat.log</categoryname>
<optiontype>integer</optiontype> <optiontype>timeInterval</optiontype>
<defaultvalue>172800</defaultvalue> <defaultvalue>172800</defaultvalue>
<showorder>2</showorder> <showorder>2</showorder>
</option> </option>