コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faculties = ["คณะเกษตรศาสตร์และทรัพยากรธรรมชาติ", "คณะเทคโนโลยีสารสนเทศและการสื่อสาร", "คณะพยาบาลศาสตร์", "คณะเภสัชศาสตร์", "คณะวิทยาศาสตร์", "คณะวิศวกรรมศาสตร์", "คณะสถาปัตยกรรมศาสตร์และศิลปกรรมศาสตร์", "คณะทันตแพทยศาสตร์", "คณะนิติศาสตร์", "คณะแพทยศาสตร์", "คณะรัฐศาสตร์และสังคมศาสตร์", "คณะวิทยาการจัดการและสารสนเทศศาสตร์", "คณะวิทยาศาสตร์การแพทย์", "คณะศิลปศาสตร์", "คณะสหเวชศาสตร์", "วิทยาลัยการศึกษา", "วิทยาลัยพลังงานและสิ่งแวดล้อม", "วิทยาลัยการจัดการ กรุงเทพมหานคร"];
     foreach ($faculties as $faculty) {
         $f = new Faculty();
         $f->name_th = $faculty;
         $f->save();
     }
 }
コード例 #2
0
 /**
  * Show the form for editing the specified Publication.
  *
  * @param  int $facultyId
  * @param  int  $id
  * @return Response
  */
 public function edit($facultyId, $id)
 {
     $publication = Publication::with(['faculty', 'researchArea'])->find($id);
     $facultyName = Faculty::find($facultyId)->name;
     $researchAreaList = ResearchArea::lists('name', 'id')->all();
     $typeList = ['journal' => 'Journal', 'conference' => 'Conference'];
     return view('admin.faculty.publication.edit', compact('facultyId', 'facultyName', 'researchAreaList', 'typeList', 'publication'));
 }
コード例 #3
0
 /**
  * Store a newly created Education in storage.
  *
  * @param  int      $facultyId
  * @param  EducationRequest  $request
  * @return Response 
  */
 public function store($facultyId, EducationRequest $request)
 {
     $faculty = Faculty::find($facultyId);
     $education = new Education(['name_of_degree' => $request->name_of_degree, 'institute' => $request->institute, 'year' => $request->year, 'remarks' => e($this->htmlEditor->parseHtml($request->remarks))]);
     $faculty->education()->save($education);
     Flash::success('Faculty education added successfully');
     return redirect("/admin/faculty/{$facultyId}");
 }
コード例 #4
0
 /**
  * Show dashboard
  * 
  * @return Response
  */
 public function index()
 {
     $faculty = Faculty::count();
     $researchGroup = ResearchGroup::count();
     $researchArea = ResearchArea::count();
     $news = News::count();
     return view('admin.pages.dashboard', compact('faculty', 'researchGroup', 'researchArea', 'news'));
 }
コード例 #5
0
 private function linkToFaculty(Project $project, array $input)
 {
     if (isset($input['faculty'])) {
         $id = $input['faculty']['id'];
         $faculty = Faculty::find($id);
         $project->faculty()->associate($faculty)->save();
     }
     return $project;
 }
コード例 #6
0
ファイル: FacultySearch.php プロジェクト: J-Beam/SchoolDMS
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Faculty::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['fac_ID' => $this->fac_ID]);
     $query->andFilterWhere(['like', 'fac_Name', $this->fac_Name])->andFilterWhere(['like', 'fac_Code', $this->fac_Code]);
     return $dataProvider;
 }
コード例 #7
0
 public function facultyProjectChart()
 {
     $chart = [];
     $chart['labels'] = [];
     $chart['series'] = ["จำนวนโครงการ"];
     $chart['data'] = [];
     $faculties = Faculty::with(['projects'])->get();
     $seriesA = [];
     foreach ($faculties as $f) {
         array_push($chart['labels'], $f->name_th);
         array_push($seriesA, $f->projects->count());
     }
     array_push($chart['data'], $seriesA);
     return $chart;
 }
コード例 #8
0
 public function doEdit(Request $request, $id)
 {
     $project_input = $request->get('project');
     $project = Project::find($id);
     if (!$project) {
         return redirect('backend/admin/project');
     }
     $project->fill($project_input);
     $project->faculty()->associate(Faculty::find($project_input['faculty']['id']));
     if ($project_input['status']['id'] != "") {
         $project->status()->associate(ProjectStatus::find($project_input['status']['id']));
     } else {
         $project->status()->associate(ProjectStatus::where('key', '=', 'draft')->first());
     }
     $project->save();
     return redirect('/backend/project');
 }
コード例 #9
0
 private function createUserFromSoap($username, $password)
 {
     $infoResult = $this->getUserInfoFromSoap($username, $password);
     $user = new User();
     $user->username = $username;
     $user->title = $infoResult->Title;
     $user->firstname = $infoResult->FirstName_TH;
     $user->lastname = $infoResult->LastName_TH;
     $user->email = $username . "@up.ac.th";
     //        $user->save();
     $faculty = Faculty::where('name_th', '=', $infoResult->Faculty)->first();
     if ($faculty) {
         $user->faculty_id = $faculty->id;
     }
     $user->save();
     $role = Role::where('key', '=', 'researcher')->first();
     $user->roles()->attach($role->id);
     $user->faculty;
     return $user;
 }
コード例 #10
0
 public function delete($id)
 {
     return [Faculty::find($id)->delete()];
 }
コード例 #11
0
ファイル: routes.php プロジェクト: pchaow/SuccessModel5
             $arrayRes[] = $value;
         }
         $query = $arrayRes;
         return $query;
     });
     Route::get('amphur/{id}/{name}', function ($id, $name) {
         $amphur = \App\Models\Thailand\Amphur::find($id);
         $query = Project::query();
         $query->where('amphur_id', '=', $id);
         $projects = $query->get();
         return ['projects' => $projects, 'amphur' => $amphur];
     });
 });
 Route::group(['prefix' => 'faculty', 'middleware' => ['cors']], function () {
     Route::get('/', function () {
         return \App\Models\Faculty::all();
     });
     Route::get('{id}/project', function ($id) {
         $projects = Project::whereHas('faculty', function ($q) use($id) {
             $q->where('id', '=', $id);
         })->with(['faculty'])->orderBy('created_at', 'desc')->get();
         return $projects;
     });
 });
 Route::group(['prefix' => 'project'], function () {
     Route::group(['middleware' => ['cors']], function () {
         Route::get('/', function () {
             return Project::with(['faculty'])->whereHas('status', function ($q) {
                 $q->where('key', '=', 'published');
             })->orderBy('created_at', 'desc')->get();
         });
コード例 #12
0
ファイル: Department.php プロジェクト: vetal06/diplom
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFaculty()
 {
     return $this->hasOne(Faculty::className(), ['id' => 'faculty_id']);
 }
コード例 #13
0
 /**
  * Finds the Faculty model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Faculty the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Faculty::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #14
0
 /**
  * Remove the specified Faculty from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $faculty = Faculty::find($id);
     if (file_exists(public_path("uploads/faculty/faculty_{$faculty->id}.jpg"))) {
         @unlink(public_path("uploads/faculty/faculty_{$faculty->id}.jpg"));
     }
     //delete education
     $faculty->education()->delete();
     //delete publication
     foreach ($faculty->publication as $publication) {
         $publication->researchArea()->sync([]);
     }
     $faculty->publication()->delete();
     //delete faculty
     $faculty->delete();
     Flash::success('Faculty deleted successfully.');
     return redirect('/admin/faculty');
 }
コード例 #15
0
 public function testSetFaculty()
 {
     $faculty = new Faculty();
     if ($faculty->getID() == null) {
         $faculty->setID("001-1100");
         $faculty->setAcadPos("Lecturer");
         $faculty->setDept("IT");
         $faculty->setCollege("SCS");
         $faculty->setSubjectSpec("Database");
     }
     if ($faculty->getID() == "001-1100") {
         $this->assertEquals("Lecturer", $faculty->getAcadPos());
         $this->assertEquals("IT", $faculty->getDept());
         $this->assertEquals("SCS", $faculty->getCollege());
         $this->assertEquals("Database", $faculty->getSubjectSpec());
     }
 }
コード例 #16
0
ファイル: index.php プロジェクト: RomarioLopezC/RobotSS
/* @var $searchModel app\models\SocialServiceManagerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Eliminar responsables de servicio social';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="social-service-manager-index">

    <div class="well well-sm">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'Nombre', 'value' => function ($dataProvider) {
    $user = User::findOne(['id' => $dataProvider->user_id]);
    $person = Person::findOne(['id' => $user->person_id]);
    return $person->name . ' ' . $person->lastname;
}], ['attribute' => 'Facultad', 'value' => function ($dataProvider) {
    $faculty = \app\models\Faculty::findOne(['id' => $dataProvider->faculty_id]);
    //$person = Person::findOne (['id' => $user->person_id]);
    return $faculty->name;
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'user_id' => $model['user_id']], ['title' => Yii::t('app', 'Delete'), 'data-confirm' => Yii::t('app', '¿Estas seguro que deseas eliminar?'), 'data-method' => 'post']);
}]]]]);
?>

</div>
コード例 #17
0
ファイル: form.blade.php プロジェクト: pchaow/SuccessModel5
                   value="{{$project->name_en}}">
        </div>

        <div class="field">
            <label>กอง/คณะ/วิทยาลัย ที่ดำเนินโครงการ</label>
            <div class="ui selection dropdown" tabindex="0">
                <input type="hidden" name="project[faculty][id]" value="{{$project->faculty_id}}">
                @if($project->faculty_id)
                    <div class="text">{{$project->faculty->name_th}}</div>
                @else
                    <div class="default text">กรุณาเลือก</div>
                @endif
                <i class="dropdown icon"></i>
                <div class="menu transition hidden" tabindex="-1">
                    <?php 
$faculties = \App\Models\Faculty::all();
?>
                    @foreach($faculties as $faculty)
                        <div class="item {{ $project->faculty_id == $faculty->id ? "active" : ""  }}"
                             data-value="{{$faculty->id}}">
                            {{$faculty->name_th}}
                        </div>
                    @endforeach

                </div>
            </div>
        </div>

        <div class="field">
            <label>ชื่อสถานที่</label>
            <input type="text" name="project[location]" placeholder="สถานที่ดำเนินโครงการ"
コード例 #18
0
 /**
  * Show the form for editing the specified ResearchGroup.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $researchGroup = ResearchGroup::find($id);
     $facultyList = Faculty::lists('name', 'id')->all();
     return view('admin.research_group.edit', compact('researchGroup', 'facultyList'));
 }
コード例 #19
0
 public function doDelete($id)
 {
     Faculty::find($id)->delete();
     return redirect('/backend/faculty');
 }
コード例 #20
0
ファイル: _form.php プロジェクト: RomarioLopezC/RobotSS
echo $form->field($user, 'email')->textInput();
?>

                    <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => true]);
?>

                    <?php 
if (Yii::$app->user->can('projectManager')) {
    echo $form->field($rol, 'organization')->textInput();
} else {
    if (Yii::$app->user->can('socialServiceManager')) {
        echo $form->field($rol, 'faculty_id')->dropDownList(ArrayHelper::map(Faculty::find()->all(), 'id', 'name'));
    } else {
        if (Yii::$app->user->can('student')) {
            echo $form->field($rol, 'faculty_id')->dropDownList(ArrayHelper::map(Faculty::find()->all(), 'id', 'name'));
            echo $form->field($rol, 'degree_id')->dropDownList(ArrayHelper::map(Degree::find()->all(), 'id', 'name'));
            echo $form->field($rol, 'current_semester')->textInput();
            echo $form->field($rol, 'enrollment_id')->textInput();
        }
    }
}
?>

                </div>

            </div>


            <div class="form-group">
                <?php 
コード例 #21
0
 /**
  * Display the specified Faculty.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $active = 'faculty';
     $faculty = Faculty::with(['journal', 'conference', 'education'])->findOrFail($id);
     return view('frontend.faculty.show', compact('active', 'faculty'));
 }