public function action_available() { $job_obj = new \Model_Job(); $job_id = \Fuel\Core\Input::post('job_id'); $is_available = \Fuel\Core\Input::post('is_available'); $data = array('is_available' => $is_available); $res = $job_obj->save_data($data, $job_id); \Fuel\Core\Session::set_flash('report', '承認に失敗しました。'); if ($res) { \Fuel\Core\Session::set_flash('report', $is_available == 0 ? '非公開しました' : '公開しました'); } return new \Response($res, 200, array()); }
/** * @author Thuanth6589 <*****@*****.**> * delete media * @param $media_id * @return bool */ public function delete_media($media_id) { $media = Model_Mmedia::find_by_pk($media_id); if ($media) { try { $media_in_job = Model_Job::count('job_id', false, array(array('media_list', 'like', '%,' . $media_id . ',%'))); $media_in_order = Model_Orders::count('order_id', false, array(array('media_list', 'like', '%,' . $media_id . ',%'))); if ($media_in_job || $media_in_order) { return false; } \Fuel\Core\DB::start_transaction(); $post = new Model_Mpost(); $delete_post = $post->delete_by_media($media_id); if (!isset($delete_post)) { \Fuel\Core\DB::rollback_transaction(); return false; } if ($media->delete() != 1) { \Fuel\Core\DB::rollback_transaction(); return false; } \Fuel\Core\DB::commit_transaction(); return true; } catch (Exception $e) { \Fuel\Core\DB::rollback_transaction(); } } return false; }
echo __('Job settings'); ?> </span> </div> <div class="panel-body panel-spoiler"> <div class="note note-warning"> <?php echo UI::icon('lightbulb-o fa-lg'); ?> <?php echo __('When using cron you need to add the following line to the crontab file:'); ?> <br /><br /> <strong>* * * * * cd <?php echo DOCROOT; ?> ; php -f index.php --task=job:run > /dev/null 2>&1</strong> </div> <div class="form-group"> <label class="control-label col-sm-3"><?php echo __('Job agent'); ?> </label> <div class="col-sm-3"> <?php echo Form::select('setting[job][agent]', Model_Job::agents(), (int) Config::get('job', 'agent')); ?> </div> </div> </div>
public function update_csv($file) { $data = $this->get_file_csv($file); //array_shift($data); if (!count($data)) { return false; } $model_job = new Model_Job(); $model_add = new Model_Jobadd(); $model_rec = new Model_Jobrecruit(); $k = 1; \DB::start_transaction(); $check = true; $no_update = array(); try { foreach ($data as $row) { if (!$check) { break; } $data = self::data_once_csv($row); $validate_field = $this->validate($data['job'], $data['job_add'], $data['job_rec'], $k); $res = $model_job->update_data_csv($data['job'], $data['job']['job_id'], $validate_field, $no_update, $k); if ($res === -1) { $this->error[$k]['job_id'] = $k . '行目:求人情報が存在していません。'; $check = false; } else { if ($res && $validate_field) { $res_delete_add = $model_add->delete_data($data['job']['job_id']); if ($res_delete_add >= 0) { if (count($data['job_add']) && !$model_add->insert_multi_data($data['job_add'], $model_job)) { $check = false; } } $res_delete_rec = $model_rec->delete_data($data['job']['job_id']); if ($res_delete_rec >= 0) { if (count($data['job_rec']) && !$model_rec->insert_multi_data($data['job_rec'], $model_job)) { $check = false; } } } else { $check = false; } } ++$k; } if (!$check) { \DB::rollback_transaction(); } else { \DB::commit_transaction(); } } catch (Exception $e) { // rollback pending transactional queries \DB::rollback_transaction(); throw $e; } $this->no_update = $no_update; return $check; }
public function action_index() { $data = array(); $model_par = new \Model_Mpartner(); $model_ss = new \Model_Mss(); $model_job = new \Model_Job(); $model_or = new \Model_Orders(); $m_user = new Model_Muser(); $m_person = new Model_Person(); $data['m_partner'] = $model_par->count_data(array('status' => 1)); $data['m_ss'] = $model_ss->count_data(array('status' => '0')); $data['job'] = $model_job->count_data(); $data['or'] = count($model_or->get_all_order_list(null, null, array('unapproved' => '0'))); $data['person_inactive'] = $m_person->count_data(array('status' => '0')); $this->template->title = 'UOS求人システム'; $this->template->content = View::forge('default/top', $data); $user_info = \Fuel\Core\Session::get('login_info'); $division = $user_info['division_type']; $department_id = $user_info['department_id']; if ($division == 2) { $data['count_partner'] = $model_par->count_data(array('department_id' => $department_id, 'status' => '1')); $data['count_ss'] = $model_ss->count_data(array('department_id' => $department_id, 'status' => '0')); $data['count_job'] = $model_job->count_job_department_id(array('department_id' => $department_id, 'status' => '0')); $data['count_order'] = count($model_or->get_all_order_list(null, null, array('department_id' => $department_id, 'unapproved' => '0'))); $data['list_user'] = $m_user->get_data(array('department_id' => $department_id, 'order_by_time' => 1)); $data['link_partner'] = \Fuel\Core\Uri::base() . 'master/partners?department_id=' . $department_id . '&status=1'; $data['link_ss'] = \Fuel\Core\Uri::base() . 'master/sslist?department_id=' . $department_id . '&status=0'; $data['link_job'] = \Fuel\Core\Uri::base() . 'job/jobs?department_id=' . $department_id . '&status=0'; $data['link_order'] = \Fuel\Core\Uri::base() . 'job/orders?department_id=' . $department_id . '&unapproved=0&flag=1'; $array_user = array(); foreach ($data['list_user'] as $user) { $array_user[] = $user->user_id; } $list_person = $m_person->get_person_division_2($array_user); foreach ($list_person as $person) { foreach ($array_user as $k => $v) { if ($person['interview_user_id'] == $v || $person['agreement_user_id'] == $v || $person['training_user_id'] == $v || $person['partner_user_id'] == $v) { if ($person['contact_result'] == 0) { $data['count'][$v]['contact_result'] = isset($data['count'][$v]['contact_result']) ? $data['count'][$v]['contact_result'] + 1 : 1; } if ($person['review_date'] == '') { $data['count'][$v]['review_date'] = isset($data['count'][$v]['review_date']) ? $data['count'][$v]['review_date'] + 1 : 1; } if ($person['review_result'] == 0) { $data['count'][$v]['review_result'] = isset($data['count'][$v]['review_result']) ? $data['count'][$v]['review_result'] + 1 : 1; } if ($person['adoption_result'] == 0) { $data['count'][$v]['adoption_result'] = isset($data['count'][$v]['adoption_result']) ? $data['count'][$v]['adoption_result'] + 1 : 1; } if ($person['contract_date'] == '') { $data['count'][$v]['contract_date'] = isset($data['count'][$v]['contract_date']) ? $data['count'][$v]['contract_date'] + 1 : 1; } if ($person['contract_result'] == 0) { $data['count'][$v]['contract_result'] = isset($data['count'][$v]['contract_result']) ? $data['count'][$v]['contract_result'] + 1 : 1; } if ($person['hire_date'] == '') { $data['count'][$v]['hire_date'] = isset($data['count'][$v]['hire_date']) ? $data['count'][$v]['hire_date'] + 1 : 1; } if ($person['employee_code'] == '') { $data['count'][$v]['employee_code'] = isset($data['count'][$v]['employee_code']) ? $data['count'][$v]['employee_code'] + 1 : 1; } if ($person['work_confirmation'] == 0) { $data['count'][$v]['work_confirmation'] = isset($data['count'][$v]['work_confirmation']) ? $data['count'][$v]['work_confirmation'] + 1 : 1; } } } } $data['pagination'] = \Uospagination::forge('pagination', array('pagination_url' => Uri::base() . '?division=2', 'total_items' => count($data['list_user']), 'per_page' => \Constants::$default_limit_pagination, 'num_links' => \Constants::$default_num_links, 'uri_segment' => 'page', 'show_last' => true)); $this->template->content = View::forge('default/division2', $data); } elseif ($division == 3) { $this->division3(); } else { $this->template->content = View::forge('default/top', $data); } }
public function action_delete($id = null) { is_null($id) and Response::redirect('job'); if ($job = Model_Job::find($id)) { $job->delete(); Session::set_flash('success', 'Deleted job #' . $id); } else { Session::set_flash('error', 'Could not delete job #' . $id); } Response::redirect('job'); }
/** * @author NamNT * action index */ public function action_index() { $data = array(); $is_view = array(); $model = new \Model_Person(); $employment = new \Model_Employment(); $model_job = new \Model_Job(); $model_order = new \Model_Orders(); $model_user = new \Model_Muser(); $sssale_id = null; $sssale_id_view = null; $order_id = null; $post_id = null; $data['person_info'] = null; $data['edit_person'] = null; $data['post_id'] = null; $data['job_id'] = $model_job->get_list_id(); $data['person_id'] = \Input::get('person_id'); $data['listusers_interview'] = array(); $data['listusers_agreement'] = array(); $data['listusers_training'] = array(); $data['listusers_business'] = array(); if (\Input::get('order_id')) { $order_id = \Input::get('order_id'); $od = $model_order->get_order_info($order_id); $post_id = $od['post_id']; $data['post_id'] = $post_id; $data['order'] = $od; $data['order'] = $model_user->get_user_info_path($od['interview_user_id'], 'interview', $data['order']); $data['order'] = $model_user->get_user_info_path($od['agreement_user_id'], 'agreement', $data['order']); $data['order'] = $model_user->get_user_info_path($od['training_user_id'], 'training', $data['order']); } if (\Input::get('person_id')) { $person_info = \Model_Person::find(\Input::get('person_id')); $data['edit_person'] = $person_info; $data['edit_person']['interview_department_id'] = ''; $data['edit_person']['agreement_department_id'] = ''; $data['edit_person']['training_department_id'] = ''; $data['edit_person']['business_department_id'] = ''; $data['edit_person']['listusers_interview'] = array(); $data['edit_person']['listusers_agreement'] = array(); $data['edit_person']['listusers_training'] = array(); $data['edit_person']['listusers_business'] = array(); $data['edit_person'] = $model_user->get_user_info_path($person_info->interview_user_id, 'interview', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($person_info->agreement_user_id, 'agreement', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($person_info->training_user_id, 'training', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($person_info->business_user_id, 'business', $data['edit_person']); $data['person_info'] = $data['edit_person']; if ($edit_data = $person_info->edit_data) { $person_info['application_date'] = substr($person_info['application_date'], 0, 16); $data['edit_person'] = json_decode($edit_data, true); $data['edit_person']['interview_user_id'] = isset($data['edit_person']['interview_user_id']) ? $data['edit_person']['interview_user_id'] : ''; $data['edit_person']['agreement_user_id'] = isset($data['edit_person']['agreement_user_id']) ? $data['edit_person']['agreement_user_id'] : ''; $data['edit_person']['training_user_id'] = isset($data['edit_person']['training_user_id']) ? $data['edit_person']['training_user_id'] : ''; $data['edit_person']['business_user_id'] = isset($data['edit_person']['business_user_id']) ? $data['edit_person']['business_user_id'] : ''; $data['edit_person']['interview_department_id'] = ''; $data['edit_person']['agreement_department_id'] = ''; $data['edit_person']['business_department_id'] = ''; $data['edit_person']['training_department_id'] = ''; $data['edit_person']['listusers_interview'] = array(); $data['edit_person']['listusers_agreement'] = array(); $data['edit_person']['listusers_training'] = array(); $data['edit_person']['listusers_business'] = array(); $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['interview_user_id'], 'interview', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['agreement_user_id'], 'agreement', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['training_user_id'], 'training', $data['edit_person']); $data['edit_person'] = $model_user->get_user_info_path($data['edit_person']['business_user_id'], 'business', $data['edit_person']); $data['is_view'] = \Utility::compare_json_data($person_info, $edit_data); } } $data_filter['field'] = array('step' => 4, 'type' => 1, 'label' => array('group' => 'グループ', 'partner' => '取引先(受注先)', 'ss' => 'SS', 'sslist' => '売上形態')); if ($data['edit_person']) { $sssale_id = $data['edit_person']['sssale_id']; } if ($data['person_info']) { $sssale_id_view = $data['person_info']['sssale_id']; } $data_filter['datafilter'] = \Presenter_Group_Filter::edit($data_filter['field']['step'], $data_filter['field']['type'], $sssale_id, $sssale_id_view); if (\Input::method() == 'POST') { $datas = array(); $dataPost = \Input::post(); $datas = $model->get_person_data($dataPost); $action = 'add'; foreach (\Input::post() as $key => $value) { if (\Input::post($key) == '') { $datas[$key] = null; } } if (!\Model_Sssale::find_by_pk($datas['sssale_id'])) { Session::set_flash('error', '売上形態は存在しません'); } else { if (\Input::get('person_id')) { $action = 'edit'; if (!($model = $model->find(\Input::get('person_id')))) { Session::set_flash('error', '応募者は存在しません'); Response::redirect('job/persons'); } $model->status = \Constants::$_status_person['pending']; $data_temp = Input::post(); if (!$data_temp['business_user_id']) { $data_temp['business_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']); } if (!$data_temp['interview_user_id']) { $data_temp['interview_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']); } if (!$data_temp['agreement_user_id']) { $data_temp['agreement_user_id'] = $this->get_default_business_user_id($data_temp['sssale_id']); } $model->edit_data = json_encode($model->get_person_data($data_temp)); if ($model->save()) { Session::set_flash('success', \Constants::$message_create_success); Response::redirect(Uri::base() . 'job/persons'); } } else { $datas['created_at'] = date('Y-m-d H:i:s'); if (!$datas['business_user_id']) { $datas['business_user_id'] = $this->get_default_business_user_id($datas['sssale_id']); } if (!$datas['interview_user_id']) { $datas['interview_user_id'] = $this->get_default_business_user_id($datas['sssale_id']); } if (!$datas['agreement_user_id']) { $datas['agreement_user_id'] = $this->get_default_business_user_id($datas['sssale_id']); } $model->set($datas); if ($model->save()) { if ($action == 'add') { $person_obj = $model->find($model->person_id); $sssale_id_mail = $person_obj->sssale_id != '' ? $person_obj->sssale_id : 0; $person_data = $model->get_data_for_mail($sssale_id_mail); if (count($person_data)) { //send mail $model_user = new \Model_Muser(); $department_id = $person_data['0']['department_id'] ? $person_data['0']['department_id'] : 0; $list_email_department = $model_user->get_list_mail_department($department_id); $datamail_department = array('m_group' => isset($person_data['0']['name']) ? $person_data['0']['name'] : '', 'branch_name' => isset($person_data['0']['branch_name']) ? $person_data['0']['branch_name'] : '', 'ss_name' => isset($person_data['0']['ss_name']) ? $person_data['0']['ss_name'] : '', 'sale_name' => isset($person_data['0']['sale_name']) ? $person_data['0']['sale_name'] : '', 'list_emails' => $list_email_department, 'last_id' => $model->person_id); $model->sendmail_department($datamail_department); } } Session::set_flash('success', \Constants::$message_create_success); } else { Session::set_flash('error', \Constants::$message_create_error); } } } if (\Fuel\Core\Cookie::get('person_url')) { Response::redirect(\Fuel\Core\Cookie::get('person_url')); } else { Response::redirect('job/persons'); } } $this->template->title = 'UOS求人システム'; $this->template->content = \View::forge('persons/person', $data); $this->template->content->filtergroup = \Presenter::forge('group/filter')->set('custom', $data_filter); }
public function save($ujob_obj, $job_id, $data_post) { if ($job_id != '' && !\Model_Job::find_by_pk($job_id)) { \Fuel\Core\Session::set_flash('report', '求人情報は存在しません'); \Fuel\Core\Session::set_flash('class', 'alert-danger'); \Fuel\Core\Response::redirect(\Fuel\Core\Uri::base() . 'job/jobs'); } \Fuel\Core\Session::set_flash('report', \Constants::$message_create_error); if ($ujob_obj->save_data($data_post, $job_id) >= 0) { \Fuel\Core\Session::set_flash('class', 'alert-success'); \Fuel\Core\Session::set_flash('report', \Constants::$message_create_success); if (\Session::get('url_job_redirect')) { \Fuel\Core\Response::redirect(\Session::get('url_job_redirect')); } \Fuel\Core\Response::redirect(\Fuel\Core\Uri::base() . 'job/jobs'); } }
/** * * @return atring */ public function status() { return Arr::get(Model_Job::statuses(), $this->status, Model_Job::STATUS_NEW); }
function init(){ parent::init(); $this->addCondition('expires_at>',date('Y-m-d')); }
/** * * @return string */ public function status() { return Arr::get(Model_Job::statuses(), $this->status, 1); }