Пример #1
0
 public function getAll()
 {
     return Department::find()->asArray()->all();
 }
Пример #2
0
use yii\helpers\Html;
//use yii\widgets\ActiveForm;
use kartik\widgets\ActiveForm;
use app\models\Position;
use yii\helpers\ArrayHelper;
use app\models\Department;
/* @var $this yii\web\View */
/* @var $model app\models\Staff */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="staff-form">
	<?php 
$Position = Position::find()->all();
$arraypos = ArrayHelper::map($Position, 'positio_id', 'position_name');
$Department = Department::find()->all();
$arraydep = ArrayHelper::map($Department, 'department_id', 'department_name');
// echo '<pre>';
// 	print_r($arraypos);
// echo '<pre>';
?>

    <?php 
$form = ActiveForm::begin();
?>

     <?php 
echo $form->field($model, 'position_id')->dropDownList($arraypos, ['prompt' => '--Select--']);
?>

    <?php 
Пример #3
0
<div class="digital-form">

    <?php 
$form = ActiveForm::begin();
?>

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

    <?php 
echo $form->field($model, 'date_work')->widget(DatePicker::className(), ['options' => ['class' => 'form-control'], 'language' => 'th', 'dateFormat' => 'yyyy-MM-dd']);
?>

    <?php 
echo $form->field($model, 'department_id')->dropDownList(ArrayHelper::map(Department::find()->all(), 'id', 'name'), ['prompt' => 'เลือกหน่วยงาน']);
?>

    <?php 
echo $form->field($model, 'subject')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'num_pages')->textInput();
?>

    <?php 
echo $form->field($model, 'paper_type')->textInput();
?>

    <?php 
Пример #4
0
 /**
  * Select choices for department_id (ycm)
  *
  * @return array
  */
 public function department_idChoices()
 {
     return ArrayHelper::map(Department::find()->orderBy('name ASC')->all(), 'id', 'name');
 }
Пример #5
0
 public function actionList()
 {
     $model = Department::find()->all();
     return $this->renderPartial('list', ['model' => $model]);
 }
Пример #6
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model app\models\Employee */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="employee-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'Department_id')->dropDownList(ArrayHelper::map(Department::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'Chief_id')->dropDownList(ArrayHelper::map(Employee::find()->all(), 'id', 'Name'));
?>

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

    <?php 
echo $form->field($model, 'Salary')->textInput();
?>

    <div class="form-group">
Пример #7
0
 public function actionAppointment()
 {
     $listDepartment = ArrayHelper::map(Department::find()->where('enabled<>0')->all(), 'id', 'name');
     $listChannel = ArrayHelper::map(Channel::find()->where('enabled<>0')->all(), 'id', 'name');
     $listDoctor = ArrayHelper::map(Doctor::find()->where('enabled<>0')->all(), 'id', 'name');
     $listUser = ArrayHelper::map(User::find()->where('enabled<>0')->all(), 'id', 'username');
     return $this->render('appointment', ['model' => new Record(), 'listDepartment' => $listDepartment, 'listChannel' => $listChannel, 'listDoctor' => $listDoctor, 'listUser' => $listUser]);
 }
Пример #8
0
 /**
  * @param UpdateUserRequest $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(UpdateUserRequest $request, $id)
 {
     $user = $this->user->find($id);
     // Get all attribute from the request.
     $attributes = $request->all();
     if ($attributes['password'] == '') {
         unset($attributes['password']);
     }
     // Get a copy of the attributes that we will modify to save for a replay.
     $replayAtt = $attributes;
     // Add the id of the current user for the replay action.
     $replayAtt["id"] = $id;
     // Create log entry with replay data.
     $tmp = Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-update', ['username' => $user->username]), $replayAtt, "App\\Http\\Controllers\\UsersController::ParseUpdateAuditLog", "admin.users.replay-edit");
     if (!$user->isEditable()) {
         abort(403);
     }
     if (array_key_exists('selected_roles', $attributes)) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     }
     $user->update($attributes);
     /*
      * Assign the new user's active cluster
      */
     $user->activateCluster($attributes['activeCluster']);
     /*
      * Assign the department
      */
     $department = Department::find($attributes['department']);
     $department->users()->save($user);
     $user->save();
     alert()->success(trans('admin/users/general.status.updated'));
     return redirect('/admin/users');
 }
Пример #9
0
 protected function deptDataProvider()
 {
     $dp = new ActiveDataProvider(['query' => Department::find(), 'sort' => false]);
     return $dp;
 }
Пример #10
0
 /**
  * 查询听课列表
  * @author FuRongxin
  * @date    2016-05-17
  * @version 2.1
  * @param   \Illuminate\Http\Request $request 听课查询请求
  * @return  \Illuminate\Http\Response 听课列表
  */
 public function search(Request $request)
 {
     $departments = Department::where('dw', '<>', '')->whereLx('1')->whereZt(config('constants.status.enable'))->orderBy('dw')->get();
     $title = session('year') . '年度' . Term::find(session('term'))->mc . '学期' . '听课查询';
     $courses = [];
     if ($request->isMethod('post')) {
         $this->validate($request, ['department' => 'required', 'week' => 'required', 'class' => 'required']);
         $input = $request->all();
         $query = Timetable::with(['classroom' => function ($query) {
             $query->select('jsh', 'mc');
         }, 'user' => function ($query) {
             $query->select('jsgh', 'xm', 'zc');
         }, 'user.position', 'campus'])->whereNd(session('year'))->whereXq(session('term'))->whereZc($input['week'])->where('ksj', '<=', $input['class'])->where('jsj', '>=', $input['class']);
         $kcxhs = Mjcourse::whereNd(session('year'))->whereXq(session('term'))->whereKkxy($input['department'])->select('kcxh')->distinct()->get()->pluck('kcxh');
         $query = $query->whereIn('kcxh', $kcxhs);
         $results = $query->get();
         foreach ($results as $result) {
             $courses[] = ['kcmc' => Course::find(Helper::getCno($result->kcxh))->kcmc, 'xqh' => $result->campus->mc, 'jsmc' => count($result->classroom) ? $result->classroom->mc : '', 'kkxy' => count($result->mjcourse) ? $result->mjcourse->college->mc : '', 'xy' => count($result->mjcourse) ? $result->mjcourse->major->college->mc : '', 'zy' => count($result->mjcourse) ? $result->mjcourse->major->mc : '', 'nj' => count($result->mjcourse) ? $result->mjcourse->nj : '', 'rs' => Selcourse::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($result->kcxh)->count(), 'jsxm' => $result->user->xm, 'jszc' => $result->user->position->mc];
         }
         $department_name = 'all' == $input['department'] ? '所有学院' : Department::find($input['department'])->mc;
         $week_name = 'all' == $input['week'] ? '所有周次' : '星期' . config('constants.week.' . $input['week']);
         $class_name = '第 ' . $input['class'] . ' 节课';
         $subtitle = '查询条件:' . $department_name . $week_name . $class_name;
     }
     return view('timetable.search', compact('title', 'departments', 'courses', 'subtitle'));
 }
Пример #11
0
?>

<div class="box box-info">
    <div class="box-header with-border">
        
            <?php 
$form = ActiveForm::begin();
?>

            <?php 
$dataCategory = ArrayHelper::map(Computer::find()->select(['id', 'concat("COMID: ",id, " หมายเลข: " ,code) as name'])->asArray()->all(), 'id', 'name');
echo $form->field($model, 'com_id')->widget(Select2::classname(), ['data' => $dataCategory, 'options' => ['placeholder' => '----- อุปกรณ์คอมพิวเตอร์ -------']]);
?>

            <?php 
$dataCategory = ArrayHelper::map(Department::find()->asArray()->all(), 'id', 'name');
echo $form->field($model, 'dep_id')->widget(Select2::classname(), ['data' => $dataCategory, 'options' => ['placeholder' => '----- เลือกฝ่าย -------']]);
?>


            <?php 
echo $form->field($model, 'datein')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE]);
?>

            <?php 
echo $form->field($model, 'dateout')->widget(DateControl::classname(), ['value' => '20-11-2015', 'type' => DateControl::FORMAT_DATE, 'displayFormat' => 'php: d-m-yy']);
?>

            <div class="form-group">
                <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
Пример #12
-1
 public function edit(ShiftRequest $request, Shift $shift)
 {
     $this->authorize('edit-shift');
     $input = $request->all();
     $department = Department::find($input['department_id']);
     // Convert roles into JSON
     $input['roles'] = json_encode($input['roles']);
     // Check if the current roles match the department roles
     if ($input['roles'] == $department->roles) {
         // Unset the roles, use department as default instead
         unset($input['roles']);
     }
     // Make sure dates and times are set properly and formatted
     $input = Shift::setDates($department, $input);
     $input = Shift::setTimes($input);
     $shift->formatTimes();
     // Check if the start time, end time, or duration are changing
     $regenerateSlots = false;
     if ($shift->start_date != $input['start_date'] || $shift->end_date != $input['end_date'] || $shift->start_time != $input['start_time'] || $shift->end_time != $input['end_time'] || $shift->duration != $input['duration']) {
         $regenerateSlots = true;
     }
     $shift->update($input);
     // Regenerate slots after the updated shift information is saved
     if ($regenerateSlots) {
         Slot::generate($shift);
     }
     event(new EventChanged($shift->event, ['type' => 'shift', 'status' => 'edited']));
     $request->session()->flash('success', 'Shift has been updated.');
     return redirect('/event/' . $shift->event->id);
 }
Пример #13
-1
 public function programs($id, $results = null)
 {
     $departments = null;
     if ($results == null) {
         $departments = Department::find($id)->programs()->get();
     } else {
         $departments = Department::find($id)->programs()->paginate($results);
     }
     return Response::json($departments);
 }
Пример #14
-1
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Department::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(['ID' => $this->ID, 'fac_ID' => $this->fac_ID]);
     $query->andFilterWhere(['like', 'deptName', $this->deptName])->andFilterWhere(['like', 'deptCode', $this->deptCode]);
     return $dataProvider;
 }