Index: trunk/extensions/Contest/includes/ContestChallange.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Contest challange object. |
| 5 | + * Class representing a single contest challange object. |
6 | 6 | * Each contest (can) has a list of associated challanges. |
7 | 7 | * |
8 | 8 | * @since 0.1 |
Index: trunk/extensions/Contest/includes/ContestContestant.php |
— | — | @@ -0,0 +1,120 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class representing a single contest contestant. |
| 6 | + * A contestant is a unique user + contest combination. |
| 7 | + * |
| 8 | + * @since 0.1 |
| 9 | + * |
| 10 | + * @file ContestContestant.php |
| 11 | + * @ingroup Contest |
| 12 | + * |
| 13 | + * @licence GNU GPL v3 or later |
| 14 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 15 | + */ |
| 16 | +class ContestContestant extends ContestDBObject { |
| 17 | + |
| 18 | + /** |
| 19 | + * Method to get an instance so methods that ought to be static, |
| 20 | + * but can't be due to PHP 5.2 not having LSB, can be called on |
| 21 | + * it. This also allows easy identifying of code that needs to |
| 22 | + * be changed once PHP 5.3 becomes an acceptable requirement. |
| 23 | + * |
| 24 | + * @since 0.1 |
| 25 | + * |
| 26 | + * @return ContestDBObject |
| 27 | + */ |
| 28 | + public static function s() { |
| 29 | + static $instance = false; |
| 30 | + |
| 31 | + if ( $instance === false ) { |
| 32 | + $instance = new self( array() ); |
| 33 | + } |
| 34 | + |
| 35 | + return $instance; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Get a new instance of the class from an array. |
| 40 | + * This method ought to be in the basic class and |
| 41 | + * return a new static(), but this requires LSB/PHP>=5.3. |
| 42 | + * |
| 43 | + * @since 0.1 |
| 44 | + * |
| 45 | + * @param array $data |
| 46 | + * @param boolean $loadDefaults |
| 47 | + * |
| 48 | + * @return ContestDBObject |
| 49 | + */ |
| 50 | + public function newFromArray( array $data, $loadDefaults = false ) { |
| 51 | + return new self( $data, $loadDefaults ); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * @see parent::getFieldTypes |
| 56 | + * |
| 57 | + * @since 0.1 |
| 58 | + * |
| 59 | + * @return string |
| 60 | + */ |
| 61 | + public function getDBTable() { |
| 62 | + return 'contest_contestants'; |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * @see parent::getFieldTypes |
| 67 | + * |
| 68 | + * @since 0.1 |
| 69 | + * |
| 70 | + * @return string |
| 71 | + */ |
| 72 | + protected function getFieldPrefix() { |
| 73 | + return 'contestant_'; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @see parent::getFieldTypes |
| 78 | + * |
| 79 | + * @since 0.1 |
| 80 | + * |
| 81 | + * @return array |
| 82 | + */ |
| 83 | + protected function getFieldTypes() { |
| 84 | + return array( |
| 85 | + 'id' => 'id', |
| 86 | + 'contest_id' => 'id', |
| 87 | + 'challange_id' => 'id', |
| 88 | + 'user_id' => 'id', |
| 89 | + |
| 90 | + 'full_name' => 'str', |
| 91 | + 'user_name' => 'str', |
| 92 | + 'email_name' => 'str', |
| 93 | + |
| 94 | + 'country' => 'str', |
| 95 | + 'volunteer' => 'bool', |
| 96 | + 'wmf' => 'bool', |
| 97 | + |
| 98 | + 'submission' => 'wtf', // TODO |
| 99 | + ); |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * @see parent::getDefaults |
| 104 | + * |
| 105 | + * @since 0.1 |
| 106 | + * |
| 107 | + * @return array |
| 108 | + */ |
| 109 | + public function getDefaults() { |
| 110 | + return array( |
| 111 | + 'full_name' => '', |
| 112 | + 'user_name' => '', |
| 113 | + 'email_name' => '', |
| 114 | + |
| 115 | + 'country' => '', |
| 116 | + 'volunteer' => false, |
| 117 | + 'wmf' => false |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 121 | +} |
Index: trunk/extensions/Contest/includes/Contest.class.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
| 5 | + * Class representing a single contest. |
5 | 6 | * |
6 | | - * |
7 | 7 | * @since 0.1 |
8 | 8 | * |
9 | 9 | * @file Contest.class.php |
Index: trunk/extensions/Contest/Contest.sql |
— | — | @@ -51,5 +51,5 @@ |
52 | 52 | comment_contestant_id INT unsigned NOT NULL, -- Foreign key on contest_contestants.contestant_id |
53 | 53 | comment_user_id INT(10) unsigned NOT NULL, -- Judge user id |
54 | 54 | comment_text TEXT NOT NULL, -- The comment text |
55 | | - comment_time CHAR(14) binary NOT NULL default '' -- The time at which the comment was made |
| 55 | + comment_time varbinary(14) NOT NULL default '' -- The time at which the comment was made |
56 | 56 | ) /*$wgDBTableOptions*/; |
\ No newline at end of file |