本文整理汇总了PHP中Users::retrieve_entity_info方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::retrieve_entity_info方法的具体用法?PHP Users::retrieve_entity_info怎么用?PHP Users::retrieve_entity_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Users
的用法示例。
在下文中一共展示了Users::retrieve_entity_info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public static function render($userInputObject, $user)
{
global $list_max_entries_per_page;
$adb = PearDatabase::getInstance();
$viewer = new Import_UI_Viewer();
$ownerId = $userInputObject->get('foruser');
$owner = new Users();
$owner->id = $ownerId;
$owner->retrieve_entity_info($ownerId, 'Users');
if (!is_admin($user) && $user->id != $owner->id) {
$viewer->display('OperationNotPermitted.tpl', 'Vtiger');
exit;
}
$userDBTableName = Import_Utils::getDbTableName($owner);
$moduleName = $userInputObject->get('module');
$moduleMeta = self::getModuleMeta($moduleName, $user);
$result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
$noOfRecords = $adb->num_rows($result);
$importedRecordIds = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
}
if (count($importedRecordIds) == 0) {
$importedRecordIds[] = 0;
}
$focus = CRMEntity::getInstance($moduleName);
$queryGenerator = new QueryGenerator($moduleName, $user);
$customView = new CustomView($moduleName);
$viewId = $customView->getViewIdByName('All', $moduleName);
$queryGenerator->initForCustomViewById($viewId);
$list_query = $queryGenerator->getQuery();
// Fetch only last imported records
$list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
$count_result = $adb->query(mkCountQuery($list_query));
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$noofrows = null;
}
$start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
$navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
$limit_start_rec = ($start - 1) * $list_max_entries_per_page;
$list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
$viewer->assign('recordListRange', $recordListRangeMsg);
$controller = new ListViewController($adb, $user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
$listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
$viewer->assign('CURRENT_PAGE', $start);
$viewer->assign('LISTHEADER', $listview_header);
$viewer->assign('LISTENTITY', $listview_entries);
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('FOR_USER', $ownerId);
$isAjax = $userInputObject->get('ajax');
if (!empty($isAjax)) {
echo $viewer->fetch('ListViewEntries.tpl');
} else {
$viewer->display('ImportListView.tpl');
}
}
示例2: vtws_changePassword
/**
*
* @param WebserviceId $id
* @param String $oldPassword
* @param String $newPassword
* @param String $confirmPassword
* @param Users $user
*
*/
function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword, $user)
{
vtws_preserveGlobal('current_user', $user);
$idComponents = vtws_getIdComponents($id);
if ($idComponents[1] == $user->id || is_admin($user)) {
$newUser = new Users();
$newUser->retrieve_entity_info($idComponents[1], 'Users');
if (!is_admin($user)) {
if (empty($oldPassword)) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
}
if (!$user->verifyPassword($oldPassword)) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
}
}
if (strcmp($newPassword, $confirmPassword) === 0) {
$success = $newUser->change_password($oldPassword, $newPassword);
$error = $newUser->db->hasFailedTransaction();
if ($error) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
}
if (!$success) {
throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
}
} else {
throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
}
VTWS_PreserveGlobal::flush();
return array('message' => 'Changed password successfully');
}
}
示例3: setDefaultUsersAccess
/**
* Function creates default user's Role, Profiles
*/
public function setDefaultUsersAccess()
{
$adminPassword = $_SESSION['installation_info']['admin_password'];
$this->db->pquery('update vtiger_users set email1=? where id=1', array($_SESSION['installation_info']['admin_email']));
$newUser = new Users();
$newUser->retrieve_entity_info(1, 'Users');
$newUser->change_password('admin', $adminPassword, false);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile(1);
}
示例4: createUserSharingPrivilegesfile
/** Creates a file with all the organization default sharing permissions and custom sharing permissins specific for the specified user. In this file the information of the other users whose data is shared with the specified user is stored.
* @param $userid -- user id:: Type integer
* @returns sharing_privileges_userid file under the user_privileges directory
*/
function createUserSharingPrivilegesfile($userid)
{
global $adb, $root_directory;
checkFileAccessForInclusion('user_privileges/user_privileges_' . $userid . '.php');
require 'user_privileges/user_privileges_' . $userid . '.php';
$handle = @fopen($root_directory . 'user_privileges/sharing_privileges_' . $userid . '.php', "w+");
if ($handle) {
$newbuf = '';
$newbuf .= "<?php\n\n";
$newbuf .= "\n";
$newbuf .= "//This is the sharing access privilege file\n";
$user_focus = new Users();
$user_focus->retrieve_entity_info($userid, "Users");
if ($user_focus->is_admin == 'on') {
$newbuf .= "\n";
$newbuf .= "?>";
fputs($handle, $newbuf);
fclose($handle);
return;
} else {
//Constructig the Default Org Share Array
$def_org_share = getAllDefaultSharingAction();
$newbuf .= "\$defaultOrgSharingPermission=" . constructArray($def_org_share) . ";\n";
$newbuf .= "\n";
//Constructing the Related Module Sharing Array
$relModSharArr = array();
$query = "select * from vtiger_datashare_relatedmodules";
$result = $adb->pquery($query, array());
$num_rows = $adb->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$parTabId = $adb->query_result($result, $i, 'tabid');
$relTabId = $adb->query_result($result, $i, 'relatedto_tabid');
if (is_array($relModSharArr[$relTabId])) {
$temArr = $relModSharArr[$relTabId];
$temArr[] = $parTabId;
} else {
$temArr = array();
$temArr[] = $parTabId;
}
$relModSharArr[$relTabId] = $temArr;
}
$newbuf .= "\$related_module_share=" . constructTwoDimensionalValueArray($relModSharArr) . ";\n\n";
//Constructing Lead Sharing Rules
$lead_share_per_array = getUserModuleSharingObjects("Leads", $userid, $def_org_share, $current_user_roles, $parent_roles, $current_user_groups);
$lead_share_read_per = $lead_share_per_array['read'];
$lead_share_write_per = $lead_share_per_array['write'];
$lead_sharingrule_members = $lead_share_per_array['sharingrules'];
$newbuf .= "\$Leads_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Leads_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_share_write_per['GROUP']) . ");\n\n";
//Constructing the Lead Email Related Module Sharing Array
$lead_related_email = getRelatedModuleSharingArray("Leads", "Emails", $lead_sharingrule_members, $lead_share_read_per, $lead_share_write_per, $def_org_share);
$lead_email_share_read_per = $lead_related_email['read'];
$lead_email_share_write_per = $lead_related_email['write'];
$newbuf .= "\$Leads_Emails_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_email_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_email_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Leads_Emails_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($lead_email_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($lead_email_share_write_per['GROUP']) . ");\n\n";
//Constructing Account Sharing Rules
$account_share_per_array = getUserModuleSharingObjects("Accounts", $userid, $def_org_share, $current_user_roles, $parent_roles, $current_user_groups);
$account_share_read_per = $account_share_per_array['read'];
$account_share_write_per = $account_share_per_array['write'];
$account_sharingrule_members = $account_share_per_array['sharingrules'];
/*echo '<pre>';
print_r($account_share_read_per['GROUP']);
echo '</pre>';*/
$newbuf .= "\$Accounts_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Accounts_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_write_per['GROUP']) . ");\n\n";
//Constructing Contact Sharing Rules
$newbuf .= "\$Contacts_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Contacts_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($account_share_write_per['GROUP']) . ");\n\n";
//Constructing the Account Potential Related Module Sharing Array
$acct_related_pot = getRelatedModuleSharingArray("Accounts", "Potentials", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
$acc_pot_share_read_per = $acct_related_pot['read'];
$acc_pot_share_write_per = $acct_related_pot['write'];
$newbuf .= "\$Accounts_Potentials_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_pot_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Accounts_Potentials_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_pot_share_write_per['GROUP']) . ");\n\n";
//Constructing the Account Ticket Related Module Sharing Array
$acct_related_tkt = getRelatedModuleSharingArray("Accounts", "HelpDesk", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
$acc_tkt_share_read_per = $acct_related_tkt['read'];
$acc_tkt_share_write_per = $acct_related_tkt['write'];
$newbuf .= "\$Accounts_HelpDesk_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_tkt_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Accounts_HelpDesk_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_tkt_share_write_per['GROUP']) . ");\n\n";
//Constructing the Account Email Related Module Sharing Array
$acct_related_email = getRelatedModuleSharingArray("Accounts", "Emails", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
$acc_email_share_read_per = $acct_related_email['read'];
$acc_email_share_write_per = $acct_related_email['write'];
$newbuf .= "\$Accounts_Emails_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_email_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_email_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Accounts_Emails_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_email_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_email_share_write_per['GROUP']) . ");\n\n";
//Constructing the Account Quote Related Module Sharing Array
$acct_related_qt = getRelatedModuleSharingArray("Accounts", "Quotes", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
$acc_qt_share_read_per = $acct_related_qt['read'];
$acc_qt_share_write_per = $acct_related_qt['write'];
$newbuf .= "\$Accounts_Quotes_share_read_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_read_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_qt_share_read_per['GROUP']) . ");\n\n";
$newbuf .= "\$Accounts_Quotes_share_write_permission=array('ROLE'=>" . constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_write_per['ROLE']) . ",'GROUP'=>" . constructTwoDimensionalValueArray($acc_qt_share_write_per['GROUP']) . ");\n\n";
//Constructing the Account SalesOrder Related Module Sharing Array
$acct_related_so = getRelatedModuleSharingArray("Accounts", "SalesOrder", $account_sharingrule_members, $account_share_read_per, $account_share_write_per, $def_org_share);
$acc_so_share_read_per = $acct_related_so['read'];
$acc_so_share_write_per = $acct_related_so['write'];
//.........这里部分代码省略.........
示例5: elseif
}
}
if (isset($_POST['record']) && !is_admin($current_user) && $_POST['record'] != $current_user->id) {
echo "Unauthorized access to user administration.";
} elseif (!isset($_POST['record']) && !is_admin($current_user)) {
echo "Unauthorized access to user administration.";
}
$focus = new Users();
if (isset($_REQUEST["record"]) && $_REQUEST["record"] != '') {
$focus->mode = 'edit';
$focus->id = $_REQUEST["record"];
} else {
$focus->mode = '';
}
if ($_REQUEST['changepassword'] == 'true') {
$focus->retrieve_entity_info($_REQUEST['record'], 'Users');
$focus->id = $_REQUEST['record'];
if (isset($_POST['new_password'])) {
$new_pass = $_POST['new_password'];
$new_passwd = $_POST['new_password'];
$new_pass = md5($new_pass);
$old_pass = $_POST['old_password'];
$uname = $_POST['user_name'];
if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {
header("Location: index.php?action=Error&module=Users&error_string=" . urlencode($focus->error_string));
exit;
}
}
}
//save user Image
if (!$_REQUEST['changepassword'] == 'true') {
示例6: getScheduledImport
public static function getScheduledImport()
{
$scheduledImports = array();
$importQueue = Import_Queue_Controller::getAll(Import_Queue_Controller::$IMPORT_STATUS_SCHEDULED);
foreach ($importQueue as $importId => $importInfo) {
$userId = $importInfo['user_id'];
$user = new Users();
$user->id = $userId;
$user->retrieve_entity_info($userId, 'Users');
$scheduledImports[$importId] = new Import_Data_Controller($importInfo, $user);
}
return $scheduledImports;
}
示例7: undoLastImport
function undoLastImport($obj, $user)
{
$adb = PearDatabase::getInstance();
$moduleName = $obj->get('module');
$ownerId = $obj->get('foruser');
$owner = new Users();
$owner->id = $ownerId;
$owner->retrieve_entity_info($ownerId, 'Users');
$dbTableName = Import_Utils_Helper::getDbTableName($owner);
if (!is_admin($user) && $user->id != $owner->id) {
$viewer = new Vtiger_Viewer();
$viewer->view('OperationNotPermitted.tpl', 'Vtiger');
exit;
}
$result = $adb->query("SELECT recordid FROM {$dbTableName} WHERE temp_status = " . Import_Data_Controller::$IMPORT_RECORD_CREATED . " AND recordid IS NOT NULL;");
$noOfRecords = $adb->num_rows($result);
$noOfRecordsDeleted = 0;
for ($i = 0; $i < $noOfRecords; ++$i) {
$recordId = $adb->query_result($result, $i, 'recordid');
if (isRecordExists($recordId) && isPermitted($moduleName, 'Delete', $recordId) == 'yes') {
$focus = CRMEntity::getInstance($moduleName);
$focus->id = $recordId;
$focus->trash($moduleName, $recordId);
$noOfRecordsDeleted++;
}
}
$viewer = new Vtiger_Viewer();
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('TOTAL_RECORDS', $noOfRecords);
$viewer->assign('DELETED_RECORDS_COUNT', $noOfRecordsDeleted);
$viewer->view('ImportUndoResult.tpl');
}
示例8: unlink
}
$_SESSION['vtiger_authenticated_user_theme'] = $authenticated_user_theme;
$_SESSION['authenticated_user_language'] = $authenticated_user_language;
$log->debug("authenticated_user_theme is {$authenticated_user_theme}");
$log->debug("authenticated_user_language is {$authenticated_user_language}");
$log->debug("authenticated_user_id is " . $focus->id);
$log->debug("app_unique_key is {$application_unique_key}");
// Clear all uploaded import files for this user if it exists
global $import_dir;
$tmp_file_name = $import_dir . "IMPORT_" . $focus->id;
if (file_exists($tmp_file_name)) {
unlink($tmp_file_name);
}
$userSetupStatus = Users_CRMSetup::getUserSetupStatus($focus->id);
if ($userSetupStatus) {
$user = $focus->retrieve_entity_info($focus->id, 'Users');
$isFirstUser = Users_CRMSetup::isFirstUser($user);
if ($isFirstUser) {
header('Location: index.php?module=Users&action=SystemSetup');
} else {
$arr = $_SESSION['lastpage'];
if (isset($_SESSION['lastpage'])) {
header("Location: {$successURL}" . $arr);
} else {
header("Location: {$successURL}");
}
}
} else {
$arr = $_SESSION['lastpage'];
if (isset($_SESSION['lastpage'])) {
header("Location: {$successURL}" . $arr);
示例9: process
public static function process($requestObject, $user) {
$moduleName = $requestObject->get('module');
$mode = $requestObject->get('mode');
if($mode == 'undo_import') {
Import_Index_Controller::undoLastImport($requestObject, $user);
exit;
} elseif($mode == 'listview') {
Import_ListView_Controller::render($requestObject, $user);
exit;
} elseif($mode == 'delete_map') {
Import_Index_Controller::deleteMap($requestObject, $user);
exit;
} elseif($mode == 'clear_corrupted_data') {
Import_Utils::clearUserImportInfo($user);
} elseif($mode == 'cancel_import') {
$importId = $requestObject->get('import_id');
$importInfo = Import_Queue_Controller::getImportInfoById($importId);
if($importInfo != null) {
if($importInfo['user_id'] == $user->id || is_admin($user)) {
$importuser = new Users();
$importuser->id = $importInfo['user_id'];
$importuser->retrieve_entity_info($importInfo['user_id'], 'Users');
$importDataController = new Import_Data_Controller($importInfo, $importuser);
$importStatusCount = $importDataController->getImportStatusCount();
$importDataController->finishImport();
Import_Controller::showResult($importInfo, $importStatusCount);
}
exit;
}
}
// Check if import on the module is locked
$lockInfo = Import_Lock_Controller::isLockedForModule($moduleName);
if($lockInfo != null) {
$lockedBy = $lockInfo['userid'];
if($user->id != $lockedBy && !is_admin($user)) {
Import_Utils::showImportLockedError($lockInfo);
exit;
} else {
if($mode == 'continue_import' && $user->id == $lockedBy) {
$importController = new Import_Controller($requestObject, $user);
$importController->triggerImport(true);
} else {
$importInfo = Import_Queue_Controller::getImportInfoById($lockInfo['importid']);
$lockOwner = $user;
if($user->id != $lockedBy) {
$lockOwner = new Users();
$lockOwner->id = $lockInfo['userid'];
$lockOwner->retrieve_entity_info( $lockInfo['userid'], 'Users');
}
Import_Controller::showImportStatus($importInfo, $lockOwner);
}
exit;
}
}
if(Import_Utils::isUserImportBlocked($user)) {
$importInfo = Import_Queue_Controller::getUserCurrentImportInfo($user);
if($importInfo != null) {
Import_Controller::showImportStatus($importInfo, $user);
exit;
} else {
Import_Utils::showImportTableBlockedError($moduleName, $user);
exit;
}
}
Import_Utils::clearUserImportInfo($user);
if($mode == 'upload_and_parse') {
if(Import_Index_Controller::validateFileUpload($requestObject)) {
Import_Index_Controller::loadAdvancedSettings($requestObject, $user);
exit;
}
} elseif($mode == 'import') {
Import_Controller::import($requestObject, $user);
exit;
}
Import_Index_Controller::loadBasicSettings($requestObject, $user);
}
示例10: setDefaultUsersAccess
/**
* Function creates default user's Role, Profiles
*/
public function setDefaultUsersAccess()
{
$adminPassword = $_SESSION['config_file_info']['password'];
$userDateFormat = $_SESSION['config_file_info']['dateformat'];
$userTimeZone = $_SESSION['config_file_info']['timezone'];
$userFirstName = $_SESSION['config_file_info']['firstname'];
$userLastName = $_SESSION['config_file_info']['lastname'];
$adminEmail = $_SESSION['config_file_info']['admin_email'];
$adb = PearDatabase::getInstance();
$adb->pquery("UPDATE vtiger_users SET date_format = ?, time_zone = ?, first_name = ?, last_name = ?, email1 = ?, accesskey = ?, language = ?", array($userDateFormat, $userTimeZone, $userFirstName, $userLastName, $adminEmail, vtws_generateRandomAccessKey(16), $_SESSION['default_language']));
$newUser = new Users();
$newUser->retrieve_entity_info(1, 'Users');
$newUser->change_password('admin', $adminPassword, false);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile(1);
}
示例11: buildDocumentModel
function buildDocumentModel()
{
global $adb;
$model = new Vtiger_PDF_Model();
if (isset($this->focus->column_fields["spcompany"]) && $this->focus->column_fields["spcompany"] != '') {
$selfcompany = html_entity_decode($this->focus->column_fields["spcompany"], ENT_QUOTES, 'UTF-8');
} else {
$selfcompany = "Default";
}
// Company information
$result = $adb->pquery("SELECT * FROM vtiger_organizationdetails WHERE company=?", array($selfcompany));
$num_rows = $adb->num_rows($result);
if ($num_rows) {
$resultrow = $adb->fetch_array($result);
$model->set('orgAddress', $adb->query_result($result, 0, "address"));
$model->set('orgCity', $adb->query_result($result, 0, "city"));
$model->set('orgState', $adb->query_result($result, 0, "state"));
$model->set('orgCountry', $adb->query_result($result, 0, "country"));
$model->set('orgCode', $adb->query_result($result, 0, "code"));
$model->set('orgBillingAddress', implode(', ', array($adb->query_result($result, 0, "code"), $adb->query_result($result, 0, "city"), $adb->query_result($result, 0, "address"))));
$model->set('orgPhone', $adb->query_result($result, 0, "phone"));
$model->set('orgFax', $adb->query_result($result, 0, "fax"));
$model->set('orgWebsite', $adb->query_result($result, 0, "website"));
$model->set('orgInn', $adb->query_result($result, 0, "inn"));
$model->set('orgKpp', $adb->query_result($result, 0, "kpp"));
$model->set('orgBankAccount', $adb->query_result($result, 0, "bankaccount"));
$model->set('orgBankName', $adb->query_result($result, 0, 'bankname'));
$model->set('orgBankId', $adb->query_result($result, 0, 'bankid'));
$model->set('orgCorrAccount', $adb->query_result($result, 0, 'corraccount'));
$model->set('orgOKPO', $adb->query_result($result, 0, "okpo"));
if ($adb->query_result($result, 0, 'director')) {
$model->set('orgDirector', $adb->query_result($result, 0, 'director'));
} else {
$model->set('orgDirector', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'bookkeeper')) {
$model->set('orgBookkeeper', $adb->query_result($result, 0, 'bookkeeper'));
} else {
$model->set('orgBookkeeper', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'entrepreneur')) {
$model->set('orgEntrepreneur', $adb->query_result($result, 0, 'entrepreneur'));
} else {
$model->set('orgEntrepreneur', str_repeat('_', 15));
}
if ($adb->query_result($result, 0, 'entrepreneurreg')) {
$model->set('orgEntrepreneurreg', $adb->query_result($result, 0, 'entrepreneurreg'));
} else {
$model->set('orgEntrepreneurreg', str_repeat('_', 50));
}
$model->set('orgLogo', '<img src="test/logo/' . $resultrow['logoname'] . '" />');
$model->set('orgLogoPath', 'test/logo/' . $resultrow['logoname']);
$model->set('orgName', decode_html($resultrow['organizationname']));
}
$model->set('billingAddress', $this->buildHeaderBillingAddress());
$model->set('shippingAddress', $this->buildHeaderShippingAddress());
// Add owner info into model
if (isset($this->focus->column_fields['record_id']) && $this->focus->column_fields['record_id'] != '') {
$ownerArr = getRecordOwnerId($this->focus->column_fields['record_id']);
if (isset($ownerArr['Users'])) {
$userEntity = new Users();
$userEntity->retrieve_entity_info($ownerArr['Users'], 'Users');
$this->generateEntityModel($userEntity, 'Users', 'owner_', $model);
}
if (isset($ownerArr['Groups'])) {
$groupInstance = Settings_Groups_Record_Model::getInstance($ownerArr['Groups']);
$model->set('owner_groupid', $groupInstance->getId());
$model->set('owner_groupname', $groupInstance->getName());
$model->set('owner_description', $groupInstance->getDescription());
}
}
return $model;
}
示例12: pullEvents
protected function pullEvents($start, $end, &$result, $userid = false, $color = null, $textColor = 'white')
{
$dbStartDateOject = DateTimeField::convertToDBTimeZone($start);
$dbStartDateTime = $dbStartDateOject->format('Y-m-d H:i:s');
$dbStartDateTimeComponents = explode(' ', $dbStartDateTime);
$dbStartDate = $dbStartDateTimeComponents[0];
$dbEndDateObject = DateTimeField::convertToDBTimeZone($end);
$dbEndDateTime = $dbEndDateObject->format('Y-m-d H:i:s');
$currentUser = Users_Record_Model::getCurrentUserModel();
$db = PearDatabase::getInstance();
$moduleModel = Vtiger_Module_Model::getInstance('Events');
if ($userid) {
$focus = new Users();
$focus->id = $userid;
$focus->retrieve_entity_info($userid, 'Users');
$user = Users_Record_Model::getInstanceFromUserObject($focus);
$userName = $user->getName();
$queryGenerator = new QueryGenerator($moduleModel->get('name'), $user);
} else {
$queryGenerator = new QueryGenerator($moduleModel->get('name'), $currentUser);
}
$queryGenerator->setFields(array('subject', 'eventstatus', 'visibility', 'date_start', 'time_start', 'due_date', 'time_end', 'assigned_user_id', 'id', 'activitytype'));
$query = $queryGenerator->getQuery();
$query .= " AND vtiger_activity.activitytype NOT IN ('Emails','Task') AND ";
$hideCompleted = $currentUser->get('hidecompletedevents');
if ($hideCompleted) {
$query .= "vtiger_activity.eventstatus != 'HELD' AND ";
}
$query .= " ((concat(date_start, '', time_start) >= '{$dbStartDateTime}' AND concat(due_date, '', time_end) < '{$dbEndDateTime}') OR ( due_date >= '{$dbStartDate}'))";
$params = array();
if (empty($userid)) {
$eventUserId = $currentUser->getId();
} else {
$eventUserId = $userid;
}
$params = array_merge(array($eventUserId), $this->getGroupsIdsForUsers($eventUserId));
$query .= " AND vtiger_crmentity.smownerid IN (" . generateQuestionMarks($params) . ")";
$queryResult = $db->pquery($query, $params);
while ($record = $db->fetchByAssoc($queryResult)) {
$item = array();
$crmid = $record['activityid'];
$visibility = $record['visibility'];
$activitytype = $record['activitytype'];
$status = $record['eventstatus'];
$item['id'] = $crmid;
$item['visibility'] = $visibility;
$item['activitytype'] = $activitytype;
$item['status'] = $status;
if (!$currentUser->isAdminUser() && $visibility == 'Private' && $userid && $userid != $currentUser->getId()) {
$item['title'] = decode_html($userName) . ' - ' . decode_html(vtranslate('Busy', 'Events')) . '*';
$item['url'] = '';
} else {
$item['title'] = decode_html($record['subject']) . ' - (' . decode_html(vtranslate($record['eventstatus'], 'Calendar')) . ')';
$item['url'] = sprintf('index.php?module=Calendar&view=Detail&record=%s', $crmid);
}
$dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['start'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
$userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
$dateTimeComponents = explode(' ', $userDateTimeString);
$dateComponent = $dateTimeComponents[0];
//Conveting the date format in to Y-m-d . since full calendar expects in the same format
$dataBaseDateFormatedString = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
$item['end'] = $dataBaseDateFormatedString . ' ' . $dateTimeComponents[1];
$item['className'] = $cssClass;
$item['allDay'] = false;
$item['color'] = $color;
$item['textColor'] = $textColor;
$item['module'] = $moduleModel->getName();
$result[] = $item;
}
}
示例13: array
$contact_ids = array();
$product_ids = array();
$pricebook_ids = array();
$quote_ids = array();
$salesorder_ids = array();
$purchaseorder_ids = array();
$invoice_ids = array();
$email_ids = array();
// Assigned user for all demo data.
$assigned_user_name = "admin";
// Look up the user id for the assigned user
$seed_user = new Users();
$assigned_user_id = $seed_user->retrieve_user_id($assigned_user_name);
global $current_user;
$current_user = new Users();
$result = $current_user->retrieve_entity_info($assigned_user_id, 'Users');
$tagkey = 1;
// Get _dom arrays
$comboFieldNames = array('leadsource' => 'leadsource_dom', 'leadstatus' => 'lead_status_dom', 'industry' => 'industry_dom', 'rating' => 'rating_dom', 'opportunity_type' => 'opportunity_type_dom', 'sales_stage' => 'sales_stage_dom');
$comboFieldArray = getComboArray($comboFieldNames);
$adb->println("company_name_array");
$adb->println($company_name_array);
$cloudtag = array('SO_vendtl', 'X-CEED', 'X-CEED', 'vtiger_50usr');
for ($i = 0; $i < $company_name_count; $i++) {
$account_name = $company_name_array[$i];
// Create new accounts.
$account = new Accounts();
$account->column_fields["accountname"] = $account_name;
$account->column_fields["phone"] = create_phone_number();
$account->column_fields["assigned_user_id"] = $assigned_user_id;
$whitespace = array(" ", ".", "&", "\\/");
示例14: Users
require_once 'include/database/PearDatabase.php';
global $adb, $mod_strings;
$local_log =& LoggerManager::getLogger('UsersAjax');
$ajaxaction = $_REQUEST["ajxaction"];
if ($ajaxaction == "DETAILVIEW") {
if (empty($_SESSION['Users_FORM_TOKEN']) || $_SESSION['Users_FORM_TOKEN'] !== (int) $_REQUEST['form_token']) {
echo ":#:ERR" . $app_strings['LBL_PERMISSION'];
die;
}
$userid = $_REQUEST["recordid"];
$tablename = $_REQUEST["tableName"];
$fieldname = $_REQUEST["fldName"];
$fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]);
if ($userid != "") {
$userObj = new Users();
$userObj->retrieve_entity_info($userid, "Users");
$userObj->column_fields[$fieldname] = $fieldvalue;
if ($fieldname == 'asterisk_extension') {
$query = "select 1 from vtiger_asteriskextensions\n inner join vtiger_users on vtiger_users.id=vtiger_asteriskextensions.userid\n where status='Active' and asterisk_extension =?";
$params = array($fieldvalue);
$result = $adb->pquery($query, $params);
if ($adb->num_rows($result) > 0) {
echo ":#:ERR" . $mod_strings['LBL_ASTERISKEXTENSIONS_EXIST'];
return false;
}
}
if ($fieldname == 'internal_mailer') {
if (isset($_SESSION['internal_mailer']) && $_SESSION['internal_mailer'] != $userObj->column_fields['internal_mailer']) {
$_SESSION['internal_mailer'] = $userObj->column_fields['internal_mailer'];
}
}
示例15: foreach
foreach ($user_focus->column_fields as $key => $value) {
$upperKey = "USER_" . strtoupper($key);
${$upperKey} = $value;
}
$USER_MOBILE = $user_focus->column_fields["phone_mobile"];
$USER_NAME = $user_focus->column_fields["last_name"];
$USER_EMAIL = $user_focus->column_fields["email1"];
} else {
$USER_NAME = "";
$USER_EMAIL = "";
$USER_MOBILE = "";
}
$smcreatorid = $focus->column_fields['smcreatorid'];
if (!empty($smcreatorid)) {
$user_focus = new Users();
$user_focus->retrieve_entity_info($smcreatorid, "Users");
foreach ($user_focus->column_fields as $key => $value) {
$upperKey = "CREATOR_" . strtoupper($key);
${$upperKey} = $value;
}
$CREATOR_MOBILE = $user_focus->column_fields["phone_mobile"];
$CREATOR_NAME = $user_focus->column_fields["last_name"];
$CREATOR_EMAIL = $user_focus->column_fields["email1"];
} else {
$CREATOR_NAME = "";
$CREATOR_EMAIL = "";
$CREATOR_OBILE = "";
}
$focus->id = $focus->column_fields["record_id"];
if (isset($module_enable_product) && $module_enable_product) {
$associated_products = getAssociatedProducts_NoPrice("Memdays", $focus);