Add files pmgmail
This commit is contained in:
@@ -29,7 +29,8 @@
|
||||
"underscore/underscore": "1.5.2",
|
||||
"colosa/pmUI": "dev-master",
|
||||
"colosa/MichelangeloFE": "dev-master",
|
||||
"colosa/pmdynaform": "dev-master"
|
||||
"colosa/pmdynaform": "dev-master",
|
||||
"google/apiclient": "1.1.*"
|
||||
},
|
||||
"require-dev":{
|
||||
"guzzle/guzzle":"~3.1.1",
|
||||
|
||||
269
workflow/engine/classes/class.pmDrive.php
Executable file
269
workflow/engine/classes/class.pmDrive.php
Executable file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pmDrive.php
|
||||
*
|
||||
* @package workflow.engine.class
|
||||
*
|
||||
*/
|
||||
class PMDrive extends PMGoogleApi
|
||||
{
|
||||
private $folderIdPMDrive = '';
|
||||
private $folderNamePMDrive;
|
||||
|
||||
/**
|
||||
* Validate if exist folder PMDrive
|
||||
*
|
||||
* @param $userUid id user
|
||||
*/
|
||||
private function validateFolderPMDrive($usrUid)
|
||||
{
|
||||
if ($this->folderIdPMDrive != '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = new Users();
|
||||
$dataUser = $user->load($usrUid);
|
||||
|
||||
if (!empty($dataUser['USR_EMAIL'])) {
|
||||
$this->setDriveUser($dataUser['USR_EMAIL']);
|
||||
}
|
||||
$this->folderIdPMDrive = empty($dataUser['USR_PMDRIVE_FOLDER_UID']) ? '' : $dataUser['USR_PMDRIVE_FOLDER_UID'];
|
||||
|
||||
$conf = $this->getConfigGmail();
|
||||
$this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . SYS_SYS . ')' : $conf->aConfig['folderNamePMDrive'];
|
||||
|
||||
if ($this->folderIdPMDrive == '') {
|
||||
$folderid = $this->createFolder($this->folderNamePMDrive);
|
||||
|
||||
$this->folderIdPMDrive = $folderid->id;
|
||||
$dataUser['USR_PMDRIVE_FOLDER_UID'] = $folderid->id;
|
||||
$user->update($dataUser);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFolderIdPMDrive($usrUid)
|
||||
{
|
||||
$this->validateFolderPMDrive($usrUid);
|
||||
return $this->folderIdPMDrive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set account user
|
||||
*
|
||||
* @param $user email user
|
||||
*/
|
||||
public function setFolderNamePMDrive($name)
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
$conf->aConfig['folderNamePMDrive'] = $name;
|
||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
|
||||
$this->folderNamePMDrive = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set account user
|
||||
*
|
||||
* @param $user email user
|
||||
*/
|
||||
public function setDriveUser($user)
|
||||
{
|
||||
$this->setUser($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance google service Drive
|
||||
*
|
||||
* @return Google_Service_Drive $service Drive API service instance.
|
||||
*/
|
||||
private function serviceDrive()
|
||||
{
|
||||
$client = $this->serviceClient();
|
||||
$service = new Google_Service_Drive($client);
|
||||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of File resources.
|
||||
*
|
||||
* @param string $fileId uid file
|
||||
* @return Array List of Google_Service_Drive_DriveFile resources.
|
||||
*/
|
||||
public function listFolder($fileId)
|
||||
{
|
||||
$this->setScope('https://www.googleapis.com/auth/drive');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.file');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.readonly');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.metadata.readonly');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.appdata');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.metadata');
|
||||
$service = $this->serviceDrive();
|
||||
|
||||
try {
|
||||
$parameters['q'] = "'" . $fileId . "' in parents and trashed = false";
|
||||
$parents = $service->files->listFiles($parameters);
|
||||
|
||||
$rows = array();
|
||||
foreach ($parents->getItems() as $parent) {
|
||||
//echo 'File Id: ' . $parent->getId() . '<br>';
|
||||
$rows = $parent;
|
||||
}
|
||||
return $rows;
|
||||
} catch (Exception $e) {
|
||||
return G::LoadTranslation("ID_MSG_AJAX_FAILURE") . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of File resources.
|
||||
*
|
||||
* @param string $name Title of the file to insert, including the extension.
|
||||
* @param string $parentId Parent folder's ID.
|
||||
* @return Google_Service_Drive_DriveFile The file that was inserted. NULL is returned if an API error occurred.
|
||||
*/
|
||||
public function createFolder($name, $parentId = null)
|
||||
{
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.file');
|
||||
|
||||
$service = $this->serviceDrive();
|
||||
|
||||
$file = new Google_Service_Drive_DriveFile();
|
||||
$file->setMimeType("application/vnd.google-apps.folder");
|
||||
$file->setTitle($name);
|
||||
|
||||
if ($parentId != null) {
|
||||
$parent = new Google_Service_Drive_ParentReference();
|
||||
$parent->setId($parentId);
|
||||
$file->setParents(array($parent));
|
||||
}
|
||||
|
||||
try {
|
||||
$createdFolder = $service->files->insert($file);
|
||||
return $createdFolder;
|
||||
} catch (Exception $e) {
|
||||
return "An error occurred: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* upload new file
|
||||
*
|
||||
* @param string $mime MIME type of the file to insert.
|
||||
* @param string $src location of the file to insert.
|
||||
* @param string $name Title of the file to insert, including the extension.
|
||||
* @return Google_Service_Drive_DriveFile The file that was inserted. NULL is returned if an API error occurred.
|
||||
*/
|
||||
public function uploadFile($mime, $src, $name, $parentId = null)
|
||||
{
|
||||
//$this->validateFolderPMDrive();
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.file');
|
||||
|
||||
$service = $this->serviceDrive();
|
||||
|
||||
$file = new Google_Service_Drive_DriveFile();
|
||||
$file->setMimeType("*/*");
|
||||
$file->setTitle($name);
|
||||
|
||||
// Set the parent folder.
|
||||
if ($parentId != null) {
|
||||
$parent = new Google_Service_Drive_ParentReference();
|
||||
$parent->setId($parentId);
|
||||
$file->setParents(array($parent));
|
||||
}
|
||||
|
||||
$data = file_get_contents($src);
|
||||
|
||||
try {
|
||||
$createdFile = $service->files->insert(
|
||||
$file,
|
||||
array(
|
||||
'data' => $data,
|
||||
'mimeType' => $mime,
|
||||
'uploadType' => 'media'
|
||||
)
|
||||
);
|
||||
|
||||
return $createdFile;
|
||||
} catch (Exception $e) {
|
||||
return "An error occurred: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a file's content.
|
||||
*
|
||||
* @param string $fileId id file.
|
||||
* @return String The file's content if successful, null otherwise
|
||||
*/
|
||||
public function downloadFile($fileId)
|
||||
{
|
||||
//$this->validateFolderPMDrive();
|
||||
$this->setScope('https://www.googleapis.com/auth/drive');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.appdata');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.apps.readonly');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.file');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.metadata');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.metadata.readonly');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.readonly');
|
||||
$service = $this->serviceDrive();
|
||||
|
||||
try {
|
||||
$file = $service->files->get($fileId);
|
||||
|
||||
$downloadUrl = $file->getDownloadUrl();
|
||||
if ($downloadUrl) {
|
||||
$request = new Google_Http_Request($downloadUrl, 'GET', null, null);
|
||||
$httpRequest = $service->getClient()->getAuth()->authenticatedRequest($request);
|
||||
if ($httpRequest->getResponseHttpCode() == 200) {
|
||||
return $httpRequest->getResponseBody();
|
||||
} else {
|
||||
// An error occurred.
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// The file doesn't have any content stored on Drive.
|
||||
return null;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
print "An error occurred: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new permission.
|
||||
*
|
||||
* @param String $fileId ID of the file to insert permission for.
|
||||
* @param String $value User or group e-mail address, domain name or NULL for "default" type.
|
||||
* @param String $type The value "user", "group", "domain" or "default".
|
||||
* @param String $role The value "owner", "writer" or "reader".
|
||||
* @return Google_Servie_Drive_Permission The inserted permission. NULL is returned if an API error occurred.
|
||||
*/
|
||||
public function setPermission($fileId, $value, $type = 'user', $role = 'reader', $sendNotification = false)
|
||||
{
|
||||
$this->setScope('https://www.googleapis.com/auth/drive');
|
||||
$this->setScope('https://www.googleapis.com/auth/drive.file');
|
||||
|
||||
$service = $this->serviceDrive();
|
||||
|
||||
$newPermission = new Google_Service_Drive_Permission();
|
||||
$newPermission->setValue($value);
|
||||
$newPermission->setType($type);
|
||||
$newPermission->setRole($role);
|
||||
|
||||
try {
|
||||
$permission = $service->permissions->insert(
|
||||
$fileId,
|
||||
$newPermission,
|
||||
array(
|
||||
'sendNotificationEmails' => $sendNotification
|
||||
)
|
||||
);
|
||||
|
||||
return $permission;
|
||||
} catch (Exception $e) {
|
||||
error_log('permission error: ' . $e->getMessage());
|
||||
return "An error occurred: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
213
workflow/engine/classes/class.pmGoogleApi.php
Executable file
213
workflow/engine/classes/class.pmGoogleApi.php
Executable file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pmGoogleApi.php
|
||||
*
|
||||
*/
|
||||
|
||||
require_once PATH_TRUNK . 'vendor' . PATH_SEP . 'google' . PATH_SEP . 'apiclient' . PATH_SEP . 'src' . PATH_SEP . 'Google' . PATH_SEP . 'autoload.php';
|
||||
|
||||
class PMGoogleApi
|
||||
{
|
||||
private $scope = array();
|
||||
private $serviceAccountEmail;
|
||||
private $serviceAccountP12;
|
||||
private $statusService;
|
||||
private $domain;
|
||||
private $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
$this->loadSettings();
|
||||
}
|
||||
|
||||
public function setScope($scope)
|
||||
{
|
||||
$this->scope[] = $scope;
|
||||
}
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
public function setUser($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function setStatusService($status)
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
|
||||
$conf->aConfig['statusService'] = $status;
|
||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
|
||||
$this->statusService = $status;
|
||||
}
|
||||
|
||||
public function getStatusService()
|
||||
{
|
||||
return $this->statusService;
|
||||
}
|
||||
|
||||
public function getConfigGmail()
|
||||
{
|
||||
$conf = new Configurations();
|
||||
$conf->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
|
||||
return $conf;
|
||||
}
|
||||
|
||||
public function setServiceAccountEmail($serviceAccountEmail)
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
|
||||
$conf->aConfig['serviceAccountEmail'] = $serviceAccountEmail;
|
||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
|
||||
$this->serviceAccountEmail = $serviceAccountEmail;
|
||||
}
|
||||
|
||||
public function getServiceAccountEmail()
|
||||
{
|
||||
return $this->serviceAccountEmail;
|
||||
}
|
||||
|
||||
public function setServiceAccountP12($serviceAccountP12)
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
|
||||
$conf->aConfig['serviceAccountP12'] = $serviceAccountP12;
|
||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
|
||||
$this->serviceAccountP12 = $serviceAccountP12;
|
||||
}
|
||||
|
||||
public function getserviceAccountP12()
|
||||
{
|
||||
return $this->serviceAccountP12;
|
||||
}
|
||||
|
||||
public function setDomain($domain)
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
|
||||
$conf->aConfig['domain'] = $domain;
|
||||
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
|
||||
$this->domain = $domain;
|
||||
}
|
||||
|
||||
public function getDomain()
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* load configuration gmail service account
|
||||
*
|
||||
*/
|
||||
public function loadSettings()
|
||||
{
|
||||
$conf = $this->getConfigGmail();
|
||||
|
||||
$serviceAccountP12 = empty($conf->aConfig['serviceAccountP12']) ? '' : $conf->aConfig['serviceAccountP12'];
|
||||
$serviceAccountEmail = empty($conf->aConfig['serviceAccountEmail']) ? '' : $conf->aConfig['serviceAccountEmail'];
|
||||
$statusService = empty($conf->aConfig['statusService']) ? '' : $conf->aConfig['statusService'];
|
||||
|
||||
$this->scope = array();
|
||||
$this->setServiceAccountEmail($serviceAccountEmail);
|
||||
$this->setServiceAccountP12($serviceAccountP12);
|
||||
$this->setStatusService($statusService);
|
||||
}
|
||||
|
||||
/**
|
||||
* New service client - Authentication google Api
|
||||
*
|
||||
* @return Google_Service_Client $service API service instance.
|
||||
*/
|
||||
public function serviceClient()
|
||||
{
|
||||
$key = file_get_contents(PATH_DATA_SITE . $this->serviceAccountP12);
|
||||
|
||||
$assertionCredentials = new Google_Auth_AssertionCredentials(
|
||||
$this->serviceAccountEmail,
|
||||
$this->scope,
|
||||
$key
|
||||
);
|
||||
$assertionCredentials->sub = $this->user;
|
||||
|
||||
$client = new Google_Client();
|
||||
$client->setApplicationName("PMDrive");
|
||||
$client->setAssertionCredentials($assertionCredentials);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* New service client - Authentication google Api
|
||||
*
|
||||
* @return Google_Service_Client $service API service instance.
|
||||
*/
|
||||
public function testService($serviceAccountEmail, $pathServiceAccountP12)
|
||||
{
|
||||
$key = file_get_contents($pathServiceAccountP12);
|
||||
|
||||
$assertionCredentials = new Google_Auth_AssertionCredentials(
|
||||
$serviceAccountEmail,
|
||||
array(
|
||||
'https://www.googleapis.com/auth/drive',
|
||||
'https://www.googleapis.com/auth/drive.file',
|
||||
'https://www.googleapis.com/auth/drive.readonly',
|
||||
'https://www.googleapis.com/auth/drive.metadata.readonly',
|
||||
'https://www.googleapis.com/auth/drive.appdata',
|
||||
'https://www.googleapis.com/auth/drive.metadata',
|
||||
'https://www.googleapis.com/auth/drive.photos.readonly'
|
||||
),
|
||||
$key
|
||||
);
|
||||
$assertionCredentials->sub = $this->user;
|
||||
|
||||
$client = new Google_Client();
|
||||
$client->setApplicationName("PMDrive");
|
||||
$client->setAssertionCredentials($assertionCredentials);
|
||||
|
||||
$service = new Google_Service_Drive($client);
|
||||
|
||||
$result = new StdClass();
|
||||
$result->success = true;
|
||||
|
||||
$result->currentUserName = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
$result->rootFolderId = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
$result->quotaType = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
$result->quotaBytesTotal = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
$result->quotaBytesUsed = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
|
||||
try {
|
||||
$about = $service->about->get();
|
||||
|
||||
$result->currentUserName = $about->getName();
|
||||
$result->rootFolderId = $about->getRootFolderId();
|
||||
$result->quotaType = $about->getQuotaType();
|
||||
$result->quotaBytesTotal = $about->getQuotaBytesTotal();
|
||||
$result->quotaBytesUsed = $about->getQuotaBytesUsed();
|
||||
$result->responseGmailTest = G::LoadTranslation('ID_SUCCESSFUL_CONNECTION');
|
||||
} catch (Exception $e) {
|
||||
$result->success = false;
|
||||
$result->responseGmailTest = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
115
workflow/engine/controllers/pmGmail.php
Normal file
115
workflow/engine/controllers/pmGmail.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* pmGmail controller
|
||||
* @inherits Controller
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
|
||||
class pmGmail extends Controller
|
||||
{
|
||||
public function saveConfigPmGmail($httpData)
|
||||
{
|
||||
G::LoadClass( "pmGoogleApi" );
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$result = new StdClass();
|
||||
$result->success = true;
|
||||
|
||||
if (!empty($httpData->status_pmgmail)) {
|
||||
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
|
||||
$pmGoogle->setStatusService($httpData->status_pmgmail);
|
||||
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
|
||||
if (!empty($httpData->email_service_account)) {
|
||||
$pmGoogle->setServiceAccountEmail($httpData->email_service_account);
|
||||
$message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
|
||||
}
|
||||
if (!empty($_FILES)) {
|
||||
if ($_FILES['file_p12']['error'] != 1) {
|
||||
if ($_FILES['file_p12']['tmp_name'] != '') {
|
||||
G::uploadFile($_FILES['file_p12']['tmp_name'], PATH_DATA_SITE, $_FILES['file_p12']['name']);
|
||||
$pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
|
||||
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
|
||||
}
|
||||
} else {
|
||||
$result->success = false;
|
||||
$result->fileError = true;
|
||||
print(G::json_encode($result));
|
||||
die();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pmGoogle->setStatusService(false);
|
||||
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
|
||||
}
|
||||
G::auditLog("Update Settings Gmail", $message);
|
||||
|
||||
print(G::json_encode($result));
|
||||
}
|
||||
|
||||
public function formPMGmail()
|
||||
{
|
||||
try {
|
||||
$this->includeExtJS('admin/pmGmail');
|
||||
if (!empty ($_SESSION['__PMGMAIL_ERROR__'])) {
|
||||
$this->setJSVar('__PMGMAIL_ERROR__', $_SESSION['__PMGMAIL_ERROR__']);
|
||||
unset($_SESSION['__PMGMAIL_ERROR__']);
|
||||
}
|
||||
G::LoadClass( "pmGoogleApi" );
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
$accountEmail = $pmGoogle->getServiceAccountEmail();
|
||||
$fileP12 = $pmGoogle->getServiceAccountP12();
|
||||
$enablePMGmail = $pmGoogle->getStatusService();
|
||||
|
||||
$this->setJSVar('accountEmail', $accountEmail);
|
||||
$this->setJSVar('fileP12', $fileP12);
|
||||
$this->setJSVar('enablePMGmail', $enablePMGmail);
|
||||
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
} catch (Exception $error) {
|
||||
$_SESSION['__PMGMAIL_ERROR__'] = $error->getMessage();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public function testConfigPmGmail($httpData)
|
||||
{
|
||||
G::LoadClass( "pmGoogleApi" );
|
||||
$pmGoogle = new PMGoogleApi();
|
||||
|
||||
$emailServiceAccount = empty($httpData->email_service_account) ? $pmGoogle->getServiceAccountEmail() : $httpData->email_service_account;
|
||||
$pathServiceAccountP12 = empty($_FILES['file_p12']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getserviceAccountP12() : $_FILES['file_p12']['tmp_name'];
|
||||
|
||||
print(G::json_encode($pmGoogle->testService($emailServiceAccount, $pathServiceAccountP12)));
|
||||
}
|
||||
|
||||
public function testUserGmail()
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->clearSelectColumns();
|
||||
$criteria->addSelectColumn('COUNT(*) AS NUM_EMAIL');
|
||||
$criteria->addSelectColumn(UsersPeer::USR_UID);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
|
||||
$criteria->addGroupByColumn(UsersPeer::USR_EMAIL);
|
||||
|
||||
$rs = UsersPeer::doSelectRS($criteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$userRepeat = array();
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
if ($row['NUM_EMAIL'] > 1) {
|
||||
$userRepeat[] = array(
|
||||
'USR_UID' => $row['USR_UID'],
|
||||
'FULL_NAME' => $row['USR_FIRSTNAME'] . ' ' . $row['USR_LASTNAME'],
|
||||
'EMAIL' => $row['USR_EMAIL']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
print(G::json_encode($userRepeat));
|
||||
}
|
||||
}
|
||||
@@ -70,9 +70,12 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||
$G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings');
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
||||
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
||||
$G_TMP_MENU->AddIdRawOption('STRATEGIC_DASHBOARD', '../strategicDashboard/dashboardList', ucfirst(G::LoadTranslation('ID_STRATEGIC_DASHBOARD')), '', '', 'settings');
|
||||
}
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
$G_TMP_MENU->AddIdRawOption('PMGMAIL', '../pmGmail/formPMGmail', ucfirst(G::LoadTranslation('ID_PMGMAIL')), '', '', 'settings');
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
|
||||
315
workflow/engine/templates/admin/pmGmail.js
Normal file
315
workflow/engine/templates/admin/pmGmail.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user