function feZMetaData_ContentActionHandler( &$module, &$http, &$objectID )
{
	// Action when user clicks on the Add Button
	if( $http->hasPostVariable( 'AddMetaDataButton' ) )
	{
		$link = 'fezmetadata/edit/0/(contentObjectID)/'.$objectID;
		$link .= '/(metaDataName)/'.$_POST['metaDataName'];
		$link .= '/(language)/'.$_POST['language'];
		eZURI::transformURI( $link );
		$http->redirect( $link );
	}

	// Action when user clicks on the Remove Button
	if( $http->hasPostVariable( 'RemoveMetaDataButton' ) and $http->hasPostVariable( 'MetaDataIDSelection' ) )
	{
		$metaDataSelection = $http->postVariable( 'MetaDataIDSelection' );
		foreach( $metaDataSelection as $metaData )
		{
			$metaDataObject = feZMetaData::fetch( $metaData );
			$metaDataObject->remove();
		}
		eZContentCacheManager::clearContentCache( $objectID );
		$ContentObject = eZContentObject::fetch( $objectID );
		$ContentNodeID = $ContentObject->mainNodeID();
		return $module->redirect( 'content', 'view', array( 'full', $ContentNodeID ) );
	}
}
 private static function getMetaTitleItem( $itemNode )
 {
     $meta_title = '';
     $meta_title_item = feZMetaData::fetchByContentObjectIDAndMetaName( $itemNode->attribute( 'contentobject_id' ),
                                                                  'title',
                                                                  $itemNode->CurrentLanguage );
     if ( ! empty( $meta_title_item ) )
     {
         $meta_title = $meta_title_item->attribute( 'meta_value' );
     }
     if ( empty( $meta_title ) )
     {
         $meta_title = $itemNode->attribute( 'name' );
     }
     
     return $meta_title;
     
 }
 function fetchBySubTree($nodeID, $depth, $language='')
 {
     $retMetaData = feZMetaData::fetchBySubTree( $nodeID, $depth, true, $language);
     return array( 'result' => $retMetaData );
 }
Exemplo n.º 4
0
	static function fetchByContentObjectIDAndMetaName( $contentObjectID, $metaDataName, $language,  $asObject = true )
	{
		$meta = array('contentobject_id' => $contentObjectID,
		              'meta_name' => $metaDataName,
		              'language' => $language );
		$db = eZDB::instance();
		if( is_numeric( $contentObjectID ) )
		{
			$query = "SELECT fezmeta_data.*
					  FROM fezmeta_data 
					  WHERE fezmeta_data.contentobject_id = $contentObjectID 
					  AND fezmeta_data.meta_name = '".$db->escapeString( $metaDataName )."' 
					  AND fezmeta_data.language = '" . $db->escapeString( $language )."'";
			$metaDataList = $db->arrayQuery( $query );
			foreach( $metaDataList as $metaData )
			{
			    $meta = $metaData;
			    break;
			}
		}

        if( $asObject )
        {
            return feZMetaData::makeObjectArray( $meta );
        }
        else
        {
            return $meta;
		}
	}
Exemplo n.º 5
0
if( is_numeric( $metaID ) and $metaID == 0 )
{
	$contentObjectID = $Params[ 'contentObjectID' ];
	$contentObject = eZContentObject::fetch( $contentObjectID );
	$metaObject = feZMetaData::fetchByContentObjectIDAndMetaName( $contentObjectID,
	                                                             $Params['metaDataName'],
	                                                             $Params['language'] );
    if ( $metaObject->MetaID > 0 )
    {
        return $Module->redirect( 'fezmetadata', 'edit', $metaObject->MetaID ); 
    }
}
else
{
	$metaObject = feZMetaData::fetch( $metaID );
	$contentObject = eZContentObject::fetch( $metaObject->attribute( 'contentobject_id') );
}

if( !$contentObject->attribute('can_edit') )
{
	return $Module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel',
                                 array( 'AccessList' => $obj->accessList( 'edit' ) ) );
}

$MetaDataINI = eZINI::instance( 'ezmetadata.ini' );
$AvailableMetaData = $MetaDataINI->variable( 'MetaData', 'AvailablesMetaData' );

foreach( $AvailableMetaData as $MetaData )
{
	if( $MetaDataINI->hasVariable( 'MetaData_'.$MetaData ) )