diff --git a/lib/asset/dmChessJavascriptConfig.php b/lib/asset/dmChessJavascriptConfig.php index 8027e5d..f575184 100644 --- a/lib/asset/dmChessJavascriptConfig.php +++ b/lib/asset/dmChessJavascriptConfig.php @@ -8,7 +8,7 @@ class dmChessJavascriptConfig $i18n, $player; - public function __construct(dmWebResponse $response, dmHelper $helper, dmi18n $i18n, DmChessPlayer $player) + public function __construct(dmWebResponse $response, dmHelper $helper, dmI18n $i18n, DmChessPlayer $player) { $this->response = $response; $this->helper = $helper; diff --git a/lib/model/doctrine/PluginDmChessGameTable.class.php b/lib/model/doctrine/PluginDmChessGameTable.class.php index 57bc7b9..198e192 100644 --- a/lib/model/doctrine/PluginDmChessGameTable.class.php +++ b/lib/model/doctrine/PluginDmChessGameTable.class.php @@ -6,13 +6,16 @@ class PluginDmChessGameTable extends myDoctrineTable public function broom() { - $this->createQuery('g') - // games created yesterday, with less than 3 moves - ->where('g.created_at < ? AND g.turns < ?', array(date ("Y-m-d H:i:s", strtotime('-1 day')), 3)) - // games with last move one month ago, and not finished - ->orWhere('g.updated_at < ? AND g.is_finished = ?', array(date ("Y-m-d H:i:s", strtotime('-1 month')), false)) - // hop! - ->delete()->execute(); + $this->getBroomQuery()->delete()->execute(); + } + + public function getBroomQuery() + { + return $this->createQuery('g') + // games created three days ago, with less than 3 moves + ->where('g.created_at < ? AND g.turns < ?', array(date ("Y-m-d H:i:s", strtotime('-3 day')), 3)) + // games with last move 6 months ago, and not finished + ->orWhere('g.updated_at < ? AND g.is_finished = ?', array(date ("Y-m-d H:i:s", strtotime('-6 month')), false)); } public function preload($id) @@ -23,4 +26,9 @@ public function preload($id) ->leftJoin('players.Pieces pieces') ->fetchRecord(); } + + public function getAdminListQuery(dmDoctrineQuery $query) + { + return parent::getAdminListQuery($query)->leftJoin($query->getRootAlias().'.Players'); + } } \ No newline at end of file diff --git a/modules/dmChessGameAdmin/templates/_players_list.php b/modules/dmChessGameAdmin/templates/_players_list.php index 423d404..e2349de 100644 --- a/modules/dmChessGameAdmin/templates/_players_list.php +++ b/modules/dmChessGameAdmin/templates/_players_list.php @@ -1,4 +1,6 @@ $dm_chess_game, 'alias' => 'Players', 'options' => array( - 'new' => false -))); \ No newline at end of file +echo $sf_context->getServiceContainer()->mergeParameter('related_records_view.options', array( + 'record' => $dm_chess_game, + 'alias' => 'Players', + 'new' => false +))->getService('related_records_view')->render(); \ No newline at end of file diff --git a/modules/dmChessPlayerAdmin/config/generator.yml b/modules/dmChessPlayerAdmin/config/generator.yml index c60ef6d..1738046 100644 --- a/modules/dmChessPlayerAdmin/config/generator.yml +++ b/modules/dmChessPlayerAdmin/config/generator.yml @@ -46,7 +46,7 @@ generator: - events form: display: - NONE: [is_creator, is_winner, is_ai, game_id] + NONE: [is_creator, is_winner, is_ai] Others: [code, ai_level, color, events] class: DmChessPlayerAdminForm fields: { } diff --git a/web/css/table.css b/web/css/table.css index caff15e..64f12e5 100644 --- a/web/css/table.css +++ b/web/css/table.css @@ -3,7 +3,7 @@ div.dm_chess_opponent { } div.dm_chess_table { - height: 216px; + height: 216px; overflow: hidden; background: #F8F8F8; padding: 10px; @@ -14,24 +14,25 @@ div.dm_chess_table { } div.dm_chess_join_url { - background: #FFFFFF; - border: 1px solid #D4D4D4; - margin: 24px 0; - padding: 10px; + background: #FFFFFF; + border: 1px solid #D4D4D4; + margin: 24px 0; + padding: 10px; + font-size: 11px; } div.dm_chess_separator { - border-bottom: 1px solid #D4D4D4; + border-bottom: 1px solid #D4D4D4; margin: 10px 0; } div.dm_chess_permalink a.link { - white-space: nowrap; - display: block; + white-space: nowrap; + display: block; } div.dm_chess_give_up { - margin-top: 20px; + margin-top: 20px; text-align: right; } div.dm_chess_give_up a.link { @@ -83,7 +84,7 @@ div.dm_chess_cemetery_bottom { } div.dm_chess_cemetery li { - display: block; + display: block; list-style: none; float: left; margin-right: -24px;