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


PHP Subject::find方法代码示例

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


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

示例1: addGroup

 public function addGroup()
 {
     $sectionCode = SectionCode::find(new MongoId(Input::get('section')));
     if (isset($sectionCode->_id)) {
         $section = Subject::find($sectionCode->subject_id)->sections()->find($sectionCode->section_id);
         if (strcasecmp($section->current_code, $sectionCode->code) === 0) {
             $group = new Group();
             $group->name = trim(ucfirst(Input::get('name')));
             $group->teamleader_id = Auth::id();
             $group->section_code_id = new MongoId($sectionCode->_id);
             $group->students_id = array(Auth::id());
             $group->project_name = trim(strtolower(Input::get('project_name')));
             $message = "";
             if (Input::hasFile('avatar_file')) {
                 $data = Input::get('avatar_data');
                 $image = new CropImage(null, $data, $_FILES['avatar_file']);
                 $group->logo = $image->getURL();
             } else {
                 $group->logo = null;
             }
             try {
                 $group->save();
             } catch (MongoDuplicateKeyException $e) {
                 return Redirect::back()->withErrors(array('error' => Lang::get('register_group.duplicated')));
             }
             return Redirect::to(Lang::get('routes.add_group'))->with('message', Lang::get('register_group.success'));
         } else {
             $message = Lang::get('register_group.code_expired');
         }
     } else {
         $message = Lang::get('register_group.code_fail');
     }
     return Redirect::back()->withErrors(array('error' => $message));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:34,代码来源:GroupController.php

示例2: update

 public function update($id)
 {
     $subject = Subject::find($id);
     $subject->name = Input::get('name');
     $subject->save();
     Session::flash('message', 'Sukses menambahkan bidang studi baru!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:7,代码来源:SubjectsController.php

示例3: 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

示例4: enrollSection

 public function enrollSection()
 {
     $sectionCode = SectionCode::where('code', Input::get('code'))->first();
     if (isset($sectionCode->_id)) {
         $section = Subject::find($sectionCode->subject_id)->sections()->find($sectionCode->section_id);
         $message = "";
         if (strcasecmp($section->current_code, $sectionCode->code) === 0) {
             $codes = SectionCode::where('code', Input::get('code'))->whereIn('students_id', array(Auth::id()))->first();
             if (!isset($codes->_id)) {
                 $pending = new PendingEnrollment();
                 $pending->section_code_id = new MongoId($sectionCode->_id);
                 $pending->student_id = Auth::id();
                 $pending->teacher_id = new MongoId($sectionCode->teacher_id);
                 try {
                     $pending->save();
                 } catch (MongoDuplicateKeyException $e) {
                     return Redirect::back()->withErrors(array('error' => Lang::get('register_group.enroll_pending')));
                 }
                 return Redirect::to(Lang::get('routes.enroll_section'))->with('message', Lang::get('register_group.enroll_sucess'));
             } else {
                 $message = Lang::get('register_group.user_register');
             }
         } else {
             $message = Lang::get('register_group.code_expired');
         }
     } else {
         $message = Lang::get('register_group.code_fail');
     }
     return Redirect::back()->withErrors(array('error' => $message));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:30,代码来源:PendingEnrollmentController.php

示例5: format

 public static function format($data)
 {
     $uids = $sids = [];
     $users = $subjects = [];
     foreach ($data as $d) {
         $uids[] = $d->userid;
         $sids[] = $d->subject_id;
     }
     $uids = array_unique($uids);
     $ret = \User::find([['userid' => ['$in' => $uids]]]);
     foreach ($ret as $u) {
         $users[$u->userid] = $u->attrs();
     }
     $sids = array_unique($sids);
     $ret = \Subject::find([['id' => ['$in' => $sids]]]);
     foreach ($ret as $s) {
         $subjects[$s->id] = $s->attrs();
     }
     $ret = [];
     foreach ($data as $d) {
         $ret[] = ['id' => $d->id, 'saying' => $d->saying, 'imgs' => $d->imgs, 'author' => $users[$d->userid], 'subject' => $subjects[$d->subject_id], 'created_at' => $d->created_at];
     }
     return $ret;
     print_r($users);
     print_r($subjects);
     print_r($uids);
     print_r($sids);
     return [];
 }
开发者ID:nisnaker,项目名称:tu,代码行数:29,代码来源:Photo.php

示例6: getTopicList

 public function getTopicList()
 {
     $currentchapterid = Session::get('chapterid');
     $currentchapter = Chapter::find($currentchapterid);
     $subjectid = $currentchapter->getSubjectID();
     $subject = Subject::find($subjectid);
     return Response::json($subject->getTopics());
 }
开发者ID:nverdhan,项目名称:qdbwrite,代码行数:8,代码来源:TypingController.php

示例7: showJoinToGroupView

 public function showJoinToGroupView()
 {
     $sectionCodes = SectionCode::where('status', true)->whereIn('students_id', array(Auth::id()))->get();
     $sections = array();
     $pending = PendingGroup::where('student_id', Auth::id())->get();
     foreach ($sectionCodes as $sectionCode) {
         $subject = Subject::find($sectionCode->subject_id);
         if (isset($subject->_id)) {
             $section = $subject->sections()->find($sectionCode->section_id);
             $sections[$sectionCode->code] = $subject->name . ' - ' . $section->code;
         }
     }
     return View::make('student.join_to_group')->with(array('sections' => $sections, 'pending' => $pending));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:14,代码来源:PendingGroupController.php

示例8: 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

示例9: getsubjectsAction

 public function getsubjectsAction()
 {
     try {
         $subjects = Subject::find(array("conditions" => "status = ?0", "bind" => array(1)));
         $array = array();
         foreach ($subjects as $subject) {
             $obj = new stdClass();
             $obj->id = $subject->idSubject;
             $obj->text = $subject->name;
             $array[] = $obj;
         }
         return $this->setJsonResponse($array, 200);
     } catch (InvalidArgumentException $ex) {
         return $this->setJsonResponse($ex->getMessage(), 400);
     } catch (Exception $ex) {
         $this->logger->log("Exception while getting subjects: " . $ex->getMessage());
         $this->logger->log($ex->getTraceAsString());
         return $this->setJsonResponse("Ha ocurrido un error, por favor contacta al administrador", 500);
     }
 }
开发者ID:willmontiel,项目名称:sayvot,代码行数:20,代码来源:SubjectController.php

示例10:

				@if(count($groups) > 0)
					@foreach ($groups as $index => $group)
						<div class="col-lg-6 col-md-6">
							<div class="panel" style="background-color: {{ $colors[$index] }}; color: white;">
								<div class="panel-heading">
									<div class="row">
										<div class="col-xs-3">
											<i class="fa fa-group fa-5x"></i>
											<input type="hidden" value="{{storage_path()}}" id="url">
										</div>
										<div class="col-xs-9 text-right">
											<div class="huge">
												<a href="#" id="{{$group->_id}}" class="group_name" style="text-transform: none; color: white;">{{$group->name}}</a></div>
												<?php 
$sectionCode = SectionCode::find($group->section_code_id);
$subject = Subject::find($sectionCode->subject_id);
$section = $subject->sections()->find($sectionCode->section_id);
$name = $subject->name . ' - ' . $section->code;
?>
												<div>
													<span style="text-transform: uppercase;">{{$name}}</span>
												</div>
										</div>
									</div>
								</div>
								<div class="panel-footer" style="color: #000000;">
                                    <?php 
$students = Student::whereIn('_id', $group->students_id)->get();
?>
                                    @foreach ($students as $user)
                                        @if(strcmp($group->teamleader_id, $user->_id) === 0)
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:31,代码来源:show_all_group.blade.php

示例11: drop

 /**
  * Remove the subjects of an University
  * 
  * @return JSON Ajax
  */
 public function drop()
 {
     if (Request::ajax()) {
         $subject = Subject::find(Input::get('subject_id'));
         foreach (Teacher::where('university_id', Auth::id())->get() as $teacher) {
             if ($teacher->whereIn('subjects_id', array(new MongoId($subject->_id)))->count() > 0) {
                 return Response::json(Lang::get('add_subject.subject_used'));
             }
         }
         $subject->delete();
         return Response::json($subject->trashed() ? "00" : "99");
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:18,代码来源:SubjectController.php

示例12: delete

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $subject = Subject::find($id);
     $subject->delete();
     return Redirect::to('/subject/list')->with("success", "Subject Deleted Succesfully.");
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:12,代码来源:subjectController.php

示例13: showGenerateReportView

 public function showGenerateReportView()
 {
     $subject = Subject::find(Input::get('subject'));
     if (isset($subject->_id)) {
         $tags = Input::get('tags');
         $array = array();
         if (in_array('all', $tags)) {
             $tags = null;
         }
         if (strcasecmp(Input::get('group'), 'all') === 0) {
             $sectionCode = SectionCode::where('code', Input::get('section'))->first();
             $groups = Group::where('section_code_id', new MongoId($sectionCode->_id))->get();
             if (is_null($tags)) {
                 $array['groups'] = $this->getStatGroups($groups, $subject->name, Input::get('section'), Input::get('attach'));
             } else {
                 $array['groups'] = $this->getStatGroupByTags($groups, $tags, $subject->name, Input::get('section'), Input::get('attach'));
             }
         } else {
             $group = Group::find(Input::get('group'));
             $students = Input::get('students');
             if (in_array('all', $students)) {
                 $students = $group->students_id;
             }
             if (is_null($tags)) {
                 $array['students'] = $this->getStatStudents($students, $group->_id, $subject->name, Input::get('section'), Input::get('attach'));
             } else {
                 $array['students'] = $this->getStatStudentsByTags($students, $group->_id, $tags, $subject->name, Input::get('section'), Input::get('attach'));
             }
         }
         return View::make('teacher.view_report')->with(array('report' => $array));
     } else {
         return Redirect::back();
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:34,代码来源:TeacherController.php

示例14: function

                        <th>Subject</th>
                        <th>Grade</th>
                        <th>Created Date</th>
                        <th>Modified Date</th>
                        <th>Created By</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
$tutorial_list = Cache::remember('tutorial_listing_dash' . Sentry::getUser()->id, 20, function () {
    $tutorials = Tutorials::all();
    $out = '';
    foreach ($tutorials as $tutorial) {
        $subject = Subject::find($tutorial->subjectid);
        $teacher = User::find($tutorial->createdby);
        $username = Sentry::findUserByLogin($teacher->email);
        if (Sentry::getUser()->inGroup(Sentry::findGroupByName('admin')) || Sentry::getUser()->id == $tutorial->createdby) {
            $out .= "<tr>";
            $out .= "<td>";
            $out .= $tutorial->id;
            $out .= "</td>";
            $out .= "<td>";
            $out .= $tutorial->name;
            $out .= "</td>";
            $out .= "<td>";
            $out .= $subject->subjectname;
            $out .= "</td>";
            $out .= "<td>";
            $out .= $subject->grade;
开发者ID:eufelipemartins,项目名称:edlara,代码行数:31,代码来源:tutorials.blade.php

示例15: update

 public function update()
 {
     $id = Input::get('id');
     $tabla = Input::get('tabla');
     switch ($tabla) {
         case '0':
             $clave = Input::get('clave');
             $appat = Input::get('ap_pat');
             $apmat = Input::get('ap_mat');
             $nombre = Input::get('nombre');
             $segnombre = Input::get('seg_nombre');
             $tipo = Input::get('tipo');
             $grado = Input::get('grado');
             $tutorias = Input::get('tutorias');
             $gestion = Input::get('gestion');
             $investigacion = Input::get('investigacion');
             $dependencias = Input::get('dependencias');
             $edit = Professor::find($id);
             $edit->clave = $clave;
             $edit->ap_pat = $appat;
             $edit->ap_mat = $apmat;
             $edit->nombre = $nombre;
             $edit->seg_nombre = $segnombre;
             $edit->tipo = $tipo;
             $edit->id_grado = $grado;
             $edit->tutorias = $tutorias;
             $edit->gestion = $gestion;
             $edit->investigacion = $investigacion;
             $edit->dependencias = $dependencias;
             $edit->save();
             return View::make('crud.crudMaestros')->with('professors', Professor::all());
             break;
         case '1':
             $nombre = Input::get('nombre');
             $semestre = Input::get('semestre');
             $plan = Input::get('idPlan');
             $edit = Subject::find($id);
             $edit->nombre = $nombre;
             $edit->semestre = $semestre;
             $edit->id_plan = $plan;
             $edit->save();
             return View::make('crud.crudMaterias')->with('subjects', Subject::all());
             break;
         case '2':
             $nombre = Input::get('nombre');
             $edit = Aula::find($id);
             $edit->nombre = $nombre;
             $edit->save();
             return View::make('crud.crudAulas')->with('aulas', Aula::all());
             break;
         case '3':
             $nombre = Input::get('nombre');
             $edit = Plan::find($id);
             $edit->nombre = $nombre;
             $edit->save();
             return View::make('crud.crudPlanes')->with('plans', Plan::all());
             break;
         default:
             //aqui me redirecciona a una pagina vacia solo con un mensaje 404
             return View::make('landing');
             break;
     }
 }
开发者ID:Thekami,项目名称:sistema-horarios,代码行数:63,代码来源:CrudController.php


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