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 );
  }
Esempio n. 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;
 }
Esempio n. 3
0
}

$object = false;

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();
Esempio n. 4
0
                                   ( 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')));
Esempio n. 5
0
        case '3':
            $limit = 50;
            break;
        default:
            $limit = 10;
            break;
    }
} else {
    $limit = 10;
}
$object = false;
if (is_numeric($objectID)) {
    $object = eZContentObject::fetch($objectID);
}
if (!$object) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$collections = eZInformationCollection::fetchCollectionsList($objectID, false, false, array('limit' => $limit, 'offset' => $offset));
$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', 'text' => ezpI18n::tr('kernel/infocollector', 'Collected information')), array('url' => false, 'text' => $objectName));
Esempio n. 6
0
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();
}
Esempio n. 7
0
 * @package bccie
 */
$http = eZHTTPTool::instance();
$module = $Params['Module'];
$objectID = $Params['ObjectID'];
$object = false;
if (!isset($offset)) {
    $offset = false;
}
if (is_numeric($objectID)) {
    $object = eZContentObject::fetch($objectID);
}
if (!$object) {
    return $module->handleError(EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel');
}
$collections = eZInformationCollection::fetchCollectionsList($objectID, false, false, array());
$numberOfCollections = eZInformationCollection::fetchCollectionsCount($objectID);
$objects = bccieExportUtils::getObjectsWithCollectedInformation();
$numberOfInfoCollectorObjects = bccieExportUtils::getCollectorObjectsCount();
$viewParameters = array('offset' => $offset);
$objectName = $object->attribute('name');
$tpl = eZTemplate::factory();
$tpl->setVariable('module', $module);
$tpl->setVariable('object', $object);
$tpl->setVariable('object_array', $objects);
$tpl->setVariable('object_count', $numberOfInfoCollectorObjects);
$tpl->setVariable('collection_array', $collections);
$tpl->setVariable('collection_count', $numberOfCollections);
if ($numberOfCollections >= 1) {
    $createdTimestamp = $collections[0]->attribute('created');
    $startDay = date('d', $createdTimestamp);
Esempio n. 8
0
foreach ( array_keys( $objects ) as $i )
{
    $firstCollections = eZInformationCollection::fetchCollectionsList( (int)$objects[$i]['contentobject_id'], /* object id */
                                                                       false, /* creator id */
                                                                       false, /* user identifier */
                                                                       array( 'limit' => 1, 'offset' => 0 ), /* limitArray */
                                                                       array( 'created', true ), /* sortArray */
                                                                       false  /* asObject */
                                                                     );
    $objects[$i]['first_collection'] = $firstCollections[0]['created'];

    $lastCollections = eZInformationCollection::fetchCollectionsList( (int)$objects[$i]['contentobject_id'], /* object id */
                                                                      false, /* creator id */
                                                                      false, /* user identifier */
                                                                      array( 'limit' => 1, 'offset' => 0 ), /* limitArray */
                                                                      array( 'created', false ), /* sortArray */
                                                                      false  /* asObject */
                                                                    );
    $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 );