From 5656d116afe5c354f7e0ecd436ab69b34b0b7c9b Mon Sep 17 00:00:00 2001
From: Li Chen
Date: Sun, 1 Dec 2013 20:03:20 +0100
Subject: [PATCH] Fixed bad url in theme page
---
onyx/include/admin/exercice.php | 13 ++++++++++---
onyx/tpl/bootstrap/admin/exercice.tpl | 12 ++++++++++--
onyx/tpl/bootstrap/admin/themes.tpl | 4 ++--
3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/onyx/include/admin/exercice.php b/onyx/include/admin/exercice.php
index 3a925efb..fa6858cd 100644
--- a/onyx/include/admin/exercice.php
+++ b/onyx/include/admin/exercice.php
@@ -5,9 +5,16 @@ if(!defined('ONYX')) exit;
$p = $out[0];
if (isset($p[2]))
- $template->assign("theme", $p[2]);
+{
+ $tmp = explode("-", $p[2]);
+ $id = intval($tmp[0]);
+ if ($id == 0)
+ return "404";
+ $theme = new Theme($id);
+ $template->assign("theme", $theme);
+}
if (isset($p[3]))
- $template->assign("ex", $p[3]);
+ $template->assign("ex", new Exercice($p[3], $theme));
-return "admin/exercice";
+return SALT_ADMIN."/exercice";
diff --git a/onyx/tpl/bootstrap/admin/exercice.tpl b/onyx/tpl/bootstrap/admin/exercice.tpl
index 1537536f..605034b2 100644
--- a/onyx/tpl/bootstrap/admin/exercice.tpl
+++ b/onyx/tpl/bootstrap/admin/exercice.tpl
@@ -1,7 +1,15 @@
{extends file="admin/layout.tpl"}
{block name=content}
- Theme: {$theme}
- Exercice: {$ex}
+ Theme: {$theme->name}
+ {if isset($ex)}
+ Exercice: {$ex->id}
+ {else}
+
+ {foreach $theme->get_exercices_ordered() as $ex}
+ - {$ex->get_name()}
+ {/foreach}
+
+ {/if}
{/block}
diff --git a/onyx/tpl/bootstrap/admin/themes.tpl b/onyx/tpl/bootstrap/admin/themes.tpl
index 150ded87..86c9bf2b 100644
--- a/onyx/tpl/bootstrap/admin/themes.tpl
+++ b/onyx/tpl/bootstrap/admin/themes.tpl
@@ -19,10 +19,10 @@
Exporter
- {$t->name} |
+ {$t->name} |
|
FIXME |