{"action":"created","comment":{"url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/comments/91347969","pull_request_review_id":11857195,"id":91347969,"diff_hunk":"@@ -2,56 +2,146 @@\n   <h2 class = \"topcap\">\n     直近のイベント\n   </h2>\n-  <!-- event.htmlの直近のイベントと共通部ここから -->\n+  <!-- 直近のイベント機能ここから -->\n   <div class = \"latestEvent\">\n     <div class = \"flexslider\">\n       <ul class = \"slides\">\n-        <li>\n-          <a href = \"event.html#6\">\n-            <div class = \"latestBox_future\">\n-              <div class = \"remaindays_future\">\n-                <div class = \"caption\">\n-                  <script>countdown(20161029,20161030)</script>\n-                </div>\n-              </div>\n-              <!-- <div class = \"latestBox_img\"> -->\n-                <img src=\"<?php echo get_template_directory_uri(); ?>/images/event6_FCH.jpg\" alt=\"イベント6\">\n-              <!-- </div> -->\n-              <div class = \"eventText\">\n-                <p class = \"eventsch caption FCHcolor\">\n-                  10/29(土) 30(日)\n-                </p>\n-                <p class = \"eventtitle\">FabLab ワークショップ</p>\n-                <p class = \"eventplace caption\">\n-                  みらい館\n-                </p>\n+      <?php\n+        $args = array(//eventを抜き出す\n+        'post_type' => 'event',\n+        );\n+        $post_list = array();\n+        $post_list = get_posts( $args );\n+        $dates = array();\n+        $today = date('Ymd');//今日の日付を8桁に\n+        $i = 0;\n+        //直近の日程を算出\n+        foreach ( $post_list as $post ) : setup_postdata( $post );//全てのpostに対して\n+          if(get_field(\"day_and_time\")) :\n+            while(the_repeater_field('day_and_time')) :\n+              if(!isset($nextdate)){\n+                $nextdate = get_sub_field('date');\n+              }else if($nextdate - get_sub_field('date') > 0 && $nextdate - $today >= 0){//入っている数値より先で、かつまだ過ぎていないなら入れ替え\n+                $nextdate = get_sub_field('date');\n+              }\n+            endwhile;\n+            //もしそのイベントが終わっていたらdatesには0を代入\n+            if($nextdate - $today < 0){\n+              $nextdate = 0;\n+            }\n+            $dates[$i] = $nextdate;\n+            unset($nextdate);\n+          endif;\n+          $i++;\n+        endforeach;\n+        /*\n+        $postlistにはソートされたイベント情報が、\n+        $datesにはそれに対応したイベントの直近の日程が入っている\n+         */\n+        //過ぎたイベントを省く\n+        /*\n+        過ぎたイベントに対応する$datesには0が代入されているため、\n+        そうであるものの$datesとそれに対応する$post_listをarray_spliceを用いて削除する\n+         */\n+        $i = 0;\n+        foreach ($dates as $date) {\n+           if($date == 0){\n+            array_splice($dates, $i, 1);\n+            array_splice($post_list, $i, 1);\n+           }\n+           $i++;\n+        }\n+        //イベント情報のソート\n+        array_multisort($dates,$post_list);\n+        // print_r($post_list);\n+        //出力\n+        $i = 0;\n+        foreach ( $post_list as $post ) : setup_postdata( $post );\n+        if(get_field('place') == 'fch'){\n+          $place = \"future\";\n+        }else if(get_field('place') == 'kph'){\n+          $place = \"kids\";\n+        }else{\n+          $place = \"other\";\n+        }\n+      ?>\n+      <li>\n+        <a href = \"event.html#<?php the_id(); ?>\">\n+          <div class = \"latestBox_<?php echo $place; ?>\">\n+            <div class = \"remaindays_<?php echo $place; ?>\">\n+              <div class = \"caption\">\n+                <script>countdown(<?php\n+                  $i = 0;\n+                  while(the_repeater_field('day_and_time')) :\n+                    if($i != 0){\n+                      echo \",\";\n+                    }\n+                    the_sub_field('date');\n+                    $i++;\n+                  endwhile;?>)</script>\n               </div>\n             </div>\n-          </a>\n-        </li>\n-        <li>\n-          <a href = \"event.html#7\">\n-            <div class = \"latestBox_future\">\n-              <div class = \"remaindays_future\">\n-                <div class = \"caption\">\n-                  <script>countdown(20161029,20161030)</script>\n-                </div>\n-              </div>\n-              <!-- <div class = \"latestBox_img\"> -->\n-                <img src=\"<?php echo get_template_directory_uri(); ?>/images/event7_FCH.jpg\" alt=\"イベント7\">\n-              <!-- </div> -->\n-              <div class = \"eventText\">\n-                <p class = \"eventsch caption FCHcolor\">\n-                  10/29(土) 30(日)\n-                </p>\n-                <p class = \"eventtitle\">せかいをはかるワークショップ</p>\n-                <p class = \"eventplace caption\">\n-                  みらい館\n-                </p>\n-              </div>\n+            <!-- <div class = \"latestBox_img\"> -->\n+              <img src=\"<?php the_field('image'); ?>\" alt=\"<?php the_title(); ?>\">\n+            <!-- </div> -->\n+            <div class = \"eventText\">\n+              <p class = \"eventsch caption <?php\n+                  if(get_field('place') == 'fch'){\n+                    echo \"FCH\";\n+                  }else if(get_field('place') == 'kph'){\n+                    echo \"KPH\";\n+                  }else{\n+                    echo \"OTHER\";\n+                  }\n+                ?>color\">\n+                <?php\n+                  $i = 0;\n+                  $chk_date = 0;\n+                  $weekday = array( \"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\" );\n+                  while(the_repeater_field('day_and_time')) :\n+                    if($i == 0){\n+                      $chk_date = get_sub_field('date');\n+                      echo date('m月d日',strtotime(get_sub_field('date')));\n+                      echo \"(\".$weekday[date(\"w\",strtotime(get_sub_field('date')))].\")\";","path":"header-upcommingEvent.php","position":146,"original_position":146,"commit_id":"1f561e9fdce71171ff08fdcf65e1854d84819227","original_commit_id":"1f561e9fdce71171ff08fdcf65e1854d84819227","user":{"login":"sKawashima","id":9900753,"avatar_url":"https://avatars.githubusercontent.com/u/9900753?v=3","gravatar_id":"","url":"https://api.github.com/users/sKawashima","html_url":"https://github.com/sKawashima","followers_url":"https://api.github.com/users/sKawashima/followers","following_url":"https://api.github.com/users/sKawashima/following{/other_user}","gists_url":"https://api.github.com/users/sKawashima/gists{/gist_id}","starred_url":"https://api.github.com/users/sKawashima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sKawashima/subscriptions","organizations_url":"https://api.github.com/users/sKawashima/orgs","repos_url":"https://api.github.com/users/sKawashima/repos","events_url":"https://api.github.com/users/sKawashima/events{/privacy}","received_events_url":"https://api.github.com/users/sKawashima/received_events","type":"User","site_admin":false},"body":"__[code_sniffer]__\n* Line indented incorrectly; expected at least 24 spaces, found 22\n* No space found after comma in function call\n\n<!-- Comment by [SideCI](https://sideci.com) -->","created_at":"2016-12-07T17:51:42Z","updated_at":"2016-12-07T17:51:42Z","html_url":"https://github.com/YngLab/Msite_wp_theme/pull/21#discussion_r91347969","pull_request_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/comments/91347969"},"html":{"href":"https://github.com/YngLab/Msite_wp_theme/pull/21#discussion_r91347969"},"pull_request":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21","id":96973884,"html_url":"https://github.com/YngLab/Msite_wp_theme/pull/21","diff_url":"https://github.com/YngLab/Msite_wp_theme/pull/21.diff","patch_url":"https://github.com/YngLab/Msite_wp_theme/pull/21.patch","issue_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/21","number":21,"state":"closed","locked":false,"title":"#19 直近のイベント実装","user":{"login":"sKawashima","id":9900753,"avatar_url":"https://avatars.githubusercontent.com/u/9900753?v=3","gravatar_id":"","url":"https://api.github.com/users/sKawashima","html_url":"https://github.com/sKawashima","followers_url":"https://api.github.com/users/sKawashima/followers","following_url":"https://api.github.com/users/sKawashima/following{/other_user}","gists_url":"https://api.github.com/users/sKawashima/gists{/gist_id}","starred_url":"https://api.github.com/users/sKawashima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sKawashima/subscriptions","organizations_url":"https://api.github.com/users/sKawashima/orgs","repos_url":"https://api.github.com/users/sKawashima/repos","events_url":"https://api.github.com/users/sKawashima/events{/privacy}","received_events_url":"https://api.github.com/users/sKawashima/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-07T17:49:38Z","updated_at":"2016-12-07T17:51:43Z","closed_at":"2016-12-07T17:51:25Z","merged_at":"2016-12-07T17:51:25Z","merge_commit_sha":"c9881a1d0927b1875a9aef704c8f33abf2d90ac3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21/commits","review_comments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21/comments","review_comment_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/21/comments","statuses_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/statuses/1f561e9fdce71171ff08fdcf65e1854d84819227","head":{"label":"YngLab:#19-直近のイベント実装","ref":"#19-直近のイベント実装","sha":"1f561e9fdce71171ff08fdcf65e1854d84819227","user":{"login":"YngLab","id":19465040,"avatar_url":"https://avatars.githubusercontent.com/u/19465040?v=3","gravatar_id":"","url":"https://api.github.com/users/YngLab","html_url":"https://github.com/YngLab","followers_url":"https://api.github.com/users/YngLab/followers","following_url":"https://api.github.com/users/YngLab/following{/other_user}","gists_url":"https://api.github.com/users/YngLab/gists{/gist_id}","starred_url":"https://api.github.com/users/YngLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YngLab/subscriptions","organizations_url":"https://api.github.com/users/YngLab/orgs","repos_url":"https://api.github.com/users/YngLab/repos","events_url":"https://api.github.com/users/YngLab/events{/privacy}","received_events_url":"https://api.github.com/users/YngLab/received_events","type":"Organization","site_admin":false},"repo":{"id":71572982,"name":"Msite_wp_theme","full_name":"YngLab/Msite_wp_theme","owner":{"login":"YngLab","id":19465040,"avatar_url":"https://avatars.githubusercontent.com/u/19465040?v=3","gravatar_id":"","url":"https://api.github.com/users/YngLab","html_url":"https://github.com/YngLab","followers_url":"https://api.github.com/users/YngLab/followers","following_url":"https://api.github.com/users/YngLab/following{/other_user}","gists_url":"https://api.github.com/users/YngLab/gists{/gist_id}","starred_url":"https://api.github.com/users/YngLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YngLab/subscriptions","organizations_url":"https://api.github.com/users/YngLab/orgs","repos_url":"https://api.github.com/users/YngLab/repos","events_url":"https://api.github.com/users/YngLab/events{/privacy}","received_events_url":"https://api.github.com/users/YngLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/YngLab/Msite_wp_theme","description":"10/21Create, 納品目標11/4-11","fork":false,"url":"https://api.github.com/repos/YngLab/Msite_wp_theme","forks_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/forks","keys_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/teams","hooks_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/hooks","issue_events_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/events{/number}","events_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/events","assignees_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/assignees{/user}","branches_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/branches{/branch}","tags_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/tags","blobs_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/refs{/sha}","trees_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/statuses/{sha}","languages_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/languages","stargazers_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/stargazers","contributors_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/contributors","subscribers_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/subscribers","subscription_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/subscription","commits_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/commits{/sha}","git_commits_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/commits{/sha}","comments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/comments{/number}","issue_comment_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/comments{/number}","contents_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/contents/{+path}","compare_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/merges","archive_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/downloads","issues_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues{/number}","pulls_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls{/number}","milestones_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/milestones{/number}","notifications_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/labels{/name}","releases_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/releases{/id}","deployments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/deployments","created_at":"2016-10-21T14:35:47Z","updated_at":"2016-11-05T08:07:58Z","pushed_at":"2016-12-07T17:51:25Z","git_url":"git://github.com/YngLab/Msite_wp_theme.git","ssh_url":"git@github.com:YngLab/Msite_wp_theme.git","clone_url":"https://github.com/YngLab/Msite_wp_theme.git","svn_url":"https://github.com/YngLab/Msite_wp_theme","homepage":null,"size":108871,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"YngLab:master","ref":"master","sha":"ce93f2bcf3e5318ca36c829fad5af107f7e4330c","user":{"login":"YngLab","id":19465040,"avatar_url":"https://avatars.githubusercontent.com/u/19465040?v=3","gravatar_id":"","url":"https://api.github.com/users/YngLab","html_url":"https://github.com/YngLab","followers_url":"https://api.github.com/users/YngLab/followers","following_url":"https://api.github.com/users/YngLab/following{/other_user}","gists_url":"https://api.github.com/users/YngLab/gists{/gist_id}","starred_url":"https://api.github.com/users/YngLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YngLab/subscriptions","organizations_url":"https://api.github.com/users/YngLab/orgs","repos_url":"https://api.github.com/users/YngLab/repos","events_url":"https://api.github.com/users/YngLab/events{/privacy}","received_events_url":"https://api.github.com/users/YngLab/received_events","type":"Organization","site_admin":false},"repo":{"id":71572982,"name":"Msite_wp_theme","full_name":"YngLab/Msite_wp_theme","owner":{"login":"YngLab","id":19465040,"avatar_url":"https://avatars.githubusercontent.com/u/19465040?v=3","gravatar_id":"","url":"https://api.github.com/users/YngLab","html_url":"https://github.com/YngLab","followers_url":"https://api.github.com/users/YngLab/followers","following_url":"https://api.github.com/users/YngLab/following{/other_user}","gists_url":"https://api.github.com/users/YngLab/gists{/gist_id}","starred_url":"https://api.github.com/users/YngLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YngLab/subscriptions","organizations_url":"https://api.github.com/users/YngLab/orgs","repos_url":"https://api.github.com/users/YngLab/repos","events_url":"https://api.github.com/users/YngLab/events{/privacy}","received_events_url":"https://api.github.com/users/YngLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/YngLab/Msite_wp_theme","description":"10/21Create, 納品目標11/4-11","fork":false,"url":"https://api.github.com/repos/YngLab/Msite_wp_theme","forks_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/forks","keys_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/teams","hooks_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/hooks","issue_events_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/events{/number}","events_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/events","assignees_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/assignees{/user}","branches_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/branches{/branch}","tags_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/tags","blobs_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/refs{/sha}","trees_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/statuses/{sha}","languages_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/languages","stargazers_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/stargazers","contributors_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/contributors","subscribers_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/subscribers","subscription_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/subscription","commits_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/commits{/sha}","git_commits_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/git/commits{/sha}","comments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/comments{/number}","issue_comment_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/comments{/number}","contents_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/contents/{+path}","compare_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/merges","archive_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/downloads","issues_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues{/number}","pulls_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls{/number}","milestones_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/milestones{/number}","notifications_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/labels{/name}","releases_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/releases{/id}","deployments_url":"https://api.github.com/repos/YngLab/Msite_wp_theme/deployments","created_at":"2016-10-21T14:35:47Z","updated_at":"2016-11-05T08:07:58Z","pushed_at":"2016-12-07T17:51:25Z","git_url":"git://github.com/YngLab/Msite_wp_theme.git","ssh_url":"git@github.com:YngLab/Msite_wp_theme.git","clone_url":"https://github.com/YngLab/Msite_wp_theme.git","svn_url":"https://github.com/YngLab/Msite_wp_theme","homepage":null,"size":108871,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21"},"html":{"href":"https://github.com/YngLab/Msite_wp_theme/pull/21"},"issue":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/21"},"comments":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/YngLab/Msite_wp_theme/statuses/1f561e9fdce71171ff08fdcf65e1854d84819227"}}}}
{"actor":{"display_login":"sKawashima"}}