Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. $page_step_steps = array(
  2. array("id" => "1", "step" => "done-step"),
  3. 'main-active-step next-step-five',
  4. array("id" => "2", "step" => "done-step"),
  5. "main-active-step next-step-five",
  6. array("id" => "3", "step" => "active-step"),
  7. "main-next-step next-step-five",
  8. array("id" => "4", "step" => "next-step"),
  9. "main-next-step next-step-five",
  10. array("id" => "5", "step" => "next-step")
  11. );
  12.  
  13. function formatting_steps($step, $steps){
  14. $page_step_steps = array();
  15. $steps_t = array(1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six");
  16. $steps_f = $steps_t[$steps];
  17. $final_steps = $steps * 2;
  18.  
  19. for($i = 1; $i < $final_steps; $i++){
  20.  
  21. $r_step = round($i / 2, 0, PHP_ROUND_HALF_UP);
  22.  
  23. if($i % 2){
  24. if($i == 1){
  25. $page_step_steps[$i]['id'] = $i;
  26.  
  27. if($i == $step){
  28. $page_step_steps[$i]['step'] = "active-step";
  29. }
  30. else {
  31. $page_step_steps[$i]['step'] = $i;
  32. }
  33. }
  34. else {
  35. $page_step_steps[$i]['id'] = $r_step;
  36.  
  37. if($r_step == $step){
  38. $page_step_steps[$i]['step'] = "active-step";
  39. }
  40. else {
  41. $page_step_steps[$i]['step'] = $i;
  42. }
  43. }
  44. }
  45. else {
  46. $page_step_steps[] = 'next-step-' . $steps_f;
  47. }
  48.  
  49. }
  50.  
  51. $page_step_steps = $page_step_steps;
  52.  
  53. return $page_step_steps;
  54. }
  55.  
  56. Array
  57. (
  58. [1] => Array
  59. (
  60. [id] => 1
  61. [step] => 1
  62. )
  63.  
  64. [2] => next-step-four
  65. [3] => Array
  66. (
  67. [id] => 2
  68. [step] => 3
  69. )
  70.  
  71. [4] => next-step-four
  72. [5] => Array
  73. (
  74. [id] => 3
  75. [step] => active-step
  76. )
  77.  
  78. [6] => next-step-four
  79. [7] => Array
  80. (
  81. [id] => 4
  82. [step] => 7
  83. )
  84.  
  85. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement