コード例 #1
0
 /**
  * Method to get types list
  * 
  * @return array
  * @since 1.5
  */
 function getTypeslist($type_ids = false, $check_perms = false, $published = false)
 {
     return flexicontent_html::getTypesList($type_ids, $check_perms, $published);
 }
コード例 #2
0
    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);
    }
コード例 #3
0
 function _createPlacementConf(&$item, &$fields)
 {
     $params =& $item->parameters;
     // 1. Find core placer fields (of type 'coreprops')
     $core_placers = array();
     foreach ($fields as $field) {
         if ($field->field_type == 'coreprops') {
             $core_placers[$field->parameters->get('props_type')] = $field;
         }
     }
     // 2. Field name arrays:  (a) placeable and  (b) placeable via placer  (c) above tabs fields
     $via_core_field = array('title' => 1, 'type_id' => 1, 'state' => 1, 'cats' => 1, 'tags' => 1, 'text' => 1);
     $via_core_field = array_merge($via_core_field, array('created' => 1, 'created_by' => 1, 'modified' => 1, 'modified_by' => 1));
     $via_core_prop = array('alias' => 1, 'disable_comments' => 1, 'notify_subscribers' => 1, 'language' => 1, 'perms' => 1, 'metadata' => 1, 'seoconf' => 1, 'display_params' => 1, 'layout_selection' => 1, 'layout_params' => 1);
     $via_core_prop = array_merge($via_core_prop, array('timezone_info' => 1, 'created_by_alias' => 1, 'publish_up' => 1, 'publish_down' => 1, 'access' => 1));
     $placeable_fields = array_merge($via_core_field, $via_core_prop);
     // 3. Decide placement of CORE properties / fields
     $tab_fields['above'] = $params->get('form_tabs_above', 'title, alias, category, lang, type, state, disable_comments, notify_subscribers');
     $tab_fields['tab01'] = $params->get('form_tab01_fields', 'text');
     $tab_fields['tab02'] = $params->get('form_tab02_fields', 'fields_manager');
     $tab_fields['tab03'] = $params->get('form_tab03_fields', 'categories, tags, language, perms');
     $tab_fields['tab04'] = $params->get('form_tab04_fields', 'timezone_info, created, createdby, created_by_alias, publish_up, publish_down, access');
     $tab_fields['tab05'] = $params->get('form_tab05_fields', 'metadata, seoconf');
     $tab_fields['tab06'] = $params->get('form_tab06_fields', 'display_params');
     $tab_fields['tab07'] = $params->get('form_tab07_fields', 'layout_selection, layout_params');
     $tab_fields['fman'] = $params->get('form_tabs_fieldsman', '');
     $tab_fields['below'] = $params->get('form_tabs_below', '');
     // Fix aliases, also replacing field types with field names
     foreach ($tab_fields as $tab_name => $field_list) {
         $field_list = str_replace('createdby', 'created_by', $field_list);
         $field_list = str_replace('modifiedby', 'modified_by', $field_list);
         $field_list = str_replace('createdby_alias', 'created_by_alias', $field_list);
         $field_list = str_replace('maintext', 'text', $field_list);
         $tab_fields[$tab_name] = $field_list;
     }
     //echo "<pre>"; print_r($tab_fields); echo "</pre>";
     // Split field lists
     $all_tab_fields = array();
     foreach ($tab_fields as $i => $field_list) {
         // Split field names and flip the created sub-array to make field names be the indexes of the sub-array
         $tab_fields[$i] = empty($tab_fields[$i]) || $tab_fields[$i] == '_skip_' ? array() : array_flip(preg_split("/[\\s]*,[\\s]*/", $field_list));
         // Find all field names of the placed fields, we can use this to find non-placed fields
         foreach ($tab_fields[$i] as $field_name => $ignore) {
             $all_tab_fields[$field_name] = 1;
         }
     }
     // Find fields missing from configuration, and place them below the tabs
     foreach ($placeable_fields as $fn => $i) {
         if (!isset($all_tab_fields[$fn])) {
             $tab_fields['below'][$fn] = 1;
         }
     }
     // get TAB titles and TAB icon classes
     $_tmp = $params->get('form_tab_titles', '1:FLEXI_DESCRIPTION, 2:__TYPE_NAME__, 3:FLEXI_ASSIGNMENTS, 4:FLEXI_PUBLISHING, 5:FLEXI_META_SEO, 6:FLEXI_DISPLAYING, 7:FLEXI_TEMPLATE');
     $_ico = $params->get('form_tab_icons', '1:icon-file-2, 2:icon-signup, 3:icon-tree-2, 4:icon-calendar, 5:icon-bookmark, 6:icon-eye-open, 7:icon-palette');
     // Create title of the custom fields default TAB (field manager TAB)
     if ($item->type_id) {
         $_str = JText::_('FLEXI_DETAILS');
         $_str = mb_strtoupper(mb_substr($_str, 0, 1, 'UTF-8')) . mb_substr($_str, 1, NULL, 'UTF-8');
         $types_arr = flexicontent_html::getTypesList();
         $type_lbl = isset($types_arr[$item->type_id]) ? $types_arr[$item->type_id]->name : '';
         $type_lbl = $type_lbl ? JText::_($type_lbl) : JText::_('FLEXI_CONTENT_TYPE');
         $type_lbl = $type_lbl . ' (' . $_str . ')';
     } else {
         $type_lbl = JText::_('FLEXI_TYPE_NOT_DEFINED');
     }
     // Split titles of default tabs and language filter the titles
     $_tmp = preg_split("/[\\s]*,[\\s]*/", $_tmp);
     $tab_titles = array();
     foreach ($_tmp as $_data) {
         list($tab_no, $tab_title) = preg_split("/[\\s]*:[\\s]*/", $_data);
         if ($tab_title == '__TYPE_NAME__') {
             $tab_titles['tab0' . $tab_no] = $type_lbl;
         } else {
             $tab_titles['tab0' . $tab_no] = JText::_($tab_title);
         }
     }
     // Split icon classes of default tabs
     $_ico = preg_split("/[\\s]*,[\\s]*/", $_ico);
     $tab_icocss = array();
     foreach ($_ico as $_data) {
         list($tab_no, $tab_icon_class) = preg_split("/[\\s]*:[\\s]*/", $_data);
         $tab_icocss['tab0' . $tab_no] = $tab_icon_class;
     }
     // 4. find if some fields are missing placement field
     $coreprop_missing = array();
     foreach ($via_core_prop as $fn => $i) {
         // -EITHER- configured to be shown at default position -OR-
         if (isset($tab_fields['fman'][$fn]) && !isset($core_placers[$fn])) {
             $coreprop_missing[$fn] = true;
             unset($tab_fields['fman'][$fn]);
             $tab_fields['below'][$fn] = 1;
         }
     }
     $placementConf['via_core_field'] = $via_core_field;
     $placementConf['via_core_prop'] = $via_core_prop;
     $placementConf['placeable_fields'] = $placeable_fields;
     $placementConf['tab_fields'] = $tab_fields;
     $placementConf['tab_titles'] = $tab_titles;
     $placementConf['tab_icocss'] = $tab_icocss;
     $placementConf['all_tab_fields'] = $all_tab_fields;
     $placementConf['coreprop_missing'] = $coreprop_missing;
     return $placementConf;
 }
コード例 #4
0
    function display($tpl = null)
    {
        $fc_css = JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css';
        echo '
		<link rel="stylesheet" href="' . JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css?' . FLEXI_VHASH . '" />
		<link rel="stylesheet" href="' . $fc_css . '?' . FLEXI_VHASH . '" />
		<link rel="stylesheet" href="' . JURI::root(true) . '/media/jui/css/bootstrap.min.css" />
		';
        $user = JFactory::getUser();
        // Get types
        $types = flexicontent_html::getTypesList($_type_ids = false, $_check_perms = false, $_published = true);
        $types = is_array($types) ? $types : array();
        $ctrl_task = FLEXI_J16GE ? 'items.add' : 'add';
        $icon = "components/com_flexicontent/assets/images/layout_add.png";
        $btn_class = FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall';
        echo '
<div id="flexicontent">
	<table class="fc-table-list">
		<tr>
			<th>' . JText::_('FLEXI_SELECT_TYPE') . '</th>
		</tr>
		<tr>
			<td>
		';
        $link = "index.php?option=com_flexicontent&amp;controller=items&amp;task=" . $ctrl_task . "&amp;" . (FLEXI_J30GE ? JSession::getFormToken() : JUtility::getToken()) . "=1";
        $_name = '- ' . JText::_("FLEXI_ANY") . ' -';
        //.' ... '. JText::_("FLEXI_TYPE");
        ?>
			<a class="<?php 
        echo $btn_class;
        ?>
 btn-info" href="<?php 
        echo $link;
        ?>
" style="min-width:60px;" target="_parent">
				<!--<img style="margin-bottom:-3px;" src="<?php 
        echo $icon;
        ?>
" width="16" height="16" border="0" alt="<?php 
        echo $_name;
        ?>
" />&nbsp;-->
				<?php 
        echo $_name;
        ?>
			</a>
		<?php 
        foreach ($types as $type) {
            $allowed = !$type->itemscreatable || $user->authorise('core.create', 'com_flexicontent.type.' . $type->id);
            if (!$allowed && $type->itemscreatable == 1) {
                continue;
            }
            $link = "index.php?option=com_flexicontent&amp;controller=items&amp;task=" . $ctrl_task . "&amp;typeid=" . $type->id . "&amp;" . (FLEXI_J30GE ? JSession::getFormToken() : JUtility::getToken()) . "=1";
            if (!$allowed && $type->itemscreatable == 2) {
                ?>
				<span class="badge badge-warning">
					<!--<img style="margin-bottom:-3px;" src="<?php 
                echo $icon;
                ?>
" width="16" height="16" border="0" alt="<?php 
                echo $type->name;
                ?>
" />&nbsp;-->
					<?php 
                echo $type->name;
                ?>
				</span>
				<?php 
            } else {
                ?>
				<a class="<?php 
                echo $btn_class;
                ?>
 btn-success" href="<?php 
                echo $link;
                ?>
" target="_parent">
					<!--<img style="margin-bottom:-3px;" src="<?php 
                echo $icon;
                ?>
" width="16" height="16" border="0" alt="<?php 
                echo $type->name;
                ?>
" />&nbsp;-->
					<?php 
                echo $type->name;
                ?>
				</a>
			<?php 
            }
        }
        echo '
			</td>
		</tr>
	</table>
</div>
		';
    }
コード例 #5
0
 function _displayCopyMove($tpl = null, $cid = array(), $behaviour = 'copy/move')
 {
     global $globalcats;
     $app = JFactory::getApplication();
     // Initialise variables
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     // Add css to document
     $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);
     // Add js to document
     JHTML::_('behavior.tooltip');
     flexicontent_html::loadFramework('select2');
     $document->addScriptVersion(JURI::base(true) . '/components/com_flexicontent/assets/js/copymove.js', FLEXI_VERSION);
     // 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_VERSION);
     $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VERSION);
     // Create document/toolbar titles
     if ($behaviour == 'translate') {
         $doc_title = JText::_('FLEXI_TRANSLATE_ITEM');
     } else {
         $doc_title = JText::_('FLEXI_BATCH');
     }
     $site_title = $document->getTitle();
     JToolBarHelper::title($doc_title, 'itemadd');
     $document->setTitle($doc_title . ' - ' . $site_title);
     // Create the toolbar
     JToolBarHelper::save('items.copymove');
     JToolBarHelper::cancel('items.cancel');
     //Get data from the model
     $rows = $this->get('Data');
     $itemCats = $this->get('ItemCats');
     $categories = $globalcats;
     // build the main category select list
     $lists['maincat'] = flexicontent_cats::buildcatselect($categories, 'maincat', '', JText::_('FLEXI_DO_NOT_CHANGE'), 'class="use_select2_lib" size="10"', false, false);
     // build the secondary categories select list
     $lists['seccats'] = flexicontent_cats::buildcatselect($categories, 'seccats[]', '', 0, 'class="use_select2_lib" multiple="multiple" size="10"', false, false);
     // build language selection
     $lists['language'] = flexicontent_html::buildlanguageslist('language', '', '', $type = $behaviour != 'translate' ? JText::_('FLEXI_NOCHANGE_LANGUAGE') : 7, $allowed_langs = null, $published_only = true, $disable_langs = null, $add_all = true, array('required' => 1));
     // build state selection
     $selected_state = 0;
     // use unpublished as default state of new items, (instead of '' which means do not change)
     $lists['state'] = flexicontent_html::buildstateslist('state', 'class="use_select2_lib"', $selected_state);
     // build types selection
     $types = flexicontent_html::getTypesList();
     $lists['type_id'] = flexicontent_html::buildtypesselect($types, 'type_id', '', JText::_('FLEXI_DO_NOT_CHANGE'), 'class="use_select2_lib" size="1" style="vertical-align:top;"', 'type_id');
     // build access level filter
     $levels = JHtml::_('access.assetgroups');
     array_unshift($levels, JHtml::_('select.option', '', 'FLEXI_DO_NOT_CHANGE'));
     $fieldname = $elementid = 'access';
     $attribs = 'class="use_select2_lib"';
     $lists['access'] = JHTML::_('select.genericlist', $levels, $fieldname, $attribs, 'value', 'text', $value = '', $elementid, $translate = true);
     //assign data to template
     $this->assignRef('lists', $lists);
     $this->assignRef('rows', $rows);
     $this->assignRef('itemCats', $itemCats);
     $this->assignRef('cid', $cid);
     $this->assignRef('user', $user);
     $this->assignRef('behaviour', $behaviour);
     parent::display($tpl);
 }
コード例 #6
0
 /**
  * Method to get attributes and other data of types in types filter
  * 
  * @return array
  * @since 1.5
  */
 function getTypesFromFilter()
 {
     static $types = null;
     if ($types !== null) {
         return $types;
     }
     $filter_type = $this->getState('filter_type');
     JArrayHelper::toInteger($filter_type, null);
     if (empty($filter_type)) {
         return array();
     }
     // Get the extra fields from COMPONENT OR per type if TYPE FILTER is active
     $types = flexicontent_html::getTypesList($filter_type, $check_perms = false, $published = false);
     foreach ($types as $type_id => $type) {
         $types[$type_id]->params = new JRegistry($type->attribs);
     }
     return $types;
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: jakesyl/flexicontent
 function _createPlacementConf(&$fields, &$params, &$item)
 {
     // 1. Find core placer fields (of type 'coreprops')
     $core_placers = array();
     foreach ($fields as $field) {
         if ($field->field_type == 'coreprops') {
             $core_placers[$field->parameters->get('props_type')] = $field;
         }
     }
     // 2. Field name arrays:  (a) placeable and  (b) placeable via placer  (c) above tabs fields
     $via_core_field = array('title' => 1, 'type_id' => 1, 'state' => 1, 'cats' => 1, 'tags' => 1, 'maintext' => 1);
     $via_core_field = array_merge($via_core_field, FLEXI_J16GE ? array('created' => 1, 'created_by' => 1, 'modified' => 1, 'modified_by' => 1) : array());
     $via_core_prop = array('alias' => 1, 'disable_comments' => 1, 'notify_subscribers' => 1, 'language' => 1, 'perms' => 1, 'metadata' => 1, 'seoconf' => 1, 'display_params' => 1, 'layout_selection' => 1, 'layout_params' => 1);
     $via_core_prop = array_merge($via_core_prop, FLEXI_J16GE ? array('timezone_info' => 1, 'created_by_alias' => 1, 'publish_up' => 1, 'publish_down' => 1, 'access' => 1) : array('timezone_info' => 1, 'publication_details' => 1));
     $placeable_fields = array_merge($via_core_field, $via_core_prop);
     // 3. Decide placement of CORE properties / fields
     $tab_fields['above'] = $params->get('form_tabs_above', 'title, alias, type, state, disable_comments, notify_subscribers');
     $tab_fields['tab01'] = $params->get('form_tab01_fields', 'categories, tags, language, perms');
     $tab_fields['tab02'] = $params->get('form_tab02_fields', 'maintext');
     $tab_fields['tab03'] = $params->get('form_tab03_fields', 'fields_manager');
     $tab_fields['tab04'] = $params->get('form_tab04_fields', !FLEXI_J16GE ? 'timezone_info, publication_details' : 'timezone_info, created, createdby, created_by_alias, publish_up, publish_down, access');
     $tab_fields['tab05'] = $params->get('form_tab05_fields', 'metadata, seoconf');
     $tab_fields['tab06'] = $params->get('form_tab06_fields', 'display_params');
     $tab_fields['tab07'] = $params->get('form_tab07_fields', 'layout_selection, layout_params');
     $tab_fields['fman'] = $params->get('form_tabs_fieldsman', '');
     $tab_fields['below'] = $params->get('form_tabs_below', '');
     // fix aliases
     foreach ($tab_fields as $tab_name => $field_list) {
         $field_list = str_replace('created_by', 'createdby', $field_list);
         $field_list = str_replace('createdby_alias', 'created_by_alias', $field_list);
         $tab_fields[$tab_name] = $field_list;
     }
     //echo "<pre>"; print_r($tab_fields); echo "</pre>";
     // Split field lists
     $all_tab_fields = array();
     foreach ($tab_fields as $i => $field_list) {
         $tab_fields[$i] = empty($tab_fields[$i]) || $tab_fields[$i] == '_skip_' ? array() : array_flip(preg_split("/[\\s]*,[\\s]*/", $field_list));
         foreach ($tab_fields[$i] as $tbl_name => $ignore) {
             $all_tab_fields[$tbl_name] = 1;
         }
         //$all_tab_fields = array_merge($all_tab_fields, $tab_fields[$i]);
     }
     // Find fields missing from configuration, and place them below the tabs
     foreach ($placeable_fields as $fn => $i) {
         if (!isset($all_tab_fields[$fn])) {
             $tab_fields['below'][$fn] = 1;
         }
     }
     // get TAB titles
     $_tmp = $params->get('form_tab_titles', '1:FLEXI_BASIC, 2:FLEXI_DESCRIPTION, 3:__TYPE_NAME__, 4:FLEXI_PUBLISHING, 5:FLEXI_META_SEO, 6:FLEXI_DISPLAYING, 7:FLEXI_TEMPLATE');
     // Create title of the custom fields default TAB (field manager TAB)
     if ($item->type_id) {
         $types_arr = flexicontent_html::getTypesList();
         $typename = @$types_arr[$item->type_id]['name'];
         $typename = $typename ? JText::_($typename) : JText::_('FLEXI_CONTENT_TYPE');
         $typename = $typename . ' (' . JText::_('FLEXI_DETAILS') . ')';
     } else {
         $typename = JText::_('FLEXI_TYPE_NOT_DEFINED');
     }
     // Split title of default tabs and language filter the titles
     $_tmp = preg_split("/[\\s]*,[\\s]*/", $_tmp);
     $tab_titles = array();
     foreach ($_tmp as $_data) {
         list($tab_no, $tab_title) = preg_split("/[\\s]*:[\\s]*/", $_data);
         if ($tab_title == '__TYPE_NAME__') {
             $tab_titles['tab0' . $tab_no] = $typename;
         } else {
             $tab_titles['tab0' . $tab_no] = JText::_($tab_title);
         }
     }
     // 4. find if some fields are missing placement field
     $coreprop_missing = array();
     foreach ($via_core_prop as $fn => $i) {
         // -EITHER- configured to be shown at default position -OR-
         if (isset($tab_fields['fman'][$fn]) && !isset($core_placers[$fn])) {
             $coreprop_missing[$fn] = true;
             unset($tab_fields['fman'][$fn]);
             $tab_fields['below'][$fn] = 1;
         }
     }
     $placementConf['via_core_field'] = $via_core_field;
     $placementConf['via_core_prop'] = $via_core_prop;
     $placementConf['placeable_fields'] = $placeable_fields;
     $placementConf['tab_fields'] = $tab_fields;
     $placementConf['tab_titles'] = $tab_titles;
     $placementConf['all_tab_fields'] = $all_tab_fields;
     $placementConf['coreprop_missing'] = $coreprop_missing;
     return $placementConf;
 }