From 2cd9225884c71c0e17400be6aa7bdd096c244dfd Mon Sep 17 00:00:00 2001 From: Cake Date: Sun, 20 Feb 2011 15:20:02 +0900 Subject: [PATCH] =?utf8?q?type=E8=A8=AD=E5=AE=9A=E3=81=AE=E5=86=8D?= =?utf8?q?=E7=B7=A8=E3=81=A8i18n=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/plugins/links/controllers/links_controller.php | 57 +++++++++++++++++++--- app/plugins/links/models/link.php | 13 ++--- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/app/plugins/links/controllers/links_controller.php b/app/plugins/links/controllers/links_controller.php index a6c039c..e2116b5 100644 --- a/app/plugins/links/controllers/links_controller.php +++ b/app/plugins/links/controllers/links_controller.php @@ -44,6 +44,9 @@ class LinksController extends AppController { ), ); + var $type = array(); + var $type_settings = array(); + // pagenate設定 // CollectionableBehavoirによりModelにて設定 @@ -326,14 +329,9 @@ class LinksController extends AppController { /* type設定をセット */ function set_type4view() { - $this->model_type = $this->get_type(); - $this->set('type', $this->model_type); + $this->type = $this->get_type_i18n(); - $this->model_type2 = array_merge( - array(0 => 'member'), - $this->model_type - ); - $this->set('type2', $this->model_type2); + $this->set('type', $this->type); } function get_type() { @@ -343,6 +341,51 @@ class LinksController extends AppController { return array(); } } + function get_type_i18n(){ + $type = $this->get_type(); + + if (!empty($type)) { + $this->set_type_i18n(); + + $types = array(); + foreach ($type as $k => $v) { + $types[$k]['name'] = $v; + if (isset($this->type_settings[$v])) { + $types[$k]['title'] = $this->type_settings[$v]['title']; + $types[$k]['description'] = $this->type_settings[$v]['description']; + } else { + $types[$k]['title'] = ''; + $types[$k]['description'] = ''; + } + } + $type = $types; + } + return $type; + } + function set_type_i18n() { + $this->type_settings = array( + 'member' => array( + 'title' => '', + 'description' => '', + ), + 'creators' => array( + 'title' => __('Creators/Publishers', true), + 'description' => __('The website of TRPG creators/Publishers.', true), + ), + 'portal' => array( + 'title' => __('Portal/Search', true), + 'description' => __('The portal site or the search site for TRPG.', true), + ), + 'ring' => array( + 'title' => __('WebRing', true), + 'description' => __('Joined Webrings', true), + ), + 'thanks' => array( + 'title' => __('Thanks links', true), + 'description' => __('Thanks sites. Some site have NO relation to TRPG.', true), + ), + ); + } /* Restore */ function _restore_html_link($data, $nl2br = false, $emptyNotitle = false) { diff --git a/app/plugins/links/models/link.php b/app/plugins/links/models/link.php index c389b65..65ada95 100644 --- a/app/plugins/links/models/link.php +++ b/app/plugins/links/models/link.php @@ -61,13 +61,14 @@ class Link extends AppModel { ), ); + + // リンク種類 public $type = array( - 1 => 'official', - 2 => 'ring', - 3 => 'material', - 4 => 'thanks', - 5 => 'mutual', - 99 => 'admin', + 0 => 'member', + 1 => 'creators', + 2 => 'portal', + 3 => 'ring', + 10 => 'thanks', ); var $validate = array( -- 2.11.0