本文整理汇总了PHP中HC_Lib::ri方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::ri方法的具体用法?PHP HC_Lib::ri怎么用?PHP HC_Lib::ri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::ri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: label
function label($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$return = '';
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
case HC_PRESENTER::VIEW_HTML_ICON:
$ri = HC_Lib::ri();
if ($ri == 'wordpress') {
$avatar = get_avatar($model->email, 16);
$return = HC_Html::icon('', TRUE, $avatar);
} else {
$return = HC_Html::icon(HC_App::icon_for('user'));
if (!$model->exists()) {
$return->add_attr('class', 'text-danger');
} else {
if ($model->id && $model->active != $model->_const('STATUS_ACTIVE')) {
$return = HC_Html::icon_stack(array(HC_App::icon_for('user'), array('ban', 'text-muted')));
}
}
}
break;
case HC_PRESENTER::VIEW_TEXT:
$return = HCM::__('Staff');
break;
}
return $return;
}
示例2: _content_password
private function _content_password($model)
{
$form = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
if ($ri = HC_Lib::ri()) {
$form->set_readonly();
}
// $form->set_values( $model->to_array() );
$form->set_errors($model->errors());
return $this->render('admin/users/zoom/password', array('form' => $form, 'object' => $model));
}
示例3: logout
function logout()
{
$ri = HC_Lib::ri();
if ($ri) {
Modules::run($ri . '/auth/logout');
return;
}
$logout = $this->auth->logout();
$this->session->set_flashdata('message', HCM::__('You have been logged out'));
$this->redirect();
}
示例4: array
$nav = HC_Html_Factory::widget('list')->add_attr('class', array('nav', 'nav-pills'))->add_attr('class', array('text-smaller'))->add_attr('class', array('nav-condensed'))->add_attr('style', 'margin-bottom: 0.5em;');
if ($user && $user->id) {
$user_title = $user->present_title();
$user_title .= ' [';
if ($login_with == 'username') {
$user_title .= $user->username;
} else {
$user_title .= $user->email;
}
$user_title .= ']';
$link_profile = 'auth/profile';
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link($link_profile))->add_child($user_title));
$auth_user = $this->auth->user();
$acl = HC_App::acl();
$acl_user = $acl->user();
$ri = HC_Lib::ri();
if ($auth_user->id != $acl_user->id) {
if ($ri == 'wordpress') {
if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
$nav->add_divider();
$app = HC_App::app();
$admin_url = get_admin_url() . 'admin.php?page=' . $app;
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', $admin_url)->add_child(HC_Html::icon('cogs'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Admin Area'))));
}
}
}
$nav->add_divider();
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/logout'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log Out')))->add_child(HC_Html::icon('sign-out')));
} else {
if ($this_method != 'login') {
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/login'))->add_child(HC_Html::icon('sign-in'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log In'))));
示例5: url
function url()
{
$return = NULL;
$append_controller = '';
$change_params = array();
$args = func_get_args();
$ri = HC_Lib::ri();
if ($ri && count($args) == 0 && count($this->params) == 0) {
switch ($this->controller) {
case 'auth/login':
$return = Modules::run($ri . '/auth/login_url');
break;
case 'auth/logout':
$return = Modules::run($ri . '/auth/logout_url');
break;
}
}
if ($return) {
return $return;
}
if (count($args) == 1) {
list($change_params) = $args;
} elseif (count($args) == 2) {
list($append_controller, $change_params) = $args;
}
$slug = array();
if ($this->controller) {
$slug[] = $this->controller;
}
if ($append_controller) {
$slug[] = $append_controller;
}
$params = array_merge($this->params, $change_params);
$params = $this->params;
foreach ($change_params as $k => $v) {
if (substr($k, -1) == '+' or substr($k, -1) == '-') {
$operation = substr($k, -1);
$k = substr($k, 0, -1);
if (isset($params[$k])) {
if (!is_array($params[$k])) {
$params[$k] = array($params[$k]);
}
} else {
$params[$k] = array();
}
if ($operation == '+') {
$params[$k][] = $v;
} else {
$params[$k] = HC_Lib::remove_from_array($params[$k], $v);
}
} else {
$params[$k] = $v;
}
}
foreach ($params as $k => $v) {
if (is_array($v)) {
if (!$v) {
continue;
}
$v = join('.', $v);
}
if ($v !== NULL) {
$slug[] = $k;
$slug[] = $v;
}
}
$CI =& ci_get_instance();
$return = $CI->config->site_url($slug);
return $return;
}
示例6: index
function index($tab = 'core')
{
$fields = $this->config->items('settings');
$tabs = $this->_get_tabs($fields);
$ri = HC_Lib::ri();
if ($ri) {
unset($fields['login_with']);
}
/* render view */
$this->layout->set_partial('content', $this->render('conf/admin/index', array('fields' => $fields, 'form' => $this->form, 'tab' => $tab, 'tabs' => $tabs)));
$this->layout();
}
示例7: layout
function layout($template_file = NULL)
{
$template_dir = '_layout_new';
$ri = HC_Lib::ri();
$is_module = $this->is_module();
$is_ajax = $this->input->is_ajax_request();
if ($is_module or $is_ajax) {
$template_file = 'index_module';
} else {
if (!$template_file) {
$template_file = 'index';
}
/* theme */
$theme_dir = $GLOBALS['NTS_APPPATH'] . '/../theme';
if (file_exists($theme_dir)) {
$theme_head = $theme_dir . '/head.php';
if (file_exists($theme_head)) {
$this->layout->set_partial('theme_head', $this->render('../../theme/head', array()));
}
$theme_header = $theme_dir . '/header.php';
if (file_exists($theme_header)) {
$this->layout->set_partial('theme_header', $this->render('../../theme/header', array()));
}
$theme_footer = $theme_dir . '/footer.php';
if (file_exists($theme_footer)) {
$this->layout->set_partial('theme_footer', $this->render('../../theme/footer', array()));
}
}
$this->layout->set_param('ri', $ri);
/* head */
// if( ! $ri ){
$page_title = $this->config->item('nts_app_title');
$this->layout->set_partial('head', $this->render($template_dir . '/head', array('layout' => $this->layout, 'page_title' => $page_title)));
// }
/* menu & profile */
$user = NULL;
if ($this->auth && $this->auth->check() && $this->auth->user() && $this->auth->user()->active) {
$user = $this->auth->user();
}
$user = $this->auth->user();
/* menu */
if ((1 or $user) && !$this->is_setup) {
$menu_conf = $this->config->item('menu');
$disabled_panels = $this->config->item('disabled_panels');
$this_uri = $this->uri->uri_string();
$user_level = $user ? $user->level : 0;
$acl = HC_App::acl();
$auth_user = $acl->user();
$this->layout->set_partial('menu', $this->render($template_dir . '/menu', array('menu_conf' => $menu_conf, 'disabled_panels' => $disabled_panels, 'this_uri' => $this_uri, 'user' => $auth_user)));
}
/* profile */
$app_conf = HC_App::app_conf();
if ((1 or !$ri) && !$this->is_setup) {
$this_method = $this->router->fetch_method();
$login_with = $app_conf->get('login_with');
$this->layout->set_partial('profile', $this->render($template_dir . '/profile', array('this_method' => $this_method, 'login_with' => $login_with, 'user' => $user)));
}
/* brand */
$brand_title = $this->config->item('nts_app_title');
$brand_url = $this->config->item('nts_app_url');
$hc_app_version = $this->config->item('hc_app_version');
if (!$ri && strlen($brand_title)) {
$this->layout->set_partial('brand', $this->render($template_dir . '/brand', array('brand_title' => $brand_title, 'brand_url' => $brand_url, 'ri' => $ri, 'app_version' => $hc_app_version)));
}
/* js footer code */
$this->layout->set_partial('js_footer', $this->render($template_dir . '/js_footer', array()));
}
/* flashdata */
if (!$is_module) {
$this->layout->set_partial('flashdata', $this->render($template_dir . '/flashdata', array('message' => $this->session->flashdata('message_ajax') ? $this->session->flashdata('message_ajax') : $this->session->flashdata('message'), 'debug_message' => $this->session->flashdata('debug_message'), 'error' => $this->session->flashdata('error_ajax') ? $this->session->flashdata('error_ajax') : $this->session->flashdata('error'))));
$this->layout->set_partial('flashdata_ajax', $this->render($template_dir . '/flashdata', array('message' => $this->session->flashdata('message_ajax'), 'debug_message' => NULL, 'error' => $this->session->flashdata('error_ajax'))));
}
/* final output */
$this->layout->set_template($template_dir . '/' . $template_file);
/* return */
$this->load->view($this->layout->template(), array('layout' => $this->layout));
/*
return $this->render(
$this->layout->template(),
array(
'layout' => $this->layout
)
);
*/
}