diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-04 17:05:20 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-04 17:05:20 +0200 |
commit | d529672a314e188d9effdc14a30c37a990f80ebe (patch) | |
tree | 9ad28a9de239bbe542b99846156f37002dfe7ab4 /lib/list | |
parent | 187883fd80675211a022a6e98f6d5d84a796373f (diff) | |
download | Bits-d529672a314e188d9effdc14a30c37a990f80ebe.tar.gz Bits-d529672a314e188d9effdc14a30c37a990f80ebe.zip |
Some changes to the way reviews work - custom styles!
Diffstat (limited to 'lib/list')
-rw-r--r-- | lib/list/inc_process.php | 28 | ||||
-rw-r--r-- | lib/list/list_models.php | 17 |
2 files changed, 37 insertions, 8 deletions
diff --git a/lib/list/inc_process.php b/lib/list/inc_process.php index d4656b5..0c7dd82 100644 --- a/lib/list/inc_process.php +++ b/lib/list/inc_process.php @@ -1,16 +1,28 @@ <?php require("lib/JSON/inc_json.php"); +require("lib/list/list_models.php"); function mk_batch_json($models, $contents) { - $data = array("columns" => array(), "items" => array()); - - $columns = explode('|', $models); - foreach ($columns as $c) { - if ($c[0] == '!') { - $data['columns'][] = array("question" => false, "name" => substr($c, 1)); - } else { - $data['columns'][] = array("question" => true, "name" => $c); + global $list_models; + + $data = array("columns" => array(), "items" => array(), "questions" => array()); + + if ($models[0] == '*') { + $model = $list_models[substr($models, 1)]; + + $columns = $data['columns'] = $model['columns']; + $data['questions'] = $model['questions']; + } else { + $columns = explode('|', $models); + + foreach ($columns as $k => $c) { + if ($c[0] == '!') { + $data['columns'][] = substr($c, 1); + } else { + $data['columns'][] = $c; + $data['questions'][] = array('col' => $k); + } } } diff --git a/lib/list/list_models.php b/lib/list/list_models.php new file mode 100644 index 0000000..0d34856 --- /dev/null +++ b/lib/list/list_models.php @@ -0,0 +1,17 @@ +<?php + +$list_models = array( + "RTK-Kanji" => array( + "columns" => array("N#", "Kanji", "Keyword", "Strokes"), + "questions" => array( + array( + 'q' => '<p class="rtk_kr_q_2">%2</p>', + 'a' => '<p class="rtk_kr_a_2">#%0: %2 [%3]<br /><span>%1</span></p>' + ), + array( + 'q' => '<p class="rtk_kr_q_1">%1</p>', + 'a' => '<p class="rtk_kr_a_1">#%0: %1 [%3]<br /><span>%2</span></p>' + ), + ), + ), +); |