当前位置: 首页>>代码示例>>PHP>>正文


PHP Teacher::find方法代码示例

本文整理汇总了PHP中Teacher::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::find方法的具体用法?PHP Teacher::find怎么用?PHP Teacher::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Teacher的用法示例。


在下文中一共展示了Teacher::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addSectionCode

 public function addSectionCode()
 {
     $section_code = new SectionCode();
     $teacher = Teacher::find(Auth::Id());
     $subject_id = Input::get('subject');
     $section_id = Input::get('section');
     $current_period = Input::get('current_period');
     $section_code->teacher_id = new MongoId($teacher->_id);
     $section_code->subject_id = new MongoId($subject_id);
     $section_code->section_id = new MongoId($section_id);
     $section_code->current_period = $current_period;
     $section_code->teamleaders_id = array();
     $section_code->students_id = array();
     $section_code->status = true;
     $subject = Subject::find($subject_id);
     $section = $subject->sections()->find($section_id);
     $code = $this->getInitialLetters($subject->name) . '-' . $section->code . '-' . $current_period;
     $section_code->code = $code;
     if (!is_null($section->current_code)) {
         $sectionCode = SectionCode::where('code', $section->current_code)->first();
         if (isset($sectionCode->_id)) {
             $sectionCode->status = false;
             $sectionCode->save();
         }
     }
     try {
         $section_code->save();
         $section->current_code = $code;
         $section->save();
     } catch (MongoDuplicateKeyException $e) {
         return Redirect::back()->withErrors(array('error' => Lang::get('section_codes.duplicate_code')));
     }
     return Redirect::to(Lang::get('routes.section_codes'))->with(array('message' => Lang::get('section_codes.success_message')));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:34,代码来源:SectionCodeController.php

示例2: getLastTitleId

 public static function getLastTitleId()
 {
     try {
         return Teacher::find(self::$lastTeacherId)->title->title_id;
     } catch (Exception $e) {
         return 'all';
     }
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:8,代码来源:Teacher.php

示例3: getSubjectSections

 /**
  * Return the sections belonging to a teacher
  * 
  * @return JSON Ajax
  */
 public function getSubjectSections()
 {
     if (Request::ajax()) {
         $subject = Subject::where("_id", new MongoId(Input::get("_id")))->first();
         $teacher = Teacher::find(Auth::id());
         $sections = $subject->sections()->whereIn('_id', $teacher->sections_id)->get();
         if (count($sections) > 0) {
             return Response::json(array('subject' => $subject->_id, 'sections' => $sections));
         }
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:16,代码来源:SectionController.php

示例4: syncTeacher

 /**
  * 同步更新教師的班級資料
  */
 public static function syncTeacher()
 {
     $classes = Classes::find(self::$lastClassesId);
     try {
         $teacher = Teacher::where('classes_id', '=', $classes->classes_id)->update(array('classes_id' => 0));
         if ($classes->teacher_id > 0) {
             $teacher = Teacher::find($classes->teacher_id)->update(array('classes_id' => $classes->classes_id));
         }
     } catch (Exception $e) {
     }
 }
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:14,代码来源:Classes.php

示例5: unlink

 /**
  * Unlink a section with a teacher 
  * 
  * @return JSON Ajax
  */
 public function unlink()
 {
     if (Request::ajax()) {
         $subject = Subject::find(Input::get('subject_id'));
         $teacher = Teacher::find(Input::get('teacher_id'));
         $teacher->pull('sections_id', new MongoId(Input::get('section_id')));
         $section = $subject->sections()->find(Input::get('section_id'));
         $section->is_free = true;
         $section->save();
         if ($subject->sections()->whereIn('_id', $teacher->sections_id)->count() === 0) {
             $teacher->pull('subjects_id', new MongoId(Input::get('subject_id')));
         }
         return Response::json("00");
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:20,代码来源:EnrollmentController.php

示例6: showView

 /**
  * Show chat home view
  * 
  * @return View
  */
 public function showView()
 {
     $users = array();
     $user = UserController::getUser(Auth::user());
     if ($user instanceof Teacher) {
         $sectionCodes = SectionCode::where('teacher_id', new MongoId($user->_id))->where('status', true)->get();
         foreach ($sectionCodes as $sectionCode) {
             foreach ($sectionCode->teamleaders_id as $id) {
                 array_push($users, Student::find($id));
             }
             $users = array_unique($users);
         }
     } else {
         if ($user instanceof Student) {
             $sectionCodes = SectionCode::whereIn('students_id', array(new MongoId($user->_id)))->where('status', true)->get();
             foreach ($sectionCodes as $sectionCode) {
                 foreach ($sectionCode->students_id as $id) {
                     if ($id != Auth::id()) {
                         array_push($users, Student::find($id));
                     }
                 }
                 $count = SectionCode::whereIn('teamleaders_id', array(Auth::id()))->where('_id', new MongoId($sectionCode->_id))->count();
                 if ($count > 0) {
                     array_push($users, Teacher::find($sectionCode->teacher_id));
                 }
                 $users = array_unique($users);
             }
         } else {
             if ($user instanceof University) {
                 return View::make('error.403');
             }
         }
     }
     $ip = App::isLocal() ? '127.0.0.1' : '104.131.3.39';
     return View::make('chat.home')->with(array('contacts' => $users, 'user' => $user, 'ip' => $ip));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:41,代码来源:ChatController.php

示例7: function

     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     return View::make('timetable')->with($viewData);
 });
 // 顯示教師排課編輯畫面
 Route::get('view_title/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     $viewData['courseUnit'] = Courseunit::find($courseUnitId);
     return View::make('timetable')->with($viewData);
 });
 // 執行更新排課設定
 Route::post('edit/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     // 設定為編輯模式,方便驗證功能
     $validator = FormValidator::courseUnit(array_merge(Input::all(), array('mode' => 'edit' . $courseUnitId)));
     if ($validator->fails()) {
         return Redirect::to('/timetable/view_title/' . $titleId . '/' . $teacherId . '/' . $courseUnitId)->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
     } else {
         $data = Input::all();
         $courseUnit = Courseunit::find($courseUnitId);
         if ($courseUnit->update($data)) {
开发者ID:ramazanalic,项目名称:open-school-timetable,代码行数:31,代码来源:routes.php

示例8:

                            <div class="offset2 span3">
                                <div class="control-group">
                                <label class="control-label">Created Date</label>
                                    <div class="controls">
                                        <span class="input-xlarge uneditable-input">{{ $tutorial->created_at }}</span>
                                    </div>
                                </div>
                                <label class="control-label">Updated Date</label>
                                <div class="controls">
                                        <span class="input-xlarge uneditable-input">{{ $tutorial->updated_at }}</span>
                                </div>
                                <label class="control-label">Created By</label>
                                <div class="controls">
                                        <span class="input-xlarge eneditable-input">
                                            <?php 
$teacher = Teacher::find($tutorial->createdby);
$username = Sentry::findUserByLogin($teacher->email);
echo $username->first_name . ' ' . $username->last_name;
?>
                                        </span>
                                </div><br>
                                <label class="control-label">Current Attachments</label>
                                <table class="table table-striped table-bordered bootstrap-datatable datatable">
                                    <thead>
                                        <tr>
                                            <th>#id</th>
                                            <th>Name</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
开发者ID:eufelipemartins,项目名称:edlara,代码行数:31,代码来源:edit.blade.php

示例9: teacherMore

 public function teacherMore()
 {
     $teacher_id = Input::get('teacher_id');
     $teacher = Teacher::find($teacher_id);
     return View::make('home.comedy.comedy-details')->with(array('teacher' => $teacher, 'links' => $this->link()));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:6,代码来源:PerformancePageController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // self::requestOriginalApi('/api/teachers', "DELETE");
     // return Redirect::to('admin/teachers');
     $teacher = Teacher::find($id);
     $teacher->delete();
     return Redirect::to('admin/teachers');
 }
开发者ID:riferimenti,项目名称:college-web-control,代码行数:14,代码来源:AppTeachersController.php

示例11:

      var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    }
    </script>
    </head>
    <body>
        {{ $header }}
        <div class='container-fluid'>
            <div class='row-fluid'>
                <div class="span3 offset2">
                <?php 
$user = User::find($id);
$userdata = Student::find($id);
$userstream = 'student';
if ($userdata == NULL) {
    $userdata = Teacher::find($id);
    $userstream = 'teacher';
} else {
    $userdata;
}
?>
                    <div class="pull-left">
                        First Name -
                    </div>
                    <div class="pull-right">
                        {{$user->first_name}}
                    </div><br>&nbsp;<br>
                    <div class="pull-left">
                        Last Name -
                    </div>
                    <div class="pull-right">
开发者ID:eufelipemartins,项目名称:edlara,代码行数:31,代码来源:view.blade.php

示例12: showReportView

 public function showReportView()
 {
     $teacher = Teacher::find(Auth::id());
     $subjects = Subject::whereIn('_id', $teacher->subjects_id)->get();
     $section_codes = SectionCode::where('teacher_id', new MongoId($teacher->_id))->where('status', true)->get();
     return View::make('teacher.report')->with(array('subjects' => $subjects, 'teacher_section_id' => $teacher->sections_id, 'section_codes' => $section_codes));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:7,代码来源:TeacherController.php

示例13: deleteTeacher

 public function deleteTeacher()
 {
     ${$teacher_id} = Input::get('$teacher_id');
     $teacher = Teacher::find($teacher_id);
     if (!$teacher_id->delete()) {
         return Response::json(array('errCode' => 1, 'message' => '删除失败!'));
     }
     return Response::json(array('errCode' => 0, 'message' => '删除成功!'));
 }
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:9,代码来源:AdminShowController.php

示例14:

			<div class="navbar-default sidebar" role="navigation">
				<div class="sidebar-nav navbar-collapse">
					<ul class="nav" id="side-menu">
						<li>
							<a href="{{Lang::get('routes.teacher')}}" class="nav_home_categoria" style="background-color: #0097A7; color: white;">
								<i class="fa fa-home"></i> {{Lang::get('teacher_master.board')}}
							</a>
						</li>
						<li>
							<a href="#" class="nav_categoria">
								<i class="fa fa-list"></i> 
								{{Lang::get('teacher_master.subject')}}
							</a>
							<ul class="nav nav-second-level">
								<?php 
$teacher = Teacher::find(Auth::id());
$subjects = Subject::whereIn('_id', $teacher->subjects_id)->get();
?>
								@foreach($subjects as $subject)
									<li>
										<a href="#">
											<i class="fa fa-eye" style="color: #0097A7;"></i> 
											{{ $subject->name }}
										</a>
										<ul class="nav nav-third-level">
											<?php 
$sections = $subject->sections()->whereIn('_id', $teacher->sections_id)->get();
?>
											@foreach($sections as $section)
												<li>
													<a href="#" id="{{$section->current_code}}" class="menu_section">
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:31,代码来源:master.blade.php

示例15: updateUser

 private function updateUser($user, $group)
 {
     $accountlevel = Input::get('accountlevel');
     $useradminupgrade = array();
     $useradminupgrade['enabled'] = 0;
     $useradminupgrade['from'] = 'teachers';
     switch ($group) {
         case 'teachers':
             if ($accountlevel == 'admin') {
                 $useradminupgrade['enabled'] = 1;
                 $useradminupgrade['from'] = 'teachers';
                 break;
             }
             $updateableuserid = $user->id;
             $user = User::find($user->id);
             $updateableuser = Student::find($user->id);
             $userstream = 'student';
             if ($updateableuser == NULL) {
                 $updateableuser = Teacher::find($user->id);
                 $userstream = 'teacher';
             }
             $updateduser = self::setAccountLevel($accountlevel);
             $updateduser->email = $updateableuser->email;
             $updateduser->dob = $updateableuser->dob;
             $updateableuser->extra = $updateableuser->extra;
             $updateduser->user_id = $updateableuser->user_id;
             $newuser = Sentry::findUserById($user->id);
             $newusergroup = self::setUserGroup($accountlevel);
             $oldusergroup = Sentry::findGroupByName('teachers');
             $newuser->removeGroup($oldusergroup);
             $newuser->addGroup($newusergroup);
             //Save NEW User
             $updateduser->save();
             //Delete OLD User
             $updateableuser->delete();
             break;
         case 'students':
             if ($accountlevel == 'admin') {
                 $useradminupgrade['enabled'] = 1;
                 $useradminupgrade['from'] = 'students';
                 break;
             }
             $updateableuserid = $user->id;
             $user = User::find($user->id);
             $updateableuser = Student::find($user->id);
             $userstream = 'student';
             if ($updateableuser == NULL) {
                 $updateableuser = Teacher::find($user->id);
                 $userstream = 'teacher';
             }
             $updateduser = self::setAccountLevel($accountlevel);
             $updateduser->email = $updateableuser->email;
             $updateduser->dob = $updateableuser->dob;
             $updateduser->extra = $updateableuser->extra;
             $updateduser->user_id = $updateableuser->user_id;
             $newuser = Sentry::findUserById($user->id);
             $newusergroup = self::setUserGroup($accountlevel);
             $oldusergroup = Sentry::findGroupByName('students');
             $newuser->removeGroup($oldusergroup);
             $newuser->addGroup($newusergroup);
             //Delete OLD User
             $updateableuser->delete();
             //Save NEW User
             $updateduser->save();
             break;
         case 'admin':
             if ($accountlevel == 'admin') {
                 $useradminupgrade['enabled'] = 1;
                 $useradminupgrade['from'] = 'admin';
             }
             $updateableuserid = $user->id;
             $newuser = Sentry::findUserById($updateableuserid);
             $newusergroup = self::setUserGroup($accountlevel);
             $oldusergroup = Sentry::findGroupByName('admin');
             $newuser->removeGroup($oldusergroup);
             $newuser->addGroup($newusergroup);
             break;
     }
     if ($useradminupgrade['enabled'] == 1) {
         switch ($useradminupgrade['from']) {
             case 'teachers':
                 $updateableuserid = $user->id;
                 $newuser = Sentry::findUserById($updateableuserid);
                 $newusergroup = self::setUserGroup('admin');
                 $oldusergroup = Sentry::findGroupByName('students');
                 $newuser->removeGroup($oldusergroup);
                 $newuser->addGroup($newusergroup);
                 break;
             case 'students':
                 $updateableuserid = $user->id;
                 $newuser = Sentry::findUserById($updateableuserid);
                 $newusergroup = self::setUserGroup('admin');
                 $oldusergroup = Sentry::findGroupByName('students');
                 $newuser->removeGroup($oldusergroup);
                 $newuser->addGroup($newusergroup);
         }
     }
 }
开发者ID:eufelipemartins,项目名称:edlara,代码行数:98,代码来源:UserController.php


注:本文中的Teacher::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。