本文整理汇总了PHP中UserController::getView方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::getView方法的具体用法?PHP UserController::getView怎么用?PHP UserController::getView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::getView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterDispatch
function onAfterDispatch()
{
$mainframe = JFactory::getApplication();
if ($mainframe->isAdmin()) {
return;
}
$params = JComponentHelper::getParams('com_k2');
if (!$params->get('K2UserProfile')) {
return;
}
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$task = JRequest::getCmd('task');
$layout = JRequest::getCmd('layout');
$user = JFactory::getUser();
if (K2_JVERSION != '15') {
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout'])) {
$layout = $active->query['layout'];
}
}
if ($option == 'com_user' && $view == 'register' || $option == 'com_users' && $view == 'registration') {
if ($params->get('recaptchaOnRegistration') && $params->get('recaptcha_public_key')) {
$document = JFactory::getDocument();
$document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
theme: "' . $params->get('recaptcha_theme', 'clean') . '"
});
}
$K2(document).ready(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
if (!$user->guest) {
$mainframe->enqueueMessage(JText::_('K2_YOU_ARE_ALREADY_REGISTERED_AS_A_MEMBER'), 'notice');
$mainframe->redirect(JURI::root());
$mainframe->close();
}
if (K2_JVERSION != '15') {
require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
$controller = new UsersController();
} else {
require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
$controller = new UserController();
}
$view = $controller->getView($view, 'html');
$view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
$view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
$view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
$view->setLayout('register');
$K2User = new JObject();
$K2User->description = '';
$K2User->gender = 'm';
$K2User->image = '';
$K2User->url = '';
$K2User->plugins = '';
$wysiwyg = JFactory::getEditor();
$editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
$view->assignRef('editor', $editor);
$lists = array();
$genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
$genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
$lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
$view->assignRef('lists', $lists);
$view->assignRef('K2Params', $params);
JPluginHelper::importPlugin('k2');
$dispatcher = JDispatcher::getInstance();
$K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
$view->assignRef('K2Plugins', $K2Plugins);
$view->assignRef('K2User', $K2User);
if (K2_JVERSION != '15') {
$view->assignRef('user', $user);
}
$pathway = $mainframe->getPathway();
$pathway->setPathway(NULL);
$nameFieldName = K2_JVERSION != '15' ? 'jform[name]' : 'name';
$view->assignRef('nameFieldName', $nameFieldName);
$usernameFieldName = K2_JVERSION != '15' ? 'jform[username]' : 'username';
$view->assignRef('usernameFieldName', $usernameFieldName);
$emailFieldName = K2_JVERSION != '15' ? 'jform[email1]' : 'email';
$view->assignRef('emailFieldName', $emailFieldName);
$passwordFieldName = K2_JVERSION != '15' ? 'jform[password1]' : 'password';
$view->assignRef('passwordFieldName', $passwordFieldName);
$passwordVerifyFieldName = K2_JVERSION != '15' ? 'jform[password2]' : 'password2';
$view->assignRef('passwordVerifyFieldName', $passwordVerifyFieldName);
$optionValue = K2_JVERSION != '15' ? 'com_users' : 'com_user';
$view->assignRef('optionValue', $optionValue);
$taskValue = K2_JVERSION != '15' ? 'registration.register' : 'register_save';
$view->assignRef('taskValue', $taskValue);
ob_start();
$view->display();
$contents = ob_get_clean();
$document = JFactory::getDocument();
$document->setBuffer($contents, 'component');
}
if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form') || $option == 'com_users' && $view == 'profile' && ($layout == 'edit' || $task == 'profile.edit')) {
//.........这里部分代码省略.........
示例2: onAfterDispatch
function onAfterDispatch()
{
$mainframe =& JFactory::getApplication();
if ($mainframe->isAdmin()) {
return;
}
JPlugin::loadLanguage('com_k2');
$params =& JComponentHelper::getParams('com_k2');
if (!$params->get('K2UserProfile')) {
return;
}
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$task = JRequest::getCmd('task');
$layout = JRequest::getCmd('layout');
$user =& JFactory::getUser();
if ($option == 'com_user' && $view == 'register') {
if (!$user->guest) {
$mainframe->redirect(JURI::root(), JText::_('You are already registered as a member.'), 'notice');
$mainframe->close();
}
require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
$controller = new UserController();
$view = $controller->getView('register', 'html');
$view->_addPath('template', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
$view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
$view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
$view->setLayout('register');
$K2User = new JObject();
$K2User->description = '';
$K2User->gender = 'm';
$K2User->image = '';
$K2User->url = '';
$K2User->plugins = '';
$wysiwyg =& JFactory::getEditor();
$editor = $wysiwyg->display('description', $K2User->description, '100%', '250', '40', '5', false);
$view->assignRef('editor', $editor);
$lists = array();
$genderOptions[] = JHTML::_('select.option', 'm', JText::_('Male'));
$genderOptions[] = JHTML::_('select.option', 'f', JText::_('Female'));
$lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
$view->assignRef('lists', $lists);
JPluginHelper::importPlugin('k2');
$dispatcher =& JDispatcher::getInstance();
$K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
$view->assignRef('K2Plugins', $K2Plugins);
$view->assignRef('K2User', $K2User);
$pathway =& $mainframe->getPathway();
$pathway->setPathway(NULL);
ob_start();
$view->display();
$contents = ob_get_clean();
$document =& JFactory::getDocument();
$document->setBuffer($contents, 'component');
}
if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
$controller = new UserController();
$view = $controller->getView('user', 'html');
$view->_addPath('template', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
$view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
$view->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
$view->setLayout('profile');
require_once JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'itemlist.php';
$model = new K2ModelItemlist();
$K2User = $model->getUserProfile($user->id);
if (!is_object($K2User)) {
$K2User = new Jobject();
$K2User->description = '';
$K2User->gender = 'm';
$K2User->url = '';
$K2User->image = NULL;
}
$wysiwyg =& JFactory::getEditor();
$editor = $wysiwyg->display('description', $K2User->description, '100%', '250', '40', '5', false);
$view->assignRef('editor', $editor);
$lists = array();
$genderOptions[] = JHTML::_('select.option', 'm', JText::_('Male'));
$genderOptions[] = JHTML::_('select.option', 'f', JText::_('Female'));
$lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
$view->assignRef('lists', $lists);
JPluginHelper::importPlugin('k2');
$dispatcher =& JDispatcher::getInstance();
$K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
$view->assignRef('K2Plugins', $K2Plugins);
$view->assignRef('K2User', $K2User);
ob_start();
$view->_displayForm();
$contents = ob_get_clean();
$document =& JFactory::getDocument();
$document->setBuffer($contents, 'component');
}
}
示例3: onAfterDispatch
function onAfterDispatch() {
jimport('joomla.filesystem.file');
if(!JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php')) {
return;
}
$mainframe = &JFactory::getApplication();
if($mainframe->isAdmin()) return;
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$task = JRequest::getCmd('task');
$layout = JRequest::getCmd('layout');
$user = &JFactory::getUser();
$plugin = JPluginHelper::getPlugin( 'system' , 'joomailermailchimpsignup' );
$api = $this->api();
$k2plugin = false;
jimport('joomla.filesystem.file');
if(JFile::exists( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'admin.k2.php')){
$k2params = JComponentHelper::getParams( 'com_k2' );
$k2plugin = $k2params->get('K2UserProfile');
}
if (!$k2plugin && ($option == 'com_user' && ($view == 'register' || $view == 'user')))
{
$template =& $mainframe->getTemplate();
if($view == 'register') {
$v = 'register';
$l = ($template == 'morph') ? 'register_morph' : 'register';
} else {
$v = 'user';
$l = 'profile';
}
require_once (JPATH_SITE.DS.'components'.DS.'com_user'.DS.'controller.php');
$controller = new UserController;
$view = $controller->getView($v, 'html');
$view->_addPath('template', JPATH_SITE.DS.'components'.DS.'com_joomailermailchimpsignup'.DS.'templates');
$view->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_joomailermailchimpsignup'.DS.'templates');
$view->setLayout($l);
$listId = $this->params->get('listid');
$mergefields = $api->listMergeVars( $listId );
$mergeids = $this->params->get('fields');
$interests = $api->listInterestGroupings( $listId );
$interestids = $this->params->get('interests');
$ihtml = '';
$checked = '';
$groupings = '';
$usermerges = array();
//Check if the user is subscribed
if($user->email){
$userlists = $api->listsForEmail($user->email);
if($userlists && in_array($listId,$userlists)) {
$checked = 'checked="checked"';
}
$userinfo = $api->listMemberInfo($listId, $user->email);
$usermerges = $userinfo['merges'];
$groupings = $userinfo['merges']['GROUPINGS'];
}
$lang = & JFactory::getLanguage();
$lang->load('plg_system_joomailermailchimpsignup', JPATH_ADMINISTRATOR);
if($template == 'morph'){
$ihtml = '<li class="label"><label for="newsletter">';
$ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
$ihtml.= '</label></li>';
$ihtml.= '<li>';
$ihtml.= "<input type='checkbox' name='newsletter' id='newsletter' value='1' ".$checked." />";
$ihtml.= ' <label for="newsletter">';
$ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
$ihtml.= '</label>';
$ihtml.= "</li>";
} else {
$ihtml = "<tr><td height='40'><label for='newsletter'>";
$ihtml.= JText::_('JM_NEWSLETTERSIGNUP');
$ihtml.= '</label></td>';
$ihtml.= '<td height="40">';
$ihtml.= "<input type='checkbox' name='newsletter' id='newsletter' value='1' ".$checked." /><input type='hidden' name='oldEmail' value='".$user->email."' />";
$ihtml.= "</td></tr>";
}
//Merge Fields
if($mergefields){
$ihtml .= $this->buildMergeVarsHTML( $mergefields, $usermerges, $mergeids );
}
//Groups
if($interests){
//Build the HTML for the interests
//.........这里部分代码省略.........
示例4: onAfterDispatch
function onAfterDispatch()
{
$mainframe =& JFactory::getApplication();
if ($mainframe->isAdmin()) {
return;
}
$params =& JComponentHelper::getParams('com_k2');
if (!$params->get('K2UserProfile')) {
return;
}
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$task = JRequest::getCmd('task');
$layout = JRequest::getCmd('layout');
$user =& JFactory::getUser();
if ($option == 'com_user' && $view == 'register' || $option == 'com_users' && $view == 'registration') {
if ($params->get('recaptchaOnRegistration') && $params->get('recaptcha_public_key')) {
$document =& JFactory::getDocument();
$document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
theme: "' . $params->get('recaptcha_theme', 'clean') . '"
});
}
$K2(document).ready(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
if (!$user->guest) {
$mainframe->redirect(JURI::root(), JText::_('K2_YOU_ARE_ALREADY_REGISTERED_AS_A_MEMBER'), 'notice');
$mainframe->close();
}
if (K2_JVERSION == '16') {
require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
$controller = new UsersController();
} else {
require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
$controller = new UserController();
}
$view = $controller->getView($view, 'html');
$view->addTemplatePath(JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'templates');
$view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates');
$view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2');
$view->setLayout('register');
$K2User = new JObject();
$K2User->description = '';
$K2User->gender = 'm';
$K2User->image = '';
$K2User->url = '';
$K2User->plugins = '';
$wysiwyg =& JFactory::getEditor();
$editor = $wysiwyg->display('description', $K2User->description, '100%', '250px', '', '', false);
$view->assignRef('editor', $editor);
$lists = array();
$genderOptions[] = JHTML::_('select.option', 'm', JText::_('K2_MALE'));
$genderOptions[] = JHTML::_('select.option', 'f', JText::_('K2_FEMALE'));
$lists['gender'] = JHTML::_('select.radiolist', $genderOptions, 'gender', '', 'value', 'text', $K2User->gender);
$view->assignRef('lists', $lists);
$view->assignRef('K2Params', $params);
JPluginHelper::importPlugin('k2');
$dispatcher =& JDispatcher::getInstance();
$K2Plugins = $dispatcher->trigger('onRenderAdminForm', array(&$K2User, 'user'));
$view->assignRef('K2Plugins', $K2Plugins);
$view->assignRef('K2User', $K2User);
if (K2_JVERSION == '16') {
$view->assignRef('user', $user);
}
$pathway =& $mainframe->getPathway();
$pathway->setPathway(NULL);
ob_start();
$view->display();
$contents = ob_get_clean();
$document =& JFactory::getDocument();
$document->setBuffer($contents, 'component');
}
if ($option == 'com_user' && $view == 'user' && ($task == 'edit' || $layout == 'form') || $option == 'com_users' && $view == 'profile' && $layout == 'edit') {
if ($user->guest) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if (K2_JVERSION == '16') {
require_once JPATH_SITE . DS . 'components' . DS . 'com_users' . DS . 'controller.php';
$controller = new UsersController();
} else {
require_once JPATH_SITE . DS . 'components' . DS . 'com_user' . DS . 'controller.php';
$controller = new UserController();
}
/*
// TO DO - We open the profile editing page in a modal, so let's define some CSS
$document = &JFactory::getDocument();
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.frontend.css');
$document->addStyleSheet(JURI::root(true).'/templates/system/css/general.css');
$document->addStyleSheet(JURI::root(true).'/templates/system/css/system.css');
if(K2_JVERSION == '16') {
$document->addStyleSheet(JURI::root(true).'/administrator/templates/bluestork/css/template.css');
$document->addStyleSheet(JURI::root(true).'/media/system/css/system.css');
} else {
$document->addStyleSheet(JURI::root(true).'/administrator/templates/khepri/css/general.css');
//.........这里部分代码省略.........