public static function index() { return function ($request, $response) { $models = Company::all(); $response->json($models->as_array()); }; }
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); }
public function create() { if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) { $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first(); $this->data['department'] = Department::where('id', $department_admin->department_id)->first(); $this->data["company"] = Company::where('id', $this->data['department']->company_id)->first(); } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) { $department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first(); $this->data['department'] = Department::where('id', $department_operator->department_id)->first(); $this->data["company"] = Company::where('id', $this->data['department']->company_id)->first(); } elseif (\KodeInfo\Utilities\Utils::isCustomer(Auth::user()->id)) { $company_customer = CompanyCustomers::where('customer_id', Auth::user()->id)->first(); $this->data['company'] = Company::where('id', $company_customer->company_id)->first(); $this->data["operator"] = User::where('id', Auth::user()->id)->first(); $this->data['departments'] = Department::where('company_id', $company_customer->company_id)->get(); } else { $companies = Company::all(); if (sizeof($companies) > 0) { $departments = Department::where('company_id', $companies[0]->id)->get(); } else { $departments = []; } $this->data['companies'] = $companies; $this->data['departments'] = $departments; } return View::make('tickets.create', $this->data); }
public static function apiAll() { if (!Auth::user()->isAdmin()) { return [Company::find(Auth::user()["company_id"])]; } else { return Company::all(); } }
public function testOptionsForAllCompanies() { $options = array('count' => 1); self::createTestCompany(); self::createTestCompany(); $companies = Company::all($options); $this->assertSame(1, count($companies)); }
public function company() { $ids = DB::table('tblCustCompany')->select('strCustCompanyID')->orderBy('created_at', 'desc')->orderBy('strCustCompanyID', 'desc')->take(1)->get(); $ID = $ids["0"]->strCustCompanyID; $newID = $this->smartCounter($ID); $company = Company::all(); $reason = ReasonCompany::all(); $company = DB::table('tblCustCompany')->leftJoin('tblReasonCompany', 'tblCustCompany.strCustCompanyID', '=', 'tblReasonCompany.strInactiveCompanyID')->select('tblCustCompany.*', 'tblReasonCompany.strInactiveCompanyID', 'tblReasonCompany.strInactiveReason')->orderBy('created_at')->get(); return View::make('customerCompany')->with('company', $company)->with('reason', $reason)->with('newID', $newID); }
public function edit($id) { try { $this->data["user"] = User::findOrFail($id); $company_id = CompanyCustomers::where("customer_id", $this->data["user"]->id)->pluck('company_id'); $this->data["user"]->company = Company::find($company_id); $this->data["countries"] = DB::table("countries")->remember(60)->get(); $this->data["companies"] = Company::all(); $this->data['timezones'] = Config::get("timezones"); return View::make('customers.edit', $this->data); } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { Session::flash("error_msg", trans('msgs.customer_not_found')); return Redirect::to("/customers/all"); } }
public function edit($id) { $companies = Company::all(); $this->data['operator'] = User::find($id); $department_id = OperatorsDepartment::where('user_id', $this->data["operator"]->id)->pluck("department_id"); $department = Department::find($department_id); $this->data['company_id'] = $department->company_id; $this->data['department_id'] = $department->id; $permissions_keys = explode(",", $department->permissions); $permissions = Permissions::whereIn('key', $permissions_keys)->get(); $this->data['permissions'] = $permissions; $this->data['operator_permissions'] = explode(",", $this->data['operator']->permissions); $this->data['departments'] = Department::where("company_id", $department->company_id)->get(); $this->data['companies'] = $companies; $this->data["countries"] = DB::table("countries")->remember(60)->get(); $this->data['timezones'] = Config::get("timezones"); return View::make('operators.edit', $this->data); }
public function edit($department_admin_id) { $companies = Company::all(); $user = User::find($department_admin_id); if (sizeof(DepartmentAdmins::where('user_id', $user->id)->get()) > 0) { $department_id = DepartmentAdmins::where('user_id', $user->id)->pluck("department_id"); } else { $department_id = 0; } $this->data['department_id'] = $department_id; $this->data['company_id'] = CompanyDepartmentAdmins::where("user_id", $department_admin_id)->pluck("company_id"); $this->data['departments'] = Department::where("company_id", $this->data['company_id'])->get(); $this->data['user'] = $user; $this->data['user']->company = Company::find($this->data['company_id']); $this->data['companies'] = $companies; $this->data["countries"] = DB::table("countries")->remember(60)->get(); $this->data['timezones'] = Config::get("timezones"); return View::make('department_admins.edit', $this->data); }
$user->position = $posty['position']; if (isset($posty['update_pass']) && $posty['update_pass'] != '0') { $user->encrypted_password = md5($posty['update_pass']); } $user->save(); $app->response->setStatus(200); } else { $app->response->setStatus(401); } }); $app->get('/company', function () use($app) { //Users are allowed to see companies they belong to. //Super-Admins see everything. $all_roles = get_company_membership(); $role_super = $app->jwt->role_super; $companies = \Company::all(); //index by company ID if (sizeof($companies) > 0) { foreach ($companies as $company) { if ($role_super == 1 || in_array($company->id, $all_roles)) { $indexed_companies[$company->id] = $company; } } } $app->response->setStatus(200); echo json_encode($indexed_companies); }); $app->post('/company', function () use($app) { //must be admin or superadmin $posty = $app->request->post(); $is_admin = in_array($posty['id'], $app->jwt->role_admin);
/** * [postData - handle posted data] * @return [json] [DT compatible object] */ public function postData() { $Model = $this->modelName; // Build our Editor instance and process the data coming from _POST global $db; $data = Editor::inst($db, 'projects')->fields(Field::inst('projects.id'), Field::inst('projects.company_id'), Field::inst('companies.bedrijfsnaam'), Field::inst('projects.name'), Field::inst('projects.description'), Field::inst('projects.comment'), Field::inst('projects.status'), Field::inst('projects.jira_id'))->leftJoin('companies', 'companies.id', '=', 'projects.company_id')->process($_POST)->data(); $data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']); return Response::json($data); }
public function all() { $this->data['companies'] = Company::all(); $this->data['permissions'] = Permissions::all(); return View::make('companies.all', $this->data); }
public function transfer($onlineusers_id) { $online_users = OnlineUsers::find($onlineusers_id); $companies = Company::all(); $this->data['operators'] = []; if (sizeof($companies) > 0) { $departments = Department::where('company_id', $online_users->company_id)->get(); $department_ids = Department::where('company_id', $online_users->company_id)->lists('id'); if (sizeof($department_ids) > 0) { $operator_ids = OperatorsDepartment::whereIn('department_id', $department_ids)->lists('user_id'); if (sizeof($operator_ids) > 0) { $this->data['operators'] = User::whereIn('id', $operator_ids)->get(); } } } else { $departments = []; } $this->data['companies'] = $companies; $this->data['departments'] = $departments; $this->data['online_users'] = $online_users; $this->data['company_id'] = $online_users->company_id; $this->data['department_id'] = $online_users->department_id; $this->data['customer'] = User::find($online_users->user_id); return View::make('conversations.transfer', $this->data); }
/** * [postData - handle posted data] * @return [json] [DT compatible object] */ public function postData() { $Model = $this->modelName; //error_log(json_encode($_POST)); // Build our Editor instance and process the data coming from _POST global $db; $data = Editor::inst($db, 'worklogs')->fields(Field::inst('worklogs.id'), Field::inst('worklogs.date'), Field::inst('worklogs.company_id'), Field::inst('companies.bedrijfsnaam'), Field::inst('worklogs.project_id'), Field::inst('projects.name'), Field::inst('worklogs.strippenkaarten_id'), Field::inst('worklogs.user_id'), Field::inst('users.username'), Field::inst('worklogs.minutes')->validator('Validate::notEmpty'), Field::inst('worklogs.description'), Field::inst('worklogs.comment'), Field::inst('worklogs.billable')->validator('Validate::boolean'), Field::inst('worklogs.processed')->validator('Validate::boolean'))->leftJoin('users', 'users.id', '=', 'worklogs.user_id')->leftJoin('companies', 'companies.id', '=', 'worklogs.company_id')->leftJoin('projects', 'projects.id', '=', 'worklogs.project_id')->leftJoin('strippenkaarten', 'strippenkaarten.id', '=', 'worklogs.strippenkaarten_id')->process($_POST)->data(); $data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']); $data['projects'] = Project::all(['id AS value', 'name AS label']); $data['users'] = User::all(['id AS value', 'username AS label']); $data['strippenkaarten'] = Strippenkaart::where('expiry_date', '=', null)->get(['id AS value', 'hours AS label']); return Response::json($data); }
function index() { if (\KodeInfo\Utilities\Utils::isCustomer(Auth::user()->id)) { return Redirect::to('/tickets/customer/all'); } $past_hr = \Carbon\Carbon::now()->subHour(); $today = \Carbon\Carbon::now()->subDay(); $this_week = \Carbon\Carbon::now()->subWeek(); $this_month = \Carbon\Carbon::now()->subMonth(); 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(); $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_total'] = sizeof(DB::table('tickets')->get()); $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get()); $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get()); $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get()); $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id'); if (sizeof($operator_ids) > 0) { $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get()); $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get()); } else { $department->operators_online = 0; $department->operators_offline = 0; } $this->data['department_stats'] = $department; } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) { $department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first(); $department = Department::where('id', $department_operator->department_id)->first(); $company = Company::where('id', $department->company_id)->first(); $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count(); $this->data['tickets_total'] = sizeof(DB::table('tickets')->get()); $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get()); $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get()); $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get()); $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id'); if (sizeof($operator_ids) > 0) { $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get()); $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get()); } else { $department->operators_online = 0; $department->operators_offline = 0; } $this->data['department_stats'] = $department; } else { $this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->count(); $this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->count(); $this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->count(); $this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->count(); $this->data['tickets_total'] = sizeof(DB::table('tickets')->get()); $companies = Company::all(); foreach ($companies as $company) { $departments = Department::where('company_id', $company->id)->get(); foreach ($departments as $department) { $department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get()); $department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get()); $department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get()); $operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id'); if (sizeof($operator_ids) > 0) { $department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get()); $department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get()); } else { $department->operators_online = 0; $department->operators_offline = 0; } } $company->departments = $departments; } $this->data['department_stats'] = $companies; } return View::make('index', $this->data); }
/** * [postModelData - handle company specific posted subscriptions data] * @param [Eloquent model] $model [company model] * @return [json] [DT compatible object] */ public function postModelData($model) { $Model = $this->modelName; if (isset($_POST["data"]) && !empty($_POST["data"])) { $tot_price_str = $_POST['data']['subscriptions']['total_price']; if (empty($tot_price_str)) { $subs_id = (int) $_POST['data']['subscriptions']['id']; $subscription = Subscription::find($subs_id); $tot_price_str = $this->subscriptionTotalPrice($_POST['data']['subscriptions']['subscription_start'], $_POST['data']['subscriptions']['subscription_end'], $_POST['data']['subscriptions']['invoice_periods_id'], $_POST['data']['subscriptions']['price']); $_POST['data']['subscriptions']['total_price'] = $tot_price_str; } //error_log("Le POST".json_encode($_POST['data']['subscriptions']['total_price'])); } // Build our Editor instance and process the data coming from _POST global $db; $data = Editor::inst($db, 'subscriptions')->fields(Field::inst('subscriptions.id'), Field::inst('subscriptions.company_id'), Field::inst('service_categories.id'), Field::inst('service_categories.name'), Field::inst('subscriptions.service_id'), Field::inst('services.name'), Field::inst('subscriptions.description'), Field::inst('subscriptions.price'), Field::inst('subscriptions.total_price'), Field::inst('subscriptions.subscription_start'), Field::inst('subscriptions.subscription_end')->validator(function ($val, $data, $opts) { $date_start = strtotime($data['subscriptions']['subscription_start']); $date_end = strtotime($data['subscriptions']['subscription_end']); return $date_end > $date_start ? true : "Error: End date precedes start date"; }), Field::inst('subscriptions.invoice_id'), Field::inst('subscriptions.invoice_periods_id'), Field::inst('invoice_periods.description'), Field::inst('subscriptions.status_id'), Field::inst('statuses.description'), Field::inst('subscriptions.status_date'))->leftJoin('invoice_periods', 'invoice_periods.id', '=', 'subscriptions.invoice_periods_id')->leftJoin('statuses', 'statuses.id', '=', 'subscriptions.status_id')->leftJoin('companies', 'companies.id', '=', 'subscriptions.company_id')->leftJoin('services', 'services.id', '=', 'subscriptions.service_id')->leftJoin('service_categories', 'service_categories.id', '=', 'services.category_id')->process($_POST)->data(); $data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']); $data['services'] = Service::all(['id AS value', 'name AS label']); $data['service_categories'] = ServiceCategory::all(['id AS value', 'name AS label']); $data['statuses'] = Status::all(['id AS value', 'description AS label']); $data['invoice_periods'] = Period::all(['id AS value', 'description AS label']); return Response::json($data); }
public function getCompanyList() { $companies = Company::all(); return View::make('admin.list_company')->with('companies', $companies); }
@extends('layouts.admin.default') @section('content') <?php $employeeEditId = $employeeEditInfo[0]->id; $message = Session::get('message'); //echo 'employeeEdit:'.$employeeEditId; //exit; $companies = Company::all(); $departments = Department::all(); $jobTitles = JobTitle::all(); $managers = Employee::all(); $supervisors = Employee::all(); $roles = DB::table('groups')->get(); if (isset($employeeEditId) && !empty($employeeEditId)) { $userEdit = DB::table('users')->where('employee_id', $employeeEditId)->first(); } if (isset($userEdit) && !empty($userEdit)) { $userGroupEdit = DB::table('users_groups')->where('user_id', $userEdit->id)->first(); } if (isset($userGroupEdit) && !empty($userGroupEdit)) { $groupEdit = DB::table('groups')->where('id', (int) $userGroupEdit->group_id)->first(); } $companyArr[0] = ''; if (!empty($companies)) { foreach ($companies as $company) { $companyArr[$company->id] = $company->name; } } $departmentArr[0] = '';
/** * [postData - handle posted strippenkaart data] * @return [json] [DT compatible object] */ public function postData() { $Model = $this->modelName; // Build our Editor instance and process the data coming from _POST global $db; $data = Editor::inst($db, 'strippenkaarten')->fields(Field::inst('strippenkaarten.id'), Field::inst('strippenkaarten.company_id'), Field::inst('companies.bedrijfsnaam'), Field::inst('strippenkaarten.hours'), Field::inst('strippenkaarten.price'), Field::inst('strippenkaarten.expired_at'))->leftJoin('companies', 'companies.id', '=', 'strippenkaarten.company_id')->process($_POST)->data(); $data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']); return Response::json($data); }