/** * @param Request $request * @param $result * * @dataProvider provideGetControllerTestData */ public function testGetCorrectController(Request $request, $result) { app(HttpKernelContract::class)->handle($request); $this->assertSame($result, \Active::getController()); $this->assertSame($result, app('active')->getController()); $this->assertSame($result, current_controller()); }
/** * @param string $tag Allows to specify another tag for the wrapper control, default for google controls is <span> */ function __initialize($tag = 'span') { parent::__initialize($tag); $page = current_controller(false); if ($page instanceof HtmlPage) { $page->addJs('//www.google.com/jsapi'); } }
/** * @param string $tag Allows to specify another tag for the wrapper control, default for google controls is <span> */ function __initialize($tag = 'span', $frozen = true) { parent::__initialize($tag); $this->frozen = $frozen; $page = current_controller(false); if ($page instanceof HtmlPage) { if ($this->frozen) { $page->addJs('//www.gstatic.com/charts/loader.js'); } else { $page->addJs('//www.google.com/jsapi'); } } }
/** * @param mixed $current_language_code Currently selected language * @param type $current_region_code Currently selected region */ function __initialize($current_language_code = false, $current_region_code = false) { parent::__initialize(); $this->script("Locale_Settings_Init();"); $this->setData('role', 'region'); $this->setData('controller', buildQuery($this->id)); if ($current_language_code) { if ($current_language_code instanceof CultureInfo) { $lang = $current_language_code->ResolveToLanguage(); } else { $lang = Localization::getLanguageCulture($current_language_code); } if (!$lang) { $lang = Localization::detectCulture()->ResolveToLanguage(); } $regions = $lang->GetRegions(false); if (!$current_region_code) { $current_region_code = $lang->DefaultRegion()->Code; } } else { $regions = Localization::get_all_regions(false); } if ($current_region_code) { if ($current_region_code instanceof CultureInfo) { $this->SetCurrentValue($current_region_code->DefaultRegion()->Code); } else { $this->SetCurrentValue($current_region_code); } } if (count($regions) > 0) { $cc = current_controller(false); $translations_active = $cc instanceof Renderable && $cc->_translate; $sorted = array(); foreach ($regions as $reg) { if (!$reg) { continue; } $code = $reg->Code; if ($translations_active) { $sorted[$code] = array("name" => tds("TXT_COUNTRY_" . strtoupper($code), $reg->EnglishName), "code", $code); } else { $sorted[$code] = array("name" => $reg->EnglishName, "code", $code); } } uasort($sorted, __CLASS__ . "::compareCountryNames"); foreach ($sorted as $code => $item) { $this->AddOption($code, $item['name']); } } }
* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see <http://www.gnu.org/licenses/> * * @author Scavix Software Ltd. & Co. KG http://www.scavix.com <*****@*****.**> * @copyright since 2012 Scavix Software Ltd. & Co. KG * @license http://www.opensource.org/licenses/lgpl-license.php LGPL */ ?> <form action="<?php echo buildQuery(current_controller(), 'Login'); ?> " method="post" class="login"> <table> <thead> <tr> <td colspan="2">Login first</td> </tr> </thead> <tbody> <tr> <td>Username</td> <td align="right"><input name="username" type="text"/></td> </tr> <tr> <td>Password</td>
/** * Returns a (new) request id * * ScavixWDF creates a new ID for every request and passed it to every subsequent AJAX call. * This method does the real magic and creates a new request id or returns the current. * @return string A new request id or the current one */ function RequestId() { if (!isset($GLOBALS['session_request_id'])) { $p = current_controller(); $e = current_event(); $GLOBALS['session_request_id'] = md5($p . $e . microtime()); } return $GLOBALS['session_request_id']; }
/** * * @param int $total_row * @param int $uri_segment * @return string pagination */ function paging($total_row, $uri_segment = 3) { $CI =& get_instance(); $param = $_GET; $function = $CI->uri->segment(2); $CI->load->library('pagination'); $config['base_url'] = current_controller($function); $config['total_rows'] = $total_row; $config['uri_segment'] = $uri_segment; $config['anchor_class'] = 'class="tangan"'; $config['per_page'] = $param['perpage']; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['first_link'] = '<<'; $config['last_link'] = '>>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $config['last_tag_close'] = '</li>'; $config['last_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['first_tag_open'] = '<li>'; $config['next_link'] = '>'; $config['prev_link'] = '<'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a>'; $config['cur_tag_close'] = '</a></li>'; $CI->pagination->initialize($config); $paging = '<div class="pagination pull-right"><ul>'; $paging .= $CI->pagination->create_links(); $paging .= '</ul></div>'; $n = $param['page']; $n2 = $n + 1; $sd = $n + $param['perpage']; $sd = $total_row < $sd ? $total_row : $sd; $remark = $sd > 0 ? "View {$n2} - {$sd} of {$total_row}" : ''; return $paging . '<div class="pull-right" style="line-height:32px;margin:0 8px;">' . $remark . '</div>'; }
/** * Builds a query for the current page. * * Calls buildQuery internally to build an URL to the current route. * @param string|array $data Additional data * @return string A complete Request (for use as HREF) */ function samePage($data = "") { return buildQuery(current_controller(), current_event(), $data); }
echo GLOBAL_VENDOR_URL; ?> datatables/media/js/jquery.dataTables.min.js"></script> <script src="<?php echo GLOBAL_VENDOR_URL; ?> datatables/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script> <!-- global var js --> <script type="text/javascript"> var base_url = '<?php echo base_url(); ?> '; var current_ctrl = '<?php echo current_controller(); ?> '; var current_url = '<?php echo current_url(); ?> '; var assets_url = '<?php echo ASSETS_URL; ?> '; var token_name = '<?php echo $this->security->get_csrf_token_name(); ?> '; var token_key = '<?php
/** * Tries to figure out the item that must have the focus * * Will then set it active and return * @return void */ function DetectSelected() { $controller = strtolower(current_controller()); $event = current_event(true); $data = md5(render_var($_GET)); for ($level = 1; $level <= 6; $level++) { foreach ($this->GetItems() as $item) { if ($level < 4) { foreach ($item->GetItems() as $sub) { if ($sub->controller == $controller && ($level > 2 || $sub->event == $event) && ($level > 1 || $sub->data == $data)) { $sub->SetSelected(); $item->SetSelected(); return; } } } else { if ($item->controller == $controller && ($level > 5 || $item->event == $event) && ($level > 4 || $item->data == $data)) { $item->SetSelected(); return; } } } } }