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


PHP eZURLAliasML::setLangMaskAlwaysAvailable方法代码示例

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


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

示例1: testSetLangMaskAlwaysAvailable

 public function testSetLangMaskAlwaysAvailable()
 {
     $nodeID = mt_rand();
     // Create an ezurlalias_ml entry
     $url = eZURLAliasML::create(__FUNCTION__ . $nodeID, "eznode:" . $nodeID, 0, 2);
     $url->store();
     // Update lang_mask by setting always available,
     eZURLAliasML::setLangMaskAlwaysAvailable(2, "eznode", $nodeID);
     // Verify that language mask was increased to 3.
     $urls = eZURLAliasML::fetchByAction('eznode', $nodeID);
     self::assertEquals(3, (int) $urls[0]->attribute('lang_mask'));
     // Update lang_mask by removing always available,
     eZURLAliasML::setLangMaskAlwaysAvailable(false, "eznode", $nodeID);
     // Verify that language mask was reduced back to 2.
     $urls = eZURLAliasML::fetchByAction('eznode', $nodeID);
     self::assertEquals(2, (int) $urls[0]->attribute('lang_mask'));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:17,代码来源:urlaliasml_test.php

示例2: setAlwaysAvailableLanguageID

    /**
     * @param int $languageID
     * @param int|bool $version
     */
    function setAlwaysAvailableLanguageID( $languageID, $version = false )
    {
        $db = eZDB::instance();
        $db->begin();

        if ( $version == false )
        {
            $version = $this->currentVersion();
            if ( $languageID )
            {
                $this->setAttribute( 'language_mask', (int)$this->attribute( 'language_mask' ) | 1 );
            }
            else
            {
                $this->setAttribute( 'language_mask', (int)$this->attribute( 'language_mask' ) & ~1 );
            }
            $this->store();
        }

        $objectID = $this->attribute( 'id' );
        $versionID = $version->attribute( 'version' );

        // reset 'always available' flag
        $sql = "UPDATE ezcontentobject_name SET language_id=";
        if ( $db->databaseName() == 'oracle' )
        {
            $sql .= "bitand( language_id, -2 )";
        }
        else
        {
            $sql .= "language_id & ~1";
        }
        $sql .= " WHERE contentobject_id = '$objectID' AND content_version = '$versionID'";
        $db->query( $sql );

        if ( $languageID != false )
        {
            $newLanguageID = $languageID | 1;
            $sql = "UPDATE ezcontentobject_name
                    SET language_id='$newLanguageID'
                    WHERE language_id='$languageID' AND contentobject_id = '$objectID' AND content_version = '$versionID'";
            $db->query( $sql );
        }

        $version->setAlwaysAvailableLanguageID( $languageID );

        // Update url alias for all locations
        $nodeRows = eZContentObjectTreeNode::fetchByContentObjectID( $objectID, false );
        $actions = array();
        foreach ( $nodeRows as $nodeRow )
        {
            $nodeID = (int)$nodeRow['node_id'];
            $actions[] = array( 'eznode', $nodeID );
        }
        eZURLAliasML::setLangMaskAlwaysAvailable( $languageID, $actions, null );

        $db->commit();
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:62,代码来源:ezcontentobject.php


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