Example #1
0
 public function action_login()
 {
     // already logged in?
     if (Auth::check()) {
         // yes, so go back to the page the user came from, or the
         // application dashboard if no previous page can be detected
         //Messages::info(__('login.already-logged-in'));
         Response::redirect_back('');
     }
     // was the login form posted?
     if (Input::method() == 'POST') {
         // check the credentials.
         print_r(Input::all());
         if (Auth::login(Input::param('email'), Input::param('password'))) {
             // did the user want to be remembered?
             if (Input::param('remember', false)) {
                 // create the remember-me cookie
                 Auth::remember_me();
             } else {
                 // delete the remember-me cookie if present
                 Auth::dont_remember_me();
             }
             // logged in, go back to the page the user came from, or the
             // application dashboard if no previous page can be detected
             Response::redirect_back('/home');
         } else {
             // login failed, show an error message
             $this->error = 'test';
         }
     }
     // display the login page
     return \View::forge('auth/login');
 }
 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 #3
0
 /**
  * @author dangbc <*****@*****.**>
  * filter plan
  */
 public function action_loaddata()
 {
     $year = Input::post('year');
     $plan = new \Model_Plan();
     $data_plan = $plan->data_plan($year);
     return json_encode($data_plan);
 }
Example #4
0
 /**
  * @author NamNT
  * action index
  */
 public function action_index()
 {
     $model = new \Model_Person();
     $filter = array();
     $data = array();
     if (Input::get()) {
         $filter = Input::get();
         $query_string = http_build_query($filter);
         \Session::set('url_filter_persons', $query_string);
         $person_url = $query_string ? '?' . $query_string : '';
     } else {
         $person_url = '';
     }
     if (Input::get('export', false)) {
         $filter['per_page'] = 100000;
         $download_his = new \Model_Downloadhis();
         $download = array('param' => json_encode($filter), 'content' => json_encode(Input::server()));
         $download_his->set_data($download);
         if ($download_his->save_data()) {
             $this->export($model->get_filter_person($filter));
         }
     }
     $config = ['pagination_url' => \Uri::base() . 'job/persons/index' . $person_url, 'total_items' => $model->count_data($filter), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true];
     \Fuel\Core\Cookie::set('person_url', \Uri::main() . $person_url, 30 * 60);
     $pagination = \Uospagination::forge('mypagination', $config);
     $filter['offset'] = $pagination->offset;
     $filter['limit'] = $pagination->per_page;
     $data['listPerson'] = $model->get_filter_person($filter);
     $data['groups'] = (new \Model_Mgroups())->get_type(1);
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('persons/persons', $data);
 }
Example #5
0
 /**
  * @author Bui Dang <*****@*****.**>
  * action login
  */
 public function action_index()
 {
     if (\Fuel\Core\Session::get('login_info')) {
         \Fuel\Core\Response::redirect(($uri = \Fuel\Core\Session::get('uri_before_login')) ? $uri : \Fuel\Core\Uri::base());
     }
     if (\Fuel\Core\Input::post()) {
         $login_id = \Fuel\Core\Input::post('login_id');
         $pass = \Fuel\Core\Input::post('password');
         if ($user = Model_Muser::find_one_by(array('login_id' => $login_id, 'pass' => hash('SHA256', $pass)))) {
             $login_info = array('department_id' => $user['department_id'], 'division_type' => $user['division_type'], 'name' => $user['name'], 'login_id' => $user['login_id'], 'email' => $user['mail'], 'user_id' => $user['user_id'], 'expired' => time() + 30 * 60);
             \Fuel\Core\Session::set('login_info', $login_info);
             $url = \Fuel\Core\Uri::base();
             if ($user['division_type'] == 2) {
                 $url = \Fuel\Core\Uri::base() . '?division=2';
             }
             if ($user['division_type'] == 3) {
                 $url = \Fuel\Core\Uri::base() . '?division=3';
             }
             \Fuel\Core\Response::redirect(($uri = \Fuel\Core\Session::get('uri_before_login')) ? $uri : $url);
         }
         \Fuel\Core\Session::set_flash('error', 'ログインIDもしくはパスワードが正しくありません');
     }
     $this->template->title = 'UOS求人システム';
     $this->template->content = \View::forge('login/index');
 }
 public static function init()
 {
     if (!\Fuel::$is_cli and !\Input::is_ajax() and !static::$profiler) {
         static::$profiler = new PhpQuickProfiler(FUEL_START_TIME);
         static::$profiler->queries = array();
         static::$profiler->queryCount = 0;
     }
 }
Example #7
0
 public function post_login()
 {
     $data = (object) Input::post();
     if (Auth::login($data->username, $data->password)) {
         return \Response::redirect('admin/home');
     }
     return \Response::redirect('admin/login');
 }
Example #8
0
 /**
  * @author Bui Dang <*****@*****.**>
  * action Save group
  */
 public function action_ajaxsave()
 {
     $group = new \Model_Mgroups();
     $groupid = \Input::post('groupid');
     $group_name = Input::post('groupname');
     $data = array('group_id' => $groupid, 'group_name' => $group_name);
     $status = $group->create_group($data);
     return Response::forge(json_encode($status));
 }
Example #9
0
 public function post_add()
 {
     $model = Model_Blog::forge();
     $model->set(Input::post());
     $model->set(BLOG_CREATED_DATE, DB::expr('now()'));
     $model->set(DELETE_FLG, '0');
     $model->save();
     Response::redirect(Config::get('base_url'));
 }
Example #10
0
 public static function post_photo_to_fb_by_url($data)
 {
     $data = json_decode($data);
     $flag = false;
     $facebook = new \Libs\Facebook();
     $page = \Model_Pages::find(\Fuel\Core\Input::post('page_id'));
     $flag = $facebook->post_photo_by_url($page->long_lived_access_token, $page->fanpage_id, $data);
     return $flag;
 }
Example #11
0
 public function __construct()
 {
     if (!\Fuel\Core\Input::is_ajax()) {
         $protocol = strtolower(substr(\Fuel\Core\Input::server('SERVER_PROTOCOL'), 0, 5)) == 'https' ? 'https://' : 'http://';
         $uri_current = $protocol . \Fuel\Core\Input::server('HTTP_HOST') . \Fuel\Core\Input::server('REQUEST_URI');
         if (!Input::get('export', false)) {
             \Fuel\Core\Session::set('uri_before_login', $uri_current);
         }
     }
 }
Example #12
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 #13
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * list media
  */
 public function action_get_partner()
 {
     $m_group_id = Input::post('m_group_id');
     if (!isset($m_group_id) || $m_group_id == '') {
         exit(json_encode($this->_partners));
     }
     $m_partner = new \Model_Mpartner();
     $partners = $this->_partners + array_column($m_partner->get_partner_group($m_group_id, $this->_partner_type), 'branch_name', 'partner_code');
     return Response::forge(json_encode($partners));
 }
Example #14
0
 public static function init()
 {
     if (!\Fuel::$is_cli and !\Input::is_ajax() and !static::$profiler) {
         static::$profiler = new PhpQuickProfiler(FUEL_START_TIME);
         static::$profiler->queries = array();
         static::$profiler->queryCount = 0;
         static::mark(__METHOD__ . ' Start');
         \Fuel::$profiling = true;
     }
 }
Example #15
0
 public static function handleCallback()
 {
     $result = false;
     $oauth_verifier = \Fuel\Core\Input::get('oauth_verifier');
     if (isset($oauth_verifier)) {
         \Fuel\Core\Session::set('oauthVerifier', $oauth_verifier);
         return true;
     } else {
         return false;
     }
 }
Example #16
0
 public function action_index()
 {
     if ($search = \Fuel\Core\Input::param('search')) {
         $data['projects'] = Model_Project::find('all', array('where' => array(array('name', 'like', "%{$search}%")), 'related' => array('client', 'project_type')));
     } else {
         $data['projects'] = Model_Project::find('all', array('related' => array('client', 'project_type')));
     }
     $this->template->set_global('auto_complete_list', Model_Project::get_auto_complete_list());
     $this->template->title = "Projects &raquo; Listing";
     $this->template->content = View::forge('admin/projects/index', $data);
 }
Example #17
0
 public function post_list()
 {
     $page = (int) Input::post('page') !== 0 ? (int) Input::post('page') : 1;
     $code = Input::post('code');
     $category_id = Model_Base_Category::get_id_by_code($code);
     $total = Model_Base_Product::count_by_category($category_id);
     $limit = _DEFAULT_LIMIT_;
     $offset = $page * $limit - $limit < $total ? $page * $limit - $limit : _DEFAULT_OFFSET_;
     $this->data['products'] = Model_Base_Product::get_by_category($category_id, $offset, $limit);
     $this->data['success'] = true;
     return $this->response($this->data);
 }
Example #18
0
 public function post_list()
 {
     $page = (int) Input::post('page') !== 0 ? (int) Input::post('page') : 1;
     $category_id = Input::post('category_id');
     $type = !empty($category_id) && Model_Base_Category::valid_field('id', $category_id) ? true : false;
     $total = $type ? Model_Base_Product::admin_count_by_category($category_id) : Model_Base_Product::count_all();
     $limit = _DEFAULT_LIMIT_;
     $offset = $page * $limit - $limit < $total ? $page * $limit - $limit : _DEFAULT_OFFSET_;
     $this->data['product'] = $type ? Model_Base_Product::admin_get_by_category($category_id, $offset, $limit) : Model_Base_Product::get_all($offset, $limit);
     $this->data['success'] = true;
     return $this->response($this->data);
 }
Example #19
0
 public function action_detail()
 {
     $this->setJavascript('responesive_tabs.js');
     $this->setJavascript('fb_comment.js');
     $aryDataTemplate['data'] = array();
     $id = Input::param('id');
     if ($id) {
         $data = Model_Blog::find($id);
         $aryDataTemplate['data'] = $data;
         $this->setPageTitle($data[BLOG_TITLE]);
     }
     $this->template->content = View_Smarty::forge('blog/detail.tpl', $aryDataTemplate);
 }
Example #20
0
 public function get_announcement()
 {
     $__getParams = Input::get();
     if (!isset($__getParams['view'])) {
         $view_type = 'all';
     }
     $view_type = $__getParams['view'];
     if (!in_array($view_type, $this->announcement_view_type)) {
         // Return 404 pages
     }
     $call_func = 'announcement_view_' . $view_type;
     $this->{$call_func}($__getParams);
 }
Example #21
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 #22
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 #23
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 #24
0
 public function post_recruitment()
 {
     $data = Input::json();
     if ($data == null) {
         $this->template->__yield__ = View::forge('pages/recruitment', array());
     } else {
         if ($data['action'] == 'save') {
             $response['Code'] = Recruitment::update_content($data);
             if ($response['Code'] == 1) {
                 $response['Msg'] = 'Update success';
             } else {
                 $response['Msg'] = 'Update fail';
             }
             return json_encode($response);
         }
     }
 }
Example #25
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 #26
0
 public function get_index()
 {
     $reqObj = Input::get();
     $id = $reqObj['id'];
     $managerObj = new StoryManager();
     $storyObj = $managerObj->getStoryBaseID($id);
     $a = $managerObj->getSectionInfoBaseID($storyObj->Type);
     $storyObj->updateView();
     //		$retData['Data']['MainSection'] = 'Thông báo';
     //		$retData['Data']['SubSection'][0] = 'Thông Báo & Sự Kiện';
     //		$retData['Data']['SubSection'][1] = 'Thông Báo';
     $retData['Data'] = $a;
     $retData['Data']['Next'] = array();
     $retData['Data']['Popular'] = array();
     $retData['Data']['Event'] = array();
     $retData['Data']['Post'] = $storyObj->getFull();
     $this->template->__yield__ = View::forge('section/details', $retData);
 }
Example #27
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 #28
0
 public function action_filter()
 {
     $user_id = \Fuel\Core\Input::param('user_id', 0);
     $client_id = Fuel\Core\Input::param('client_id', 0);
     $project_id = \Fuel\Core\Input::param('project_id', 0);
     $month = Fuel\Core\Input::param('month', '00');
     $year = Fuel\Core\Input::param('year', date('Y'));
     $status = 0;
     $data['open_tasks'] = THelper::get_tasks($user_id, $client_id, $project_id, $month, $year, $status, array(\Fuel\Core\Input::param('sort', 'priority') => \Fuel\Core\Input::param('order', 0)));
     $view = \Fuel\Core\View::forge('admin/tasks/index');
     $view->set_global('clients', Model_Customer::find('all', array('order_by' => array('name' => 'asc'))));
     $view->set_global('users', Model_User::find('all', array('order_by' => array('username' => 'asc'))));
     $view->set_global('years', range(2015, date('Y')));
     $view->set_global('months', THelper::get_months_array());
     $view->set_global('open_tasks', $data['open_tasks']);
     $view->set_global('admin', true);
     $this->template->title = 'Open Tasks';
     $this->template->content = $view;
 }
Example #29
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 #30
0
 /**
  * @author Thuanth6589 <*****@*****.**>
  * action delete media
  */
 public function action_delete()
 {
     if (Input::method() == 'POST') {
         $result = 'error';
         $m_media_id = Input::post('m_media_id', null);
         if (!\Model_Mmedia::find_by_pk($m_media_id)) {
             $message = '媒体は存在しません';
         } else {
             $umedia = new \Model_Umedia();
             $message = \Constants::$message_delete_error;
             if ($umedia->delete_media($m_media_id)) {
                 $result = 'success';
                 $message = \Constants::$message_delete_success;
             }
         }
         Session::set_flash($result, $message);
     }
     $url = Session::get('medias_url') ? Session::get('medias_url') : Uri::base() . 'master/medias';
     return Response::redirect($url);
 }