/** * 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); }
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); }
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); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); // Get data from the model $genstats = $this->get('Generalstats'); $popular = $this->get('Popular'); $rating = $this->get('Rating'); $worstrating = $this->get('WorstRating'); $favoured = $this->get('Favoured'); $statestats = $this->get('Statestats'); $votesstats = $this->get('Votesstats'); $creators = $this->get('Creators'); $editors = $this->get('Editors'); // ************************************************** New data*********************************************************************************************************************// $itemsgraph = $this->get('Itemsgraph'); $unpopular = $this->get('Unpopular'); $totalitemspublish = $this->get('Itemspublish'); $totalitemsunpublish = $this->get('Itemsunpublish'); $totalitemswaiting = $this->get('Itemswaiting'); $totalitemsprogress = $this->get('Itemsprogress'); $metadescription = $this->get('Itemsmetadescription'); $metakeywords = $this->get('Itemsmetakeywords'); // ************************************************** New data*********************************************************************************************************************// // ************************** // 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'); } } //*****************************************************************Adicionar as biblitecas*******************************************************************************************// $document->addStyleSheet('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css'); $document->addScript(JURI::root(true) . '/components/com_flexicontent/librairies/esl/esl.js'); //*****************************************************************Adicionar as biblitecas*******************************************************************************************// // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanStats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_STATISTICS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'stats'); $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'); } //Load pane behavior if (!FLEXI_J16GE) { jimport('joomla.html.pane'); $pane = JPane::getInstance('Tabs'); $this->assignRef('pane', $pane); } $this->assignRef('genstats', $genstats); $this->assignRef('popular', $popular); $this->assignRef('rating', $rating); $this->assignRef('worstrating', $worstrating); $this->assignRef('favoured', $favoured); $this->assignRef('statestats', $statestats); $this->assignRef('votesstats', $votesstats); $this->assignRef('creators', $creators); $this->assignRef('editors', $editors); // ************************************************** New data*********************************************************************************************************************// $this->assignRef('itemsgraph', $itemsgraph); $this->assignRef('unpopular', $unpopular); $this->assignRef('totalitemspublish', $totalitemspublish); $this->assignRef('totalitemsunpublish', $totalitemsunpublish); $this->assignRef('totalitemswaiting', $totalitemswaiting); $this->assignRef('totalitemsprogress', $totalitemsprogress); $this->assignRef('metadescription', $metadescription); $this->assignRef('metakeywords', $metakeywords); // ************************************************** New data*********************************************************************************************************************// $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { // *********** // Batch tasks // *********** $app = JFactory::getApplication(); $jinput = $app->input; $task = $jinput->get('task', '', 'cmd'); $cid = $jinput->get('cid', array(), 'array'); if ($task == 'copy') { $behaviour = $jinput->get('copy_behaviour', 'copy/move', 'string'); $this->setLayout('copy'); $this->_displayCopyMove($tpl, $cid, $behaviour); return; } // ******************** // Initialise variables // ******************** global $globalcats; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $session = JFactory::getSession(); $bind_limit = $jinput->get('bind_limit', 1000, 'int'); // Some flags $enable_translation_groups = flexicontent_db::useAssociations(); //$cparams->get("enable_translation_groups"); $print_logging_info = $cparams->get('print_logging_info'); // Get model $model = $this->getModel(); // *********** // Get filters // *********** $count_filters = 0; // File id filtering $fileid_to_itemids = $session->get('fileid_to_itemids', array(), 'flexicontent'); $filter_fileid = $model->getState('filter_fileid'); if ($filter_fileid) { $count_filters++; } // Order type, order, order direction $filter_order_type = $model->getState('filter_order_type'); $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // Category filtering $filter_cats = $model->getState('filter_cats'); $filter_subcats = $model->getState('filter_subcats'); $filter_catsinstate = $model->getState('filter_catsinstate'); if ($filter_cats) { $count_filters++; } if ($filter_subcats != 1) { $count_filters++; } if ($filter_catsinstate != 1) { $count_filters++; } // Other filters $filter_tag = $model->getState('filter_tag'); $filter_lang = $model->getState('filter_lang'); $filter_type = $model->getState('filter_type'); $filter_author = $model->getState('filter_author'); $filter_state = $model->getState('filter_state'); $filter_access = $model->getState('filter_access'); // Support for using 'ALL', 'ORPHAN' fake states, by clearing other values if (is_array($filter_state) && in_array('ALL', $filter_state)) { $filter_state = array('ALL'); } if (is_array($filter_state) && in_array('ORPHAN', $filter_state)) { $filter_state = array('ORPHAN'); } // Count active filters if ($filter_tag) { $count_filters++; } if ($filter_lang) { $count_filters++; } if ($filter_type) { $count_filters++; } if ($filter_author) { $count_filters++; } if ($filter_state) { $count_filters++; } if ($filter_access) { $count_filters++; } // Date filters $date = $model->getState('date'); $startdate = $model->getState('startdate'); $enddate = $model->getState('enddate'); $startdate = $db->escape(trim(JString::strtolower($startdate))); $enddate = $db->escape(trim(JString::strtolower($enddate))); if ($startdate) { $count_filters++; } if ($enddate) { $count_filters++; } // Item ID filter $filter_id = $model->getState('filter_id'); if ($filter_id) { $count_filters++; } // Text search $scope = $model->getState('scope'); $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.calendar'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION); $js = "jQuery(document).ready(function(){"; if ($filter_cats) { $js .= "jQuery('.col_cats').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_type) { $js .= "jQuery('.col_type').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_author) { $js .= "jQuery('.col_authors').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_state) { $js .= "jQuery('.col_state').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_lang) { $js .= "jQuery('.col_lang').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_access) { $js .= "jQuery('.col_access').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_tag) { $js .= "jQuery('.col_tag').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_id) { $js .= "jQuery('.col_id').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($startdate || $enddate) { if ($date == 1) { $js .= "jQuery('.col_created').each(function(){ jQuery(this).addClass('yellow'); });"; } else { if ($date == 2) { $js .= "jQuery('.col_revised').each(function(){ jQuery(this).addClass('yellow'); });"; } } } if (strlen($search)) { $js .= "jQuery('.col_title').each(function(){ jQuery(this).addClass('yellow'); });"; } // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); $CanEdit = $perms->CanEdit; $CanPublish = $perms->CanPublish; $CanDelete = $perms->CanDelete; $CanEditOwn = $perms->CanEditOwn; $CanPublishOwn = $perms->CanPublishOwn; $CanDeleteOwn = $perms->CanDeleteOwn; $hasEdit = $CanEdit || $CanEditOwn; $hasPublish = $CanPublish || $CanPublishOwn; $hasDelete = $CanDelete || $CanDeleteOwn; $CanCats = $perms->CanCats; $CanAccLvl = $perms->CanAccLvl; $CanOrder = $perms->CanOrder; $CanCopy = $perms->CanCopy; $CanArchives = $perms->CanArchives; // Check if user can create in at least one published category require_once "components/com_flexicontent/models/item.php"; $itemmodel = new FlexicontentModelItem(); $CanAdd = $itemmodel->getItemAccess()->get('access-create'); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('notvariable'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_ITEMS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'items'); $document->setTitle($doc_title . ' - ' . $site_title); $toolbar = JToolBar::getInstance('toolbar'); // Implementation of multiple-item state selector $add_divider = false; if ($hasPublish) { $btn_task = ''; $ctrl_task = '&task=items.selectstate'; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent' . $ctrl_task . '&format=raw'; 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\t\tjQuery('#toolbar-publish a.toolbar, #toolbar-publish button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 240}, onClose: function() {}}');\n\t\t\t\t"; //JToolBarHelper::publishList( $btn_task ); JToolBarHelper::custom($btn_task, 'publish.png', 'publish_f2.png', 'FLEXI_CHANGE_STATE', false); JHtml::_('behavior.modal', '#toolbar-publish a.toolbar, #toolbar-publish button'); } else { $toolbar->appendButton('Popup', 'publish', JText::_('FLEXI_CHANGE_STATE'), str_replace('&', '&', $popup_load_url), 800, 240); } $add_divider = true; } if ($hasDelete) { if ($filter_state && in_array('T', $filter_state)) { //$btn_msg = JText::_('FLEXI_ARE_YOU_SURE'); //$btn_task = 'items.remove'; //JToolBarHelper::deleteList($btn_msg, $btn_task); $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ARE_YOU_SURE'); $btn_task = 'items.remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning"); } else { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_TRASH')); $msg_confirm = JText::_('FLEXI_TRASH_CONFIRM') . ' ' . JText::_('FLEXI_NOTES') . ': ' . JText::_('FLEXI_DELETE_PERMANENTLY'); $btn_task = 'items.changestate'; $extra_js = "document.adminForm.newstate.value='T';"; flexicontent_html::addToolBarButton('FLEXI_TRASH', 'trash', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true, $btn_class = ""); } $add_divider = true; } if ($CanArchives && (!$filter_state || !in_array('A', $filter_state))) { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_ARCHIVE')); $msg_confirm = JText::_('FLEXI_ARCHIVE_CONFIRM'); $btn_task = 'items.changestate'; $extra_js = "document.adminForm.newstate.value='A';"; flexicontent_html::addToolBarButton('FLEXI_ARCHIVE', 'archive', $full_js = '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $add_divider = true; } if ($CanArchives && $filter_state && in_array('A', $filter_state) || $hasDelete && $filter_state && in_array('T', $filter_state)) { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_RESTORE')); $msg_confirm = JText::_('FLEXI_RESTORE_CONFIRM'); $btn_task = 'items.changestate'; $extra_js = "document.adminForm.newstate.value='P';"; flexicontent_html::addToolBarButton('FLEXI_RESTORE', 'restore', $full_js = '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if ($CanAdd) { $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=types&format=raw'; 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\t\tjQuery('#toolbar-new a.toolbar, #toolbar-new button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 240}, onClose: function() {}}');\n\t\t\t\t"; //JToolBarHelper::addNew( $btn_task ); JToolBarHelper::custom($btn_task, 'new.png', 'new_f2.png', 'FLEXI_NEW', false); JHtml::_('behavior.modal', '#toolbar-new a.toolbar, #toolbar-new button'); } else { $toolbar->appendButton('Popup', 'new', JText::_('FLEXI_NEW'), str_replace('&', '&', $popup_load_url), 800, 240); } $add_divider = true; } if ($hasEdit) { $btn_task = 'items.edit'; JToolBarHelper::editList($btn_task); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if ($CanAdd && $CanCopy) { $btn_task = 'items.copy'; JToolBarHelper::custom($btn_task, 'copy.png', 'copy_f2.png', 'FLEXI_BATCH'); if ($enable_translation_groups) { JToolBarHelper::custom('translate', 'translate', 'translate', 'FLEXI_TRANSLATE'); } $add_divider = true; } $btn_task = 'items.checkin'; JToolbarHelper::checkin($btn_task); if ($add_divider) { JToolBarHelper::divider(); JToolBarHelper::spacer(); } if ($perms->CanConfig) { $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); // *********************** // Get data from the model // *********************** $badcatitems = (int) $model->getUnboundedItems($limit = 10000000, $count_only = true, $checkNoExtData = false, $checkInvalidCat = true); $unassociated = (int) $model->getUnboundedItems($limit = 10000000, $count_only = true, $checkNoExtData = true, $checkInvalidCat = false); $rows = $this->get('Data'); $pagination = $this->get('Pagination'); $types = $this->get('Typeslist'); $authors = $this->get('Authorslist'); // these depend on data rows and must be called after getting data $extraCols = $this->get('ExtraCols'); $customFilts = $this->get('CustomFilts'); foreach ($customFilts as $filter) { if (count($filter->value)) { $count_filters++; } } $itemCats = $this->get('ItemCats'); $itemTags = $this->get('ItemTags'); if ($enable_translation_groups) { $langAssocs = $this->get('LangAssocs'); } $langs = FLEXIUtilities::getLanguages('code'); $categories = $globalcats ? $globalcats : array(); $limit = $pagination->limit; $inline_ss_max = 500; $drag_reorder_max = 150; if ($limit > $drag_reorder_max) { $cparams->set('draggable_reordering', 0); } // ****************************************** // Add usability notices if these are enabled // ****************************************** if ($cparams->get('show_usability_messages', 1) && !$unassociated && !$badcatitems) { $notice_iss_disabled = $app->getUserStateFromRequest($option . '.items.notice_iss_disabled', 'notice_iss_disabled', 0, 'int'); if (!$notice_iss_disabled && $limit > $inline_ss_max) { $app->setUserState($option . '.items.notice_iss_disabled', 1); $app->enqueueMessage(JText::sprintf('FLEXI_INLINE_ITEM_STATE_SELECTOR_DISABLED', $inline_ss_max), 'notice'); $show_turn_off_notice = 1; } $notice_drag_reorder_disabled = $app->getUserStateFromRequest($option . '.items.notice_drag_reorder_disabled', 'notice_drag_reorder_disabled', 0, 'int'); if (!$notice_drag_reorder_disabled && $limit > $drag_reorder_max) { $app->setUserState($option . '.items.notice_drag_reorder_disabled', 1); $app->enqueueMessage(JText::sprintf('FLEXI_DRAG_REORDER_DISABLED', $drag_reorder_max), 'notice'); $show_turn_off_notice = 1; } $notice_add_custom_columns = $app->getUserStateFromRequest($option . '.items.notice_add_custom_columns', 'notice_add_custom_columns', 0, 'int'); if (!$notice_add_custom_columns) { $app->setUserState($option . '.items.notice_add_custom_columns', 1); $app->enqueueMessage(JText::_('FLEXI_YOU_MAY_CONFIGURE_CUSTOM_COLUMNS_GLOBAL_AND_PER_TYPE'), 'message'); $show_turn_off_notice = 1; } if (!empty($show_turn_off_notice)) { $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } // ******************* // Create Filters HTML // ******************* // filter publication state $states = array(); //$states[] = JHTML::_('select.option', '', '-'/*JText::_( 'FLEXI_SELECT_STATE' )*/ ); $states[] = JHTML::_('select.optgroup', JText::_('FLEXI_SINGLE_STATUS')); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); $states[] = JHTML::_('select.option', 'PE', JText::_('FLEXI_PENDING')); $states[] = JHTML::_('select.option', 'OQ', JText::_('FLEXI_TO_WRITE')); $states[] = JHTML::_('select.option', 'IP', JText::_('FLEXI_IN_PROGRESS')); $states[] = JHTML::_('select.option', 'RV', JText::_('FLEXI_REVISED_VER')); $states[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ARCHIVED')); $states[] = JHTML::_('select.option', 'T', JText::_('FLEXI_TRASHED')); $states[] = JHTML::_('select.optgroup', ''); $states[] = JHTML::_('select.optgroup', JText::_('FLEXI_STATUS_GROUPS')); $states[] = JHTML::_('select.option', 'ALL', JText::_('FLEXI_GRP_ALL') . ' ' . JText::_('FLEXI_STATE_S')); $states[] = JHTML::_('select.option', 'ALL_P', JText::_('FLEXI_GRP_PUBLISHED') . ' ' . JText::_('FLEXI_STATE_S')); $states[] = JHTML::_('select.option', 'ALL_U', JText::_('FLEXI_GRP_UNPUBLISHED') . ' ' . JText::_('FLEXI_STATE_S')); $states[] = JHTML::_('select.option', 'ORPHAN', JText::_('FLEXI_GRP_ORPHAN')); $states[] = JHTML::_('select.optgroup', ''); $lists['filter_state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $states, 'filter_state[]', 'class="use_select2_lib fcfilter_be" multiple="multiple" size="3" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_state); //JHTML::_('grid.state', $filter_state ); // build filter state group if ($hasDelete || $CanArchives) { //$stategroups[''] = JText::_( 'FLEXI_GRP_NORMAL' ) .' '. JText::_( 'FLEXI_STATE_S' ); //$stategroups['published'] = JText::_( 'FLEXI_GRP_PUBLISHED' ) .' '. JText::_( 'FLEXI_STATE_S' ); //$stategroups['unpublished'] = JText::_( 'FLEXI_GRP_UNPUBLISHED' ) .' '. JText::_( 'FLEXI_STATE_S' ); /*if ($hasDelete) $stategroups['trashed'] = JText::_( 'FLEXI_GRP_TRASHED' );*/ /*if ($CanArchives) $stategroups['archived'] = JText::_( 'FLEXI_GRP_ARCHIVED' );*/ //$stategroups['orphan'] = JText::_( 'FLEXI_GRP_ORPHAN' ); //$stategroups['all'] = JText::_( 'FLEXI_GRP_ALL' ); /*$_stategroups = array(); foreach ($stategroups as $i => $v) { $_stategroups[] = JHTML::_('select.option', $i, $v); } $lists['filter_stategrp'] = JHTML::_('select.radiolist', $_stategroups, 'filter_stategrp', 'size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_stategrp );*/ /*$lists['filter_stategrp'] = ''; foreach ($stategroups as $i => $v) { $checked = $filter_stategrp == $i ? ' checked="checked" ' : ''; $lists['filter_stategrp'] .= '<input type="radio" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" class="inputbox" '.$checked.' value="'.$i.'" id="filter_stategrp'.$i.'" name="filter_stategrp" />'; $lists['filter_stategrp'] .= '<label class="" id="filter_stategrp'.$i.'-lbl" for="filter_stategrp'.$i.'">'.$v.'</label>'; }*/ } // build the include subcats boolean list // build the include non-published cats boolean list if ($filter_order_type && $filter_cats && ($filter_order == 'i.ordering' || $filter_order == 'catsordering')) { $ordering_tip = '<img src="components/com_flexicontent/assets/images/comment.png" class="hasTooltip" title="' . JText::_('FLEXI_SUBCATEGORIES_NOT_INCLUDED_DURING_CATORDER_DESC', true) . '" />'; $lists['filter_subcats'] = ' <span class="fc-mssg-inline fc-note"> ' . JText::_('FLEXI_SUBCATEGORIES_NOT_INCLUDED_DURING_CATORDER') . ' ' . $ordering_tip . ' </span>'; } else { //$lists['filter_subcats'] = JHTML::_('select.booleanlist', 'filter_subcats', 'class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_subcats ); $subcats = array(); $subcats[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO')); $subcats[] = JHTML::_('select.option', 1, JText::_('FLEXI_YES')); $lists['filter_subcats'] = JHTML::_('select.genericlist', $subcats, 'filter_subcats', 'size="1" class="use_select2_lib ' . ($filter_subcats != 1 ? '' : ' fc_skip_highlight') . '" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_subcats, 'filter_subcats'); } $lists['filter_subcats'] = ($filter_subcats || 1 ? '<label class="label">' . JText::_('FLEXI_SUBCATEGORIES') . '</label>' : '') . $lists['filter_subcats']; // build the include non-published cats boolean list $catsinstate[1] = JText::_('FLEXI_PUBLISHED'); $catsinstate[0] = JText::_('FLEXI_UNPUBLISHED'); $catsinstate[99] = JText::_('FLEXI_ANY'); $catsinstate[2] = JText::_('FLEXI_ARCHIVED_STATE'); $catsinstate[-2] = JText::_('FLEXI_TRASHED_STATE'); $_catsinstate = array(); foreach ($catsinstate as $i => $v) { $_catsinstate[] = JHTML::_('select.option', $i, $v); } $lists['filter_catsinstate'] = ($filter_catsinstate || 1 ? '<label class="label">' . JText::_('FLEXI_LIST_ITEMS_IN_CATS') . '</label>' : '') . JHTML::_('select.genericlist', $_catsinstate, 'filter_catsinstate', 'size="1" class="use_select2_lib' . ($filter_catsinstate != 1 ? '' : ' fc_skip_highlight') . '" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_catsinstate, 'filter_catsinstate'); //$lists['filter_catsinstate'] = JHTML::_('select.radiolist', $_catsinstate, 'filter_catsinstate', 'size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_catsinstate ); /*$lists['filter_catsinstate'] = ''; foreach ($catsinstate as $i => $v) { $checked = $filter_catsinstate == $i ? ' checked="checked" ' : ''; $lists['filter_catsinstate'] .= '<input type="radio" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" class="inputbox" '.$checked.' value="'.$i.'" id="filter_catsinstate'.$i.'" name="filter_catsinstate" />'; $lists['filter_catsinstate'] .= '<label class="" id="filter_catsinstate'.$i.'-lbl" for="filter_catsinstate'.$i.'">'.$v.'</label>'; }*/ // build the order type boolean list $order_types = array(); $order_types[] = JHTML::_('select.option', '0', 'FLEXI_ORDER_JOOMLA'); $order_types[] = JHTML::_('select.option', '1', 'FLEXI_ORDER_FLEXICONTENT'); //$lists['filter_order_type'] = JHTML::_('select.radiolist', $order_types, 'filter_order_type', 'size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_order_type ); $lists['filter_order_type'] = JHTML::_('select.genericlist', $order_types, 'filter_order_type', 'size="1" class="use_select2_lib fc_skip_highlight" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_order_type, 'filter_order_type', $translate = true); // build the categories select list for filter $lists['filter_cats'] = ($filter_cats || 1 ? '<label class="label">' . JText::_('FLEXI_CATEGORY') . '</label>' : '') . flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, '-', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $check_published = false, $check_perms = false); //build type select list $lists['filter_type'] = ($filter_type || 1 ? '<label class="label">' . JText::_('FLEXI_TYPE') . '</label>' : '') . flexicontent_html::buildtypesselect($types, 'filter_type[]', $filter_type, 0, 'class="use_select2_lib fcfilter_be" multiple="multiple" size="3" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'filter_type'); //build authors select list $lists['filter_author'] = ($filter_author || 1 ? '<label class="label">' . JText::_('FLEXI_AUTHOR') . '</label>' : '') . flexicontent_html::buildauthorsselect($authors, 'filter_author[]', $filter_author, 0, 'class="use_select2_lib fcfilter_be" multiple="multiple" size="3" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'); if ($badcatitems) { $lists['default_cat'] = flexicontent_cats::buildcatselect($categories, 'default_cat', '', 2, 'class="use_select2_lib"', false, false); } //search filter $scopes = array(); $scopes[1] = JText::_('FLEXI_TITLE'); $scopes[2] = JText::_('FLEXI_INTROTEXT'); $scopes[4] = JText::_('FLEXI_INDEXED_CONTENT'); $_scopes = array(); foreach ($scopes as $i => $v) { $_scopes[] = JHTML::_('select.option', $i, $v); } //$lists['scope'] = JHTML::_('select.radiolist', $_scopes, 'scope', 'size="1" class="inputbox"', 'value', 'text', $scope ); $lists['scope'] = JHTML::_('select.genericlist', $_scopes, 'scope', 'size="1" class="use_select2_lib fc_skip_highlight" onchange="jQuery(\'#search\').attr(\'placeholder\', jQuery(this).find(\'option:selected\').text());" title="' . JText::_('FLEXI_SEARCH_TEXT_INSIDE') . '"', 'value', 'text', $scope, 'scope'); /*$lists['scope'] = ''; foreach ($scopes as $i => $v) { $checked = $scope == $i ? ' checked="checked" ' : ''; $lists['scope'] .= '<input type="radio" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" class="inputbox" '.$checked.' value="'.$i.'" id="scope'.$i.'" name="scope" />'; $lists['scope'] .= '<label class="" id="scope'.$i.'-lbl" for="scope'.$i.'">'.$v.'</label>'; }*/ // build item dates option list $dates[1] = JText::_('FLEXI_CREATED'); $dates[2] = JText::_('FLEXI_REVISED'); $_dates = array(); foreach ($dates as $i => $v) { $_dates[] = JHTML::_('select.option', $i, $v); } //$lists['date'] = JHTML::_('select.radiolist', $_dates, 'date', 'size="1" class="inputbox"', 'value', 'text', $date ); $lists['date'] = '<label class="label">' . JText::_('FLEXI_DATE') . '</label>' . JHTML::_('select.genericlist', $_dates, 'date', 'size="1" class="use_select2_lib fc_skip_highlight"', 'value', 'text', $date, 'date'); /*$lists['date'] = ''; foreach ($dates as $i => $v) { $checked = $date == $i ? ' checked="checked" ' : ''; $lists['date'] .= '<input type="radio" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" class="inputbox" '.$checked.' value="'.$i.'" id="date'.$i.'" name="date" />'; $lists['date'] .= '<label class="" id="date'.$i.'-lbl" for="date'.$i.'">'.$v.'</label>'; }*/ $lists['startdate'] = JHTML::_('calendar', $startdate, 'startdate', 'startdate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '8', 'maxlength' => '19', 'style' => 'width:auto', 'placeholder' => JText::_('FLEXI_FROM'))); $lists['enddate'] = JHTML::_('calendar', $enddate, 'enddate', 'enddate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '8', 'maxlength' => '19', 'style' => 'width:auto', 'placeholder' => JText::_('FLEXI_TO'))); // search filter $bind_limits = array(); $bind_limits[] = JHTML::_('select.option', 250, '250 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 500, '500 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 750, '750 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 1000, '1000 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 1500, '1500 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 2000, '2000 ' . JText::_('FLEXI_ITEMS')); $lists['bind_limits'] = JHTML::_('select.genericlist', $bind_limits, 'bind_limit', 'size="1" class="use_select2_lib"', 'value', 'text', $bind_limit, 'bind_limit'); // search filter $lists['search'] = $search; // search id $lists['filter_id'] = $filter_id; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // filter ordering if (!$filter_order_type) { $ordering = $lists['order'] == 'i.ordering'; } else { $ordering = $lists['order'] == 'catsordering'; } //build tags filter $lists['filter_tag'] = ($filter_tag || 1 ? '<label class="label">' . JText::_('FLEXI_TAG') . '</label>' : '') . flexicontent_html::buildtagsselect('filter_tag[]', 'class="use_select2_lib fcfilter_be" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" multiple="multiple" size="3" ', $filter_tag, 0); //build languages filter $lists['filter_lang'] = ($filter_lang || 1 ? '<label class="label">' . JText::_('FLEXI_LANGUAGE') . '</label>' : '') . flexicontent_html::buildlanguageslist('filter_lang[]', 'class="use_select2_lib fcfilter_be" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" multiple="multiple" size="3" ', $filter_lang, 1); // build access level filter $access_levels = JHtml::_('access.assetgroups'); /*if ( $cparams->get('iman_viewable_items', 1) ) // only viewable items is enabled, skip the non available levels to avoid user confusion { $_aid_arr = array_flip(JAccess::getAuthorisedViewLevels($user->id)); $_levels = array(); foreach($access_levels as $i => $level) { if ( isset($_aid_arr[$level->value]) ) $_levels[] = $level; //else $access_levels[$i]->disable = 1; } $access_levels = $_levels; }*/ // Above code is maybe problematic (e.g. in multi-sites), need to test more //array_unshift($access_levels, JHtml::_('select.option', '', '-'/*'JOPTION_SELECT_ACCESS'*/) ); $fieldname = 'filter_access[]'; // make multivalue $elementid = 'filter_access'; $attribs = 'class="use_select2_lib fcfilter_be" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" multiple="multiple"'; $lists['filter_access'] = ($filter_access || 1 ? '<label class="label">' . JText::_('FLEXI_ACCESS') . '</label>' : '') . JHTML::_('select.genericlist', $access_levels, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // filter by item usage a specific file if ($fileid_to_itemids && count($fileid_to_itemids)) { $files_data = $model->getFileData(array_keys($fileid_to_itemids)); $file_options = array(); $file_options[] = JHTML::_('select.option', '', '-'); foreach ($files_data as $_file) { $file_options[] = JHTML::_('select.option', $_file->id, $_file->altname); } flexicontent_html::loadFramework('select2'); $lists['filter_fileid'] = ($filter_fileid || 1 ? '<label class="label">' . JText::_('FLEXI_ITEMS_USING') . ' ' . JText::_('FLEXI_FILE') . '</label>' : '') . JHTML::_('select.genericlist', $file_options, 'filter_fileid', 'size="1" class="use_select2_lib' . ($filter_fileid ? '' : ' fc_skip_highlight') . '" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_fileid); } //assign data to template $this->assignRef('CanTemplates', $perms->CanTemplates); $this->assignRef('count_filters', $count_filters); //$this->assignRef('filter_stategrp', $filter_stategrp); $this->assignRef('filter_catsinstate', $filter_catsinstate); $this->assignRef('db', $db); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('itemCats', $itemCats); $this->assignRef('itemTags', $itemTags); $this->assignRef('extra_fields', $extraCols); $this->assignRef('custom_filts', $customFilts); if ($enable_translation_groups) { $this->assignRef('lang_assocs', $langAssocs); } $this->assignRef('langs', $langs); $this->assignRef('cid', $cid); $this->assignRef('pagination', $pagination); $this->assignRef('ordering', $ordering); $this->assignRef('CanOrder', $CanOrder); $this->assignRef('CanCats', $CanCats); $this->assignRef('CanAccLvl', $CanAccLvl); $this->assignRef('unassociated', $unassociated); $this->assignRef('badcatitems', $badcatitems); // filters $this->assignRef('filter_id', $filter_id); $this->assignRef('filter_state', $filter_state); $this->assignRef('filter_author', $filter_author); $this->assignRef('filter_type', $filter_type); $this->assignRef('filter_cats', $filter_cats); $this->assignRef('filter_subcats', $filter_subcats); $this->assignRef('filter_catsinstate', $filter_catsinstate); $this->assignRef('filter_order_type', $filter_order_type); $this->assignRef('filter_order', $filter_order); $this->assignRef('filter_lang', $filter_lang); $this->assignRef('filter_access', $filter_access); $this->assignRef('filter_tag', $filter_tag); $this->assignRef('filter_fileid', $filter_fileid); $this->assignRef('inline_ss_max', $inline_ss_max); $this->assignRef('scope', $scope); $this->assignRef('search', $search); $this->assignRef('date', $date); $this->assignRef('startdate', $startdate); $this->assignRef('enddate', $enddate); $this->assignRef('option', $option); $this->assignRef('view', $view); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); if ($print_logging_info) { @($fc_run_times['template_render'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } }
function display($tpl = null) { //initialise variables $mainframe = JFactory::getApplication(); $option = JRequest::getVar('option'); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $user = JFactory::getUser(); FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); $use_jquery_sortable = true; //FLEXI_J16GE ? true : false; if ($use_jquery_sortable) { flexicontent_html::loadJQuery(); } else { // mootools sortable $document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/sortables.js'); } $type = JRequest::getVar('type', 'items', '', 'word'); $folder = JRequest::getVar('folder', 'default', '', 'cmd'); if (FLEXI_FISH || FLEXI_J16GE) { FLEXIUtilities::loadTemplateLanguageFile($folder); } //Get data from the model $layout = $this->get('Data'); $fields = $this->get('Fields'); $fbypos = $this->get('FieldsByPositions'); $used = $this->get('UsedFields'); $contentTypes = $this->get('ContentTypesList'); $fieldTypes = $this->get('FieldTypesList'); // Create CONTENT TYPE SELECTOR foreach ($fields as $field) { $field->type_ids = !empty($field->reltypes) ? explode(",", $field->reltypes) : array(); } $options = array(); $options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL')); foreach ($contentTypes as $contentType) { $options[] = JHTML::_('select.option', $contentType->id, JText::_($contentType->name)); } $fieldname = $elementid = 'content_type__au__'; $attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="fcfield_selectval" '; $content_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid); // Create FIELD TYPE SELECTOR $options = array(); $options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL')); foreach ($fieldTypes as $fieldType) { $options[] = JHTML::_('select.option', $fieldType->type_name, $fieldType->field_name); } $fieldname = $elementid = 'field_type__au__'; $attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="fcfield_selectval" '; $field_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid); if (isset($layout->positions)) { $sort = array(); $jssort = array(); $idsort = array(); $sort[0] = 'sortablecorefields'; $sort[1] = 'sortableuserfields'; $i = 2; $count = -1; foreach ($layout->positions as $pos) { $count++; if (isset($layout->attributes[$count]) && isset($layout->attributes[$count]['readonly'])) { continue; } $sort[$i] = 'sortable-' . $pos; $idsort[$i] = $pos; $i++; } foreach ($idsort as $k => $v) { if ($k > 1) { $jssort[] = $use_jquery_sortable ? 'storeordering(jQuery("#sortable-' . $v . '"))' : 'results(' . $k . ',\'' . $v . '\')'; } } $positions = implode(',', $idsort); $jssort = implode("; ", $jssort); $sortable_ids = "#" . implode(",#", $sort); if ($use_jquery_sortable) { $js = "\n\t\t\t\tjQuery(function() {\n\t\t\t\t\tmy = jQuery( \"{$sortable_ids}\" ).sortable({\n\t\t\t\t\t\tconnectWith: \"" . $sortable_ids . "\",\n\t\t\t\t\t\tupdate: function(event, ui) {\n\t\t\t\t\t\t\tif(ui.sender) {\n\t\t\t\t\t\t\t\tstoreordering(jQuery(ui.sender));\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tstoreordering(jQuery(ui.item).parent());\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\tinitordering();\n\t\t\t\t});\n\t\t\t\tfunction storeordering(parent_element) {\n\t\t\t\t\thidden_id = '#'+jQuery.trim(parent_element.attr('id').replace('sortable-',''));\n\t\t\t\t\tfields = new Array();\n\t\t\t\t\ti = 0;\n\t\t\t\t\tparent_element.children('li').each(function(){\n\t\t\t\t\t\tfields[i++] = jQuery(this).attr('id').replace('field_', '');\n\t\t\t\t\t});\n\t\t\t\t\tjQuery(hidden_id).val(fields.join(','))\n\t\t\t\t}\n\t\t\t\t"; } else { $js = "\n\t\t\t\tvar my = '';\n\t\t\t\twindow.addEvent('domready', function(){\n\t\t\t\t\tvar mySortables = new Sortables('.positions', {\n\t\t\t\t\t\tconstrain: false,\n\t\t\t\t\t\tclone: false,\n\t\t\t\t\t\trevert: true,\n\t\t\t\t\t\tonComplete: storeordering\n\t\t\t\t\t});\n\t\t\t\t\tmy = mySortables;\n\t\t\t\t\tstoreordering();\n\n\t\t\t\t\tvar slideaccess = new Fx.Slide('propvisible');\n\t\t\t\t\tvar slidenoaccess = new Fx.Slide('propnovisible');\n\t\t\t\t\tvar legend = \$\$('fieldset.tmplprop legend');\n\t\t\t\t\tslidenoaccess.hide();\n\t\t\t\t\tlegend.addEvent('click', function(ev) {\n\t\t\t\t\t\tlegend.toggleClass('open');\n\t\t\t\t\t\tslideaccess.toggle();\n\t\t\t\t\t\tslidenoaccess.toggle();\n\t\t\t\t\t});\n\n\n\t\t\t\t});\n\n\t\t\t\tfunction results(i, field) {\n\t\t\t\t\tvar res = my.serialize(i, function(element, index){\n\t\t\t\t\treturn element.getProperty('id').replace('field_','');\n\t\t\t\t}).join(',');\n\t\t\t\t\t\$(field).value = res;\n\t\t\t\t}\n\t\t\t\t"; } $js .= ' var fieldListFilters = new Array( "content_type", "field_type" ); function filterFieldList (containerID, method, group) { var needed_classes = ""; for (i=0; i<fieldListFilters.length; i++) { filter_name = fieldListFilters[i]; var filter_val = jQuery("#" + filter_name + "_" + group).val(); if (filter_val) { needed_classes += "."+filter_name+"_"+filter_val; } } if (needed_classes) { (method=="hide") ? jQuery("#"+containerID).find("li").show().filter(":not("+needed_classes+")").hide() : jQuery("#"+containerID).find("li").css({"color":"red"}).filter(":not("+needed_classes+")").css({"color":"black"}); } else { (method=="hide") ? jQuery("#"+containerID).find("li").show() : jQuery("#"+containerID).find("li").css({"color":"black"}); } } '; $document->addScriptDeclaration($js); } 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')); } //Create Submenu FLEXISubmenu('CanTemplates'); //create the toolbar JToolBarHelper::title(JText::_('FLEXI_EDIT_TEMPLATE'), 'templates'); if (FLEXI_J16GE) { JToolBarHelper::apply('templates.apply'); JToolBarHelper::save('templates.save'); JToolBarHelper::cancel('templates.cancel'); } else { JToolBarHelper::apply(); JToolBarHelper::save(); JToolBarHelper::cancel(); } //assign data to template $this->assignRef('layout', $layout); $this->assignRef('fields', $fields); $this->assignRef('user', $user); $this->assignRef('type', $type); $this->assignRef('folder', $folder); $this->assignRef('jssort', $jssort); $this->assignRef('positions', $positions); $this->assignRef('used', $used); $this->assignRef('fbypos', $fbypos); $this->assignRef('use_jquery_sortable', $use_jquery_sortable); $this->assignRef('content_type_select', $content_type_select); $this->assignRef('field_type_select', $field_type_select); parent::display($tpl); }
function display($tpl = null) { //initialise variables $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'); // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // Order and order direction $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // Get filter vars $filter_state = $model->getState('filter_state'); $filter_assigned = $model->getState('filter_assigned'); if ($filter_state) { $count_filters++; } if ($filter_assigned) { $count_filters++; } // Text search $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // **************************** // Important usability messages // **************************** if ($cparams->get('show_usability_messages', 1)) { } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanTags'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TAGS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'tags'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $js = "jQuery(document).ready(function(){"; $contrl = FLEXI_J16GE ? "tags." : ""; $toolbar = JToolBar::getInstance('toolbar'); if ($perms->CanConfig) { $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=tags&layout=import&tmpl=component'; 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\t\tjQuery('#toolbar-import a.toolbar, #toolbar-import button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 430, y: 500}, onClose: function() {}}');\n\t\t\t\t"; JToolBarHelper::custom($btn_task, 'import.png', 'import_f2.png', 'FLEXI_IMPORT', false); JHtml::_('behavior.modal', '#toolbar-import a.toolbar, #toolbar-import button'); } else { $toolbar->appendButton('Popup', 'import', JText::_('FLEXI_IMPORT'), str_replace('&', '&', $popup_load_url), 430, 500); } JToolBarHelper::divider(); JToolBarHelper::spacer(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); if ($perms->CanCreateTags) { JToolBarHelper::addNew($contrl . 'add'); } JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); // Checkin JToolbarHelper::checkin($contrl . 'checkin'); 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); // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $model = $this->getModel(); $rows = $this->get('Data'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items (via separate query), (if not already retrieved) // ... when we order by assigned then this is already done via main DB query if ($filter_order != 'nrassigned') { $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } $rowtotals = $model->getAssignedItems($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { $row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; } } // Create pagination object $pagination = $this->get('Pagination'); $lists = array(); // build orphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '-'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = ($filter_assigned || 1 ? '<label class="label">' . JText::_('FLEXI_ASSIGNED') . '</label>' : '') . JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_assigned); // build publication state filter $states = array(); $states[] = JHTML::_('select.option', '', '-'); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$states[] = JHTML::_('select.option', '-2', JText::_( 'FLEXI_TRASHED' ) ); $lists['state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_state); //JHTML::_('grid.state', $filter_state ); // text search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // ordering filters $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // pagination filters $limit = $model->getState('limit'); $limitstart = $model->getState('limitstart'); // Various filters $filter_itemscount = $model->getState('filter_itemscount'); $filter_usergrp = $model->getState('filter_usergrp'); $filter_logged = $model->getState('filter_logged'); if ($filter_itemscount) { $count_filters++; } if ($filter_usergrp) { $count_filters++; } if ($filter_logged) { $count_filters++; } $date = $model->getState('date'); $startdate = $model->getState('startdate'); $enddate = $model->getState('enddate'); $startdate = $db->escape(trim(JString::strtolower($startdate))); $enddate = $db->escape(trim(JString::strtolower($enddate))); if ($startdate) { $count_filters++; } if ($enddate) { $count_filters++; } // Author id filter $filter_id = $model->getState('filter_id'); if (strlen($filter_id)) { $count_filters++; } // Text search $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // ******************* // Get data from model // ******************* $rows = $model->getData(); // User data $total = $model->getTotal(); // Total rows $pagination = $model->getPagination(); // Pagination // ****************************************** // Add usability notices if these are enabled // ****************************************** if ($cparams->get('show_usability_messages', 1)) { $notice_author_with_items_only = $app->getUserStateFromRequest($option . '.users.notice_author_with_items_only', 'notice_author_with_items_only', 0, 'int'); if (!$notice_author_with_items_only) { $app->setUserState($option . '.users.notice_author_with_items_only', 1); $app->enqueueMessage(JText::_('FLEXI_BY_DEFAULT_ONLY_AUTHORS_WITH_ITEMS_SHOWN'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.calendar'); JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VERSION); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VERSION); $js = "jQuery(document).ready(function(){"; if ($search) { $js .= "jQuery('.col_title').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_itemscount) { $js .= "jQuery('.col_itemscount').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_usergrp) { $js .= "jQuery('.col_usergrp').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_logged) { $js .= "jQuery('.col_logged').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($filter_id) { $js .= "jQuery('.col_id').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($startdate || $enddate) { if ($date == 1) { $js .= "jQuery('.col_registered').each(function(){ jQuery(this).addClass('yellow'); });"; } else { if ($date == 2) { $js .= "jQuery('.col_visited').each(function(){ jQuery(this).addClass('yellow'); });"; } } } $js .= "});"; $document->addScriptDeclaration($js); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanAuthors'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_AUTHORS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'authors'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->setToolbar(); // DB Query to get -mulitple- user group ids for all authors, // Get user-To-usergoup mapping for users in current page $user_ids = array(); foreach ($rows as $row) { $row->usergroups = array(); if ($row->id) { $user_ids[] = $row->id; } } $query = 'SELECT user_id, group_id FROM #__user_usergroup_map ' . (count($user_ids) ? 'WHERE user_id IN (' . implode(',', $user_ids) . ')' : ''); $db->setQuery($query); $ugdata_arr = $db->loadObjectList(); foreach ($ugdata_arr as $ugdata) { $usergroups[$ugdata->user_id][] = $ugdata->group_id; } foreach ($rows as $row) { if ($row->id) { $row->usergroups = $usergroups[$row->id]; } } // Get list of Groups for dropdown filter $query = 'SELECT *, id AS value, title AS text FROM #__usergroups'; $db->setQuery($query); $usergroups = $db->loadObjectList('id'); $types[] = JHTML::_('select.option', '', '-'); foreach ($usergroups as $ugrp) { $types[] = JHTML::_('select.option', $ugrp->value, JText::_($ugrp->text)); } $itemscount_options[] = JHTML::_('select.option', '', '-'); $itemscount_options[] = JHTML::_('select.option', 1, JText::_('None')); $itemscount_options[] = JHTML::_('select.option', 2, JText::_('One or more')); $lists['filter_itemscount'] = ($filter_itemscount || 1 ? '<label class="label"># ' . JText::_('FLEXI_ITEMS') . '</label>' : '') . JHTML::_('select.genericlist', $itemscount_options, 'filter_itemscount', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_itemscount); $lists['filter_usergrp'] = ($filter_usergrp || 1 ? '<label class="label">' . JText::_('Select Group') . '</label>' : '') . JHTML::_('select.genericlist', $types, 'filter_usergrp', 'class="use_select2_lib" style="width:auto;" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_usergrp); // get list of Log Status for dropdown filter $logged[] = JHTML::_('select.option', '', '-'); $logged[] = JHTML::_('select.option', 1, JText::_('Logged In')); $logged[] = JHTML::_('select.option', 2, JText::_('Logged Out')); $lists['filter_logged'] = ($filter_logged || 1 ? '<label class="label">' . JText::_('Log Status') . '</label>' : '') . JHTML::_('select.genericlist', $logged, 'filter_logged', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_logged); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // build dates option list $dates = array(); $dates[] = JHTML::_('select.option', '1', JText::_('Registered')); $dates[] = JHTML::_('select.option', '2', JText::_('Last Visit')); $lists['date'] = '<label class="label">' . JText::_('FLEXI_DATE') . '</label>' . JHTML::_('select.genericlist', $dates, 'date', 'size="1" class="use_select2_lib fc_skip_highlight"', 'value', 'text', $date, 'date'); $lists['startdate'] = JHTML::_('calendar', $startdate, 'startdate', 'startdate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '8', 'maxlength' => '19', 'style' => 'width:auto', 'placeholder' => JText::_('FLEXI_FROM'))); $lists['enddate'] = JHTML::_('calendar', $enddate, 'enddate', 'enddate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '8', 'maxlength' => '19', 'style' => 'width:auto', 'placeholder' => JText::_('FLEXI_TO'))); // search filter $lists['search'] = $search; // search id $lists['filter_id'] = $filter_id; $this->assignRef('count_filters', $count_filters); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('usergroups', $usergroups); $this->assignRef('pagination', $pagination); // filters $this->assignRef('filter_id', $filter_id); $this->assignRef('filter_itemscount', $filter_itemscount); $this->assignRef('filter_usergrp', $filter_usergrp); $this->assignRef('filter_logged', $filter_logged); $this->assignRef('search', $search); $this->assignRef('filter_id', $filter_id); $this->assignRef('date', $date); $this->assignRef('startdate', $startdate); $this->assignRef('enddate', $enddate); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // various filters $filter_fieldtype = $model->getState('filter_fieldtype'); $filter_assigned = $model->getState('filter_assigned'); $filter_type = $model->getState('filter_type'); $filter_state = $model->getState('filter_state'); $filter_access = $model->getState('filter_access'); if ($filter_assigned) { $count_filters++; } if ($filter_fieldtype) { $count_filters++; } if ($filter_state) { $count_filters++; } if ($filter_access) { $count_filters++; } if ($filter_type) { $count_filters++; } // ordering filters $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // text search $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // **************************** // Important usability messages // **************************** if ($cparams->get('show_usability_messages', 1)) { $notice_content_type_order = $app->getUserStateFromRequest($option . '.' . $view . '.notice_content_type_order', 'notice_content_type_order', 0, 'int'); if (!$notice_content_type_order) { $app->setUserState($option . '.' . $view . '.notice_content_type_order', 1); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_BY_TYPE'), 'message'); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_WITHOUT_TYPE'), 'message'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); $js = "jQuery(document).ready(function(){"; // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanFields'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FIELDS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fields'); $document->setTitle($doc_title . ' - ' . $site_title); if ($perms->CanEditField) { $ctrl_task = '&task=fields.selectsearchflag'; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent' . $ctrl_task . '&tmpl=component'; $btn_name = 'basicindex'; $btn_task = ''; $full_js = ';'; $extra_js = ''; flexicontent_html::addToolBarButton(JText::_('FLEXI_TOGGLE_SEARCH_FLAG'), $btn_name, $full_js, $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false, $btn_class = ""); $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: 800, y: 340}, onClose: function() {}}');\n\t\t\t"; } $contrl = "fields."; if ($perms->CanCopyFields) { JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::custom($contrl . 'copy_wvalues', 'copy_wvalues.png', 'copy_f2.png', 'FLEXI_COPY_WITH_VALUES'); JToolBarHelper::divider(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); if ($perms->CanAddField) { JToolBarHelper::addNew($contrl . 'add'); } if ($perms->CanEditField) { JToolBarHelper::editList($contrl . 'edit'); } if ($perms->CanDeleteField) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } JToolbarHelper::checkin($contrl . 'checkin'); /* JToolBarHelper::divider(); JToolBarHelper::spacer(); $btn_name = 'basicindex'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='issearch';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_TEXT_SEARCHABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'basicfilter'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isfilter';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_FILTERABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'advindex'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvsearch';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_ADV_TEXT_SEARCHABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'advfilter'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvfilter';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_ADV_FILTERABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); */ $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman'; if (file_exists($appsman_path)) { $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'appsman.exportxml'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_fields'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); $btn_icon = 'icon-box-add'; $btn_name = 'box-add'; $btn_task = 'appsman.addtoexport'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_fields'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); } /*$btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'fields.exportsql'; $extra_js = ""; flexicontent_html::addToolBarButton( 'Export SQL', $btn_name, $full_js='', $msg_alert='', $msg_confirm='Field\'s configuration will be exported as SQL', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=true, $btn_class="btn-warning", $btn_icon); $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'fields.exportcsv'; $extra_js = ""; flexicontent_html::addToolBarButton( 'Export CSV', $btn_name, $full_js='', $msg_alert='', $msg_confirm='Field\'s configuration will be exported as CSV', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=true, $btn_class="btn-warning", $btn_icon);*/ 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); // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Items'); $allrows = $this->get('AllItems'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } $pagination = $this->get('Pagination'); // Pagination $types = $this->get('Typeslist'); // Content types $fieldTypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = true, $_published = false); // Field types with content type ASSIGNMENT COUNTING $lists = array(); // build item-type filter $lists['filter_type'] = ($filter_type || 1 ? '<label class="label">' . JText::_('FLEXI_TYPE') . '</label>' : '') . flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, '-', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'filter_type'); // build orphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '-'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = ($filter_assigned || 1 ? '<label class="label">' . JText::_('FLEXI_ASSIGNED') . '</label>' : '') . JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_assigned); // build field-type filter $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftypes = array(); $fftypes[] = array('value' => '', 'text' => '-'); $fftypes[] = array('value' => 'BV', 'text' => $ALL . JText::_('FLEXI_BACKEND_FIELDS')); $fftypes[] = array('value' => 'C', 'text' => $ALL . JText::_('FLEXI_CORE_FIELDS')); $fftypes[] = array('value' => 'NC', 'text' => $ALL . JText::_('FLEXI_NON_CORE_FIELDS')); 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->assigned . '- ' . $ftdata->friendly); } $fftypes[] = ''; } $lists['fftype'] = ($filter_fieldtype || 1 ? '<label class="label">' . JText::_('FLEXI_FIELD_TYPE') . '</label>' : '') . flexicontent_html::buildfieldtypeslist($fftypes, 'filter_fieldtype', $filter_fieldtype, $_grouped ? 1 : 0, 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'); // build publication state filter $states = array(); $states[] = JHTML::_('select.option', '', '-'); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$states[] = JHTML::_('select.option', '-2', JText::_( 'FLEXI_TRASHED' ) ); $lists['state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_state); //JHTML::_('grid.state', $filter_state ); // build access level filter $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', '-')); $fieldname = $elementid = 'filter_access'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['access'] = ($filter_access || 1 ? '<label class="label">' . JText::_('FLEXI_ACCESS') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // text search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; if ($filter_type == '' || $filter_type == 0) { $ordering = $lists['order'] == 't.ordering'; } else { $ordering = $lists['order'] == 'typeordering'; } //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('permission', $perms); $this->assignRef('filter_type', $filter_type); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('allrows', $allrows); $this->assignRef('types', $types); $this->assignRef('ordering', $ordering); $this->assignRef('pagination', $pagination); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
/** * Creates the Filemanager view * * @since 1.0 */ function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $view = JRequest::getVar('view'); $layout = JRequest::getVar('layout', 'default'); $db = JFactory::getDBO(); $user = JFactory::getUser(); $cparams = JComponentHelper::getParams('com_flexicontent'); //$authorparams = flexicontent_db::getUserConfig($user->id); $langs = FLEXIUtilities::getLanguages('code'); flexicontent_html::loadJQuery(); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); // Load the form validation behavior JHTML::_('behavior.formvalidation'); // Get filters $count_filters = 0; $_view = $view; $filter_order = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_order', 'filter_order', 'f.filename', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_lang = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_lang', 'filter_lang', '', 'string'); $filter_url = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_url', 'filter_url', '', 'word'); $filter_secure = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_secure', 'filter_secure', '', 'word'); $filter_ext = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_ext', 'filter_ext', '', 'alnum'); $filter_uploader = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_uploader', 'filter_uploader', '', 'int'); $filter_item = $app->getUserStateFromRequest($option . '.' . $_view . '.item_id', 'item_id', '', 'int'); if ($layout != 'image') { if ($filter_lang) { $count_filters++; } if ($filter_url) { $count_filters++; } if ($filter_secure) { $count_filters++; } } if ($filter_ext) { $count_filters++; } if ($filter_uploader) { $count_filters++; } if ($filter_item) { $count_filters++; } $scope = $app->getUserStateFromRequest($option . '.' . $_view . '.scope', 'scope', 1, 'int'); $search = $app->getUserStateFromRequest($option . '.' . $_view . '.search', 'search', '', 'string'); $search = $db->escape(trim(JString::strtolower($search))); $filter_uploader = $filter_uploader ? $filter_uploader : ''; $filter_item = $filter_item ? $filter_item : ''; // ************************** // Add css and js to document // ************************** if ($app->isSite()) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css'); } else { $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('CanFiles'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FILEMANAGER'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'files'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar JToolBarHelper::deleteList('Are you sure?', 'filemanager.remove'); 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 = "jQuery(document).ready(function(){"; $toolbar = JToolBar::getInstance('toolbar'); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=filemanager&layout=indexer&tmpl=component&indexer=fileman_default'; 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', 'Index file statistics', false); JHtml::_('behavior.modal', '#toolbar-basicindex a.toolbar, #toolbar-basicindex button'); } else { $toolbar->appendButton('Popup', 'basicindex', 'Index file statistics', str_replace('&', '&', $popup_load_url), 500, 240); } $js .= "});"; $document->addScriptDeclaration($js); // *********************** // Get data from the model // *********************** $folder_mode = 0; $model = $this->getModel(); if (!$folder_mode) { $rows = $this->get('Data'); } else { // TODO MORE ... } $pagination = $this->get('Pagination'); //$users = $this->get('Users'); // Get item using at least one file (-of- the currently listed files) /*$items_single = $model->getItemsSingleprop( array('file','minigallery') ); $items_multi = $model->getItemsMultiprop ( $field_props=array('image'=>'originalname'), $value_props=array('image'=>'filename') ); $items = array(); foreach ($items_single as $item_id => $_item) $items[$item_id] = $_item; foreach ($items_multi as $item_id => $_item) $items[$item_id] = $_item; ksort($items);*/ $assigned_fields_labels = array('image' => 'image/gallery', 'file' => 'file', 'minigallery' => 'minigallery'); $assigned_fields_icons = array('image' => 'picture_link', 'file' => 'page_link', 'minigallery' => 'film_link'); /***************** ** BUILD LISTS ** *****************/ $lists = array(); // ** FILE UPLOAD FORM ** // Build languages list //$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed',null); //$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs); $display_file_lang_as = $cparams->get('display_file_lang_as', 3); $allowed_langs = null; $lists['file-lang'] = flexicontent_html::buildlanguageslist('file-lang', '', '*', $display_file_lang_as, $allowed_langs, $published_only = false); /************* ** FILTERS ** *************/ // language filter $lists['language'] = ($filter_lang || 1 ? '<label class="label">' . JText::_('FLEXI_LANGUAGE') . '</label>' : '') . flexicontent_html::buildlanguageslist('filter_lang', 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" size="1" ', $filter_lang, '-'); // search $lists['search'] = $search; //search filter $filters = array(); $filters[] = JHTML::_('select.option', '1', JText::_('FLEXI_FILENAME')); $filters[] = JHTML::_('select.option', '2', JText::_('FLEXI_FILE_DISPLAY_TITLE')); $lists['scope'] = JHTML::_('select.genericlist', $filters, 'scope', 'size="1" class="use_select2_lib fc_skip_highlight" title="' . JText::_('FLEXI_SEARCH_TEXT_INSIDE') . '"', 'value', 'text', $scope); //build url/file filterlist $url = array(); $url[] = JHTML::_('select.option', '', '-'); $url[] = JHTML::_('select.option', 'F', JText::_('FLEXI_FILE')); $url[] = JHTML::_('select.option', 'U', JText::_('FLEXI_URL')); $lists['url'] = ($filter_url || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_FILES') . '</label>' : '') . JHTML::_('select.genericlist', $url, 'filter_url', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_url); //item lists /*$items_list = array(); $items_list[] = JHTML::_('select.option', '', '- '. JText::_( 'FLEXI_FILTER_BY_ITEM' ) .' -' ); foreach($items as $item) { $items_list[] = JHTML::_('select.option', $item->id, JText::_( $item->title ) . ' (#' . $item->id . ')' ); } $lists['item_id'] = JHTML::_('select.genericlist', $items_list, 'item_id', 'size="1" class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_item );*/ $lists['item_id'] = '<input type="text" name="item_id" size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" value="' . $filter_item . '" />'; //build secure/media filterlist $secure = array(); $secure[] = JHTML::_('select.option', '', '-'); $secure[] = JHTML::_('select.option', 'S', JText::_('FLEXI_SECURE_DIR')); $secure[] = JHTML::_('select.option', 'M', JText::_('FLEXI_MEDIA_DIR')); $lists['secure'] = ($filter_secure || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_DIRECTORIES') . '</label>' : '') . JHTML::_('select.genericlist', $secure, 'filter_secure', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_secure); //build ext filterlist $lists['ext'] = ($filter_ext || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_EXT') . '</label>' : '') . flexicontent_html::buildfilesextlist('filter_ext', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_ext, '-'); //build uploader filterlist $lists['uploader'] = ($filter_uploader || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_UPLOADERS') . '</label>' : '') . flexicontent_html::builduploaderlist('filter_uploader', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_uploader, '-'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // uploadstuff if ($cparams->get('enable_flash', 1) && !FLEXI_J30GE) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ window.location.reload(); }')); } jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('params', $cparams); $this->assign('require_ftp', $ftp); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('folder_mode', $folder_mode); $this->assignRef('pagination', $pagination); $this->assignRef('CanFiles', $perms->CanFiles); $this->assignRef('CanUpload', $perms->CanUpload); $this->assignRef('CanViewAllFiles', $perms->CanViewAllFiles); $this->assignRef('assigned_fields_labels', $assigned_fields_labels); $this->assignRef('assigned_fields_icons', $assigned_fields_icons); $this->assignRef('langs', $langs); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); if (!$perms->CanTemplates) { $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS')); } // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) 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 $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman'; if (file_exists($appsman_path)) { $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'appsman.exportxml'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_templates'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); $btn_icon = 'icon-box-add'; $btn_name = 'box-add'; $btn_task = 'appsman.addtoexport'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_templates'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); } //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'); // Get layout data /*$tmpl = flexicontent_tmpl::getTemplates(); foreach($rows as $row) { $row->item_layout = @ $tmpl->items->{$row->name}; $row->category_layout = @ $tmpl->category->{$row->name}; }*/ //assign data to template $this->assignRef('rows', $rows); $this->assignRef('user', $user); $this->assignRef('tmpldirectory', $tmpldirectory); $this->assignRef('source', $source); $this->assignRef('dest', $dest); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { global $globalcats; $app = JFactory::getApplication(); $cparams = JComponentHelper::getParams('com_flexicontent'); //initialise variables $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $task = JRequest::getVar('task', ''); $cid = JRequest::getVar('cid', array()); $bind_limit = JRequest::getInt('bind_limit', 1000); $session = JFactory::getSession(); $fileid_to_itemids = $session->get('fileid_to_itemids', array(), 'flexicontent'); $filter_fileid = JRequest::getInt('filter_fileid', 0); // Some flags $enable_translation_groups = $cparams->get("enable_translation_groups") && (FLEXI_J16GE || FLEXI_FISH); $print_logging_info = $cparams->get('print_logging_info'); FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); if ($task == 'copy') { $this->setLayout('copy'); $this->_displayCopyMove($tpl, $cid); return; } flexicontent_html::loadJQuery(); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.calendar'); // Get filters $count_filters = 0; $filter_cats = $app->getUserStateFromRequest($option . '.items.filter_cats', 'filter_cats', '', 'int'); $filter_subcats = $app->getUserStateFromRequest($option . '.items.filter_subcats', 'filter_subcats', 1, 'int'); $filter_catsinstate = $app->getUserStateFromRequest($option . '.items.filter_catsinstate', 'filter_catsinstate', 1, 'int'); if ($filter_cats) { $count_filters++; } $filter_order_type = $app->getUserStateFromRequest($option . '.items.filter_order_type', 'filter_order_type', 1, 'int'); $filter_order = $app->getUserStateFromRequest($option . '.items.filter_order', 'filter_order', '', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.items.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest($option . '.items.filter_type', 'filter_type', 0, 'int'); $filter_authors = $app->getUserStateFromRequest($option . '.items.filter_authors', 'filter_authors', 0, 'int'); $filter_state = $app->getUserStateFromRequest($option . '.items.filter_state', 'filter_state', '', 'word'); if ($filter_type) { $count_filters++; } if ($filter_authors) { $count_filters++; } if ($filter_state) { $count_filters++; } $filter_stategrp = $app->getUserStateFromRequest($option . '.items.filter_stategrp', 'filter_stategrp', '', 'word'); if (FLEXI_FISH || FLEXI_J16GE) { $filter_lang = $app->getUserStateFromRequest($option . '.items.filter_lang', 'filter_lang', '', 'string'); if ($filter_lang) { $count_filters++; } } $scope = $app->getUserStateFromRequest($option . '.items.scope', 'scope', 1, 'int'); $date = $app->getUserStateFromRequest($option . '.items.date', 'date', 1, 'int'); $startdate = $app->getUserStateFromRequest($option . '.items.startdate', 'startdate', '', 'cmd'); if ($startdate == JText::_('FLEXI_FROM')) { $startdate = $app->setUserState($option . '.items.startdate', ''); } if ($startdate) { $count_filters++; } $enddate = $app->getUserStateFromRequest($option . '.items.enddate', 'enddate', '', 'cmd'); if ($enddate == JText::_('FLEXI_TO')) { $enddate = $app->setUserState($option . '.items.enddate', ''); } if ($enddate) { $count_filters++; } $filter_id = $app->getUserStateFromRequest($option . '.items.filter_id', 'filter_id', '', 'int'); if ($filter_id) { $count_filters++; } $search = $app->getUserStateFromRequest($option . '.items.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); if ($search) { $count_filters++; } // Add custom css and js 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'); } } $document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/stateselector.js'); $document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/flexi-lib.js'); $js = "window.addEvent('domready', function(){"; if ($filter_cats) { $js .= "\$\$('.col_cats').each(function(el){ el.addClass('yellow'); });"; } if ($filter_type) { $js .= "\$\$('.col_type').each(function(el){ el.addClass('yellow'); });"; } if ($filter_authors) { $js .= "\$\$('.col_authors').each(function(el){ el.addClass('yellow'); });"; } if ($filter_state) { $js .= "\$\$('.col_state').each(function(el){ el.addClass('yellow'); });"; } if (FLEXI_FISH || FLEXI_J16GE) { if ($filter_lang) { $js .= "\$\$('.col_lang').each(function(el){ el.addClass('yellow'); });"; } } if ($filter_id) { $js .= "\$\$('.col_id').each(function(el){ el.addClass('yellow'); });"; } if ($startdate || $enddate) { if ($date == 1) { $js .= "\$\$('.col_created').each(function(el){ el.addClass('yellow'); });"; } else { if ($date == 2) { $js .= "\$\$('.col_revised').each(function(el){ el.addClass('yellow'); });"; } } } if ($search) { $js .= "\$\$('.col_title').each(function(el){ el.addClass('yellow'); });"; } else { $js .= "\$\$('.col_title').each(function(el){ el.removeClass('yellow'); });"; } // Check if user can create in at least one published category require_once "components/com_flexicontent/models/item.php"; $itemmodel = new FlexicontentModelItem(); $CanAdd = !FLEXI_J16GE ? $itemmodel->canAdd() : $itemmodel->getItemAccess()->get('access-create'); // Performance consideration: ... CHECK ONLY global permissions, and not individual categories $perms = FlexicontentHelperPerm::getPerm(); $CanEdit = $perms->CanEdit; $CanPublish = $perms->CanPublish; $CanDelete = $perms->CanDelete; $CanEditOwn = $perms->CanEditOwn; $CanPublishOwn = $perms->CanPublishOwn; $CanDeleteOwn = $perms->CanDeleteOwn; $CanCats = $perms->CanCats; $CanAccLvl = $perms->CanAccLvl; $CanOrder = $perms->CanOrder; $CanCopy = $perms->CanCopy; $CanArchives = $perms->CanArchives; // Create Submenu (and also check access to current view) FLEXISubmenu('notvariable'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_ITEMS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'items'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $toolbar = JToolBar::getInstance('toolbar'); $add_divider = false; if ($filter_stategrp != '') { $btn_task = FLEXI_J16GE ? 'items.display' : 'display'; $extra_js = "document.getElementById('filter_stategrp').checked=true;"; flexicontent_html::addToolBarButton('FLEXI_DISPLAY_NORMAL', 'preview', $full_js = '', $msg_alert = '', $msg_confirm = '', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = false); $add_divider = true; } /*if ( ($CanDelete || $CanDeleteOwn) && $filter_stategrp != 'trashed' ) { $btn_task = FLEXI_J16GE ? 'items.display' : 'display'; $extra_js = "document.getElementById('filter_stategrptrashed').checked=true;"; flexicontent_html::addToolBarButton( 'FLEXI_DISPLAY_TRASH', 'preview', $full_js='', $msg_alert='', $msg_confirm='', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=false); $add_divider = true; } if ($CanArchives && $filter_stategrp != 'archived') { $btn_task = FLEXI_J16GE ? 'items.display' : 'display'; $extra_js = "document.getElementById('filter_stategrparchived').checked=true;"; flexicontent_html::addToolBarButton( 'FLEXI_DISPLAY_ARCHIVE', 'preview', $full_js='', $msg_alert='', $msg_confirm='', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=false); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); }*/ // Implementation of multiple-item state selector $add_divider = false; if ($CanPublish || $CanPublishOwn) { $btn_task = ''; $ctrl_task = FLEXI_J16GE ? '&task=items.selectstate' : '&controller=items&task=selectstate'; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent' . $ctrl_task . '&format=raw'; 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\t\tjQuery('#toolbar-publish a.toolbar, #toolbar-publish button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 240}, onClose: function() {}}');\n\t\t\t\t"; //JToolBarHelper::publishList( $btn_task ); JToolBarHelper::custom($btn_task, 'publish.png', 'publish_f2.png', 'FLEXI_CHANGE_STATE', false); JHtml::_('behavior.modal', '#toolbar-publish a.toolbar, #toolbar-publish button'); } else { $toolbar->appendButton('Popup', 'publish', JText::_('FLEXI_CHANGE_STATE'), str_replace('&', '&', $popup_load_url), 800, 240); } $add_divider = true; } if ($CanDelete || $CanDeleteOwn) { if ($filter_stategrp == 'trashed') { $btn_msg = 'FLEXI_ARE_YOU_SURE'; $btn_task = FLEXI_J16GE ? 'items.remove' : 'remove'; JToolBarHelper::deleteList($btn_msg, $btn_task); } else { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_TRASH')); $msg_confirm = JText::_('FLEXI_TRASH_CONFIRM'); $btn_task = FLEXI_J16GE ? 'items.changestate' : 'changestate'; $extra_js = "document.adminForm.newstate.value='T';"; flexicontent_html::addToolBarButton('FLEXI_TRASH', 'trash', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } $add_divider = true; } if ($CanArchives && $filter_stategrp != 'archived') { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_ARCHIVE')); $msg_confirm = JText::_('FLEXI_ARCHIVE_CONFIRM'); $btn_task = FLEXI_J16GE ? 'items.changestate' : 'changestate'; $extra_js = "document.adminForm.newstate.value='A';"; flexicontent_html::addToolBarButton('FLEXI_ARCHIVE', 'archive', $full_js = '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $add_divider = true; } if ($CanArchives && $filter_stategrp == 'archived' || ($CanDelete || $CanDeleteOwn) && $filter_stategrp == 'trashed') { $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_RESTORE')); $msg_confirm = JText::_('FLEXI_RESTORE_CONFIRM'); $btn_task = FLEXI_J16GE ? 'items.changestate' : 'changestate'; $extra_js = "document.adminForm.newstate.value='P';"; flexicontent_html::addToolBarButton('FLEXI_RESTORE', 'restore', $full_js = '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if ($CanAdd) { $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=types&format=raw'; 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\t\tjQuery('#toolbar-new a.toolbar, #toolbar-new button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 240}, onClose: function() {}}');\n\t\t\t\t"; //JToolBarHelper::addNew( $btn_task ); JToolBarHelper::custom($btn_task, 'new.png', 'new_f2.png', 'FLEXI_NEW', false); JHtml::_('behavior.modal', '#toolbar-new a.toolbar, #toolbar-new button'); } else { $toolbar->appendButton('Popup', 'new', JText::_('FLEXI_NEW'), str_replace('&', '&', $popup_load_url), 800, 240); } $add_divider = true; } if ($CanEdit || $CanEditOwn) { $btn_task = FLEXI_J16GE ? 'items.edit' : 'edit'; JToolBarHelper::editList($btn_task); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if ($CanAdd && $CanCopy) { $btn_task = FLEXI_J16GE ? 'items.copy' : 'copy'; JToolBarHelper::custom($btn_task, 'copy.png', 'copy_f2.png', 'FLEXI_COPY_MOVE'); if ($enable_translation_groups) { JToolBarHelper::custom('translate', 'translate', 'translate', 'FLEXI_TRANSLATE'); } $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); JToolBarHelper::spacer(); } if ($perms->CanConfig) { $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); // *********************** // Get data from the model // *********************** $model = $this->getModel(); $badcatitems = (int) $model->getUnboundedItems($limit = 10000000, $count_only = true, $checkNoExtData = false, $checkInvalidCat = true); $unassociated = (int) $model->getUnboundedItems($limit = 10000000, $count_only = true, $checkNoExtData = true, $checkInvalidCat = false); $rows = $this->get('Data'); $pagination = $this->get('Pagination'); $types = $this->get('Typeslist'); $authors = $this->get('Authorslist'); // these depend on data rows and must be called after getting data $extraCols = $this->get('ExtraCols'); $itemCats = $this->get('ItemCats'); if ($enable_translation_groups) { $langAssocs = $this->get('LangAssocs'); } if (FLEXI_FISH || FLEXI_J16GE) { $langs = FLEXIUtilities::getLanguages('code'); } $categories = $globalcats ? $globalcats : array(); $limit = $pagination->limit; $inline_ss_max = 30; $drag_reorder_max = 100; if ($limit > $drag_reorder_max) { $cparams->set('draggable_reordering', 0); } // ****************************************** // Add usability notices if these are enabled // ****************************************** if ($cparams->get('show_usability_messages', 1) && !$unassociated && !$badcatitems) { $notice_iss_disabled = $app->getUserStateFromRequest($option . '.items.notice_iss_disabled', 'notice_iss_disabled', 0, 'int'); if (!$notice_iss_disabled && $limit > $inline_ss_max) { $app->setUserState($option . '.items.notice_iss_disabled', 1); $app->enqueueMessage(JText::sprintf('FLEXI_INLINE_ITEM_STATE_SELECTOR_DISABLED', $inline_ss_max), 'notice'); $show_turn_off_notice = 1; } $notice_drag_reorder_disabled = $app->getUserStateFromRequest($option . '.items.notice_drag_reorder_disabled', 'notice_drag_reorder_disabled', 0, 'int'); if (!$notice_drag_reorder_disabled && $limit > $drag_reorder_max) { $app->setUserState($option . '.items.notice_drag_reorder_disabled', 1); $app->enqueueMessage(JText::sprintf('FLEXI_DRAG_REORDER_DISABLED', $drag_reorder_max), 'notice'); $show_turn_off_notice = 1; } $notice_add_custom_columns = $app->getUserStateFromRequest($option . '.items.notice_add_custom_columns', 'notice_add_custom_columns', 0, 'int'); if (!$notice_add_custom_columns) { $app->setUserState($option . '.items.notice_add_custom_columns', 1); $app->enqueueMessage(JText::_('FLEXI_YOU_MAY_CONFIGURE_CUSTOM_COLUMNS_GLOBAL_AND_PER_TYPE'), 'message'); $show_turn_off_notice = 1; } if (!empty($show_turn_off_notice)) { $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'notice'); } } // ******************* // Create Filters HTML // ******************* $state[] = JHTML::_('select.option', '', JText::_('FLEXI_SELECT_STATE')); $state[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $state[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); $state[] = JHTML::_('select.option', 'PE', JText::_('FLEXI_PENDING')); $state[] = JHTML::_('select.option', 'OQ', JText::_('FLEXI_TO_WRITE')); $state[] = JHTML::_('select.option', 'IP', JText::_('FLEXI_IN_PROGRESS')); $state[] = JHTML::_('select.option', 'RV', JText::_('FLEXI_REVISED_VER')); $lists['filter_state'] = JHTML::_('select.genericlist', $state, 'filter_state', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_state); // build filter state group if ($CanDelete || $CanDeleteOwn || $CanArchives) { $stategroups[''] = JText::_('FLEXI_GRP_NORMAL') . ' ' . JText::_('FLEXI_STATE_S'); $stategroups['published'] = JText::_('FLEXI_GRP_PUBLISHED') . ' ' . JText::_('FLEXI_STATE_S'); $stategroups['unpublished'] = JText::_('FLEXI_GRP_UNPUBLISHED') . ' ' . JText::_('FLEXI_STATE_S'); if ($CanDelete || $CanDeleteOwn) { $stategroups['trashed'] = JText::_('FLEXI_GRP_TRASHED'); } if ($CanArchives) { $stategroups['archived'] = JText::_('FLEXI_GRP_ARCHIVED'); } $stategroups['orphan'] = JText::_('FLEXI_GRP_ORPHAN'); $stategroups['all'] = JText::_('FLEXI_GRP_ALL'); /*$_stategroups = array(); foreach ($stategroups as $i => $v) { $_stategroups[] = JHTML::_('select.option', $i, $v); } $lists['filter_stategrp'] = JHTML::_('select.radiolist', $_stategroups, 'filter_stategrp', 'size="1" class="inputbox" onchange="submitform();"', 'value', 'text', $filter_stategrp );*/ $lists['filter_stategrp'] = ''; foreach ($stategroups as $i => $v) { $checked = $filter_stategrp == $i ? ' checked="checked" ' : ''; $lists['filter_stategrp'] .= '<input type="radio" onchange="submitform();" class="inputbox" ' . $checked . ' value="' . $i . '" id="filter_stategrp' . $i . '" name="filter_stategrp" />'; $lists['filter_stategrp'] .= '<label class="" id="filter_stategrp' . $i . '-lbl" for="filter_stategrp' . $i . '">' . $v . '</label>'; } } // build the include subcats boolean list // build the include non-published cats boolean list if ($filter_order_type && $filter_cats && ($filter_order == 'i.ordering' || $filter_order == 'catsordering')) { $ordering_tip = '<img src="components/com_flexicontent/assets/images/comment.png" class="hasTip" title="' . JText::_('FLEXI_REASON', true) . '::' . JText::_('<u>Items may belong to both</u>: <br/> (a) currently filtered category <br/>(b) to any of its subcategories, <br/> -- Thus item may get listed in a subcategory instead of the currently filtered category, to avoid this sub-categories are not included.', true) . '" />'; $lists['filter_subcats'] = '<span class="fc-mssg-inline fc-note">' . JText::_('Sub-categories not included during specific category ordering: ') . $ordering_tip . '</span>'; } else { $lists['filter_subcats'] = JHTML::_('select.booleanlist', 'filter_subcats', 'class="inputbox" onchange="submitform();"', $filter_subcats); } // build the include non-published cats boolean list $catsinstate[1] = JText::_('FLEXI_PUBLISHED'); $catsinstate[0] = JText::_('FLEXI_UNPUBLISHED'); $catsinstate[99] = JText::_('FLEXI_ANY'); if (FLEXI_J16GE) { $catsinstate[2] = JText::_('FLEXI_ARCHIVED_STATE'); $catsinstate[-2] = JText::_('FLEXI_TRASHED_STATE'); } /*$_catsinstate = array(); foreach ($catsinstate as $i => $v) { $_catsinstate[] = JHTML::_('select.option', $i, $v); } $lists['filter_catsinstate'] = JHTML::_('select.radiolist', $_catsinstate, 'filter_catsinstate', 'size="1" class="inputbox" onchange="submitform();"', 'value', 'text', $filter_catsinstate );*/ $lists['filter_catsinstate'] = ''; foreach ($catsinstate as $i => $v) { $checked = $filter_catsinstate == $i ? ' checked="checked" ' : ''; $lists['filter_catsinstate'] .= '<input type="radio" onchange="submitform();" class="inputbox" ' . $checked . ' value="' . $i . '" id="filter_catsinstate' . $i . '" name="filter_catsinstate" />'; $lists['filter_catsinstate'] .= '<label class="" id="filter_catsinstate' . $i . '-lbl" for="filter_catsinstate' . $i . '">' . $v . '</label>'; } // build the order type boolean list $order_types = array(); $order_types[] = JHTML::_('select.option', '0', JText::_('FLEXI_ORDER_JOOMLA') . '<br/>'); $order_types[] = JHTML::_('select.option', '1', JText::_('FLEXI_ORDER_FLEXICONTENT')); $lists['filter_order_type'] = JHTML::_('select.radiolist', $order_types, 'filter_order_type', 'size="1" class="inputbox" onchange="submitform();"', 'value', 'text', $filter_order_type); // build the categories select list for filter $lists['filter_cats'] = flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, 2, 'class="use_select2_lib" size="1" onchange="submitform( );"', $check_published = false, $check_perms = false); //build type select list $lists['filter_type'] = flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, true, 'class="use_select2_lib" size="1" onchange="submitform( );"', 'filter_type'); //build authors select list $lists['filter_authors'] = flexicontent_html::buildauthorsselect($authors, 'filter_authors', $filter_authors, true, 'class="use_select2_lib" size="1" onchange="submitform( );"'); if ($badcatitems) { $lists['default_cat'] = flexicontent_cats::buildcatselect($categories, 'default_cat', '', 2, 'class="use_select2_lib"', false, false); } //search filter $scopes = array(); $scopes[1] = JText::_('FLEXI_TITLE'); $scopes[2] = JText::_('FLEXI_INTROTEXT'); $scopes[4] = JText::_('FLEXI_INDEXED_CONTENT'); /*$_scopes = array(); foreach ($scopes as $i => $v) { $_scopes[] = JHTML::_('select.option', $i, $v); } $lists['scope'] = JHTML::_('select.radiolist', $_scopes, 'scope', 'size="1" class="inputbox"', 'value', 'text', $scope );*/ $lists['scope'] = ''; foreach ($scopes as $i => $v) { $checked = $scope == $i ? ' checked="checked" ' : ''; $lists['scope'] .= '<input type="radio" onchange="submitform();" class="inputbox" ' . $checked . ' value="' . $i . '" id="scope' . $i . '" name="scope" />'; $lists['scope'] .= '<label class="" id="scope' . $i . '-lbl" for="scope' . $i . '">' . $v . '</label>'; } // build item dates option list $dates[1] = JText::_('FLEXI_CREATED'); $dates[2] = JText::_('FLEXI_REVISED'); /*$_dates = array(); foreach ($dates as $i => $v) { $_dates[] = JHTML::_('select.option', $i, $v); } $lists['date'] = JHTML::_('select.radiolist', $_dates, 'date', 'size="1" class="inputbox"', 'value', 'text', $date );*/ $lists['date'] = ''; foreach ($dates as $i => $v) { $checked = $date == $i ? ' checked="checked" ' : ''; $lists['date'] .= '<input type="radio" onchange="submitform();" class="inputbox" ' . $checked . ' value="' . $i . '" id="date' . $i . '" name="date" />'; $lists['date'] .= '<label class="" id="date' . $i . '-lbl" for="date' . $i . '">' . $v . '</label>'; } $lists['startdate'] = JHTML::_('calendar', $startdate, 'startdate', 'startdate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '11', 'maxlength' => '20')); $lists['enddate'] = JHTML::_('calendar', $enddate, 'enddate', 'enddate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '11', 'maxlength' => '20')); // search filter $bind_limits = array(); $bind_limits[] = JHTML::_('select.option', 250, '250 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 500, '500 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 750, '750 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 1000, '1000 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 1500, '1500 ' . JText::_('FLEXI_ITEMS')); $bind_limits[] = JHTML::_('select.option', 2000, '2000 ' . JText::_('FLEXI_ITEMS')); $lists['bind_limits'] = JHTML::_('select.genericlist', $bind_limits, 'bind_limit', 'size="1" class="use_select2_lib"', 'value', 'text', $bind_limit, 'bind_limit'); // search filter $lists['search'] = $search; // search id $lists['filter_id'] = $filter_id; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // filter ordering if (!$filter_order_type) { $ordering = $lists['order'] == 'i.ordering'; } else { $ordering = $lists['order'] == 'catsordering'; } if (FLEXI_FISH || FLEXI_J16GE) { //build languages filter $lists['filter_lang'] = flexicontent_html::buildlanguageslist('filter_lang', 'class="use_select2_lib" onchange="submitform();" size="1" ', $filter_lang, 2); } // filter by item usage a specific file if ($fileid_to_itemids && count($fileid_to_itemids)) { $files_data = $model->getFileData(array_keys($fileid_to_itemids)); $file_options = array(); $file_options[] = JHTML::_('select.option', '', ' -- ' . JText::_('FLEXI_SELECT') . ' ' . JText::_('FLEXI_FILE') . ' -- '); foreach ($files_data as $_file) { $file_options[] = JHTML::_('select.option', $_file->id, $_file->altname); } flexicontent_html::loadFramework('select2'); $lists['filter_fileid'] = JHTML::_('select.genericlist', $file_options, 'filter_fileid', 'size="1" class="use_select2_lib" onchange="submitform();"', 'value', 'text', $filter_fileid); } //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('filter_stategrp', $filter_stategrp); $this->assignRef('filter_catsinstate', $filter_catsinstate); $this->assignRef('db', $db); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('itemCats', $itemCats); $this->assignRef('extra_fields', $extraCols); if ($enable_translation_groups) { $this->assignRef('lang_assocs', $langAssocs); } if (FLEXI_FISH || FLEXI_J16GE) { $this->assignRef('langs', $langs); } $this->assignRef('cid', $cid); $this->assignRef('pagination', $pagination); $this->assignRef('ordering', $ordering); $this->assignRef('CanOrder', $CanOrder); $this->assignRef('CanCats', $CanCats); $this->assignRef('CanAccLvl', $CanAccLvl); $this->assignRef('unassociated', $unassociated); $this->assignRef('badcatitems', $badcatitems); // filters $this->assignRef('filter_id', $filter_id); $this->assignRef('filter_state', $filter_state); $this->assignRef('filter_authors', $filter_authors); $this->assignRef('filter_type', $filter_type); $this->assignRef('filter_cats', $filter_cats); $this->assignRef('filter_subcats', $filter_subcats); $this->assignRef('filter_catsinstate', $filter_catsinstate); $this->assignRef('filter_order_type', $filter_order_type); $this->assignRef('filter_order', $filter_order); $this->assignRef('filter_lang', $filter_lang); $this->assignRef('filter_fileid', $filter_fileid); $this->assignRef('inline_ss_max', $inline_ss_max); $this->assignRef('scope', $scope); $this->assignRef('search', $search); $this->assignRef('date', $date); $this->assignRef('startdate', $startdate); $this->assignRef('enddate', $enddate); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } parent::display($tpl); if ($print_logging_info) { @($fc_run_times['template_render'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } }
function display($tpl = null) { $mainframe = JFactory::getApplication(); //initialise variables $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $context = 'com_flexicontent'; $task = JRequest::getVar('task', ''); $cid = JRequest::getVar('cid', array()); $cparams = JComponentHelper::getParams('com_flexicontent'); $this->setLayout('import'); //initialise variables $user = JFactory::getUser(); $document = JFactory::getDocument(); $context = 'com_flexicontent'; $has_zlib = version_compare(PHP_VERSION, '5.4.0', '>='); FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); JHTML::_('behavior.tooltip'); //add css 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 filter vars $filter_order = $mainframe->getUserStateFromRequest($context . '.import.filter_order', 'filter_order', '', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($context . '.import.filter_order_Dir', 'filter_order_Dir', '', 'word'); // Get session information $session = JFactory::getSession(); $conf = $session->get('csvimport_config', "", 'flexicontent'); $conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : ""); $lineno = $session->get('csvimport_lineno', 999999, 'flexicontent'); $session->set('csvimport_parse_log', null, 'flexicontent'); // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanImport'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_IMPORT'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'import'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $toolbar = JToolBar::getInstance('toolbar'); if (!empty($conf)) { if ($task != 'processcsv') { $ctrl_task = FLEXI_J16GE ? 'import.processcsv' : 'processcsv'; $import_btn_title = empty($lineno) ? 'FLEXI_IMPORT_START_TASK' : 'FLEXI_IMPORT_CONTINUE_TASK'; JToolBarHelper::custom($ctrl_task, 'save.png', 'save.png', $import_btn_title, $list_check = false); } $ctrl_task = FLEXI_J16GE ? 'import.clearcsv' : 'clearcsv'; JToolBarHelper::custom($ctrl_task, 'cancel.png', 'cancel.png', 'FLEXI_IMPORT_CLEAR_TASK', $list_check = false); } else { $ctrl_task = FLEXI_J16GE ? 'import.initcsv' : 'initcsv'; JToolBarHelper::custom($ctrl_task, 'import.png', 'import.png', 'FLEXI_IMPORT_PREPARE_TASK', $list_check = false); $ctrl_task = FLEXI_J16GE ? 'import.testcsv' : 'testcsv'; JToolBarHelper::custom($ctrl_task, 'test.png', 'test.png', 'FLEXI_IMPORT_TEST_FILE_FORMAT', $list_check = false); } //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'); } if (!empty($conf) && $task == 'processcsv') { $this->assignRef('conf', $conf); parent::display('process'); return; } // Get types $query = 'SELECT id, name' . ' FROM #__flexicontent_types' . ' WHERE published = 1' . ' ORDER BY name ASC'; $db->setQuery($query); $types = $db->loadObjectList('id'); // Get Languages $languages = FLEXI_FISH || FLEXI_J16GE ? FLEXIUtilities::getLanguages('code') : array(); // Get categories global $globalcats; $categories = $globalcats; if (!empty($conf)) { $this->assignRef('conf', $conf); $this->assignRef('cparams', $cparams); $this->assignRef('types', $types); $this->assignRef('languages', $languages); $this->assignRef('categories', $globalcats); parent::display('list'); return; } // ****************** // Create form fields // ****************** $lists['type_id'] = flexicontent_html::buildtypesselect($types, 'type_id', '', true, 'class="fcfield_selectval" size="1"', 'type_id'); $actions_allowed = array('core.create'); // Creating categorories tree for item assignment, we use the 'create' privelege // build the secondary categories select list $class = "fcfield_selectmulval"; $attribs = 'multiple="multiple" size="10" class="' . $class . '"'; $fieldname = FLEXI_J16GE ? 'seccats[]' : 'seccats[]'; $lists['seccats'] = flexicontent_cats::buildcatselect($categories, $fieldname, '', false, $attribs, false, true, $actions_allowed, $require_all = true); // build the main category select list $attribs = 'class="fcfield_selectval"'; $fieldname = FLEXI_J16GE ? 'maincat' : 'maincat'; $lists['maincat'] = flexicontent_cats::buildcatselect($categories, $fieldname, '', 2, $attribs, false, true, $actions_allowed); /* // build the main category select list $lists['maincat'] = flexicontent_cats::buildcatselect($categories, 'maincat', '', 0, 'class="inputbox" size="10"', false, false); // build the secondary categories select list $lists['seccats'] = flexicontent_cats::buildcatselect($categories, 'seccats[]', '', 0, 'class="inputbox" multiple="multiple" size="10"', false, false); */ //build languages list // Retrieve author configuration $db->setQuery('SELECT author_basicparams FROM #__flexicontent_authors_ext WHERE user_id = ' . $user->id); if ($authorparams = $db->loadResult()) { $authorparams = FLEXI_J16GE ? new JRegistry($authorparams) : new JParameter($authorparams); } $allowed_langs = !$authorparams ? null : $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 if (FLEXI_FISH || FLEXI_J16GE) { $default_lang = $cparams->get('import_lang', '*'); $lists['languages'] = flexicontent_html::buildlanguageslist('language', '', $default_lang, 6, $allowed_langs, $published_only = true); } else { $default_lang = flexicontent_html::getSiteDefaultLang(); $_langs[] = JHTML::_('select.option', $default_lang, JText::_('Default') . ' (' . flexicontent_html::getSiteDefaultLang() . ')'); $lists['languages'] = JHTML::_('select.radiolist', $_langs, 'language', $class = '', 'value', 'text', $default_lang); } $default_state = $cparams->get('import_state', 1); $lists['states'] = flexicontent_html::buildstateslist('state', '', $default_state, 2); // Ignore warnings because component may not be installed $warnHandlers = JERROR::getErrorHandling(E_WARNING); JERROR::setErrorHandling(E_WARNING, 'ignore'); if (FLEXI_J30GE) { // J3.0+ adds an warning about component not installed, commented out ... till time ... $fleximport_comp_enabled = false; //JComponentHelper::isEnabled('com_fleximport'); } else { $fleximport_comp = JComponentHelper::getComponent('com_fleximport', true); $fleximport_comp_enabled = $fleximport_comp && $fleximport_comp->enabled; } // Reset the warning handler(s) foreach ($warnHandlers as $mode) { JERROR::setErrorHandling(E_WARNING, $mode); } if ($fleximport_comp_enabled) { $fleximport = JText::sprintf('FLEXI_FLEXIMPORT_INSTALLED', JText::_('FLEXI_FLEXIMPORT_INFOS')); } else { $fleximport = JText::sprintf('FLEXI_FLEXIMPORT_NOT_INSTALLED', JText::_('FLEXI_FLEXIMPORT_INFOS')); } // ******************************************************************************** // 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('lists', $lists); $this->assignRef('cid', $cid); $this->assignRef('user', $user); $this->assignRef('fleximport', $fleximport); $this->assignRef('cparams', $cparams); $this->assignRef('file_fields', $file_fields); parent::display($tpl); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); // Get data from the model $genstats = $this->get('Generalstats'); $popular = $this->get('Popular'); $rating = $this->get('Rating'); $worstrating = $this->get('WorstRating'); $favoured = $this->get('Favoured'); $statestats = $this->get('Statestats'); $votesstats = $this->get('Votesstats'); $creators = $this->get('Creators'); $editors = $this->get('Editors'); //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 toolbar // ************************** FLEXISubmenu('CanStats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_STATISTICS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'stats'); $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'); } //Load pane behavior if (!FLEXI_J16GE) { jimport('joomla.html.pane'); $pane = JPane::getInstance('Tabs'); $this->assignRef('pane', $pane); } $this->assignRef('genstats', $genstats); $this->assignRef('popular', $popular); $this->assignRef('rating', $rating); $this->assignRef('worstrating', $worstrating); $this->assignRef('favoured', $favoured); $this->assignRef('statestats', $statestats); $this->assignRef('votesstats', $votesstats); $this->assignRef('creators', $creators); $this->assignRef('editors', $editors); parent::display($tpl); }
/** * Creates the Filemanagerview * * @since 1.0 */ function display($tpl = null) { flexicontent_html::loadJQuery(); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); // Load the form validation behavior JHTML::_('behavior.formvalidation'); //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $params = JComponentHelper::getParams('com_flexicontent'); //$authorparams = flexicontent_db::getUserConfig($user->id); $langs = FLEXIUtilities::getLanguages('code'); //get vars $filter_order = $app->getUserStateFromRequest($option . '.filemanager.filter_order', 'filter_order', 'f.filename', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.filemanager.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter = $app->getUserStateFromRequest($option . '.filemanager.filter', 'filter', 1, 'int'); $filter_lang = $app->getUserStateFromRequest($option . '.filemanager.filter_lang', 'filter_lang', '', 'string'); $filter_uploader = $app->getUserStateFromRequest($option . '.filemanager.filter_uploader', 'filter_uploader', 0, 'int'); $filter_url = $app->getUserStateFromRequest($option . '.filemanager.filter_url', 'filter_url', '', 'word'); $filter_secure = $app->getUserStateFromRequest($option . '.filemanager.filter_secure', 'filter_secure', '', 'word'); $filter_ext = $app->getUserStateFromRequest($option . '.filemanager.filter_ext', 'filter_ext', '', 'alnum'); $search = $app->getUserStateFromRequest($option . '.filemanager.search', 'search', '', 'string'); $filter_item = $app->getUserStateFromRequest($option . '.filemanager.item_id', 'item_id', 0, 'int'); $folder_mode = 0; $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //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 toolbar // ************************** FLEXISubmenu('CanFiles'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FILEMANAGER'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'files'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar if (FLEXI_J16GE) { JToolBarHelper::deleteList('Are you sure?', 'filemanager.remove'); } else { JToolBarHelper::deleteList(); } 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'); } // *********************** // Get data from the model // *********************** $model = $this->getModel(); if (!$folder_mode) { $rows = $this->get('Data'); } else { // TODO MORE ... } $pagination = $this->get('Pagination'); //$users = $this->get('Users'); // Get item using at least one file (-of- the currently listed files) /*$items_single = $model->getItemsSingleprop( array('file','minigallery') ); $items_multi = $model->getItemsMultiprop ( $field_props=array('image'=>'originalname'), $value_props=array('image'=>'filename') ); $items = array(); foreach ($items_single as $item_id => $_item) $items[$item_id] = $_item; foreach ($items_multi as $item_id => $_item) $items[$item_id] = $_item; ksort($items);*/ $assigned_fields_labels = array('image' => 'image/gallery', 'file' => 'file', 'minigallery' => 'minigallery'); $assigned_fields_icons = array('image' => 'picture_link', 'file' => 'page_link', 'minigallery' => 'film_link'); /***************** ** BUILD LISTS ** *****************/ $lists = array(); // ** FILE UPLOAD FORM ** // Build languages list //$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed',null); //$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs); $display_file_lang_as = $params->get('display_file_lang_as', 3); $allowed_langs = null; if (FLEXI_FISH || FLEXI_J16GE) { $lists['file-lang'] = flexicontent_html::buildlanguageslist('file-lang', '', '*', $display_file_lang_as, $allowed_langs, $published_only = false); } else { $lists['file-lang'] = flexicontent_html::getSiteDefaultLang() . '<input type="hidden" name="file-lang" value="' . flexicontent_html::getSiteDefaultLang() . '" />'; } /************* ** FILTERS ** *************/ // language filter $lists['language'] = flexicontent_html::buildlanguageslist('filter_lang', 'class="use_select2_lib" onchange="submitform();" size="1" ', $filter_lang, 2); // search $lists['search'] = $search; //search filter $filters = array(); $filters[] = JHTML::_('select.option', '1', JText::_('FLEXI_FILENAME')); $filters[] = JHTML::_('select.option', '2', JText::_('FLEXI_FILE_TITLE')); $lists['filter'] = JHTML::_('select.genericlist', $filters, 'filter', 'size="1" class="use_select2_lib"', 'value', 'text', $filter); //build url/file filterlist $url = array(); $url[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FILES') . ' -'); $url[] = JHTML::_('select.option', 'F', JText::_('FLEXI_FILE')); $url[] = JHTML::_('select.option', 'U', JText::_('FLEXI_URL')); $lists['url'] = JHTML::_('select.genericlist', $url, 'filter_url', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_url); //item lists /*$items_list = array(); $items_list[] = JHTML::_('select.option', '', '- '. JText::_( 'FLEXI_FILTER_BY_ITEM' ) .' -' ); foreach($items as $item) { $items_list[] = JHTML::_('select.option', $item->id, JText::_( $item->title ) . ' (#' . $item->id . ')' ); } $lists['item_id'] = JHTML::_('select.genericlist', $items_list, 'item_id', 'size="1" class="use_select2_lib" onchange="submitform( );"', 'value', 'text', $filter_item );*/ $lists['item_id'] = '<input type="text" name="item_id" size="1" class="inputbox" onchange="submitform( );" value="' . $filter_item . '" />'; //build secure/media filterlist $secure = array(); $secure[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_DIRECTORIES') . ' -'); $secure[] = JHTML::_('select.option', 'S', JText::_('FLEXI_SECURE_DIR')); $secure[] = JHTML::_('select.option', 'M', JText::_('FLEXI_MEDIA_DIR')); $lists['secure'] = JHTML::_('select.genericlist', $secure, 'filter_secure', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_secure); //build ext filterlist $lists['ext'] = flexicontent_html::buildfilesextlist('filter_ext', 'class="use_select2_lib" size="1" onchange="submitform( );"', $filter_ext); //build uploader filterlist $lists['uploader'] = flexicontent_html::builduploaderlist('filter_uploader', 'class="use_select2_lib" size="1" onchange="submitform( );"', $filter_uploader); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // uploadstuff if ($params->get('enable_flash', 1) && !FLEXI_J30GE) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ window.location.reload(); }')); } jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); //assign data to template $this->assignRef('params', $params); $this->assign('require_ftp', $ftp); //Load pane behavior if (!FLEXI_J16GE) { jimport('joomla.html.pane'); $pane = JPane::getInstance('Tabs'); $this->assignRef('pane', $pane); } $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); $this->assignRef('CanFiles', $perms->CanFiles); $this->assignRef('CanUpload', $perms->CanUpload); $this->assignRef('CanViewAllFiles', $perms->CanViewAllFiles); $this->assignRef('assigned_fields_labels', $assigned_fields_labels); $this->assignRef('assigned_fields_icons', $assigned_fields_icons); $this->assignRef('langs', $langs); parent::display($tpl); }
function display($tpl = null) { $layout = JRequest::getVar('layout', 'default'); if ($layout == 'indexer') { $this->indexer($tpl); return; } $app = JFactory::getApplication(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $db = JFactory::getDBO(); $filter_order = $app->getUserStateFromRequest($option . '.search.filter_order', 'filter_order', 'a.title', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.search.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $filter_fieldtype = $app->getUserStateFromRequest($option . '.fields.filter_fieldtype', 'filter_fieldtype', '', 'word'); $filter_itemtype = $app->getUserStateFromRequest($option . '.fields.filter_itemtype', 'filter_itemtype', '', 'int'); $filter_itemstate = $app->getUserStateFromRequest($option . '.fields.filter_itemstate', 'filter_itemstate', '', 'word'); $search_index = $app->getUserStateFromRequest($option . '.search.search_index', 'search_index', '', 'string'); $search_index = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search_index))) : $db->getEscaped(trim(JString::strtolower($search_index))); $search_itemtitle = $app->getUserStateFromRequest($option . '.search.search_itemtitle', 'search_itemtitle', '', 'string'); $search_itemid = $app->getUserStateFromRequest($option . '.search.search_itemid', 'search_itemid', '', 'string'); $search_itemid = strlen($search_itemid) ? (int) $search_itemid : ''; $filter_indextype = $app->getUserStateFromRequest($option . '.search.filter_indextype', 'filter_indextype', 'advanced', 'word'); $f_active['filter_fieldtype'] = (bool) $filter_fieldtype; $f_active['filter_itemtype'] = (bool) $filter_itemtype; $f_active['filter_itemstate'] = (bool) $filter_itemstate; $f_active['search_index'] = strlen($search_index); $f_active['search_itemtitle'] = strlen($search_itemtitle); $f_active['search_itemid'] = (bool) $search_itemid; //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'); } } // Create Submenu and check access FLEXISubmenu('CanIndex'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_SEARCH_INDEX'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, FLEXI_J16GE ? 'searchtext.png' : 'searchindex'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->setToolbar(); $types = $this->get('Typeslist'); $fieldtypes = $this->get('Fieldtypes'); // Build select lists $lists = array(); //build backend visible filter $fftypes = array(); $fftypes[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FIELDS_TYPE') . ' -'); $fftypes[] = JHTML::_('select.option', 'C', JText::_('FLEXI_CORE_FIELDS')); $fftypes[] = JHTML::_('select.option', 'NC', JText::_('FLEXI_NON_CORE_FIELDS')); foreach ($fieldtypes as $field_type => $ftdata) { $fftypes[] = JHTML::_('select.option', $field_type, '-' . $ftdata->assigned . '- ' . $field_type); } $lists['filter_fieldtype'] = JHTML::_('select.genericlist', $fftypes, 'filter_fieldtype', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_fieldtype); //build type select list $lists['filter_itemtype'] = flexicontent_html::buildtypesselect($types, 'filter_itemtype', $filter_itemtype, true, 'class="inputbox" size="1" onchange="submitform( );"', 'filter_itemtype'); //publish unpublished filter $ffstate = array(); $ffstate[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_SELECT_STATE') . ' -'); $ffstate[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $ffstate[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); $lists['filter_itemstate'] = JHTML::_('select.genericlist', $ffstate, 'filter_itemstate', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_itemstate); // build filter index type record listing //$itn['basic'] = JText::_( 'FLEXI_INDEX_BASIC' ); $itn['advanced'] = JText::_('FLEXI_INDEX_ADVANCED'); $indextypes = array(); //foreach ($itn as $i => $v) $indextypes[] = JHTML::_('select.option', $i, $v); //$lists['filter_indextype'] = JHTML::_('select.radiolist', $indextypes, 'filter_indextype', 'size="1" class="inputbox" onchange="submitform();"', 'value', 'text', $filter_indextype ); $lists['filter_indextype'] = ''; foreach ($itn as $i => $v) { $checked = $filter_indextype == $i ? ' checked="checked" ' : ''; $lists['filter_indextype'] .= '<input type="radio" onchange="submitform();" class="inputbox" size="1" ' . $checked . ' value="' . $i . '" id="filter_indextype' . $i . '" name="filter_indextype" />'; $lists['filter_indextype'] .= '<label class="" id="filter_indextype' . $i . '-lbl" for="filter_indextype' . $i . '">' . $v . '</label>'; } // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search index & item title filter $lists['search_index'] = $search_index; $lists['search_itemtitle'] = $search_itemtitle; $lists['search_itemid'] = $search_itemid; $data = $this->get('Data'); // MUST BE BEFORE getCount and getPagination because it also calculates total rows $total = $this->get('Count'); $pagination = $this->get('Pagination'); $limitstart = $this->get('LimitStart'); $js = "window.addEvent('domready', function(){"; if ($filter_fieldtype) { $js .= "\$\$('.col_fieldtype').each(function(el){ el.addClass('yellow'); });"; } if ($search_index) { $js .= "\$\$('.col_search_index').each(function(el){ el.addClass('yellow'); });"; } $js .= "});"; $document->addScriptDeclaration($js); $query = "SHOW VARIABLES LIKE '%ft_min_word_len%'"; $db->setQuery($query); $_dbvariable = $db->loadObject(); $ft_min_word_len = (int) @$_dbvariable->Value; $notice_ft_min_word_len = $app->getUserStateFromRequest($option . '.fields.notice_ft_min_word_len', 'notice_ft_min_word_len', 0, 'int'); //if ( $cparams->get('show_usability_messages', 1) ) // Important usability messages //{ if ($notice_ft_min_word_len < 2) { $app->setUserState($option . '.fields.notice_ft_min_word_len', $notice_ft_min_word_len + 1); $app->enqueueMessage("NOTE : Database limits minimum search word length (ft_min_word_len) to " . $ft_min_word_len, 'notice'); //$app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } //} $this->assignRef('lists', $lists); $this->assignRef('pagination', $pagination); $this->assignRef('data', $data); $this->assignRef('total', $total); $this->assignRef('limitstart', $limitstart); $this->assignRef('f_active', $f_active); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $user = JFactory::getUser(); $acl = JFactory::getACL(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $filter_order = $app->getUserStateFromRequest("{$option}.authors.filter_order", 'filter_order', 'a.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest("{$option}.authors.filter_order_Dir", 'filter_order_Dir', '', 'word'); $filter_itemscount = $app->getUserStateFromRequest("{$option}.authors.filter_itemscount", 'filter_itemscount', '', 'int'); $filter_usergrp = $app->getUserStateFromRequest("{$option}.authors.filter_usergrp", 'filter_usergrp', '', 'string'); $filter_logged = $app->getUserStateFromRequest("{$option}.authors.filter_logged", 'filter_logged', '', 'int'); $date = $app->getUserStateFromRequest("{$option}.authors.date", 'date', 1, 'int'); $startdate = $app->getUserStateFromRequest("{$option}.authors.startdate", 'startdate', '', 'cmd'); $enddate = $app->getUserStateFromRequest("{$option}.authors.enddate", 'enddate', '', 'cmd'); if ($startdate == JText::_('FLEXI_FROM')) { $startdate = $app->setUserState("{$option}.authors.startdate", ''); } if ($enddate == JText::_('FLEXI_TO')) { $enddate = $app->setUserState("{$option}.authors.enddate", ''); } $filter_id = $app->getUserStateFromRequest("{$option}.authors.filter_id", 'filter_id', '', 'int'); $search = $app->getUserStateFromRequest("{$option}.authors.search", 'search', '', 'string'); if (strpos($search, '"') !== false) { $search = str_replace(array('=', '<'), '', $search); } $search = JString::strtolower($search); if ($cparams->get('show_usability_messages', 1)) { $notice_author_with_items_only = $app->getUserStateFromRequest($option . '.users.notice_author_with_items_only', 'notice_author_with_items_only', 0, 'int'); if (!$notice_author_with_items_only) { $app->setUserState($option . '.users.notice_author_with_items_only', 1); $app->enqueueMessage(JText::_('FLEXI_BY_DEFAULT_ONLY_AUTHORS_WITH_ITEMS_SHOWN'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } //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'); } } $js = "window.addEvent('domready', function(){"; if ($filter_usergrp) { $js .= "\$\$('.col_usergrp').each(function(el){ el.addClass('yellow'); });"; } if ($filter_logged) { $js .= "\$\$('.col_logged').each(function(el){ el.addClass('yellow'); });"; } if ($filter_id) { $js .= "\$\$('.col_id').each(function(el){ el.addClass('yellow'); });"; } if ($startdate || $enddate) { if ($date == 1) { $js .= "\$\$('.col_registered').each(function(el){ el.addClass('yellow'); });"; } else { if ($date == 2) { $js .= "\$\$('.col_visited').each(function(el){ el.addClass('yellow'); });"; } } } if ($filter_itemscount) { $js .= "\$\$('.col_itemscount').each(function(el){ el.addClass('yellow'); });"; } else { $js .= "\$\$('.col_itemscount').each(function(el){ el.removeClass('yellow'); });"; } if ($search) { $js .= "\$\$('.col_title').each(function(el){ el.addClass('yellow'); });"; } else { $js .= "\$\$('.col_title').each(function(el){ el.removeClass('yellow'); });"; } $js .= "});"; $document->addScriptDeclaration($js); // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanAuthors'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_AUTHORS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'authors'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $contrl = FLEXI_J16GE ? "users." : ""; JToolBarHelper::custom('logout', 'cancel.png', 'cancel_f2.png', 'Logout'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); JToolBarHelper::divider(); JToolBarHelper::spacer(); if (!FLEXI_J16GE) { JToolBarHelper::help('screen.users'); } else { JToolBarHelper::help('JHELP_USERS_USER_MANAGER'); } 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'); } $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = $app->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int'); $where = array(); $having = array(); $extra_joins = array(); if (isset($search) && $search != '') { $searchEscaped = FLEXI_J16GE ? $db->escape($search, true) : $db->getEscaped($search, true); $searchEscaped = $db->Quote('%' . $searchEscaped . '%', false); $where[] = 'a.username LIKE ' . $searchEscaped . ' OR a.email LIKE ' . $searchEscaped . ' OR a.name LIKE ' . $searchEscaped; } // visited date filtering if ($date == 1) { if ($startdate && !$enddate) { // from only $where[] = ' a.registerDate >= ' . $db->Quote($startdate); } if (!$startdate && $enddate) { // to only $where[] = ' a.registerDate <= ' . $db->Quote($enddate); } if ($startdate && $enddate) { // date range $where[] = '( a.registerDate >= ' . $db->Quote($startdate) . ' AND a.registerDate <= ' . $db->Quote($enddate) . ' )'; } } if ($date == 2) { if ($startdate && !$enddate) { // from only $where[] = ' a.lastvisitDate >= ' . $db->Quote($startdate); } if (!$startdate && $enddate) { // to only $where[] = ' a.lastvisitDate <= ' . $db->Quote($enddate); } if ($startdate && $enddate) { // date range $where[] = '( a.lastvisitDate >= ' . $db->Quote($startdate) . ' AND a.lastvisitDate <= ' . $db->Quote($enddate) . ' )'; } } if ($filter_id) { $where[] = 'a.id = ' . $filter_id; } if ($filter_usergrp) { if (!FLEXI_J16GE) { if ($filter_usergrp == 'Public Frontend') { $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' '; } else { if ($filter_usergrp == 'Public Backend') { $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' '; } else { $where[] = 'a.usertype = LOWER( ' . $db->Quote($filter_usergrp) . ' ) '; } } } else { // Added as right join, see query bellow $extra_joins[] = ' RIGHT JOIN #__user_usergroup_map AS ug ON ug.user_id = a.id AND ug.group_id=' . $filter_usergrp; } } if ($filter_logged == 1) { $where[] = 's.userid IS NOT NULL'; } else { if ($filter_logged == 2) { $where[] = 's.userid IS NULL'; } } if (!$filter_itemscount) { $having[] = ' itemscount > 0 '; } else { if ($filter_itemscount == 1) { $having[] = ' itemscount = 0 '; } } // exclude any child group id's for this user, this applicable only in J1.5, and not for J16/J1.7/J2.5+ if (!FLEXI_J16GE) { $pgids = $acl->get_group_children($user->get('gid'), 'ARO', 'RECURSE'); if (is_array($pgids) && count($pgids) > 0) { JArrayHelper::toInteger($pgids); $where[] = 'a.gid NOT IN (' . implode(',', $pgids) . ')'; } } // ensure filter_order has a valid value. $allowed_order_cols = array('a.name', 'itemscount', 'a.username', 'loggedin', 'a.block', 'groupname', 'a.email', 'a.lastvisitDate', 'a.lastvisitDate', 'a.id'); if (!in_array($filter_order, $allowed_order_cols)) { $filter_order = 'a.name'; } if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) { $filter_order_Dir = ''; } $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir; $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : ''; $having = count($having) ? ' HAVING (' . implode(') AND (', $having) . ')' : ''; $extra_joins = count($extra_joins) ? implode(' ', $extra_joins) : ''; // Do main query to get the authors $query = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, s.userid IS NOT NULL AS loggedin' . ', (SELECT COUNT(*) FROM #__content AS i WHERE i.created_by = a.id) AS itemscount ' . (!FLEXI_J16GE ? ', g.name AS groupname' : '') . ' FROM #__users AS a' . (!FLEXI_J16GE ? ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' : '') . (!FLEXI_J16GE ? ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' : '') . (!FLEXI_J16GE ? ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' : '') . ' LEFT JOIN #__flexicontent_authors_ext AS ue ON a.id = ue.user_id' . ' LEFT JOIN #__session AS s ON s.userid = a.id' . $extra_joins . $where . $having . $orderby; $db->setQuery($query, $limitstart, $limit); if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $db->loadObjectList(); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } if ($db->getErrorMsg()) { echo $db->getErrorMsg(); } // Get total and create pagination controls $db->setQuery("SELECT FOUND_ROWS()"); $total = $db->loadResult(); if (!$total) { echo $db->getErrorMsg(); } // Create pagination jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); // DB Query (J2.5 only) to get -mulitple- user group ids for all authors, // this is needed because user-To-usergoup mapping are stored in separate table if (FLEXI_J16GE) { $user_ids = array(); foreach ($rows as $row) { $row->usergroups = array(); $user_ids[] = $row->id; } $query = 'SELECT user_id, group_id FROM #__user_usergroup_map ' . (count($user_ids) ? 'WHERE user_id IN (' . implode(',', $user_ids) . ')' : ''); $db->setQuery($query); $ugdata_arr = $db->loadObjectList(); foreach ($ugdata_arr as $ugdata) { $usergroups[$ugdata->user_id][] = $ugdata->group_id; } foreach ($rows as $row) { $row->usergroups = $usergroups[$row->id]; } } // get list of Groups for dropdown filter if (FLEXI_J16GE) { $query = 'SELECT *, id AS value, title AS text FROM #__usergroups'; } else { $query = 'SELECT *, name AS value, name AS text FROM #__core_acl_aro_groups WHERE name != "ROOT" AND name != "USERS"'; } $db->setQuery($query); $usergroups = $db->loadObjectList('id'); $types[] = JHTML::_('select.option', '', '- ' . JText::_('Select Group') . ' -'); foreach ($usergroups as $ugrp) { $types[] = JHTML::_('select.option', $ugrp->value, JText::_($ugrp->text)); } $itemscount_options[] = JHTML::_('select.option', '', '- ' . JText::_('One or more') . ' -'); $itemscount_options[] = JHTML::_('select.option', 1, JText::_('None')); $itemscount_options[] = JHTML::_('select.option', 2, JText::_('Any number')); $lists['filter_itemscount'] = JHTML::_('select.genericlist', $itemscount_options, 'filter_itemscount', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "{$filter_itemscount}"); $lists['filter_usergrp'] = JHTML::_('select.genericlist', $types, 'filter_usergrp', 'class="inputbox" style="width:auto;" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "{$filter_usergrp}"); // get list of Log Status for dropdown filter $logged[] = JHTML::_('select.option', '', '- ' . JText::_('Select Log Status') . ' -'); $logged[] = JHTML::_('select.option', 1, JText::_('Logged In')); $logged[] = JHTML::_('select.option', 2, JText::_('Logged Out')); $lists['filter_logged'] = JHTML::_('select.genericlist', $logged, 'filter_logged', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "{$filter_logged}"); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // build dates option list $dates = array(); $dates[] = JHTML::_('select.option', '1', JText::_('Registered')); $dates[] = JHTML::_('select.option', '2', JText::_('Last Visit')); $lists['date'] = JHTML::_('select.radiolist', $dates, 'date', 'size="1" class="inputbox"', 'value', 'text', $date); $lists['startdate'] = JHTML::_('calendar', $startdate, 'startdate', 'startdate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '11', 'maxlength' => '20')); $lists['enddate'] = JHTML::_('calendar', $enddate, 'enddate', 'enddate', '%Y-%m-%d', array('class' => 'inputbox', 'size' => '11', 'maxlength' => '20')); // search filter $lists['search'] = $search; // search id $lists['filter_id'] = $filter_id; $this->assignRef('lists', $lists); $this->assignRef('items', $rows); $this->assignRef('usergroups', $usergroups); $this->assignRef('pagination', $pagination); // filters $this->assignRef('filter_id', $filter_id); $this->assignRef('filter_itemscount', $filter_itemscount); $this->assignRef('filter_usergrp', $filter_usergrp); $this->assignRef('filter_logged', $filter_logged); $this->assignRef('search', $search); $this->assignRef('filter_id', $filter_id); $this->assignRef('date', $date); $this->assignRef('startdate', $startdate); $this->assignRef('enddate', $enddate); parent::display($tpl); }
function display($tpl = null) { // *********** // Batch tasks // *********** $app = JFactory::getApplication(); $jinput = $app->input; $layout = $jinput->get('layout', '', 'cmd'); if ($layout == 'indexer') { $this->indexer($tpl); return; } // ******************** // Initialise variables // ******************** $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // Get filter vars $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); $filter_indextype = $model->getState('filter_indextype'); $isADV = $filter_indextype == 'advanced'; $filter_fieldtype = $model->getState('filter_fieldtype'); $filter_itemtype = $model->getState('filter_itemtype'); $filter_itemstate = $model->getState('filter_itemstate'); if ($filter_fieldtype) { $count_filters++; } if ($filter_itemtype) { $count_filters++; } if ($filter_itemstate) { $count_filters++; } $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); $search_itemtitle = $model->getState('search_itemtitle'); $search_itemid = $model->getState('search_itemid'); $search_itemid = !empty($search_itemid) ? (int) $search_itemid : ''; if ($search_itemtitle) { $count_filters++; } if ($search_itemid) { $count_filters++; } $filter_indextype = $model->getState('filter_indextype'); $f_active['filter_fieldtype'] = (bool) $filter_fieldtype; $f_active['filter_itemtype'] = (bool) $filter_itemtype; $f_active['filter_itemstate'] = (bool) $filter_itemstate; $f_active['search'] = strlen($search); $f_active['search_itemtitle'] = strlen($search_itemtitle); $f_active['search_itemid'] = (bool) $search_itemid; // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); $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('CanIndex'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_SEARCH_INDEX'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, FLEXI_J16GE ? 'searchtext.png' : 'searchindex'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->setToolbar(); $types = $this->get('Typeslist'); $fieldtypes = flexicontent_db::getFieldTypes($_grouped = false, $_usage = true, $_published = false); // Build select lists $lists = array(); //build backend visible filter if ($isADV) { $fftypes = array(); $fftypes[] = JHTML::_('select.option', '', '-'); $fftypes[] = JHTML::_('select.option', 'C', JText::_('FLEXI_CORE_FIELDS')); $fftypes[] = JHTML::_('select.option', 'NC', JText::_('FLEXI_NON_CORE_FIELDS')); foreach ($fieldtypes as $field_type => $ftdata) { $fftypes[] = JHTML::_('select.option', $field_type, '-' . $ftdata->assigned . '- ' . $field_type); } $lists['filter_fieldtype'] = ($filter_fieldtype || 1 ? '<label class="label">' . JText::_('FLEXI_FIELD_TYPE') . '</label>' : '') . JHTML::_('select.genericlist', $fftypes, 'filter_fieldtype', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_fieldtype); } //build type select list $lists['filter_itemtype'] = ($filter_itemtype || 1 ? '<label class="label">' . JText::_('FLEXI_TYPE') . '</label>' : '') . flexicontent_html::buildtypesselect($types, 'filter_itemtype', $filter_itemtype, '-', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'filter_itemtype'); //publish unpublished filter $ffstates = array(); $ffstates[] = JHTML::_('select.option', '', '-'); $ffstates[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $ffstates[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); $lists['filter_itemstate'] = ($filter_itemstate || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $ffstates, 'filter_itemstate', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_itemstate); // build filter index type record listing $itn['basic'] = JText::_('FLEXI_INDEX_BASIC'); $itn['advanced'] = JText::_('FLEXI_INDEX_ADVANCED'); $indextypes = array(); //foreach ($itn as $i => $v) $indextypes[] = JHTML::_('select.option', $i, $v); //$lists['filter_indextype'] = JHTML::_('select.radiolist', $indextypes, 'filter_indextype', 'size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_indextype ); $lists['filter_indextype'] = ''; foreach ($itn as $i => $v) { $checked = $filter_indextype == $i ? ' checked="checked" ' : ''; $lists['filter_indextype'] .= '<input type="radio" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" class="inputbox" size="1" ' . $checked . ' value="' . $i . '" id="filter_indextype' . $i . '" name="filter_indextype" />'; $lists['filter_indextype'] .= '<label class="" id="filter_indextype' . $i . '-lbl" for="filter_indextype' . $i . '">' . $v . '</label>'; } // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search index & item title filter $lists['search'] = $search; $lists['search_itemtitle'] = $search_itemtitle; $lists['search_itemid'] = $search_itemid; $rows = $this->get('Data'); // MUST BE BEFORE getCount and getPagination because it also calculates total rows $total = $this->get('Count'); $pagination = $this->get('Pagination'); $limitstart = $this->get('LimitStart'); $js = "jQuery(document).ready(function(){"; if ($filter_fieldtype) { $js .= "jQuery('.col_fieldtype').each(function(){ jQuery(this).addClass('yellow'); });"; } if ($search) { $js .= "jQuery('.col_search').each(function(){ jQuery(this).addClass('yellow'); });"; } $js .= "});"; $document->addScriptDeclaration($js); $query = "SHOW VARIABLES LIKE '%ft_min_word_len%'"; $db->setQuery($query); $_dbvariable = $db->loadObject(); $ft_min_word_len = (int) @$_dbvariable->Value; $notice_ft_min_word_len = $app->getUserStateFromRequest($option . '.fields.notice_ft_min_word_len', 'notice_ft_min_word_len', 0, 'int'); //if ( $cparams->get('show_usability_messages', 1) ) // Important usability messages //{ $old_add_search_prefix = $app->getUserState('add_search_prefix', null); $add_search_prefix = $cparams->get('add_search_prefix', 0); $app->setUserState('add_search_prefix', $add_search_prefix); if ($old_add_search_prefix !== null && $old_add_search_prefix != $add_search_prefix) { $app->enqueueMessage('Parameter: "Searching small/common words" has changed, please recreate (just once) the search indexes, otherwise text search will not work', 'warning'); } if (!$cparams->get('add_search_prefix', 0)) { if ($ft_min_word_len > 1 && $notice_ft_min_word_len < 10) { $app->setUserState($option . '.fields.notice_ft_min_word_len', $notice_ft_min_word_len + 1); $app->enqueueMessage("NOTE : Database limits minimum search word length (ft_min_word_len) to " . $ft_min_word_len, 'message'); $app->enqueueMessage('Please enable: "Searching small/common words": <a class="btn" href="index.php?option=com_config&view=component&component=com_flexicontent&path=&"><span class="icon-options"></span>Configuration</a> and then click to re-INDEX both search indexes', 'notice'); //$app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } //} $this->assignRef('count_filters', $count_filters); $this->assignRef('lists', $lists); $this->assignRef('pagination', $pagination); $this->assignRef('rows', $rows); $this->assignRef('total', $total); $this->assignRef('limitstart', $limitstart); $this->assignRef('f_active', $f_active); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->assignRef('isADV', $isADV); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { // Initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $use_jquery_sortable = true; $type = JRequest::getVar('type', 'items', '', 'word'); $folder = JRequest::getVar('folder', 'default', '', 'cmd'); $ismodal = JRequest::getVar('ismodal', 'default', '', 'int'); FLEXIUtilities::loadTemplateLanguageFile($folder); //Get data from the model $layout = $this->get('Data'); $conf = $this->get('LayoutConf'); $fields = $this->get('Fields'); $fbypos = $this->get('FieldsByPositions'); $used = $this->get('UsedFields'); $contentTypes = $this->get('TypesList'); //$fieldTypes = $this->get( 'FieldTypesList' ); $fieldTypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = false); // Field types with content type ASSIGNMENT COUNTING // Create CONTENT TYPE SELECTOR foreach ($fields as $field) { $field->type_ids = !empty($field->reltypes) ? explode(",", $field->reltypes) : array(); } $options = array(); $options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL')); foreach ($contentTypes as $contentType) { $options[] = JHTML::_('select.option', $contentType->id, JText::_($contentType->name)); } $fieldname = $elementid = 'content_type__au__'; $attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="use_select2_lib" '; $content_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid); // Create FIELD TYPE SELECTOR $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftypes = array(); $fftypes[] = array('value' => '', 'text' => JText::_('FLEXI_ALL')); //$fftypes[] = array('value'=>'BV', 'text'=>$ALL . JText::_( 'FLEXI_BACKEND_FIELDS' ) ); //$fftypes[] = array('value'=>'C', 'text'=>$ALL . JText::_( 'FLEXI_CORE_FIELDS' ) ); //$fftypes[] = array('value'=>'NC', 'text'=>$ALL . JText::_( 'FLEXI_NON_CORE_FIELDS' )); 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[] = ''; } $fieldname = $elementid = 'field_type__au__'; $attribs = ' class="use_select2_lib" onchange="filterFieldList(\'%s\', \'%s\', \'%s\');"'; $field_type_select = flexicontent_html::buildfieldtypeslist($fftypes, $fieldname, '', $_grouped ? 1 : 0, $attribs, $elementid); if (isset($layout->positions)) { $sort = array(); $jssort = array(); $idsort = array(); $sort[0] = 'sortablecorefields'; $sort[1] = 'sortableuserfields'; $i = 2; $count = -1; foreach ($layout->positions as $pos) { $count++; if (isset($layout->attributes[$count]) && isset($layout->attributes[$count]['readonly'])) { continue; } $sort[$i] = 'sortable-' . $pos; $idsort[$i] = $pos; $i++; } foreach ($idsort as $k => $v) { if ($k > 1) { $jssort[] = 'storeordering(jQuery("#sortable-' . $v . '"))'; } } $positions = implode(',', $idsort); $jssort = implode("; ", $jssort); $sortable_ids = "#" . implode(",#", $sort); $js = "\n\t\t\tjQuery(function() {\n\t\t\t\tmy = jQuery( \"{$sortable_ids}\" ).sortable({\n\t\t\t\t\tconnectWith: \"" . $sortable_ids . "\",\n\t\t\t\t\tupdate: function(event, ui) {\n\t\t\t\t\t\tif(ui.sender) {\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.sender));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.item).parent());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tinitordering();\n\t\t\t});\n\t\t\tfunction storeordering(parent_element) {\n\t\t\t\thidden_id = '#'+jQuery.trim(parent_element.attr('id').replace('sortable-',''));\n\t\t\t\tfields = new Array();\n\t\t\t\ti = 0;\n\t\t\t\tparent_element.children('li').each(function(){\n\t\t\t\t\tfields[i++] = jQuery(this).attr('id').replace('field_', '');\n\t\t\t\t});\n\t\t\t\tjQuery(hidden_id).val(fields.join(','))\n\t\t\t}\n\t\t\t"; $js .= ' var fieldListFilters = new Array( "content_type", "field_type" ); function filterFieldList (containerID, method, group) { var needed_classes = ""; for (i=0; i<fieldListFilters.length; i++) { filter_name = fieldListFilters[i]; var filter_val = jQuery("#" + filter_name + "_" + group).val(); if (filter_val) { needed_classes += "."+filter_name+"_"+filter_val; } } if (needed_classes) { (method=="hide") ? jQuery("#"+containerID).find("li").show().filter(":not("+needed_classes+")").hide() : jQuery("#"+containerID).find("li").css({"color":"red"}).filter(":not("+needed_classes+")").css({"color":"black"}); } else { (method=="hide") ? jQuery("#"+containerID).find("li").show() : jQuery("#"+containerID).find("li").css({"color":"black"}); } } '; $document->addScriptDeclaration($js); } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); $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(); if (!$perms->CanTemplates) { $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS')); } // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanTemplates'); //create the toolbar $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::title(JText::_('FLEXI_EDIT_TEMPLATE'), 'templates'); if (!$ismodal) { JToolBarHelper::apply('templates.apply'); JToolBarHelper::save('templates.save'); JToolBarHelper::cancel('templates.cancel'); } else { JToolBarHelper::apply('templates.apply_modal'); echo $bar->render(); } // ********************************************************************************** // Get Templates and apply Template Parameters values into the form fields structures // ********************************************************************************** if (FLEXI_J16GE) { $jform = new JForm('com_flexicontent.template.category', array('control' => 'jform', 'load_data' => true)); $jform->load($layout->params); $layout->params = $jform; // ... values applied at the template form file } else { $layout->params->loadINI($row->params); } //print_r($layout); //assign data to template //print_r($conf); $this->assignRef('conf', $conf); $this->assignRef('layout', $layout); $this->assignRef('fields', $fields); $this->assignRef('user', $user); $this->assignRef('type', $type); $this->assignRef('folder', $folder); $this->assignRef('jssort', $jssort); $this->assignRef('positions', $positions); $this->assignRef('used', $used); $this->assignRef('fbypos', $fbypos); $this->assignRef('use_jquery_sortable', $use_jquery_sortable); $this->assignRef('content_type_select', $content_type_select); $this->assignRef('field_type_select', $field_type_select); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $option = JRequest::getVar('option'); //initialise variables $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); JHTML::_('behavior.tooltip'); //get vars $filter_order = $mainframe->getUserStateFromRequest($option . '.archive.filter_order', 'filter_order', 'i.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.archive.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . '.archive.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //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'); } } $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanArchives'); //create the toolbar JToolBarHelper::title(JText::_('FLEXI_ITEM_ARCHIVE'), 'archive'); if (FLEXI_J16GE) { JToolBarHelper::unarchiveList('archive.unarchive'); JToolBarHelper::deleteList('Are you sure?', 'archive.remove'); } else { JToolBarHelper::unarchiveList(); JToolBarHelper::deleteList(); } 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'); } //Get data from the model $rows =& $this->get('Data'); $pageNav =& $this->get('Pagination'); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $ordering = $lists['order'] == 'i.ordering'; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pageNav', $pageNav); $this->assignRef('ordering', $ordering); $this->assignRef('user', $user); parent::display($tpl); }
function display($tpl = null) { //initialise variables global $globalcats; $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $view = JRequest::getVar('view'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $order_property = !FLEXI_J16GE ? 'c.ordering' : 'c.lft'; $filter_order = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order', 'filter_order', $order_property, 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.' . $view . '.filter_state', 'filter_state', '', 'string'); $filter_cats = $app->getUserStateFromRequest($option . '.' . $view . '.filter_cats', 'filter_cats', '', 'int'); $filter_level = $app->getUserStateFromRequest($option . '.' . $view . '.filter_level', 'filter_level', '', 'string'); $filter_access = $app->getUserStateFromRequest($option . '.' . $view . '.filter_access', 'filter_access', '', 'string'); if (FLEXI_J16GE) { $filter_language = $app->getUserStateFromRequest($option . '.' . $view . '.filter_language', 'filter_language', '', 'string'); } $search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); // Prepare the document: add css files, etc $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('CanCats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_CATEGORIES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fc_categories'); $document->setTitle($doc_title . ' - ' . $site_title); // ****************** // Create the toolbar // ****************** $js = "window.addEvent('domready', function(){"; $contrl = FLEXI_J16GE ? "categories." : ""; $contrl_singular = FLEXI_J16GE ? "category." : ""; $toolbar = JToolBar::getInstance('toolbar'); // Copy Parameters $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=categories&layout=params&tmpl=component'; 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-params a.toolbar, #toolbar-params 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: 600, y: 440}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'params.png', 'params_f2.png', 'FLEXI_COPY_PARAMS', false); JHtml::_('behavior.modal', '#toolbar-params a.toolbar, #toolbar-params button'); } else { $toolbar->appendButton('Popup', 'params', JText::_('FLEXI_COPY_PARAMS'), str_replace('&', '&', $popup_load_url), 600, 440); } //if (FLEXI_J16GE) // $toolbar->appendButton('Popup', 'move', JText::_('FLEXI_COPY_MOVE'), JURI::base().'index.php?option=com_flexicontent&view=categories&layout=batch&tmpl=component', 800, 440); JToolBarHelper::divider(); $add_divider = false; if (!FLEXI_J16GE || $user->authorise('core.create', 'com_flexicontent')) { $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; } if ($cancreate_cat) { JToolBarHelper::addNew($contrl_singular . 'add'); $add_divider = true; } if (!FLEXI_J16GE || ($user->authorise('core.edit', 'com_flexicontent') || $user->authorise('core.edit.own', 'com_flexicontent'))) { JToolBarHelper::editList($contrl_singular . 'edit'); $add_divider = true; } if (FLEXI_J16GE && $user->authorise('core.admin', 'checkin')) { JToolBarHelper::checkin($contrl . 'checkin'); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if (!FLEXI_J16GE || ($user->authorise('core.edit.state', 'com_flexicontent') || $user->authorise('core.edit.state.own', 'com_flexicontent'))) { JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::divider(); if (FLEXI_J16GE) { JToolBarHelper::archiveList($contrl . 'archive'); } } $add_divider = false; if (!FLEXI_J16GE || $filter_state == -2 && $user->authorise('core.delete', 'com_flexicontent')) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $add_divider = true; } elseif ($user->authorise('core.edit.state', 'com_flexicontent')) { JToolBarHelper::trash($contrl . 'trash'); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } if ($perms->CanConfig) { //JToolBarHelper::custom($contrl.'rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); $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); //Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } if (FLEXI_J16GE) { $rows = $this->get('Items'); } else { $rows = $this->get('Data'); } if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items $model = $this->getModel(); $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } $rowtotals = $model->getAssignedItems($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { $row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; } // Parse configuration for every category foreach ($rows as $cat) { $cat->config = FLEXI_J16GE ? new JRegistry($cat->config) : new JParameter($cat->config); } if (FLEXI_J16GE) { $this->state = $this->get('State'); // Preprocess the list of items to find ordering divisions. foreach ($rows as &$item) { $this->ordering[$item->parent_id][] = $item->id; } } $pagination = $this->get('Pagination'); $categories =& $globalcats; $lists['copyid'] = flexicontent_cats::buildcatselect($categories, 'copycid', '', 2, 'class="inputbox"', false, true, $actions_allowed = array('core.edit')); $lists['destid'] = flexicontent_cats::buildcatselect($categories, 'destcid[]', '', false, 'class="inputbox" size="15" multiple="true"', false, true, $actions_allowed = array('core.edit')); // ******************* // Create Form Filters // ******************* // filter by a category (it's subtree will be displayed) $categories = $globalcats; $lists['cats'] = flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, 2, 'class="inputbox" size="1" onchange="this.form.submit();"', $check_published = true, $check_perms = false); // filter depth level $options = array(); $options[] = JHtml::_('select.option', '', JText::_('FLEXI_SELECT_MAX_DEPTH')); for ($i = 1; $i <= 10; $i++) { $options[] = JHtml::_('select.option', $i, $i); } $fieldname = $elementid = 'filter_level'; $attribs = ' size="1" class="inputbox" onchange="this.form.submit();" '; $lists['level'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_level, $elementid, $translate = true); // filter publication state if (FLEXI_J16GE) { $options = JHtml::_('jgrid.publishedOptions'); array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_PUBLISHED'))); $fieldname = $elementid = 'filter_state'; $attribs = ' size="1" class="inputbox" onchange="Joomla.submitform()" '; $lists['state'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_state, $elementid, $translate = true); } else { $lists['state'] = JHTML::_('grid.state', $filter_state); } if (FLEXI_J16GE) { // filter access level $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_ACCESS'))); $fieldname = $elementid = 'filter_access'; $attribs = ' size="1" class="inputbox" onchange="Joomla.submitform()" '; $lists['access'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // filter language $lists['language'] = flexicontent_html::buildlanguageslist('filter_language', 'size="1" class="inputbox" onchange="submitform();"', $filter_language, 2); } else { // filter access level $options = array(); $options[] = JHtml::_('select.option', '', JText::_('FLEXI_SELECT_ACCESS_LEVEL')); $options[] = JHtml::_('select.option', '0', JText::_('Public')); $options[] = JHtml::_('select.option', '1', JText::_('Registered')); $options[] = JHtml::_('select.option', '2', JText::_('SPECIAL')); $fieldname = $elementid = 'filter_access'; $attribs = ' size="1" class="inputbox" onchange="this.form.submit()" '; $lists['access'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); } // filter search word $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $ordering = $lists['order'] == $order_property ? $order_property : ''; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('perms', $perms); if (FLEXI_J16GE) { $this->assignRef('orderingx', $ordering); } else { $this->assignRef('ordering', $ordering); } $this->assignRef('pagination', $pagination); $this->assignRef('user', $user); parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $task = $jinput->get('task', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $session = JFactory::getSession(); // Get model $model = $this->getModel(); // Some flags $has_zlib = function_exists("zlib_encode"); //version_compare(PHP_VERSION, '5.4.0', '>='); // Get session information $conf = $session->get('csvimport_config', "", 'flexicontent'); $conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : ""); $lineno = $session->get('csvimport_lineno', 999999, 'flexicontent'); $session->set('csvimport_parse_log', null, 'flexicontent'); // This is the flag if CSV file has been parsed (import form already submitted), thus to display the imported data // ************************** // Add css and js to document // ************************** $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // Add JS frameworks flexicontent_html::loadFramework('select2'); $prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable'); flexicontent_html::loadFramework('flexi-lib'); // Add js function to overload the joomla submitform validation JHTML::_('behavior.formvalidation'); // load default validation JS to make sure it is overriden $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH); $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanImport'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_IMPORT'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'import'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $toolbar = JToolBar::getInstance('toolbar'); if (!empty($conf)) { if ($task != 'processcsv') { $ctrl_task = 'import.processcsv'; $import_btn_title = empty($lineno) ? 'FLEXI_IMPORT_START_TASK' : 'FLEXI_IMPORT_CONTINUE_TASK'; JToolBarHelper::custom($ctrl_task, 'save.png', 'save.png', $import_btn_title, $list_check = false); } $ctrl_task = 'import.clearcsv'; JToolBarHelper::custom($ctrl_task, 'cancel.png', 'cancel.png', 'FLEXI_IMPORT_CLEAR_TASK', $list_check = false); } else { $ctrl_task = 'import.initcsv'; JToolBarHelper::custom($ctrl_task, 'import.png', 'import.png', 'FLEXI_IMPORT_PREPARE_TASK', $list_check = false); $ctrl_task = 'import.testcsv'; JToolBarHelper::custom($ctrl_task, 'test.png', 'test.png', 'FLEXI_IMPORT_TEST_FILE_FORMAT', $list_check = false); } //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'); } // Get types $types = flexicontent_html::getTypesList($_type_ids = false, $_check_perms = false, $_published = true); // Get Languages $languages = FLEXIUtilities::getLanguages('code'); // Get categories global $globalcats; $categories = $globalcats; // ************************************ // Decide layout to load: 'import*.php' // ************************************ $this->setLayout('import'); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; // Execute the import task, load the log-like AJAX-based layout (import_process.php), to display results including any warnings if (!empty($conf) && $task == 'processcsv') { $this->assignRef('conf', $conf); parent::display('process'); return; } else { if (!empty($conf)) { $this->assignRef('conf', $conf); $this->assignRef('cparams', $cparams); $this->assignRef('types', $types); $this->assignRef('languages', $languages); $this->assignRef('categories', $globalcats); parent::display('list'); return; } } // Session config is empty, means import form has not been submited, display the form // We will display import form which is not 'default.php', it is 'import.php' // else ... // Check is session table DATA column is not mediumtext (16MBs, it can be 64 KBs ('text') in some sites that were not properly upgraded) $tblname = 'session'; $dbprefix = $app->getCfg('dbprefix'); $dbname = $app->getCfg('db'); $db->setQuery("SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . $dbname . "' AND TABLE_NAME = '" . $dbprefix . $tblname . "'"); $jession_coltypes = $db->loadAssocList('COLUMN_NAME'); $_dataColType = strtolower($jession_coltypes['data']['DATA_TYPE']); $_dataCol_wrongSize = $_dataColType != 'mediumtext' && $_dataColType != 'longtext'; // If data type is "text" it is safe to assume that it can be converted to "mediumtext", // since "text" means that session table is not memory storage, // plus it is already stored externally aka operation will be quick ? /*if ($_dataCol_wrongSize && $_dataColType == 'text') { $db->setQuery("ALTER TABLE `#__session` MODIFY `data` MEDIUMTEXT"); $db->execute(); $_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); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** global $globalcats; $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'); $order_property = 'c.lft'; // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // various filters $filter_state = $model->getState('filter_state'); $filter_cats = $model->getState('filter_cats'); $filter_level = $model->getState('filter_level'); $filter_access = $model->getState('filter_access'); $filter_language = $model->getState('filter_language'); if ($filter_state) { $count_filters++; } if ($filter_cats) { $count_filters++; } if ($filter_level) { $count_filters++; } if ($filter_access) { $count_filters++; } if ($filter_language) { $count_filters++; } // Item ID filter $filter_id = $model->getState('filter_id'); if ($filter_id) { $count_filters++; } // text search $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // ordering $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanCats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_CATEGORIES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fc_categories'); $document->setTitle($doc_title . ' - ' . $site_title); $js = "jQuery(document).ready(function(){"; $contrl = "categories."; $contrl_singular = "category."; $toolbar = JToolBar::getInstance('toolbar'); // Copy Parameters $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=categories&layout=params&tmpl=component'; 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-params a.toolbar, #toolbar-params 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: 600, y: 440}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'params.png', 'params_f2.png', 'FLEXI_COPY_PARAMS', false); JHtml::_('behavior.modal', '#toolbar-params a.toolbar, #toolbar-params button'); } else { $toolbar->appendButton('Popup', 'params', JText::_('FLEXI_COPY_PARAMS'), str_replace('&', '&', $popup_load_url), 600, 440); } //$toolbar->appendButton('Popup', 'move', JText::_('FLEXI_BATCH'), JURI::base().'index.php?option=com_flexicontent&view=categories&layout=batch&tmpl=component', 800, 440); JToolBarHelper::divider(); $add_divider = false; if ($user->authorise('core.create', 'com_flexicontent')) { $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; } if ($cancreate_cat) { JToolBarHelper::addNew($contrl_singular . 'add'); $add_divider = true; } if ($user->authorise('core.edit', 'com_flexicontent') || $user->authorise('core.edit.own', 'com_flexicontent')) { JToolBarHelper::editList($contrl_singular . 'edit'); $add_divider = true; } $add_divider = false; if ($user->authorise('core.edit.state', 'com_flexicontent') || $user->authorise('core.edit.state.own', 'com_flexicontent')) { JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::divider(); JToolBarHelper::archiveList($contrl . 'archive'); } $add_divider = false; if ($filter_state == -2 && $user->authorise('core.delete', 'com_flexicontent')) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ARE_YOU_SURE'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $add_divider = true; } elseif ($user->authorise('core.edit.state', 'com_flexicontent')) { JToolBarHelper::trash($contrl . 'trash'); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } // Checkin JToolBarHelper::checkin($contrl . 'checkin'); $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman'; if (file_exists($appsman_path)) { $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'appsman.exportxml'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'categories'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); $btn_icon = 'icon-box-add'; $btn_name = 'box-add'; $btn_task = 'appsman.addtoexport'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'categories'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); } if ($perms->CanConfig) { //JToolBarHelper::custom($contrl.'rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); $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); // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Items'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } //$rowtotals = $model->getAssignedItems($rowids); $byStateTotals = $model->countItemsByState($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { //$row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; $row->byStateTotals = isset($byStateTotals[$row->id]) ? $byStateTotals[$row->id] : array(); } // Parse configuration for every category foreach ($rows as $cat) { $cat->config = new JRegistry($cat->config); } $this->state = $this->get('State'); // Preprocess the list of items to find ordering divisions. foreach ($rows as &$item) { $this->ordering[$item->parent_id][] = $item->id; } unset($item); // unset the variable reference to avoid trouble if variable is reused, thus overwritting last pointed variable $pagination = $this->get('Pagination'); $categories =& $globalcats; $lists['copyid'] = flexicontent_cats::buildcatselect($categories, 'copycid', '', 2, 'class="use_select2_lib"', false, true, $actions_allowed = array('core.edit')); $lists['destid'] = flexicontent_cats::buildcatselect($categories, 'destcid[]', '', false, 'class="use_select2_lib" size="10" multiple="true"', false, true, $actions_allowed = array('core.edit')); // ******************* // Create Form Filters // ******************* // filter by a category (it's subtree will be displayed) $categories = $globalcats; $lists['cats'] = ($filter_cats || 1 ? '<label class="label">' . JText::_('FLEXI_CATEGORY') . '</label>' : '') . flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, '-', 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $check_published = true, $check_perms = false); // filter depth level $options = array(); $options[] = JHtml::_('select.option', '', '-'); for ($i = 1; $i <= 10; $i++) { $options[] = JHtml::_('select.option', $i, $i); } $fieldname = $elementid = 'filter_level'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['level'] = ($filter_level || 1 ? '<label class="label">' . JText::_('FLEXI_MAX_DEPTH') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_level, $elementid, $translate = true); // filter publication state $options = JHtml::_('jgrid.publishedOptions'); array_unshift($options, JHtml::_('select.option', '', '-')); $fieldname = $elementid = 'filter_state'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_state, $elementid, $translate = true); // filter access level $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', '-')); $fieldname = $elementid = 'filter_access'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['access'] = ($filter_access || 1 ? '<label class="label">' . JText::_('FLEXI_ACCESS') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // filter language $lists['language'] = ($filter_language || 1 ? '<label class="label">' . JText::_('FLEXI_LANGUAGE') . '</label>' : '') . flexicontent_html::buildlanguageslist('filter_language', 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_language, '-'); // filter search word $lists['search'] = $search; // search id $lists['filter_id'] = $filter_id; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $orderingx = $lists['order'] == $order_property && strtolower($lists['order_Dir']) == 'asc' ? $order_property : ''; //assign data to template $this->assignRef('CanTemplates', $perms->CanTemplates); $this->assignRef('count_filters', $count_filters); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('perms', $perms); $this->assignRef('orderingx', $orderingx); $this->assignRef('pagination', $pagination); $this->assignRef('user', $user); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getVar('option'); FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); //get vars $filter_assigned = $app->getUserStateFromRequest($option . '.fields.filter_assigned', 'filter_assigned', '', 'word'); $filter_fieldtype = $app->getUserStateFromRequest($option . '.fields.filter_fieldtype', 'filter_fieldtype', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.fields.filter_state', 'filter_state', '', 'word'); $filter_type = $app->getUserStateFromRequest($option . '.fields.filter_type', 'filter_type', '', 'int'); $filter_order = $app->getUserStateFromRequest($option . '.fields.filter_order', 'filter_order', 't.ordering', 'cmd'); if ($filter_type && $filter_order == 't.ordering') { $filter_order = $app->setUserState($option . '.fields.filter_order', 'typeordering'); } else { if (!$filter_type && $filter_order == 'typeordering') { $filter_order = $app->setUserState($option . '.fields.filter_order', 't.ordering'); } } $filter_order_Dir = $app->getUserStateFromRequest($option . '.fields.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $search = $app->getUserStateFromRequest($option . '.fields.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); if ($cparams->get('show_usability_messages', 1)) { $notice_content_type_order = $app->getUserStateFromRequest($option . '.fields.notice_content_type_order', 'notice_content_type_order', 0, 'int'); if (!$notice_content_type_order) { $app->setUserState($option . '.fields.notice_content_type_order', 1); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_BY_TYPE'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_WITHOUT_TYPE'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } //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'); } } $document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/flexi-lib.js'); // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu and check access FLEXISubmenu('CanFields'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FIELDS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fields'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $contrl = FLEXI_J16GE ? "fields." : ""; if ($perms->CanCopyFields) { JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::custom($contrl . 'copy_wvalues', 'copy_wvalues.png', 'copy_f2.png', 'FLEXI_COPY_WITH_VALUES'); JToolBarHelper::divider(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); if ($perms->CanAddField) { JToolBarHelper::addNew($contrl . 'add'); } if ($perms->CanEditField) { JToolBarHelper::editList($contrl . 'edit'); } if ($perms->CanDeleteField) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } JToolBarHelper::divider(); JToolBarHelper::spacer(); $toggle_icon = 'basicindex'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='issearch';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_TEXT_SEARCHABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'basicfilter'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isfilter';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_FILTERABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'advindex'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvsearch';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_ADV_TEXT_SEARCHABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'advfilter'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvfilter';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_ADV_FILTERABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); 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'); } //Get data from the model $model = $this->getModel(); $rows = $this->get(FLEXI_J16GE ? 'Items' : 'Data'); $pagination = $this->get('Pagination'); $types = $this->get('Typeslist'); $fieldtypes = $model->getFieldtypes($fields_in_groups = true); $lists = array(); //build backend visible filter $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftype = array(); $fftype[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FIELDS_TYPE') . ' -'); $fftype[] = JHTML::_('select.option', 'BV', $ALL . JText::_('FLEXI_BACKEND_FIELDS')); $fftype[] = JHTML::_('select.option', 'C', $ALL . JText::_('FLEXI_CORE_FIELDS')); $fftype[] = JHTML::_('select.option', 'NC', $ALL . JText::_('FLEXI_NON_CORE_FIELDS')); foreach ($fieldtypes as $field_group => $ft_types) { $fftype[] = JHTML::_('select.optgroup', $field_group); foreach ($ft_types as $field_type => $ftdata) { $field_friendlyname = str_ireplace("FLEXIcontent - ", "", $ftdata->field_friendlyname); $fftype[] = JHTML::_('select.option', $field_type, '-' . $ftdata->assigned . '- ' . $field_friendlyname); } $fftype[] = JHTML::_('select.optgroup', ''); } $lists['fftype'] = JHTML::_('select.genericlist', $fftype, 'filter_fieldtype', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_fieldtype); if (!FLEXI_J16GE) { $lists['fftype'] = str_replace('<optgroup label="">', '</optgroup>', $lists['fftype']); } //build orphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FIELDS') . ' -'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_assigned); //build type select list $lists['filter_type'] = flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, true, 'class="use_select2_lib" size="1" onchange="submitform( );"', 'filter_type'); //publish unpublished filter $states = array(); $states[] = JHTML::_('select.option', '', JText::_('FLEXI_SELECT_STATE')); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$lists['state'] = JHTML::_('grid.state', $filter_state ); $lists['state'] = JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // filter ordering if ($filter_type == '' || $filter_type == 0) { $ordering = $lists['order'] == 't.ordering'; } else { $ordering = $lists['order'] == 'typeordering'; } //assign data to template $this->assignRef('permission', $perms); $this->assignRef('filter_type', $filter_type); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('ordering', $ordering); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // various filters $filter_state = $app->getUserStateFromRequest($option . '.' . $view . '.filter_state', 'filter_state', '', 'word'); $filter_access = $app->getUserStateFromRequest($option . '.' . $view . '.filter_access', 'filter_access', '', 'string'); if ($filter_state) { $count_filters++; } if ($filter_access) { $count_filters++; } // ordering filters $filter_order = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); // text search $search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string'); $search = $db->escape(trim(JString::strtolower($search))); // **************************** // Important usability messages // **************************** if ($cparams->get('show_usability_messages', 1)) { } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); $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('CanTypes'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TYPES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'types'); $document->setTitle($doc_title . ' - ' . $site_title); $contrl = "types."; JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::divider(); JToolBarHelper::spacer(); JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman'; if (file_exists($appsman_path)) { $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'appsman.exportxml'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_types'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); $btn_icon = 'icon-box-add'; $btn_name = 'box-add'; $btn_task = 'appsman.addtoexport'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_types'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); } 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'); } // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Items'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } $pagination = $this->get('Pagination'); // Pagination // Create type's parameters foreach ($rows as $type) { $type->config = FLEXI_J16GE ? new JRegistry($type->config) : new JParameter($type->config); } $lists = array(); // build publication state filter $states = array(); $states[] = JHTML::_('select.option', '', '-'); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$states[] = JHTML::_('select.option', '-2', JText::_( 'FLEXI_TRASHED' ) ); $lists['state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_state); //JHTML::_('grid.state', $filter_state ); // build access level filter $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', '-')); $fieldname = $elementid = 'filter_access'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['access'] = ($filter_access || 1 ? '<label class="label">' . JText::_('FLEXI_ACCESS') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // text search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('CanTemplates', $perms->CanTemplates); $this->assignRef('count_filters', $count_filters); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $filter_order = $app->getUserStateFromRequest($option . '.types.filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.types.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.types.filter_state', 'filter_state', '*', 'word'); $search = $app->getUserStateFromRequest($option . '.types.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //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('CanTypes'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TYPES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'types'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $contrl = FLEXI_J16GE ? "types." : ""; JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::divider(); JToolBarHelper::spacer(); JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); 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'); } // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } if (FLEXI_J16GE) { $rows = $this->get('Items'); } else { $rows = $this->get('Data'); } if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Create type's parameters foreach ($rows as $type) { $type->config = FLEXI_J16GE ? new JRegistry($type->config) : new JParameter($type->config); } // Create pagination object $pagination = $this->get('Pagination'); $lists = array(); //publish unpublished filter $lists['state'] = JHTML::_('grid.state', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { $app = JFactory::getApplication(); $config = JFactory::getConfig(); $params = JComponentHelper::getParams('com_flexicontent'); $document = JFactory::getDocument(); $session = JFactory::getSession(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $print_logging_info = $params->get('print_logging_info'); // Special displaying when getting flexicontent version $layout = JRequest::getVar('layout', 'default'); if ($layout == 'fversion') { $this->fversion($tpl, $params); return; } // Load the file system librairies jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); // activate the tooltips //JHTML::_('behavior.tooltip'); // handle jcomments integration if (JPluginHelper::isEnabled('system', 'jcomments')) { $JComments_Installed = 1; $destpath = JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'plugins'; $dest = $destpath . DS . 'com_flexicontent.plugin.php'; $source = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'jcomments' . DS . 'com_flexicontent.plugin.php'; if (!JFile::exists($dest)) { if (!JFolder::exists($destpath)) { if (!JFolder::create($destpath)) { JError::raiseWarning(100, JText::_('FLEXIcontent: Unable to create jComments plugin folder')); } } if (!JFile::copy($source, $dest)) { JError::raiseWarning(100, JText::_('FLEXIcontent: Unable to copy jComments plugin')); } else { $app->enqueueMessage(JText::_('Copied FLEXIcontent jComments plugin')); } } } else { $JComments_Installed = 0; } // handle joomfish integration if (JPluginHelper::isEnabled('system', 'jfdatabase')) { $files = new stdClass(); $files->fields = new stdClass(); $files->files = new stdClass(); $files->tags = new stdClass(); $files->fields->dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements' . DS . 'flexicontent_fields.xml'; $files->fields->source = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'joomfish' . DS . 'flexicontent_fields.xml'; $files->files->dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements' . DS . 'flexicontent_files.xml'; $files->files->source = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'joomfish' . DS . 'flexicontent_files.xml'; $files->tags->dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomfish' . DS . 'contentelements' . DS . 'flexicontent_tags.xml'; $files->tags->source = JPATH_SITE . DS . 'components' . DS . 'com_flexicontent' . DS . 'librairies' . DS . 'joomfish' . DS . 'flexicontent_tags.xml'; foreach ($files as $file) { if (!JFile::exists($file->dest)) { JFile::copy($file->source, $file->dest); } } } // Get model $model = $this->getModel('flexicontent'); // initialise template related variables if (!FLEXI_J16GE) { $pane = JPane::getInstance('sliders'); } $template = $app->getTemplate(); $themes = flexicontent_tmpl::getThemes(); // Get data from the model if ($print_logging_info) { global $fc_run_times; } if ($print_logging_info) { $start_microtime = microtime(true); } $totalrows = array(); $_total = 0; $draft = $model->getDraft($_total); $totalrows['draft'] = $_total; $pending = $model->getPending($_total); $totalrows['pending'] = $_total; $revised = $model->getRevised($_total); $totalrows['revised'] = $_total; $inprogress = $model->getInprogress($_total); $totalrows['inprogress'] = $_total; if ($print_logging_info) { $fc_run_times['quick_sliders'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } // 1. CHECK REQUIRED NON-AUTOMATIC TASKs // THEY ARE TASKs THAT USER MUST COMPLETE MANUALLY $existcat = $model->getExistcat(); if (!FLEXI_J16GE) { $existsec = $model->getExistsec(); } $existmenu = $model->getExistmenu(); // 2. OPTIONAL AUTOMATIC TASKS, // THESE ARE SEPARETELY CHECKED, AS THEY ARE NOT OBLIGATORY BUT RATHER RECOMMENDED $allplgpublish = $session->get('flexicontent.allplgpublish'); if ($allplgpublish === NULL || $allplgpublish === false) { $allplgpublish = $model->getAllPluginsPublished(); } $optional_tasks = !$allplgpublish; // || .. // 3. OBLIGATORY AUTOMATIC TASKS, THAT WILL BLOCK COMPONENT USE UNTIL THEY ARE COMPLETED $postinst_integrity_ok = $session->get('flexicontent.postinstall'); // THE FOLLOWING WILL ONLY BE DISPLAYED IF $DOPOSTINSTALL IS INCOMPLETE // SO WHY CALCULATE THEM, WE SKIP THEM, USER MUST LOG OUT ANYWAY TO SEE THEM ... if ($postinst_integrity_ok === NULL || $postinst_integrity_ok === false) { $use_versioning = $params->get('use_versioning', 1); $existtype = $model->getExistType(); $existmenuitems = $model->getExistMenuItems(); $existfields = $model->getExistFields(); $existfplg = $model->getExistFieldsPlugins(); $existseplg = $model->getExistSearchPlugin(); $existsyplg = $model->getExistSystemPlugin(); $existcats = !$model->getItemsNoCat(); $existlang = $model->getExistLanguageColumns() && !$model->getItemsNoLang(); $existversions = $model->getExistVersionsTable(); $existversionsdata = !$use_versioning || $model->getExistVersionsPopulated(); $existauthors = $model->getExistAuthorsTable(); $deprecatedfiles = $model->getDeprecatedFiles(); $nooldfieldsdata = $model->getNoOldFieldsData(); $missingversion = true; //!$use_versioning || !$model->checkCurrentVersionData(); $cachethumb = $model->getCacheThumbChmod(); $existdbindexes = !(bool) ($missingindexes = $model->getExistDBindexes($check_only = false)); $itemcountingdok = $model->getItemCountingDataOK(); $initialpermission = $model->checkInitialPermission(); } else { if ($optional_tasks) { // IF optional tasks do not recheck instead just set the FLAGS to true $existtype = $existmenuitems = $existfields = true; $existfplg = $existseplg = $existsyplg = true; $existcats = $existlang = $existversions = $existversionsdata = $existauthors = true; $deprecatedfiles = $nooldfieldsdata = $missingversion = $cachethumb = true; $existdbindexes = $itemcountingdok = $initialpermission = true; $missingindexes = array(); } } // ************************** // Add css and js to document // ************************** $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); $css = '.install-ok { background: url(components/com_flexicontent/assets/images/accept.png) 0% 50% no-repeat transparent; padding:1px 0; width: 20px; height:16px; display:block; } .install-notok { background: url(components/com_flexicontent/assets/images/delete.png) 0% 50% no-repeat transparent; padding:1px 0; width: 20px; height:16px; display:block; float:left;}'; $document->addStyleDeclaration($css); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('notvariable'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_DASHBOARD'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'flexicontent'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar if (version_compare(PHP_VERSION, '5.0.0', '>')) { $js = "jQuery(document).ready(function(){"; if ($perms->CanConfig) { $toolbar = JToolBar::getInstance('toolbar'); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&layout=import&tmpl=component'; if (!FLEXI_J16GE) { $js .= "\n\t\t\t\t\t\tjQuery('#toolbar-download a.toolbar, #toolbar-download button')\n\t\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 500}, onClose: function() {}}');\n\t\t\t\t\t"; JToolBarHelper::custom($btn_task, 'download.png', 'download_f2.png', 'FLEXI_IMPORT_JOOMLA', false); JHtml::_('behavior.modal', '#toolbar-download a.toolbar, #toolbar-download button'); } else { //$toolbar->appendButton('Popup', 'download', JText::_('FLEXI_IMPORT_JOOMLA'), str_replace('&', '&', $popup_load_url), 400, 300); } /*$btn_task = ''; $popup_load_url = JURI::base().'index.php?option=com_flexicontent&layout=language&tmpl=component'; if (FLEXI_J16GE) { $js .= " jQuery('#toolbar-language a.toolbar, #toolbar-language button') .attr('onclick', 'javascript:;') .attr('href', '".$popup_load_url."') .attr('rel', '{handler: \'iframe\', size: {x: 800, y: 500}, onClose: function() {}}'); "; JToolBarHelper::custom( $btn_task, 'language.png', 'language_f2.png', 'FLEXI_SEND_LANGUAGE', false ); JHtml::_('behavior.modal', '#toolbar-language a.toolbar, #toolbar-language button'); } else { $toolbar->appendButton('Popup', 'language', JText::_('FLEXI_SEND_LANGUAGE'), str_replace('&', '&', $popup_load_url), 800, 500); }*/ $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); } // Lists jimport('joomla.filesystem.folder'); $lists = array(); $options = array(); $folder = JPATH_ADMINISTRATOR . DS . 'language'; $langs = JFolder::folders($folder); $activelang = JComponentHelper::getParams('com_languages')->get('administrator', 'en-GB'); foreach ($langs as $lang) { $options[] = JHTML::_('select.option', $lang, $lang); } $lists['languages'] = JHTML::_('select.genericlist', $options, 'lang', '', 'value', 'text', $activelang); // Missing files $lists['missing_lang'] = $model->processlanguagefiles(); // Get the default copyright values to populate the form automatically $mailfrom = $app->getCfg('mailfrom'); $fromname = $app->getCfg('fromname'); $website = $app->getCfg('live_site'); $this->assignRef('pending', $pending); $this->assignRef('revised', $revised); $this->assignRef('draft', $draft); $this->assignRef('inprogress', $inprogress); $this->assignRef('totalrows', $totalrows); $this->assignRef('existcat', $existcat); if (!FLEXI_J16GE) { $this->assignRef('existsec', $existsec); } $this->assignRef('existmenu', $existmenu); $this->assignRef('template', $template); $this->assignRef('params', $params); $this->assignRef('lists', $lists); $this->assignRef('activelang', $activelang); $this->assignRef('mailfrom', $mailfrom); $this->assignRef('fromname', $fromname); $this->assignRef('website', $website); // install check $this->assignRef('dopostinstall', $postinst_integrity_ok); $this->assignRef('allplgpublish', $allplgpublish); $this->assignRef('existtype', $existtype); $this->assignRef('existmenuitems', $existmenuitems); $this->assignRef('existfields', $existfields); $this->assignRef('existfplg', $existfplg); $this->assignRef('existseplg', $existseplg); $this->assignRef('existsyplg', $existsyplg); $this->assignRef('existcats', $existcats); $this->assignRef('existlang', $existlang); $this->assignRef('existversions', $existversions); $this->assignRef('existversionsdata', $existversionsdata); $this->assignRef('existauthors', $existauthors); $this->assignRef('deprecatedfiles', $deprecatedfiles); $this->assignRef('nooldfieldsdata', $nooldfieldsdata); $this->assignRef('missingversion', $missingversion); $this->assignRef('cachethumb', $cachethumb); $this->assignRef('existdbindexes', $existdbindexes); $this->assignRef('missingindexes', $missingindexes); $this->assignRef('itemcountingdok', $itemcountingdok); $this->assignRef('initialpermission', $initialpermission); // assign Rights to the template $this->assignRef('perms', $perms); $this->assignRef('document', $document); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $filter_order = $app->getUserStateFromRequest($option . '.tags.filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.tags.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.tags.filter_state', 'filter_state', '*', 'word'); $filter_assigned = $app->getUserStateFromRequest($option . '.tags.filter_assigned', 'filter_assigned', '*', 'word'); $search = $app->getUserStateFromRequest($option . '.tags.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //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('CanTags'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TAGS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'tags'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $js = "window.addEvent('domready', function(){"; $contrl = FLEXI_J16GE ? "tags." : ""; $toolbar = JToolBar::getInstance('toolbar'); if ($perms->CanConfig) { $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=tags&layout=import&tmpl=component'; 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\t\tjQuery('#toolbar-import a.toolbar, #toolbar-import button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 430, y: 500}, onClose: function() {}}');\n\t\t\t\t"; JToolBarHelper::custom($btn_task, 'import.png', 'import_f2.png', 'FLEXI_IMPORT', false); JHtml::_('behavior.modal', '#toolbar-import a.toolbar, #toolbar-import button'); } else { $toolbar->appendButton('Popup', 'import', JText::_('FLEXI_IMPORT'), str_replace('&', '&', $popup_load_url), 430, 500); } JToolBarHelper::divider(); JToolBarHelper::spacer(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); 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); //Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Data'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items $model = $this->getModel(); $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } $rowtotals = $model->getAssignedItems($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { $row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; } $pagination = $this->get('Pagination'); $lists = array(); //build arphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_TAGS') . ' -'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_assigned); //publish unpublished filter $lists['state'] = JHTML::_('grid.state', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $layout = $jinput->get('layout', '', 'cmd'); $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // Get model $model = $this->getModel(); //$authorparams = flexicontent_db::getUserConfig($user->id); $langs = FLEXIUtilities::getLanguages('code'); flexicontent_html::loadJQuery(); flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); // Load the form validation behavior JHTML::_('behavior.formvalidation'); // Get user's global permissions $perms = FlexicontentHelperPerm::getPerm(); // Get folder mode $_view = $view; $folder_mode = 0; // *********** // Get filters // *********** $count_filters = 0; // Order and order direction $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); $filter_lang = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_lang', 'filter_lang', '', 'string'); $filter_url = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_url', 'filter_url', '', 'word'); $filter_secure = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_secure', 'filter_secure', '', 'word'); $filter_ext = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_ext', 'filter_ext', '', 'alnum'); $filter_uploader = $app->getUserStateFromRequest($option . '.' . $_view . '.filter_uploader', 'filter_uploader', '', 'int'); $filter_item = $app->getUserStateFromRequest($option . '.' . $_view . '.item_id', 'item_id', '', 'int'); if ($layout != 'image') { if ($filter_lang) { $count_filters++; } if ($filter_url) { $count_filters++; } if ($filter_secure) { $count_filters++; } } if ($filter_ext) { $count_filters++; } if ($filter_uploader) { $count_filters++; } if ($filter_item) { $count_filters++; } // Text search $scope = $model->getState('scope'); $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); $filter_uploader = $filter_uploader ? $filter_uploader : ''; $filter_item = $filter_item ? $filter_item : ''; // ************************** // Add css and js to document // ************************** if ($app->isSite()) { $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH); } else { $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); } $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); $js = "jQuery(document).ready(function(){"; // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanFiles'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FILEMANAGER'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'files'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->setToolbar(); // *********************** // Get data from the model // *********************** if (!$folder_mode) { $rows = $this->get('Data'); } else { // TODO MORE ... } $pagination = $this->get('Pagination'); //$users = $this->get('Users'); // Get item using at least one file (-of- the currently listed files) /*$items_single = $model->getItemsSingleprop( array('file','minigallery') ); $items_multi = $model->getItemsMultiprop ( $field_props=array('image'=>'originalname'), $value_props=array('image'=>'filename') ); $items = array(); foreach ($items_single as $item_id => $_item) $items[$item_id] = $_item; foreach ($items_multi as $item_id => $_item) $items[$item_id] = $_item; ksort($items);*/ $assigned_fields_labels = array('image' => 'image/gallery', 'file' => 'file', 'minigallery' => 'minigallery'); $assigned_fields_icons = array('image' => 'picture_link', 'file' => 'page_link', 'minigallery' => 'film_link'); /***************** ** BUILD LISTS ** *****************/ $lists = array(); // ** FILE UPLOAD FORM ** // Build languages list //$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed',null); //$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs); $display_file_lang_as = $cparams->get('display_file_lang_as', 3); $allowed_langs = null; $lists['file-lang'] = flexicontent_html::buildlanguageslist('file-lang', '', '*', $display_file_lang_as, $allowed_langs, $published_only = false); /************* ** FILTERS ** *************/ // language filter $lists['language'] = ($filter_lang || 1 ? '<label class="label">' . JText::_('FLEXI_LANGUAGE') . '</label>' : '') . flexicontent_html::buildlanguageslist('filter_lang', 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" size="1" ', $filter_lang, '-'); // search $lists['search'] = $search; //search filter $filters = array(); $filters[] = JHTML::_('select.option', '0', '- ' . JText::_('FLEXI_ALL') . ' -'); $filters[] = JHTML::_('select.option', '1', JText::_('FLEXI_FILENAME')); $filters[] = JHTML::_('select.option', '2', JText::_('FLEXI_FILE_DISPLAY_TITLE')); $filters[] = JHTML::_('select.option', '3', JText::_('FLEXI_DESCRIPTION')); $lists['scope'] = ' <span class="hasTooltip" style="display:inline-block; padding:0; margin:0;" title="' . JText::_('FLEXI_SEARCH_TEXT_INSIDE') . '"><i class="icon-info"></i></span> ' . JHTML::_('select.genericlist', $filters, 'scope', 'size="1" class="use_select2_lib fc_skip_highlight" onchange="jQuery(\'#search\').attr(\'placeholder\', jQuery(this).find(\'option:selected\').text());" ', 'value', 'text', $scope); //build url/file filterlist $url = array(); $url[] = JHTML::_('select.option', '', '-'); $url[] = JHTML::_('select.option', 'F', JText::_('FLEXI_FILE')); $url[] = JHTML::_('select.option', 'U', JText::_('FLEXI_URL')); $lists['url'] = ($filter_url || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_FILES') . '</label>' : '') . JHTML::_('select.genericlist', $url, 'filter_url', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_url); //item lists /*$items_list = array(); $items_list[] = JHTML::_('select.option', '', '- '. JText::_( 'FLEXI_FILTER_BY_ITEM' ) .' -' ); foreach($items as $item) { $items_list[] = JHTML::_('select.option', $item->id, JText::_( $item->title ) . ' (#' . $item->id . ')' ); } $lists['item_id'] = JHTML::_('select.genericlist', $items_list, 'item_id', 'size="1" class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_item );*/ $lists['item_id'] = '<input type="text" name="item_id" size="1" class="inputbox" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()" value="' . $filter_item . '" />'; //build secure/media filterlist $secure = array(); $secure[] = JHTML::_('select.option', '', '-'); $secure[] = JHTML::_('select.option', 'S', JText::_('FLEXI_SECURE_DIR')); $secure[] = JHTML::_('select.option', 'M', JText::_('FLEXI_MEDIA_DIR')); $lists['secure'] = ($filter_secure || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_DIRECTORIES') . '</label>' : '') . JHTML::_('select.genericlist', $secure, 'filter_secure', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_secure); //build ext filterlist $lists['ext'] = ($filter_ext || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_EXT') . '</label>' : '') . flexicontent_html::buildfilesextlist('filter_ext', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_ext, '-'); //build uploader filterlist $lists['uploader'] = ($filter_uploader || 1 ? '<label class="label">' . JText::_('FLEXI_ALL_UPLOADERS') . '</label>' : '') . flexicontent_html::builduploaderlist('filter_uploader', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', $filter_uploader, '-'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // uploadstuff if ($cparams->get('enable_flash', 1) && !FLEXI_J30GE) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ window.location.reload(); }')); } jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('params', $cparams); $this->assign('require_ftp', $ftp); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('folder_mode', $folder_mode); $this->assignRef('pagination', $pagination); $this->assignRef('CanFiles', $perms->CanFiles); $this->assignRef('CanUpload', $perms->CanUpload); $this->assignRef('CanViewAllFiles', $perms->CanViewAllFiles); $this->assignRef('assigned_fields_labels', $assigned_fields_labels); $this->assignRef('assigned_fields_icons', $assigned_fields_icons); $this->assignRef('langs', $langs); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }