Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. //this code is for output
  2. $selectedMonths = isset(io::$post['month']) && !empty(io::$post['month'])?io::$post['month']:date('m');
  3. io::$out['month'] = $this->getMonths(date('m'), $selectedMonth);
  4.  
  5. //this is the function that gives me list of months, default item is a current month
  6. private function getMonths($selectedMonth) {
  7. $arr = array();
  8. $j = 0;
  9. for ($i = 1; $i <= 12; $i++) {
  10. if ($i < 10) {
  11. $i = "0" . $i;
  12. }
  13. $arr[$j]['number'] = $i;
  14. $monthName = date("F", strtotime(date("Y-$i-01")));
  15. $arr[$j]['name'] = $monthName;
  16. if ($i == $selectedMonth) {
  17. $arr[$i-1]['selected'] = "selected";
  18. } else {
  19. $arr[$i-1]['selected'] = "";
  20. }
  21. $j++;
  22. }
  23. return $arr;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement