public function delete($id) { if (Title::destroy($id)) { return redirect()->back()->with('msg', 'Логотип удален'); } return redirect()->back()->with('warning', 'Не удалось удалить'); }
public function homepage() { $params = array('logo' => Title::findOrFail(1), 'timer' => Timer::findOrFail(1), 'about' => About::findOrFail(1), 'contacts' => Contact::where('enabled', '=', true)->orderBy('id', 'ASC')->get(), 'grouped' => GroupRepository::grouped(), 'offices' => Office::where('enabled', '=', true)->orderBy('position', 'ASC')->get(), 'title' => 'TWIGA – крупнейшая независимая коммуникационная группа в России и странах СНГ'); /*if (Request::has('r')) { $r = Request::get('r'); Session::set('r', $r); return redirect('/#' . $r); }*/ $view = Agent::isTablet() || Request::has('t') ? 'tablet.homepage' : (Agent::isMobile() || Request::has('m') ? 'mobile.homepage' : 'index.homepage'); return view($view, $params); }
public function getAllUsersOptions() { $raw = User::find()->asArray()->all(); $arr = []; foreach ($raw as $row) { $arr[$row['id']] = Title::getTitleById($row['title']) . ' ' . $row['first_name'] . ' ' . $row['last_name']; } return $arr; }
public function start() { $session = Session::get('start_session'); if ($session) { $data['title'] = "Welcome"; $user = User::find($session['user_id']); $profile = new \stdClass(); $profile->id = $user->id; $profile->profile_picture = $user->owner->profile_picture()->path(); $profile->first_name = $user->owner->first_name; $profile->last_name = $user->owner->last_name; $profile->username = $user->username; $profile->contacts = new \stdClass(); $profile->contact = $user->active_contact; foreach ($user->owner->company_person as $contact) { $profile->contacts->{$contact->id} = $contact; if (!isset($profile->first_contact)) { $profile->first_contact = $contact->id; } } $data['profile'] = $profile; $data['departments'] = Department::orderBy("name")->get(); $data['titles'] = Title::orderBy("name")->get(); return view('login.start', $data); } else { return redirect()->intended(); } }
public function getTitleById($id) { $raw = Title::findOne($id); return $raw['name']; }
<div class="user-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'username')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'password')->passwordInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'title')->dropDownList(\app\models\Title::getTitleOptions(), array('prompt' => '-- Select a Title --')); ?> <?php echo $form->field($model, 'first_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'last_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php
public function vacancy() { $params = array('logo' => Title::findOrFail(1), 'vacancyGroups' => VacancyRepository::grouped(), 'title' => 'Работа и стажировка | TWIGA'); $view = Agent::isTablet() || Request::has('t') ? 'tablet.vacancy' : (Agent::isMobile() || Request::has('m') ? 'mobile.vacancy' : 'index.vacancy'); return view($view, $params); }
public function edit($id) { $company_person = CompanyPerson::find($id); if (Auth::user()->can('update-contact') || Auth::user()->active_contact->id == $id && Auth::user()->can('update-own-contact') || !$company_person->isE80() && Auth::user()->can('update-customer-contact')) { $data['title'] = "Edit Contact"; $data['titles'] = Title::orderBy("name")->get(); $data['departments'] = Department::orderBy("name")->get(); $data['companies'] = Company::orderBy("name")->get(); $data['contact'] = CompanyPerson::find($id); $data['divisions'] = Division::orderBy("name")->get(); $data['groups'] = Group::where("group_type_id", "=", $company_person->group_type_id)->orderBy("name")->get(); return view('company_person/edit', $data); } else { return redirect()->back()->withErrors(['Access denied to contacts edit page']); } }
public function create() { if (Auth::user()->can('create-company')) { $data['titles'] = Title::orderBy("name")->get(); $data['departments'] = Department::orderBy("name")->get(); $data['support_types'] = SupportType::orderBy("name")->get(); $data['connection_types'] = ConnectionType::orderBy("name")->get(); $data['group_types'] = GroupType::orderBy("name")->get(); $data['escalation_profiles'] = EscalationProfile::orderBy("name")->get(); $data['account_managers'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID, "company_person.title_id|=|" . ACCOUNT_MANAGER_TITLE_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]); $data['title'] = "Create Company"; return view('companies/create', $data); } else { return redirect()->back()->withErrors(['Access denied to companies create page']); } }