-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaxonomy-pkt_channel.php
420 lines (389 loc) · 14.4 KB
/
taxonomy-pkt_channel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package kanso-general
*/
$pkt_obj = get_queried_object();
$pkt = get_fields( $pkt_obj );
$pkt['id'] = $pkt_obj->term_id;
$pkt['url'] = get_term_link( $pkt_obj );
$pkt['title'] = $pkt_obj->name;
$pkt['description'] = $pkt_obj->description;
$user_logged_in = is_user_logged_in();
$can_edit = false;
if ( current_user_can( 'edit_posts' ) ) {
acf_form_head();
wp_deregister_style( 'wp-admin' );
$can_edit = true;
}
/* 閲覧制限を取得 */
global $wcr_content;
$has_access = true;
if ( true === $pkt['restrict'] ) {
$has_access = $wcr_content->check_access( $pkt['restrict_product'] );
if ( is_super_admin() ) {
$has_access = true;
}
}
/*
* ユーザー固有のリンクを取得する。大元のテーマでモーダルdivを出力していることを前提にしています。
* toiee.jp では、ログインしていない場合、ナビ部分でモーダルdivを出力しています。
*/
if ( $user_logged_in ) {
$pcast_url = $pkt['url'] . 'feed/pcast/?wcrtoken=' . $wcr_content->get_user_wcrtoken();
$pcast_url_app = str_replace( array( 'https://', 'http://' ), 'podcast://', $pcast_url );
$button_href_app = 'href="' . $pcast_url_app . '"';
$button_href_feed = 'href="' . $pcast_url . '""';
} else {
$button_href_app = 'href="#" uk-toggle="target: #modal_login_form"';
$button_href_feed = $button_href_app;
}
$new_feed = get_field( 'new_feed', $pkt_obj );
/*
*
*/
get_header();
?>
<header class="pkt-header">
<div class="uk-section">
<div class="uk-container">
<?php if( $new_feed ): ?>
<div class="uk-alert uk-alert-warning" uk-alert>
<p>この教材は、新しい形式に移動しました。移動先は<a href="<?php echo $new_feed; ?>">こちら<br>
<?php echo $new_feed; ?></a></p>
</div>
<?php endif; ?>
<p class="uk-margin-remove-top uk-margin-remove-bottom pkt-tagline">ポケてら : 探求、発見、驚き、楽しさ</p>
</div>
</div>
</header>
<div class="pkt-overlap">
<div class="pkt-content uk-container uk-background-default">
<div class="uk-margin-top" uk-grid>
<div class="uk-width-auto"><img src="<?php echo esc_attr( $pkt['image'] ); ?>" width="150" height="150"></div>
<div class="uk-width-expand">
<h1 class="uk-h2 uk-margin-remove-bottom"><?php echo esc_html( $pkt['title'] ); ?></h1>
<p class="uk-text-muted uk-margin-remove-top"><?php echo esc_html( $pkt['subtitle'] ); ?></p>
<p>
<a <?php echo $button_href_app; ?> class="uk-button uk-button-default uk-box-shadow-small" style="text-transform:none;">Podcast登録</a>
<a <?php echo $button_href_feed; ?> class="uk-button uk-button-text" style="text-transform:none;" onclick="copyToClipboard()">フィードURL</a>
</p>
</div>
</div>
<div class="uk-margin">
<p class="uk-text-small uk-text-muted pkt-description"><?php echo esc_html( $pkt['description'] ); ?></span></p>
</div>
<ul class="uk-child-width-expand" uk-tab>
<li class="uk-active"><a href="#">教材</a></li>
<li class=""><a href="#"><span class="uk-visible@s">受講資料</span><span class="uk-hidden@s">資料</span></a></li>
<li class=""><a href="#"><span class="uk-visible@s">関連ナレッジ</span><span class="uk-hidden@s">関連</span></a></li>
<li class=""><a href="#"><span class="uk-visible@s">ファシリテーター</span><span class="uk-hidden@s">LFT</span></a></li>
</ul>
<ul class="uk-switcher uk-margin uk-margin-bottom">
<!-- ================= 教材 =================== -->
<li>
<?php
if ( $can_edit ) {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'pkt_episode',
'post_status' => 'draft',
'tax_input' => array( 'pkt_channel' => $pkt['id'] ),
),
'fields' => array( 'hoge' ),
'submit_value' => 'エピソードを追加(下書き保存)',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
);
?>
<button class="uk-button uk-button-default uk-margin-small-right uk-align-right" type="button" uk-toggle="target: #modal-post">投稿する</button>
<div id="modal-post" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<h2 class="uk-modal-title">教材を追加する</h2>
<?php acf_form( $setting ); ?>
</div>
</div>
<?php
}
$the_episode_player_plyr_ext = 'scrum_episode';
while ( have_posts() ) :
the_post();
require locate_template( 'template-parts/player.php' );
endwhile;
?>
</li>
<!-- ================= 受講者資料 =================== -->
<li>
<?php
$tmp_posts = get_posts(
array(
'post_type' => 'pkt_material',
'posts_per_page' => 20,
'meta_query' => array(
array(
'key' => 'pocketera',
'value' => $pkt['id'],
),
),
)
);
if ( count( $tmp_posts ) ) {
/* 最初のものだけ表示 */
$p = array_pop( $tmp_posts );
if ( $can_edit ) :
?>
<a href="<?php echo esc_url( admin_url( 'post.php?post=' . $p->ID . '&action=edit' ) ) ?>" class="uk-button uk-button-default uk-margin-small-right uk-align-right">編集する</a>
<?php
endif;
echo apply_filters( 'the_content', $p->post_content ); // the_content filter を通す
foreach ( $tmp_posts as $p ) {
echo $p->post_title; // TODO 過去のレジュメがあったら表示する
}
} else {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'pkt_material',
'post_status' => 'draft',
),
'fields' => array( 'hoge' ),
'submit_value' => '授業資料を下書き保存',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
'html_after_fields' => '<input type="hidden" name="acf[pocketera]" value="' . $pkt['id'] . '"/>',
);
acf_form( $setting );
}
?>
</li>
<!-- ================= 関連ナレッジ =================== -->
<li>
<?php
$tmp_posts = get_posts(
array(
'post_type' => 'toiee_knowledge',
'posts_per_page' => 20,
'orderby' => 'meta_value',
'meta_key' => 'like',
'meta_query' => array(
array(
'key' => 'pocketera',
'value' => serialize( (string)$pkt['id'] ),
'compare' => 'LIKE',
),
),
)
);
if ( count( $tmp_posts ) ) {
$attr = array(
'class' => 'uk-align-center uk-align-right@m uk-margin-remove-adjacent uk-width-medium',
);
foreach ( $tmp_posts as $p ) {
setup_postdata( $p );
?>
<div>
<?php echo get_the_post_thumbnail( $p->ID, 'medium', $attr ); ?>
<h3><?php echo $p->post_title; ?></h3>
<p><?php echo strip_tags( mb_substr( get_the_content(), 0, 200 ) );?></p>
<p class="uk-text-meta"><?php echo get_post_meta( $p->ID, 'like', true); ?> likes, update <?php the_modified_date(); ?>, created <?php the_date(); ?></p>
<p><a href="<?php echo get_permalink( $p->ID ); ?>">詳細を読む</a></p>
</div>
<hr style="clear:both">
<?php
}
wp_reset_postdata();
} else {
?>
<div uk-alert>
<p>関連ナレッジはありません。</p>
</div>
<?php
}
if ( $can_edit ) {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'toiee_knowledge',
'post_status' => 'draft',
),
'fields' => array( 'hoge' ),
'submit_value' => '関連ナレッジを作成(下書き保存)',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
'html_after_fields' => '<input type="hidden" name="acf[pocketera]" value="' . $pkt['id'] . '"/>',
);
echo '<div uk-alert class="uk-margin-medium-top"><h3>関連ナレッジを追加する</h3>';
acf_form( $setting );
echo '</div>';
}
?>
</li>
<!-- ================= レジュメ =================== -->
<li>
<ul class="uk-tab-bottom uk-flex-right" uk-tab>
<li class="uk-active"><a href="#">レジュメ</a></li>
<li><a href="#">LFTノート</a></li>
<li><a href="#">開催レポート</a></li>
</ul>
<ul class="uk-switcher uk-margin uk-margin-bottom">
<li>
<?php
$tmp_posts = get_posts(
array(
'post_type' => 'pkt_resume',
'posts_per_page' => 20,
'meta_query' => array(
array(
'key' => 'pocketera',
'value' => $pkt['id'],
),
),
)
);
if ( count( $tmp_posts ) ) {
/* 最初のものだけ表示 */
$p = array_pop( $tmp_posts );
echo apply_filters( 'the_content', $p->post_content ); // the_content filter を通す
toiee_get_edit_button( $p );
foreach ( $tmp_posts as $p ) {
echo $p->post_title; // TODO 過去のレジュメがあったら表示する
}
} else {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'pkt_resume',
'post_status' => 'draft',
),
'fields' => array( 'hoge' ),
'submit_value' => '授業資料を下書き保存',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
'html_after_fields' => '<input type="hidden" name="acf[pocketera]" value="' . $pkt['id'] . '"/>',
);
acf_form( $setting );
}
?>
</li>
<li>
<!-- ================= LFTノート =========== -->
<?php
$tmp_posts = get_posts(
array(
'post_type' => 'pkt_lftnote',
'posts_per_page' => 20,
'meta_query' => array(
array(
'key' => 'pocketera',
'value' => $pkt['id'],
),
),
)
);
if ( count( $tmp_posts ) ) {
/* 最初のものだけ表示 */
$p = array_pop( $tmp_posts );
if ( $can_edit ) {
toiee_get_edit_button( $p );
}
echo apply_filters( 'the_content', $p->post_content ); // the_content filter を通す
foreach ( $tmp_posts as $p ) {
echo $p->post_title; // TODO 過去のレジュメがあったら表示する
}
} else {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'pkt_lftnote',
'post_status' => 'draft',
),
'fields' => array( 'hoge' ),
'submit_value' => '授業資料を下書き保存',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
'html_after_fields' => '<input type="hidden" name="acf[pocketera]" value="' . $pkt['id'] . '"/>',
);
acf_form( $setting );
}
?>
</li>
<li>
<!-- ================= 開催報告 & フィードバック =================== -->
<?php
if ( $can_edit ) {
$setting = array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'pkt_report',
'post_status' => 'draft',
),
'fields' => array( 'hoge' ),
'submit_value' => '開催レポートを追加',
'return' => admin_url( '/post.php?post=%post_id%&action=edit' ),
'html_submit_button' => '<input type="submit" class="uk-button uk-button-secondary" value="%s" />',
'html_after_fields' => '<input type="hidden" name="acf[pocketera]" value="' . $pkt['id'] . '"/>',
'html_before_fields' => '<div class="uk-alert-primary" uk-alert><p>期待する結果、プロセス・姿勢、前提を記入し「必ず、公開」を行ってから、参加者にフィードバック用のURLを配布してください。</p></div>',
);
?>
<button class="uk-button uk-button-default uk-margin-small-right uk-align-right" type="button" uk-toggle="target: #modal-post-report">開催レポート、フィードバックフォームを作る</button>
<div id="modal-post-report" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<h2 class="uk-modal-title">開催レポート作成</h2>
<?php acf_form( $setting ); ?>
</div>
</div>
<?php
}
?>
<h2>開催レポート一覧</h2>
<?php
$tmp_posts = get_posts(
array(
'post_type' => 'pkt_report',
'posts_per_page' => 20,
'meta_query' => array(
array(
'key' => 'pocketera',
'value' => $pkt['id'],
),
),
)
);
if ( count( $tmp_posts ) ) {
?>
<ul class="uk-list uk-list-striped">
<?php
foreach ( $tmp_posts as $p ) {
$fnum = get_post_meta( $p->ID, 'feedback_num', true );
?>
<li><a href="<?php echo get_permalink( $p ); ?>"><?php echo get_the_date( '', $p->ID ) . ' ' . $p->post_title; ?> <span uk-icon="comments"></span> <?php echo $fnum; ?></a></li>
<?php
}
?>
</ul>
<?php
} else {
?>
<p>no item</p>
<?php
}
?>
</li>
</ul>
</li>
</ul>
</div>
</div>
<?php
get_sidebar();
get_footer();