[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <02-Oct-2006 13:37:23 dl> 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 class eZContentClassName extends eZPersistentObject 28 { 29 function eZContentClassName( $row ) 30 { 31 eZPersistentObject::eZPersistentObject( $row ); 32 } 33 34 function definition() 35 { 36 return array( 'fields' => array( 'contentclass_id' => array( 'name' => 'ContentClassID', 37 'datatype' => 'integer', 38 'default' => 0, 39 'required' => true, 40 'foreign_class' => 'eZContentClass', 41 'foreign_attribute' => 'id', 42 'multiplicity' => '1..*' ), 43 'contentclass_version' => array( 'name' => 'ContentClassVersion', 44 'datatype' => 'integer', 45 'default' => 0, 46 'required' => true ), 47 'language_locale' => array( 'name' => 'LanguageLocale', 48 'datatype' => 'string', 49 'default' => '', 50 'required' => true ), 51 'language_id' => array( 'name' => 'LanguageID', 52 'datatype' => 'integer', 53 'default' => 0, 54 'required' => true, 55 'foreign_class' => 'eZContentLanguage', 56 'foreign_attribute' => 'id', 57 'multiplicity' => '1..*' ), 58 'name' => array( 'name' => 'Name', 59 'datatype' => 'string', 60 'default' => '', 61 'required' => false ) ), 62 'keys' => array( 'contentclass_id', 63 'contentclass_version', 64 'language_locale' ), 65 'function_attributes' => array(), 66 'class_name' => 'eZContentClassName', 67 'sort' => array( 'contentclass_id' => 'asc' ), 68 'name' => 'ezcontentclass_name' ); 69 } 70 71 function fetchList( $classID, $classVersion, $languageLocaleList, $asObjects = true, $fields = null, $sorts = null, $limit = null ) 72 { 73 $conds = array(); 74 75 if ( is_array( $languageLocaleList ) && count( $languageLocaleList ) > 0 ) 76 $conds[ 'language_locale'] = array( $languageLocaleList ); 77 78 $conds[ 'contentclass_id'] = $classID; 79 $conds[ 'contentclass_version'] = $classVersion; 80 81 return eZPersistentObject::fetchObjectList( eZContentClassName::definition(), 82 $fields, 83 $conds, 84 $sorts, 85 $limit, 86 $asObjects ); 87 } 88 89 /*! 90 \return the SQL where-condition for selecting the rows (with class names) in the correct language, 91 i. e. in the most prioritized language from those in which an object exists. 92 93 \param languageTable Name of the table containing the attribute with bitmaps, e.g. ezcontentclass 94 \param languageListTable Name of the table containing the attribute with language id. 95 */ 96 function sqlFilter( $languageTable = 'ezcontentclass' ) 97 { 98 $def = eZContentClassName::definition(); 99 $languageListTable = $def['name']; 100 $sqlFilter = array( 'nameField' => "$languageListTable.name", 101 'from' => "$languageListTable", 102 'where' => "$languageTable.id = $languageListTable.contentclass_id AND 103 $languageTable.version = $languageListTable.contentclass_version AND " . 104 eZContentLanguage::sqlFilter( $languageListTable, $languageTable ), 105 'orderBy' => "$languageListTable.name" ); 106 107 return $sqlFilter; 108 } 109 110 /*! 111 The same as 'sqlFilter' but adds symbol ',' to 'nameField' and 'from' parts 112 */ 113 function sqlAppendFilter( $languageTable = 'ezcontentclass' ) 114 { 115 $def = eZContentClassName::definition(); 116 $languageListTable = $def['name']; 117 $sqlFilter = array( 'nameField' => ", $languageListTable.name", 118 'from' => ", $languageListTable", 119 'where' => "AND $languageTable.id = $languageListTable.contentclass_id AND 120 $languageTable.version = $languageListTable.contentclass_version AND " . 121 eZContentLanguage::sqlFilter( $languageListTable, $languageTable ), 122 'orderBy' => "$languageListTable.name" ); 123 124 return $sqlFilter; 125 } 126 127 /*! 128 The same as 'sqlFilter' but all fields are empty 129 */ 130 function sqlEmptyFilter() 131 { 132 $sqlFilter = array( 'nameField' => '', 133 'from' => '', 134 'where' => '', 135 'orderBy' => '' ); 136 137 return $sqlFilter; 138 } 139 140 function remove( $contentClassID, $contentClassVersion ) 141 { 142 $db =& eZDb::instance(); 143 $db->begin(); 144 145 $sql = "DELETE FROM ezcontentclass_name WHERE contentclass_id = $contentClassID AND contentclass_version = $contentClassVersion"; 146 $db->query( $sql ); 147 148 $db->commit(); 149 } 150 151 } 152 153 ?>
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 |