laravel 4 - sending a fixed parameter via href or button to a php function -


i have calendar array have populated dates keys , reports corresponding values (whether done depending on day, week or month).

this consists of 3 methods makecalendar(), populatedateswithreports(), , makefullcalendar().

i know need href buttons e.g. previous month , next month, send variable makecalendar() , makefullcalendar() functions e.g. -1 previous months , +1 next month.

these functions...

public function makecalendar(/*$monthnumber*/) {     // $month = $monthnumber;     $month = date("m");     $year = date("y");      $num = cal_days_in_month(cal_gregorian, $month, $year);         $dates_month=array();         for($i=1;$i<=$num;$i++)         {             $mktime=mktime(0,0,0,$month,$i,$year);             $date=date("y-m-d",$mktime);             $dates_month[$i]=$date;         }         return $dates_month; }  public function populatedateswithreports($parkid = null) {     $completecalendar = array();      $calendar = $this->makecalendar();      $reports = db::table('reportrecord')         ->where('parkid','=', $parkid)         ->orderby('datecompleted', 'asc')         ->get();      foreach ($calendar $key => $date)      {         foreach ($reports $report)          {             if ($report->datecompleted == $date)              {                 $completecalendar[$date][] = $report->reportnameid;             }         }     }      return $completecalendar; }  public function makefullcalendar(/*$monthnumber,*/$parkid = null) {     $reportdates = $this->populatedateswithreports($parkid);     $reportcounter = 0;     $weekreportcounter = 0;     $monthreportcounter = 0;     $weeklyreports = array();     $monthlyreports = array();      $month = date("m");     $year = date("y");      $reports = db::table('reportrecord')         ->where('parkid','=', $parkid)         ->orderby('datecompleted', 'asc')         ->get();      $num = cal_days_in_month(cal_gregorian, $month, $year);     $dates_month_with_reports=array();      for($i=1;$i<=$num;$i++)     {             $mktime=mktime(0,0,0,$month,$i,$year);             $date=date("y-m-d",$mktime);             $dates_month_with_reports[$date]=$date;     }      foreach ($dates_month_with_reports $cal)      {         foreach ($reportdates $key => $rdate)          {             if ($key == $cal)              {                 $dates_month_with_reports[$cal] = $rdate;             }          }     }      $daycounter = 0;      foreach ($dates_month_with_reports $key => $value)      {         $daycounter++;          if (! is_array($value))          {             $dates_month_with_reports[$key] = "no reports done today";         }         else {             foreach ($value $int => $val)              {                  if ($val == 1 || $val == 3 || $val == 4 || $val == 5)                  {                     $reportcounter++;                      if ($reportcounter >= 4)                      {                         $dates_month_with_reports[$key] = "daily reports done";                     }                     else {                         $dates_month_with_reports[$key] = "daily repoorts missing";                     }                 }                  elseif ($val == 41 || $val == 10 || $val == 9 || $val == 8 || $val == 7 || $val == 6 || $val == 2)                  {                     $weeklyreports[$key][] = $val;                 }                 elseif($val == 42 || $val == 22 || $val == 21 || $val == 20 || $val == 18 || $val == 17 || $val == 16 || $val == 15 || $val == 14 || $val == 13 || $val == 12 )                  {                     $monthlyreports[$key][] = $val;                 }             }         }          if ($daycounter == 7||$daycounter == 14||$daycounter == 21||$daycounter == 28)          {             foreach ($weeklyreports $index => $val)              {                 foreach ($val $va)                  {                     $weekreportcounter++;                 }             }              if ($weekreportcounter >= 7)              {                 $dates_month_with_reports[$key] = "weekly reports done";             }             else {                  $dates_month_with_reports[$key] = "weekly reports not done achieved ".$weekreportcounter."/7";             }          }          if ($daycounter == count($dates_month_with_reports))          {             foreach ($monthlyreports $index => $val)              {                 foreach ($val $va)                  {                     $monthreportcounter++;                 }             }             if ($monthreportcounter >= 11)              {                 $dates_month_with_reports[$key] = "monthly reports done";             }             else {                  $dates_month_with_reports[$key] = "monthly reports not done achieved ".$monthreportcounter."/11";             }         }      }      return $dates_month_with_reports; } 

i'm using laravel 4, , know need send parameters both makecalendar(), , makefullcalnedar() using href input, increment month.

so question ways can send data functions don't involve using routes, or way?

you can call makecalendar function within populatedateswithreports function, sending $monthnumber paramater this,

$this->makecalendar($monthnumber); 

you can @ point long you're sending $monthnumber parameter populatedateswithreports function.

so href like

http://www.example.com/calender/makefullcalendar/1/99 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -