TRPGサイト向け会員認証システム
メンバー登録
キャラシ作成&公開
修订版 | 9a0070552090254798d603411f9ffb75c7c564fd (tree) |
---|---|
时间 | 2011-03-10 13:06:51 |
作者 | Cake <cake_67@user...> |
Commiter | Cake |
Index表示内容設定
@@ -149,35 +149,24 @@ class LinksController extends AppController { | ||
149 | 149 | |
150 | 150 | function _index() { |
151 | 151 | $this->Link->beforeFind(''); |
152 | - // WhatsNew | |
153 | - $member = $this->Link->find('all', array('options' => array( | |
154 | - 'member_new5' | |
155 | - ))); | |
156 | - $member = $this->restore_html_link($member, true, false); | |
157 | - $creator = $this->Link->find('all', array('options' => array( | |
158 | - 'creator_new5' | |
159 | - ))); | |
160 | - $creator = $this->restore_html_link($creator, true, false); | |
161 | - $portal = $this->Link->find('all', array('options' => array( | |
162 | - 'portal_new5' | |
163 | - ))); | |
164 | - $portal = $this->restore_html_link($portal, true, false); | |
165 | - $ring = $this->Link->find('all', array('options' => array( | |
166 | - 'ring_new5' | |
167 | - ))); | |
168 | - $ring = $this->restore_html_link($ring, true, false); | |
169 | - $thanks = $this->Link->find('all', array('options' => array( | |
170 | - 'thanks_new5' | |
171 | - ))); | |
172 | - $thanks = $this->restore_html_link($thanks, true, false); | |
152 | + /* WhatsNew */ | |
153 | + // all | |
154 | + $this->set('all', $this->get_link4options(array('limit9'))); | |
173 | 155 | |
156 | + // By Type | |
174 | 157 | $this->set('links', array( |
175 | - 'member' => $member, | |
176 | - 'creator' => $creator, | |
177 | - 'portal' => $portal, | |
178 | - 'ring' => $ring, | |
179 | - 'thanks' => $thanks, | |
158 | + 'portal' => $this->get_link4options(array('portal', 'limit5')), | |
159 | + 'online' => $this->get_link4options(array('online', 'limit5')), | |
160 | + 'offline' => $this->get_link4options(array('offline', 'limit5')), | |
161 | + 'tool' => $this->get_link4options(array('tool', 'limit5')), | |
162 | + 'creator' => $this->get_link4options(array('creator', 'limit5')), | |
163 | + 'shop' => $this->get_link4options(array('shop', 'limit5')), | |
180 | 164 | )); |
165 | + | |
166 | + // ring | |
167 | + // thans | |
168 | + $this->set('ring', $this->get_link4options(array('ring', 'unlimited'))); | |
169 | + $this->set('thanks', $this->get_link4options(array('thanks', 'unlimited'))); | |
181 | 170 | } |
182 | 171 | |
183 | 172 | function _listview() { |
@@ -472,5 +461,12 @@ class LinksController extends AppController { | ||
472 | 461 | } |
473 | 462 | } |
474 | 463 | |
464 | + /* optionsを指定してLink取得 */ | |
465 | + function get_link4options($options = array()) { | |
466 | + $links = $this->Link->find('all', array('options' => $options)); | |
467 | + | |
468 | + return $this->restore_html_link($links, true, false); | |
469 | + } | |
470 | + | |
475 | 471 | } |
476 | 472 |
@@ -206,6 +206,9 @@ class Link extends AppModel { | ||
206 | 206 | 'limit5' => array( |
207 | 207 | 'limit' => 5, |
208 | 208 | ), |
209 | + 'limit9' => array( | |
210 | + 'limit' => 9, | |
211 | + ), | |
209 | 212 | 'unlimited' => array( |
210 | 213 | 'limit' => null, |
211 | 214 | ), |
@@ -238,13 +241,6 @@ class Link extends AppModel { | ||
238 | 241 | 'Link.type' => $id, |
239 | 242 | ), |
240 | 243 | ), |
241 | - // merged | |
242 | - $type.'_new5' => array( | |
243 | - 'options' => array( | |
244 | - $type, | |
245 | - 'limit5', | |
246 | - ), | |
247 | - ), | |
248 | 244 | )); |
249 | 245 | } |
250 | 246 |
@@ -18,7 +18,7 @@ if (!isset($length)) { | ||
18 | 18 | } |
19 | 19 | |
20 | 20 | ?> |
21 | -<div class="SimpleBox" id="Link_index"> | |
21 | +<div class="SimpleBox<?php if (isset($class)): ?> <?php echo $class ?><?php endif ?>" id="Link_index"> | |
22 | 22 | <div class="innerBox smallInnerBox"> |
23 | 23 | <div class="box full"> |
24 | 24 |
@@ -62,38 +62,12 @@ $url = array( | ||
62 | 62 | $link['Link']['id'] |
63 | 63 | ); |
64 | 64 | |
65 | -if (!empty($link['Link']['title'])) { | |
66 | - $title = $this->Text->truncate($link['Link']['title'], $length, array( | |
67 | - 'html' => true, | |
68 | - )); | |
69 | -} else { | |
70 | - $title = __('No Title', true); | |
71 | -} | |
65 | +echo $this->element('link_box_td', array( | |
66 | + 'link' => $link, | |
67 | + 'url' => $url, | |
68 | + 'length' => $length, | |
69 | +)); | |
72 | 70 | ?> |
73 | -<td class="banner"> | |
74 | -<?php | |
75 | -if (!empty($link['Attachment'])) { | |
76 | - echo $this->element('link_banner', array( | |
77 | - 'attachment' => $link['Attachment'][0], | |
78 | - 'name' => $title, | |
79 | - 'options' => array( | |
80 | - 'url' => $url, | |
81 | - 'htmlAttributes' => array( | |
82 | - 'title' => $title, | |
83 | - ), | |
84 | - ) | |
85 | - )); | |
86 | -} | |
87 | -?></td> | |
88 | -<td class="linkInfo"> | |
89 | -<div class="linkTitle"><?php | |
90 | - //echo $link['Link']['not_found']; | |
91 | - echo $this->Html->link($title, $url, array( | |
92 | - 'target' => '_blank', | |
93 | - )); | |
94 | -?></div> | |
95 | -<div class="linkUrl linkUrlSmall"><?php echo $link['Link']['url']; ?></div> | |
96 | -</td> | |
97 | 71 | </tr> |
98 | 72 | <?php endforeach; ?> |
99 | 73 | </table> |
@@ -0,0 +1,50 @@ | ||
1 | +<?php | |
2 | +/* | |
3 | + * Link Plugin for TRPG Databank | |
4 | + * | |
5 | + * PHP version 5 | |
6 | + * | |
7 | + * @copyright Copyright 2010, Cake. (http://trpgtools-onweb.sourceforge.jp/) | |
8 | + * @category Element | |
9 | + * @package plugin for TRPG Data Bank | |
10 | + * @version beta | |
11 | + * @author Cake <cake_67@users.sourceforge.jp> | |
12 | + * @license http://www.opensource.org/licenses/mit-license.php The MIT License | |
13 | + * @link http://trpgtools-onweb.sourceforge.jp/ | |
14 | + */ | |
15 | + | |
16 | +if (!empty($link['Link']['title'])) { | |
17 | + $title = $this->Text->truncate($link['Link']['title'], $length, array( | |
18 | + 'html' => true, | |
19 | + )); | |
20 | +} else { | |
21 | + $title = __('No Title', true); | |
22 | +} | |
23 | +?> | |
24 | +<td class="banner"> | |
25 | +<?php | |
26 | +if (!empty($link['Attachment'])) { | |
27 | + echo $this->element('link_banner', array( | |
28 | + 'attachment' => $link['Attachment'][0], | |
29 | + 'name' => $title, | |
30 | + 'options' => array( | |
31 | + 'url' => $url, | |
32 | + 'htmlAttributes' => array( | |
33 | + 'title' => $title, | |
34 | + ), | |
35 | + ) | |
36 | + )); | |
37 | +} | |
38 | +?> | |
39 | +</td> | |
40 | +<td class="linkInfo"> | |
41 | +<?php if(!empty($link['Link'])): ?> | |
42 | +<div class="linkTitle"><?php | |
43 | + //echo $link['Link']['not_found']; | |
44 | + echo $this->Html->link($title, $url, array( | |
45 | + 'target' => '_blank', | |
46 | + )); | |
47 | +?></div> | |
48 | +<div class="linkUrl linkUrlSmall"><?php echo $link['Link']['url']; ?></div> | |
49 | +<?php endif; ?> | |
50 | +</td> |