当前位置: 首页>>代码示例>>PHP>>正文


PHP flexicontent_html::getSiteDefaultLang方法代码示例

本文整理汇总了PHP中flexicontent_html::getSiteDefaultLang方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::getSiteDefaultLang方法的具体用法?PHP flexicontent_html::getSiteDefaultLang怎么用?PHP flexicontent_html::getSiteDefaultLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flexicontent_html的用法示例。


在下文中一共展示了flexicontent_html::getSiteDefaultLang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getOriginalContentItemids

 static function getOriginalContentItemids($_items, $ids = null)
 {
     if (empty($ids) && empty($_items)) {
         return array();
     }
     if (is_array($_items)) {
         $items =& $_items;
     } else {
         $items = array(&$_items);
     }
     if (empty($ids)) {
         $ids = array();
         foreach ($items as $item) {
             $ids[] = $item->id;
         }
     }
     // Get associated translations
     $db = JFactory::getDBO();
     $query = 'SELECT a.id as id, k.id as original_id' . ' FROM #__associations AS a' . ' JOIN #__associations AS k ON a.`key`=k.`key`' . ' JOIN #__content AS i ON i.id = k.id AND i.language = ' . $db->Quote(flexicontent_html::getSiteDefaultLang()) . ' WHERE a.id IN (' . implode(',', $ids) . ') AND a.context = "com_content.item"';
     $db->setQuery($query);
     $assoc_keys = $db->loadObjectList('id');
     if (!empty($items)) {
         foreach ($items as $item) {
             $item->lang_parent_id = isset($assoc_keys[$item->id]) ? $assoc_keys[$item->id]->original_id : $item->id;
         }
     } else {
         return $assoc_keys;
     }
 }
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:29,代码来源:flexicontent.helper.php

示例2: createLangColumn

 /**
  * Method to create the language datas
  * 
  * @access	public
  * @return	boolean	True on success
  * @since 1.5
  */
 function createLangColumn()
 {
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     $db = JFactory::getDBO();
     $nullDate = $db->getNullDate();
     // Add language column
     $columns = $db->getTableColumns('#__flexicontent_items_ext');
     $language_col = array_key_exists('language', $columns) ? true : false;
     if (!$language_col) {
         $query = "ALTER TABLE #__flexicontent_items_ext ADD `language` VARCHAR( 11 ) NOT NULL DEFAULT '' AFTER `type_id`";
         $db->setQuery($query);
         $result_lang_col = $db->query();
         if (!$result_lang_col) {
             echo "Cannot add language column<br>";
         }
     } else {
         $result_lang_col = true;
     }
     // Add translation group column
     $lang_parent_id_col = array_key_exists('lang_parent_id', $columns) ? true : false;
     if (!$lang_parent_id_col) {
         $query = "ALTER TABLE #__flexicontent_items_ext ADD `lang_parent_id` INT NOT NULL DEFAULT 0 AFTER `language`";
         $db->setQuery($query);
         $result_tgrp_col = $db->query();
         if (!$result_tgrp_col) {
             echo "Cannot add translation group column<br>";
         }
     } else {
         $result_tgrp_col = true;
     }
     // Add default language for items that do not have one, and add translation group to items that do not have one set
     $model = $this->getModel('flexicontent');
     if ($model->getItemsNoLang()) {
         // 1. copy language from __flexicontent_items_ext table into __content
         $this->syncItemsLang();
         // 2. then for those that are still empty, add site default language to the language field if empty
         $lang = flexicontent_html::getSiteDefaultLang();
         $result_items_default_lang = $this->setItemsDefaultLang($lang);
         if (!$result_items_default_lang) {
             echo "Cannot set default language or set default translation group<br>";
         }
     } else {
         $result_items_default_lang = true;
     }
     $query = "\n\t\t\tINSERT INTO `#__associations` (`id`, `context`, `key`)\n\t\t\t\tSELECT DISTINCT ie.item_id, 'com_content.item', ie.lang_parent_id\n\t\t\t\tFROM `#__flexicontent_items_ext` AS ie\n\t\t\t\tJOIN `#__flexicontent_items_ext` AS j ON ie.lang_parent_id = j.lang_parent_id AND ie.item_id<>j.item_id\n\t\t\t\tWHERE ie.lang_parent_id <> 0\n\t\t\tON DUPLICATE KEY UPDATE id=id";
     $db->setQuery($query);
     try {
         $convert_assocs = $db->query();
         $query = "UPDATE `#__flexicontent_items_ext` SET lang_parent_id = 0";
         $db->setQuery($query);
         $clear_assocs = $db->query();
     } catch (Exception $e) {
         echo "Cannot convert FLEXIcontent associations to Joomla associations<br>";
         JError::raiseWarning(500, $e->getMessage());
         $convert_assocs = $clear_assocs = false;
     }
     if (!$result_lang_col || !$result_tgrp_col || !$result_items_default_lang || !$convert_assocs || !$clear_assocs) {
         echo '<span class="install-notok"></span>';
         jexit();
     } else {
         echo '<span class="install-ok"></span>';
     }
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:71,代码来源:controller.php

示例3: saveFields

 /**
  * Method to save field values of the item in field versioning DB table or in ..._fields_item_relations DB table 
  *
  * @access	public
  * @return	boolean	True on success
  * @since	1.0
  */
 function saveFields($isnew, &$item, &$data, &$files)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $dispatcher = JDispatcher::getInstance();
     $cparams = $this->_cparams;
     $use_versioning = $cparams->get('use_versioning', 1);
     $print_logging_info = $cparams->get('print_logging_info');
     $last_version = FLEXIUtilities::getLastVersions($item->id, true);
     $mval_query = true;
     if ($print_logging_info) {
         global $fc_run_times;
     }
     if ($print_logging_info) {
         $start_microtime = microtime(true);
     }
     //*********************************
     // Checks for untranslatable fields
     //*********************************
     // CASE 1. Check if saving an item that translates an original content in site's default language
     // ... Decide whether to retrieve field values of untranslatable fields from the original content item
     $enable_translation_groups = $cparams->get('enable_translation_groups');
     $is_content_default_lang = substr(flexicontent_html::getSiteDefaultLang(), 0, 2) == substr($item->language, 0, 2);
     $get_untraslatable_values = $enable_translation_groups && !$is_content_default_lang && $item->lang_parent_id && $item->lang_parent_id != $item->id;
     // CASE 2. Check if saving an original content item (item's language is site default language)
     // ... Get item ids of translating items
     if ($is_content_default_lang && $this->_id) {
         $query = 'SELECT ie.item_id' . ' FROM #__flexicontent_items_ext as ie' . ' WHERE ie.lang_parent_id = ' . (int) $this->_id . '  AND ie.item_id <> ' . (int) $this->_id;
         // DO NOT include the item itself in associated translations !!
         $this->_db->setQuery($query);
         $assoc_item_ids = FLEXI_J16GE ? $this->_db->loadColumn() : $this->_db->loadResultArray();
     }
     if (empty($assoc_item_ids)) {
         $assoc_item_ids = array();
     }
     // ***************************************************************************************************************************
     // Get item's fields ... and their values (for untranslatable fields the field values from original content item are retrieved
     // ***************************************************************************************************************************
     $fields = $this->getExtrafields($force = true, $get_untraslatable_values ? $item->lang_parent_id : 0);
     // ******************************************************************************************************************
     // Loop through Fields triggering onBeforeSaveField Event handlers, this was seperated from the rest of the process
     // to give chance to ALL fields to check their DATA and cancel item saving process before saving any new field values
     // ******************************************************************************************************************
     $searchindex = array();
     //$qindex = array();
     if ($fields) {
         foreach ($fields as $field) {
             // Set vstate property into the field object to allow this to be changed be the before saving  field event handler
             $field->item_vstate = $data['vstate'];
             if (FLEXI_J16GE) {
                 $is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
             } else {
                 if (FLEXI_ACCESS && $user->gid < 25) {
                     $is_editable = !$field->valueseditable || FAccess::checkAllContentAccess('com_content', 'submit', 'users', $user->gmid, 'field', $field->id);
                 } else {
                     $is_editable = 1;
                 }
             }
             // FORM HIDDEN FIELDS (FRONTEND/BACKEND) AND (ACL) UNEDITABLE FIELDS: maintain their DB value ...
             if ($app->isSite() && ($field->formhidden == 1 || $field->formhidden == 3 || $field->parameters->get('frontend_hidden')) || $app->isAdmin() && ($field->formhidden == 2 || $field->formhidden == 3 || $field->parameters->get('backend_hidden')) || !$is_editable) {
                 $postdata[$field->name] = $field->value;
                 // UNTRANSLATABLE (CUSTOM) FIELDS: maintain their DB value ...
             } else {
                 if ($get_untraslatable_values && $field->untranslatable) {
                     $postdata[$field->name] = $field->value;
                     // CORE FIELDS: if not set maintain their DB value ...
                 } else {
                     if ($field->iscore) {
                         $postdata[$field->name] = @$data[$field->name];
                         if (is_array($postdata[$field->name]) && !count($postdata[$field->name]) || !is_array($postdata[$field->name]) && !strlen(trim($postdata[$field->name]))) {
                             $postdata[$field->name] = $field->value;
                         }
                         // OTHER CUSTOM FIELDS (not hidden and not untranslatable)
                     } else {
                         $postdata[$field->name] = !FLEXI_J16GE ? @$data[$field->name] : @$data['custom'][$field->name];
                     }
                 }
             }
             // Unserialize values already serialized values, e.g. (a) if current values used are from DB or (b) are being imported from CSV file
             if (!is_array($postdata[$field->name])) {
                 $postdata[$field->name] = strlen($postdata[$field->name]) ? array($postdata[$field->name]) : array();
             }
             //echo "<b>{$field->field_type}</b>: <br/> <pre>".print_r($postdata[$field->name], true)."</pre>\n";
             foreach ($postdata[$field->name] as $i => $postdata_val) {
                 if (@unserialize($postdata_val) !== false || $postdata_val === 'b:0;') {
                     $postdata[$field->name][$i] = unserialize($postdata_val);
                 }
             }
             // Trigger plugin Event 'onBeforeSaveField'
             $fieldname = $field->iscore ? 'core' : $field->field_type;
             $result = FLEXIUtilities::call_FC_Field_Func($fieldname, 'onBeforeSaveField', array(&$field, &$postdata[$field->name], &$files[$field->name], &$item));
             //$qindex[$field->name] = NULL;
             //$result = FLEXIUtilities::call_FC_Field_Func($fieldname, 'onBeforeSaveField', array( &$field, &$postdata[$field->name], &$files[$field->name], &$item, &$qindex[$field->name] ));
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:parentclassitem.php

示例4: import

 /**
  * Method to import Joomla! com_content datas and structure
  * this is UNUSED in J2.5+, it may be used in the future
  * 
  * @return boolean true on success
  * @since 1.5
  */
 function import()
 {
     jimport('joomla.utilities.simplexml');
     // Deprecated J2.5, removed J3.x
     // Get the site default language
     $lang = flexicontent_html::getSiteDefaultLang();
     if (!FLEXI_J16GE) {
         // Get all Joomla sections
         $query = 'SELECT * FROM #__sections';
         $this->_db->setQuery($query);
         $sections = $this->_db->loadObjectList();
     }
     $logs = new stdClass();
     if (!FLEXI_J16GE) {
         $logs->sec = 0;
     }
     $logs->cat = 0;
     $logs->art = 0;
     //$logs->err = new stdClass();
     // Create the new category for the flexicontent items
     $topcat = JTable::getInstance('flexicontent_categories', '');
     $topcat->parent_id = 1;
     $topcat->level = 0;
     $topcat->extension = "com_content";
     $topcat->title = 'FLEXIcontent';
     $topcat->alias = 'flexicontent';
     $topcat->lft = null;
     $topcat->rgt = null;
     $topcat->level = 0;
     $topcat->published = 1;
     $topcat->access = 1;
     $topcat->language = "*";
     $topcat->setLocation(0, 'last-child');
     $topcat->check();
     $topcat->store();
     $topcat->rebuildPath($topcat->id);
     // Get the category default parameters in a string
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $catparams = new JRegistry();
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if (!$param->attributes('name')) {
                 continue;
             }
             // FIX for empty name e.g. seperator fields
             $catparams->set($param->attributes('name'), $param->attributes('default'));
         }
     }
     $catparams_str = $catparams->toString();
     // Loop through the top category object and create cat -> subcat -> items -> fields
     $k = 0;
     if ($topcat->id) {
         // Get the sub-categories of the root category that belong to com_content
         $query = "SELECT * FROM #__categories as c WHERE c.extension='com_content' ";
         $this->_db->setQuery($query);
         $categories = $this->_db->loadObjectList();
         /*//get children
         		$children = array();
         		foreach ($categories as $child) {
         			$parent = $child->parent_id;
         			$list = @$children[$parent] ? $children[$parent] : array();
         			array_push($list, $child);
         			$children[$parent] = $list;
         		}
         		$categories = $children;
         		//unset($children);
         		*/
         $map_old_new = array();
         $map_old_new[1] = $topcat->id;
         // Loop throught the categories of the created section
         foreach ($categories as $category) {
             $subcat = JTable::getInstance('flexicontent_categories', '');
             $subcat->load($category->id);
             $subcat->id = 0;
             $subcat->lft = null;
             $subcat->rgt = null;
             $subcat->level = null;
             $subcat->parent_id = isset($map_old_new[$category->parent_id]) ? $map_old_new[$category->parent_id] : $topcat->id;
             $subcat->setLocation($subcat->parent_id, 'last-child');
             $subcat->params = $category->params;
             $k++;
             $subcat->check();
             if ($subcat->store()) {
                 $logs->cat++;
             } else {
                 $logs->err->{$k}->type = JText::_('FLEXI_IMPORT_CATEGORY') . ' id';
                 $logs->err->{$k}->id = $category->id;
                 $logs->err->{$k}->title = $category->title;
             }
             $subcat->rebuildPath($subcat->id);
             $map_old_new[$category->id] = $subcat->id;
             // Get the articles of the created category
//.........这里部分代码省略.........
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:101,代码来源:items.php

示例5: import

 /**
  * Method to import Joomla! com_content datas and structure
  * this is UNUSED in J2.5+, it may be used in the future
  * 
  * @return boolean true on success
  * @since 1.5
  */
 function import()
 {
     jimport('joomla.utilities.simplexml');
     // Deprecated J2.5, removed J3.x
     // Get the site default language
     $lang = flexicontent_html::getSiteDefaultLang();
     if (!FLEXI_J16GE) {
         // Get all Joomla sections
         $query = 'SELECT * FROM #__sections';
         $this->_db->setQuery($query);
         $sections = $this->_db->loadObjectList();
     }
     $logs = new stdClass();
     if (!FLEXI_J16GE) {
         $logs->sec = 0;
     }
     $logs->cat = 0;
     $logs->art = 0;
     //$logs->err = new stdClass();
     // Create the new section for flexicontent items
     $flexisection = JTable::getInstance('section');
     $flexisection->title = 'FLEXIcontent';
     $flexisection->alias = 'flexicontent';
     $flexisection->published = 1;
     $flexisection->ordering = $flexisection->getNextOrder();
     $flexisection->access = 0;
     $flexisection->scope = 'content';
     $flexisection->check();
     $flexisection->store();
     // Get the category default parameters in a string
     $xml = new JSimpleXML();
     $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml');
     $catparams = FLEXI_J16GE ? new JRegistry() : new JParameter("");
     foreach ($xml->document->params as $paramGroup) {
         foreach ($paramGroup->param as $param) {
             if (!$param->attributes('name')) {
                 continue;
             }
             // FIX for empty name e.g. seperator fields
             $catparams->set($param->attributes('name'), $param->attributes('default'));
         }
     }
     $catparams_str = $catparams->toString();
     // Loop through the section object and create cat -> subcat -> items -> fields
     $k = 0;
     foreach ($sections as $section) {
         // Create a category for every imported section, to contain all categories of the section
         $cat = JTable::getInstance('flexicontent_categories', '');
         $cat->parent_id = 0;
         $cat->title = $section->title;
         $cat->name = $section->name;
         $cat->alias = $section->alias;
         $cat->image = $section->image;
         $cat->section = $flexisection->id;
         $cat->image_position = $section->image_position;
         $cat->description = $section->description;
         $cat->published = $section->published;
         $cat->ordering = $section->ordering;
         $cat->access = $section->access;
         $cat->params = $catparams_str;
         $k++;
         $cat->check();
         if ($cat->store()) {
             $logs->sec++;
         } else {
             $logs->err->{$k}->type = JText::_('FLEXI_IMPORT_SECTION') . ' id';
             $logs->err->{$k}->id = $section->id;
             $logs->err->{$k}->title = $section->title;
         }
         // Get the categories of each imported section
         $query = "SELECT * FROM #__categories WHERE section = " . $section->id;
         $this->_db->setQuery($query);
         $categories = $this->_db->loadObjectList();
         // Loop throught the categories of the created section
         foreach ($categories as $category) {
             $subcat = JTable::getInstance('flexicontent_categories', '');
             $subcat->load($category->id);
             $subcat->id = 0;
             $subcat->parent_id = $cat->id;
             $subcat->section = $flexisection->id;
             $subcat->params = $catparams_str;
             $k++;
             $subcat->check();
             if ($subcat->store()) {
                 $logs->cat++;
             } else {
                 $logs->err->{$k}->type = JText::_('FLEXI_IMPORT_CATEGORY') . ' id';
                 $logs->err->{$k}->id = $category->id;
                 $logs->err->{$k}->title = $category->title;
             }
             // Get the articles of the created category
             $query = 'SELECT * FROM #__content WHERE catid = ' . $category->id;
             $this->_db->setQuery($query);
//.........这里部分代码省略.........
开发者ID:jakesyl,项目名称:flexicontent,代码行数:101,代码来源:items.php

示例6: _buildContentWhere

 /**
  * Build the where clause
  *
  * @access private
  * @return string
  */
 function _buildContentWhere()
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $option = JRequest::getVar('option');
     $langparent_item = $app->getUserStateFromRequest($option . '.itemelement.langparent_item', 'langparent_item', 0, 'int');
     $type_id = $app->getUserStateFromRequest($option . '.itemelement.type_id', 'type_id', 0, 'int');
     $created_by = $app->getUserStateFromRequest($option . '.itemelement.created_by', 'created_by', 0, 'int');
     if ($langparent_item) {
         $user_fullname = JFactory::getUser($created_by)->name;
         $this->_db->setQuery('SELECT name FROM #__flexicontent_types WHERE id = ' . $type_id);
         $type_name = $this->_db->loadResult();
         $msg = sprintf("Selecting ORIGINAL Content item for a translating item of &nbsp; Content Type: \"%s\" &nbsp; and &nbsp; User: \"%s\"", $type_name, $user_fullname);
         $jAp = JFactory::getApplication();
         $jAp->enqueueMessage($msg, 'message');
     }
     $filter_state = $app->getUserStateFromRequest($option . '.itemelement.filter_state', 'filter_state', '', 'word');
     $filter_cats = $app->getUserStateFromRequest($option . '.itemelement.filter_cats', 'filter_cats', '', 'int');
     $filter_type = $app->getUserStateFromRequest($option . '.itemelement.filter_type', 'filter_type', '', 'int');
     if (FLEXI_FISH || FLEXI_J16GE) {
         if ($langparent_item) {
             $filter_lang = flexicontent_html::getSiteDefaultLang();
         } else {
             $filter_lang = $app->getUserStateFromRequest($option . '.itemelement.filter_lang', 'filter_lang', '', 'cmd');
         }
     }
     $search = $app->getUserStateFromRequest($option . '.itemelement.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $where = array();
     $where[] = ' i.state != -2';
     // Exclude trashed
     if (!FLEXI_J16GE) {
         $where[] = ' sectionid = ' . FLEXI_SECTION;
     }
     if ($filter_state) {
         if ($filter_state == 'P') {
             $where[] = 'i.state = 1';
         } else {
             if ($filter_state == 'U') {
                 $where[] = 'i.state = 0';
             } else {
                 if ($filter_state == 'PE') {
                     $where[] = 'i.state = -3';
                 } else {
                     if ($filter_state == 'OQ') {
                         $where[] = 'i.state = -4';
                     } else {
                         if ($filter_state == 'IP') {
                             $where[] = 'i.state = -5';
                         } else {
                             if ($filter_state == 'A') {
                                 $where[] = 'i.state = ' . (FLEXI_J16GE ? 2 : -1);
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($filter_cats) {
         $where[] = 'rel.catid = ' . $filter_cats;
     }
     if ($langparent_item && $type_id) {
         $where[] = 'ie.type_id = ' . $type_id;
     } else {
         if ($filter_type) {
             $where[] = 'ie.type_id = ' . $filter_type;
         }
     }
     if (FLEXI_FISH || FLEXI_J16GE) {
         if ($filter_lang) {
             $where[] = 'ie.language = ' . $this->_db->Quote($filter_lang);
         }
     }
     if ($search) {
         $search_escaped = FLEXI_J16GE ? $this->_db->escape($search, true) : $this->_db->getEscaped($search, true);
         $where[] = ' LOWER(i.title) LIKE ' . $this->_db->Quote('%' . $search_escaped . '%', false);
     }
     /*if (FLEXI_J16GE) {
     			$isAdmin = JAccess::check($user->id, 'core.admin', 'root.1');
     		} else {
     			$isAdmin = $user->gid >= 24;
     		}*/
     if (FLEXI_J16GE) {
         $assocanytrans = $user->authorise('flexicontent.assocanytrans', 'com_flexicontent');
     } else {
         if (FLEXI_ACCESS) {
             $assocanytrans = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'assocanytrans', 'users', $user->gmid) : 1;
         } else {
             $assocanytrans = $user->gid >= 24;
         }
     }
     // is at least admin
     if (!$assocanytrans) {
//.........这里部分代码省略.........
开发者ID:jakesyl,项目名称:flexicontent,代码行数:101,代码来源:itemelement.php

示例7: getlanguageslist

	/**
	 * Method to get information of site languages
	 *
	 * @return object
	 * @since 1.5
	 */
	static function getlanguageslist($published_only=false, $add_all = true)
	{
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		static $pub_languages = null;
		static $all_languages = null;
		
		if ( $published_only ) {
			if ($pub_languages) return $pub_languages;
			else $pub_languages = false;
		}
		
		if ( !$published_only ) {
			if ($all_languages) return $all_languages;
			else $all_languages = false;
		}

		// ******************
		// Retrieve languages
		// ******************
		if (FLEXI_J16GE) {   // Use J1.6+ language info
			$query = 'SELECT DISTINCT lc.lang_id as id, lc.image as image_prefix, lc.lang_code as code, lc.title_native, '
				. ' CASE WHEN CHAR_LENGTH(lc.title_native) THEN CONCAT(lc.title, " (", lc.title_native, ")") ELSE lc.title END as name '
				.' FROM #__languages as lc '
				.' WHERE 1 '.($published_only ? ' AND lc.published=1' : '')
				. ' ORDER BY lc.ordering ASC '
				;
		} else if (FLEXI_FISH) {   // Use joomfish languages table
			$query = 'SELECT l.* '
				. ( FLEXI_FISH_22GE ? ', lext.* ' : '' )
				. ( FLEXI_FISH_22GE ? ', l.lang_id as id ' : ', l.id ' )
				. ( FLEXI_FISH_22GE ? ', l.lang_code as code, l.sef as shortcode' : ', l.code, l.shortcode' )
				. ( FLEXI_FISH_22GE ? ', CASE WHEN CHAR_LENGTH(l.title_native) THEN CONCAT(l.title, " (", l.title_native, ")") ELSE l.title END as name ' : ', l.name ' )
				. ' FROM #__languages as l'
				. ( FLEXI_FISH_22GE ? ' LEFT JOIN #__jf_languages_ext as lext ON l.lang_id=lext.lang_id ' : '')
				. ' WHERE '.    (FLEXI_FISH_22GE ? ' l.published=1 ' : ' l.active=1 ')
				. ' ORDER BY '. (FLEXI_FISH_22GE ? ' lext.ordering ASC ' : ' l.ordering ASC ')
				;
		} else {
			//echo "<pre>"; debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); echo "</pre>";
			//JError::raiseNotice(500, 'getlanguageslist(): Notice no joomfish installed');
			//return array();
		}
		if ( !empty($query) ) {
			$db->setQuery($query);
			$languages = $db->loadObjectList('id');
			//echo "<pre>"; print_r($languages); echo "</pre>"; exit;
			if ($db->getErrorNum())  JFactory::getApplication()->enqueueMessage(__FUNCTION__.'(): SQL QUERY ERROR:<br/>'.nl2br($db->getErrorMsg()),'error');
		}
		
		
		// *********************
		// Calculate image paths
		// *********************
		if (FLEXI_J16GE)  {  // FLEXI_J16GE, use J1.6+ images
			$imgpath	= $app->isAdmin() ? '../images/':'images/';
			$mediapath	= $app->isAdmin() ? '../media/mod_languages/images/' : 'media/mod_languages/images/';
		} else {      // Use joomfish images
			$imgpath	= $app->isAdmin() ? '../images/':'images/';
			$mediapath	= $app->isAdmin() ? '../components/com_joomfish/images/flags/' : 'components/com_joomfish/images/flags/';
		}
		
		
		// ************************
		// Prepare language objects
		// ************************
		$_languages = array();
		
		// J1.6+ add 'ALL' also add 'ALL' if no languages found, since this is default for J1.6+
		if (FLEXI_J16GE && $add_all) {
			$lang_all = new stdClass();
			$lang_all->code = '*';
			$lang_all->name = JText::_('FLEXI_ALL');
			$lang_all->shortcode = '*';
			$lang_all->id = 0;
			$_languages = array( 0 => $lang_all);
		}
		
		// J1.5 add default site language if no languages found, e.g. no Joom!Fish installed
		if (!FLEXI_J16GE && empty($languages)) {
			$lang_default = new stdClass();
			$lang_default->code = flexicontent_html::getSiteDefaultLang();
			$lang_default->name = $lang_default->code;
			$lang_default->shortcode = strpos($lang_default->code,'-') ?
				substr($lang_default->code, 0, strpos($lang_default->code,'-')) :
				$lang_default->code;
			$lang_default->id = 0;
			$_languages = array( 0 => $lang_default);
		}
		
		// Check if no languages found and return
		if ( empty($languages) )  return $_languages;
		
		if (FLEXI_J16GE)  // FLEXI_J16GE, based on J1.6+ language data and images
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:flexicontent.helper.php

示例8: display


//.........这里部分代码省略.........
        // 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);*/
        $fname = $model->getFieldName($fieldid);
        $files_selected = $model->getItemFiles($u_item_id);
        $formfieldname = FLEXI_J16GE ? 'custom[' . $fname . '][]' : $fname . '[]';
        //add js to document
        if ($folder_mode) {
            $js = "\n\t\t\t\n\t\t\twindow.addEvent('domready', function() {\n\n\t\t    function closest (obj, el) {\n\t\t        var find = obj.getElement(el);\n\t\t        var self = obj;\n\t\t        \n\t\t        while (self && !find) {\n\t\t            self = self.getParent();\n\t\t            find = self ? self.getElement(el) : null;\n\t\t        }\n\t\t        return find;\n\t\t    }\n\n\t\t\t\tvar delfilename = '" . $delfilename . "';\n\t\t\t\tvar remove_existing_files_from_list = 0;\n\t\t\t\tvar remove_new_files_from_list = 0;\n\t\t\t\toriginal_objs = \$(window.parent.document.body).getElement('#container_fcfield_" . $fieldid . "').getElements('.originalname');\n\t\t\t\texisting_objs = \$(window.parent.document.body).getElement('#container_fcfield_" . $fieldid . "').getElements('.existingname');\n\t\t\t\t\n\t\t\t\tvar imgobjs = Array();\n\t\t\t\tfor(i=0,n=original_objs.length; i<n; i++)  {\n\t\t\t\t\tif (original_objs[i].value) imgobjs.push(original_objs[i].value);\n\t\t\t\t\tif ( delfilename!='' && original_objs[i].value == delfilename)\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.parent.deleteField" . $fieldid . "( original_objs[i].getParent() );\n\t\t\t\t\t\tremove_existing_files_from_list = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i=0,n=existing_objs.length; i<n; i++) {\n\t\t\t\t\tif ( existing_objs[i].value) imgobjs.push(existing_objs[i].value);\n\t\t\t\t\tif ( delfilename!='' && existing_objs[i].value == delfilename)\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.parent.deleteField" . $fieldid . "(\n\t\t\t\t\t\t\t(MooTools.version>='1.2.4')  ?  existing_objs[i].getParent('.img_value_props')  :  closest (existing_objs[i] , '.img_value_props')\n\t\t\t\t\t\t);\n\t\t\t\t\t\tremove_new_files_from_list = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( remove_existing_files_from_list || remove_new_files_from_list ) {\n\t\t\t\t\tmssg = '" . JText::_('FLEXI_DELETE_FILE_IN_LIST_WINDOW_MUST_CLOSE') . "';\n\t\t\t\t\tmssg = mssg + '\\n' + (remove_existing_files_from_list ? '" . JText::_('FLEXI_EXISTING_FILE_REMOVED_SAVE_RECOMMENEDED', true) . "' : '');\n\t\t\t\t\talert( mssg );\n\t\t\t\t\t(MooTools.version>='1.2.4') ?  window.parent.SqueezeBox.close()  :  window.parent.document.getElementById('sbox-window').close();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor(i=0,n=imgobjs.length; i<n; i++) {\n\t\t\t\t\tvar rows = \$(document.body).getElements('a[rel='+ imgobjs[i] +']');\n\t\t\t\t\trows.addClass('striketext');\n\t\t\t\t\t\n\t\t\t\t\t//if( (typeof rows) != 'undefined' && rows != null) {\n\t\t\t\t\t\t//alert(rows[0]);\n\t\t\t\t\t\t//row.className = 'striketext';\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t\t" . ($autoassign && $newfilename ? "window.parent.qmAssignFile" . $fieldid . "('" . $targetid . "', '" . $newfilename . "', '" . $thumb . "');" : "") . "\n\t\t\t});\n\t\t\t";
        } else {
            $js = "\n\t\t\tfunction qffileselementadd(obj, id, file) {\n\t\t\t\tvar result = window.parent.qfSelectFile" . $fieldid . "(id, file);\n\t\t\t\tif ((typeof result) != 'undefined' && result == 'cancel') return;\n\t\t\t\tobj.className = 'striketext';\n\t\t\t\tdocument.adminForm.file.value=id;\n\t\t\t}\n\t\t\twindow.addEvent('domready', function() {\n\t\t\t\tfileobjs = window.parent.document.getElementsByName('{$formfieldname}');\n\t\t\t\tfor(i=0,n=fileobjs.length; i<n; i++) {\n\t\t\t\t\trow = document.getElementById('file'+fileobjs[i].value);\n\t\t\t\t\tif( (typeof row) != 'undefined' && row != null) {\n\t\t\t\t\t\trow.className = 'striketext';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t" . ($autoselect && $newfileid ? "qffileselementadd( document.getElementById('file" . $newfileid . "'), '" . $newfileid . "', '" . $newfilename . "');" : "") . "\n\t\t\t});\n\t\t\t";
        }
        $document->addScriptDeclaration($js);
        if ($autoselect && $newfileid) {
            $app->enqueueMessage(JText::_('FLEXI_UPLOADED_FILE_WAS_SELECTED'), 'message');
        }
        /*****************
         ** 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'));
开发者ID:jakesyl,项目名称:flexicontent,代码行数:67,代码来源:view.html.php

示例9: display


//.........这里部分代码省略.........
     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);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:view.html.php

示例10: createLangColumn

 /**
  * Method to create the language datas
  * 
  * @access	public
  * @return	boolean	True on success
  * @since 1.5
  */
 function createLangColumn()
 {
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     $db = JFactory::getDBO();
     $nullDate = $db->getNullDate();
     // Add language column
     if (!FLEXI_J16GE) {
         $fields = $db->getTableFields(array('#__flexicontent_items_ext'));
         $columns = $fields['#__flexicontent_items_ext'];
     } else {
         $columns = $db->getTableColumns('#__flexicontent_items_ext');
     }
     $language_col = array_key_exists('language', $columns) ? true : false;
     if (!$language_col) {
         $query = "ALTER TABLE #__flexicontent_items_ext ADD `language` VARCHAR( 11 ) NOT NULL DEFAULT '' AFTER `type_id`";
         $db->setQuery($query);
         $result_lang_col = $db->query();
         if (!$result_lang_col) {
             echo "Cannot add language column<br>";
         }
     } else {
         $result_lang_col = true;
     }
     // Add translation group column
     $lang_parent_id_col = array_key_exists('lang_parent_id', $columns) ? true : false;
     if (!$lang_parent_id_col) {
         $query = "ALTER TABLE #__flexicontent_items_ext ADD `lang_parent_id` INT NOT NULL DEFAULT 0 AFTER `language`";
         $db->setQuery($query);
         $result_tgrp_col = $db->query();
         if (!$result_tgrp_col) {
             echo "Cannot add translation group column<br>";
         }
     } else {
         $result_tgrp_col = true;
     }
     // Add default language for items that do not have one, and add translation group to items that do not have one set
     $model = $this->getModel('flexicontent');
     if ($model->getItemsNoLang()) {
         // Add site default language to the language field if empty
         $lang = flexicontent_html::getSiteDefaultLang();
         $result_items_default_lang = $this->setItemsDefaultLang($lang);
         if (!$result_items_default_lang) {
             echo "Cannot set default language or set default translation group<br>";
         }
     } else {
         $result_items_default_lang = true;
     }
     if (!$result_lang_col || !$result_tgrp_col || !$result_items_default_lang) {
         echo '<span class="install-notok"></span>';
         jexit();
     } else {
         echo '<span class="install-ok"></span>';
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:62,代码来源:controller.php

示例11: htmlspecialchars

				<div class="fcclear"></div>
				<?php 
        $label_tooltip = 'class="hasTip flexi_label" title="' . '::' . htmlspecialchars(JText::_('FLEXI_ORIGINAL_CONTENT_ITEM_DESC'), ENT_COMPAT, 'UTF-8') . '"';
        ?>
				<label id="jform_lang_parent_id-lbl" for="jform_lang_parent_id" <?php 
        echo $label_tooltip;
        ?>
 >
					<?php 
        echo JText::_('FLEXI_ORIGINAL_CONTENT_ITEM');
        ?>
				</label>
				
				<div class="container_fcfield container_fcfield_name_originalitem">
				<?php 
        if ($this->row->id && (substr(flexicontent_html::getSiteDefaultLang(), 0, 2) == substr($this->row->language, 0, 2) || $this->row->language == '*')) {
            ?>
					<br/><small><?php 
            echo JText::_($this->row->language == '*' ? 'FLEXI_ORIGINAL_CONTENT_ALL_LANGS' : 'FLEXI_ORIGINAL_TRANSLATION_CONTENT');
            ?>
</small>
					<input type="hidden" name="jform[lang_parent_id]" id="jform_lang_parent_id" value="<?php 
            echo $this->row->id;
            ?>
" />
				<?php 
        } else {
            ?>
					<?php 
            if (1) {
                // currently selecting associated item, is always allowed in backend
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:31,代码来源:default.php

示例12: display


//.........这里部分代码省略.........
            }
            $previewlink = $item_url . (strstr($item_url, '?') ? '&amp;' : '?') . 'preview=1' . $autologin;
            //$previewlink     = str_replace('&amp;', '&', $previewlink);
            //$previewlink = JRoute::_(JURI::root() . FlexicontentHelperRoute::getItemRoute($item->id.':'.$item->alias, $categories[$item->catid]->slug)) .$autologin;
            // PREVIEW for latest version
            if (!$params->get('use_versioning', 1) || $item->version == $item->current_version && $item->version == $item->last_version) {
                $toolbar->appendButton('Custom', '<button class="preview btn btn-small btn-info spaced-btn" onClick="window.open(\'' . $previewlink . '\');"><span title="' . JText::_('Preview') . '" class="icon-screen"></span>' . JText::_('Preview') . '</button>', 'preview');
            } else {
                // Add a preview button for (currently) LOADED version of the item
                $previewlink_loaded_ver = $previewlink . '&version=' . $item->version;
                $toolbar->appendButton('Custom', '<button class="preview btn btn-small" onClick="window.open(\'' . $previewlink_loaded_ver . '\');" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-screen"></span>' . JText::_('FLEXI_PREVIEW_FORM_LOADED_VERSION') . ' [' . $item->version . ']</button>', 'preview');
                // Add a preview button for currently ACTIVE version of the item
                $previewlink_active_ver = $previewlink . '&version=' . $item->current_version;
                $toolbar->appendButton('Custom', '<button class="preview btn btn-small" onClick="window.open(\'' . $previewlink_active_ver . '\');" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-screen"></span>' . JText::_('FLEXI_PREVIEW_FRONTEND_ACTIVE_VERSION') . ' [' . $item->current_version . ']</button>', 'preview');
                // Add a preview button for currently LATEST version of the item
                $previewlink_last_ver = $previewlink;
                //'&version='.$item->last_version;
                $toolbar->appendButton('Custom', '<button class="preview btn btn-small" onClick="window.open(\'' . $previewlink_last_ver . '\');" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-screen"></span>' . JText::_('FLEXI_PREVIEW_LATEST_SAVED_VERSION') . ' [' . $item->last_version . ']</button>', 'preview');
            }
            JToolBarHelper::spacer();
            JToolBarHelper::divider();
            JToolBarHelper::spacer();
        }
        // ************************
        // Add modal layout editing
        // ************************
        if ($perms['cantemplates']) {
            JToolBarHelper::divider();
            if (!$isnew || $item->version) {
                flexicontent_html::addToolBarButton('FLEXI_EDIT_LAYOUT', $btn_name = 'apply_ajax', $full_js = "var url = jQuery(this).attr('data-href'); fc_showDialog(url, 'fc_modal_popup_container'); return false;", $msg_alert = '', $msg_confirm = '', $btn_task = 'items.apply_ajax', $extra_js = '', $btn_list = false, $btn_menu = true, $btn_confirm = false, $btn_class = "btn-info" . $tip_class, $btn_icon = "icon-pencil", 'data-placement="bottom" data-href="index.php?option=com_flexicontent&amp;view=template&amp;type=items&amp;tmpl=component&amp;ismodal=1&amp;folder=' . $item->itemparams->get('ilayout', $tparams->get('ilayout', 'default')) . '" title="Edit the display layout of this item. <br/><br/>Note: this layout maybe assigned to content types or other items, thus changing it will effect them too"');
            }
        }
        // Check if saving an item that translates an original content in site's default language
        $site_default = substr(flexicontent_html::getSiteDefaultLang(), 0, 2);
        $is_content_default_lang = $site_default == substr($item->language, 0, 2);
        // *****************************************************************************
        // Get (CORE & CUSTOM) fields and their VERSIONED values and then
        // (a) Apply Content Type Customization to CORE fields (label, description, etc)
        // (b) Create the edit html of the CUSTOM fields by triggering 'onDisplayField'
        // *****************************************************************************
        if ($print_logging_info) {
            $start_microtime = microtime(true);
        }
        $fields = $this->get('Extrafields');
        $item->fields =& $fields;
        if ($print_logging_info) {
            $fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
        }
        if ($print_logging_info) {
            $start_microtime = microtime(true);
        }
        $jcustom = $app->getUserState('com_flexicontent.edit.item.custom');
        //print_r($jcustom);
        foreach ($fields as $field) {
            // a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
            // NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
            if ($field->iscore) {
                FlexicontentFields::loadFieldConfig($field, $item);
            }
            // b. Create field 's editing HTML (the form field)
            // NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
            if (!$field->iscore) {
                if (isset($jcustom[$field->name])) {
                    $field->value = array();
                    foreach ($jcustom[$field->name] as $i => $_val) {
                        $field->value[$i] = $_val;
开发者ID:nettdotkomm,项目名称:flexicontent-cck,代码行数:67,代码来源:view.html.php

示例13: saveFields

    /**
     * Method to save field values of the item in field versioning DB table or in ..._fields_item_relations DB table 
     *
     * @access	public
     * @return	boolean	True on success
     * @since	1.0
     */
    function saveFields($isnew, &$item, &$data, &$files, &$old_item = null, &$core_data_via_events = null)
    {
        if (!$old_item) {
            $old_item =& $item;
        }
        $app = JFactory::getApplication();
        $user = JFactory::getUser();
        $dispatcher = JDispatcher::getInstance();
        $cparams = $this->_cparams;
        $use_versioning = $cparams->get('use_versioning', 1);
        $print_logging_info = $cparams->get('print_logging_info');
        $last_version = (int) FLEXIUtilities::getLastVersions($item->id, true);
        $mval_query = true;
        if ($print_logging_info) {
            global $fc_run_times;
        }
        if ($print_logging_info) {
            $start_microtime = microtime(true);
        }
        // ********************************
        // Checks for untranslatable fields
        // ********************************
        // CASE 1. Check if saving an item that translates an original content in site's default language
        // ... Decide whether to retrieve field values of untranslatable fields from the original content item
        $enable_translation_groups = flexicontent_db::useAssociations();
        //$cparams->get('enable_translation_groups');
        $site_default = substr(flexicontent_html::getSiteDefaultLang(), 0, 2);
        $is_content_default_lang = $site_default == substr($item->language, 0, 2);
        $get_untraslatable_values = $enable_translation_groups && !$is_content_default_lang;
        if ($enable_translation_groups) {
            $langAssocs = $this->getLangAssocs();
            //}
            //if ($enable_translation_groups /*&& $is_content_default_lang*/)
            //{
            // ... Get item ids of the associated items, so that we save into the untranslatable fields
            $_langAssocs = $langAssocs;
            unset($_langAssocs[$this->_id]);
            $assoc_item_ids = array_keys($_langAssocs);
        }
        if (empty($assoc_item_ids)) {
            $assoc_item_ids = array();
        }
        // ***************************************************************************************************************************
        // Get item's fields ... and their values (for untranslatable fields the field values from original content item are retrieved
        // ***************************************************************************************************************************
        $original_content_id = 0;
        if ($get_untraslatable_values) {
            foreach ($langAssocs as $content_id => $_assoc) {
                if ($site_default == substr($_assoc->language, 0, 2)) {
                    $original_content_id = $content_id;
                    break;
                }
            }
        }
        //JFactory::getApplication()->enqueueMessage(__FUNCTION__.'(): '.$original_content_id.' '.print_r($assoc_item_ids, true),'message');
        $fields = $this->getExtrafields($force = true, $original_content_id, $old_item);
        // ******************************************************************************************************************
        // Loop through Fields triggering onBeforeSaveField Event handlers, this was seperated from the rest of the process
        // to give chance to ALL fields to check their DATA and cancel item saving process before saving any new field values
        // ******************************************************************************************************************
        $searchindex = array();
        //$qindex = array();
        $core_data_via_events = array();
        // Extra validation for some core fields via onBeforeSaveField
        if ($fields) {
            $core_via_post = array('title' => 1, 'text' => 1);
            foreach ($fields as $field) {
                // Set vstate property into the field object to allow this to be changed be the before saving  field event handler
                $field->item_vstate = $data['vstate'];
                $is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
                $maintain_dbval = false;
                // FORM HIDDEN FIELDS (FRONTEND/BACKEND) AND (ACL) UNEDITABLE FIELDS: maintain their DB value ...
                if ($app->isSite() && ($field->formhidden == 1 || $field->formhidden == 3 || $field->parameters->get('frontend_hidden')) || $app->isAdmin() && ($field->formhidden == 2 || $field->formhidden == 3 || $field->parameters->get('backend_hidden')) || !$is_editable) {
                    $postdata[$field->name] = $field->value;
                    $maintain_dbval = true;
                    // UNTRANSLATABLE (CUSTOM) FIELDS: maintain their DB value ...
                    /*} else if ( $get_untraslatable_values && $field->untranslatable ) {
                    		$postdata[$field->name] = $field->value;
                    		$maintain_dbval = true;*/
                } else {
                    if ($field->iscore) {
                        // (posted) CORE FIELDS: if not set maintain their DB value ...
                        if (isset($core_via_post[$field->name])) {
                            if (isset($data[$field->name])) {
                                $postdata[$field->name] = $data[$field->name];
                            } else {
                                $postdata[$field->name] = $field->value;
                                $maintain_dbval = true;
                            }
                            // (not posted) CORE FIELDS: get current value
                        } else {
                            // Get value from the updated item instead of old data
                            $postdata[$field->name] = $this->getCoreFieldValue($field, 0);
//.........这里部分代码省略.........
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:101,代码来源:parentclassitem.php

示例14: _displayForm


//.........这里部分代码省略.........
                    $msg = $content_is_limited ? JText::sprintf('FLEXI_ALERTNOTAUTH_CREATE_MORE', $max_auth_limit) : '';
                }
            }
            if ($not_authorised && !$allowunauthorize || @$content_is_limited) {
                // User isn't authorize to add ANY content
                if ($notauth_menu = $app->getMenu()->getItem($notauth_itemid)) {
                    // a. custom unauthorized submission page via menu item
                    $internal_link_vars = @$notauth_menu->component ? '&Itemid=' . $notauth_itemid . '&option=' . $notauth_menu->component : '';
                    $notauthurl = JRoute::_($notauth_menu->link . $internal_link_vars, false);
                    JError::raiseNotice(403, $msg);
                    $app->redirect($notauthurl);
                } else {
                    if ($unauthorized_page) {
                        // b. General unauthorized page via global configuration
                        JError::raiseNotice(403, $msg);
                        $app->redirect($unauthorized_page);
                    } else {
                        // c. Finally fallback to raising a 403 Exception/Error that will redirect to site's default 403 unauthorized page
                        if (FLEXI_J16GE) {
                            throw new Exception($msg, 403);
                        } else {
                            JError::raiseError(403, $msg);
                        }
                    }
                }
            }
        }
        // *****************************************************************************
        // Get (CORE & CUSTOM) fields and their VERSIONED values and then
        // (a) Apply Content Type Customization to CORE fields (label, description, etc)
        // (b) Create the edit html of the CUSTOM fields by triggering 'onDisplayField'
        // *****************************************************************************
        // Check if saving an item that translates an original content in site's default language
        $site_default = substr(flexicontent_html::getSiteDefaultLang(), 0, 2);
        $is_content_default_lang = $site_default == substr($item->language, 0, 2);
        //$modify_untraslatable_values = $enable_translation_groups && !$is_content_default_lang; // && $item->lang_parent_id && $item->lang_parent_id!=$item->id;
        if ($print_logging_info) {
            $start_microtime = microtime(true);
        }
        $fields = $this->get('Extrafields');
        $item->fields =& $fields;
        if ($print_logging_info) {
            $fc_run_times['get_field_vals'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10;
        }
        if ($print_logging_info) {
            $start_microtime = microtime(true);
        }
        $jcustom = $app->getUserState('com_flexicontent.edit.item.custom');
        //print_r($jcustom);
        foreach ($fields as $field) {
            // a. Apply CONTENT TYPE customizations to CORE FIELDS, e.g a type specific label & description
            // NOTE: the field parameters are already created so there is not need to call this for CUSTOM fields, which do not have CONTENT TYPE customizations
            if ($field->iscore) {
                FlexicontentFields::loadFieldConfig($field, $item);
            }
            // b. Create field 's editing HTML (the form field)
            // NOTE: this is DONE only for CUSTOM fields, since form field html is created by the form for all CORE fields, EXCEPTION is the 'text' field (see bellow)
            if (!$field->iscore) {
                if (isset($jcustom[$field->name])) {
                    $field->value = array();
                    foreach ($jcustom[$field->name] as $i => $_val) {
                        $field->value[$i] = $_val;
                    }
                }
                $is_editable = !$field->valueseditable || $user->authorise('flexicontent.editfieldvalues', 'com_flexicontent.field.' . $field->id);
                if ($is_editable) {
开发者ID:benediktharter,项目名称:flexicontent-cck,代码行数:67,代码来源:view.html.php

示例15: if

		<?php if ( $this->params->get('enable_translation_groups') ) : ?>

			<div class="fcclear"></div>
			<?php
				if(FLEXI_J30GE){
					$label_tooltip = 'class="hasTooltip flexi_label" title="'.JHtml::tooltipText(trim(JText::_('FLEXI_ORIGINAL_CONTENT_ITEM'), ':'), htmlspecialchars(JText::_( 'FLEXI_ORIGINAL_CONTENT_ITEM_DESC' ), ENT_COMPAT, 'UTF-8'), 0).'"';
				}else{
					$label_tooltip = 'class="hasTip flexi_label" title="'.'::'.htmlspecialchars(JText::_( 'FLEXI_ORIGINAL_CONTENT_ITEM_DESC' ), ENT_COMPAT, 'UTF-8').'"';
				}
			?>
			<label id="jform_lang_parent_id-lbl" for="jform_lang_parent_id" <?php echo $label_tooltip; ?> >
				<?php echo JText::_( 'FLEXI_ORIGINAL_CONTENT_ITEM' );?>
			</label>
			
			<div class="container_fcfield container_fcfield_name_originalitem">
			<?php if ( !$isnew  && (substr(flexicontent_html::getSiteDefaultLang(), 0,2) == substr($this->item->language, 0,2) || $this->item->language=='*') ) : ?>
				<br/><?php echo JText::_( $this->item->language=='*' ? 'FLEXI_ORIGINAL_CONTENT_ALL_LANGS' : 'FLEXI_ORIGINAL_TRANSLATION_CONTENT' );?>
				<input type="hidden" name="jform[lang_parent_id]" id="jform_lang_parent_id" value="<?php echo $this->item->id; ?>" />
			<?php else : ?>
				<?php
				if ( in_array( 'mod_item_lang', $allowlangmods_fe) || $isnew || $this->item->id==$this->item->lang_parent_id) {
					$app = JFactory::getApplication();
					$option = JRequest::getVar('option');
					$app->setUserState( $option.'.itemelement.langparent_item', 1 );
					$app->setUserState( $option.'.itemelement.type_id', $typeid);
					$app->setUserState( $option.'.itemelement.created_by', $this->item->created_by);
					//echo '<small>'.JText::_( 'FLEXI_ORIGINAL_CONTENT_IGNORED_IF_DEFAULT_LANG' ).'</small><br/>';
					echo $this->form->getInput('lang_parent_id');
				?>
					<span class="editlinktip <?php echo FLEXI_J30GE?'hasTooltip':'hasTip'; ?>" style="display:inline-block;" title="<?php echo FLEXI_J30GE?JHtml::tooltipText(trim(JText::_('FLEXI_NOTES'), ':'), htmlspecialchars(JText::_( 'FLEXI_ORIGINAL_CONTENT_IGNORED_IF_DEFAULT_LANG' ), ENT_COMPAT, 'UTF-8'), 0):htmlspecialchars(JText::_( 'FLEXI_NOTES' ), ENT_COMPAT, 'UTF-8').'::'.htmlspecialchars(JText::_( 'FLEXI_ORIGINAL_CONTENT_IGNORED_IF_DEFAULT_LANG' ), ENT_COMPAT, 'UTF-8'); ?>">
						<?php echo $infoimage; ?>
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:31,代码来源:form.php


注:本文中的flexicontent_html::getSiteDefaultLang方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。