コード例 #1
0
 /**
  * Retrieve user logins in JSon format
  *
  * @return string
  */
 protected function getSwarmUsers()
 {
     $swarmApi = new swarmApi();
     $swarmUsers = json_decode($swarmApi->getUsers());
     $users = array();
     foreach ($swarmUsers as $user) {
         // If we want to display the customer's login and fullname in the autocompletion results,
         // use the following type of code
         // $users[] = array( 'label' => $user->user, 'fullname' => 'test' );
         $users[] = $user->user;
     }
     return json_encode($users, JSON_HEX_APOS);
 }
コード例 #2
0
ファイル: user.php プロジェクト: Novactive/ezswarm
<?php

/**
 * Retrieve user data for provided login
 *
 * @category  eZpublish
 * @package   eZpublish.eZSwarm
 * @author    Novactive <*****@*****.**>
 * @copyright 2014 Novactive
 */
eZDebug::updateSettings(array('debug-enabled' => false));
$userId = $Params['id'];
if (!$userId) {
    $returnData = array('notif' => ezpI18n::tr('ezswarm', 'No user login provided'));
} else {
    $swarmApi = new swarmApi();
    $userData = $swarmApi->getUserData($userId);
    if ($userData) {
        $returnData = array('account' => $userData);
    } else {
        $returnData = array('notif' => ezpI18n::tr('ezswarm', 'No user data found for login : %1', null, array($userId)));
    }
}
$Result = array();
$Result['pagelayout'] = false;
$Result['content'] = json_encode($returnData, JSON_HEX_TAG);
return $Result;