[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <02-Dec-2002 13:15:49 bf> 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 /*! 28 \class eZInformationCollection ezinformationcollection.php 29 \ingroup eZKernel 30 \brief The class eZInformationCollection handles information collected by content objects 31 32 Content objects can contain attributes which are able to collect information. 33 The information collected is handled by the eZInformationCollection class. 34 35 */ 36 37 include_once ( 'kernel/classes/ezinformationcollectionattribute.php' ); 38 include_once ( 'lib/ezutils/classes/ezsys.php' ); 39 40 class eZInformationCollection extends eZPersistentObject 41 { 42 function eZInformationCollection( $row ) 43 { 44 $this->eZPersistentObject( $row ); 45 } 46 47 /*! 48 \return the persistent object definition for the eZInformationCollection class. 49 */ 50 function definition() 51 { 52 return array( 'fields' => array( 'id' => array( 'name' => 'ID', 53 'datatype' => 'integer', 54 'default' => 0, 55 'required' => true ), 56 'contentobject_id' => array( 'name' => 'ContentObjectID', 57 'datatype' => 'integer', 58 'default' => 0, 59 'required' => true, 60 'foreign_class' => 'eZContentObject', 61 'foreign_attribute' => 'id', 62 'multiplicity' => '1..*' ), 63 'user_identifier' => array( 'name' => 'UserIdentifier', 64 'datatype' => 'string', 65 'default' => '', 66 'required' => true ), 67 'creator_id' => array( 'name' => 'CreatorID', 68 'datatype' => 'integer', 69 'default' => 0, 70 'required' => true, 71 'foreign_class' => 'eZUser', 72 'foreign_attribute' => 'contentobject_id', 73 'multiplicity' => '1..*' ), 74 'created' => array( 'name' => 'Created', 75 'datatype' => 'integer', 76 'default' => 0, 77 'required' => true ), 78 'modified' => array( 'name' => 'Modified', 79 'datatype' => 'integer', 80 'default' => 0, 81 'required' => true ) ), 82 'keys' => array( 'id' ), 83 'function_attributes' => array( 'attributes' => 'informationCollectionAttributes', 84 'data_map' => 'dataMap', 85 'object' => 'object', 86 'creator' => 'creator' ), 87 'increment_key' => 'id', 88 'class_name' => 'eZInformationCollection', 89 'name' => 'ezinfocollection' ); 90 } 91 92 /*! 93 \static 94 \return an array with attribute identifiers that are not to be shown in 95 information collection templates. 96 */ 97 function attributeHideList() 98 { 99 $attributes = array(); 100 $ini =& eZINI::instance( 'collect.ini' ); 101 $attributes[] = $ini->variable( 'InfoSettings', 'TypeAttribute' ); 102 $attributes[] = $ini->variable( 'EmailSettings', 'SendEmailAttribute' ); 103 $attributes[] = $ini->variable( 'DisplaySettings', 'DisplayAttribute' ); 104 $attributes[] = $ini->variable( 'DisplaySettings', 'RedirectURLAttribute' ); 105 $attributes[] = $ini->variable( 'CollectionSettings', 'CollectAnonymousDataAttribute' ); 106 $attributes[] = $ini->variable( 'CollectionSettings', 'CollectionUserDataAttribute' ); 107 return $attributes; 108 } 109 110 /*! 111 \static 112 113 Remove infomation collection from specified contentobject_id 114 115 \param contentobject id 116 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 117 the calls within a db transaction; thus within db->begin and db->commit. 118 */ 119 function removeContentObject( $delID ) 120 { 121 if( !is_numeric( $delID ) ) 122 { 123 return; 124 } 125 126 $db =& eZDB::instance(); 127 $db->begin(); 128 129 $db->query( "DELETE FROM ezinfocollection 130 WHERE contentobject_id = '$delID'" ); 131 $db->query( "DELETE FROM ezinfocollection_attribute 132 WHERE contentobject_id = '$delID'" ); 133 $db->commit(); 134 } 135 136 /*! 137 \static 138 139 Remove a specific collection 140 141 \param contentobject id 142 */ 143 function removeCollection( $collectionID ) 144 { 145 if( !is_numeric( $collectionID ) ) 146 { 147 return; 148 } 149 150 $db =& eZDB::instance(); 151 152 $db->query( "DELETE FROM ezinfocollection 153 WHERE id = '$collectionID'" ); 154 $db->query( "DELETE FROM ezinfocollection_attribute 155 WHERE informationcollection_id = '$collectionID'" ); 156 } 157 158 /*! 159 \static 160 \return the name of the template to use for viewing a specific information collection. 161 162 The template name is determined from the content class type and object attributes. 163 See settings/collect.ini for more information. 164 */ 165 function templateForObject( &$object ) 166 { 167 return eZInformationCollection::typeForObject( $object ); 168 } 169 170 /*! 171 \static 172 \return the name of the template to use for viewing a specific information collection. 173 174 The template name is determined from the content class type and object attributes. 175 See settings/collect.ini for more information. 176 */ 177 function typeForObject( &$object ) 178 { 179 if ( !$object ) 180 return false; 181 $class =& $object->contentClass(); 182 if ( !$class ) 183 return false; 184 185 $ini =& eZINI::instance( 'collect.ini' ); 186 $typeList = $ini->variable( 'InfoSettings', 'TypeList' ); 187 188 $classID = $class->attribute( 'id' ); 189 $classIdentifier = $class->attribute( 'identifier' ); 190 191 $type = false; 192 193 if ( isset( $typeList[$classID] ) ) 194 $type = $typeList[$classID]; 195 else if ( isset( $typeList[$classIdentifier] ) ) 196 $type = $typeList[$classIdentifier]; 197 198 $typeAttribute = $ini->variable( 'InfoSettings', 'TypeAttribute' ); 199 if ( $typeAttribute ) 200 { 201 $dataMap = $object->attribute( 'data_map' ); 202 if ( isset( $dataMap[$typeAttribute] ) ) 203 { 204 $type = $dataMap[$typeAttribute]->content(); 205 if ( is_array( $type ) or 206 is_object( $type ) ) 207 $type = false; 208 } 209 } 210 211 if ( !$type ) 212 $type = $ini->variable( 'InfoSettings', 'Type' ); 213 214 return $type; 215 } 216 217 /*! 218 \static 219 \return \c true if anonymous users can submit data to the information collection \a $contentObject. 220 */ 221 function allowAnonymous( &$contentObject ) 222 { 223 if ( !$contentObject ) 224 return false; 225 $type = eZInformationCollection::typeForObject( $contentObject ); 226 227 $ini =& eZINI::instance( 'collect.ini' ); 228 $collectAnonymousList = $ini->variable( 'CollectionSettings', 'CollectAnonymousDataList' ); 229 230 $collectAnonymous = false; 231 232 if ( isset( $collectAnonymousList[$type] ) ) 233 $collectAnonymous = $collectAnonymousList[$type]; 234 235 $collectAnonymousAttribute = $ini->variable( 'CollectionSettings', 'CollectAnonymousDataAttribute' ); 236 if ( $collectAnonymousAttribute ) 237 { 238 $dataMap = $contentObject->attribute( 'data_map' ); 239 if ( isset( $dataMap[$collectAnonymousAttribute] ) ) 240 { 241 $collectAnonymous = $dataMap[$collectAnonymousAttribute]->content(); 242 if ( is_array( $collectAnonymous ) or 243 is_object( $collectAnonymous ) ) 244 $collectAnonymous = false; 245 } 246 } 247 248 if ( !$collectAnonymous ) 249 $collectAnonymous = $ini->variable( 'CollectionSettings', 'CollectAnonymousData' ); 250 251 if ( $collectAnonymous == 'enabled' ) 252 $collectAnonymous = true; 253 else 254 $collectAnonymous = false; 255 256 return $collectAnonymous; 257 } 258 259 /*! 260 \static 261 \return the type of handling that should be performed on user-data. 262 263 Possible return types are: 264 - multiple 265 - unique 266 - overwrite 267 */ 268 function userDataHandling( &$contentObject ) 269 { 270 if ( !$contentObject ) 271 return false; 272 $type = eZInformationCollection::typeForObject( $contentObject ); 273 274 $ini =& eZINI::instance( 'collect.ini' ); 275 $userDataList = $ini->variable( 'CollectionSettings', 'CollectionUserDataList' ); 276 277 $userData = false; 278 279 if ( isset( $userDataList[$type] ) ) 280 $userData = $userDataList[$type]; 281 282 $userDataAttribute = $ini->variable( 'CollectionSettings', 'CollectionUserDataAttribute' ); 283 if ( $userDataAttribute ) 284 { 285 $dataMap = $contentObject->attribute( 'data_map' ); 286 if ( isset( $dataMap[$userDataAttribute] ) ) 287 { 288 $userData = $dataMap[$userDataAttribute]->content(); 289 if ( is_array( $userData ) or 290 is_object( $userData ) ) 291 $userData = false; 292 } 293 } 294 295 if ( !$userData ) 296 $userData = $ini->variable( 'CollectionSettings', 'CollectionUserData' ); 297 298 if ( !in_array( $userData, array( 'multiple', 'unique', 'overwrite' ) ) ) 299 $userData = 'unique'; 300 301 return $userData; 302 } 303 304 function sendOutEmail( &$contentObject ) 305 { 306 if ( !$contentObject ) 307 return false; 308 $type = eZInformationCollection::typeForObject( $contentObject ); 309 310 $ini =& eZINI::instance( 'collect.ini' ); 311 $sendEmailList = $ini->variable( 'EmailSettings', 'SendEmailList' ); 312 313 $sendEmail = null; 314 315 if ( isset( $sendEmailList[$type] ) ) 316 $sendEmail = $sendEmailList[$type] == 'enabled'; 317 318 $sendEmailAttribute = $ini->variable( 'EmailSettings', 'SendEmailAttribute' ); 319 if ( $sendEmailAttribute ) 320 { 321 $dataMap = $contentObject->attribute( 'data_map' ); 322 if ( isset( $dataMap[$sendEmailAttribute] ) ) 323 { 324 $sendEmail = $dataMap[$sendEmailAttribute]->content(); 325 if ( is_array( $sendEmail ) or 326 is_object( $sendEmail ) ) 327 $sendEmail = null; 328 } 329 } 330 331 if ( $sendEmail === null ) 332 $sendEmail = $ini->variable( 'EmailSettings', 'SendEmail' ) == 'enabled'; 333 334 return $sendEmail; 335 } 336 337 function displayHandling( &$contentObject ) 338 { 339 if ( !$contentObject ) 340 return false; 341 $type = eZInformationCollection::typeForObject( $contentObject ); 342 343 $ini =& eZINI::instance( 'collect.ini' ); 344 $displayList = $ini->variable( 'DisplaySettings', 'DisplayList' ); 345 346 $display = false; 347 348 if ( isset( $displayList[$type] ) ) 349 $display = $displayList[$type]; 350 351 $displayAttribute = $ini->variable( 'DisplaySettings', 'DisplayAttribute' ); 352 if ( $displayAttribute ) 353 { 354 $dataMap = $contentObject->attribute( 'data_map' ); 355 if ( isset( $dataMap[$displayAttribute] ) ) 356 { 357 $display = $dataMap[$displayAttribute]->content(); 358 if ( is_array( $display ) or 359 is_object( $display ) ) 360 $display = false; 361 } 362 } 363 364 if ( !$display ) 365 $display = $ini->variable( 'DisplaySettings', 'Display' ); 366 367 if ( !in_array( $display, array( 'result', 'redirect', 'node' ) ) ) 368 $display = 'result'; 369 370 return $display; 371 } 372 373 function redirectURL( &$contentObject ) 374 { 375 if ( !$contentObject ) 376 return false; 377 $type = eZInformationCollection::typeForObject( $contentObject ); 378 379 $ini =& eZINI::instance( 'collect.ini' ); 380 $redirectURLList = $ini->variable( 'DisplaySettings', 'RedirectURLList' ); 381 382 $redirectURL = false; 383 384 if ( isset( $redirectURLList[$type] ) ) 385 $redirectURL = $redirectURLList[$type]; 386 387 $redirectURLAttribute = $ini->variable( 'DisplaySettings', 'RedirectURLAttribute' ); 388 if ( $redirectURLAttribute ) 389 { 390 $dataMap = $contentObject->attribute( 'data_map' ); 391 if ( isset( $dataMap[$redirectURLAttribute] ) ) 392 { 393 $redirectURL = $dataMap[$redirectURLAttribute]->content(); 394 if ( is_array( $redirectURL ) or 395 is_object( $redirectURL ) ) 396 $redirectURL = false; 397 } 398 } 399 400 if ( !$redirectURL ) 401 $redirectURL = $ini->variable( 'DisplaySettings', 'RedirectURL' ); 402 403 return $redirectURL; 404 } 405 406 /*! 407 \static 408 Fetches the information collection by ID. 409 */ 410 function fetch( $id, $asObject = true ) 411 { 412 return eZPersistentObject::fetchObject( eZInformationCollection::definition(), 413 null, 414 array( 'id' => $id ), 415 $asObject ); 416 } 417 418 /*! 419 \static 420 Fetches the information collection by user identifier. 421 */ 422 function fetchByUserIdentifier( $userIdentifier, $contentObjectID = false, $asObject = true ) 423 { 424 $conditions = array( 'user_identifier' => $userIdentifier ); 425 if ( $contentObjectID ) 426 $conditions['contentobject_id'] = $contentObjectID; 427 return eZPersistentObject::fetchObject( eZInformationCollection::definition(), 428 null, 429 $conditions, 430 $asObject ); 431 } 432 433 function fetchCountForAttribute( $objectAttributeID, $value ) 434 { 435 $db =& eZDB::instance(); 436 // Do a count on the value of collected integer info. Useful for e.g. polls 437 $valueSQL = ""; 438 if ( $value !== false ) 439 { 440 if ( is_integer( $value ) ) 441 { 442 $valueSQL = " AND data_int='" . $db->escapeString( $value ) . "'"; 443 } 444 } 445 $objectAttributeID =(int) $objectAttributeID; 446 $resArray = $db->arrayQuery( "SELECT count( ezinfocollection_attribute.id ) as count FROM ezinfocollection_attribute, ezinfocollection 447 WHERE ezinfocollection_attribute.informationcollection_id = ezinfocollection.id 448 AND ezinfocollection_attribute.contentobject_attribute_id = '" . $objectAttributeID . "' " . $valueSQL ); 449 450 return $resArray[0]['count']; 451 } 452 453 function fetchCollectionCountForObject( $objectID ) 454 { 455 if( !is_numeric( $objectID ) ) 456 { 457 return false; 458 } 459 460 $db =& eZDB::instance(); 461 $resultArray = $db->arrayQuery( 'SELECT COUNT( * ) as count FROM ezinfocollection WHERE contentobject_id=' . $objectID ); 462 463 return $resultArray[0]['count']; 464 } 465 466 /*! 467 \static 468 \param $definition - required, definition of fields 469 \param $sortArray - required, the input array 470 471 This function converts sorting on the form array ( 'field', true ) to the array( 'field' => true ) 472 and checks if the field exists in the definition. The functions is used to make sorting the same 473 way as done in fetch('content','list', ... ) 474 */ 475 function getSortArrayFromParam( $definition, $sortArray ) 476 { 477 if ( count( $sortArray ) < 2 ) 478 return null; 479 480 $sortField = $sortArray[0]; 481 482 // Check if we have the specified sort_field in the definition 483 if ( isset( $definition[ 'fields' ][ $sortField ] ) ) 484 { 485 $sortDir = $sortArray[1] ? 'asc' : 'desc'; 486 $sorts = array( $sortField => $sortDir ); 487 return $sorts; 488 } 489 eZDebug::writeWarning( 'Unknown sort field: ' . $sortField, 'eZInformationCollection ::fetchCollectionsList::getSortArrayFromParam' ); 490 return null; 491 } 492 493 /*! 494 \static 495 \param $creatorID - optional, default false, limits the fetched set to a creator_id 496 \param $contentObjectID - optional, default false, limits the fetched set of collection to 497 a specific content object 498 \param $userIdentifier - optional, default false, limits the fetched set to a user_identifier 499 \param $limitArray - optional, default false, limits the number of returned results 500 on the form: array( 'limit' => $limit, 'offset' => $offset ) 501 \param $sortArray - optional, default false, how to sort the result, 502 on the form: array( 'field', true/false ), true = asc 503 \param $asObject - optional, default true, specifies if results should be returned as objects. 504 505 Fetches a list of information collections. 506 */ 507 function fetchCollectionsList( $contentObjectID = false, $creatorID = false , $userIdentifier = false, $limitArray = false, $sortArray = false, $asObject = true ) 508 { 509 $conditions = array(); 510 if ( $contentObjectID ) 511 $conditions = array( 'contentobject_id' => $contentObjectID ); 512 if ( $creatorID ) 513 $conditions['creator_id'] = $creatorID; 514 if ( $userIdentifier ) 515 $conditions['user_identifier'] = $userIdentifier; 516 517 $limit = null; 518 if ( isset( $limitArray['limit'] ) ) 519 { 520 $limit = $limitArray; 521 if ( ! ( $limit['offset'] ) ) 522 $limit['offset'] = 0; 523 } 524 525 $sorts = null; 526 if ( !( $sortArray === false ) ) 527 { 528 if ( count( $sortArray ) >= 2 ) 529 { 530 $def = eZInformationCollection::definition(); 531 532 if ( ! ( is_array( $sortArray[0] ) ) ) 533 { 534 $sortArray = array( 0 => $sortArray ); 535 } 536 537 foreach ( $sortArray as $sortElement ) 538 { 539 $result = eZInformationCollection::getSortArrayFromParam( $def, $sortElement ); 540 $sorts = array_merge($sorts, $result ); 541 } 542 } 543 else 544 { 545 eZDebug::writeWarning( 'Too few parameters for setting sorting in fetch, ignoring', 'eZInformationCollection ::fetchCollectionsList' ); 546 } 547 } 548 549 return eZPersistentObject::fetchObjectList( eZInformationCollection::definition(), 550 null, 551 $conditions, 552 $sorts, 553 $limit, 554 $asObject ); 555 } 556 557 /*! 558 \static 559 560 \param $creatorID - optional, default false, the user to fetch collections for 561 \param $contentObjectID - optional, default false, limits the fetched set of collection to 562 a specific content object 563 564 Fetch the number of items limited by the parameters 565 */ 566 function fetchCollectionsCount( $contentObjectID = false, $creatorID = false, $userIdentifier = false ) 567 { 568 $conditions = array(); 569 if ( is_numeric( $contentObjectID ) ) 570 $conditions = array( 'contentobject_id' => $contentObjectID ); 571 if ( is_numeric( $creatorID ) ) 572 $conditions['creator_id'] = $creatorID ; 573 if ( $userIdentifier ) 574 $conditions['user_identifier'] = $userIdentifier; 575 576 $resultSet = eZPersistentObject::fetchObjectList( eZInformationCollection::definition(), 577 array(), 578 $conditions, 579 null, 580 null, 581 false, 582 false, 583 array( array( 'operation' => 'count(id)', 584 'name' => 'count' ) ) ); 585 return $resultSet[0]['count']; 586 } 587 588 function fetchCountList( $objectAttributeID ) 589 { 590 $db =& eZDB::instance(); 591 // Do a count on the value of collected integer info. Useful for e.g. polls 592 $valueSQL = ""; 593 // if ( $value !== false ) 594 // { 595 // if ( is_integer( $value ) ) 596 // { 597 // $valueSQL = " AND data_int='" . $db->escapeString( $value ) . "'"; 598 // } 599 // } 600 $objectAttributeID =(int) $objectAttributeID; 601 $resArray = $db->arrayQuery( "SELECT data_int, count( ezinfocollection_attribute.id ) as count FROM ezinfocollection_attribute, ezinfocollection 602 WHERE ezinfocollection_attribute.informationcollection_id = ezinfocollection.id 603 AND ezinfocollection_attribute.contentobject_attribute_id = '" . $objectAttributeID . "' " . $valueSQL . " 604 GROUP BY data_int" ); 605 606 $result = array(); 607 foreach ( $resArray as $res ) 608 { 609 $result[$res['data_int']] = $res['count']; 610 } 611 612 return $result; 613 } 614 615 function &creator() 616 { 617 $creatorID = $this->attribute( 'creator_id' ); 618 if ( $creatorID == 0 ) 619 { 620 return false; 621 } 622 $creator = eZUser::fetch( $creatorID ); 623 return $creator; 624 } 625 626 function &informationCollectionAttributes( $asObject = true ) 627 { 628 $db =& eZDB::instance(); 629 630 $arrayRes = $db->arrayQuery( "SELECT ica.id, ica.informationcollection_id, ica.contentclass_attribute_id, ica.contentobject_attribute_id, ica.contentobject_id, ica.data_text, ica.data_int, 631 ica.data_float 632 FROM ezinfocollection_attribute ica, ezcontentclass_attribute 633 WHERE ezcontentclass_attribute.id=ica.contentclass_attribute_id 634 AND informationcollection_id='" . $this->ID . "' 635 AND ezcontentclass_attribute.version=0 636 ORDER BY ezcontentclass_attribute.placement" ); 637 638 if ( $asObject ) 639 { 640 $retArray = array(); 641 foreach ( $arrayRes as $row ) 642 { 643 $retArray[] = new eZInformationCollectionAttribute( $row ); 644 } 645 } 646 else 647 { 648 $retArray = $arrayRes; 649 } 650 651 return $retArray; 652 } 653 654 /*! 655 \return an array of attributes of the information collection by identifier. 656 657 Fetches information collection attributes and indexes by the 658 content class attribute identifier. 659 */ 660 function &dataMap() 661 { 662 // Retreive the indexed information collection attributes 663 $informationCollectionAttributes =& $this->informationCollectionAttributes(); 664 665 $retArray = array(); 666 667 // Loop through each attribute hashing the array with the 668 // class attribute identifier associated with the information 669 // collection attribute 670 foreach ( $informationCollectionAttributes as $informationAttribute ) 671 { 672 $contentClassAttribute =& $informationAttribute->attribute( 'contentclass_attribute' ); 673 $id = $contentClassAttribute->attribute( 'identifier' ); 674 $retArray[$id] = $informationAttribute; 675 } 676 677 return $retArray; 678 } 679 680 function &object() 681 { 682 $object =& eZContentObject::fetch( $this->ContentObjectID ); 683 return $object; 684 } 685 686 /*! 687 Same as generateUserIdentifier but returns the user identifier for the current user. 688 */ 689 function currentUserIdentifier() 690 { 691 $user = null; 692 return eZInformationCollection::generateUserIdentifier( $user ); 693 } 694 695 /*! 696 Generates a user identifier for the user \a $user. 697 If \a $user is \c null then the current user will be used. 698 699 The user identifier is either calculated from the unique user ID 700 or the IP address when the user is anonymous. 701 */ 702 function generateUserIdentifier( &$user ) 703 { 704 if ( !$user ) 705 { 706 $user =& eZUser::currentUser(); 707 } 708 $userIdentifierBase = false; 709 if ( $user->attribute( 'is_logged_in' ) ) 710 { 711 $userIdentifierBase = 'ezuser-' . $user->attribute( 'contentobject_id' ); 712 $userIdentifier = md5( $userIdentifierBase ); 713 } 714 else 715 { 716 $userIdentifier = session_id(); 717 //$userIdentifierBase = 'ezuser-anonymous-' . eZSys::serverVariable( 'REMOTE_ADDR' ); 718 } 719 return $userIdentifier; 720 } 721 722 /*! 723 Creates a new eZInformationCollection instance. 724 */ 725 function &create( $contentObjectID, $userIdentifier, $creatorID = false ) 726 { 727 $timestamp = time(); 728 729 if ( $creatorID === false ) 730 { 731 $user = eZUser::currentUser(); 732 $creatorID = $user->id(); 733 } 734 $row = array( 'contentobject_id' => $contentObjectID, 735 'user_identifier' => $userIdentifier, 736 'creator_id' => $creatorID, 737 'created' => $timestamp, 738 'modified' => $timestamp ); 739 $newInformationCollection = new eZInformationCollection( $row ); 740 return $newInformationCollection; 741 } 742 743 /*! 744 \static 745 Removes all collected information. 746 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 747 the calls within a db transaction; thus within db->begin and db->commit. 748 */ 749 function cleanup() 750 { 751 $db =& eZDB::instance(); 752 $db->begin(); 753 eZInformationCollectionAttribute::cleanup(); 754 $db->query( "DELETE FROM ezinfocollection" ); 755 $db->commit(); 756 } 757 } 758 759 ?>
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 |