当前位置: 首页>>代码示例>>PHP>>正文


PHP eZDB类代码示例

本文整理汇总了PHP中eZDB的典型用法代码示例。如果您正苦于以下问题:PHP eZDB类的具体用法?PHP eZDB怎么用?PHP eZDB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了eZDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forcePlaylistImport

 /**
  * Forza l'importazione di una playlist alla prossima esecuzione
  * del cronjob.
  * 
  * Ritorna true se la playlist è stata rischedulata
  * 
  * @param int $parentNodeID
  * @return boolean
  */
 public static function forcePlaylistImport($parentNodeID)
 {
     $limit = 1000;
     $offset = 0;
     $imports = SQLIScheduledImport::fetchList($offset, $limit);
     foreach ($imports as $import) {
         if ($import instanceof SQLIScheduledImport) {
             $options = $import->getOptions();
             if ($options->hasAttribute('parentnodeid')) {
                 $_parentNodeID = $options->attribute('parentnodeid');
                 if ($parentNodeID == $_parentNodeID) {
                     $db = eZDB::instance();
                     $db->begin();
                     // Imposta il giorno precedente rispetto al timestamp attuale
                     $currentNextTime = $import->attribute('next');
                     $nextTimeInterval = '-1 day';
                     $nextTime = strtotime($nextTimeInterval, $currentNextTime);
                     $import->setAttribute('next', $nextTime);
                     $import->store(array('next'));
                     $db->commit();
                     return true;
                 }
             }
         } else {
             throw new Exception('Classe errata!');
         }
     }
     //echo("!");
     //die();
     return false;
 }
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:40,代码来源:patbaseplaylistfunctions.php

示例2: applyChanges

function applyChanges($module, $http, $vatTypeArray = false)
{
    $errors = array();
    if ($vatTypeArray === false) {
        $vatTypeArray = eZVatType::fetchList(true, true);
    }
    $db = eZDB::instance();
    $db->begin();
    foreach ($vatTypeArray as $vatType) {
        $id = $vatType->attribute('id');
        if ($id == -1) {
            // avoid storing changes to the "fake" dynamic VAT type
            continue;
        }
        if ($http->hasPostVariable("vattype_name_" . $id)) {
            $name = $http->postVariable("vattype_name_" . $id);
        }
        if ($http->hasPostVariable("vattype_percentage_" . $id)) {
            $percentage = $http->postVariable("vattype_percentage_" . $id);
        }
        if (!$name || $percentage < 0 || $percentage > 100) {
            if (!$name) {
                $errors[] = ezpI18n::tr('kernel/shop/vattype', 'Empty VAT type names are not allowed (corrected).');
            } else {
                $errors[] = ezpI18n::tr('kernel/shop/vattype', 'Wrong VAT percentage (corrected).');
            }
            continue;
        }
        $vatType->setAttribute('name', $name);
        $vatType->setAttribute('percentage', $percentage);
        $vatType->store();
    }
    $db->commit();
    return $errors;
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:35,代码来源:vattype.php

示例3: validateUniqueURLHTTPInput

 /**
  * This method validates unique URL.
  *
  * @param string $data
  * @param object $contentObjectAttribute
  * @return boolean
  */
 public static function validateUniqueURLHTTPInput($data, $contentObjectAttribute)
 {
     $ini = eZINI::instance('uniquedatatypes.ini');
     $uniqueURLINI = $ini->group('UniqueURLSettings');
     if (count($uniqueURLINI['AllowedSchemaList'])) {
         if (!eregi("^(" . implode('|', $uniqueURLINI['AllowedSchemaList']) . ")", $data)) {
             $contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Only URLs beginning with  "%schemas" are accepted!', '', array('%schemas' => implode('", "', $uniqueURLINI['AllowedSchemaList']))));
             return eZInputValidator::STATE_INVALID;
         }
     }
     $url = eZURL::urlByURL($data);
     if (is_object($url)) {
         $contentObjectID = $contentObjectAttribute->ContentObjectID;
         $contentClassAttributeID = $contentObjectAttribute->ContentClassAttributeID;
         $db = eZDB::instance();
         if ($uniqueURLINI['CurrentVersionOnly'] == 'true') {
             $query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject co, ezcontentobject_attribute coa\n\t\t\t\t\tWHERE co.id = coa.contentobject_id\n\t\t\t\t\tAND co.current_version = coa.version\n\t\t\t\t\tAND coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n                    AND coa.data_int = " . $db->escapeString($url->ID);
         } else {
             $query = "SELECT COUNT(*) AS row_counter\n\t\t\t\t\tFROM ezcontentobject_attribute coa\n\t\t\t\t\tWHERE coa.contentclassattribute_id = " . $db->escapeString($contentClassAttributeID) . "\n\t\t\t\t\tAND coa.contentobject_id <> " . $db->escapeString($contentObjectID) . "\n                    AND coa.data_int = " . $db->escapeString($url->ID);
         }
         if (self::EZUNIQUEURL_DEBUG) {
             eZDebug::writeDebug('Query: ' . $query, 'eZUniqueURLType::validateUniqueURLHTTPInput');
         }
         $rows = $db->arrayQuery($query);
         $rowCount = (int) $rows[0]['row_counter'];
         if ($rowCount >= 1) {
             $contentObjectAttribute->setValidationError(ezpI18n::tr('extension/ezuniquedatatypes', 'Given URL already exists in another content object of this type!'));
             return eZInputValidator::STATE_INVALID;
         }
     }
     return eZInputValidator::STATE_ACCEPTED;
 }
开发者ID:Opencontent,项目名称:ezuniquedatatypes,代码行数:39,代码来源:ezuniqueurltype.php

示例4: applyChanges

function applyChanges( $module, $http, $productCategories = false )
{
    $errors = array();
    if ( $productCategories === false )
        $productCategories = eZProductCategory::fetchList();

    $db = eZDB::instance();
    $db->begin();
    foreach ( $productCategories as $cat )
    {
        $id = $cat->attribute( 'id' );

        if ( !$http->hasPostVariable( "category_name_" . $id ) )
            continue;

        $name = $http->postVariable( "category_name_" . $id );

        if ( !$name )
        {
            $errors[] = ezpI18n::tr( 'kernel/shop/productcategories', 'Empty category names are not allowed (corrected).' );
            continue;
        }

        $cat->setAttribute( 'name', $name );
        $cat->store();
    }
    $db->commit();

    return $errors;
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:30,代码来源:productcategories.php

示例5: testContentClassStillInGroupAfterEdition

    /**
     * Test that saving a content class in DEFINED version status
     * correctly manipulate associated class groups
     *
     * @link http://issues.ez.no/16197
     */
    public function testContentClassStillInGroupAfterEdition()
    {
        $class = eZContentClass::fetch( $this->class->id );
        // This is logic contained in kernel/class/edit.php
        foreach ( eZContentClassClassGroup::fetchGroupList( $class->attribute( 'id' ),
                                                            eZContentClass::VERSION_STATUS_DEFINED )  as $classGroup )
        {
            eZContentClassClassGroup::create( $class->attribute( 'id' ),
                                              eZContentClass::VERSION_STATUS_TEMPORARY,
                                              $classGroup->attribute( 'group_id' ),
                                              $classGroup->attribute( 'group_name' ) )
                ->store();
        }

        $attributes = $class->fetchAttributes();
        $class->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
        $class->NameList->setHasDirtyData();

        foreach ( $attributes as $attribute )
        {
            $attribute->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
            if ( $dataType = $attribute->dataType() )
                $dataType->initializeClassAttribute( $attribute );
        }

        $class->store( $attributes );
        $db = eZDB::instance();
        $db->begin();
        $class->storeVersioned( $attributes, eZContentClass::VERSION_STATUS_DEFINED );
        $db->commit();

        $this->assertTrue( eZContentClassClassGroup::classInGroup( $class->attribute( 'id' ),
                                                                   eZContentClass::VERSION_STATUS_DEFINED,
                                                                   1 ) );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:41,代码来源:ezcontentclass_regression.php

示例6: copyObject

 /**
  * Create a copy of an object.
  *
  * The basis for this method is taken from kernel/content/copy.php
  *
  * @todo Merge this method into kernel wrapper's object class.
  *
  * @param eZContentObject $object
  * @param int $newParentNodeID
  * @return eZContentObject
  */
 public static function copyObject($object, $newParentNodeID)
 {
     $newParentNode = eZContentObjectTreeNode::fetch($newParentNodeID);
     $db = eZDB::instance();
     $db->begin();
     $newObject = $object->copy(true);
     // We should reset section that will be updated in updateSectionID().
     // If sectionID is 0 than the object has been newly created
     $newObject->setAttribute('section_id', 0);
     $newObject->store();
     $curVersion = $newObject->attribute('current_version');
     $curVersionObject = $newObject->attribute('current');
     $newObjAssignments = $curVersionObject->attribute('node_assignments');
     unset($curVersionObject);
     // remove old node assignments
     foreach ($newObjAssignments as $assignment) {
         $assignment->purge();
     }
     // and create a new one
     $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $newObject->attribute('id'), 'contentobject_version' => $curVersion, 'parent_node' => $newParentNodeID, 'is_main' => 1));
     $nodeAssignment->store();
     // publish the newly created object
     eZOperationHandler::execute('content', 'publish', array('object_id' => $newObject->attribute('id'), 'version' => $curVersion));
     // Update "is_invisible" attribute for the newly created node.
     $newNode = $newObject->attribute('main_node');
     eZContentObjectTreeNode::updateNodeVisibility($newNode, $newParentNode);
     $db->commit();
     return $newObject;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:40,代码来源:ezcontentobject_regression.php

示例7: initialize

 protected static function initialize()
 {
     $db = eZDB::instance();
     if ($db->databaseName() == 'mysql') {
         self::$view_groups['databaseqa']['disabled'] = false;
     }
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:7,代码来源:ezsysinfoqaviewgroup.php

示例8: removeGroup

    static function removeGroup( $workflowID, $workflowVersion, $selectedGroup )
    {
        $workflow = eZWorkflow::fetch( $workflowID );
        if ( !$workflow )
            return false;
        $groups = $workflow->attribute( 'ingroup_list' );
        foreach ( array_keys( $groups ) as $key )
        {
            if ( in_array( $groups[$key]->attribute( 'group_id' ), $selectedGroup ) )
            {
                unset( $groups[$key] );
            }
        }

        if ( count( $groups ) == 0 )
        {
            return false;
        }
        else
        {
            $db = eZDB::instance();
            $db->begin();
            foreach(  $selectedGroup as $group_id )
            {
                eZWorkflowGroupLink::removeByID( $workflowID, $workflowVersion, $group_id );
            }
            $db->commit();
        }
        return true;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:30,代码来源:ezworkflowfunctions.php

示例9: ezflow_list_blocktypes

 private function ezflow_list_blocktypes($output)
 {
     $validOutput = array('simple', 'grouped');
     if (!in_array($output, $validOutput)) {
         $output = 'simple';
     }
     $db = eZDB::instance();
     $sql['simple'] = "SELECT block_type, id as block_id FROM `ezm_block` ORDER BY `block_type` ASC";
     $sql['grouped'] = "\n            SELECT \n                block_type, \n                COUNT(block_type) as count, \n                (SELECT \n                    GROUP_CONCAT(id) \n                FROM \n                    `ezm_block` t2 \n                WHERE \n                    t1.block_type = t2.block_type\n                ) as block_ids \n            FROM \n                `ezm_block` t1 \n            GROUP BY t1.block_type \n            ORDER BY t1.`block_type` ASC;";
     // header field names for each output mode
     $headers['simple'] = array("block_type", "block_id");
     $headers['grouped'] = array("block_type", "count", "block_ids");
     if ($query = $db->query($sql[$output])) {
         // add field headers row
         $results[] = $headers[$output];
         while ($row = $query->fetch_array(MYSQL_NUM)) {
             $result = array();
             foreach ($row as $index => $value) {
                 $result[] = $value;
             }
             $results[] = $result;
         }
         eep::printTable($results, "ezflow list blocktypes [{$output}]");
     }
 }
开发者ID:truffo,项目名称:eep,代码行数:25,代码来源:index.php

示例10: gather

 static function gather()
 {
     $contentTypes = array('Objects (including users)' => array('table' => 'ezcontentobject'), 'Users' => array('table' => 'ezuser'), 'Nodes' => array('table' => 'ezcontentobject_tree'), 'Content Classes' => array('table' => 'ezcontentclass'), 'Information Collections' => array('table' => 'ezinfocollection'), 'Pending notification events' => array('table' => 'eznotificationevent', 'wherecondition' => 'status = 0'), 'Objects pending indexation' => array('table' => 'ezpending_actions', 'wherecondition' => "action = 'index_object'"), 'Binary files (content)' => array('table' => 'ezbinaryfile'), 'Image files (content)' => array('table' => 'ezimagefile'), 'Media files (content)' => array('table' => 'ezmedia'), 'Maximum children per node' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY parent_node_id ) nodes'), 'Maximum nodes per object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_tree GROUP BY contentobject_id ) nodes'), 'Maximum incoming relations to an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY to_contentobject_id ) links', 'nvl' => 0), 'Maximum outgoing relations from an object' => array('sql' => 'SELECT MAX(tot) AS NUM FROM ( SELECT count(*) AS tot FROM ezcontentobject_link GROUP BY from_contentobject_id ) links', 'nvl' => 0));
     $db = eZDB::instance();
     $contentList = array();
     foreach ($contentTypes as $key => $desc) {
         if (isset($desc['table'])) {
             $sql = 'SELECT COUNT(*) AS NUM FROM ' . $desc['table'];
             if (@$desc['wherecondition']) {
                 $sql .= ' WHERE ' . $desc['wherecondition'];
             }
         } else {
             $sql = $desc['sql'];
         }
         $count = $db->arrayQuery($sql);
         $contentList[$key] = $count[0]['NUM'] === null ? $desc['nvl'] : $count[0]['NUM'];
     }
     if (in_array('ezfind', eZExtension::activeExtensions())) {
         $ini = eZINI::instance('solr.ini');
         $ezfindpingurl = $ini->variable('SolrBase', 'SearchServerURI') . "/admin/stats.jsp";
         $data = eZHTTPTool::getDataByURL($ezfindpingurl, false);
         //var_dump( $data );
         if (preg_match('#<stat +name="numDocs" ?>([^<]+)</stat>#', $data, $matches)) {
             $contentList['Documents in SOLR'] = trim($matches[1]);
         } else {
             $contentList['Documents in SOLR'] = 'Unknown';
         }
     }
     return $contentList;
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:30,代码来源:contentstatsgatherer.php

示例11: modify

 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     $parentNodeID = $namedParameters['parent_node_id'];
     switch ($operatorName) {
         case 'ezkeywordlist':
             include_once 'lib/ezdb/classes/ezdb.php';
             $db = eZDB::instance();
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
             }
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
             $versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND\n                                            ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
             $languageFilter = " AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
             $versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
             $quotedClassIdentifiers = array();
             foreach ((array) $namedParameters['class_identifier'] as $classIdentifier) {
                 $quotedClassIdentifiers[] = "'" . $db->escapeString($classIdentifier) . "'";
             }
             $rs = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n                                            FROM ezkeyword_attribute_link,\n                                                 ezkeyword,\n                                                 ezcontentobject,\n                                                 ezcontentobject_name,\n                                                 ezcontentobject_attribute,\n                                                 ezcontentobject_tree,\n                                                 ezcontentclass\n                                                 {$sqlPermissionChecking['from']}\n                                            WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                                                AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                                AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id\n                                                AND ezkeyword.class_id = ezcontentclass.id\n                                                AND " . $db->generateSQLINStatement($quotedClassIdentifiers, 'ezcontentclass.identifier') . "\n                                                {$pathString}\n                                                {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n                                                {$showInvisibleNodesCond}\n                                                {$sqlPermissionChecking['where']}\n                                                {$languageFilter}\n                                                {$versionNameJoins}\n                                            ORDER BY ezkeyword.keyword ASC");
             $operatorValue = $rs;
             break;
     }
 }
开发者ID:BGCX067,项目名称:ezpublish-thetechtalent-svn-to-git,代码行数:30,代码来源:ezkeywordlist.php

示例12: fetchSearchListCount

 function fetchSearchListCount()
 {
     $db = eZDB::instance();
     $query = "SELECT count(*) as count FROM ezsearch_search_phrase";
     $searchListCount = $db->arrayQuery($query);
     return array('result' => $searchListCount[0]['count']);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:7,代码来源:ezsearchfunctioncollection.php

示例13: cleanup

 static function cleanup($db)
 {
     if ($db === null) {
         $db = eZDB::instance();
     }
     $relationTypes = $db->supportedRelationTypes();
     $result = true;
     $defaultRegexp = "#^ez|tmp_notification_rule_s#";
     foreach ($relationTypes as $relationType) {
         $relationItems = $db->relationList($relationType);
         // This is the default regexp, unless the db driver provides one
         $matchRegexp = null;
         if (method_exists($db, 'relationMatchRegexp')) {
             $matchRegexp = $db->relationMatchRegexp($relationType);
         }
         if ($matchRegexp === null) {
             $matchRegexp = $defaultRegexp;
         }
         foreach ($relationItems as $relationItem) {
             // skip relations that shouldn't be touched
             if ($matchRegexp !== false and !preg_match($matchRegexp, $relationItem)) {
                 continue;
             }
             if (!$db->removeRelation($relationItem, $relationType)) {
                 $result = false;
                 break;
             }
         }
         if (!$result) {
             break;
         }
     }
     return $result;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:34,代码来源:ezdbtool.php

示例14: checkDatabase

 /**
  * Executes checks for db configuration errors that are not exposed by the
  * default db upgrade check test
  */
 static function checkDatabase()
 {
     $db = eZDB::instance();
     $type = $db->databaseName();
     switch ($type) {
         case 'mysql':
             $ini = eZINI::instance();
             $dbname = $ini->variable('DatabaseSettings', 'Database');
             $warnings = array();
             foreach ($db->arrayquery("SELECT table_name, table_collation, engine FROM information_schema.tables WHERE table_schema = '" . $db->escapeString($dbname) . "'") as $row) {
                 if ($row['engine'] != 'InnoDB') {
                     $warnings[] = "Table " . $row['table_name'] . " does not use the InnoDB storage engine: " . $row['engine'];
                 }
                 if (substr($row['table_collation'], 0, 5) != 'utf8_') {
                     $warnings[] = "Table " . $row['table_name'] . " does not use an utf8 character set: " . $row['table_collation'];
                 }
             }
             return $warnings;
             //case 'oracle':
             /// @todo check for stored procs which are not compiled; tables with max id bigger than their associated sequence; double triggers on tables
         //case 'oracle':
         /// @todo check for stored procs which are not compiled; tables with max id bigger than their associated sequence; double triggers on tables
         default:
             return array('Database type ' . $db->databaseName() . ' can currently not be checked for problems');
     }
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:30,代码来源:dbchecker.php

示例15: fetchClassListByGroups

    function fetchClassListByGroups( $groupFilter, $groupFilterType = 'include' )
    {
        $notIn = ( $groupFilterType == 'exclude' );

        if ( is_array( $groupFilter ) && count( $groupFilter ) > 0 )
        {
            $db = eZDB::instance();
            $groupFilter = $db->generateSQLINStatement( $groupFilter, 'ccg.group_id', $notIn );

            $classNameFilter = eZContentClassName::sqlFilter( 'cc' );
            $version = eZContentClass::VERSION_STATUS_DEFINED;

            $sql = "SELECT DISTINCT cc.*, $classNameFilter[nameField] " .
                   "FROM ezcontentclass cc, ezcontentclass_classgroup ccg, $classNameFilter[from] " .
                   "WHERE cc.version = $version" .
                   "      AND cc.id = ccg.contentclass_id" .
                   "      AND $groupFilter" .
                   "      AND $classNameFilter[where] " .
                   "ORDER BY $classNameFilter[nameField] ASC";

            $rows = $db->arrayQuery( $sql );
            $classes = eZPersistentObject::handleRows( $rows, 'eZContentClass', true );
        }
        else
        {
            $classes = eZContentClass::fetchList( eZContentClass::VERSION_STATUS_DEFINED, true, false, array( 'name' => 'asc' ) );
        }

        return array( 'result' => $classes );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:ezclassfunctioncollection.php


注:本文中的eZDB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。