Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1.  
  2.  function renderBossComposition($current_boss){
  3.       $str = file_get_contents('./content/benchmarks/compositions.json');
  4.       $json_compositions = json_decode($str, true);
  5.       for ($i = 1; $i <= 10; $i++) {
  6.         $p_subtext[$i] = $json_compositions[$current_boss][0][$i]["subtext"];
  7.         $p_profession[$i] = $json_compositions[$current_boss][0][$i]["profession"];
  8.         $p_specialization[$i] = $json_compositions[$current_boss][0][$i]["specialization"];
  9.         $p_build[$i] = $json_compositions[$current_boss][0][$i]["build"];
  10.         $p_subgroup[$i] = $json_compositions[$current_boss][0][$i]["subgroup"];  
  11.       }
  12.         echo'
  13.         <div class="card">
  14.            <div class="card-header clr-benchmarks">
  15.                Composition
  16.            </div>
  17.            <div class="card-body text-center">
  18.         ';
  19.         //iterate through all possible subgroups 1-10
  20.         for ($i = 1; $i <= 10; $i++) {
  21.             $subgroupexists=false;
  22.             //iterate through all players 1-10
  23.             for ($j = 1; $j <= 10; $j++) {
  24.                  if ($p_subgroup[$j] == $i){
  25.                      //check if first time
  26.                      if (!$subgroupexists){
  27.                          $subgroupexists = true;
  28.                          echo '
  29.                          <div class="row">
  30.                             <div class="col-2">
  31.                                 Group '.$i.'
  32.                             </div>
  33.                         ';
  34.                      }
  35.                      echo '<div class="col-2">';
  36.                     if ($p_profession[$j] == "any") { echo '<a name="any">';}
  37.                     else{ echo '<a href="/raids/'.$p_profession[$j].'/'.systemStringToURL($p_build[$j]).'/">';}
  38.                     echo'
  39.                             <img src="/assets/icons/professions/'.$p_specialization[$j].'-dark.png" alt="" class="img-fluid benchmarks-composition-icon">
  40.                             </a>
  41.                             <span class="benchmarks-composition-title">'.$p_subtext[$j].'</span>
  42.                         </div>
  43.                     ';
  44.                  }
  45.             }
  46.             //close subgroup div
  47.             if ($subgroupexists){
  48.                 echo '
  49.                     </div>
  50.                <hr>
  51.                 ';
  52.             }
  53.         }
  54.         //close group composition divs
  55.         echo '
  56.             </div>
  57.         </div>
  58.         ';
  59.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement