public static function sendReservedEMail($id) { $reservation = Model_Lessontime::find($id); // for teacher $url = Uri::base() . "teachers/top"; date_default_timezone_set(Config::get("timezone.timezone")[$reservation->teacher->timezone]); $body = View::forge("email/teachers/reserved", ["url" => $url]); $body->set("name", $reservation->teacher->firstname); $body->set("reservation", $reservation); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($reservation->teacher->email); $sendmail->subject("Lesson Booking Confirmation / Game-bootcamp"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); // for student $url = Uri::base() . "students/top"; date_default_timezone_set(Config::get("timezone.timezone")[$reservation->student->timezone]); $body = View::forge("email/students/reserved", ["url" => $url]); $body->set("name", $reservation->student->firstname); $body->set("reservation", $reservation); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($reservation->student->email); $sendmail->subject("Lesson Booking Confirmation / Game-bootcamp"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); }
protected static function render_menu($menus) { $selected = \Uri::segment(1); $out = ''; foreach ($menus as $k => $v) { is_int($k) and $k = $v; if (substr_compare($k, 'divider', 0, 7) == 0) { $out .= static::$template['menu_divider']; continue; } isset($v['label']) or $v['label'] = \Lang::get($k); isset($v['link']) or $v['link'] = '#'; isset($v['level']) or $v['level'] = 0; $user = \Session::get('user_info'); if ($user['level'] < $v['level']) { continue; } if (isset($v['submenu']) and count($v['submenu']) > 0) { $active = array_key_exists($selected, $v['submenu']) ? ' active' : ''; $out .= str_replace(array('{item_id}', '{active}', '{label}', '{submenu}'), array($k, $active, $v['label'], static::render_menu($v['submenu'])), static::$template['menu_dropdown']); } else { $active = $selected == $k ? ' class="active"' : ''; $out .= str_replace(array('{item_id}', '{active}', '{link}', '{label}'), array($k, $active, \Uri::base() . $v['link'], $v['label']), static::$template['menu_item']); } } return $out; }
/** * get admin's avatar picture. * * @param integer $account_id * @return string return element ready for display avatar. */ function getAdminAvatar($account_id) { // set default avatar $theme = \Theme::instance(); $doc_root = str_replace('\\', '/', DOCROOT); $default_avatar_getfile = $theme->asset->get_file('default-avatar.jpg', 'img'); $default_no_avatar = str_replace([$doc_root, \Uri::base()], '', $default_avatar_getfile); unset($doc_root, $default_avatar_getfile, $theme); if (!is_numeric($account_id) || intval($account_id) === intval(0)) { return $default_no_avatar; } $cache_name = 'public.themes.sys2.getAdminAvatar-' . \Model_Sites::getSiteId(false) . '-' . $account_id; $cache_data = \Extension\Cache::getSilence($cache_name); if (false === $cache_data) { // if never cached or cache expired. $result = \DB::select()->as_object()->from('accounts')->where('account_id', $account_id)->execute(); if (count($result) > 0) { $row = $result->current(); if ($row->account_avatar != null) { $return_val = $row->account_avatar; \Cache::set($cache_name, $return_val, 86400); unset($cache_name); return $return_val; } } if (!isset($return_val) || isset($return_val) && $return_val == null) { // not found account or not found avatar. \Cache::set($cache_name, $default_no_avatar, 86400); unset($cache_name); return $default_no_avatar; } } unset($cache_name); return $cache_data; }
public function before() { parent::before(); $auth = \Auth::instance('SimpleAuth'); if (\Input::get('logout')) { $auth->logout(); \Response::redirect(\Uri::base(false) . 'admin/login'); } $uri = explode('/', \Uri::string()); if ($auth->check()) { if (count($uri) < 3 && (empty($uri[1]) || $uri[1] == 'login')) { \Response::redirect(\Uri::base(false) . 'admin/list'); } // Load admin Config for List View and default to first tab $this->data['tabs'] = $this->template->tabs = \Config::get('admin.tabs'); $this->data['table'] = $this->param('item', ''); // get item from URI if (!$this->data['table']) { list($this->data['table']) = array_slice(array_keys($this->data['tabs']), 0, 1); } $this->template->table = $this->data['table']; } elseif (count($uri) > 1 && $uri[1] != 'login') { \Response::redirect(\Uri::base(false) . 'admin/login'); } if ($this->auto_render === true) { // set up defaults $this->template->body = ''; } return true; }
public function sidebar($options = array()) { $identifier = array('nav' => array('id' => 'sidebar', 'class' => 'sidebar nav-collapse collapse'), 'ul' => array('id' => 'side-nav', 'class' => 'side-nav'), 'li' => array('id' => '', 'class' => '', 'role' => '')); if (isset($options['nav'])) { $identifier['nav'] = $options['nav']; } if (isset($options['ul'])) { $identifier['ul'] = $options['ul']; } if (isset($options['li'])) { $identifier['li'] = $options['li']; } $ul = ' <nav id="' . $identifier['nav']['id'] . '" class="' . $identifier['nav']['class'] . '"> <ul id="' . $identifier['ul']['id'] . '" class="' . $identifier['ul']['class'] . '">'; foreach ($options['data'] as $k => $v) { if (isset($v['filter'])) { if ($v['filter'] == '*') { $ul .= '<li><a href="' . Uri::base() . $v['link'] . '">' . $v['name'] . '</a></li>'; } elseif (in_array(\Auth\Auth::instance()->get('group')->id, $v['filter'])) { $ul .= '<li><a href="' . Uri::base() . $v['link'] . '">' . $v['name'] . '</a></li>'; } } } $ul .= '</ul></nav>'; return $ul; }
private function pagination($model, $options) { $config = array('pagination_url' => Uri::base() . $options['controller'] . '/' . $options['page'], 'total_items' => count($model), 'per_page' => isset($options['per_page']) ? $options['per_page'] : '', 'uri_segment' => 'page', 'wrapper' => '<div class="clearfix"><div class="pagination no-margin">{pagination}</div></div>', 'first' => '<li class="first">{link}</li>', 'fist-marker' => 'First', 'first-link' => '<a href="{uri}">{page}</a>', 'previous' => '<li class="previous">{link}</li>', 'previous-marker' => 'Previous', 'previous-link' => '<a href="{uri}">{page}</a>', 'previous-inactive' => '<li class="previous-inactive">{link}</li>', 'previous-inactive-link' => '<a href="{uri}" rel="prev">{page}</a>', 'regular' => '<li>{link}</li>', 'regular-link' => '<a href="{uri}">{page}</a>', 'active' => '<li class="active">{link}</li>', 'active-link' => '<a href="{uri}">{page}</a>', 'next' => '<li class="next">{link}</li>', 'next-marker' => 'Next', 'next-link' => '<a href="{uri}" rel="next">{page}</a>', 'next-inactive' => '<li class="next-inactive">{link}</li>', 'next-inactive-link' => '<a href="{uri}" rel="next">{page}</a>', 'last' => '<li class="last">{link}</li>', 'last-marker' => 'Last', 'last-link' => '<a href="{uri}">{page}</a>'); $pagination = Pagination::forge('table', $config); $data = $options['model']::query()->rows_offset($pagination->per_page)->rows_limit($pagination->offset)->get(); return $pagination->render(); }
public function action_index() { $this->template = View::forge("teachers/template"); $this->template->auth_status = false; $this->template->title = "Forgotpassword"; // login if (Input::post("email", null) !== null and Security::check_token()) { $email = Input::post('email', null); $user = Model_User::find("first", ["where" => [["email", $email]]]); if ($user != null) { $token = Model_Forgotpasswordtoken::forge(); $token->user_id = $user->id; $token->token = sha1("asadsada23424{$user->email}" . time()); $token->save(); $url = Uri::base() . "teachers/forgotpassword/form/{$token->token}"; $body = View::forge("email/forgotpassword", ["url" => $url]); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($email); $sendmail->subject("forgot password"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); } $view = View::forge("teachers/forgotpassword/sent"); $this->template->content = $view; } else { $view = View::forge("teachers/forgotpassword/index"); $this->template->content = $view; } }
/** * @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); }
/** * Creates an html image tag * * Sets the alt atribute to filename of it is not supplied. * * @param string the source * @param array the attributes array * @return string the image tag */ public static function img($src, $attr = array()) { if (!preg_match('#^(\\w+://)# i', $src)) { $src = \Uri::base(false) . $src; } $attr['src'] = $src; $attr['alt'] = isset($attr['alt']) ? $attr['alt'] : pathinfo($src, PATHINFO_FILENAME); return html_tag('img', $attr); }
/** inheritdoc */ public static function displayForm($value, &$settings, $model) { $settings = static::settings($settings); $include_label = isset($settings['label']) ? $settings['label'] : true; $required = isset($settings['required']) ? $settings['required'] : false; $errors = $model->getErrorsForField($settings['mapping']['fieldName']); $has_errors = count($errors) > 0; // Check stylesSet URL $stylesSet = \Arr::get($settings, 'stylesSet'); if (!empty($stylesSet) && substr($stylesSet, 0, 1) == '/') { // Add an absolute URL to the start $settings['stylesSet'] = rtrim(\Uri::base(false), '/') . $stylesSet; } // Add ckeditor to the class for the field $input_attributes = isset($settings['input_attributes']) ? $settings['input_attributes'] : array('class' => 'input-xxlarge'); $input_attributes['class'] = $input_attributes['class'] . " ckeditor-cmf"; $label = !$include_label ? '' : \Form::label($settings['title'] . ($required ? ' *' : '') . ($has_errors ? ' - ' . $errors[0] : ''), $settings['mapping']['fieldName'], array('class' => 'item-label')); $input = \Form::textarea($settings['mapping']['fieldName'], strval($value), $input_attributes); // Set up required information for any links specified if (isset($settings['links']) && is_array($settings['links'])) { $links = array(); foreach ($settings['links'] as $link_type => $link) { if (!class_exists($link_type)) { continue; } $link['table_name'] = \CMF\Admin::getTableForClass($link_type); $link['singular'] = $link_type::singular(); $link['plural'] = $link_type::plural(); $link['icon'] = $link_type::icon(); $links[$link_type] = $link; } $settings['links'] = $links; } if (isset($settings['stylesSet'])) { if (file_exists(DOCROOT . ltrim($settings['stylesSet'], '/'))) { $settings['stylesSet'] = 'default:' . \Uri::base(false) . ltrim($settings['stylesSet'], '/'); } else { unset($settings['stylesSet']); } } if (isset($settings['contentsCss'])) { if (strpos($settings['contentsCss'], '.php') === false && !file_exists(DOCROOT . ltrim($settings['contentsCss'], '/'))) { unset($settings['contentsCss']); } } // Return only the field and label if no wrap is required if (isset($settings['wrap']) && $settings['wrap'] === false) { return $label . $input; } // Return the widget if (isset($settings['widget']) && $settings['widget'] === true) { return array('assets' => array(), 'content' => $input, 'widget' => true, 'widget_title' => $settings['title'], 'widget_icon' => 'align-left', 'js_data' => $settings); } // Return the normal field return array('assets' => array(), 'content' => html_tag('div', array('class' => 'control-group ' . ($has_errors ? ' error' : '')), $label . $input), 'widget' => false, 'js_data' => $settings); }
public function action_404() { Lang::load('error', 'error'); $output['error_head'] = Lang::get('error.404_error_head'); $output['error_content'] = Lang::get('error.404_error_content', array('home_link' => Uri::base())); // <head> output ---------------------------------------------------------------------------------------------- $output['page_title'] = Lang::get('error.404_page_title'); // <head> output ---------------------------------------------------------------------------------------------- return Response::forge(Theme::instance()->view('error/404_v', $output)->auto_filter(false), 404); }
public function getParentBase($default = null) { if (empty($this->parent_site)) { if (!is_null($default)) { return $default; } return rtrim(\Uri::base(false), '/'); } return $this->parent_site; }
public function action_index() { $item_id = \Input::get('id', ''); $save_item = \Input::post('save_item'); $post_data = \Input::post('item_field'); $new = \Input::get('new', ''); if (!$this->data['table'] || !isset($this->data['tabs'][$this->data['table']])) { return $this->return_404(); } $class = $this->data['tabs'][$this->data['table']]; $this->data['item_config'] = $class::admin_config(); if ($new) { $item = $class::factory(); } elseif ($item_id) { $item = $class::find($item_id); } if (!$item) { return $this->return_404(); } if (($id = $item->id) && \Input::post('delete')) { $item->delete(); \Response::redirect(\Uri::base(false) . 'admin/list/' . $this->data['table'] . '?delete=' . $id); } // Load admin fields for the template or to save $post_data = \Input::post('item_field'); $post_save = array(); foreach ($this->data['item_config'] as $field => $field_data) { //TODO: get the factory working properly so we can chain this muh-fuh $field_type = $field_data['type']; $new_field = $field_type::factory($class, $item, $field); $this->data['item_config'][$field]['type'] = $new_field; if ($save_item) { $new_field->update_item($post_data); if (method_exists($field_type, 'post_save')) { // Create an list of Admin Fields with post-save callbacks. $post_save[] = $field; } } } if ($save_item && $item->save()) { foreach ($post_save as $field) { $this->data['item_config'][$field]['type']->post_save(); } $this->data['success'] = 'The record has been saved.'; if ($new) { \Response::redirect(\Uri::base(false) . 'admin/item/' . $this->data['table'] . "?id={$item->id}&save_success=1"); } } if (\Input::get('save_success')) { $this->data['success'] = 'The record has been saved.'; } $this->data['item'] = $item; $this->template->body = 'item.php'; }
public function action_index() { // log out. \Model_Accounts::logout(); // go back if (\Input::referrer() != null && \Input::referrer() != \Uri::main()) { \Response::redirect(\Input::referrer()); } else { \Response::redirect(\Uri::base()); } }
public function action_index() { $export = \Input::get('export', false); //set cookie order \Fuel\Core\Cookie::set('person_url', Uri::base() . 'job/orders'); $this->template->title = 'UOS求人システム'; //get search value $search_arr = \Input::get(); //set return url after edit $pagination_url = \Uri::base() . 'job/orders/index'; $return_url = \Uri::current(); if (\Input::get('flag') != null) { $pagination_url = \Uri::base() . 'job/orders/index' . '?' . http_build_query($_GET); $return_url = \Uri::current() . '?' . http_build_query($_GET); } //config pagination $config = array('pagination_url' => $pagination_url, 'total_items' => count(\Model_Orders::get_all_order_list(null, null, $search_arr)), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true); if ($export) { $config['per_page'] = 100000; } else { //setcookie \Cookie::set('return_url_search', $return_url, 60 * 60 * 24); } //setup pagination $pagination = \Uospagination::forge('orders-pagination', $config); $model_group = new \Model_Mgroups(); $data['listgroup'] = $model_group->get_type(1); $model_partner = new \Model_Mpartner(); $data['listpartner'] = $model_partner->get_filter_partner(array('type' => 1)); //get list media $model_media = new \Model_Mmedia(); $data['listmedias'] = $model_media->get_list_all_media(); if (is_array($data['listmedias']) == false) { $data['listmedias'] = array(); } //get list post $model_post = new \Model_Mpost(); $data['listpost'] = $model_post->get_list_all(); //get list ss $model_ss = new \Model_Mss(); $data['list_all_ss'] = $model_ss->get_list_all_ss(); //get all orders $model_order = new \Model_Orders(); $data['listorders'] = \Model_Orders::get_all_order_list($pagination->per_page, $pagination->offset, $search_arr); if ($export) { $csv_data = $model_order->csv_process($data['listorders']); \Model_Orders::export($csv_data); } foreach ($data['listorders'] as $key => $value) { $data['listorders'][$key]['image_content'] = base64_encode($data['listorders'][$key]['image_content']); $data['listorders'][$key]['price'] = \Model_Orders::cost_of_order($value); } $this->template->content = \View::forge('orders/index', $data); }
public function action_index() { $this->template->title = 'UOS求人システム'; $register_id = \Input::get('register_id'); $model = \Model_Concierges::find_by_pk($register_id); if (!$model) { \Response::redirect(\Uri::base() . 'support/concierges'); } $data['model'] = $model; $this->template->content = \View::forge('concierges/detail', $data); }
public function before() { parent::before(); if (\Input::post('submit_login')) { if (\Auth::instance('SimpleAuth')->login()) { \Response::redirect(\Uri::base(false) . 'admin/list'); } else { $this->data['msg'] = 'Incorrect login.'; } } return true; }
/** * Redirects back to the previous page, if that page is within the current * application. If not, it will redirect to the given url, and if none is * given, back to the application root * * @param string $url The url * @param string $method The redirect method * @param int $code The redirect status code * * @return void */ public static function redirect_back($url = '', $method = 'location', $code = 302) { // do we have a referrer? if ($referrer = \Input::referrer()) { // is it within our website? And not equal to the current url? if (strpos($referrer, \Uri::base()) === 0 and $referrer != \Uri::current()) { // redirect back to where we came from static::redirect($referrer, $method, $code); } } // no referrer or an external link, do a normal redirect static::redirect($url, $method, $code); }
/** * @author Bui Dang <*****@*****.**> * action list group */ public function action_index() { if ($filter = Input::get()) { Session::set('url_filter_group', http_build_query($filter)); //Set url filter } $data = array(); $groups = new \Model_Mgroups(); $keywork = Input::get('keywork'); $data['groups'] = $groups->get_all($keywork); $pagination = \Uospagination::forge('pagination', array('pagination_url' => \Uri::base() . 'master/groups?' . http_build_query(Input::get()), 'total_items' => count($data['groups']), 'per_page' => \Constants::$default_limit_pagination, 'num_links' => \Constants::$default_num_links, 'uri_segment' => 'page', 'show_last' => true)); $data['pagination'] = $pagination; $data['groups'] = $groups->get_all($keywork, $pagination->offset, $pagination->per_page); $this->template->title = 'UOS求人システム'; $this->template->content = \View::forge('groups/index', $data); }
/** * Tests Uri::base() * * @test */ public function test_base() { Config::set('base_url', null); Config::set('index_file', false); $output = Uri::base(); $expected = null; $this->assertEquals($expected, $output); Config::set('base_url', 'http://example.com/'); Config::set('index_file', 'index.php'); $output = Uri::base(); $expected = 'http://example.com/index.php/'; $this->assertEquals($expected, $output); $output = Uri::base(false); $expected = 'http://example.com/'; $this->assertEquals($expected, $output); }
/** * Redirects to another uri/url. Sets the redirect header, * sends the headers and exits. Can redirect via a Location header * or using a refresh header. * * The refresh header works better on certain servers like IIS. * * @param string $url The url * @param string $method The redirect method * @param int $code The redirect status code * @return void */ public static function redirect($url = '', $method = 'location', $code = 302) { $response = new static(); $response->set_status($code); if (strpos($url, '://') === false) { $url = $url !== '' ? \Uri::create($url) : \Uri::base(); } if ($method == 'location') { $response->set_header('Location', $url); } elseif ($method == 'refresh') { $response->set_header('Refresh', '0;url=' . $url); } else { return; } $response->send(true); exit; }
public function action_index() { // We only have one root, the settings for which are defined in the CMF config file $opts = \Config::get('cmf.finder'); $opts['URL'] = \Uri::base(false) . ltrim($opts['path'], '/'); $opts['path'] = rtrim(DOCROOT . ltrim($opts['path'], '/'), '/') . '/'; if ($startPath = \Input::get('start', false)) { $opts['startPath'] = $opts['path'] . trim($startPath, '/') . '/'; } // Make sure the various directories exist if (!is_dir($opts['path'])) { @mkdir($opts['path'], 0775, true); } if (!is_dir($opts['startPath'])) { @mkdir($opts['startPath'], 0775, true); } $connector = new elFinderConnector(new ElFinder(array('roots' => array($opts)))); $connector->run(); }
/** * read template * * @author Vee Winch. * @param string $email_file email file. * @param string $template_path path to folder that store email file. * @return mixed */ public static function readTemplate($email_file = '', $template_path = null) { if ($email_file == null) { return null; } if ($template_path == null) { $template_path = APPPATH . 'lang' . DS . \Lang::get_lang() . DS . 'email' . DS; } if (file_exists($template_path . $email_file)) { $site_name = \Model_Config::getval('site_name'); $output = file_get_contents($template_path . $email_file); $output = str_replace("%site_name%", $site_name, $output); $output = str_replace("%site_url%", \Uri::base(), $output); $output = str_replace("%site_admin%", \Uri::create('admin'), $output); unset($site_name, $template_path); return $output; } else { return false; } }
/** * Display all images of slider * * @access public * @author Nguyen Van Hiep * * @version 1.0 * @since 1.0 */ public function action_index() { $view = View::forge('admin/article/index'); $view->cats = Model_Categories::get_cat_list(true, Input::get('lang')); $view->total = (int) Model_Article::count(); $view->in_cat = null; $view->selected_cat_view = Input::get('cat') == '' ? 'cat' : Input::get('cat'); $view->selected_lang_view = Input::get('lang') == '' ? 'lang' : Input::get('lang'); $view->langs = array('' => '---'); foreach (glob(LANG_DIR . '/*', GLOB_ONLYDIR) as $lang_dir) { $short_lang = str_replace(LANG_DIR . '/', '', $lang_dir); $view->langs[$short_lang] = $short_lang; } $view->in_cat = count(Model_Article::get_articles_offset(0, 9999, Input::get('cat'), Input::get('lang'))); $config = array('pagination_url' => Uri::base() . 'admin/article?cat=' . Input::get('cat') . '&lang=' . Input::get('lang'), 'total_items' => $view->in_cat, 'per_page' => 30, 'uri_segment' => 'page', 'num_links' => 7); $pag = Pagination::forge('paging', $config); $view->arts = Model_Article::get_articles_offset($pag->offset, $pag->per_page, Input::get('cat'), Input::get('lang')); $view->pag = $pag; $this->template->title = __('art.arts'); $this->template->content = $view; }
/** * Renders the empty form for creating an item */ public function action_create($table_name) { // Find class name and metadata etc $class_name = \Admin::getClassForTable($table_name); if ($class_name === false) { return $this->show404(null, "type"); } $can_edit = \CMF\Auth::can('edit', $class_name); if (!$can_edit) { return $this->show403('action_plural', array('action' => \Lang::get('admin.verbs.create'), 'resource' => strtolower($class_name::plural()))); } $metadata = $class_name::metadata(); \Admin::setCurrentClass($class_name); // Superlock: don't let them create one!! if ($this->superlock = $class_name::superlock()) { $default_redirect = \Uri::base(false) . "admin/{$table_name}"; \Response::redirect($default_redirect, 'location'); } $root_class = $metadata->rootEntityName; $root_metadata = $root_class::metadata(); // Create a fresh model $model = new $class_name(); // Get stuff ready for the template $this->js['model'] = $class_name; $this->form = new ModelForm($metadata, $model); $this->static = $class_name::_static(); $this->table_name = $metadata->table['name']; $this->root_table_name = $root_metadata->table['name']; $this->root_plural = $root_class::plural(); $this->model = $model; $this->template = 'admin/item/create.twig'; $this->qs = \Uri::build_query_string(\Input::get()); // Permissions $this->can_edit = $can_edit; $this->can_create = \CMF\Auth::can('create', $class_name); $this->can_delete = \CMF\Auth::can('delete', $class_name) && !$class_name::_static(); $this->description = $class_name::formDescription(); }
protected function cleanCache($item) { $urls = array(); $base = \Uri::base(false); foreach ($this->_properties['relations'] as $property) { $subItems = $this->resolve($item, $property); foreach ($subItems as $subItem) { $urlEnhConfig = $subItem->behaviours('Nos\\Orm_Behaviour_Urlenhancer'); if (!empty($urlEnhConfig)) { foreach ($urlEnhConfig['enhancers'] as $enhancer_name) { foreach (Tools_Enhancer::url_item($enhancer_name, $subItem) as $url) { $cache_path = \Nos\FrontCache::getPathFromUrl($base, parse_url($url, PHP_URL_PATH)); $urls[] = $cache_path; } } } } } $urls = array_unique($urls); foreach ($urls as $url) { \Nos\FrontCache::forge($url)->delete(); } }
public function action_index() { $this->template->title = 'UOS求人システム'; $data = array(); $group = new \Model_Mgroups(); $data['search_group'] = $group->get_type(1); $ujob_obj = new \Model_Ujob(); $data['search_partner'] = $ujob_obj->get_list_partner(); $where = Input::get('partner_search') != '' ? 'partner_code = "' . Input::get('partner_search') . '"' : ''; $data['search_ss_list'] = $ujob_obj->get_list_ss($where); $data['search_media'] = $ujob_obj->get_list_media(); $data['start_date'] = \Fuel\Core\Input::get('start_date'); $data['end_date'] = \Fuel\Core\Input::get('end_date'); if (Input::get('export', false)) { $res = $ujob_obj->get_search_data(true); $this->export($res['res']); } else { $res = $ujob_obj->get_search_data(false); } $data['res'] = $res; \Session::set('url_job_redirect', \Uri::base() . 'job/jobs/index/' . (\Uri::segment(4) ? \Uri::segment(4) : 1) . '?' . http_build_query(\Input::get())); $this->template->content = \Fuel\Core\View::forge('jobs/index', $data); }
protected function getCanonicalLink($model = null) { if (empty($model)) { $model = $this->model; } if (!empty($model)) { $base = rtrim(\Uri::base(false), '/'); // If this model was imported, we set the canonical base to where it came from if (is_array($model->settings) && \Arr::get($model->settings, 'original_id', false)) { $canonical_base = rtrim(\CMF\Model\DevSettings::instance()->parent_site ?: '', '/'); if (empty($canonical_base)) { $canonical_base = rtrim(\Arr::get($model->settings, 'imported_from', $base), '/'); } } else { $canonical_base = $base; } $current_uri = '/' . trim($_SERVER['REQUEST_URI'], '/'); $uri = property_exists($model, 'url') ? strval($model->get('url', $current_uri)) : $current_uri; if (!empty($canonical_base)) { return $canonical_base . $uri; } } return null; }
public function action_deleteAvatar() { // get account id from cookie $account = new \Model_Accounts(); $cookie = $account->getAccountCookie(); if (\Input::method() == 'POST') { if (!\Extension\NoCsrf::check()) { // validate token failed $output['form_status'] = 'error'; $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token'); $output['result'] = false; } else { if (!isset($cookie['account_id']) || \Model_Accounts::isMemberLogin() == false) { $output['result'] = false; } else { $output['result'] = true; $account->deleteAccountAvatar($cookie['account_id']); } } } unset($account, $cookie); if (\Input::is_ajax()) { // re-generate csrf token for ajax form to set new csrf. $output['csrf_html'] = \Extension\NoCsrf::generate(); $response = new \Response(); $response->set_header('Content-Type', 'application/json'); $response->body(json_encode($output)); return $response; } else { if (\Input::referrer() != null && \Input::referrer() != \Uri::main()) { \Response::redirect(\Input::referrer()); } else { \Response::redirect(\Uri::base()); } } }
public function action_index() { $this->template->title = 'UOS求人システム'; $data = array(); //get search value if ($search_arr = \Input::get()) { Session::set('url_filter_concierges', http_build_query(\Input::get())); } //set return url after edit $pagination_url = \Uri::base() . 'support/concierges/index'; $return_url = \Uri::current(); if (\Input::get()) { $pagination_url = \Uri::base() . 'support/concierges/index' . '?' . http_build_query($_GET); $return_url = \Uri::current() . '?' . http_build_query($_GET); } //setcookie \Cookie::set('register_url_search', $return_url, 60 * 60 * 24); //config pagination $config = array('pagination_url' => $pagination_url, 'total_items' => count(\Model_Concierges::get_register_list(null, null, $search_arr)), 'per_page' => \Constants::$default_limit_pagination, 'uri_segment' => 'page', 'num_links' => \Constants::$default_num_links, 'show_last' => true); //setup pagination $pagination = \Uospagination::forge('concierges-pagination', $config); $data['listall'] = \Model_Concierges::get_register_list($pagination->per_page, $pagination->offset, $search_arr); $this->template->content = \View::forge('concierges/index', $data); }