OSDN Git Service

type設定の再編とi18n化
authorCake <cake_67@users.sourceforge.jp>
Sun, 20 Feb 2011 06:20:02 +0000 (15:20 +0900)
committerCake <cake_67@users.sourceforge.jp>
Sun, 20 Feb 2011 06:20:02 +0000 (15:20 +0900)
app/plugins/links/controllers/links_controller.php
app/plugins/links/models/link.php

index a6c039c..e2116b5 100644 (file)
@@ -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) {
index c389b65..65ada95 100644 (file)
@@ -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(