Пример #1
0
function fillDepartment(Department $department, array $people)
{
    foreach ($people as $value) {
        for ($i = 0; $i < $value[0]; $i++) {
            $department->addEmployee(new $value[1]($value[2]));
        }
    }
}
Пример #2
0
    /**
     * [start_el description]
     *
     * @param string $output Passed by reference. Used to append additional content.
     * @param object $elem Department data object.
     * @param int $depth Depth of Department. Used for padding.
     * @param int $current_page Department ID.
     * @param array $args
     *
     * @return void
     */
    public function start_el(&$output, $elem, $depth = 0, $args = array(), $id = 0)
    {
        static $alternate;
        $department = new Department($elem);
        $alternate = 'alternate' == $alternate ? 'even' : 'alternate';
        $padding = str_repeat('&#8212; ', $depth);
        ?>
        <tr class="<?php 
        echo $alternate;
        ?>
" id="erp-dept-<?php 
        echo $department->id;
        ?>
">
            <th scope="row" class="check-column">
                <input id="cb-select-1" type="checkbox" name="dept[]" value="1">
            </th>
            <td class="col-">

                <strong><a href="#"><?php 
        echo $padding . $department->name;
        ?>
</a></strong>

                <div class="row-actions">
                    <span class="edit"><a href="#" data-id="<?php 
        echo $department->id;
        ?>
" title="Edit this item"><?php 
        _e('Edit', 'wp-erp');
        ?>
</a> | </span>
                    <span class="trash"><a class="submitdelete" data-id="<?php 
        echo $department->id;
        ?>
" title="Delete this item" href="#"><?php 
        _e('Delete', 'wp-erp');
        ?>
</a></span>
                </div>
            </td>
            <td class="col-">
                <?php 
        if ($lead = $department->get_lead()) {
            echo $lead->get_link();
        } else {
            echo '-';
        }
        ?>
            </td>
            <td class="col-"><?php 
        echo $department->num_of_employees();
        ?>
</td>
        </tr>
        <?php 
    }
Пример #3
0
function installDepartments()
{
    global $departmentsData, $departments;
    foreach ($departmentsData as $departmenName) {
        $department = new Department();
        $department->setName($departmenName);
        //        $em->persist($department);
        $departments[$departmenName] = $department;
    }
}
Пример #4
0
 function list_drop()
 {
     $dept = new Department();
     $dept->get();
     foreach ($dept as $row) {
         $data[''] = '[ Pilih Departement ]';
         $data[$row->dept_name] = $row->dept_name;
     }
     return $data;
 }
Пример #5
0
 function getDepartmentList($compCode)
 {
     App::import("Model", "Department");
     $model = new Department();
     $con2 = $model->find('list', array('fields' => array('Department.dept_code', 'Department.dept_name'), 'conditions' => array('Department.comp_code' => $compCode)));
     if (empty($con2)) {
         return 0;
     } else {
         return $con2;
     }
 }
Пример #6
0
 private function fillTheDepartment(Department $department, $addToDepartment)
 {
     foreach ($addToDepartment as $item) {
         foreach ($item as $count => $employee) {
             for ($i = 0; $i < $count; $i++) {
                 $em = new $employee[0]($employee[1], $employee[2]);
                 $department->addEmployee($em);
             }
         }
     }
 }
Пример #7
0
 /**
  * Validate dep_uid
  * @var string $dep_uid. Uid for Departament
  * @var string $nameField. Name of field for message
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public static function depUid($dep_uid, $nameField = 'dep_uid')
 {
     $dep_uid = trim($dep_uid);
     if ($dep_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, '')));
     }
     $oDepartment = new \Department();
     if (!$oDepartment->existsDepartment($dep_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array($nameField, $dep_uid)));
     }
     return $dep_uid;
 }
Пример #8
0
 public function executeAdd(sfWebRequest $request)
 {
     if ($request->isMethod('Post')) {
         $department = new Department();
         $department->setTitle($request->getParameter('title'));
         //$department->setDescription($request->getParameter('description'));
         $department->setStatus(Constant::RECORD_STATUS_ACTIVE);
         $department->save();
         $this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_ADDED_SUCCESSFULLY);
         $this->redirect('Department/list');
     }
     //end if
 }
function department_list($id = null)
{
    if ($id) {
        $dept = new Department($id);
        $list = new Department();
        $list->where('parent_id', $id);
        $list->order_by('orders', 'asc');
        $list->get();
        child_personnel(0, $id, $dept->title);
        foreach ($list as $key_tmp => $tmp) {
            department_list($tmp->id);
        }
    }
}
Пример #10
0
 /**
  * index method
  *
  * @return void
  */
 public function index()
 {
     $this->layout = 'ajax';
     $limit = 5;
     $page = 2;
     $dept_id = null;
     // 		debug($page= $this->request);
     $page = $this->request->query['page'];
     $limit = $this->request->query['limit'];
     $this->Paginator->settings['page'] = $page;
     $this->Paginator->settings['limit'] = $limit;
     // 		$this->Paginator->settings =array('limit'=>$limit,'page'=>$page);
     if (isset($this->request->query['dept_number'])) {
         $dept_number = $this->request->query['dept_number'];
         App::import('Model', 'Department');
         App::import('Controller', 'Departments');
         $Department = new Department();
         $dept_id = $Department->findByDept_number($dept_number)['Department']['id'];
         $DepartmentsController = new DepartmentsController();
         $depts = $DepartmentsController->getChildren($dept_id);
         // 			debug($depts);
         $deptdata = array();
         foreach ($depts as $dept) {
             $deptdata[] = $dept['dept_number'];
         }
         $logdept = array();
         // 			debug(count($deptdata));
         for ($i = 0; $i < count($deptdata); $i++) {
             $logdept[] = array('logdept like' => $deptdata[$i] . '%');
         }
         if (count($depts) == 0) {
             $deptdata = $dept_number;
             $logdept = array('logdept like' => $deptdata . '%');
         }
         // 			debug($deptdata);
         $conditions = array('or' => array('dept_number' => $deptdata, 'or' => $logdept));
         // 			debug($conditions);
         $this->Paginator->settings = array('conditions' => $conditions);
     }
     if (isset($this->request->query['stu_name'])) {
         $qurey = $this->request->query['stu_name'];
         $conditions = array('or' => array('stu_name like' => '%' . $qurey . '%', 'stu_number like' => $qurey . '%', 'id_card_number like' => $qurey . '%', 'note like' => '%' . $qurey . '%'));
         $this->Paginator->settings = array('conditions' => $conditions);
     }
     $this->Paginator->settings['page'] = $page;
     $this->Paginator->settings['limit'] = $limit;
     $this->Student->recursive = 0;
     $this->set('students', $this->Paginator->paginate());
 }
Пример #11
0
 public function get_by_doctor($id)
 {
     $conn = $this->db->conn;
     try {
         $query = $conn->prepare("\n\t\t\t\t\t\t\t\t\t\tSELECT De.Acronim, De.ID, De.Image, C.Content as Name\n\t\t\t\t\t\t\t\t\t\tFROM Departments as De \n\t\t\t\t\t\t\t\t\t\tINNER JOIN DepartmentsDoctors as DD ON De.ID = DD.DepartmentID\n\t\t\t\t\t\t\t\t\t\tINNER JOIN Doctors as D ON DD.DoctorID = D.ID\n\t\t\t\t\t\t\t\t\t\tINNER JOIN Contents as C \n\t\t\t\t\t\t\t\t\t\tON De.NameContentID = C.ID \n\t\t\t\t\t\t\t\t\t\tWHERE D.ID = ? AND C.Lang = ? AND De.Active = 1\n\t\t\t\t\t\t\t\t\t");
         $query->execute(array($id, $this->db->lang));
     } catch (PDOException $e) {
         echo "Error: " . $e;
     }
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $department = new Department($this->db);
         $department->update_class($row);
         array_push($this->departments, $department);
     }
 }
Пример #12
0
 public function editAction()
 {
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         if (empty($data)) {
             $this->pageError('param');
         }
         $modelForm = new DepartmentForm('edit');
         if ($result = $modelForm->validate($data)) {
             if ($modelForm->edit()) {
                 $this->success('操作成功');
             } else {
                 $this->error('操作失败');
             }
         }
         $this->error($result);
     }
     $oid = $this->dispatcher->getParams()[0];
     if (empty($oid)) {
         $this->pageError('param');
     }
     $operator = Department::findById($oid);
     if (!$operator) {
         $this->pageError('param');
     }
     $form = new DepartmentForm('edit', $operator);
     $this->view->setVars(['formparams' => ['event' => 'edit', 'action' => \Func\url('/department/edit')], 'data' => $operator]);
     $this->view->pick('department/add');
 }
Пример #13
0
 public function actionForm($id = null)
 {
     if (Yii::app()->session["username"] != null) {
         $this->layout = "main";
     } else {
         $this->layout = "front";
     }
     $model = new Department();
     if (!empty($_POST["Department"])) {
         // 1.step new Department
         $model = new Department();
         // 2.step edit Department
         if (!empty($id)) {
             $model = Department::model()->findByPk($id);
         }
         // 3. step merge data
         $model->_attributes = $_POST["Department"];
         // 6. step save/update
         if ($model->save()) {
             $this->redirect("index.php?r=department");
         }
     }
     if (!empty($id)) {
         $model = Department::model()->findByPk($id);
     }
     $this->render("//department/form", array("model" => $model));
 }
Пример #14
0
 public static function checkReadScope($uid, $data)
 {
     if ($data["deptid"] == "alldept") {
         return true;
     }
     if ($uid == $data["author"]) {
         return true;
     }
     if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
         return true;
     }
     $user = User::model()->fetch(array("select" => array("deptid", "positionid"), "condition" => "uid=:uid", "params" => array(":uid" => $uid)));
     $childDeptid = Department::model()->fetchChildIdByDeptids($data["deptid"]);
     if (StringUtil::findIn($user["deptid"], $childDeptid . "," . $data["deptid"])) {
         return true;
     }
     $childCcDeptid = Department::model()->fetchChildIdByDeptids($data["ccdeptid"]);
     if (StringUtil::findIn($user["deptid"], $childCcDeptid . "," . $data["ccdeptid"])) {
         return true;
     }
     if (StringUtil::findIn($data["positionid"], $user["positionid"])) {
         return true;
     }
     if (StringUtil::findIn($data["uid"], $uid)) {
         return true;
     }
     if (StringUtil::findIn($data["ccpositionid"], $user["positionid"])) {
         return true;
     }
     if (StringUtil::findIn($data["ccuid"], $uid)) {
         return true;
     }
     return false;
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Department::create([]);
     }
 }
Пример #16
0
/**
 * Determines ownership of the cabinet and returns the CSS class in case a
 * color unequal white is assigned to the owner
 *
 * @param 	Cabinet 	$cabinet
 * @param 	array 		&$deptswithcolor
 * @return 	string		CSS class or empty string
 */
function get_cabinet_owner_color($cabinet, &$deptswithcolor)
{
    $cab_color = '';
    if ($cabinet->AssignedTo != 0) {
        $tempDept = new Department();
        $tempDept->DeptID = $cabinet->AssignedTo;
        $deptid = $tempDept->DeptID;
        $tempDept->GetDeptByID();
        if (strtoupper($tempDept->DeptColor) != "#FFFFFF") {
            $deptswithcolor[$cabinet->AssignedTo]["color"] = $tempDept->DeptColor;
            $deptswithcolor[$cabinet->AssignedTo]["name"] = $tempDept->Name;
            $cab_color = "class=\"dept{$deptid}\"";
        }
    }
    return $cab_color;
}
 public function loadModel($id)
 {
     if (($model = Department::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('units', function (Blueprint $table) {
         //
         $departmentlist = Department::whereHas('programs', function ($q) {
             $q->whereNotIn('programid', array(62, 66, 38, 22));
             $q->where('degreelevel', 'U');
         })->get();
         foreach ($departmentlist as $department) {
             $unitname = $department->unitname;
             if (strpos($unitname, 'Department of') !== false) {
                 $unitname = str_replace("Department of ", "", $unitname);
                 $unitname = substr_replace($unitname, " Department", strlen($unitname), 0);
             }
             $department->unitname = $unitname;
             $department->save(['timestamps' => false]);
         }
         foreach ($departmentlist as $department) {
             $unitname = $department->unitname;
             if (strpos($unitname, ' Department') !== false) {
                 $unitname = str_replace(" Department", "", $unitname);
                 $unitname = substr_replace($unitname, "Department of ", 0, 0);
             }
             $department->unitname = $unitname;
             $department->save(['timestamps' => false]);
         }
     });
 }
Пример #19
0
 public static function getShowData($data)
 {
     $data["subject"] = stripslashes($data["subject"]);
     if (!empty($data["author"])) {
         $data["authorDeptName"] = Department::model()->fetchDeptNameByUid($data["author"]);
     }
     if ($data["approver"] != 0) {
         $data["approver"] = User::model()->fetchRealNameByUid($data["approver"]);
     } else {
         $data["approver"] = Ibos::lang("None");
     }
     $data["addtime"] = ConvertUtil::formatDate($data["addtime"], "u");
     $data["uptime"] = empty($data["uptime"]) ? "" : ConvertUtil::formatDate($data["uptime"], "u");
     $data["categoryName"] = ArticleCategory::model()->fetchCateNameByCatid($data["catid"]);
     if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
         $data["departmentNames"] = Ibos::lang("All");
         $data["positionNames"] = $data["uidNames"] = "";
     } elseif ($data["deptid"] == "alldept") {
         $data["departmentNames"] = Ibos::lang("All");
         $data["positionNames"] = $data["uidNames"] = "";
     } else {
         $department = DepartmentUtil::loadDepartment();
         $data["departmentNames"] = ArticleUtil::joinStringByArray($data["deptid"], $department, "deptname", "、");
         $position = PositionUtil::loadPosition();
         $data["positionNames"] = ArticleUtil::joinStringByArray($data["positionid"], $position, "posname", "、");
         if (!empty($data["uid"])) {
             $users = User::model()->fetchAllByUids(explode(",", $data["uid"]));
             $data["uidNames"] = ArticleUtil::joinStringByArray($data["uid"], $users, "realname", "、");
         } else {
             $data["uidNames"] = "";
         }
     }
     return $data;
 }
Пример #20
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $departmentlist = Department::whereHas('programs', function ($q) {
         $q->whereNotIn('programid', array(62, 66, 38));
         $q->where('degreelevel', 'U');
     })->get();
     $collegelist = [];
     foreach ($departmentlist as $department) {
         array_push($collegelist, $department->college);
     }
     $collegelist = array_unique($collegelist);
     //Average students per program
     $collegeAveArray = [];
     foreach ($collegelist as $college) {
         $unitname = substr_replace($college->unitname, "\n", 11, 0);
         //if colllege of allied medical professsions
         if ($college->unitid === 9) {
             $unitname = substr_replace($college->unitname, "\n", 18, 0);
         }
         $collStudents = round($college->getAveStudents(), 2);
         $collegeAveArray[$unitname] = $collStudents;
         $collAttrition = $college->getAveAttrition();
         $collegeAveAttritionArray[$unitname] = $collAttrition;
     }
     //return page
     return View::make('college.college', ['collegelist' => $collegelist, 'collegeAveArray' => $collegeAveArray, 'collegeAveAttritionArray' => $collegeAveAttritionArray]);
 }
Пример #21
0
 public static function getDepartmentPermissions($department_id)
 {
     $department = Department::find($department_id);
     $permissions_keys = explode(",", $department->permissions);
     $permissions = Permissions::whereIn('key', $permissions_keys)->get();
     return $permissions;
 }
 /**
  * Show the form for creating a new resource.
  * GET /users/create
  *
  * @return Response
  */
 public function create()
 {
     $pagetitle = 'Create User';
     $departments = Department::orderBy('department')->lists('department', 'id');
     $roles = Role::orderBy('name')->lists('name', 'id');
     return View::make('user.create', compact('pagetitle', 'departments', 'roles'));
 }
Пример #23
0
 public function getMyprofile()
 {
     $id = Auth::user()->id;
     $alumni_id = null;
     $sql = "SELECT * FROM alumni WHERE account_id = ?";
     $prof = DB::select($sql, array($id));
     if ($prof != null) {
         $alumni_id = $prof[0]->id;
     }
     $sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
     $deg = DB::select($sql2, array($alumni_id));
     $sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
     $wrk_exp = DB::select($sql3, array($alumni_id));
     $sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
     $certificate = DB::select($sql4, array($alumni_id));
     // $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
     $sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
     $a_tracer = DB::select($sql5, array($alumni_id));
     $dept = Department::all();
     $region = Region::all();
     $province = Province::all();
     $occupation = Occupation::all();
     $company = Company::all();
     $deg_title = DegreeTitle::all();
     $school = School::all();
     $jobs = Job::all();
     $field = Field::all();
     $questions = DB::select("SELECT * FROM survey_questions");
     $civil_status = DB::select("SELECT * FROM civil_status");
     return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
 }
Пример #24
0
 public function indexAction()
 {
     $departments = Department::find();
     $this->view->departments = $departments;
     $employees = Employee::find();
     $this->view->employees = $employees;
 }
Пример #25
0
 /**
  * Start test
  */
 public function startIndexAction()
 {
     Assets::reset()->add('main');
     $token = $this->getToken();
     if (!$token) {
         return Redirect::route('info')->with('message', 'Токен не найден');
     }
     if ($token->status == Token::TOKEN_STATUS_EMPTY) {
         /**
          * вывести форму где пользователь введёт свои данные
          */
         $departments = Department::all();
         $groups = Group::all();
         $selectedDepartments = array();
         $selectGroups = array();
         $selectedDepartments[] = 'Не выбран';
         $selectGroups[] = 'Не выбран';
         foreach ($departments as $department) {
             $selectedDepartments[$department->id] = $department->name;
         }
         foreach ($groups as $group) {
             $selectGroups[$group->id] = $group->name;
         }
         return View::make('test.start', ['token' => $token, 'departments' => $selectedDepartments, 'groups' => $selectGroups]);
     } elseif ($token->status == Token::TOKEN_STATUS_STARTED) {
         if ($this->isTokenValid($token)) {
             return Redirect::route('test.index');
         } else {
             Session::forget('token_string');
             $token->status = Token::TOKEN_STATUS_EXPIRED;
             $token->save();
             return Redirect::route('info')->with('message', 'Время теста истекло');
         }
     }
 }
Пример #26
0
 public function postGeneral($id)
 {
     $id = Crypt::decrypt($id);
     $request = RRequest::find($id);
     if (Input::has('save')) {
         if (Input::get('employee') == 0 || Input::get('organization') == 0 || Input::get('r_plan') == 0 || Input::get('specialist') == 0 || strlen(Input::get('title')) < 2 || strlen(Input::get('description')) < 2) {
             Session::flash('sms_warn', trans('sta.require_field'));
         } else {
             $request->request_by_id = Input::get('employee');
             $request->for_organization_id = Input::get('organization');
             $request->for_planning_id = Input::get('r_plan');
             $request->to_department_id = Input::get('specialist');
             $request->request_title = Input::get('title');
             $request->description = Input::get('description');
             $request->request_date = date('Y-m-d');
             $request->created_by = Auth::user()->employee_id;
             if ($request->save()) {
                 Session::flash('sms_success', trans('sta.save_data_success'));
                 //return Redirect::to('branch_request/general/' . Crypt::encrypt($request->id));
             }
         }
     }
     $organizations = $this->array_list(Organization::list_item());
     $employees = $this->array_list(Employee::list_item());
     $department = $this->array_list(Department::list_item());
     $r_plans = $this->array_list(Rplan::list_item());
     return View::make('branch_request.edit_general', array('id' => $id, 'organizations' => $organizations, 'employees' => $employees, 'specialist' => $department, 'r_plans' => $r_plans, 'request' => $request));
 }
Пример #27
0
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function all()
 {
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->orderBy('id', 'desc')->get();
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->where('operator_id', Auth::user()->id)->orderBy('id', 'desc')->get();
     } else {
         $messages = CannedMessages::orderBy('id', 'desc')->get();
     }
     foreach ($messages as $message) {
         $operator = User::find($message->operator_id);
         $department = Department::find($message->department_id);
         $company = Company::find($message->company_id);
         $message->operator = $operator;
         $message->department = $department;
         $message->company = $company;
     }
     $this->data['messages'] = $messages;
     return View::make('canned_messages.all', $this->data);
 }
 public function detail()
 {
     $department = Department::find(Input::get('department_id'));
     if ($department) {
         $this->set_template('hospital.department.detail');
         $this->set_data(array('name' => $department->name, 'photo' => $department->photo, 'content' => $department->description));
         // Json response:
         //     Remove html tags
         $this->set_postprocess_function('json', function ($result, $status) {
             if ($status) {
                 $result['content'] = strip_tags($result['content']);
             }
             return $result;
         });
         // Html response:
         //     add some information
         $this->set_postprocess_function('html', function ($result, $status) use($department) {
             if ($status) {
                 $chief_doctor = $department->doctors()->where('is_chief', true)->first();
                 $hospital_name = $department->hospital()->first()->name;
                 $result['photo'] = $department->photo;
                 $result['hospital_name'] = $hospital_name;
                 if (isset($chief_doctor)) {
                     $result['doctor'] = array('photo' => $chief_doctor->photo, 'description' => $chief_doctor->description, 'specialty' => $chief_doctor->specialty);
                 }
             }
             return $result;
         });
     } else {
         $this->set_error_code($this->not_found_error_code);
     }
     return $this->response();
 }
Пример #30
-7
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Departments', GridField::create('Department', 'Departments', Department::get()->sort('Title'), GridFieldConfig_RecordEditor::create()));
     $fields->addFieldToTab('Root.Roles', GridField::create('Role', 'Roles', Role::get()->sort('Title'), GridFieldConfig_RecordEditor::create()));
     return $fields;
 }