| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <18-Aug-2006 12:46:05 vd> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 include_once ('lib/ezutils/classes/ezdebug.php'); 28 include_once ('lib/ezutils/classes/ezhttptool.php'); 29 include_once ('lib/ezdb/classes/ezdb.php'); 30 31 function sectionEditPostFetch( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, &$validation ) 32 { 33 } 34 35 function sectionEditPreCommit( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage ) 36 { 37 } 38 39 function sectionEditActionCheck( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage ) 40 { 41 if ( $module->isCurrentAction( 'SectionEdit' ) ) 42 { 43 // Check access 44 $user =& eZUser::currentUser(); 45 $access = $user->hasAccessTo( 'section' ); 46 if ( !( $access['accessWord'] == 'yes' ) ) 47 { 48 eZDebug::writeError( "You are not allowed to assign sections." ); 49 return; 50 } 51 52 $http =& eZHTTPTool::instance(); 53 54 $db =& eZDB::instance(); 55 $db->begin(); 56 57 $selectedSectionID = $http->hasPostVariable( 'SelectedSectionId' ) ? (int) $http->postVariable( 'SelectedSectionId' ) : 1; 58 if ( !$selectedSectionID ) 59 $selectedSectionID = 1; 60 61 $objectID = $object->attribute( 'id' ); 62 $assignedNodes =& $object->attribute( 'assigned_nodes' ); 63 foreach ( $assignedNodes as $node ) 64 { 65 eZContentObjectTreeNode::assignSectionToSubTree( $node->attribute( 'node_id' ), $selectedSectionID ); 66 } 67 // If there are no assigned nodes we should update db for the current object. 68 if ( count( $assignedNodes ) == 0 ) 69 { 70 $db->query( "UPDATE ezcontentobject SET section_id='$selectedSectionID' WHERE id = '$objectID'" ); 71 $db->query( "UPDATE ezsearch_object_word_link SET section_id='$selectedSectionID' WHERE contentobject_id = '$objectID'" ); 72 } 73 $object->expireAllViewCache(); 74 $db->commit(); 75 76 $module->redirectToView( 'edit', array( $object->attribute( 'id' ), $editVersion, $editLanguage, $fromLanguage ) ); 77 } 78 } 79 80 function sectionEditPreTemplate( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, &$tpl ) 81 { 82 } 83 84 function initializeSectionEdit( &$module ) 85 { 86 $module->addHook( 'post_fetch', 'sectionEditPostFetch' ); 87 $module->addHook( 'pre_commit', 'sectionEditPreCommit' ); 88 $module->addHook( 'action_check', 'sectionEditActionCheck' ); 89 $module->addHook( 'pre_template', 'sectionEditPreTemplate' ); 90 } 91 92 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |