Added Highscore to programs/view
This commit is contained in:
		| @@ -637,6 +637,10 @@ ul.nav li.dropdown-append:hover > ul.dropdown-menu { | ||||
|     border-radius: 6px 6px 0px 0px; | ||||
| } | ||||
|  | ||||
| .progview_donwloadbtns > .btn-primary { | ||||
|     font-weight: 900; | ||||
| } | ||||
|  | ||||
| /* blog/view | ||||
| -------------------------------------------------- */ | ||||
|  | ||||
|   | ||||
| @@ -115,4 +115,15 @@ class HighscoreGames extends CActiveRecord | ||||
| 	{ | ||||
| 		return '/Highscores/list?gameid=' . $this->ID; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return HighscoreEntries | ||||
| 	 */ | ||||
| 	public function getMaximumScore() | ||||
| 	{ | ||||
| 		if (count($this->ENTRIES) > 0) | ||||
| 			return $this->ENTRIES[0]; | ||||
| 		else | ||||
| 			return null; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -204,6 +204,9 @@ class Program extends CActiveRecord | ||||
| 		return new DateTime($this->add_date); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return string | ||||
| 	 */ | ||||
| 	public function getStarHTML() | ||||
| 	{ | ||||
| 		$out = ''; | ||||
| @@ -261,7 +264,16 @@ class Program extends CActiveRecord | ||||
| 		return $result; | ||||
| 	} | ||||
|  | ||||
| 	public function deleteDescriptions() { | ||||
| 	public function deleteDescriptions() | ||||
| 	{ | ||||
| 		MsHelper::deleteDir("data/programs/desc/" . $this->Name . "/"); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return HighscoreGames | ||||
| 	 */ | ||||
| 	public function getHighscoreGame() | ||||
| 	{ | ||||
| 		return HighscoreGames::model()->findByPk($this->highscore_gid); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -26,9 +26,9 @@ | ||||
| 			border-spacing: 0px; | ||||
| 		} | ||||
|  | ||||
| 		table td { | ||||
| 			padding: 2px 0px; | ||||
| 		} | ||||
| 		table td { padding: 2px 0px; } | ||||
| 		table td { width: 25%; } | ||||
| 		table td:last-child { width: 50%; } | ||||
|  | ||||
| 		caption { | ||||
| 			font-weight: bolder; | ||||
|   | ||||
| @@ -39,6 +39,12 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { | ||||
| 							<td>Downloads:</td> | ||||
| 							<td><?php echo TbHtml::badge($model->Downloads, array('color' => TbHtml::BADGE_COLOR_SUCCESS)); ?></td> | ||||
| 						</tr> | ||||
| 						<?php if ($model->highscore_gid >= 0): ?> | ||||
| 							<tr> | ||||
| 								<td>Highscore:</td> | ||||
| 								<td><?php echo TbHtml::badge($model->getHighscoreGame()->getMaximumScore()->POINTS, array('color' => TbHtml::BADGE_COLOR_SUCCESS)); ?></td> | ||||
| 							</tr> | ||||
| 						<?php endif ?> | ||||
| 						<tr> | ||||
| 							<td>Languages:</td> | ||||
| 							<td><?php foreach ($model->getLanguageList() as $lang) echo TbHtml::badge($lang, array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td> | ||||
| @@ -53,10 +59,6 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { | ||||
| 								<td><?php echo TbHtml::badge($model->version->Version, array('color' => TbHtml::BADGE_COLOR_INFO)); ?></td> | ||||
| 							</tr> | ||||
| 						<?php endif ?> | ||||
| 						<?php | ||||
| 						// TODO-MS Add Highscore Tables to MVC | ||||
| 						// TODO-MS Show highest score when highscore_gid is set | ||||
| 						?> | ||||
| 					</table> | ||||
| 				</div> | ||||
|  | ||||
| @@ -138,7 +140,7 @@ if (!$model->visible && Yii::app()->user->name != 'admin') { | ||||
| 								'block' => true, | ||||
| 								'color' => TbHtml::BUTTON_COLOR_SUCCESS, | ||||
| 								'size' => TbHtml::BUTTON_SIZE_DEFAULT, | ||||
| 								'url' => '#', //TODO-MS Add Highscore link | ||||
| 								'url' => '/Highscores/list?gameid=' . $model->highscore_gid, //TODO-MS Add Highscore link | ||||
| 							]); | ||||
| 					?> | ||||
| 				</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user