• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createSqlParts

 /**
  * Creates and returns SQL parts used in fetch functions
  *
  * @return array
  */
 function createSqlParts($params)
 {
     $returnArray = array('tables' => '', 'joins' => '', 'columns' => '');
     if (isset($params['tag_id'])) {
         if (is_array($params['tag_id'])) {
             $tagIDsArray = $params['tag_id'];
         } else {
             if ((int) $params['tag_id'] > 0) {
                 $tagIDsArray = array((int) $params['tag_id']);
             } else {
                 return $returnArray;
             }
         }
         if (!isset($params['include_synonyms']) || isset($params['include_synonyms']) && (bool) $params['include_synonyms'] == true) {
             $result = eZTagsObject::fetchList(array('main_tag_id' => array($tagIDsArray)), null, false);
             if (is_array($result) && !empty($result)) {
                 foreach ($result as $r) {
                     array_push($tagIDsArray, (int) $r['id']);
                 }
             }
         }
         $returnArray['tables'] = " INNER JOIN eztags_attribute_link i1 ON (i1.object_id = ezcontentobject.id AND i1.objectattribute_version = ezcontentobject.current_version)";
         $db = eZDB::instance();
         $dbString = $db->generateSQLINStatement($tagIDsArray, 'i1.keyword_id', false, true, 'int');
         $returnArray['joins'] = " {$dbString} AND ";
     }
     return $returnArray;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:33,代码来源:eztagsattributefilter.php


示例17: testMapLanguage

    /**
     * Test that fetching the language listing, works after languages
     * have been altered in database, and then later refetched.
     *
     * @link http://issues.ez.no/15484
     */
    public function testMapLanguage()
    {
        $db = eZDB::instance();
        eZContentLanguage::addLanguage('nno-NO', 'Nynorsk');
        $localeToChangeInto = 'dan-DK';
        $languageNameToChangeInto = 'Danish';
        $langObject = eZContentLanguage::fetchByLocale('nno-NO');
        $langId = (int) $langObject->attribute('id');
        $updateSql = <<<END
UPDATE ezcontent_language
SET
locale='{$localeToChangeInto}',
name='{$languageNameToChangeInto}'
WHERE
id={$langId}
END;
        $db->query($updateSql);
        eZContentLanguage::expireCache();
        $newLangObject = eZContentLanguage::fetchByLocale($localeToChangeInto);
        if (!$newLangObject instanceof eZContentLanguage) {
            self::fail("Language object not returned. Old version provided by cache?");
        }
        $newLangId = (int) $newLangObject->attribute('id');
        self::assertEquals($langId, $newLangId, "New language not mapped to existing language");
    }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:ezcontentlanguage_regression.php


示例18: createFKTables

    /**
     * Helper function that creates 3 tables, two of them having foreign keys towards the first one
     */
    public function createFKTables()
    {
        $db = eZDB::instance();
        $db->query( "CREATE TABLE eztestfk_1 (
id1 INT NOT NULL,
id2 INT NOT NULL,
id3 INT NOT NULL,
PRIMARY KEY (id1),
INDEX eztestfk_1_1 (id1),
INDEX eztestfk_1_2 (id2, id3)
) ENGINE=InnoDB" );

        $db->query( "CREATE TABLE eztestfk_2 (
id INT NOT NULL,
fk1 INT NULL,
fk2 INT NULL,
fk3 INT NULL,
PRIMARY KEY (id) ,
CONSTRAINT eztestfk_2_fk1 FOREIGN KEY ( fk1 ) REFERENCES eztestfk_1 (id1) ON DELETE CASCADE,
CONSTRAINT eztestfk_2_fk2 FOREIGN KEY ( fk2, fk3 ) REFERENCES eztestfk_1 (id2, id3) ON DELETE CASCADE
) ENGINE=InnoDB" );

        $db->query( "CREATE TABLE eztestfk_3 (
id INT NOT NULL,
fk1 INT NULL,
PRIMARY KEY (id) ,
CONSTRAINT eztestfk_3_fk1 FOREIGN KEY ( fk1 ) REFERENCES eztestfk_1 (id1) ON DELETE CASCADE
) ENGINE=InnoDB" );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:32,代码来源:ezmysqldb_fk_test.php


示例19: testDisplayVariableWithObject

    /**
     * Tests that the output process works with objects.
     *
     * There should be no crash from casting errors.
     * @group templateOperators
     * @group attributeOperator
     */
    public function testDisplayVariableWithObject()
    {
        $db = eZDB::instance();

        // STEP 1: Add test folder
        $folder = new ezpObject( "folder", 2 );
        $folder->name = __METHOD__;
        $folder->publish();

        $nodeId = $folder->mainNode->node_id;

        $node = eZContentObjectTreeNode::fetch( $nodeId );
        $attrOp = new eZTemplateAttributeOperator();
        $outputTxt = '';
        $formatterMock = $this->getMock( 'ezpAttributeOperatorFormatterInterface' );
        $formatterMock->expects( $this->any() )
                      ->method( 'line' )
                      ->will( $this->returnValue( __METHOD__ ) );

        try
        {
            $attrOp->displayVariable( $node, $formatterMock, true, 2, 0, $outputTxt );
        }
        catch ( PHPUnit_Framework_Error $e )
        {
            self::fail( "eZTemplateAttributeOperator raises an error when working with objects." );
        }

        self::assertNotNull( $outputTxt, "Output text is empty." );
        // this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
        self::assertContains( __METHOD__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found." );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:39,代码来源:eztemplateattributeoperator_test.php


示例20: install

 function install($package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
 {
     $path = $package->path();
     $databaseType = false;
     if (isset($parameters['database-type'])) {
         $databaseType = $parameters['database-type'];
     }
     $path .= '/' . eZDBPackageHandler::sqlDirectory();
     if ($databaseType) {
         $path .= '/' . $databaseType;
     }
     if (file_exists($path)) {
         $db = eZDB::instance();
         $canInsert = true;
         if ($databaseType and $databaseType != $db->databaseName()) {
             $canInsert = false;
         }
         if ($canInsert) {
             eZDebug::writeDebug("Installing SQL file {$path}/{$filename}");
             $db->insertFile($path, $filename, false);
             return true;
         } else {
             eZDebug::writeDebug("Skipping SQL file {$path}/{$filename}");
         }
     } else {
         eZDebug::writeError("Could not find SQL file {$path}/{$filename}");
     }
     return false;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:29,代码来源:ezdbpackagehandler.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZDataType类代码示例发布时间:2022-05-23
下一篇:
PHP eZCurrencyData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap