コード例 #1
0
 static public function fetchCollectionsList( $objectID = false, $creatorID = false, $userIdentifier = false, $limit = false, $offset = false, $sortBy = false )
 {
     $collection = eZInformationCollection::fetchCollectionsList( $objectID,
                                                                  $creatorID,
                                                                  $userIdentifier,
                                                                  array( 'limit' => $limit, 'offset' => $offset ),
                                                                  $sortBy
                                                                );
     return array( 'result' => $collection );
  }
コード例 #2
0
 public static function getObjectsWithCollectedInformation($offset = 0, $limit = 10)
 {
     $db = eZDB::instance();
     $objects = $db->arrayQuery('SELECT DISTINCT ezinfocollection.contentobject_id,
                          ezcontentobject.name,
                          ezcontentobject_tree.main_node_id,
                          ezcontentclass.*,
                          ezcontentclass.identifier AS class_identifier
         FROM ezinfocollection,
              ezcontentobject,
              ezcontentobject_tree,
              ezcontentclass
         WHERE ezinfocollection.contentobject_id=ezcontentobject.id
         AND ezcontentobject.contentclass_id=ezcontentclass.id
         AND ezinfocollection.contentobject_id=ezcontentobject_tree.contentobject_id', array('limit' => (int) $limit, 'offset' => (int) $offset));
     foreach (array_keys($objects) as $i) {
         $collections = eZInformationCollection::fetchCollectionsList((int) $objects[$i]['contentobject_id'], false, false, false, false, false);
         $class = new eZContentClass($objects[$i]);
         $objects[$i]['class_name'] = $class->attribute('name');
         $first = $collections[0]['created'];
         $last = $first;
         for ($j = 0; $j < count($collections); $j++) {
             $current = $collections[$j]['created'];
             if ($current < $first) {
                 $first = $current;
             }
             if ($current > $last) {
                 $last = $current;
             }
         }
         $objects[$i]['first_collection'] = $first;
         $objects[$i]['last_collection'] = $last;
         $objects[$i]['collections'] = count($collections);
     }
     return $objects;
 }
コード例 #3
0
{
    $cli->output( "Removing all workflow processes and operation mementos" );
    eZOperationMemento::cleanup();
    eZWorkflowProcess::cleanup();
}

if ( $clean['collaboration'] )
{
    $cli->output( "Removing all collaboration elements" );
    eZCollaborationItem::cleanup();
}

if ( $clean['collectedinformation'] )
{
    $cli->output( "Removing all collected information" );
    eZInformationCollection::cleanup();
}

if ( $clean['notification'] )
{
    $cli->output( "Removing all notifications events" );
    eZNotificationEvent::cleanup();
    eZNotificationCollection::cleanup();
    eZNotificationEventFilter::cleanup();
}

if ( $clean['searchstats'] )
{
    $cli->output( "Removing all search statistics" );
    eZSearchLog::removeStatistics();
}
コード例 #4
0
 static function currentUserIdentifier()
 {
     $user = null;
     return eZInformationCollection::generateUserIdentifier( $user );
 }
コード例 #5
0
}
if (!$object->attribute('can_read')) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$icMap = array();
if ($http->hasSessionVariable('InformationCollectionMap')) {
    $icMap = $http->sessionVariable('InformationCollectionMap');
}
$icID = false;
if (isset($icMap[$object->attribute('id')])) {
    $icID = $icMap[$object->attribute('id')];
}
$informationCollectionTemplate = eZInformationCollection::templateForObject($object);
$attributeHideList = eZInformationCollection::attributeHideList();
$tpl->setVariable('node_id', $nodeID);
$tpl->setVariable('collection_id', $icID);
$tpl->setVariable('node', $node);
$tpl->setVariable('object', $object);
$tpl->setVariable('viewmode', $viewMode);
$tpl->setVariable('view_parameters', $userParameters);
$tpl->setVariable('attribute_hide_list', $attributeHideList);
$tpl->setVariable('error', false);
$section = eZSection::fetch($object->attribute('section_id'));
if ($section) {
    $navigationPartIdentifier = $section->attribute('navigation_part_identifier');
}
$res = eZTemplateDesignResource::instance();
$res->setKeys(array(array('object', $object->attribute('id')), array('node', $node->attribute('node_id')), array('parent_node', $node->attribute('parent_node_id')), array('class', $object->attribute('contentclass_id')), array('class_identifier', $node->attribute('class_identifier')), array('viewmode', $viewMode), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('navigation_part_identifier', $navigationPartIdentifier), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias')), array('class_group', $object->attribute('match_ingroup_id_list')), array('state', $object->attribute('state_id_array')), array('state_identifier', $object->attribute('state_identifier_array'))));
$Result = array();
コード例 #6
0
ファイル: collectionlist.php プロジェクト: nottavi/ezpublish
if( is_numeric( $objectID ) )
{
    $object = eZContentObject::fetch( $objectID );
}

if( !$object )
{
    return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
}

$collections = eZInformationCollection::fetchCollectionsList( $objectID, /* object id */
                                                              false, /* creator id */
                                                              false, /* user identifier */
                                                              array( 'limit' => $limit,'offset' => $offset ) /* limit array */ );
$numberOfCollections = eZInformationCollection::fetchCollectionsCount( $objectID );

$viewParameters = array( 'offset' => $offset );
$objectName = $object->attribute( 'name' );

$tpl = eZTemplate::factory();
$tpl->setVariable( 'module', $module );
$tpl->setVariable( 'limit', $limit );
$tpl->setVariable( 'view_parameters', $viewParameters );
$tpl->setVariable( 'object', $object );
$tpl->setVariable( 'collection_array', $collections );
$tpl->setVariable( 'collection_count', $numberOfCollections );

$Result = array();
$Result['content'] = $tpl->fetch( 'design:infocollector/collectionlist.tpl' );
$Result['path'] = array( array( 'url' => '/infocollector/overview',
コード例 #7
0
ファイル: overview.php プロジェクト: mugoweb/ezpublish-legacy
                                   ( SELECT DISTINCT ezinfocollection.contentobject_id FROM ezinfocollection )
                             ORDER BY ezcontentobject.name ASC', array('limit' => (int) $limit, 'offset' => (int) $offset));
$infoCollectorObjectsQuery = $db->arrayQuery('SELECT COUNT( DISTINCT ezinfocollection.contentobject_id ) as count
                                               FROM ezinfocollection,
                                                    ezcontentobject,
                                                    ezcontentobject_tree
                                               WHERE
                                                    ezinfocollection.contentobject_id=ezcontentobject.id
                                                    AND ezinfocollection.contentobject_id=ezcontentobject_tree.contentobject_id');
$numberOfInfoCollectorObjects = 0;
if ($infoCollectorObjectsQuery) {
    $numberOfInfoCollectorObjects = $infoCollectorObjectsQuery[0]['count'];
}
foreach (array_keys($objects) as $i) {
    $firstCollections = eZInformationCollection::fetchCollectionsList((int) $objects[$i]['contentobject_id'], false, false, array('limit' => 1, 'offset' => 0), array('created', true), false);
    $objects[$i]['first_collection'] = $firstCollections[0]['created'];
    $lastCollections = eZInformationCollection::fetchCollectionsList((int) $objects[$i]['contentobject_id'], false, false, array('limit' => 1, 'offset' => 0), array('created', false), false);
    $objects[$i]['last_collection'] = $lastCollections[0]['created'];
    $objects[$i]['class_name'] = eZContentClassNameList::nameFromSerializedString($objects[$i]['serialized_name_list']);
    $objects[$i]['collections'] = eZInformationCollection::fetchCollectionCountForObject($objects[$i]['contentobject_id']);
}
$viewParameters = array('offset' => $offset);
$tpl = eZTemplate::factory();
$tpl->setVariable('module', $module);
$tpl->setVariable('limit', $limit);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('object_array', $objects);
$tpl->setVariable('object_count', $numberOfInfoCollectorObjects);
$Result = array();
$Result['content'] = $tpl->fetch('design:infocollector/overview.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/infocollector', 'Collected information')));
コード例 #8
0
ファイル: view.php プロジェクト: EVE-Corp-Center/ECC-Website
<?php

/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.8
 * @package kernel
 */
$http = eZHTTPTool::instance();
$Module = $Params['Module'];
$collectionID = $Params['CollectionID'];
$collection = false;
$object = false;
if (is_numeric($collectionID)) {
    $collection = eZInformationCollection::fetch($collectionID);
}
if (!$collection) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$object = eZContentObject::fetch($collection->attribute('contentobject_id'));
if (!$object) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$objectID = $collection->attribute('contentobject_id');
$objectName = $object->attribute('name');
$tpl = eZTemplate::factory();
$tpl->setVariable('module', $Module);
$tpl->setVariable('collection', $collection);
$Result = array();
$Result['content'] = $tpl->fetch('design:infocollector/view.tpl');
$Result['path'] = array(array('url' => '/infocollector/overview', 'text' => ezpI18n::tr('kernel/infocollector', 'Collected information')), array('url' => '/infocollector/collectionlist/' . $objectID, 'text' => $objectName), array('url' => false, 'text' => $collectionID));
コード例 #9
0
    /**
     * Deletes the current object, all versions and translations, and corresponding tree nodes from the database
     *
     * Transaction unsafe. If you call several transaction unsafe methods you must enclose
     * the calls within a db transaction; thus within db->begin and db->commit.
     */
    function purge()
    {
        $delID = $this->ID;
        // Who deletes which content should be logged.
        eZAudit::writeAudit( 'content-delete', array( 'Object ID' => $delID, 'Content Name' => $this->attribute( 'name' ),
                                                      'Comment' => 'Purged the current object: eZContentObject::purge()' ) );

        $db = eZDB::instance();

        $db->begin();

        $attrOffset = 0;
        $attrLimit = 20;
        while (
            $contentobjectAttributes = $this->allContentObjectAttributes(
                $delID, true, array( 'limit' => $attrLimit, 'offset' => $attrOffset )
            )
        )
        {
            foreach ( $contentobjectAttributes as $contentobjectAttribute )
            {
                $dataType = $contentobjectAttribute->dataType();
                if ( !$dataType )
                    continue;
                $dataType->deleteStoredObjectAttribute( $contentobjectAttribute );
            }
            $attrOffset += $attrLimit;
        }

        eZInformationCollection::removeContentObject( $delID );

        eZContentObjectTrashNode::purgeForObject( $delID );

        $db->query( "DELETE FROM ezcontentobject_tree
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_attribute
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_version
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcontentobject_name
             WHERE contentobject_id='$delID'" );

        $db->query( "DELETE FROM ezcobj_state_link WHERE contentobject_id=$delID" );

        $db->query( "DELETE FROM ezcontentobject
             WHERE id='$delID'" );

        $db->query( "DELETE FROM eznode_assignment
             WHERE contentobject_id = '$delID'" );

        $db->query( "DELETE FROM ezuser_role
             WHERE contentobject_id = '$delID'" );

        $db->query( "DELETE FROM ezuser_discountrule
             WHERE contentobject_id = '$delID'" );

        eZContentObject::fixReverseRelations( $delID, 'remove' );

        eZSearch::removeObjectById( $delID );

        // Check if deleted object is in basket/wishlist
        $sql = 'SELECT DISTINCT ezproductcollection_item.productcollection_id
                FROM   ezbasket, ezwishlist, ezproductcollection_item
                WHERE  ( ezproductcollection_item.productcollection_id=ezbasket.productcollection_id OR
                         ezproductcollection_item.productcollection_id=ezwishlist.productcollection_id ) AND
                       ezproductcollection_item.contentobject_id=' . $delID;
        $rows = $db->arrayQuery( $sql );
        if ( count( $rows ) > 0 )
        {
            $countElements = 50;
            $deletedArray = array();
            // Create array of productCollectionID will be removed from ezwishlist and ezproductcollection_item
            foreach ( $rows as $row )
            {
                $deletedArray[] = $row['productcollection_id'];
            }
            // Split $deletedArray into several arrays with $countElements values
            $splitted = array_chunk( $deletedArray, $countElements );
            // Remove eZProductCollectionItem and eZWishList
            foreach ( $splitted as $value )
            {
                eZPersistentObject::removeObject( eZProductCollectionItem::definition(), array( 'productcollection_id' => array( $value, '' ) ) );
                eZPersistentObject::removeObject( eZWishList::definition(), array( 'productcollection_id' => array( $value, '' ) ) );
            }
        }
        $db->query( 'UPDATE ezproductcollection_item
                     SET contentobject_id = 0
                     WHERE  contentobject_id = ' . $delID );

        // Cleanup relations in two steps to avoid locking table for to long
        $db->query( "DELETE FROM ezcontentobject_link
                     WHERE from_contentobject_id = '$delID'" );

        $db->query( "DELETE FROM ezcontentobject_link
                     WHERE to_contentobject_id = '$delID'" );

        // Cleanup properties: LastVisit, Creator, Owner
        $db->query( "DELETE FROM ezuservisit
             WHERE user_id = '$delID'" );

        $db->query( "UPDATE ezcontentobject_version
             SET creator_id = 0
             WHERE creator_id = '$delID'" );

        $db->query( "UPDATE ezcontentobject
             SET owner_id = 0
             WHERE owner_id = '$delID'" );

        if ( isset( $GLOBALS["eZWorkflowTypeObjects"] ) and is_array( $GLOBALS["eZWorkflowTypeObjects"] ) )
        {
            $registeredTypes =& $GLOBALS["eZWorkflowTypeObjects"];
        }
        else
        {
            $registeredTypes = eZWorkflowType::fetchRegisteredTypes();
        }

        // Cleanup ezworkflow_event etc...
        foreach ( array_keys( $registeredTypes ) as $registeredTypeKey )
        {
            $registeredType = $registeredTypes[$registeredTypeKey];
            $registeredType->cleanupAfterRemoving( array( 'DeleteContentObject' => $delID ) );
        }

        $db->commit();
    }
コード例 #10
0
            //END ENHANCED BINARY EXTENSION MAIL CODE ADDITION
            $mail->setBody($templateResult);
            $mailResult = eZMailTransport::send($mail);
        }
        $icMap = array();
        if ($http->hasSessionVariable('InformationCollectionMap')) {
            $icMap = $http->sessionVariable('InformationCollectionMap');
        }
        $icMap[$object->attribute('id')] = $collection->attribute('id');
        $http->setSessionVariable('InformationCollectionMap', $icMap);
        if (is_numeric($redirectToNodeID)) {
            $Module->redirectToView('view', array('full', $redirectToNodeID));
        } else {
            $display = eZInformationCollection::displayHandling($object);
            if ($display == 'node') {
                $Module->redirectToView('view', array($ViewMode, $NodeID));
            } else {
                if ($display == 'redirect') {
                    $redirectURL = eZInformationCollection::redirectURL($object);
                    $Module->redirectTo($redirectURL);
                } else {
                    $Module->redirectToView('collectedinfo', array($NodeID));
                }
            }
        }
    } else {
        $collection->remove();
        return $Module->run('view', array($ViewMode, $NodeID), array('ViewCache' => false, 'AttributeValidation' => array('processed' => true, 'attributes' => $unvalidatedAttributes), 'CollectionAttributes' => $collectionAttributes));
    }
    return eZModule::HOOK_STATUS_CANCEL_RUN;
}
コード例 #11
0
ファイル: export.php プロジェクト: obenyoussef/bccie
function exportCollection($objectID = false, $dir = 'var/export', $format = 'csv', $separator = ',', $days = false, $debug = false)
{
    $ret = false;
    $object = false;
    // Settings
    $ini = eZINI::instance("cie.ini");
    $excludeAttributeID = $ini->variable("CieSettings", "ExcludeAttributeID");
    if (is_numeric($objectID)) {
        $object =& eZContentObject::fetch($objectID);
        $classID = $object->attribute('contentclass_id');
    }
    // eZDebug::writeDebug( $object );
    if (is_numeric($classID)) {
        $class =& eZContentClass::fetch($classID);
    }
    if ($debug == true) {
        echo "Object ClassID: {$classID}\n";
    }
    if (is_object($class)) {
        $className = $class->attribute('identifier');
        $classDataMap = $class->attribute('data_map');
    }
    // Settings
    $ini = eZINI::instance("cie.ini");
    $excludeAttributeID = $ini->variable("CieSettings", "ExcludeAttributeID");
    if ($debug == true) {
        echo "Exporting Collection: {$objectID}\n";
        echo "Output Directory: {$dir}\n";
        echo "Output Format: {$format}\n";
        echo "Output Separator: {$separator}\n";
        echo "Object Collection ID: {$objectID}\n";
        echo "Object Class Name: {$className}\n";
    }
    // if ( $debug == true )
    // print_r( $classDataMap );
    // print_r( $class );
    // die( );
    if (!$object) {
        die('Encountered Non-Object, Unknown Error');
    }
    $collections = eZInformationCollection::fetchCollectionsList($objectID, false, false, array());
    $collection_count = eZInformationCollection::fetchCollectionCountForObject($objectID);
    if ($debug == true) {
        echo "Object Collection Count: {$collection_count}\n\n";
        echo "Object Collection Contents: \n";
        print_r($collections);
    }
    $attributes_to_export = array();
    // fetch collection class attributes for export
    foreach ($classDataMap as $attribute) {
        // print_r( $attribute );
        if (is_object($attribute)) {
            $is_ic = $attribute->attribute('is_information_collector');
            if (is_numeric($is_ic)) {
                if ($is_ic) {
                    $id = $attribute->attribute('id');
                    $name = $attribute->attribute('identifier');
                    $attributes_to_export[] = $id;
                    if ($debug) {
                        print_r("Object Class Attribute Name: {$name} \n");
                        // echo "Object Class Attribute is Information Collector: $is_ic\n";
                        print_r("Object Class Attribute ID: {$id} \n\n");
                    }
                }
            }
        }
    }
    // Set output file name pattern
    if ($days != false) {
        $start = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y"));
        $namePattern = "_" . date("Y-m-d", $start) . "_to_" . date("Y-m-d");
    } else {
        $namePattern = "_export_" . date("Y-m-d_H-i");
    }
    // Set output file name
    switch ($format) {
        case 'csv':
            $filename = $object->attribute('name') . $namePattern . ".csv";
            break;
        case 'sylk':
            $filename = $object->attribute('name') . $namePattern . ".slk";
            break;
        default:
            $filename = $object->attribute('name') . $namePattern . ".csv";
            break;
    }
    $sdir = $dir . '/';
    $path = $sdir . $filename;
    if ($debug == true) {
        echo "Collection Output Filename: {$filename}\n";
        echo "Collection Output Path: {$path}\n";
    }
    if ($debug == true) {
        echo "Class Attributes ot Export (Array): \n";
        print_r($attributes_to_export);
        echo "\n";
    }
    print_r("Object information collection record entries fetch in progress...\n");
    $parser = new Parser();
    $data = $parser->exportInformationCollection($collections, $attributes_to_export, $separator, $format, $days);
    if ($debug == true) {
        echo "Collection Output Content:\n";
        echo "{$data}\n";
    }
    $file = new eZFile();
    $file->create($filename, $dir, $data);
    print_r("Object Collection Data Export File Path: {$path}\n");
    print_r("Object Collection Export Completed!\n\n");
    // flush();
    // eZExecution::cleanExit();
}
コード例 #12
0
ファイル: doexport.php プロジェクト: obenyoussef/bccie
set_time_limit($exportExecutionTimeLimit);
$object = false;
$exportCreationDate = false;
$exportModificationDate = false;
if (is_numeric($objectID)) {
    $object = eZContentObject::fetch($objectID);
}
if (!$object) {
    return $module->handleError(EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel');
}
$conditions = array('contentobject_id' => $objectID);
$dateConditions = bccieExportUtils::getDateConditions($http);
if ($dateConditions['conditions'] != null) {
    $conditions['created'] = $dateConditions['conditions'];
}
$collections = eZPersistentObject::fetchObjectList(eZInformationCollection::definition(), null, $conditions, false, false);
// TODO: change error handler
if (!$collections) {
    return $module->handleError(EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel');
}
$counter = 0;
$attributesToExport = array();
while (true) {
    $currentattribute = $http->postVariable("field_{$counter}");
    if (!$currentattribute) {
        break;
    }
    $attributesToExport[] = $currentattribute;
    $counter++;
}
if ($http->hasPostVariable("creation_date")) {