Added:
/trunk/vanillaapp/views/problems/listproblems.php
Deleted:
/trunk/vanillaapp/views/problems/getlist.php
Modified:
/trunk/vanillaapp/controllers/class.problemscontroller.php
/trunk/vanillaapp/models/class.problemmodel.php
/trunk/vanillaapp/views/problems/my.php
=======================================
--- /dev/null
+++ /trunk/vanillaapp/views/problems/listproblems.php Sat Jul 10 22:20:19
2010
@@ -0,0 +1,21 @@
+{ "sEcho": <?=intval($this->sEcho)?>,
+ "iTotalRecords": <?=$this->Count?>,
+ "iTotalDisplayRecords": <?=Count($this->Problems)?>,
+ "aaData": [
+<?
+$res = $this->Problems;
+for($i = 0; $i < Count($res); ++$i) {
+ $Problem = $res[$i];
+ if($i > 0) echo(",");
+?>
+[
+ "<?=$Problem->StateText?>",
+ <?=$Problem->Solved?>,
+ "<?=$Problem->ID?>",
+ "<?=$Problem->Name?>",
+ <?=$Problem->Accepted?>,
+ <?=$Problem->Submissions?>]
+<?
+}
+?>
+]}
=======================================
--- /trunk/vanillaapp/views/problems/getlist.php Mon May 31 21:48:02 2010
+++ /dev/null
@@ -1,18 +0,0 @@
-{ "sEcho": <?=intval($this->sEcho)?>,
- "iTotalRecords": <?=$this->Count?>,
- "iTotalDisplayRecords": <?=Count($this->Problems)?>,
- "aaData": [
-<?
-$res = $this->Problems;
-for($i = 0; $i < Count($res); ++$i) {
- $Problem = $res[$i];
- if($i > 0) echo(",");
-?>
-[
- <? if($this->AdminView) { echo('"' . $Problem->State . '", '); } ?>
- <?=$Problem->Solved?>, "<?=$Problem->ID?>",
- "<?=$Problem->Name?>", <?=$Problem->Accepted?>,
<?=$Problem->Submissions?>]
-<?
-}
-?>
-]}
=======================================
--- /trunk/vanillaapp/controllers/class.problemscontroller.php Sat Jul 10
22:19:58 2010
+++ /trunk/vanillaapp/controllers/class.problemscontroller.php Sat Jul 10
22:20:19 2010
@@ -265,7 +265,7 @@
"Offset" => $Offset,
"SearchTerm" => $SearchTerm);
}
- public function GetList() {
+ public function ListProblems() {
$this->MasterView = "json";
$params = $this->ParseDataTablesQuery(
Array("State", "Solved", "ID", "Name", "Accepted", "Accepted /
Submissions"));
@@ -307,7 +307,6 @@
$Problems = Array();
$this->SetData("Problems", $Problems, TRUE);
- $this->SetData("AdminView", TRUE, TRUE);
$this->Render();
}
public function ListAttachments($IdOrNo=1) {
=======================================
--- /trunk/vanillaapp/models/class.problemmodel.php Sat Jul 10 22:19:58 2010
+++ /trunk/vanillaapp/models/class.problemmodel.php Sat Jul 10 22:20:19 2010
@@ -20,6 +20,12 @@
class ProblemModel extends Gdn_Model {
public function __construct() {
parent::__construct('Problem');
+ $this->UserModel = new UserModel();
+ }
+
+ private function Augment($Problem) {
+ $Problem->StateText = ProblemState::ToString($Problem->State);
+ $Problem->AuthorInfo = $this->UserModel->Get($Problem->Author);
}
public function IsIDUnique($ID, $No) {
@@ -66,7 +72,7 @@
$this->SQL->Limit($Limit, $Offset);
$ret = $this->SQL->Get()->Result();
for($i = 0; $i < Count($ret); ++$i) {
- $ret[$i]->State = ProblemState::ToString($ret[$i]->State);
+ $this->Augment($ret[$i]);
}
return $ret;
}
=======================================
--- /trunk/vanillaapp/views/problems/my.php Sat Jul 10 22:19:58 2010
+++ /trunk/vanillaapp/views/problems/my.php Sat Jul 10 22:20:19 2010
@@ -41,7 +41,7 @@
"bServerSide": true,
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
- "sAjaxSource": "<?=Url("/aoj/problems/getlist")?>",
+ "sAjaxSource": "<?=Url("/aoj/problems/listproblems")?>",
"fnServerData": function ( sSource, aoData, fnCallback ) {
if(aoData == null) {
aoData = [];