本文整理汇总了PHP中flexicontent_db::getUserConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_db::getUserConfig方法的具体用法?PHP flexicontent_db::getUserConfig怎么用?PHP flexicontent_db::getUserConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_db
的用法示例。
在下文中一共展示了flexicontent_db::getUserConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Logic to create the view for the edit item screen
*
* @access public
* @return void
* @since 1.0
*/
function edit()
{
JRequest::setVar('view', 'item');
JRequest::setVar('hidemainmenu', 1);
$user = JFactory::getUser();
$session = JFactory::getSession();
$document = JFactory::getDocument();
// Get/Create the view
$viewType = $document->getType();
$viewName = $this->input->get('view', $this->default_view, 'cmd');
$viewLayout = $this->input->get('layout', 'default', 'string');
$view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
// Get/Create the model
$model = $this->getModel('item');
// Push the model into the view (as default), later we will call the view display method instead of calling parent's display task, because it will create a 2nd model instance !!
$view->setModel($model, true);
$view->document = $document;
// FORCE model to load versioned data (URL specified version or latest version (last saved))
$version = JRequest::getVar('version', 0, 'request', 'int');
// Load specific item version (non-zero), 0 version: is unversioned data, -1 version: is latest version (=default for edit form)
$item = $model->getItem(null, $check_view_access = false, $no_cache = true, $force_version = $version != 0 ? $version : -1);
// -1 version means latest
$isnew = !$model->getId();
$canAdd = $model->getItemAccess()->get('access-create');
$canEdit = $model->getItemAccess()->get('access-edit');
if (!$canEdit) {
// No edit privilege, check if item is editable till logoff
if ($session->has('rendered_uneditable', 'flexicontent')) {
$rendered_uneditable = $session->get('rendered_uneditable', array(), 'flexicontent');
$canEdit = isset($rendered_uneditable[$model->get('id')]) && $rendered_uneditable[$model->get('id')];
}
}
// New item: check if user can create in at least one category
if ($isnew) {
// A. Check create privilege
if (!$canAdd) {
JError::raiseNotice(403, JText::_('FLEXI_NO_ACCESS_CREATE'));
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
// Get User Group / Author parameters
$db = JFactory::getDBO();
$authorparams = flexicontent_db::getUserConfig($user->id);
$max_auth_limit = intval($authorparams->get('max_auth_limit', 0));
// maximum number of content items the user can create
// B. Check if max authored content limit reached
if ($max_auth_limit) {
$db->setQuery('SELECT COUNT(id) FROM #__content WHERE created_by = ' . $user->id);
$authored_count = $db->loadResult();
if ($authored_count >= $max_auth_limit) {
JError::raiseNotice(403, JText::sprintf('FLEXI_ALERTNOTAUTH_CREATE_MORE', $max_auth_limit));
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
}
// C. Check if Content Type can be created by current user
$typeid = JRequest::getVar('typeid', 0, '', 'int');
if ($typeid) {
$canCreateType = $model->canCreateType(array($typeid), true, $types);
// Can create given Content Type
} else {
$canCreateType = $model->canCreateType();
// Can create at least one Content Type
}
if (!$canCreateType) {
$type_name = isset($types[${$typeid}]) ? '"' . JText::_($types[${$typeid}]->name) . '"' : JText::_('FLEXI_ANY');
$msg = JText::sprintf('FLEXI_NO_ACCESS_CREATE_CONTENT_OF_TYPE', $type_name);
JError::raiseNotice(403, $msg);
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
} else {
if (!$canEdit) {
JError::raiseNotice(403, JText::_('FLEXI_NO_ACCESS_EDIT'));
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
}
// Check if record is checked out by other editor
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseNotice(500, JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
// Checkout the record and proceed to edit form
if (!$model->checkout()) {
JError::raiseWarning(500, $model->getError());
$this->setRedirect('index.php?option=com_flexicontent&view=items', '');
return;
}
// Call display method of the view, instead of calling parent's display task, because it will create a 2nd model instance !!
$view->display();
//parent::display();
//.........这里部分代码省略.........
示例2: display
//.........这里部分代码省略.........
$_dataCol_wrongSize = false;
}*/
if ($_dataCol_wrongSize) {
$app->enqueueMessage("Joomla DB table: <b>'session'</b> has a <b>'data'</b> column with type: <b>'" . $_dataColType . "'</b>, instead of expected type <b>'mediumtext'</b>. Trying to import large data files may fail", "notice");
}
$formvals = array();
// Retrieve Basic configuration
$formvals['type_id'] = $model->getState('type_id');
$formvals['language'] = $model->getState('language');
$formvals['state'] = $model->getState('state');
$formvals['access'] = $model->getState('access');
// Main and secondary categories, tags
$formvals['maincat'] = $model->getState('maincat');
$formvals['maincat_col'] = $model->getState('maincat_col');
$formvals['seccats'] = $model->getState('seccats');
$formvals['seccats_col'] = $model->getState('seccats_col');
$formvals['tags_col'] = $model->getState('tags_col');
// Publication: Author/modifier
$formvals['created_by_col'] = $model->getState('created_by_col');
$formvals['modified_by_col'] = $model->getState('modified_by_col');
// Publication: META data
$formvals['metadesc_col'] = $model->getState('metadesc_col');
$formvals['metakey_col'] = $model->getState('metakey_col');
// Publication: dates
$formvals['modified_col'] = $model->getState('modified_col');
$formvals['created_col'] = $model->getState('modified_col');
$formvals['publish_up_col'] = $model->getState('publish_up_col');
$formvals['publish_down_col'] = $model->getState('publish_down_col');
// Advanced configuration
$formvals['ignore_unused_cols'] = $model->getState('ignore_unused_cols');
$formvals['id_col'] = $model->getState('id_col');
$formvals['items_per_step'] = $model->getState('items_per_step');
// CSV file format
$formvals['mval_separator'] = $model->getState('mval_separator');
$formvals['mprop_separator'] = $model->getState('mprop_separator');
$formvals['field_separator'] = $model->getState('field_separator');
$formvals['enclosure_char'] = $model->getState('enclosure_char');
$formvals['record_separator'] = $model->getState('record_separator');
$formvals['debug_records'] = $model->getState('debug_records');
// ******************
// Create form fields
// ******************
$lists['type_id'] = flexicontent_html::buildtypesselect($types, 'type_id', $formvals['type_id'], true, 'class="required use_select2_lib"', 'type_id');
$actions_allowed = array('core.create');
// Creating categorories tree for item assignment, we use the 'create' privelege
// build the main category select list
$attribs = 'class="use_select2_lib required"';
$fieldname = 'maincat';
$lists['maincat'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['maincat'], 2, $attribs, false, true, $actions_allowed);
// build the secondary categories select list
$class = "use_select2_lib";
$attribs = 'multiple="multiple" size="10" class="' . $class . '"';
$fieldname = 'seccats[]';
$lists['seccats'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['seccats'], false, $attribs, false, true, $actions_allowed, $require_all = true);
// build languages list
// Retrieve author configuration
$authorparams = flexicontent_db::getUserConfig($user->id);
$allowed_langs = $authorparams->get('langs_allowed', null);
$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs);
// We will not use the default getInput() function of J1.6+ since we want to create a radio selection field with flags
// we could also create a new class and override getInput() method but maybe this is an overkill, we may do it in the future
$lists['languages'] = flexicontent_html::buildlanguageslist('language', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_langcol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['language'], 6, $allowed_langs, $published_only = true, $disable_langs = null, $add_all = true, $conf = array('required' => true)) . '
<span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_langcol" style="display:none;">
' . JText::_('FLEXI_USE_LANGUAGE_COLUMN_TIP') . '
</span>';
$lists['states'] = flexicontent_html::buildstateslist('state', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_statecol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['state'], 2) . '<span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_statecol" style="display:none;">
' . JText::_('FLEXI_USE_STATE_COLUMN_TIP') . '
</span>';
// build access level filter
$access_levels = JHtml::_('access.assetgroups');
array_unshift($access_levels, JHtml::_('select.option', '0', "Use 'access' column"));
array_unshift($access_levels, JHtml::_('select.option', '', 'FLEXI_SELECT_ACCESS_LEVEL'));
$fieldname = 'access';
// make multivalue
$elementid = 'access';
$attribs = 'class="required use_select2_lib"';
$lists['access'] = JHTML::_('select.genericlist', $access_levels, $fieldname, $attribs, 'value', 'text', $formvals['access'], $elementid, $translate = true);
// Ignore warnings because component may not be installed
$warnHandlers = JERROR::getErrorHandling(E_WARNING);
JERROR::setErrorHandling(E_WARNING, 'ignore');
// Reset the warning handler(s)
foreach ($warnHandlers as $mode) {
JERROR::setErrorHandling(E_WARNING, $mode);
}
// ********************************************************************************
// Get field names (from the header line (row 0), and remove it form the data array
// ********************************************************************************
$file_field_types_list = '"image","file"';
$q = 'SELECT id, name, label, field_type FROM #__flexicontent_fields AS fi' . ' WHERE fi.field_type IN (' . $file_field_types_list . ')';
$db->setQuery($q);
$file_fields = $db->loadObjectList('name');
//assign data to template
$this->assignRef('model', $model);
$this->assignRef('lists', $lists);
$this->assignRef('user', $user);
$this->assignRef('cparams', $cparams);
$this->assignRef('file_fields', $file_fields);
$this->assignRef('formvals', $formvals);
parent::display($tpl);
}
示例3: display
//.........这里部分代码省略.........
}
$i++;
}
// build field for notifying subscribers
if (!$subscribers) {
$lists['notify'] = !$isnew ? JText::_('FLEXI_NO_SUBSCRIBERS_EXIST') : '';
} else {
// b. Check if notification emails to subscribers , were already sent during current session
$subscribers_notified = $session->get('subscribers_notified', array(), 'flexicontent');
if (!empty($subscribers_notified[$item->id])) {
$lists['notify'] = JText::_('FLEXI_SUBSCRIBERS_ALREADY_NOTIFIED');
} else {
// build favs notify field
$fieldname = 'jform[notify]';
$elementid = 'jform_notify';
/*
$attribs = FLEXI_J16GE ? ' style ="float:none!important;" ' : ''; // this is not right for J1.5' style ="float:left!important;" ';
$lists['notify'] = '<input type="checkbox" name="jform[notify]" id="jform_notify" '.$attribs.' /> '. $lbltxt;
*/
$classes = !$prettycheckable_added ? '' : ' use_prettycheckable ';
$attribs = ' class="' . $classes . '" ';
$lbltxt = $subscribers . ' ' . JText::_($subscribers > 1 ? 'FLEXI_SUBSCRIBERS' : 'FLEXI_SUBSCRIBER');
if (!$prettycheckable_added) {
$lists['notify'] .= '<label class="fccheckradio_lbl" for="' . $elementid . '">';
}
$extra_params = !$prettycheckable_added ? '' : ' data-labeltext="' . $lbltxt . '" data-labelPosition="right" data-customClass="fcradiocheck"';
$lists['notify'] = ' <input type="checkbox" id="' . $elementid . '" data-element-grpid="' . $elementid . '" name="' . $fieldname . '" ' . $attribs . ' value="1" ' . $extra_params . ' checked="checked" />';
if (!$prettycheckable_added) {
$lists['notify'] .= ' ' . $lbltxt . '</label>';
}
}
}
// Retrieve author configuration
$authorparams = flexicontent_db::getUserConfig($user->id);
// Get author's maximum allowed categories per item and set js limitation
$max_cat_assign = intval($authorparams->get('max_cat_assign', 0));
$document->addScriptDeclaration('
max_cat_assign_fc = ' . $max_cat_assign . ';
existing_cats_fc = ["' . implode('","', $selectedcats) . '"];
');
JText::script('FLEXI_TOO_MANY_ITEM_CATEGORIES', true);
// Creating categorories tree for item assignment, we use the 'create' privelege
$actions_allowed = array('core.create');
// Featured categories form field
$featured_cats_parent = $params->get('featured_cats_parent', 0);
$featured_cats = array();
$enable_featured_cid_selector = $perms['multicat'] && $perms['canchange_featcat'];
if ($featured_cats_parent) {
$featured_tree = flexicontent_cats::getCategoriesTree($published_only = 1, $parent_id = $featured_cats_parent, $depth_limit = 0);
$disabled_cats = $params->get('featured_cats_parent_disable', 1) ? array($featured_cats_parent) : array();
$featured_sel = array();
foreach ($selectedcats as $item_cat) {
if (isset($featured_tree[$item_cat])) {
$featured_sel[] = $item_cat;
}
}
$class = "use_select2_lib select2_list_selected";
$attribs = 'class="' . $class . '" multiple="multiple" size="8"';
$attribs .= $enable_featured_cid_selector ? '' : ' disabled="disabled"';
$fieldname = 'jform[featured_cid][]';
$lists['featured_cid'] = ($enable_featured_cid_selector ? '' : '<label class="label" style="float:none; margin:0 6px 0 0 !important;">locked</label>') . flexicontent_cats::buildcatselect($featured_tree, $fieldname, $featured_sel, 3, $attribs, true, true, $actions_allowed, $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disabled_cats);
} else {
// Do not display, if not configured or not allowed to the user
$lists['featured_cid'] = false;
}
// Multi-category form field, for user allowed to use multiple categories
示例4: _displayForm
//.........这里部分代码省略.........
// Trigger the configured captcha plugin
if ($display_captcha) {
// Get configured captcha plugin
$c_plugin = $params->get('captcha', $app->getCfg('captcha'));
// TODO add param to override default
if ($c_plugin) {
$c_name = 'captcha_response_field';
$c_id = $c_plugin == 'recaptcha' ? 'dynamic_recaptcha_1' : 'fc_dynamic_captcha';
$c_class = ' required';
$c_namespace = 'fc_item_form';
// Try to load the configured captcha plugin, (check if disabled or uninstalled), Joomla will enqueue an error message if needed
$captcha_obj = JCaptcha::getInstance($c_plugin, array('namespace' => $c_namespace));
if ($captcha_obj) {
$captcha_field = $captcha_obj->display($c_name, $c_id, $c_class);
$label_class = 'flexi_label';
$label_class .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip';
$label_tooltip = flexicontent_html::getToolTip(null, 'FLEXI_CAPTCHA_ENTER_CODE_DESC', 1, 1);
$captcha_field = '
<label id="' . $c_name . '-lbl" for="' . $c_name . '" class="' . $label_class . '" title="' . $label_tooltip . '" >
' . JText::_('FLEXI_CAPTCHA_ENTER_CODE') . '
</label>
<div id="container_fcfield_' . $c_plugin . '" class="container_fcfield container_fcfield_name_' . $c_plugin . '">
<div class="fcfieldval_container valuebox fcfieldval_container_' . $c_plugin . '">
' . $captcha_field . '
</div>
</div>';
}
}
}
// *******************************
// CHECK EDIT / CREATE PERMISSIONS
// *******************************
// User Group / Author parameters
$authorparams = flexicontent_db::getUserConfig($user->id);
$max_auth_limit = intval($authorparams->get('max_auth_limit', 0));
// maximum number of content items the user can create
$hasTmpEdit = false;
$hasCoupon = false;
// Check session
if ($session->has('rendered_uneditable', 'flexicontent')) {
$rendered_uneditable = $session->get('rendered_uneditable', array(), 'flexicontent');
$hasTmpEdit = !empty($rendered_uneditable[$model->get('id')]);
$hasCoupon = !empty($rendered_uneditable[$model->get('id')]) && $rendered_uneditable[$model->get('id')] == 2;
// editable via coupon
}
if (!$isnew) {
// EDIT action
// Finally check if item is currently being checked-out (currently being edited)
if ($model->isCheckedOut($user->get('id'))) {
$msg = JText::sprintf('FLEXI_DESCBEINGEDITTED', $model->get('title'));
$app->redirect(JRoute::_('index.php?view=' . FLEXI_ITEMVIEW . '&cid=' . $model->get('catid') . '&id=' . $model->get('id'), false), $msg);
}
//Checkout the item
$model->checkout();
// Get edit access, this includes privileges edit and edit-own and the temporary EDIT flag ('rendered_uneditable')
$canEdit = $model->getItemAccess()->get('access-edit');
// If no edit privilege, check if edit COUPON was provided
if (!$canEdit) {
$edittok = JRequest::getCmd('edittok', false);
if ($edittok) {
$query = 'SHOW TABLES LIKE "' . $app->getCfg('dbprefix') . 'flexicontent_edit_coupons"';
$db->setQuery($query);
$tbl_exists = (bool) count($db->loadObjectList());
if ($tbl_exists) {
$query = 'SELECT * FROM #__flexicontent_edit_coupons ' . ' WHERE token = ' . $db->Quote($edittok) . ' AND id = ' . $model->get('id');
$db->setQuery($query);
示例5: store
//.........这里部分代码省略.........
// Check and correct given item DATA
// *********************************
// tags and cats will need some manipulation so we retieve them
$tags = $this->formatToArray(@$data['tag']);
$cats = $this->formatToArray(@$data['cid']);
$featured_cats = $this->formatToArray(@$data['featured_cid']);
unset($data['tag']);
unset($data['cid']);
unset($data['featured_cid']);
// Make tags unique
$tags = array_keys(array_flip($tags));
// Auto-assign a not set main category, to be the first out of secondary categories,
if (empty($data['catid']) && !empty($cats[0])) {
$data['catid'] = $cats[0];
}
$cats_indexed = array_flip($cats);
// Add the primary cat to the array if it's not already in
if (@$data['catid'] && !isset($cats_indexed[$data['catid']])) {
$cats_indexed[$data['catid']] = 1;
}
// Add the featured cats to the array if it's not already in
if (!empty($featured_cats)) {
foreach ($featured_cats as $featured_cat) {
if (@$featured_cat && !isset($cats_indexed[$featured_cat])) {
$cats_indexed[$featured_cat] = 1;
}
}
}
// Reassign (unique) categories back to the cats array
$cats = array_keys($cats_indexed);
// *****************************
// Retrieve author configuration
// *****************************
$authorparams = flexicontent_db::getUserConfig($user->id);
// At least one category needs to be assigned
if (!is_array($cats) || count($cats) < 1) {
$this->setError(JText::_('FLEXI_OPERATION_FAILED') . ", " . JText::_('FLEXI_REASON') . ": " . JText::_('FLEXI_SELECT_CATEGORY'));
return false;
// Check more than allowed categories
} else {
// Get author's maximum allowed categories per item and set js limitation
$max_cat_assign = intval($authorparams->get('max_cat_assign', 0));
// Verify category limitation for current author
if ($max_cat_assign) {
if (count($cats) > $max_cat_assign) {
if (count($cats) <= count($item->categories)) {
$existing_only = true;
// Maximum number of categories is exceeded, but do not abort if only using existing categories
foreach ($cats as $newcat) {
$existing_only = $existing_only && in_array($newcat, $item->categories);
}
} else {
$existing_only = false;
}
if (!$existing_only) {
$this->setError(JText::_('FLEXI_OPERATION_FAILED') . ", " . JText::_('FLEXI_REASON') . ": " . JText::_('FLEXI_TOO_MANY_ITEM_CATEGORIES') . $max_cat_assign);
return false;
}
}
}
}
// Trim title, but allow not setting it ... to maintain current value (but we will also need to override 'required' during validation)
if (isset($data['title'])) {
$data['title'] = trim($data['title']);
}
// Set back the altered categories and tags to the form data