public function showIndex() { if (!Auth::check()) { return View::make('login', array('title' => 'edison')); } $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター'); $all_items = Item::orderBy('created_at', 'desc')->take(10)->get(); foreach ($all_items as &$item) { $item['user'] = User::where('id', '=', $item->user_id)->get()[0]; $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count(); $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count(); if ($item->category_id != 0) { $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $recent_works = Work::orderBy('created_at', 'desc')->take(10)->get(); foreach ($recent_works as &$work) { $item = Item::where('id', '=', $work->item_id)->get()[0]; $work['item'] = $item; $work['user'] = User::where('id', '=', $work->user_id)->get()[0]; $work['item_poster_screen_name'] = User::where('id', '=', $item->user_id)->get()[0]->screen_name; if ($item->category_id != 0) { $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $user = User::where('screen_name', '=', Auth::user()->screen_name)->get()[0]; $data = array('title' => 'edison', 'user' => $user, 'all_items' => $all_items, 'recent_works' => $recent_works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', Auth::user()->id)->count()); return View::make('index', $data); }
public function showUser($screen_name) { if (User::where('screen_name', '=', $screen_name)->first() == NULL) { return Response::view('404', array('title' => '404 page'), 404); } $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター'); $user = User::where('screen_name', '=', $screen_name)->first(); $star_items = $this->getStars($screen_name); try { $items = Item::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get(); foreach ($items as &$item) { $item['user'] = User::where('id', '=', $item->user_id)->get()[0]; $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count(); $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count(); if ($item->category_id != 0) { $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $works = Work::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get(); foreach ($works as &$work) { $item = Item::where('id', '=', $work->item_id)->get()[0]; $work['item'] = $item; $work['user'] = User::where('id', '=', $work->user_id)->get()[0]; $work['item']['user'] = User::where('id', '=', $work->item->user_id)->get()[0]; if ($item->category_id) { $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $twitter_profile = array('user' => $user, 'items' => $items, 'title' => $screen_name, 'stars' => $star_items, 'works' => $works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', $user->id)->count()); return View::make('user', $twitter_profile); } catch (Exception $e) { echo $e->getMessage(); } }
public function deleteWorkEdit($id) { // $work = Work::find($id); $work = Work::where('id', '=', $id); //$workgroup->roles()->detach(); $work->delete(); return Redirect::to('/admin/workedit')->withErrors(['msg' => ['Работа удалена!']]); }
public function delete($work_id) { $work_user_id = Work::where('id', '=', $work_id)->get()[0]->user_id; // $work_item_id = Work::where('id', '=', $work_id)->get()[0]->item_id; // $item_user_id = Item::where('id', '=', $work_item_id)->get()[0]->user_id; // $item_user_screen_name = User::where('id', '=', $item_user_id)->get()[0]->screen_name; if (Auth::user()->id === $work_user_id) { Work::where('id', '=', $work_id)->delete(); return Redirect::to("/"); } else { return Redirect::to("/"); } }
public function getNoticeContents() { $login_user_id = Auth::user()->id; $notice = Starmap::where('user_id', '=', $login_user_id)->where('watched_flag', '=', 0)->where('notice_flag', '=', 1)->get(); $notice_item_ids = array(); foreach ($notice as $n) { $notice_item_ids[] = $n["item_id"]; } $notice_items_uesr = array(); $notice_item_titles = array(); $notice_work_ids = array(); foreach ($notice_item_ids as $notice_item_id) { $notice_items_uesr_ids[] = Item::where('id', '=', $notice_item_id)->get()[0]['user_id']; $notice_item_titles[] = Item::where('id', '=', $notice_item_id)->get()[0]['title']; $notice_work_ids[] = Work::where('item_id', '=', $notice_item_id)->orderBy('created_at', 'desc')->get()[0]['item_id']; } //$this->debug($notice_work_ids); $notice_work_user_ids = array(); $notice_work_title = array(); foreach ($notice_work_ids as $notice_work_id) { var_dump($notice_work_id); $notice_work_user_ids[] = Work::where('id', '=', $notice_work_id)->orderBy('updated_at', 'asc')->get()[0]['user_id']; $notice_work_title[] = Work::where('id', '=', $notice_work_id)->orderBy('id', 'asc')->get()[0]['title']; } $this->debug($notice_work_user_ids); //$this->debug($notice_work_title); // --------- $notice_work_user_screen_name = array(); foreach ($notice_work_user_ids as $notice_work_user_id) { $notice_work_user_screen_name = User::where('id', '=', $notice_work_user_id)->get()[0]['screen_name']; } //$this->debug($notice_work_user_screen_name); $notice_item_screen_name = array(); foreach ($notice_items_uesr_ids as $user_id) { $notice_item_screen_name[] = User::where('id', '=', $user_id)->get()[0]['screen_name']; } $json_val = array("notice_title" => $notice_item_titles, "notice_item_id" => $notice_item_ids, "notice_item_user" => $notice_item_screen_name, "notice_work_title" => $notice_work_title, "notice_work_user" => $notice_work_user_screen_name); header('Content-type: application/json'); echo json_encode($json_val); }
public function show($id) { $this->breadcrumb->append_crumb('Home', base_url()); $this->breadcrumb->append_crumb('Staff Detail', base_url() . ''); $staff = new Staff(); $data['staff'] = $staff->where('staff_id', $id)->get(); $family = new Family(); $data['families'] = $family->where('staff_fam_staff_id', $data['staff']->staff_id)->get(); $work = new Work(); $data['works'] = $work->where('staff_id', $data['staff']->staff_id)->get(); $education = new Education(); $data['educations'] = $education->where('staff_id', $data['staff']->staff_id)->get(); $medical = new Medical(); $data['medicals'] = $medical->where('staff_id', $data['staff']->staff_id)->get(); $asset_detail = new Asset_Detail(); $data['asset_details'] = $asset_detail->where('staff_id', $data['staff']->staff_id)->get(); $data['btn_back'] = anchor('staffs/', 'Back'); $data['btn_edit'] = anchor('staffs/edit/' . $data['staff']->staff_id, 'Edit'); $this->load->view('staffs/show', $data); }
public function delete($screen_name, $item_id) { $item = Item::find($item_id); if (Auth::user()->id === $item->user_id) { $item->delete(); Work::where('item_id', '=', $item_id)->delete(); Comment::where('item_id', '=', $item_id)->delete(); Starmap::where('item_id', '=', $item_id)->delete(); return Redirect::to("/{$screen_name}"); exit; } else { return Redirect::to("/{$screen_name}"); } }
function update() { $work = new Work(); $id = $this->input->post('id'); $work->where('history_id', $id)->update(array('history_date' => $this->input->post('history_date'), 'history_description' => $this->input->post('history_description'))); $this->session->set_flashdata('message', 'Work Update successfuly.'); redirect('staffs/' . $this->staff_id . '/work_histories/index'); }
function preview($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); //$pi = new Personal(); //$pi->get_by_employee_id( $employee_id ); //print_r($personal_info); // initiate FPDI $pdf = new FPDI('P', 'mm', 'Letter'); // add a page $pdf->AddPage(); // set the sourcefile //$pdf->setSourceFile('dtr/template/service_record/service_record.pdf'); // import page 1 //$tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm //$pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(15, 60); $pdf->SetFont('Arial', '', 16); $pdf->Cell(0, 3, "Employee's Service Record", '', 1, 'C', false); $pdf->Ln(4); $e = new Employee_m(); $e->get_by_id($employee_id); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 8, "Employee No.:" . $e->employee_id, '', 1, 'L', false); $pdf->Ln(2); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 8, "Employee Name:" . $e->lname . ', ' . $e->fname . ' ' . $e->mname, '', 1, 'L', false); $pdf->Ln(4); $pdf->Cell(0, 8, "Date From Date To Position Department Movement Status Status", '1', 1, 'L', false); $pdf->Ln(4); $work = new Work(); $work->where('govt_service', '1'); $work->order_by('inclusive_date_from', 'DESC'); $works = $work->get_by_employee_id($employee_id); $i = 1; $this->load->helper('text'); foreach ($works as $work) { $pdf->SetFont('Arial', '', 8); $pdf->SetX(10); list($year, $month, $day) = explode('-', $work->inclusive_date_from); $inclusive_date_from = $month . '/' . $day . '/' . $year; $pdf->Write(0, $inclusive_date_from); list($year, $month, $day) = explode('-', $work->inclusive_date_to); $inclusive_date_to = $month . '/' . $day . '/' . $year; if ($work->inclusive_date_to == 'Present') { $inclusive_date_to = 'Present'; } $pdf->SetX(29); $pdf->Write(0, $inclusive_date_to); $pdf->SetFont('Arial', '', 8); $pdf->SetX(50); $pdf->Write(0, str_replace('…', '..', character_limiter($work->position, 35))); $pdf->SetX(100); //$pdf->Write(0, $work->company); $pdf->Write(0, str_replace('…', '..', character_limiter($work->company, 35))); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(160); $pdf->Write(0, $work->movement); //$pdf->SetX(150); //$pdf->Write(0, $work->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(185); $pdf->Write(0, $work->status); $work->govt_service = $work->govt_service == 1 ? 'Yes' : 'No'; $pdf->SetX(190); //$pdf->Write(0, $work->govt_service); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } $pdf->Cell(0, 8, "--------------------------------------------------------- Nothing Follows ---------------------------------------------------------", '', 1, 'C', false); // Signatories $pdf->Ln(15); $pdf->SetX(20); $pdf->Cell(90, 5, "PREPARED BY:", '0', 0, 'C', false); $pdf->Cell(90, 5, "CERTIFIED CORRECT:", '0', 1, 'C', false); $pdf->Ln(10); $sr_prepared = Setting::getField('sr_prepared'); $sr_prepared_position = Setting::getField('sr_prepared_position'); $sr_certified = Setting::getField('sr_certified'); $sr_certified_position = Setting::getField('sr_certified_position'); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared, '0', 0, 'C', false); //4th param border $pdf->Cell(90, 5, $sr_certified, '0', 1, 'C', false); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared_position, '0', 0, 'C', false); $pdf->Cell(90, 5, $sr_certified_position, '0', 1, 'C', false); // Output $pdf->Output('dtr/template/service_record/archives/service_record_' . $employee_id . '.pdf', 'I'); }