當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HomeController::setGroup方法代碼示例

本文整理匯總了PHP中HomeController::setGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP HomeController::setGroup方法的具體用法?PHP HomeController::setGroup怎麽用?PHP HomeController::setGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HomeController的用法示例。


在下文中一共展示了HomeController::setGroup方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: calendarApproval


//.........這裏部分代碼省略.........
                     } elseif ($calendar_data->status == "created") {
                         $datas[$city_id]['created']++;
                         if ($datas[$city_id]['approved'] != 0) {
                             $datas[$city_id]['approved']--;
                         }
                     }
                 } elseif ($calendar_data->student_id == $student_id && $calendar_data->month != $month) {
                     $flag = false;
                     //Reset the flag for a different Month.
                     $month = $calendar_data->month;
                     if ($calendar_data->status == "approved" || $calendar_data->status == "attended") {
                         $datas[$city_id]['approved']++;
                     } elseif ($calendar_data->status == "created") {
                         $datas[$city_id]['created']++;
                     }
                 } elseif ($calendar_data->student_id != $student_id) {
                     $flag = false;
                     //Reset the flag for a different Student.
                     $student_id = $calendar_data->student_id;
                     $month = $calendar_data->month;
                     if ($calendar_data->status == "approved" || $calendar_data->status == "attended") {
                         $datas[$city_id]['approved']++;
                     } elseif ($calendar_data->status == "created") {
                         $datas[$city_id]['created']++;
                     }
                 }
                 $city_id = $calendar_data->cityId;
             }
         }
         return View::make('reports.calendar-approval')->with('datas', $datas)->with('start_date', $start_date)->with('end_date', $end_date)->with('cities', $cities);
     } else {
         $query = DB::table('propel_calendarEvents as A')->join('Student as B', 'B.id', '=', 'A.student_id')->join('Center as C', 'C.id', '=', 'B.center_id')->join('City as D', 'D.id', '=', 'C.city_id')->join('propel_student_wingman as E', 'E.student_id', '=', 'B.id')->join('User as F', 'F.id', '=', 'E.wingman_id')->join('UserGroup as G', 'G.user_id', '=', 'E.wingman_id')->join('Group as H', 'H.id', '=', 'G.group_id');
         $fetchQuery = $query->select('A.id', 'D.name as city_name', 'D.id as city_id', 'F.id as wingman_id', 'B.id as student_id', 'F.name as wingman_name', 'B.name as student_name', 'A.status', DB::raw('count(A.status) as event_count'), DB::raw('count(D.id)'), DB::raw('MONTH(A.start_time) as month'), 'A.start_time')->groupby(DB::raw('MONTH(A.start_time)'))->groupby('B.id')->groupby('A.status')->where('A.status', '<>', 'cancelled')->where('D.id', '=', $city_id)->where('F.status', '=', '1')->where('F.user_type', '=', 'volunteer')->whereIn('H.id', ['348', '365'])->orderBy('B.id', 'ASC');
         if ($start_date != 'null' && isset($start_date)) {
             $start = date('Y-m-d 00:00:00', strtotime($start_date));
             $fetchQuery = $fetchQuery->where('A.start_time', '>=', $start);
         } else {
             $fetchQuery = $fetchQuery->where('A.start_time', '>=', $this->year_time);
         }
         if ($end_date != 'null' && isset($end_date)) {
             $end = date('Y-m-d 00:00:00', strtotime($end_date));
             $fetchQuery = $fetchQuery->where('A.end_time', '<=', $end);
         }
         $data = $fetchQuery->orderBy('D.name', 'ASC')->orderBy('A.student_id', 'ASC')->orderBy('month', 'ASC')->get();
         //return $data;
         $datas = array();
         $student_id = 0;
         foreach ($data as $calendar_data) {
             if ($calendar_data->student_id != $student_id) {
                 $student_id = $calendar_data->student_id;
                 $month = 0;
                 //Reset the month to 0 for a different city.
                 $flag = true;
                 //Reset the flag for a different city.
                 $datas[$student_id]['approved'] = 0;
                 $datas[$student_id]['created'] = 0;
                 $datas[$student_id]['wingman_id'] = $calendar_data->wingman_id;
                 $datas[$student_id]['wingman_name'] = $calendar_data->wingman_name;
                 $datas[$student_id]['student_id'] = $calendar_data->student_id;
                 $datas[$student_id]['student_name'] = $calendar_data->student_name;
                 //$student_id = $calendar_data->student_id;
                 $month = $calendar_data->month;
                 if ($calendar_data->status == "approved" || $calendar_data->status == "attended") {
                     $datas[$student_id]['approved']++;
                     $flag = false;
                 } elseif ($calendar_data->status == "created") {
                     $datas[$student_id]['created']++;
                 }
             } else {
                 if ($calendar_data->month == $month) {
                     if (($calendar_data->status == "approved" || $calendar_data->status == "attended") && $flag) {
                         if ($datas[$student_id]['created'] = 0) {
                             $datas[$student_id]['approved']++;
                         }
                     } elseif ($calendar_data->status == "created") {
                         $datas[$student_id]['created']++;
                         if ($datas[$student_id]['approved'] != 0) {
                             $datas[$student_id]['approved']--;
                         }
                     }
                 } else {
                     $flag = false;
                     //Reset the flag for a different Month.
                     $month = $calendar_data->month;
                     if ($calendar_data->status == "approved" || $calendar_data->status == "attended") {
                         $datas[$student_id]['approved']++;
                     } elseif ($calendar_data->status == "created") {
                         $datas[$student_id]['created']++;
                     }
                 }
                 $student_id = $calendar_data->student_id;
             }
         }
         $cities = DB::table('City')->where('id', '<', 26)->orderBy('name', 'ASC')->get();
         $home = new HomeController();
         $home->setGroup();
         //return $datas;
         return View::make('reports.city-calendar-approval')->with('datas', $datas)->with('cities', $cities)->with('city_id', $city_id)->with('start_date', $start_date)->with('end_date', $end_date);
     }
 }
開發者ID:makeadiff,項目名稱:propel,代碼行數:101,代碼來源:CalendarController.php


注:本文中的HomeController::setGroup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。