本文整理汇总了PHP中JRegistry::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP JRegistry::merge方法的具体用法?PHP JRegistry::merge怎么用?PHP JRegistry::merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegistry
的用法示例。
在下文中一共展示了JRegistry::merge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = NULL)
{
/**
* @var JSite $app
*/
$app = JFactory::getApplication();
$this->params = $app->getParams();
/* Default Page fallback*/
$active = $app->getMenu()->getActive();
if (NULL == $active) {
$this->params->merge($app->getMenu()->getDefault()->params);
$active = $app->getMenu()->getDefault();
}
$this->currentItemid = $active->id;
$entriesPerPage = $this->params->get('max_events_per_page', 12);
$model = $this->getModel('events');
$eventModel = JModelLegacy::getInstance('Event', 'EventgalleryModel');
$recursive = $this->params->get('show_items_per_category_recursive', false);
$user = JFactory::getUser();
$usergroups = JUserHelper::getUserGroups($user->id);
$entries = $model->getEntries(JRequest::getVar('start', 0), $entriesPerPage, $this->params->get('tags'), $this->params->get('sort_events_by'), $usergroups, $this->params->get('catid', null), $recursive);
$this->pageNav = $model->getPagination();
$this->entries = $entries;
$this->eventModel = $eventModel;
$this->_prepareDocument();
parent::display($tpl);
}
示例2: display
function display($tpl = NULL)
{
/**
* @var JSite $app
*/
$app = JFactory::getApplication();
$this->state = $this->get('State');
$this->params = $app->getParams();
$model = $this->getModel('singleimage');
$model->getData(JRequest::getString('folder'), JRequest::getString('file'));
$this->model = $model;
$this->file = $model->file;
if (!isset($this->file) || strlen($this->file->getFileName()) == 0 || $this->file->isPublished() != 1) {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE'));
}
$this->folder = $this->file->getFolder();
if (!isset($this->file) || strlen($this->file->getFileName()) == 0 || $this->file->isPublished() != 1) {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE'));
}
$this->position = $model->position;
/* Default Page fallback*/
$active = $app->getMenu()->getActive();
if (NULL == $active) {
$this->params->merge($app->getMenu()->getDefault()->params);
$active = $app->getMenu()->getDefault();
}
$this->currentItemid = $active->id;
$this->use_comments = $this->params->get('use_comments');
if (!$this->folder->isVisible()) {
$user = JFactory::getUser();
if ($user->guest) {
$redirectUrl = JRoute::_("index.php?option=com_eventgallery&view=singleimage&folder=" . $this->folder->getFolderName() . "&file=" . $this->file->getFileName(), false);
$redirectUrl = urlencode(base64_encode($redirectUrl));
$redirectUrl = '&return=' . $redirectUrl;
$joomlaLoginUrl = 'index.php?option=com_users&view=login';
$finalUrl = JRoute::_($joomlaLoginUrl . $redirectUrl, false);
$app->redirect($finalUrl);
} else {
$this->setLayout('noaccess');
}
}
$password = JRequest::getString('password', '');
$accessAllowed = EventgalleryHelpersFolderprotection::isAccessAllowed($this->folder, $password);
if (!$accessAllowed) {
$app->redirect(JRoute::_("index.php?option=com_eventgallery&view=password&folder=" . $this->folder->getFolderName(), false));
}
$this->setLayout(JRequest::getString('layout', 'minipage'));
parent::display($tpl);
}
示例3: render
/**
* Renders a module script and returns the results as a string
*
* @param string $name The name of the module to render
* @param array $attribs Associative array of values
*
* @return string The output of the script
* @since 1.0
*/
public function render($module, $attribs = array(), $content = null)
{
// add the environment data to attributes of module
$registry = JRegistry::getInstance('document.environment');
$env = $registry->getValue('params', array());
$attribs = array_merge($env, $attribs);
if (!is_object($module)) {
$title = isset($attribs['title']) ? $attribs['title'] : null;
$module = MigurModuleHelper::getModule($module, $title);
if (!is_object($module)) {
if (is_null($content)) {
return '';
} else {
/**
* If module isn't found in the database but data has been pushed in the buffer
* we want to render it
*/
$tmp = $module;
$module = new stdClass();
$module->params = null;
$module->module = $tmp;
$module->id = 0;
$module->user = 0;
}
}
}
// get the user and configuration object
//$user = JFactory::getUser();
$conf = JFactory::getConfig();
// set the module content
if (!is_null($content)) {
$module->content = $content;
}
//get module parameters
$params = new JRegistry();
$params->loadJSON($module->params);
// use parameters from template
if (isset($attribs['params'])) {
$template_params = new JRegistry();
$template_params->loadJSON(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));
$params->merge($template_params);
$module = clone $module;
$module->params = (string) $params;
}
$contents = '';
$cachemode = $params->get('cachemode', 'oldstatic');
// default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the module instead
if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') {
// default to itemid creating mehod and workarounds on
$cacheparams = new stdClass();
$cacheparams->cachemode = $cachemode;
$cacheparams->class = 'JModuleHelper';
$cacheparams->method = 'renderModule';
$cacheparams->methodparams = array($module, $attribs);
$contents = MigurModuleHelper::ModuleCache($module, $params, $cacheparams);
} else {
$contents = MigurModuleHelper::renderModule($module, $attribs);
}
return $contents;
}
示例4: render
function render($position = "")
{
global $gantry;
$output = '';
$renderer = $gantry->document->loadRenderer('module');
$options = array('style' => "raw");
$params = array();
$group_params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name, true);
$group_params_reg = new JRegistry();
foreach ($group_params as $param_name => $param_value) {
$group_params_reg->set($param_name, $param_value['value']);
}
if ($position == $this->get('mainmenu-position')) {
$params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name . "-mainmenu", true);
$module = JModuleHelper::getModule('mod_menu', '_z_empty');
$reg = new JRegistry();
foreach ($params as $param_name => $param_value) {
$reg->set($param_name, $param_value['value']);
}
$reg->merge($group_params_reg);
$module->params = $reg->toString();
$output .= $renderer->render($module, $options);
}
return $output;
}
示例5: array
function __construct($params = array())
{
$app = JFactory::getApplication();
$cparams = $app->getParams('com_djcatalog2');
$ncparams = new JRegistry();
$ncparams->merge($cparams);
$this->_cparams = $ncparams;
$this->_mparams = $params;
}
示例6: getItems
/**
* Method to get a list of items.
* Overriden to inject convert the attribs field into a JParameter object.
*
* @return mixed $items An array of objects on success, false on failure.
*/
public function getItems()
{
$items = parent::getItems();
$base_path = JPATH_ROOT . '/media/com_projectfork/repo/0/logo';
$base_url = JURI::root(true) . '/media/com_projectfork/repo/0/logo';
$tasks_exists = PFApplicationHelper::enabled('com_pftasks');
$repo_exists = PFApplicationHelper::enabled('com_pfrepo');
$pks = JArrayHelper::getColumn($items, 'id');
// Get aggregate data
$progress = array();
$total_tasks = array();
$completed_tasks = array();
$total_files = array();
if ($tasks_exists) {
JLoader::register('PFtasksModelTasks', JPATH_SITE . '/components/com_pftasks/models/tasks.php');
$tmodel = JModelLegacy::getInstance('Tasks', 'PFtasksModel', array('ignore_request' => true));
$progress = $tmodel->getAggregatedProgress($pks, 'project_id');
$total_tasks = $tmodel->getAggregatedTotal($pks, 'project_id');
$completed_tasks = $tmodel->getAggregatedTotal($pks, 'project_id', 1);
}
if ($repo_exists) {
JLoader::register('PFrepoModelFiles', JPATH_SITE . '/components/com_pfrepo/models/files.php');
$fmodel = JModelLegacy::getInstance('Files', 'PFrepoModel', array('ignore_request' => true));
$total_files = $fmodel->getProjectCount($pks);
}
// Loop over each row to inject data
foreach ($items as $i => &$item) {
$params = new JRegistry();
$params->loadString($item->attribs);
// Convert the parameter fields into objects.
$items[$i]->params = $params->merge(clone $this->getState('params'));
// Create slug
$items[$i]->slug = $items[$i]->alias ? $items[$i]->id . ':' . $items[$i]->alias : $items[$i]->id;
// Try to find the logo img
$items[$i]->logo_img = null;
if (JFile::exists($base_path . '/' . $item->id . '.jpg')) {
$items[$i]->logo_img = $base_url . '/' . $item->id . '.jpg';
} elseif (JFile::exists($base_path . '/' . $item->id . '.jpeg')) {
$items[$i]->logo_img = $base_url . '/' . $item->id . '.jpeg';
} elseif (JFile::exists($base_path . '/' . $item->id . '.png')) {
$items[$i]->logo_img = $base_url . '/' . $item->id . '.png';
} elseif (JFile::exists($base_path . '/' . $item->id . '.gif')) {
$items[$i]->logo_img = $base_url . '/' . $item->id . '.gif';
}
// Inject task count
$items[$i]->tasks = isset($total_tasks[$item->id]) ? $total_tasks[$item->id] : 0;
// Inject completed task count
$items[$i]->completed_tasks = isset($completed_tasks[$item->id]) ? $completed_tasks[$item->id] : 0;
// Inject progress
$items[$i]->progress = isset($progress[$item->id]) ? $progress[$item->id] : 0;
// Inject attached files
$items[$i]->attachments = isset($total_files[$item->id]) ? $total_files[$item->id] : 0;
}
return $items;
}
示例7: save
/**
* Save method is diff here because we're writing to a file
* (non-PHPdoc)
* @see Citruscart/admin/CitruscartController::save()
*/
function save()
{
$app = JFactory::getApplication();
$id = $app->input->get('id', 'en-GB');
$temp_values = $app->input->getArray($_POST);
$model = $this->getModel('Emails', 'CitruscartModel');
// Filter values
$prefix = $model->email_prefix;
$values = array();
foreach ($temp_values as $k => $v) {
if (stripos($k, $prefix) === 0) {
$values[$k] = $v;
}
}
$lang = $model->getItem($id);
$path = $lang->path;
$msg = JText::_('COM_CITRUSCART_SAVED');
jimport('joomla.filesystem.file');
if (JFile::exists($path)) {
$original = new JRegistry();
$original->loadFile($path);
$registry = new JRegistry();
$registry->loadArray($values);
$original->merge($registry);
$txt = $original->__toString('INI');
$success = JFile::write($path, $txt);
if (!$success) {
$msg = JText::_('COM_CITRUSCART_ERROR_SAVING_NEW_LANGUAGE_FILE');
}
}
$model->clearCache();
//$task = JRequest::getVar('task');
$task = $app->input->getString('task');
$redirect = "index.php?option=com_citruscart";
switch ($task) {
case "apply":
$redirect .= '&view=' . $this->get('suffix') . '&task=edit&id=' . $id;
break;
case "save":
default:
$redirect .= "&view=" . $this->get('suffix');
break;
}
$redirect = JRoute::_($redirect, false);
$this->setRedirect($redirect, $this->message, $this->messagetype);
}
示例8: save
function save()
{
$app = JFactory::getApplication();
$data = $app->input->getArray($_POST);
$save_params = new JRegistry();
$save_params->loadArray($data['params']);
$plugin_data = JPluginHelper::getPlugin('j2store', $this->_element);
$params = new JRegistry();
$params->loadString($plugin_data->params);
$params->merge($save_params);
$json = $params->toString();
$db = JFactory::getDbo();
$query = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($json))->where($db->qn('element') . ' = ' . $db->q($this->_element))->where($db->qn('folder') . ' = ' . $db->q('j2store'))->where($db->qn('type') . ' = ' . $db->q('plugin'));
$db->setQuery($query);
$db->execute();
if ($data['promotionTask'] == 'apply' && isset($data['promotion_id'])) {
$url = 'index.php?option=com_j2store&view=promotions&task=view&id=' . $data['promotion_id'];
} else {
$url = 'index.php?option=com_j2store&view=promotions';
}
$this->setRedirect($url, JText::_('J2STORE_CHANGES_SAVED'), 'message');
}
示例9: JRegistry
/**
* Method to load content article parameters
*
* @access private
* @return void
* @since 1.5
*/
function _loadItemParams($force = false)
{
if (!$force && !empty($this->_item->parameters)) {
return;
}
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
// Retrieve currently active menu item (NOTE: this applies when Itemid variable or menu item alias exists in the URL)
$isnew = !$this->_id;
// **********************************************************************
// Retrieve RELATED parameters that will be merged into item's parameters
// **********************************************************************
// Retrieve COMPONENT parameters
$compParams = JComponentHelper::getComponent('com_flexicontent')->params;
// Retrieve parameters of current category (NOTE: this applies when cid variable exists in the URL)
$catParams = "";
if ($this->_cid) {
$query = 'SELECT c.title, c.params FROM #__categories AS c WHERE c.id = ' . (int) $this->_cid;
$this->_db->setQuery($query);
$catData = $this->_db->loadObject();
$catParams = $catData->params;
$this->_item->category_title = $catData->title;
}
$catParams = new JRegistry($catParams);
// Retrieve/Create item's Content Type parameters
$typeParams = $this->getTypeparams();
$typeParams = new JRegistry($typeParams);
// Create item parameters
if (!is_object($this->_item->attribs)) {
$itemParams = new JRegistry($this->_item->attribs);
} else {
$itemParams = $this->_item->attribs;
}
// Retrieve Layout's parameters, also deciding the layout
$this->decideLayout($compParams, $typeParams, $itemParams);
$layoutParams = $this->getLayoutparams();
$layoutParams = new JRegistry($layoutParams);
//print_r($layoutParams);
// ***************************************************************************************************
// Merge parameters in order: component, menu, (item 's) current category, (item's) content type, item
// ***************************************************************************************************
// a. Start with empty registry, then merge COMPONENT parameters
$params = new JRegistry();
$params->merge($compParams);
// b. Merge parameters from current category
$catParams->set('show_title', '');
// Prevent show_title from propagating ... to the item, it is meant for category view only
$catParams->set('title_linkable', '');
// Prevent title_linkable from propagating ... to the item, it is meant for category view only
$catParams->set('show_editbutton', '');
// Prevent title_linkable from propagating ... to the item, it is meant for category view only
$params->merge($catParams);
// c0. Merge Layout parameters into the page configuration
$params->merge($layoutParams);
// c1. Merge TYPE parameters into the page configuration
$params->merge($typeParams);
// d. Merge ITEM parameters into the page configuration
$params->merge($itemParams);
// e. Merge ACCESS permissions into the page configuration
$accessperms = $this->getItemAccess();
$params->merge($accessperms);
// d. Merge the active menu parameters, verify menu item points to current FLEXIcontent object
if ($menu && !empty($this->mergeMenuParams)) {
if (!empty($this->isForm)) {
$this->menu_matches = false;
$view_ok = FLEXI_ITEMVIEW == @$menu->query['view'] || 'article' == @$menu->query['view'];
$this->menu_matches = $view_ok;
} else {
$view_ok = FLEXI_ITEMVIEW == @$menu->query['view'] || 'article' == @$menu->query['view'];
$cid_ok = JRequest::getInt('cid') == (int) @$menu->query['cid'];
$id_ok = JRequest::getInt('id') == (int) @$menu->query['id'];
$this->menu_matches = $view_ok && $id_ok;
}
} else {
$this->menu_matches = false;
}
// MENU ITEM matched, merge parameters and use its page heading (but use menu title if the former is not set)
if ($this->menu_matches) {
$params->merge($menu->params);
$default_heading = $menu->title;
// Cross set (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
$params->def('page_heading', $params->get('page_title', $default_heading));
$params->def('page_title', $params->get('page_heading', $default_heading));
$params->def('show_page_heading', $params->get('show_page_title', 0));
$params->def('show_page_title', $params->get('show_page_heading', 0));
} else {
// Clear some menu parameters
//$params->set('pageclass_sfx', ''); // CSS class SUFFIX is behavior, so do not clear it ?
// Calculate default page heading (=called page title in J1.5), which in turn will be document title below !! ...
$default_heading = empty($this->isForm) ? $this->_item->title : (!$isnew ? JText::_('FLEXI_EDIT') : JText::_('FLEXI_NEW'));
// Decide to show page heading (=J1.5 page title), there is no need for this in item view
$show_default_heading = 0;
// Set both (show_) page_heading / page_title for compatibility of J2.5+ with J1.5 template (and for J1.5 with J2.5 template)
//.........这里部分代码省略.........
示例10: getParams
function getParams($component = true)
{
// we have to take clear JRegistry object to avoid overriding static component params
$params = new JRegistry();
// global params first
$cparams = JComponentHelper::getParams('com_djmediatools');
$params->merge($cparams);
// override global params with menu params only for component view
if ($component) {
$app = JFactory::getApplication();
$mparams = $app->getParams('com_djmediatools');
//$mparams = clone($mparams);
$params->merge($mparams);
}
// override global/menu params with category params
$id = $this->getState('category.id');
$category = $this->getItem($id);
if ($category && $category != 'root') {
$cparams = $category->params;
$params->merge($cparams);
}
return $params;
}
示例11: testMerge
/**
* Test the JRegistry::merge method.
*
* @covers JRegistry::merge
*
* @return void
*/
public function testMerge()
{
$array1 = array('foo' => 'bar', 'hoo' => 'hum', 'dum' => array('dee' => 'dum'));
$array2 = array('foo' => 'soap', 'dum' => 'huh');
$registry1 = new JRegistry();
$registry1->loadArray($array1);
$registry2 = new JRegistry();
$registry2->loadArray($array2);
$registry1->merge($registry2);
// Test getting a known value.
$this->assertThat($registry1->get('foo'), $this->equalTo('soap'), 'Line: ' . __LINE__ . '.');
$this->assertThat($registry1->get('dum'), $this->equalTo('huh'), 'Line: ' . __LINE__ . '.');
// Test merge with zero and blank value
$json1 = '{"param1":1, "param2":"value2"}';
$json2 = '{"param1":2, "param2":"", "param3":0, "param4":-1, "param5":1}';
$a = new JRegistry($json1);
$b = new JRegistry();
$b->loadString($json2, 'JSON');
$a->merge($b);
// New param with zero value should show in merged registry
$this->assertEquals(2, $a->get('param1'), '$b value should override $a value');
$this->assertEquals('value2', $a->get('param2'), '$a value should override blank $b value');
$this->assertEquals(0, $a->get('param3'), '$b value of 0 should override $a value');
$this->assertEquals(-1, $a->get('param4'), '$b value of -1 should override $a value');
$this->assertEquals(1, $a->get('param5'), '$b value of 1 should override $a value');
$a = new JRegistry();
$b = new stdClass();
$this->assertFalse($a->merge($b), 'Line: ' . __LINE__ . '. Attempt to merge non JRegistry should return false');
}
示例12: JRegistry
/**
* Method to load parameters
*
* @access private
* @return void
* @since 1.5
*/
function _loadParams()
{
if ($this->_params !== NULL) {
return;
}
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
// Retrieve active menu
// Get the COMPONENT only parameter
$params = new JRegistry();
$cparams = JComponentHelper::getParams('com_flexicontent');
$params->merge($cparams);
// Merge the active menu parameters
if ($menu) {
$params->merge($menu->params);
}
// Merge module parameters overriding current configuration
// (this done when module id is present in the HTTP request) (tags cloud module include tags view configuration)
if (JRequest::getInt('module', 0)) {
// load by module name, not used
//jimport( 'joomla.application.module.helper' );
//$module_name = JRequest::getInt('module', 0 );
//$module = JModuleHelper::getModule('mymodulename');
// load by module id
$module_id = JRequest::getInt('module', 0);
$module = JTable::getInstance('Module', 'JTable');
if ($module->load($module_id)) {
$moduleParams = new JRegistry($module->params);
$params->merge($moduleParams);
} else {
JError::raiseNotice(500, $module->getError());
}
}
$this->_params = $params;
}
示例13: jimport
/**
* Creates the item submit form
*
* @since 1.0
*/
function _displayForm($tpl)
{
jimport('joomla.html.parameter');
// ... we use some strings from administrator part
// load english language file for 'com_content' component then override with current language file
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, null, true);
// load english language file for 'com_flexicontent' component then override with current language file
JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, null, true);
// ********************************
// Initialize variables, flags, etc
// ********************************
$app = JFactory::getApplication();
$dispatcher = JDispatcher::getInstance();
$document = JFactory::getDocument();
$session = JFactory::getSession();
$user = JFactory::getUser();
$db = JFactory::getDBO();
$uri = JFactory::getURI();
$nullDate = $db->getNullDate();
$menu = $app->getMenu()->getActive();
// We do not have item parameters yet, but we need to do some work before creating the item
// Get the COMPONENT only parameter
$params = new JRegistry();
$cparams = JComponentHelper::getParams('com_flexicontent');
$params->merge($cparams);
// Merge the active menu parameters
if ($menu) {
$params->merge($menu->params);
}
// Some flags
$enable_translation_groups = flexicontent_db::useAssociations();
//$params->get("enable_translation_groups");
$print_logging_info = $params->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
}
// *****************
// Load JS/CSS files
// *****************
FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools');
flexicontent_html::loadFramework('jQuery');
flexicontent_html::loadFramework('select2');
flexicontent_html::loadFramework('flexi-lib');
// Load custom behaviours: form validation, popup tooltips
JHTML::_('behavior.formvalidation');
// load default validation JS to make sure it is overriden
JHTML::_('behavior.tooltip');
if (FLEXI_J30GE) {
JHtml::_('bootstrap.tooltip');
}
//JHTML::_('script', 'joomla.javascript.js', 'includes/js/');
// Add css files to the document <head> section (also load CSS joomla template override)
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css');
if (file_exists(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'css' . DS . 'flexicontent.css')) {
$document->addStyleSheet($this->baseurl . '/templates/' . $app->getTemplate() . '/css/flexicontent.css');
}
// Fields common CSS
$document->addStyleSheet($this->baseurl . '/components/com_flexicontent/assets/css/flexi_form_fields.css');
// Load backend / frontend shared and Joomla version specific CSS (different for frontend / backend)
FLEXI_J30GE ? $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css') : $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
// Add js function to overload the joomla submitform
$document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/admin.js');
$document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/validate.js');
// Add js function for custom code used by FLEXIcontent item form
$document->addScript(JURI::base(true) . '/components/com_flexicontent/assets/js/itemscreen.js');
// *********************************************************
// Get item data and create item form (that loads item data)
// *********************************************************
if ($print_logging_info) {
$start_microtime = microtime(true);
}
$model = $this->getModel();
// ** WE NEED TO get OR decide the Content Type, before we call the getItem
// ** We rely on typeid Request variable to decide type for new items so make sure this is set,
// ZERO means allow user to select type, but if user is only allowed a single type, then autoselect it!
// Try type from session
$jdata = $app->getUserState('com_flexicontent.edit.item.data');
//print_r($jdata);
if (!empty($jdata['type_id'])) {
JRequest::setVar('typeid', (int) $jdata['type_id']);
// This also forces zero if value not set
} else {
if ($menu && isset($menu->query['typeid'])) {
JRequest::setVar('typeid', (int) $menu->query['typeid']);
// This also forces zero if value not set
}
}
$new_typeid = JRequest::getVar('typeid', 0, '', 'int');
// Verify type is allowed to the user
if (!$new_typeid) {
$types = $model->getTypeslist($type_ids_arr = false, $check_perms = true, $_published = true);
if ($types && count($types) == 1) {
$new_typeid = $types[0]->id;
//.........这里部分代码省略.........
示例14: getMergedParams
/**
* Method to merge config params and Menu params
* @return params
*/
function getMergedParams()
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$params = new JRegistry();
$params->loadString('{}');
return $params;
}
//first get the menu params
$aparams = $app->getParams();
$menuParams = new JRegistry();
if ($menu = $app->getMenu()->getActive()) {
$menuParams->loadString($menu->params);
}
$mergedParams = clone $menuParams;
$mergedParams->merge($aparams);
//now load the configurations
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('*')->from('#__j2store_configurations');
$db->setQuery($query);
$results = $db->loadObjectList('config_meta_key');
$config = array();
foreach ($results as $key => $value) {
$config[$key] = $value->config_meta_value;
}
$configparams = new JRegistry();
$configparams->loadArray($config);
$configparams->merge($mergedParams);
/* //get the active menu details
$menu = JFactory::getApplication()->getMenu()->getActive();
$menu_array=array();
//if any menu template choosen then that template will
if(isset($menu->params)){
$menu_params = $menu->params;
$registry = new JRegistry($menu_params);
$registry->loadObject($menu_params);
$result_array = $registry->toArray($menu_params);
$menu_array = isset($result_array['data']) ? $result_array['data'] :array();
}
$params = array_merge($config,$menu_array);
$registry = new JRegistry();
$registry->loadArray($params); */
//merged params
return $configparams;
}
示例15: getComponentTypeParams
/**
* Method to get component + type parameters these are enough for the backend,
* also they are needed before frontend view's FULL item parameters are created
*
* @access public
* @return int item identifier
*/
function getComponentTypeParams()
{
// Calculate component + type parameters
if ($this->_cparams) {
return $this->_cparams;
}
$app = JFactory::getApplication();
// Get component parameters
$params = new JRegistry();
$cparams = JComponentHelper::getParams('com_flexicontent');
$params->merge($cparams);
// Merge into them the type parameters, *(type was set/verified above)
if ($this->_typeid) {
$tparams = $this->getTypeparams();
$tparams = new JRegistry($tparams);
$params->merge($tparams);
}
// Set and return component + type parameters
$this->_cparams = $params;
return $this->_cparams;
}