Example #1
0
 public static function is_logged()
 {
     if (Session::get('CurrentAdminUser') == null) {
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * list media
  */
 public function action_index()
 {
     $m_group = new \Model_Mgroups();
     $m_partner = new \Model_Mpartner();
     $tmp = array('' => 'その他');
     $data['groups'] = $tmp + (new \Model_Mgroups())->get_type(2);
     $data['partners'] = $this->_partners;
     $filters = Input::get();
     $query_string = empty($filters) ? '' : '?' . http_build_query($filters);
     Session::set('medias_url', Uri::base() . 'master/medias' . $query_string);
     if (isset($filters['m_group_id']) && $filters['m_group_id']) {
         $data['partners'] += array_column($m_partner->get_partner_group($filters['m_group_id'], $this->_partner_type), 'branch_name', 'partner_code');
     }
     $m_media = new \Model_Mmedia();
     $m_post = new \Model_Mpost();
     $data['count_media'] = $m_media->count_data($filters);
     $pagination = \Uospagination::forge('pagination', array('pagination_url' => Uri::base() . 'master/medias' . $query_string, 'total_items' => $data['count_media'], 'per_page' => \Constants::$default_limit_pagination, 'num_links' => \Constants::$default_num_links, 'uri_segment' => 'page', 'show_last' => true));
     $filters['offset'] = $pagination->offset;
     $filters['limit'] = $pagination->per_page;
     $medias = $m_media->get_data($filters);
     foreach ($medias as $media) {
         $media->count_post = $m_post->count_by_media_id($media->m_media_id);
     }
     $data['pagination'] = $pagination;
     $data['medias'] = $medias;
     $data['type'] = \Constants::$media_type;
     $data['classification'] = \Constants::get_search_media_classification();
     $data['filters'] = $filters;
     $this->template->title = 'UOS求人システム';
     $this->template->content = View::forge('medias', $data);
 }
 public function action_addtask($project_id)
 {
     if (!($project = Model_Project::find($project_id))) {
         \Fuel\Core\Session::set_flash('error', "Cannot find the selected project # {$project_id}");
         \Fuel\Core\Response::redirect_back('user/projects');
     }
     $val = Model_Projecttask::validate('create');
     if (\Fuel\Core\Input::method() == 'POST') {
         if ($val->run()) {
             $projecttask = Model_Projecttask::forge(array('project_id' => Input::post('project_id'), 'user_id' => Input::post('user_id'), 'project_task_name_id' => Input::post('project_task_name_id'), 'hourly_rate' => Input::post('hourly_rate'), 'task_status' => 0, 'task_due' => Input::post('task_due'), 'project_task_description' => Input::post('project_task_description'), 'comment' => Input::post('comment'), 'priority' => Input::post('priority')));
             if ($projecttask and $projecttask->save()) {
                 Session::set_flash('success', e('Added task #' . $projecttask->id . '.'));
                 Response::redirect('user/projects/view/' . $project_id);
             } else {
                 Session::set_flash('error', e('Could not save task.'));
             }
         } else {
             \Fuel\Core\Session::set_flash('error', $val->error());
         }
     }
     $this->load_presenter($project, Model_Projecttask::forge(array('id' => 0, 'project_id' => $project->id, 'user_id' => $this->current_user->id, 'task_status' => 0, 'hourly_rate' => 456, 'task_due' => date('Y-m-d'))));
     $this->template->set_global('project_task_names', Model_Projecttaskname::find('all', array('order_by' => array(array('name', 'asc')))));
     $this->template->set_global('users', array(Model_User::find($this->current_user->id)));
     $this->template->set_global('priorities', THelper::get_priorities());
     $this->template->title = 'My Projects';
     $this->template->content = Fuel\Core\View::forge('user/projects/addtask');
 }
Example #4
0
 public static function getTokenCredentials()
 {
     $result = array();
     try {
         $access_token_url = \Fuel\Core\Config::get('evernote.evernote_server') . '/oauth';
         $oauth_verifier = \Fuel\Core\Session::get('oauthVerifier');
         $oauth = new \OAuth(\Fuel\Core\Config::get('evernote.consumer_key'), \Fuel\Core\Config::get('evernote.consumer_secret'));
         $request_token = \Fuel\Core\Session::get('requestToken');
         $request_token_secret = \Fuel\Core\Session::get('requestTokenSecret');
         $oauth->setToken($request_token, $request_token_secret);
         $access_token_info = $oauth->getAccessToken($access_token_url, null, $oauth_verifier);
         if ($access_token_info) {
             $result['status'] = 'success';
             $result['access_token'] = $access_token_info['oauth_token'];
             $result['access_token_secret'] = $access_token_info['oauth_token_secret'];
             $result['shard_id'] = $access_token_info['edam_shard'];
             $result['user_id'] = $access_token_info['edam_userId'];
         } else {
             $result['status'] = 'failure';
         }
     } catch (\OAuthException $e) {
         $result['status'] = 'failure';
     }
     return $result;
 }
Example #5
0
 function __construct($instanceName)
 {
     $this->instanceName = $instanceName;
     $this->debug = true;
     $this->columns = array();
     $this->actions = array();
     $this->idLanguage = \Fuel\Core\Session::get('idLanguage', 0);
 }
 function performItemDeletion(Orm\Model $item, $successUrl)
 {
     $id = $item->get('id');
     $item->delete();
     $this->deleteImageFolder($id);
     $session = Session::instance();
     $session->set($this->deletedKey, true);
     // Re-loads the page on success
     Response::redirect($successUrl);
 }
Example #7
0
 protected function has_access($page)
 {
     $user = Session::get('user');
     $access = Model_Access_Right::find('first', array('where' => array('page' => $page)));
     $ac = $user->access_level;
     if ($access->{$ac} == 0) {
         Session::set_flash('error', 'Sorry! You do not have access to this page.');
         Response::redirect('welcome');
     }
 }
Example #8
0
 public static function get_new_data_photo_by_url()
 {
     $content = array('message' => \Fuel\Core\Input::post('message'), 'url' => \Fuel\Core\Input::post('link'));
     if (empty(\Fuel\Core\Input::post('publish_instantly'))) {
         $content['published'] = false;
         $content['scheduled_publish_time'] = \Libs\Datetime::get_timestamp(\Fuel\Core\Input::post('scheduled_publish_time'));
     }
     $result = array('author' => \Fuel\Core\Session::get('user_id'), 'page_id' => \Fuel\Core\Input::post('page_id'), 'modifier' => \Fuel\Core\Session::get('user_id'), 'type' => \Fuel\Core\Input::post('type'), 'push_facebook_on' => \Fuel\Core\Input::post('push_facebook_on'), 'date_created' => \Libs\Datetime::get_current_timestamp(), 'date_modified' => \Libs\Datetime::get_current_timestamp(), 'content' => json_encode($content));
     return $result;
 }
Example #9
0
 public function action_view($id = null)
 {
     is_null($id) and Response::redirect('post');
     if (!($data['post'] = Model_Post::find($id))) {
         Session::set_flash('error', 'お求めの記事はありません [# ' . $id . ' ]');
         Response::redirect('post');
     }
     $this->template->title = "ブログ";
     $this->template->content = View::forge('post/view', $data);
 }
Example #10
0
 /**
  * @author NamNT
  * action index
  */
 public function action_index()
 {
     $model = new \Model_Employment();
     $person = new \Model_Person();
     $person_id = \Input::get('person_id');
     $data = array();
     if (!$person_id) {
         Response::redirect('job/persons');
     }
     if (!($data_person = $person::find($person_id))) {
         Response::redirect('job/persons');
     }
     $data = $model->get_data_detail($person_id);
     $data['person_id'] = $person_id;
     $application_date = $data_person['application_date'];
     $get_date = getdate(strtotime($application_date));
     if ($get_date['mday'] == '29' and $get_date['mon'] == '2') {
         $registration_expiration = date('Y-m-d', strtotime(date('Y-m-d', strtotime($application_date)) . ' + 1 year' . '-1 day'));
     } else {
         $registration_expiration = date('Y-m-d', strtotime(date('Y-m-d', strtotime($application_date)) . ' + 1 year'));
     }
     $data['reg_expiration'] = $registration_expiration;
     if (\Input::method() == 'POST') {
         $datas = \Input::post();
         foreach ($datas as $key => $value) {
             if (\Input::post($key) == '') {
                 $datas[$key] = null;
             }
         }
         if ($model->find($person_id)) {
             $model = $model->find($person_id);
             $datas['obic7_flag'] = isset($datas['obic7_flag']) ? 1 : 0;
             if ($datas['obic7_flag'] == 1 && $model->obic7_flag != 1) {
                 $datas['obic7_date'] = date('Y-m-d', time());
             }
         } else {
             $datas['person_id'] = $person_id;
             $datas['created_at'] = date('Y-m-d H:i:s');
             if (isset($datas['obic7_flag'])) {
                 $datas['obic7_date'] = date('Y-m-d', time());
             }
         }
         $model->set($datas);
         if ($model->save()) {
             Session::set_flash('success', \Constants::$message_create_success);
             Response::redirect(\Fuel\Core\Uri::base() . 'job/employment?person_id=' . $person_id);
         }
     }
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('employment/index', $data);
 }
Example #11
0
 public function action_edit($id = null)
 {
     if (\Fuel\Core\Input::method() == 'POST') {
         $id = \Fuel\Core\Input::post('id');
     }
     if (!($user = Model_User::find($id))) {
         \Fuel\Core\Session::set_flash('error', 'Could not find user # ' . $id);
         \Fuel\Core\Response::redirect('admin/users');
     }
     $val = Model_User::validate('edit');
     if (\Fuel\Core\Input::method() == 'POST') {
         if ($val->run()) {
             $user->username = \Fuel\Core\Input::post('username');
             $user->email = \Fuel\Core\Input::post('email');
             $user->group = \Fuel\Core\Input::post('group');
             $user->first_name = \Fuel\Core\Input::post('first_name');
             $user->last_name = \Fuel\Core\Input::post('last_name');
             $user->target_billable = \Fuel\Core\Input::post('target_billable');
             $user->target_unbillable = \Fuel\Core\Input::post('target_unbillable');
             try {
                 if ($user->save()) {
                     Session::set_flash('success', e('Updated user #' . $id));
                     Response::redirect('admin/users');
                 } else {
                     Session::set_flash('error', e('Could not update user #' . $id));
                 }
             } catch (\SimpleUserUpdateException $ex) {
                 // duplicate email address
                 if ($ex->getCode() == 2) {
                     Fuel\Core\Session::set_flash('error', 'Email already exists.');
                 } elseif ($ex->getCode() == 3) {
                     Fuel\Core\Session::set_flash('error', 'Username already exists.');
                 } else {
                     Fuel\Core\Session::set_flash('error', $ex->getMessage());
                 }
             }
         } else {
             if (Input::method() == 'POST') {
                 Session::set_flash('error', $val->error());
             }
         }
     }
     $this->template->set_global('user', $user, false);
     $this->template->set_global('val', $val, false);
     $this->template->set_global('groups', $this->get_groups_list());
     $this->template->title = "Users";
     $this->template->content = View::forge('admin/users/edit');
 }
Example #12
0
 public function action_change_status()
 {
     if ($contact_id = Input::post('contact_id')) {
         $user_login = Session::get('login_info');
         $contact = \Model_Contact::find_by_pk($contact_id);
         if (Input::post('status') == 0) {
             $contact->set(array('status' => 1, 'user_id' => $user_login['user_id'], 'update_at' => date('Y-m-d H:i:s')));
         }
         if (Input::post('status') == 1) {
             $contact->set(array('status' => 0, 'user_id' => null, 'update_at' => null));
         }
         $contact->save();
         Response::redirect(Uri::base() . 'support/contacts?' . Session::get('url_filter_contacts'));
     }
     Response::redirect(Uri::base() . 'support/contacts?' . Session::get('url_filter_contacts'));
 }
Example #13
0
 public function action_upload_img()
 {
     $order_id = \Fuel\Core\Input::post('order_id');
     $model_order = \Model_Orders::find_by_pk($order_id);
     if (!$model_order) {
         return 'failed';
     }
     $data = array('image_content' => base64_decode(\Fuel\Core\Input::post('content_image', null)), 'width' => \Fuel\Core\Input::post('width', null), 'height' => \Fuel\Core\Input::post('height', null), 'mine_type' => \Fuel\Core\Input::post('mine_type', null));
     $obj_order = new \Model_Orders();
     if ($res = $obj_order->order_update($data, $order_id)) {
         \Fuel\Core\Session::set_flash('success', '媒体画像を登録しました。');
     } else {
         \Fuel\Core\Session::set_flash('error', '媒体画像登録は失敗しました。');
     }
     return new \Response($res, 200, array());
 }
Example #14
0
 private function _check_permission()
 {
     $user_info = \Fuel\Core\Session::get('login_info');
     $group = $user_info['division_type'];
     $controller = \Fuel\Core\Request::active()->controller;
     $action = \Fuel\Core\Request::active()->action;
     if ($group == 1 || $controller == 'Controller_Default') {
         return true;
     }
     $accept_controller = MyAuth::$roles[$group];
     $accept_action = isset($accept_controller[$controller]) ? $accept_controller[$controller] != '*' ? explode(',', $accept_controller[$controller]) : '*' : '';
     if (!isset($accept_controller[$controller]) || !in_array($controller, array_keys($accept_controller)) || $accept_action != '*' && !in_array($action, $accept_action)) {
         return false;
     }
     return true;
 }
Example #15
0
 /**
  * @author Thuanth6589 <*****@*****.**>+
  * @return bool
  * @throws Exception
  */
 public function save_data()
 {
     $login_info = \Fuel\Core\Session::get('login_info');
     $data = $this->fields;
     if (empty($data)) {
         return false;
     }
     $data['download_date'] = date('Y-m-d H:i:s', time());
     $data['user_id'] = $login_info['user_id'];
     $obj = static::forge();
     $obj->set($data);
     if ($obj->save()) {
         return true;
     }
     return false;
 }
Example #16
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * delete sssale
  */
 public function action_delete()
 {
     if (Input::method() == 'POST') {
         $sssale_id = Input::post('sssale_id');
         $result = 'error-' . Input::post('panel_index');
         $message = \Constants::$message_delete_error;
         if (isset($sssale_id) && ($sssale = \Model_Sssale::find_by_pk($sssale_id))) {
             if ($sssale->delete_data()) {
                 $result = 'success';
                 $message = \Constants::$message_delete_success;
             }
         }
         Session::set_flash($result, $message);
     }
     $url = Session::get('sssale_url') ? Session::get('sssale_url') : Uri::base() . 'master/sslist';
     return Response::redirect($url);
 }
Example #17
0
 /**
  * @author Bui Dang <*****@*****.**>
  * action Delete
  */
 public function action_delete()
 {
     $id_group = \Input::post('group_id');
     if (!$id_group or !\Model_Mgroups::find_by_pk($id_group)) {
         \Session::set_flash('error', '取引先グループは存在しません');
         \Response::redirect('master/groups');
     }
     $result = 'error';
     $message = '削除に失敗しました';
     $group = new \Model_Mgroups();
     if ($group->delete_group($id_group)) {
         $result = 'success';
         $message = '削除しました。';
     }
     \Session::set_flash($result, $message);
     \Response::redirect('master/groups?' . Session::get('url_filter_group'));
 }
Example #18
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * action list ss
  */
 public function action_index()
 {
     $filters = Input::get();
     $query_string = empty($filters) ? '' : '?' . http_build_query($filters);
     Session::set('sslist_url', Uri::base() . 'master/sslist' . $query_string);
     $m_ss = new \Model_Mss();
     $data = array();
     $data['count_ss'] = $m_ss->count_data($filters);
     $pagination = \Uospagination::forge('pagination', array('pagination_url' => Uri::base() . 'master/sslist' . $query_string, 'total_items' => $data['count_ss'], 'per_page' => \Constants::$default_limit_pagination, 'num_links' => \Constants::$default_num_links, 'uri_segment' => 'page', 'show_last' => true));
     $filters['offset'] = $pagination->offset;
     $filters['limit'] = $pagination->per_page;
     $data['ss'] = $m_ss->get_data($filters);
     $data['addr1'] = \Constants::get_search_address();
     $data['filters'] = $filters;
     $data['pagination'] = $pagination;
     $this->template->title = 'UOS求人システム';
     $this->template->content = View::forge('sslist', $data);
 }
Example #19
0
 /**
  * @author dangbc <*****@*****.**>
  * create and edit plan
  */
 public function action_index()
 {
     $department = \Constants::$department;
     if ($data_post = Input::post()) {
         $plan = new \Model_Plan();
         $return = 'error';
         $messege = '保存に失敗しました。';
         $filter_date = $data_post['filter_date'];
         if ($plan->save_plan($filter_date, $data_post)) {
             $return = 'success';
             $messege = '保存しました';
         }
         Session::set_flash($return, $messege);
     }
     $data['department'] = $department;
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('plan/index', $data);
 }
Example #20
0
 /**
  * @author: Bui Cong Dang (dangbcd6591@seta-asia.com.vn)
  * @params: List partner
  **/
 public function action_index()
 {
     $data = array();
     $partner = new \Model_Mpartner();
     //Get value from form search
     if ($filter = Input::get()) {
         Session::set('url_filter_partner', http_build_query($filter));
         //Set url filter
     }
     $pagination = \Uospagination::forge('pagination', array('pagination_url' => Uri::base() . 'master/partners?' . http_build_query($filter), 'total_items' => $partner->count_data($filter), 'per_page' => \Constants::$default_limit_pagination, 'num_links' => \Constants::$default_num_links, 'uri_segment' => 'page', 'show_last' => true));
     $filter['offset'] = $pagination->offset;
     $filter['limit'] = $pagination->per_page;
     $data['pagination'] = $pagination;
     $data['filter'] = $filter;
     $data['partners'] = $partner->get_filter_partner($filter);
     $this->template->title = 'UOS求人システム';
     $this->template->content = View::forge('partners/index', $data);
 }
Example #21
0
 public function action_upload($folder, $sub = null)
 {
     if (\Fuel\Core\Input::method() == 'POST') {
         try {
             \Fuel\Core\DB::start_transaction();
             $val = Model_Filemanager::validate('create');
             if ($val->run()) {
                 $config = array('path' => "/var/www/html/" . $this->_dir . "/" . $folder . "/" . $sub . DS, 'ext_whitelist' => array('jpg', 'jpeg', 'png'), 'file_chmod' => 0777, 'auto_rename' => true, 'overwrite' => true, 'randomize' => true, 'create_path' => true);
                 Upload::process($config);
                 $img = '';
                 if (Upload::is_valid()) {
                     Upload::save();
                     $img = Upload::get_files()[0];
                 }
                 if (!\Fuel\Core\Input::post('id')) {
                     $file = Model_Filemanager::forge(array('folder' => $folder, 'key' => Input::post('key'), 'value' => $img['saved_as'], 'photographer' => \Fuel\Core\Input::post('photographer'), 'price' => \Fuel\Core\Input::post('price'), 'usage' => \Fuel\Core\Input::post('usage'), 'source' => \Fuel\Core\Input::post('source')));
                 } else {
                     $file = Model_Filemanager::find_by_id(\Fuel\Core\Input::post('id'));
                     if ($img == '') {
                         $img = $file->value;
                     }
                     if ($file) {
                         $file->set(array('folder' => $folder, 'key' => Input::post('key'), 'value' => $img, 'photographer' => \Fuel\Core\Input::post('photographer'), 'price' => \Fuel\Core\Input::post('price'), 'usage' => \Fuel\Core\Input::post('usage'), 'source' => \Fuel\Core\Input::post('source')));
                     } else {
                         throw new Exception('File not found!');
                     }
                 }
                 if ($file and $file->save()) {
                     DB::commit_transaction();
                     \Fuel\Core\Session::set_flash('success', 'Upload success');
                 } else {
                     throw new Exception('Cannot save into database!');
                 }
             } else {
                 throw new Exception($val->show_errors());
             }
         } catch (Exception $e) {
             DB::rollback_transaction();
             \Fuel\Core\Session::set_flash('error', $e->getMessage());
         }
     }
     \Fuel\Core\Response::redirect(\Fuel\Core\Uri::create('filemanager/folder/' . $folder));
 }
Example #22
0
 /**
  * @author Thuanth6589
  * action index
  */
 public function action_index()
 {
     $data['person_id'] = Input::get('person_id', '');
     $inteview_usami = new \Model_Interviewusami();
     if ($data['person_id'] == '' || !\Model_Person::find($data['person_id'])) {
         return Response::redirect(Uri::base() . 'job/persons');
     }
     $data['inteview_usami'] = \Model_Interviewusami::find_one_by('person_id', $data['person_id']);
     if (Input::method() == 'POST') {
         $fields = Input::post('data');
         $inteview_usami->set_data($fields);
         if ($inteview_usami->save_data()) {
             Session::set_flash('success', \Constants::$message_create_success);
             return Response::redirect(Uri::base() . 'job/interviewusami?person_id=' . $data['person_id']);
         }
         Session::set_flash('error', \Constants::$message_create_error);
     }
     $this->template->title = 'UOS求人システム';
     $this->template->content = View::forge('interviewusami/index', $data);
 }
Example #23
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * action delete user
  */
 public function action_delete()
 {
     if (Input::method() == 'POST') {
         $user_id = Input::post('user_id', null);
         $result = 'error';
         if (!\Model_Muser::find_by_pk($user_id)) {
             $message = 'ユーザーは存在しません';
         } else {
             $message = \Constants::$message_delete_error;
             $user = new \Model_Muser();
             if ($user->delete_data($user_id)) {
                 $result = 'success';
                 $message = \Constants::$message_delete_success;
             }
         }
         Session::set_flash($result, $message);
     }
     $url = Session::get('users_url') ? Session::get('users_url') : Uri::base() . 'master/users';
     return Response::redirect($url);
 }
Example #24
0
 private function sample_function()
 {
     try {
         // Stuff
     } catch (Exception $ex) {
         Session::set_flash('error', $ex->getMessage());
         $this->log_error($ex);
         Response::redirect('fanpage/index');
     }
 }
Example #25
0
    echo Session::get_flash('error');
    ?>
	</div>
<?php 
}
?>
<h3>
	媒体
</h3>
	<form action="<?php 
echo \Fuel\Core\Uri::base();
?>
master/media/delete" method="post">
		<p class="text-right">
			<a href="<?php 
echo \Fuel\Core\Session::get('medias_url') ? \Fuel\Core\Session::get('medias_url') : \Fuel\Core\Uri::base() . 'master/medias';
?>
" class="btn btn-warning btn-sm right">
				<i class="glyphicon glyphicon-arrow-left icon-white"></i>
				戻る
			</a>
			<?php 
if (isset($media)) {
    ?>
			<input name="m_media_id" type="hidden" value="<?php 
    echo $media->m_media_id;
    ?>
">
			<button class="btn btn-danger btn-sm" type="button" id="btn_medias_back">
				<i class="glyphicon glyphicon-trash icon-white"></i>
				削除
Example #26
0
 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);
     }
 }
Example #27
0
 public function action_create()
 {
     try {
         if (Input::method() == 'POST') {
             $file = Input::file('news_photo_file');
             $val = Model_News::validate('create');
             if ($val->run()) {
                 $config = array('path' => "/var/www/html/uploads/news_photo/", 'ext_whitelist' => array('jpg', 'jpeg', 'png'), 'file_chmod' => 0777, 'auto_rename' => true, 'overwrite' => true, 'randomize' => true, 'create_path' => true);
                 //  $allowList = array(".jpeg", ".jpg", ".png");
                 //  $error = false;
                 //  $path = realpath(DOCROOT."/../../uploads/news_photo/").DS;
                 $news_photo = "";
                 Upload::process($config);
                 if (Upload::is_valid()) {
                     Upload::save();
                     $news_photo = Upload::get_files()[0];
                     $news = Model_News::forge(array('news_title' => Input::post('news_title'), 'news_short_detail' => Input::post('news_short_detail'), 'news_detail' => Input::post('news_detail'), 'news_photo' => $news_photo['saved_as'], 'news_published' => Input::post('news_published'), 'created_at' => time(), 'published_at' => Input::post('news_published') == 1 ? time() : 0));
                     if ($news and $news->save()) {
                         Session::set_flash('success', 'Added news #' . $news->id . '.');
                         Response::redirect('news/edit/' . $news->id);
                     } else {
                         Session::set_flash('error', 'Could not save news.');
                     }
                     if ($file and $file->save()) {
                         DB::commit_transaction();
                         \Fuel\Core\Session::set_flash('success', 'Upload success');
                     }
                 }
                 /*if($file['size'] > 0){
                 
                                         $ext = strtolower(substr($file['name'],strrpos($file['name'],".")));
                 
                                         if(!in_array($ext,$allowList)){
                                             Session::set_flash('error', 'ชนิดของไฟล์ภาพไม่ถูกต้อง');
                                             $error = true;
                                         }
                 
                                         $filename = md5(time());
                 
                                         if(@copy($file['tmp_name'],$path.$filename.$ext)){
                 
                                             $news_photo = $filename.$ext;
                 
                                             /* small thumbnail */
                 #   parent::create_cropped_thumbnail($path.$filename.$ext,64,64,"-s");
                 #   parent::create_cropped_thumbnail($path.$filename.$ext,128,128,"-s@2x");
                 /* */
                 /* medium thumbnail */
                 #  parent::create_cropped_thumbnail($path.$filename.$ext,360,240,"-m");
                 #  parent::create_cropped_thumbnail($path.$filename.$ext,720,480,"-m@2x");
                 /*
                 
                                 } else {
                                     Session::set_flash('error', 'ไม่สามารถอัพโหลดไฟล์ภาพได้ โปรดลองใหม่อีกครั้ง');
                                     $error = true;
                                 }
                 
                             }*/
                 /*if(!$error){
                 
                                         $news = Model_News::forge(array(
                                             'news_title' => Input::post('news_title'),
                                             'news_short_detail' => Input::post('news_short_detail'),
                                             'news_detail' => Input::post('news_detail'),
                                             'news_photo' => $news_photo,
                                             'news_published' => Input::post('news_published'),
                                             'created_at' => time(),
                                             'published_at' => (Input::post('news_published')==1)?time():0
                                         ));
                 
                                         if ($news and $news->save()){
                                             Session::set_flash('success', 'Added news #' . $news->id . '.');
                                             Response::redirect('news/edit/'.$news->id);
                                         } else {
                                             Session::set_flash('error', 'Could not save news.');
                                         }
                 
                                     }*/
             } else {
                 $msg = '<ul>';
                 foreach ($val->error() as $field => $error) {
                     $msg .= '<li>' . $error->get_message() . '</li>';
                 }
                 $msg .= '</ul>';
                 Session::set_flash('error', $msg);
             }
         }
         $this->theme->set_template('edit');
         $this->theme->get_template()->set_global('current_menu', "News", false);
         $this->theme->get_template()->set_global('current_menu_desc', "จัดการข่าวทั้งหมดในระบบ", false);
         $this->theme->get_template()->set('breadcrumb', array(array('title' => "Home", 'icon' => "fa-home", 'link' => Uri::create('home'), 'active' => false), array('title' => "News", 'icon' => "eicon-newspaper", 'link' => Uri::create('news/index'), 'active' => false), array('title' => "Create", 'icon' => "", 'link' => "", 'active' => true)));
         $this->theme->get_template()->set_global('mode', "create", false);
         $this->theme->get_template()->set('page_specific_js', "form_news.js");
         $this->theme->set_partial('sidebar', 'common/sidebar');
         $this->theme->set_partial('left', 'news/create');
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Example #28
0
 public function get_division_3()
 {
     $data = array('sssale_list' => array(), 'person_list' => array(), 'employment_list' => array());
     $user_info = \Fuel\Core\Session::get('login_info');
     $order_obj = new Model_Orders();
     $partner_obj = new Model_Mpartner();
     $mss_obj = new Model_Mss();
     $person_obj = new Model_Person();
     $employment_obj = new Model_Employment();
     $sssale_obj = new Model_Sssale();
     $list_order_id = array();
     $list_sssale_id = array();
     $order_list = $order_obj->get_list_oders_login($user_info['user_id']);
     /*where 1*/
     if (count($order_list)) {
         foreach ($order_list as $row) {
             $list_order_id[] = $row['order_id'];
         }
     }
     /*where 2*/
     $list_partner_code = array();
     $list_ss_id = array();
     $partner_list = $partner_obj->get_list_partner_login($user_info['user_id']);
     if (count($partner_list)) {
         foreach ($partner_list as $row) {
             $list_partner_code[] = $row['partner_code'];
         }
     }
     if (count($list_partner_code)) {
         $mss_list = $mss_obj->get_all_ss_by_list_partner_code($list_partner_code);
         $mss_list_id = '';
         $sssale_array = array();
         if (count($mss_list)) {
             foreach ($mss_list as $row) {
                 $mss_list_id .= $row['ss_id'] . ',';
                 $ss_array_list[$row['ss_id']] = $row['ss_name'];
             }
             $sssale_list = $sssale_obj->get_list_sssale('ss_id IN (' . trim($mss_list_id, ',') . ')');
             foreach ($sssale_list as $row) {
                 $list_sssale_id[] = $row['sssale_id'];
             }
         }
     }
     $person_list = $person_obj->get_person_division_3($list_sssale_id, $list_order_id);
     $list_person_id = array();
     if (count($person_list)) {
         $list_sssale_id = array();
         foreach ($person_list as $row) {
             $list_person_id[] = $row['person_id'];
             $list_sssale_id[] = (int) $row['sssale_id'];
         }
         $list_employment = $employment_obj->get_list_data($list_person_id);
         $list_sssale_of_person = $sssale_obj->get_list_sssale('sssale_id IN (' . implode(',', $list_sssale_id) . ')');
         $list_employment_array = array();
         $list_sssale = array();
         foreach ($list_employment as $row) {
             $list_employment_array[$row['person_id']] = $row;
         }
         $list_ss_id = array();
         $list_sssale_of_ss = array();
         foreach ($list_sssale_of_person as $row) {
             $list_ss_id[] = (int) $row['ss_id'];
             $list_sssale_of_ss[$row['sssale_id']] = (int) $row['ss_id'];
         }
         $list_ss_of_person = $mss_obj->get_list_ss('ss_id IN (' . implode(',', $list_ss_id) . ')');
         $list_ss_name = array();
         foreach ($list_ss_of_person as $row) {
             $list_ss_name[$row['ss_id']] = $row['ss_name'];
         }
         $list_person_ss_name = array();
         foreach ($list_sssale_of_ss as $sssale_id => $ss_id) {
             $list_person_ss_name[$sssale_id] = $list_ss_name[$ss_id];
         }
         $data['person_list'] = $person_list;
         $data['sssale_list'] = $list_person_ss_name;
         $data['employment_list'] = $list_employment_array;
     }
     return $data;
 }
Example #29
0
				<td>
					<div class="btn-group">
						<a style="cursor: pointer" data-toggle="dropdown" class="btn dropdown-toggle btn-sm btn-success">
							処理
							<span class="caret"></span>
						</a>
						<ul name="add-pulldown" class="dropdown-menu">
							<li><a href="<?php 
        echo Uri::base(true);
        ?>
job/person?person_id=<?php 
        echo $value['person_id'];
        ?>
" name="edit-btn"><i class="glyphicon glyphicon-pencil"></i> 編集</a></li>
		<?php 
        $login_info = \Fuel\Core\Session::get('login_info');
        if ($login_info['division_type'] != 3) {
            if (isset($value['status']) && $value['status'] == 0) {
                echo '<li><a class="person-agree" href="#" value="' . $value['person_id'] . '"><i class="glyphicon glyphicon-thumbs-up"></i> 承認</a></li>';
            } else {
                echo '<li class="disabled"><a><i class="glyphicon glyphicon-thumbs-up"></i> 承認</a></li>';
            }
        }
        ?>
							<li><a href="<?php 
        echo Uri::base(true);
        ?>
job/employment?person_id=<?php 
        echo $value['person_id'];
        ?>
" name="employment-btn"><i class="glyphicon glyphicon-user"></i> 採用管理</a></li>
Example #30
0
?>
"><a href="<?php 
echo Uri::base();
?>
job/plan">予算</a></li>
						<li class="<?php 
echo Utility::view_menu_role('result');
?>
"><a href="<?php 
echo Uri::base();
?>
job/result">応募実績</a></li>
					</ul>
				</li>
				<?php 
if (!\Fuel\Core\Session::get('login_info') || \Fuel\Core\Session::get('login_info') && (Utility::view_menu_role('contacts') != 'hide' || Utility::view_menu_role('concierges') != 'hide')) {
    ?>
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">サポート <span class="caret"></span></a>
					<ul class="dropdown-menu" role="menu">
						<li class="<?php 
    echo Utility::view_menu_role('contacts');
    ?>
"><a href="<?php 
    echo Uri::base();
    ?>
support/contacts">お問い合わせ</a></li>
						<li class="<?php 
    echo Utility::view_menu_role('concierges');
    ?>
"><a href="<?php