本文整理汇总了PHP中FlexicontentHelperPerm类的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperPerm类的具体用法?PHP FlexicontentHelperPerm怎么用?PHP FlexicontentHelperPerm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlexicontentHelperPerm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$document = JFactory::getDocument();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
//add css and submenu to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
// Get User's Global Permissions
$perms = FlexicontentHelperPerm::getPerm();
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanGroups');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_GROUPS');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'groups');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$this->addToolbar();
parent::display($tpl);
}
示例2: display
function display($tpl = null)
{
//initialise variables
$mainframe = JFactory::getApplication();
$option = JRequest::getVar('option');
$document = JFactory::getDocument();
$user = JFactory::getUser();
$db = JFactory::getDBO();
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
//add css and submenu to document
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css');
} else {
$document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css');
}
}
$permission = FlexicontentHelperPerm::getPerm();
if (!$permission->CanTemplates) {
$mainframe->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'));
}
// Get User's Global Permissions
$perms = FlexicontentHelperPerm::getPerm();
//Create Submenu
FLEXISubmenu('CanTemplates');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_TEMPLATES');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'templates');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
//JToolBarHelper::Back();
if ($perms->CanConfig) {
//JToolBarHelper::divider(); JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$tmpldirectory = JPATH_COMPONENT_SITE . DS . 'templates' . DS;
$source = JRequest::getString('source', '');
$dest = $source ? flexicontent_upload::sanitizedir($tmpldirectory, $source) : '';
//Get data from the model
$rows = $this->get('Data');
//assign data to template
$this->assignRef('rows', $rows);
$this->assignRef('user', $user);
$this->assignRef('tmpldirectory', $tmpldirectory);
$this->assignRef('source', $source);
$this->assignRef('dest', $dest);
parent::display($tpl);
}
示例3: display
function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$app = JFactory::getApplication();
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$db = JFactory::getDBO();
$document = JFactory::getDocument();
$option = JRequest::getCmd('option');
$view = JRequest::getVar('view');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Get filters
$count_filters = 0;
$search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string');
$search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search)));
// **************************
// Add css and js to document
// **************************
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css');
if (FLEXI_J30GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css');
} else {
if (FLEXI_J16GE) {
$document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css');
}
}
// *****************************
// Get user's global permissions
// *****************************
$perms = FlexicontentHelperPerm::getPerm();
// ************************
// Create Submenu & Toolbar
// ************************
// Create Submenu (and also check access to current view)
FLEXISubmenu('CanGroups');
// Create document/toolbar titles
$doc_title = JText::_('FLEXI_GROUPS');
$site_title = $document->getTitle();
JToolBarHelper::title($doc_title, 'groups');
$document->setTitle($doc_title . ' - ' . $site_title);
// Create the toolbar
$this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null;
$this->addToolbar();
//assign data to template
$this->lists['search'] = $search;
$this->count_filters = $count_filters;
$this->option = $option;
$this->view = $view;
parent::display($tpl);
}
示例4: checkDirtyFields
function checkDirtyFields()
{
if (JRequest::getVar('task') != '' || JRequest::getVar('format') != '' || JRequest::getVar('tmpl') != '') {
return;
}
$perms = FlexicontentHelperPerm::getPerm();
if (!$perms->CanFields) {
return;
}
$db = JFactory::getDBO();
// GET fields having dirty field properties, NOTE: a dirty field property means that search index must be updated,
// even if the field was unpublished, because the field values may still exists in the search index for some items
$query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (issearch=-1 || issearch=2)';
$db->setQuery($query);
$dirty_basic = $db->loadResult();
$query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (isadvsearch=-1 OR isadvsearch=2 OR isadvfilter=-1 OR isadvfilter=2)';
$db->setQuery($query);
$dirty_advanced = $db->loadResult();
if ($dirty_basic) {
JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_BASIC_INDEX', $dirty_basic));
}
if ($dirty_advanced) {
JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_ADVANCED_INDEX', $dirty_advanced));
}
}
示例5: getItemsMultiprop
/**
* Method to get items using files VIA (multi property) field types that store file as as property either file id or filename!
*
* @access public
* @return object
*/
function getItemsMultiprop($field_props = array('image' => 'originalname'), $value_props = array('image' => 'filename'), $file_ids = array(), $count_items = false, $ignored = false)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getVar('option');
$filter_uploader = $app->getUserStateFromRequest($option . '.' . $this->viewid . '.filter_uploader', 'filter_uploader', 0, 'int');
$where = array();
$file_ids_list = '';
if (count($file_ids)) {
$file_ids_list = ' AND f.id IN (' . "'" . implode("','", $file_ids) . "')";
} else {
$permission = FlexicontentHelperPerm::getPerm();
$CanViewAllFiles = $permission->CanViewAllFiles;
if (!$CanViewAllFiles) {
$where[] = ' f.uploaded_by = ' . (int) $user->id;
} else {
if ($filter_uploader) {
$where[] = ' f.uploaded_by = ' . $filter_uploader;
}
}
}
if (isset($ignored['item_id'])) {
$where[] = ' i.id!=' . (int) $ignored['item_id'];
}
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$groupby = !$count_items ? ' GROUP BY i.id' : ' GROUP BY f.id';
// file maybe used in more than one fields or ? in more than one values for same field
$orderby = !$count_items ? ' ORDER BY i.title ASC' : '';
// Serialized values are like : "__field_propname__";s:33:"__value__"
$format_str = 'CONCAT("%%","\\"%s\\";s:%%:%%\\"",%s,"\\"%%")';
$items = array();
$files = array();
foreach ($field_props as $field_type => $field_prop) {
// Some fields may not be using DB, create a limitation for them
$field_ids = $this->getFieldsUsingDBmode($field_type);
$field_ids_list = !$field_ids ? "" : " AND fi.id IN ('" . implode("','", $field_ids) . "')";
// Create a matching condition for the value depending on given configuration (property name of the field, and value property of file: either id or filename or ...)
$value_prop = $value_props[$field_type];
$like_str = $this->_db->escape('f.' . $value_prop, false);
$like_str = sprintf($format_str, $field_prop, $like_str);
// File field relation sub query
$query = 'SELECT ' . ($count_items ? 'f.id as file_id, COUNT(i.id) as item_count' : 'i.id as id, i.title') . ' FROM #__content AS i' . ' JOIN #__flexicontent_fields_item_relations AS rel ON rel.item_id = i.id' . ' JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id AND fi.field_type IN (' . $this->_db->Quote($field_type) . ')' . $field_ids_list . ' JOIN #__flexicontent_files AS f ON rel.value LIKE ' . $like_str . ' AND f.' . $value_prop . '<>""' . $file_ids_list . $where . $groupby . $orderby;
//echo nl2br( "\n".$query."\n");
$this->_db->setQuery($query);
$_item_data = $this->_db->loadObjectList($count_items ? 'file_id' : 'id');
if ($this->_db->getErrorNum()) {
JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($this->_db->getErrorMsg()), 'error');
}
if ($_item_data) {
foreach ($_item_data as $item) {
if ($count_items) {
$items[$item->file_id] = (int) @$items[$item->file_id] + $item->item_count;
} else {
$items[$item->title] = $item;
}
}
}
//echo "<pre>"; print_r($_item_data); exit;
}
//echo "<pre>"; print_r($items); exit;
return $items;
}
示例6: getInprogress
/**
* Method to get items in progress state, (published but) waiting to be completed
*
* @access public
* @return array
*/
function getInprogress()
{
$user = JFactory::getUser();
$permission = FlexicontentHelperPerm::getPerm();
$allitems = $permission->DisplayAllItems;
$use_tmp = true;
$query_select_ids = 'SELECT c.id';
//SQL_CALC_FOUND_ROWS
$query_select_data = 'SELECT c.id, c.title, c.catid, c.created, cr.name as creator, c.created_by, c.modified, c.modified_by, mr.name as modifier';
$query_from_join = '' . ' FROM ' . ($use_tmp ? '#__flexicontent_items_tmp' : '#__content') . ' as c' . ' LEFT JOIN #__users AS cr ON cr.id = c.created_by' . ' LEFT JOIN #__users AS mr ON mr.id = c.modified_by';
$query_where_orderby_having = '' . ' WHERE c.state = -5' . (!FLEXI_J16GE ? ' AND c.sectionid = ' . (int) FLEXI_SECTION : '') . ($allitems ? '' : ' AND c.created_by = ' . $user->id) . ' ORDER BY c.created DESC';
$query = $query_select_ids . $query_from_join . $query_where_orderby_having;
$this->_db->SetQuery($query, 0, 5);
$ids = FLEXI_J16GE ? $this->_db->loadColumn() : $this->_db->loadResultArray();
$genstats = array();
if (!empty($ids)) {
$query = $query_select_data . $query_from_join . ' WHERE c.id IN (' . implode(',', $ids) . ')';
$this->_db->SetQuery($query, 0, 5);
$genstats = $this->_db->loadObjectList();
}
return $genstats;
}
示例7: setToolbar
/**
* Method to configure the toolbar for this view.
*
* @access public
* @return void
*/
function setToolbar()
{
$document = JFactory::getDocument();
$js = "jQuery(document).ready(function(){";
$toolbar = JToolBar::getInstance('toolbar');
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', false);
JHtml::_('behavior.modal', '#toolbar-basicindex a.toolbar, #toolbar-basicindex button');
} else {
$toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240);
}
JToolBarHelper::divider();
JToolBarHelper::spacer();
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', false);
JHtml::_('behavior.modal', '#toolbar-advindex a.toolbar, #toolbar-advindex button');
} else {
$toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240);
}
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false);
JHtml::_('behavior.modal', '#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button');
} else {
$toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240);
}
$toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false);
$user = JFactory::getUser();
$perms = FlexicontentHelperPerm::getPerm();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$js .= "});";
$document->addScriptDeclaration($js);
}
示例8: _getItemPerms
/**
* Calculates the user permission on the given item
*
* @since 1.0
*/
function _getItemPerms(&$item)
{
$user = JFactory::getUser();
// get current user
$permission = FlexicontentHelperPerm::getPerm();
// get global perms
$model = $this->getModel();
$perms = array();
$perms['isSuperAdmin'] = $permission->SuperAdmin;
$perms['multicat'] = $permission->MultiCat;
$perms['cantags'] = $permission->CanUseTags;
$perms['canparams'] = $permission->CanParams;
$perms['cantemplates'] = $permission->CanTemplates;
$perms['canarchive'] = $permission->CanArchives;
$perms['canright'] = $permission->CanRights;
$perms['canacclvl'] = $permission->CanAccLvl;
$perms['canversion'] = $permission->CanVersion;
$perms['editcreationdate'] = $permission->EditCreationDate;
// Get general edit/publish/delete permissions (we will override these for existing items)
$perms['canedit'] = $permission->CanEdit || $permission->CanEditOwn;
$perms['canpublish'] = $permission->CanPublish || $permission->CanPublishOwn;
$perms['candelete'] = $permission->CanDelete || $permission->CanDeleteOwn;
$perms['canchange_cat'] = $permission->CanChangeCat;
$perms['canchange_seccat'] = $permission->CanChangeSecCat;
$perms['canchange_featcat'] = $permission->CanChangeFeatCat;
// OVERRIDE global with existing item's atomic settings
if ($model->get('id')) {
// the following include the "owned" checks too
$itemAccess = $model->getItemAccess();
$perms['canedit'] = $itemAccess->get('access-edit');
// includes temporary editable via session's 'rendered_uneditable'
$perms['canpublish'] = $itemAccess->get('access-edit-state');
// includes (frontend) check (and allows) if user is editing via a coupon and has 'edit.state.own'
$perms['candelete'] = $itemAccess->get('access-delete');
}
// Get can change categories ACL access
$type = $this->get('Typesselected');
if ($type->id) {
$perms['canchange_cat'] = $user->authorise('flexicontent.change.cat', 'com_flexicontent.type.' . $type->id);
$perms['canchange_seccat'] = $user->authorise('flexicontent.change.cat.sec', 'com_flexicontent.type.' . $type->id);
$perms['canchange_featcat'] = $user->authorise('flexicontent.change.cat.feat', 'com_flexicontent.type.' . $type->id);
}
return $perms;
}
示例9: allowAdd
/**
* Method to check if you can add a new record.
*
* Extended classes can override this if necessary.
*
* @param array An array of input data.
*
* @return boolean
* @since 1.6
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
if (!FLEXI_J16GE || $user->authorise('core.create', $this->extension)) {
$cancreate_cat = true;
} else {
$usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed = array('core.create'), $require_all = true, $check_published = true, $specific_catids = false, $find_first = true);
$cancreate_cat = count($usercats) > 0;
}
return $cancreate_cat;
}
示例10: setToolbar
/**
* Method to configure the toolbar for this view.
*
* @access public
* @return void
*/
function setToolbar()
{
$document = JFactory::getDocument();
$js = "jQuery(document).ready(function(){";
$toolbar = JToolBar::getInstance('toolbar');
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_REINDEX_BASIC_CONTENT_LISTS', false);
} else {
$toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240);
}
JToolBarHelper::divider();
JToolBarHelper::spacer();
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW', false);
} else {
$toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240);
}
$btn_task = '';
$popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick';
if (FLEXI_J30GE || !FLEXI_J16GE) {
// Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually
$js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t";
JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false);
} else {
$toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240);
}
$toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false);
$user = JFactory::getUser();
$perms = FlexicontentHelperPerm::getPerm();
if ($perms->CanConfig) {
JToolBarHelper::divider();
JToolBarHelper::spacer();
$session = JFactory::getSession();
$fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent');
$_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940;
$fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent');
$_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550;
JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration');
}
$js .= "});";
$document->addScriptDeclaration($js);
}
示例11: saveorder
/**
* Logic to mass ordering fields
*
* @access public
* @return void
* @since 1.0
*/
function saveorder()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// Get variables: model, user, field id, new ordering
$model = $this->getModel('fields');
$user = JFactory::getUser();
$cid = JRequest::getVar('cid', array(0), 'default', 'array');
$order = JRequest::getVar('order', array(0), 'post', 'array');
// calculate access
if (FLEXI_J16GE) {
$is_authorised = $user->authorise('flexicontent.orderfields', 'com_flexicontent');
} else {
if (FLEXI_ACCESS && $user->gid < 25) {
$perms = FlexicontentHelperPerm::getPerm();
$is_authorised = $perms->CanFields;
// For FLEXIAccess consider MANAGE privilege as REORDER Field privilege
} else {
// Only admin or super admin can reorder fields
$is_authorised = $user->gid >= 24;
}
}
// check access
if (!$is_authorised) {
JError::raiseWarning(403, JText::_('FLEXI_ALERTNOTAUTH'));
} else {
if (!$model->saveorder($cid, $order)) {
$msg = JText::_('FLEXI_OPERATION_FAILED');
JError::raiseWarning(500, $model->getError());
} else {
$msg = JText::_('FLEXI_NEW_ORDERING_SAVED');
}
}
$this->setRedirect('index.php?option=com_flexicontent&view=fields', $msg);
}
示例12: display
//.........这里部分代码省略.........
$_attribs = ' class="use_select2_lib fc_skip_highlight" ';
if ($row->iscore == 1) {
$_attribs .= ' disabled="disabled" ';
} else {
$_field_id = 'jform_field_type';
$_row_id = $form->getValue("id");
$_ctrl_task = 'task=fields.getfieldspecificproperties';
$document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
}
//build field select list
$fieldtypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = true);
$fftypes = array();
foreach ($fieldtypes as $field_group => $ft_types) {
$fftypes[] = $field_group;
foreach ($ft_types as $field_type => $ftdata) {
$fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly);
}
$fftypes[] = '';
}
$lists['field_type'] = flexicontent_html::buildfieldtypeslist($fftypes, 'jform[field_type]', $row->field_type, $_grouped ? 1 : 0, $_attribs);
//build type select list
$attribs = 'class="use_select2_lib" multiple="multiple" size="6"';
$attribs .= $row->iscore ? ' disabled="disabled"' : '';
$types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]';
$lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs);
// **************************************************************************
// Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields)
// **************************************************************************
if (!FLEXI_J16GE) {
//build formhidden selector
$formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO'));
$formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND'));
$formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND'));
$formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH'));
$formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden';
$lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden);
if (FLEXI_ACCESS) {
$valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR'));
$valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION'));
$valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable';
$lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable);
}
$edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE'));
$edithelp[] = JHTML::_('select.option', 1, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP'));
$edithelp[] = JHTML::_('select.option', 2, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP_WICON'));
$edithelp[] = JHTML::_('select.option', 3, JText::_('FLEXI_EDIT_HELP_INLINE'));
$edithelp_fieldname = FLEXI_J16GE ? 'jform[edithelp]' : 'edithelp';
$lists['edithelp'] = JHTML::_('select.radiolist', $edithelp, $edithelp_fieldname, '', 'value', 'text', $row->edithelp);
// build the html select list for ordering
$query = 'SELECT ordering AS value, label AS text' . ' FROM #__flexicontent_fields' . ' WHERE published >= 0' . ' ORDER BY ordering';
$row->ordering = @$row->ordering;
$lists['ordering'] = $row->id ? JHTML::_('list.specificordering', $row, $row->id, $query) : JHTML::_('list.specificordering', $row, '', $query);
//build access level list
if (FLEXI_ACCESS) {
$lang = JFactory::getLanguage();
$lang->_strings['FLEXIACCESS_PADD'] = 'Edit-Value';
$lists['access'] = FAccess::TabGmaccess($row, 'field', 1, 1, 0, 1, 0, 1, 0, 1, 1);
} else {
$lists['access'] = JHTML::_('list.accesslevel', $row);
}
}
if (!FLEXI_J16GE) {
// Create the parameter 's form object parsing the file XML
$pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $row->field_type . '.xml';
if (JFile::exists($pluginpath)) {
$form = new JParameter('', $pluginpath);
} else {
$form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml');
}
// Special and Core Groups
$form->loadINI($row->attribs);
}
// fail if checked out not by 'me'
if ($row->id) {
if ($model->isCheckedOut($user->get('id'))) {
JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
$app->redirect('index.php?option=com_flexicontent&view=fields');
}
}
//clean data
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES);
// assign permissions for J2.5
$permission = FlexicontentHelperPerm::getPerm();
$this->assignRef('permission', $permission);
//assign data to template
$this->assignRef('document', $document);
$this->assignRef('row', $row);
$this->assignRef('lists', $lists);
$this->assignRef('form', $form);
$this->assignRef('typesselected', $typesselected);
$this->assignRef('supportsearch', $supportsearch);
$this->assignRef('supportadvsearch', $supportadvsearch);
$this->assignRef('supportfilter', $supportfilter);
$this->assignRef('supportadvfilter', $supportadvfilter);
$this->assignRef('supportuntranslatable', $supportuntranslatable);
$this->assignRef('supportvalueseditable', $supportvalueseditable);
$this->assignRef('supportformhidden', $supportformhidden);
$this->assignRef('supportedithelp', $supportedithelp);
parent::display($tpl);
}
示例13: remove
/**
* Logic to delete categories
*
* @access public
* @return void
* @since 1.0
*/
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$user = JFactory::getUser();
if (FLEXI_J16GE) {
$perms = FlexicontentHelperPerm::getPerm();
$CanCats = $perms->CanCats;
} else {
if (FLEXI_ACCESS) {
$CanCats = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'categories', 'users', $user->gmid) : 1;
} else {
$CanCats = 1;
}
}
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$msg = '';
if (!is_array($cid) || count($cid) < 1) {
// no category selected
JError::raiseWarning(500, JText::_('FLEXI_SELECT_ITEM_DELETE'));
} else {
if (!$CanCats) {
// no access rights
JError::raiseWarning(500, JText::_('FLEXI_ALERTNOTAUTH_TASK'));
} else {
// try to delete the category and clean cache
$model = $this->getModel('categories');
$msg = $model->delete($cid);
if (!$msg) {
JError::raiseWarning(500, $model->getError());
$this->setRedirect('index.php?option=com_flexicontent&view=categories', $msg);
return;
}
// clean cache
$cache = JFactory::getCache('com_flexicontent');
$cache->clean();
$catscache = JFactory::getCache('com_flexicontent_cats');
$catscache->clean();
}
}
// redirect to categories management tab
$this->setRedirect('index.php?option=com_flexicontent&view=categories', $msg);
}
示例14: gettags
/**
* Method to fetch the tags form, this is currently NOT USED
*
* @since 1.5
*/
function gettags()
{
$id = JRequest::getInt('id', 0);
$model = $this->getModel('item');
$tags = $model->gettags();
$user = JFactory::getUser();
$used = null;
if ($id) {
$used = $model->getUsedtagsIds($id);
}
if (!is_array($used)) {
$used = array();
}
$permission = FlexicontentHelperPerm::getPerm();
$CanCreateTags = $permission->CanCreateTags;
$CanUseTags = $permission->CanUseTags;
$CanUseTags = $CanUseTags ? '' : ' disabled="disabled"';
$n = count($tags);
$rsp = '';
if ($n > 0) {
$rsp .= '<div class="qf_tagbox" id="qf_tagbox">';
$rsp .= '<ul id="ultagbox">';
for ($i = 0, $n; $i < $n; $i++) {
$tag = $tags[$i];
if (!in_array($tag->id, $used)) {
continue;
}
// tag not assigned to item
if ($CanUseTags && in_array($tag->id, $used)) {
$rsp .= '
<li class="tagitem">
<span>' . $tag->name . '</span>
<input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" />
<a href="javascript:;" class="deletetag" onclick="javascript:deleteTag(this);" title="' . JText::_('FLEXI_DELETE_TAG') . '"></a>
</li>';
} else {
$rsp .= '
<li class="tagitem plain">
<span>' . $tag->name . '</span>
<input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" />
</li>';
}
}
$rsp .= '</ul>';
$rsp .= '</div>';
$rsp .= '<div class="clear"></div>';
}
if ($CanCreateTags) {
$rsp .= '
<div class="qf_addtag">
<label for="addtags">' . JText::_('FLEXI_ADD_TAG') . '</label>
<input type="text" id="tagname" class="inputbox" size="30" />
<input type="button" class="fc_button" value="' . JText::_('FLEXI_ADD') . '" onclick="addtag()" />
</div>';
}
echo $rsp;
}
示例15: buildcatselect
/**
* Build a html select form field that displays a Category Tree
*
* The output is filtered (via FLEXIaccess or via J1.6+ permission) and has disabled specific categories
* About Disabled categories:
* - currently edited category is disabled
* - if the user can view all categories then categories he has no permission are disabled !!!
*
* @param array $list
* @param string $name
* @param array $selected
* @param bool $top
* @param string $check_published
* @param string $check_perms
* @param string $require_all
* @param array $skip_subtrees
* @param array $disable_subtrees
* @param array $custom_options
*
* @return a category form field element
*/
public static function buildcatselect($list, $name, $selected, $top, $attribs = 'class="inputbox"', $check_published = false, $check_perms = true, $actions_allowed = array('core.create', 'core.edit', 'core.edit.own'), $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disable_specific_cats = array(), $empty_errmsg = false)
{
// ***************************
// Initialize needed variables
// ***************************
global $globalcats;
$cparams = JComponentHelper::getParams('com_flexicontent');
$user = JFactory::getUser();
$controller = JRequest::getVar('controller');
$task = JRequest::getVar('task');
$print_logging_info = $cparams->get('print_logging_info');
if ($print_logging_info) {
global $fc_run_times;
$start_microtime = microtime(true);
}
// Privilege of (a) viewing all categories (even if disabled) and (b) viewing as a tree
require_once JPATH_ROOT . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php';
$viewallcats = FlexicontentHelperPerm::getPerm()->ViewAllCats;
$viewtree = FlexicontentHelperPerm::getPerm()->ViewTree;
// Global parameter to force always displaying of categories as tree
if ($cparams->get('cats_always_astree', 1)) {
$viewtree = 1;
}
// **************************************************************
// Find user allowed categories to be used during Filtering below
// **************************************************************
if ($check_perms) {
// Get user allowed categories, NOTE: if user (a) (J2.5) has 'core.admin' or (b) (J1.5) user is super admin (gid==25) then all cats are allowed
$usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed, $require_all, $check_published);
// NOTE: already selected categories will be allowed to the user, add them to the category list
$selectedcats = !is_array($selected) ? array($selected) : $selected;
$usercats_indexed = array_flip($usercats);
foreach ($selectedcats as $selectedcat) {
if ($selectedcat) {
$usercats_indexed[$selectedcat] = 1;
}
}
}
// *********************************************************************************
// Excluded subtrees e.g. featured categories subtree in item form
// Disabled subtrees e.g. existing children subtree when selecting category's parent
// *********************************************************************************
$skip_cats_arr = array();
if (!empty($skip_subtrees)) {
foreach ($skip_subtrees as $subtree_rootid) {
if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) {
foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) {
$skip_cats_arr[$_excluded] = 1;
}
}
}
}
$disable_cats_arr = array();
if (!empty($disable_subtrees)) {
foreach ($disable_subtrees as $subtree_rootid) {
if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) {
foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) {
$disable_cats_arr[$_excluded] = 1;
}
}
}
}
// Disable specific categories
if (!empty($disable_specific_cats)) {
foreach ($disable_specific_cats as $_excluded) {
$disable_cats_arr[$_excluded] = 1;
}
}
// **************************************************************************
// TOP parameter: defines the APPROPRIATE PROMPT option at top of select list
// **************************************************************************
$cats_count = 0;
$catlist = array();
// A tree to select: e.g. a parent category
if (!is_numeric($top) && strlen($top)) {
$catlist[] = JHTML::_('select.option', '', $top);
} else {
if ($top == 1) {
$catlist[] = JHTML::_('select.option', FLEXI_J16GE ? 1 : 0, JText::_('FLEXI_TOPLEVEL'));
//.........这里部分代码省略.........