$Module );
}
else if ( $Module->isCurrentAction( 'AddBookmark' )  )
{
    $nodeList = eZContentBrowse::result( 'AddBookmark' );
    if ( $nodeList )
    {
        $db = eZDB::instance();
        $db->begin();
        foreach ( $nodeList as $nodeID )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID );
            if ( $node )
            {
                $nodeName = $node->attribute( 'name' );
                eZContentBrowseBookmark::createNew( $userID, $nodeID, $nodeName );
            }
        }
        $db->commit();
    }
}

$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters );

$Result = array();
$Result['content'] = $tpl->fetch( 'design:content/bookmark.tpl' );
$Result['path'] = array( array( 'text' => ezpI18n::tr( 'kernel/content', 'My bookmarks' ),
                                'url' => false ) );

         $objectID = $http->postVariable('ContentObjectID');
         eZContentCacheManager::clearContentCache($objectID);
     }
     if ($http->hasPostVariable('RedirectURIAfterPriority')) {
         return $module->redirectTo($http->postVariable('RedirectURIAfterPriority'));
     }
     $module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $contentNodeID . '/');
     return;
 } else {
     if ($http->hasPostVariable("ActionAddToBookmarks")) {
         $user = eZUser::currentUser();
         $nodeID = false;
         if ($http->hasPostVariable('ContentNodeID')) {
             $nodeID = $http->postVariable('ContentNodeID');
             $node = eZContentObjectTreeNode::fetch($nodeID);
             $bookmark = eZContentBrowseBookmark::createNew($user->id(), $nodeID, $node->attribute('name'));
         }
         if (!$nodeID) {
             $contentINI = eZINI::instance('content.ini');
             $nodeID = $contentINI->variable('NodeSettings', 'RootNode');
         }
         $viewMode = $http->postVariable('ViewMode', 'full');
         $module->redirectTo($module->functionURI('view') . '/' . $viewMode . '/' . $nodeID . '/');
         return;
     } else {
         if ($http->hasPostVariable("ActionAddToNotification")) {
             $nodeID = $http->postVariable('ContentNodeID');
             $module->redirectTo('notification/addtonotification/' . $nodeID . '/');
             return;
         } else {
             if ($http->hasPostVariable("ContentObjectID")) {
Exemple #3
0
<?php

$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$module = $Params['Module'];
$nodeID = $Params['NodeID'];
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
$userID = eZUser::currentUserID();
$bookmarkList = eZPersistentObject::fetchObjectList(eZContentBrowseBookmark::definition(), null, array('user_id' => $userID, 'node_id' => $nodeID), array('id' => 'desc'), array('offset' => 0, 'length' => '10'), true);
if (count($bookmarkList) > 0) {
    foreach ($bookmarkList as $bookmark) {
        $bookmark->remove();
    }
    $star = '0';
} else {
    eZContentBrowseBookmark::createNew($userID, $nodeID, $node['name']);
    /*
    	$notificationList = eZPersistentObject::fetchObjectList(  eZSubtreeNotificationRule::definition(),
    	                                                 array( 'node_id' ),
    	                                                 array( 'user_id' => $userID , 'node_id' => $node['parent_node_id'] ),
                                                         null,
                                                         null,
                                                         false );
    
       if( count($notificationList) == 0 )
    	{
    	$notificationRules = new eZSubtreeNotificationRule( array(	'node_id' =>  $node['parent_node_id'],
    																'user_id' => $userID,
    																'use_digest' => 0
    	) );
    	$notificationRules->store();