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


PHP eZUser::instance方法代码示例

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


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

示例1: answer

 function answer()
 {
     if ($this->Answer !== false) {
         return $this->Answer;
     }
     $http = eZHTTPTool::instance();
     $prefix = eZSurveyType::PREFIX_ATTRIBUTE;
     $postSurveyAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $this->contentObjectAttributeID();
     if ($http->hasPostVariable($postSurveyAnswer)) {
         $surveyAnswer = $http->postVariable($postSurveyAnswer);
         return $surveyAnswer;
     }
     $user = eZUser::instance();
     $value = $this->Default;
     if ($user->isLoggedIn() === true) {
         switch ($this->Text3) {
             case "user_email":
                 $value = $this->userEmail();
                 break;
             case "user_name":
                 $value = $this->userName();
                 break;
             default:
                 $value = $this->defaultUserValue();
         }
     }
     return $value;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:28,代码来源:ezsurveytextentry.php

示例2: canUpload

 /**
  * Checks if a file can be uploaded.
  *
  * @return boolean
  */
 public function canUpload()
 {
     $access = eZUser::instance()->hasAccessTo('content', 'create');
     if ($access['accessWord'] === 'no') {
         return false;
     }
     return true;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:13,代码来源:ezprelationajaxuploader.php

示例3: canUpload

 /**
  * Checks if a file can be uploaded
  *
  * @return boolean
  */
 public function canUpload()
 {
     $access = eZUser::instance()->hasAccessTo('content', 'create');
     if ($access['accessWord'] === 'no') {
         return false;
     }
     $ini = eZINI::instance('upload.ini');
     $uploadableClassList = $ini->variable('CreateSettings', 'MimeClassMap');
     $uploadableClassList[] = $ini->variable('CreateSettings', 'DefaultClass');
     $classContent = $this->attribute->attribute('class_content');
     $intersect = array_intersect($classContent['class_constraint_list'], $uploadableClassList);
     if (!empty($classContent['class_constraint_list']) && empty($intersect)) {
         return false;
     }
     return true;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:21,代码来源:ezprelationlistajaxuploader.php

示例4: afterAddingComment

 /**
  * add subscription after adding comment
  * 1) If 'notification' is true
  *     add the user as a subscriber if subscriber with same email doesn't exist
  *     otherwise get the subscriber
  * 2) If 'notification' is true
  *    if the subscription with user's email and contentid doesn't exist, add a new subscription,
  * 3) If there is subscription, add the comment into notifiction queue
  *
  * @see extension/ezcomments/classes/ezcomCommentManager#afterAddingComment($comment)
  */
 public function afterAddingComment($comment, $notification)
 {
     $contentID = $comment->attribute('contentobject_id');
     $languageID = $comment->attribute('language_id');
     $subscriptionType = 'ezcomcomment';
     //add subscription
     $subscription = ezcomSubscriptionManager::instance();
     $user = eZUser::instance();
     if ($notification === true) {
         $subscription->addSubscription($comment->attribute('email'), $user, $contentID, $languageID, $subscriptionType, $comment->attribute('created'));
     }
     // insert data into notification queue
     // if there is no subscription,not adding to notification queue
     if (ezcomSubscription::exists($contentID, $languageID, $subscriptionType, null, 1)) {
         $notification = ezcomNotification::create();
         $notification->setAttribute('contentobject_id', $comment->attribute('contentobject_id'));
         $notification->setAttribute('language_id', $comment->attribute('language_id'));
         $notification->setAttribute('comment_id', $comment->attribute('id'));
         $notification->store();
         eZDebugSetting::writeNotice('extension-ezcomments', 'Notification added to queue', __METHOD__);
     }
 }
开发者ID:ezsystems,项目名称:ezcomments-ls-extension,代码行数:33,代码来源:ezcomcommentcommonmanager.php

示例5: logoutUser

    public static function logoutUser()
    {
        session_destroy();
        if( UserLog::canStore() )
        {
            $user = MMUsers::getCurrentUserObject();
            UserLog::instance()->action('logout');

            if( $user )
                UserLog::instance()->uuid( $user->attribute( 'uuid' ) );
            else
                UserLog::instance()->uuid('Unknown')->msg('Logout called for not logged in user');

            UserLog::instance()->store();
        }

        AppBarControl::instance()->store();

        $user = eZUser::instance();
        // Remove all temporary drafts
        eZContentObject::cleanupAllInternalDrafts( $user->attribute( 'contentobject_id' ) );

        // destroy t3 cookies
        // temporary fix - we are reaching the header size limit
        // self::destroyApplicationCookie( 't3process' );

        MMSelections::destroyCookie();
        MMUsers::destroyCookieUserPreferences();
        CookieTool::destroyCookie( 'catchUpSpe' );
        CookieTool::destroyCookie( 'displayToUPPPopin' );
        CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
        CookieTool::destroyCookie( 'displayToUPPPage' );
        CookieTool::destroyCookie( 'displayToUPPPage', '/', null );
        CookieTool::destroyCookie( MMUsers::COOKIE_KEY );
        CookieTool::destroyCookie(session_name());
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:36,代码来源:mmUserLogin.php

示例6: initializePackage

 function initializePackage($siteType, &$accessMap, $charset, &$extraLanguageCodes, &$allLanguages, &$primaryLanguage, &$admin, &$resultArray)
 {
     // Time limit #3:
     // We set the time limit to 5 minutes to ensure we have enough time
     // to initialize the site. However we only set if the current limit
     // is too small
     $maxTime = ini_get('max_execution_time');
     if ($maxTime != 0 and $maxTime < 5 * 60) {
         @set_time_limit(5 * 60);
     }
     switch ($siteType['access_type']) {
         case 'port':
             $userSiteaccessName = $siteType['identifier'] . '_' . 'user';
             $adminSiteaccessName = $siteType['identifier'] . '_' . 'admin';
             $accessMap['port'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['port'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
         case 'hostname':
             $userSiteaccessName = $siteType['identifier'] . '_' . 'user';
             $adminSiteaccessName = $siteType['identifier'] . '_' . 'admin';
             $accessMap['hostname'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['hostname'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
         case 'url':
         default:
             $userSiteaccessName = $siteType['access_type_value'];
             $adminSiteaccessName = $siteType['admin_access_type_value'];
             $accessMap['url'][$siteType['access_type_value']] = $userSiteaccessName;
             $accessMap['url'][$siteType['admin_access_type_value']] = $adminSiteaccessName;
             break;
     }
     $accessMap['accesses'][] = $userSiteaccessName;
     $accessMap['accesses'][] = $adminSiteaccessName;
     $accessMap['sites'][] = $userSiteaccessName;
     $userDesignName = $siteType['identifier'];
     $languageObjects = $allLanguages;
     $databaseMap = eZSetupDatabaseMap();
     $databaseInfo = $this->PersistenceList['database_info'];
     $databaseInfo['info'] = $databaseMap[$databaseInfo['type']];
     $dbServer = $databaseInfo['server'];
     $dbPort = $databaseInfo['port'];
     //        $dbName = $databaseInfo['dbname'];
     $dbSocket = $databaseInfo['socket'];
     $dbUser = $databaseInfo['user'];
     $dbPwd = $databaseInfo['password'];
     $dbCharset = $charset;
     $dbDriver = $databaseInfo['info']['driver'];
     $dbName = $siteType['database'];
     $dbParameters = array('server' => $dbServer, 'port' => $dbPort, 'user' => $dbUser, 'password' => $dbPwd, 'socket' => $dbSocket, 'database' => $dbName, 'charset' => $dbCharset);
     $db = eZDB::instance($dbDriver, $dbParameters, true);
     if (!$db->isConnected()) {
         $resultArray['errors'][] = array('code' => 'EZSW-005', 'text' => "Failed connecting to database {$dbName}\n" . $db->errorMessage());
         return false;
     }
     eZDB::setInstance($db);
     $result = true;
     // Initialize the database by inserting schema and data
     if (!isset($siteType['existing_database'])) {
         $siteType['existing_database'] = false;
     }
     if ($siteType['existing_database'] == eZStepInstaller::DB_DATA_REMOVE) {
         eZDBTool::cleanup($db);
     }
     if ($siteType['existing_database'] != eZStepInstaller::DB_DATA_KEEP) {
         $result = true;
         $schemaArray = eZDbSchema::read('share/db_schema.dba', true);
         if (!$schemaArray) {
             $resultArray['errors'][] = array('code' => 'EZSW-001', 'message' => "Failed loading database schema file share/db_schema.dba");
             $result = false;
         }
         if ($result) {
             $result = true;
             $dataArray = eZDbSchema::read('share/db_data.dba', true);
             if (!$dataArray) {
                 $resultArray['errors'][] = array('code' => 'EZSW-002', 'text' => "Failed loading database data file share/db_data.dba");
                 $result = false;
             }
             if ($result) {
                 $schemaArray = array_merge($schemaArray, $dataArray);
                 $schemaArray['type'] = strtolower($db->databaseName());
                 $schemaArray['instance'] = $db;
                 $result = true;
                 $dbSchema = eZDbSchema::instance($schemaArray);
                 if (!$dbSchema) {
                     $resultArray['errors'][] = array('code' => 'EZSW-003', 'text' => "Failed loading " . $db->databaseName() . " schema handler");
                     $result = false;
                 }
                 if ($result) {
                     $result = true;
                     // This will insert the schema, then the data and
                     // run any sequence value correction SQL if required
                     $params = array('schema' => true, 'data' => true);
                     if ($db->databaseName() == 'mysql') {
                         $engines = $db->arrayQuery('SHOW ENGINES');
                         foreach ($engines as $engine) {
                             if ($engine['Engine'] == 'InnoDB' && in_array($engine['Support'], array('YES', 'DEFAULT'))) {
                                 $params['table_type'] = 'innodb';
                                 break;
                             }
                         }
//.........这里部分代码省略.........
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:101,代码来源:ezstep_create_sites.php

示例7: trim

<?php

/**
 * File containing logic of setting view
 *
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 *
 */
$tpl = eZTemplate::factory();
$http = eZHTTPTool::instance();
$user = eZUser::instance();
$ini = eZINI::instance('ezcomments.ini');
$hashStringLength = $ini->variable('NotificationSettings', 'SubscriberHashStringLength');
$hashString = null;
$page = 1;
if ($user->isAnonymous()) {
    $hashString = trim($Params['HashString']);
    if (!is_null($Params['Page'])) {
        $page = $Params['Page'];
    }
    if (is_null($hashString) || strlen($hashString) != $hashStringLength) {
        $Result = array();
        $Result['content'] = $tpl->fetch('design:comment/setting.tpl');
        $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('ezcomments/comment/setting', 'Comment settings')));
        return $Result;
    }
} else {
    if (!is_null($Params['HashString']) && $Params['HashString'] != '') {
        $page = $Params['HashString'];
    }
开发者ID:ezsystems,项目名称:ezcomments-ls-extension,代码行数:31,代码来源:setting.php

示例8: update

 /**
  * Do all time based operations on block pool such as rotation, updating
  * the queue, overflow as well as executes fetch interfaces.
  *
  * @static
  */
 public static function update($nodeArray = array())
 {
     // log in user as anonymous if another user is logged in
     $currentUser = eZUser::currentUser();
     if ($currentUser->isLoggedIn()) {
         $loggedInUser = $currentUser;
         $anonymousUserId = eZUser::anonymousId();
         $anonymousUser = eZUser::instance($anonymousUserId);
         eZUser::setCurrentlyLoggedInUser($anonymousUser, $anonymousUserId);
         unset($currentUser, $anonymousUser, $anonymousUserId);
     }
     include_once 'kernel/classes/ezcontentcache.php';
     $ini = eZINI::instance('block.ini');
     $db = eZDB::instance();
     // Remove the blocks and items for the block if marked for removal
     $res = $db->arrayQuery("SELECT id\n                         FROM ezm_block\n                         WHERE is_removed=1");
     foreach ($res as $row) {
         $blockID = $row['id'];
         $db->begin();
         $db->query("DELETE FROM ezm_pool\n                 WHERE block_id='{$blockID}'");
         $db->query("DELETE FROM ezm_block\n                 WHERE id='{$blockID}'");
         $db->commit();
     }
     if (!$nodeArray) {
         // Update pool and pages for all nodes
         $res = $db->arrayQuery("SELECT DISTINCT node_id FROM ezm_block");
         foreach ($res as $row) {
             $nodeArray[] = $row['node_id'];
         }
     }
     foreach ($nodeArray as $nodeID) {
         $time = time() - 5;
         // a safety margin
         $nodeChanged = false;
         $blocks = $db->arrayQuery("SELECT *\n                                FROM ezm_block\n                                WHERE node_id={$nodeID}");
         $blockByID = array();
         // Determine the order of updating
         $correctOrder = array();
         $next = array();
         foreach ($blocks as $block) {
             $next[$block['id']] = trim($block['overflow_id']);
             // Make sure that block ID does not any have spaces
             $blockByID[$block['id']] = $block;
         }
         $nextIDs = array_keys($next);
         foreach ($nextIDs as $id) {
             if (in_array($id, $correctOrder, true)) {
                 continue;
             }
             if (!$next[$id]) {
                 $correctOrder[] = $id;
                 continue;
             }
             $subCorrectOrder = array($id);
             $currentID = $id;
             while ($nextID = $next[$currentID]) {
                 if (!in_array($nextID, $nextIDs, true)) {
                     eZDebug::writeWarning("Overflow for {$currentID} is {$nextID}, but no such block was found for the given node", __METHOD__);
                     break;
                 }
                 if (in_array($nextID, $subCorrectOrder, true)) {
                     eZDebug::writeWarning("Loop detected, ignoring ({$nextID} should be after {$currentID} and vice versa)", __METHOD__);
                     break;
                 }
                 if (in_array($nextID, $correctOrder, true)) {
                     break;
                 }
                 $subCorrectOrder[] = $nextID;
                 $currentID = $nextID;
             }
             if (!$nextID || !in_array($nextID, $correctOrder, true)) {
                 foreach ($subCorrectOrder as $element) {
                     $correctOrder[] = $element;
                 }
             } else {
                 $newCorrectOrder = array();
                 foreach ($correctOrder as $element) {
                     if ($element === $nextID) {
                         foreach ($subCorrectOrder as $element2) {
                             $newCorrectOrder[] = $element2;
                         }
                     }
                     $newCorrectOrder[] = $element;
                 }
                 $correctOrder = $newCorrectOrder;
             }
         }
         // Loop through all block in determined order
         foreach ($correctOrder as $blockID) {
             if ($blockByID[$blockID]) {
                 $block = $blockByID[$blockID];
             } else {
                 continue;
             }
//.........这里部分代码省略.........
开发者ID:netbliss,项目名称:ezflow,代码行数:101,代码来源:ezflowoperations.php

示例9: registerSubscription

 function registerSubscription($firstname, $name, $mobile, $email, $password = false)
 {
     if ($this->emailSubscriptionExists($email)) {
         return false;
     }
     $subscription = eZSubscription::create($this->attribute('id'), $firstname, $name, $mobile, $email);
     $user = eZUser::instance();
     if ($this->attribute('auto_confirm_registered') && $user->isLoggedIn()) {
         $subscription->setAttribute('status', eZSubscription::StatusConfirmed);
         if ($this->attribute('auto_approve_registered')) {
             $subscription->setAttribute('status', eZSubscription::StatusApproved);
         }
     }
     if ($password !== false) {
         $subscription->setAttribute('password', $password);
     }
     if (!is_object($subscription)) {
         eZDebug::writeError('Newsletter Anmeldefehler', __METHOD__);
         eZDebug::writeError($this->attribute('id'), 'subscription id');
         eZDebug::writeError($name, 'name');
         eZDebug::writeError($firstname, 'firstname');
         eZDebug::writeError($email, 'email');
     }
     $subscription->publish();
     return $subscription;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:26,代码来源:ezsubscriptionlist.php

示例10: optimize

    /**
     * Adds object $contentObject to the search database.
     *
     * @param eZContentObject $contentObject Object to add to search engine
     * @param bool $commit Whether to commit after adding the object.
              If set, run optimize() as well every 1000nd time this function is run.
     * @return bool True if the operation succeed.
     */
    function addObject( $contentObject, $commit = true )
    {
        // Add all translations to the document list
        $docList = array();

        // Check if we need to index this object after all
        // Exclude if class identifier is in the exclude list for classes
        $excludeClasses = $this->FindINI->variable( 'IndexExclude', 'ClassIdentifierList' );
        if ( $excludeClasses && in_array( $contentObject->attribute( 'class_identifier' ), $excludeClasses ) )
        {
            return true;
        }
        // Get global object values
        $mainNode = $contentObject->attribute( 'main_node' );
        if ( !$mainNode )
        {
            eZDebug::writeError( 'Unable to fetch main node for object: ' . $contentObject->attribute( 'id' ), __METHOD__ );
            return false;
        }

        $mainNodePathArray = $mainNode->attribute( 'path_array' );
        $mainNodeID = $mainNode->attribute( 'node_id' );
        // initialize array of parent node path ids, needed for multivalued path field and subtree filters
        $nodePathArray = array();

        //included in $nodePathArray
        //$pathArray = $mainNode->attribute( 'path_array' );
        $currentVersion = $contentObject->currentVersion();

        // Get object meta attributes.
        $metaAttributeValues = self::getMetaAttributesForObject( $contentObject );

        // Get node attributes.
        $nodeAttributeValues = array();
        foreach ( $contentObject->attribute( 'assigned_nodes' ) as $contentNode )
        {
            $nodeID = $contentNode->attribute( 'node_id' );
            foreach ( eZSolr::nodeAttributes() as $attributeName => $fieldType )
            {
                $nodeAttributeValues[$nodeID][] = array( 'name' => $attributeName,
                                                'value' => $contentNode->attribute( $attributeName ),
                                                'fieldType' => $fieldType );
            }
            $nodePathArray[] = $contentNode->attribute( 'path_array' );

        }

        // Check anonymous user access.
        if ( $this->FindINI->variable( 'SiteSettings', 'IndexPubliclyAvailable' ) == 'enabled' )
        {
            $anonymousUserID = $this->SiteINI->variable( 'UserSettings', 'AnonymousUserID' );
            $currentUserID = eZUser::currentUserID();
            $user = eZUser::instance( $anonymousUserID );
            eZUser::setCurrentlyLoggedInUser( $user, $anonymousUserID );
            $anonymousAccess = $contentObject->attribute( 'can_read' );
            $user = eZUser::instance( $currentUserID );
            eZUser::setCurrentlyLoggedInUser( $user, $currentUserID );
            $anonymousAccess = $anonymousAccess ? 'true' : 'false';
        }
        else
        {
            $anonymousAccess = 'false';
        }

        // Load index time boost factors if any
        //$boostMetaFields = $this->FindINI->variable( "IndexBoost", "MetaField" );
        $boostClasses = $this->FindINI->variable( 'IndexBoost', 'Class' );
        $boostAttributes = $this->FindINI->variable( 'IndexBoost', 'Attribute' );
        $boostDatatypes = $this->FindINI->variable( 'IndexBoost', 'Datatype' );
        $reverseRelatedScale = $this->FindINI->variable( 'IndexBoost', 'ReverseRelatedScale' );

        // Initialise default doc boost
        $docBoost = 1.0;
        $contentClassIdentifier = $contentObject->attribute( 'class_identifier' );
        // Just test if the boost factor is defined by checking if it has a numeric value
        if ( isset( $boostClasses[$contentClassIdentifier] ) && is_numeric( $boostClasses[$contentClassIdentifier] ) )
        {
            $docBoost += $boostClasses[$contentClassIdentifier];
        }
        // Google like boosting, using eZ Publish reverseRelatedObjectCount
        $reverseRelatedObjectCount = $contentObject->reverseRelatedObjectCount();
        $docBoost += $reverseRelatedScale * $reverseRelatedObjectCount;

        //  Create the list of available languages for this version :
        $availableLanguages = $currentVersion->translationList( false, false );

        // Loop over each language version and create an eZSolrDoc for it
        foreach ( $availableLanguages as $languageCode )
        {
            $doc = new eZSolrDoc( $docBoost );
            // Set global unique object ID
            $doc->addField( ezfSolrDocumentFieldBase::generateMetaFieldName( 'guid' ), $this->guid( $contentObject, $languageCode ) );
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezsolr.php

示例11: user

 function user()
 {
     if (isset($this->UserID) and $this->UserID) {
         return eZUser::instance($this->UserID);
     }
     return null;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:7,代码来源:ezworkflowprocess.php

示例12: testNullUserCache

 /**
  * eZUser: do not generate cache content for invalid user
  *
  * @link http://issues.ez.no/22181
  */
 public function testNullUserCache()
 {
     eZUser::instance($this->userId);
     $cacheFilePath = eZUser::getCacheDir($this->userId) . "/user-data-{$this->userId}.cache.php";
     $this->assertFalse(file_exists($cacheFilePath));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:11,代码来源:ezusercache_test.php

示例13: execute

 function execute($process, $event)
 {
     eZDebugSetting::writeDebug('kernel-workflow-approve', $process, 'eZApprove2Type::execute');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $event, 'eZApprove2Type::execute');
     $parameters = $process->attribute('parameter_list');
     $versionID = $parameters['version'];
     $object = eZContentObject::fetch($parameters['object_id']);
     if (!$object) {
         eZDebugSetting::writeError('kernel-workflow-approve', $parameters['object_id'], 'eZApprove2Type::execute');
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     /*
       If we run event first time ( when we click publish in admin ) we do not have user_id set in workflow process,
       so we take current user and store it in workflow process, so next time when we run event from cronjob we fetch
       user_id from there.
     */
     if ($process->attribute('user_id') == 0) {
         $user = eZUser::currentUser();
         $process->setAttribute('user_id', $user->id());
     } else {
         $user = eZUser::instance($process->attribute('user_id'));
     }
     $eventData = eZApprove2Event::fetch($event->attribute('id'), $event->attribute('version'));
     $userGroups = array_merge((array) $user->attribute('groups'), (array) $user->attribute('contentobject_id'));
     $workflowSections = explode(',', $eventData->attribute('selected_sections'));
     $workflowGroups = explode(',', $eventData->attribute('selected_usergroups'));
     $editors = explode(',', $eventData->attribute('approve_users'));
     $approveGroups = explode(',', $eventData->attribute('approve_groups'));
     eZDebugSetting::writeDebug('kernel-workflow-approve', $user, 'eZApprove2Type::execute::user');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $userGroups, 'eZApprove2Type::execute::userGroups');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $editors, 'eZApprove2Type::execute::editor');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $workflowSections, 'eZApprove2Type::execute::workflowSections');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $workflowGroups, 'eZApprove2Type::execute::workflowGroups');
     eZDebugSetting::writeDebug('kernel-workflow-approve', $object->attribute('section_id'), 'eZApprove2Type::execute::section_id');
     $section = $object->attribute('section_id');
     $correctSection = false;
     if (!in_array($section, $workflowSections) && !in_array(-1, $workflowSections)) {
         $assignedNodes = $object->attribute('assigned_nodes');
         if ($assignedNodes) {
             foreach ($assignedNodes as $assignedNode) {
                 $parent = $assignedNode->attribute('parent');
                 $parentObject = $parent->object();
                 $section = $parentObject->attribute('section_id');
                 if (in_array($section, $workflowSections)) {
                     $correctSection = true;
                     break;
                 }
             }
         }
     } else {
         $correctSection = true;
     }
     switch ($eventData->attribute('approve_type')) {
         case eZApprove2Event::ApproveTypeUser:
             $inExcludeGroups = false;
             $userIsEditor = false;
             break;
         default:
         case eZApprove2Event::ApproveTypePredefined:
             $inExcludeGroups = count(array_intersect($userGroups, $workflowGroups)) != 0;
             $userIsEditor = in_array($user->id(), $editors) || count(array_intersect($userGroups, $approveGroups)) != 0;
             break;
     }
     if (!$inExcludeGroups && !$userIsEditor && $correctSection) {
         switch ($eventData->attribute('approve_type')) {
             case eZApprove2Event::ApproveTypeUser:
                 $contentObjectVersionID = $parameters['version'];
                 $contentObjectID = $parameters['object_id'];
                 $approveStatus = eZXApproveStatus::fetchByContentObjectID($contentObjectID, $contentObjectVersionID);
                 if (!$approveStatus || $approveStatus->attribute('approve_status') == eZXApproveStatus::StatusSelectApprover) {
                     if (!$approveStatus) {
                         $approveStatus = eZXApproveStatus::create($contentObjectID, $contentObjectVersionID, $process->attribute('id'), $process->attribute('event_position'));
                         $approveStatus->store();
                         $approveStatus->setCreator($user->attribute('contentobject_id'));
                     }
                     $approveStatus->setAttribute('active_version', $contentObjectVersionID);
                     $approveStatus->sync();
                     $process->Template = array();
                     $process->Template['templateName'] = 'design:workflow/eventtype/ezapprove2/select_approver.tpl';
                     $process->Template['templateVars'] = array('event' => $event, 'approval_status' => $approveStatus, 'object' => $object);
                     // Set object version to draft untill approvers are selected successfully in case user exists in the wrong way.
                     #include_once( 'kernel/classes/ezcontentobjectversion.php' );
                     $contentObjectVersion = eZContentObjectVersion::fetchVersion($contentObjectVersionID, $contentObjectID);
                     $contentObjectVersion->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
                     $contentObjectVersion->sync();
                     return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
                 } else {
                     switch ($approveStatus->attribute('approve_status')) {
                         case eZXApproveStatus::StatusSelectApprover:
                             // Do nothing, continue processing in next cronjob run.
                             return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
                             break;
                         case eZXApproveStatus::StatusInApproval:
                             // Check if enough users have approves the workflow, or any has discarded it.
                             $discardCount = $approveStatus->discardedUserCount();
                             $collaborationItem = $approveStatus->attribute('collaboration_item');
                             #include_once( eZExtension::baseDirectory() . '/ezapprove2/collaboration/ezapprove2/ezapprove2collaborationhandler.php' );
                             if ($discardCount > 0) {
                                 $approveStatus->cancel();
                                 $approveINI = eZINI::instance('ezapprove2.ini');
//.........这里部分代码省略.........
开发者ID:brucem,项目名称:ezapprove2,代码行数:101,代码来源:ezapprove2type.php

示例14: currentUserObject

 protected function currentUserObject()
 {
     if (!isset(self::$currentUserObject)) {
         self::$currentUserObject = false;
         $user = eZUser::instance();
         if ($user instanceof eZUser) {
             $object = $user->attribute('contentobject');
             if ($object instanceof eZContentObject) {
                 self::$currentUserObject = $object;
             }
         }
     }
     return self::$currentUserObject;
 }
开发者ID:netbliss,项目名称:ezsurvey,代码行数:14,代码来源:ezsurveyquestion.php

示例15: currentUserID

 static function currentUserID()
 {
     $user = eZUser::instance();
     if (!$user) {
         return 0;
     }
     return $user->attribute('contentobject_id');
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:8,代码来源:ezuser.php


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