{"id":186507,"date":"2016-01-18T14:52:34","date_gmt":"2016-01-18T05:52:34","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2016\/01\/18\/%e7%8b%ac%e8%87%aa%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%8b%e3%82%89%e5%87%ba%e5%8a%9b%e3%81%97%e3%81%9f%e3%83%87%e3%83%bc%e3%82%bf%e3%83%bc%e3%82%92%e3%82%bd%e3%83%bc%e3%83%88%e3%81%97%e4%bb%b6%e\/"},"modified":"2016-09-15T23:11:38","modified_gmt":"2016-09-15T14:11:38","slug":"%e7%8b%ac%e8%87%aa%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%8b%e3%82%89%e5%87%ba%e5%8a%9b%e3%81%97%e3%81%9f%e3%83%87%e3%83%bc%e3%82%bf%e3%83%bc%e3%82%92%e3%82%bd%e3%83%bc%e3%83%88%e3%81%97%e4%bb%b6","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/%e7%8b%ac%e8%87%aa%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%8b%e3%82%89%e5%87%ba%e5%8a%9b%e3%81%97%e3%81%9f%e3%83%87%e3%83%bc%e3%82%bf%e3%83%bc%e3%82%92%e3%82%bd%e3%83%bc%e3%83%88%e3%81%97%e4%bb%b6\/","title":{"rendered":"\u72ec\u81ea\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u51fa\u529b\u3057\u305f\u30c7\u30fc\u30bf\u30fc\u3092\u30bd\u30fc\u30c8\u3057\u4ef6\u6570\u3092\u5236\u5fa1"},"content":{"rendered":"<p>\u3044\u3064\u3082\u304a\u4e16\u8a71\u306b\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u72ec\u81ea\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u51fa\u529b\u3057\u305f\u5185\u5bb9\u3092\u5168\u3066\u53d6\u5f97\u3057\u30bd\u30fc\u30c8\u3057\u305f\u5185\u5bb9\u3092\u3001\u4ef6\u6570\u3067\u5236\u5fa1\u3057\u30661\u30da\u30fc\u30b8\u306b\u8868\u793a\u3059\u308b\u4ef6\u6570\u3092\u6307\u5b9a\u3057\u305f\u3044\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u969b\u306b\u30da\u30fc\u30b8\u30e3\u30fc\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u306e\u3067\u3059\u304c\u3001\u4ef6\u6570\u6307\u5b9a\u306e\u3084\u308a\u65b9\u304c\u8272\u3005\u3084\u3063\u305f\u306e\u3067\u3059\u304c\u5206\u304b\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u73fe\u5728\u306e\u30b3\u30fc\u30c9\u306f<\/p>\n<pre><code>function outschedule($day) {  \/\/DB\u304b\u3089\u8a72\u5f53\u306e\u65e5\u4ed8\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\n    global $wpdb;\n    $table_name = $wpdb-&gt;prefix . &#039;krc_schedules&#039;;\n    $schedules = $wpdb-&gt;get_var(\n        $wpdb-&gt;prepare(&quot;SELECT work FROM $table_name WHERE day = %s AND status = %d&quot;, $day, 0)\n    );\n    $works = unserialize($schedules);\n    return  $works;  \/\/\u914d\u5217\u306b\u3057\u3066\u8fd4\u3059\n}\n\nfunction schedulesHtml() {  \/\/\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u306e\u4e2d\u8eab\n    $day = isset($_GET[&quot;works&quot;]) ? $_GET[&#039;works&#039;] : date_i18n(&quot;Y-m-d&quot;);\n    $works = outschedule($day);\n    $len = 6; \/\/+1\n\n    $week = array(&quot;\u65e5&quot;, &quot;\u6708&quot;, &quot;\u706b&quot;, &quot;\u6c34&quot;, &quot;\u6728&quot;, &quot;\u91d1&quot;, &quot;\u571f&quot;);\n    $w = date(&#039;w&#039;, strtotime($day));\n\n    ob_start();\n    echo &#039;&lt;nav class=&quot;attendance-calendar clearfix&quot;&gt;&lt;ul&gt;&#039;;\n    for ($i = 0; $i &lt;= $len; $i++) {\n        $y = date(&#039;D&#039;, strtotime(&#039;+&#039;.$i.&#039; day&#039;));\n        if ( date_i18n(&#039;Y-m-d&#039;, strtotime(&#039;+&#039;.$i.&#039; day&#039;)) == $day ) $y = &#039;target&#039;;\n        echo &#039;&lt;li class=&quot;&#039; . mb_strtolower($y) . &#039;&quot;&gt;&lt;a href=&quot;&#039; .  home_url( &#039;\/&#039; )  . &#039;\/girl-attendance\/?works=&#039; . date_i18n(&#039;Y-m-d&#039;, strtotime(&#039;+&#039;.$i.&#039; day&#039;)) . &#039;&quot;&gt;&#039; . strtoupper(date(&#039;n\/j(D)&#039;, strtotime(&#039;+&#039;.$i.&#039; day&#039;))) . &#039;&lt;\/a&gt;&lt;\/li&gt;&#039;;\n    }\n    echo &#039;&lt;\/ul&gt;&lt;\/nav&gt;&#039;;\n\n    if (!$works) {\n        \/\/\u4e88\u5b9a\u304c\u306a\u3044\u5834\u5408\n        echo &#039;&lt;p class=&quot;attendance-message&quot;&gt;&#039; . date(&#039;n\/j&#039;, strtotime($day));\n        echo &#039;(&#039; . $week[$w] . &#039;)&#039;;\n        echo &#039;\u306e\u51fa\u52e4\u4e88\u5b9a\u306f\u3054\u3056\u3044\u307e\u305b\u3093\u3002&lt;\/p&gt;&#039;;\n    } else if ( $works !=&#039;rest&#039; ) {\n        echo &#039;&lt;div class=&quot;clearfix&quot;&gt;&#039;;\n        \/\/postid\u9806\u306b\u914d\u5217\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u3067s_order\u9806\u306b\u3057\u305f\u914d\u5217\u3092\u4f5c\u308b\n        $works_array = array();\n        foreach($works as $id =&gt; $val){\n            $works_array[$val[&quot;s_order&quot;]] = $id;\n        }\n        ksort($works_array);\n        foreach ($works_array as $rder =&gt; $id){\n            $paged = ( get_query_var(&#039;page&#039;) ) ? get_query_var(&#039;page&#039;) : 1;\n            $args=array(\n                &#039;post_type&#039; =&gt; &#039;krc_cast&#039;,\n                &#039;post__in&#039; =&gt; array($id),\n                &#039;posts_per_page&#039; =&gt; 6, \/\/\u53d6\u5f97\u8a18\u4e8b\u4ef6\u6570\n                &#039;paged&#039; =&gt; $paged\n            );\n            $wp_query = new WP_Query($args);\n            while ($wp_query-&gt;have_posts()): $wp_query-&gt;the_post(); $counter++;\n            if ($counter &lt;= 1){\n                require(get_template_directory() . &quot;\/content-cast-first.php&quot;);\n            }else{\n                require(get_template_directory() . &quot;\/content-cast.php&quot;);\n            }endwhile;\n            \/\/wp_reset_query();\n        }\n        echo &#039;&lt;\/div&gt;&#039;;\n        echo &#039;&lt;div class=&quot;pagination&quot;&gt;&#039;;\n        \/\/ \u30da\u30fc\u30b8\u30f3\u30b0\u3092\u8868\u793a\n        if (function_exists(&#039;wp_pagenavi&#039;)) { wp_pagenavi(); }\n        \/\/ \u30eb\u30fc\u30d7\u51e6\u7406\u306e\u30c7\u30fc\u30bf\u3092\u30ea\u30bb\u30c3\u30c8\n        wp_reset_query();\n        echo &#039;&lt;\/div&gt;&#039;;\n    } else {\n        \/\/\u4f11\u307f\n        echo &#039;&lt;p class=&quot;attendance-message&quot;&gt;\u7533\u3057\u8a33\u3042\u308a\u307e\u305b\u3093\u3002&#039; . date(&#039;n\/j&#039;, strtotime($day));\n        echo &#039;(&#039; . $week[$w] . &#039;)&#039;;\n        echo &#039;\u306e\u51fa\u52e4\u4e88\u5b9a\u8005\u306f\u304a\u308a\u307e\u305b\u3093\u3002&lt;\/P&gt;&#039;;\n    }\n    return ob_get_clean();\n}\nadd_shortcode(&#039;scheduleshtml&#039;, &#039;schedulesHtml&#039;);<\/code><\/pre>\n<p>\u4eca\u306f\u5c02\u7528\u306e\u56fa\u5b9a\u30da\u30fc\u30b8\u306b\u3066\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3067\u8868\u793a\u3055\u305b\u3066\u3044\u307e\u3059\u3002<br \/>\n\u56fa\u5b9a\u30da\u30fc\u30b8\u306b\u30666\u4ef6\u8868\u793a\u3055\u305b\u3066\u30016\u4ef6\u4ee5\u4e0a\u306a\u3089\u30da\u30fc\u30b8\u30e3\u30fc\u3092\u8868\u793a\u3002<br \/>\n\u30da\u30fc\u30b8\u30e3\u30fc\u306fWP-PageNavi\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u51fa\u529b\u3055\u308c\u305f\u30c7\u30fc\u30bf\u30fc\u3092HOME\u306b\u30663\u4ef6\u306e\u307f\u8868\u793a\u3055\u305b\u305f\u3044\u306e\u3067\u3001\u5168\u3066\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3092\u5236\u5fa1\u3057\u305f\u3044\u3067\u3059\u3002<br \/>\n\u30bd\u30fc\u30c8\u306e\u4ed5\u65b9\u3084\u51fa\u529b\u306e\u4ed5\u65b9\u304c\u3042\u307e\u308a\u7406\u89e3\u3057\u304d\u308c\u3066\u3044\u306a\u304f\u3001\u884c\u304d\u8a70\u307e\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3054\u6559\u6388\u304a\u9858\u3044\u81f4\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-186507","topic","type-topic","status-closed","hentry","topic-tag-14122","topic-tag-18451","topic-tag-db","topic-tag-16825"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/186507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/186507\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=186507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}