diff --git a/irakli_kandelaki/challenge_two/challenge-two.php b/irakli_kandelaki/challenge_two/challenge-two.php new file mode 100644 index 0000000..45bddf4 --- /dev/null +++ b/irakli_kandelaki/challenge_two/challenge-two.php @@ -0,0 +1,62 @@ + + + + + + + + + + + + Challenge N2 + + +
+ +
+ + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + +

You must check at least one of the boxes

+ + + + + +

+ + +
+
+ + \ No newline at end of file diff --git a/irakli_kandelaki/challenge_two/getFollowers.php b/irakli_kandelaki/challenge_two/getFollowers.php new file mode 100644 index 0000000..83276f4 --- /dev/null +++ b/irakli_kandelaki/challenge_two/getFollowers.php @@ -0,0 +1,21 @@ + true, + CURLOPT_HTTPHEADER => [ + 'User-Agent: PHP', + 'Content-Type: application/json'], + ]); + $result_followers = json_decode(curl_exec($resource2)); + $followers_nested[] = $result_followers; +} + +$followers = unnest_array($followers_nested); + +if ($followers !== ['']) { + $haveDataFollowers = true; +}; +?> \ No newline at end of file diff --git a/irakli_kandelaki/challenge_two/getRepos.php b/irakli_kandelaki/challenge_two/getRepos.php new file mode 100644 index 0000000..c56e180 --- /dev/null +++ b/irakli_kandelaki/challenge_two/getRepos.php @@ -0,0 +1,27 @@ + true, + CURLOPT_HTTPHEADER => [ + 'User-Agent: PHP', + 'Content-Type: application/json'], + ]); + $result = json_decode(curl_exec($resource_user)); + $repos_nested[] = $result; + curl_close($resource_user); +} + +$repos = unnest_array($repos_nested); + +// If the user does not exist, save error message +if (!$resource_user) { + $errors[] = "Github user not found"; +} else { + $haveData = true; +} +?> \ No newline at end of file diff --git a/irakli_kandelaki/challenge_two/getdata.php b/irakli_kandelaki/challenge_two/getdata.php new file mode 100644 index 0000000..49da29f --- /dev/null +++ b/irakli_kandelaki/challenge_two/getdata.php @@ -0,0 +1,55 @@ + true, + CURLOPT_HTTPHEADER => [ + 'User-Agent: PHP', + 'Content-Type: application/json'], + ]); + $result = json_decode(curl_exec($resource), true); + curl_close($resource); + return $result; +} + +// calculate number of pages that we have to fetch +function calculate_pages($info) { + return ceil($info / 100); +} + +// unnest the given array +function unnest_array($arr) { + $unnested = []; + // Unnesting the array + for ($i = 0; $i < count($arr); $i++) { + for ($j = 0; $j < count($arr[$i]); $j++) { + $unnested[] = $arr[$i][$j]; + } + } + return $unnested; +} + +if ($_POST["username"]) { + $username = $_POST["username"]; + + // Get data about the number of repos and followers the user has + $data = get_followers_and_repos("https://api.github.com/users/", $username); + // Calculate how many pages of followers and repos there are + // to find out how many times we have to call github api + $number_of_pages_followers = calculate_pages($data["followers"]); + $number_of_pages_repos = calculate_pages($data["public_repos"]); + + // Get data about the User's repositories and put them into the array + require 'getRepos.php'; + + // Get data about the user's followers + require 'getFollowers.php'; +} + +?> diff --git a/irakli_kandelaki/challenge_two/renderFollowers.php b/irakli_kandelaki/challenge_two/renderFollowers.php new file mode 100644 index 0000000..6c5859d --- /dev/null +++ b/irakli_kandelaki/challenge_two/renderFollowers.php @@ -0,0 +1,18 @@ + +
+

's followers

+ +
\ No newline at end of file diff --git a/irakli_kandelaki/challenge_two/renderForm.php b/irakli_kandelaki/challenge_two/renderForm.php new file mode 100644 index 0000000..ea90673 --- /dev/null +++ b/irakli_kandelaki/challenge_two/renderForm.php @@ -0,0 +1,15 @@ + +
+

Input your git Username to see magic!

+ +

What do you want to see?

+
+ + +
+
+ + +
+ +
diff --git a/irakli_kandelaki/challenge_two/renderRepos.php b/irakli_kandelaki/challenge_two/renderRepos.php new file mode 100644 index 0000000..aea2700 --- /dev/null +++ b/irakli_kandelaki/challenge_two/renderRepos.php @@ -0,0 +1,15 @@ + +
+

's repositories

+
    + $repo): ?> +
  1. + ) + + name ?> + + Go to repo +
  2. + +
+
diff --git a/irakli_kandelaki/check_data.php b/irakli_kandelaki/check_data.php new file mode 100644 index 0000000..15f1a21 --- /dev/null +++ b/irakli_kandelaki/check_data.php @@ -0,0 +1,48 @@ + 500000) { + $errors[] = "Sorry, the file is too large"; + } + + // If there were no errors, save the image + if (!$errors) { + move_uploaded_file($_FILES["image"]["tmp_name"], $target_file); + } + } +} +?> \ No newline at end of file diff --git a/irakli_kandelaki/images/question-mark.png b/irakli_kandelaki/images/question-mark.png new file mode 100644 index 0000000..3244df0 Binary files /dev/null and b/irakli_kandelaki/images/question-mark.png differ diff --git a/irakli_kandelaki/index.php b/irakli_kandelaki/index.php new file mode 100644 index 0000000..69396d4 --- /dev/null +++ b/irakli_kandelaki/index.php @@ -0,0 +1,69 @@ + + + + + + + + + + + + Challenge N1 + + +
+ +
+
+
+ + +
+ +
+ + +
+ +
+ + +

Who are you?

+ +
+
+
+ + + + +

+ + + + +
+

Hello

+ class="uploaded-image"> +
+ + + + +
+
+
+ + \ No newline at end of file diff --git a/irakli_kandelaki/style/style.css b/irakli_kandelaki/style/style.css new file mode 100644 index 0000000..4dccebd --- /dev/null +++ b/irakli_kandelaki/style/style.css @@ -0,0 +1,390 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + height: 100vh; + color: #fff; + font-family: 'Roboto', sans-serif; +} + +.index-container { + height: 100%; + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 50px 1fr; + row-gap: 20px; +} + +.navigation { + width: 1000px; + margin: 0 auto; + padding: 10px 20px; + border-radius: 8px; + color:#212529; + + grid-column: 1 / -1; + grid-row: 1 / 2; + + display: flex; + align-items: center; + justify-content: space-between; + gap: 30px; +} + +.navigation:hover { + box-shadow: 0 0 8px rgba(4,4,4,0.3); + transition: box-shadow 0.15s; +} + +.navigation a:link, +.navigation a:visited { + padding: 8px 16px; + border-radius: 16px; + color: #000; + text-decoration: none; +} + +.navigation a:hover { + background-color: #1864ab; + color: #fff; + transition: all 0.4s; +} + +/* Styling main section */ +.main-section { + grid-row: 2 / 3; + grid-column: 1 / 2; + background-color: #000; + + display: flex; + justify-content: center; + align-items: center; +} + +.link-to-input { + color:#212529; + text-decoration: none; + padding: 8px 16px; + border-radius: 16px; +} + +.link-to-input:hover { + color: #fff; + background-color: #212529; + transition: all 0.3s; + cursor: pointer; +} + +.form-upload { + color: #fff; + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 36px; +} + +.form { + display: flex; + flex-direction: column; + gap: 6px; +} + +.form--image { + display: flex; + justify-content: center; + align-items: center; + gap: 6px; +} + +.label-button { + padding: 8px 16px; + background-color: #fff; + color:#212529; + border-radius: 100px; + cursor: pointer; +} + +.label-button-two { + padding: 8px 16px; + background-color: #212529; + color:#fff; + border-radius: 100px; + cursor: pointer; +} + +.label-button:hover { + background-color: #212529; + color: #fff; + transition: all 0.3s; +} + +.label-button-two:hover { + background-color: #000; + transition: all 0.3s; +} +.hidden { + display: none; +} + +.input { + padding: 6px; + border-radius: 100px; + border: 2px solid #000; +} + +.input:focus { + outline: solid #212529 2px; +} + +.main-title { + font-size: 46px; + background-image: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,1) + 50%, rgba(4,4,4,1) 50%, rgba(4,4,4,1) 100%); + background-clip: text; + -webkit-text-fill-color: transparent; + + position: absolute; + top: 25%; + left: 50%; + transform: translate(-50%, 0); +} + +button { + border: none; +} + +/* Styling upload section */ +.upload-section { + color: #212529; + grid-row: 2 / 3; + grid-column: 2 / 3; + + display:flex; + justify-content: center; + align-items: center; + position: relative; +} + +.image { + width: 240px; + height: 480px; +} + +.about-user { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 26px; + width: 100%; + height: 100%; +} + +.hello-message { + font-size: 42px; + + display: flex; + justify-content: center; + align-items: center; +} + +.upload-successful { + background-color: #fff; + color: #212529; + border-top-left-radius: 8px; +} + +.uploaded-image { + width: 300px; + border-radius: 16px; + box-shadow: 0px 0px 8px rgba(4,4,4,0.4); +} + + +/* Styling CHALLENGE TWO */ + +.challenge_two-container { + height: 100vh; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: center; + gap: 20px; +} + +.main-section-git { + width: 100%; + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.form-get { + color: #000; + margin: 5% 0; + + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 20px; +} + +.git-container { + min-height: 100vh; + width: 100%; + + display: flex; + justify-content: flex-start; + align-items: flex-start; +} + +.section-results { + width: 50%; + padding: 50px; + + display: flex; + flex-direction: column; + justify-content: flex-start; + gap: 50px; +} + +.repo-link:link, +.repo-link:active { + text-decoration: none; + color: #adb5bd; +} + +.repo-link:visited { + color: #adb5bd; +} + +.repo-link:hover { + color:#1864ab; +} + +.repo-name-link:link, +.repo-name-link:active, +.repo-name-link:visited { + text-decoration: none; + color:#fff; +} + +.repo-name-link:hover { + cursor: default; +} + +.repo-title { + cursor: pointer; +} + +.list-item { + display: grid; + grid-template-columns: 10px 1fr auto; + gap: 50px; + margin-bottom: 12px; +} + +.only-followers { + width: 600px; + padding: 50px; + text-align: center; + background-color: #adb5bd; +} + +.only-followers .follower-section:first-child { + width: 100%; +} + +.only-followers h2 { + margin-bottom: 24px; +} + +/* Styling the followers section */ + +.follower-section { + color: #212529; +} + +.follower-section ul { + list-style: none; +} + +.list-item-followers { + display: grid; + grid-template-columns: 25px 1fr auto; + align-items: center; + column-gap: 24px; + + margin-bottom: 18px; +} + +.img-name-wrapper { + display: flex; + align-items: center; + gap: 8px; +} + +.follower-image, +.follower-link-image { + width: 63px; + height: 63px; + border-radius: 50%; +} + +.follower-title { + color:#212529; +} + +.follower-link:link, +.follower-link:visited, +.follower-link:active { + text-decoration: none; + color: #343a40; +} + +.follower-link:hover { + color: #1864ab; +} + +.follower-link-image:hover { + box-shadow: 0 0 24px rgb(0, 0, 0, 0.5); + transition: box-shadow 0.3s; +} + +.checkbox { + display: flex; + gap: 8px; + align-items: center; +} + +.checklist-title { + color: #212529; +} + +.error-message { + color: #000; +} + +.pagination-links { + padding: 20px; +} + +.pagination-link:active, +.pagination-link:link, +.pagination-link:visited { + color:#fff; + text-decoration: none; + padding: 4px; +} + +.pagination-link:hover { + color: #1864ab; +} \ No newline at end of file diff --git a/irakli_kandelaki/uploads/Screenshot-from-2022-04-11-11-17-10.png b/irakli_kandelaki/uploads/Screenshot-from-2022-04-11-11-17-10.png new file mode 100644 index 0000000..453f98b Binary files /dev/null and b/irakli_kandelaki/uploads/Screenshot-from-2022-04-11-11-17-10.png differ diff --git a/irakli_kandelaki/uploads/Screenshot-from-2022-05-11-22-42-15.png b/irakli_kandelaki/uploads/Screenshot-from-2022-05-11-22-42-15.png new file mode 100644 index 0000000..63619e9 Binary files /dev/null and b/irakli_kandelaki/uploads/Screenshot-from-2022-05-11-22-42-15.png differ diff --git a/irakli_kandelaki/uploads/tanjirou.png b/irakli_kandelaki/uploads/tanjirou.png new file mode 100644 index 0000000..9bf0cda Binary files /dev/null and b/irakli_kandelaki/uploads/tanjirou.png differ