本文整理汇总了PHP中vtws_preserveGlobal函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_preserveGlobal函数的具体用法?PHP vtws_preserveGlobal怎么用?PHP vtws_preserveGlobal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_preserveGlobal函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vtws_query_related
function vtws_query_related($query, $id, $relatedLabel, $user, $filterClause = null)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
// Extract related module name from query.
$relatedType = null;
if (preg_match("/FROM\\s+([^\\s]+)/i", $query, $m)) {
$relatedType = trim($m[1]);
}
// Check for presence of expected relation.
$found = false;
$relatedTypes = vtws_relatedtypes($entityName, $user);
foreach ($relatedTypes['information'] as $label => $information) {
if ($label == $relatedLabel && $information['name'] == $relatedType) {
$found = true;
break;
}
}
if (!$found) {
throw new WebServiceException(WebServiceErrorCode::$UNKOWNENTITY, "Relation specified is incorrect");
}
vtws_preserveGlobal('currentModule', $entityName);
// Fetch related record IDs - so we can further retrieve complete information using vtws_query
$relatedWebserviceObject = VtigerWebserviceObject::fromName($adb, $relatedType);
$relatedHandlerPath = $relatedWebserviceObject->getHandlerPath();
$relatedHandlerClass = $relatedWebserviceObject->getHandlerClass();
require_once $relatedHandlerPath;
$relatedHandler = new $relatedHandlerClass($relatedWebserviceObject, $user, $adb, $log);
$relatedIds = $handler->relatedIds($id, $relatedType, $relatedLabel, $relatedHandler);
// Initialize return value
$relatedRecords = array();
// Rewrite query and extract related records if there at least one.
if (!empty($relatedIds)) {
$relatedIdClause = "id IN ('" . implode("','", $relatedIds) . "')";
if (stripos($query, 'WHERE') == false) {
$query .= " WHERE " . $relatedIdClause;
} else {
$queryParts = explode('WHERE', $query);
$query = $queryParts[0] . " WHERE " . $relatedIdClause;
$query .= " AND " . $queryParts[1];
}
if (!empty($filterClause)) {
$query .= " " . $filterClause;
}
$query .= ";";
$relatedRecords = vtws_query($query, $user);
}
VTWS_PreserveGlobal::flush();
return $relatedRecords;
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:56,代码来源:QueryRelated.php
示例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');
}
}
开发者ID:vinzdrance,项目名称:YetiForceCRM,代码行数:40,代码来源:ChangePassword.php
示例3: vtws_listtypes
function vtws_listtypes($user)
{
try {
global $adb, $log;
vtws_preserveGlobal('current_user', $user);
//get All the modules the current user is permitted to Access.
$allModuleNames = getPermittedModuleNames();
if (array_search('Calendar', $allModuleNames) !== false) {
array_push($allModuleNames, 'Events');
}
//get All the CRM entity names.
$webserviceEntities = vtws_getWebserviceEntities();
$accessibleModules = array_values(array_intersect($webserviceEntities['module'], $allModuleNames));
$entities = $webserviceEntities['entity'];
$accessibleEntities = array();
foreach ($entities as $entity) {
$webserviceObject = VtigerWebserviceObject::fromName($adb, $entity);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
if ($meta->hasAccess() === true) {
array_push($accessibleEntities, $entity);
}
}
} catch (WebServiceException $exception) {
throw $exception;
} catch (Exception $exception) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "An Database error occured while performing the operation");
}
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
$current_language = vtws_preserveGlobal('current_language', $default_language);
$appStrings = return_application_language($current_language);
$appListString = return_app_list_strings_language($current_language);
vtws_preserveGlobal('app_strings', $appStrings);
vtws_preserveGlobal('app_list_strings', $appListString);
$informationArray = array();
foreach ($accessibleModules as $module) {
$vtigerModule = $module == 'Events' ? 'Calendar' : $module;
$informationArray[$module] = array('isEntity' => true, 'label' => getTranslatedString($module, $vtigerModule), 'singular' => getTranslatedString('SINGLE_' . $module, $vtigerModule));
}
foreach ($accessibleEntities as $entity) {
$label = isset($appStrings[$entity]) ? $appStrings[$entity] : $entity;
$singular = isset($appStrings['SINGLE_' . $entity]) ? $appStrings['SINGLE_' . $entity] : $entity;
$informationArray[$entity] = array('isEntity' => false, 'label' => $label, 'singular' => $singular);
}
VTWS_PreserveGlobal::flush();
return array("types" => array_merge($accessibleModules, $accessibleEntities), 'information' => $informationArray);
}
开发者ID:hardikk,项目名称:HNH,代码行数:50,代码来源:ModuleTypes.php
示例4: describe
public function describe($elementType)
{
$app_strings = VTWS_PreserveGlobal::getGlobal('app_strings');
$current_user = vtws_preserveGlobal('current_user', $this->user);
$label = isset($app_strings[$elementType]) ? $app_strings[$elementType] : $elementType;
$createable = $this->meta->hasWriteAccess();
$updateable = $this->meta->hasWriteAccess();
$deleteable = $this->meta->hasDeleteAccess();
$retrieveable = $this->meta->hasReadAccess();
$fields = $this->getModuleFields();
return array("label" => $label, "name" => $elementType, "createable" => $createable, "updateable" => $updateable, "deleteable" => $deleteable, "retrieveable" => $retrieveable, "fields" => $fields, "idPrefix" => $this->meta->getEntityId(), 'isEntity' => $this->isEntity, 'labelFields' => $this->meta->getNameFields());
}
开发者ID:hardikk,项目名称:HNH,代码行数:12,代码来源:VtigerActorOperation.php
示例5: vtws_listtypes
function vtws_listtypes($fieldTypeList, $user)
{
// Bulk Save Mode: For re-using information
static $webserviceEntities = false;
// END
static $types = array();
if (!empty($fieldTypeList)) {
$fieldTypeList = array_map(strtolower, $fieldTypeList);
sort($fieldTypeList);
$fieldTypeString = implode(',', $fieldTypeList);
} else {
$fieldTypeString = 'all';
}
if (!empty($types[$user->id][$fieldTypeString])) {
return $types[$user->id][$fieldTypeString];
}
try {
global $log;
/**
* @var PearDatabase
*/
$db = PearDatabase::getInstance();
vtws_preserveGlobal('current_user', $user);
//get All the modules the current user is permitted to Access.
$allModuleNames = getPermittedModuleNames();
if (array_search('Calendar', $allModuleNames) !== false) {
array_push($allModuleNames, 'Events');
}
if (!empty($fieldTypeList)) {
$sql = "SELECT distinct(vtiger_field.tabid) as tabid FROM vtiger_field LEFT JOIN vtiger_ws_fieldtype ON " . "vtiger_field.uitype=vtiger_ws_fieldtype.uitype\n\t\t\t\t INNER JOIN vtiger_profile2field ON vtiger_field.fieldid = vtiger_profile2field.fieldid\n\t\t\t\t INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid = vtiger_field.fieldid\n\t\t\t\t INNER JOIN vtiger_role2profile ON vtiger_profile2field.profileid = vtiger_role2profile.profileid\n\t\t\t\t INNER JOIN vtiger_user2role ON vtiger_user2role.roleid = vtiger_role2profile.roleid\n\t\t\t\t where vtiger_profile2field.visible=0 and vtiger_def_org_field.visible = 0\n\t\t\t\t and vtiger_field.presence in (0,2)\n\t\t\t\t and vtiger_user2role.userid=? and fieldtype in (" . generateQuestionMarks($fieldTypeList) . ')';
$params = array();
$params[] = $user->id;
foreach ($fieldTypeList as $fieldType) {
$params[] = $fieldType;
}
$result = $db->pquery($sql, $params);
$it = new SqlResultIterator($db, $result);
$moduleList = array();
foreach ($it as $row) {
$moduleList[] = getTabModuleName($row->tabid);
}
$allModuleNames = array_intersect($moduleList, $allModuleNames);
$params = $fieldTypeList;
$sql = "select name from vtiger_ws_entity inner join vtiger_ws_entity_tables on " . "vtiger_ws_entity.id=vtiger_ws_entity_tables.webservice_entity_id inner join " . "vtiger_ws_entity_fieldtype on vtiger_ws_entity_fieldtype.table_name=" . "vtiger_ws_entity_tables.table_name where fieldtype=(" . generateQuestionMarks($fieldTypeList) . ')';
$result = $db->pquery($sql, $params);
$it = new SqlResultIterator($db, $result);
$entityList = array();
foreach ($it as $row) {
$entityList[] = $row->name;
}
}
//get All the CRM entity names.
if ($webserviceEntities === false || !CRMEntity::isBulkSaveMode()) {
// Bulk Save Mode: For re-using information
$webserviceEntities = vtws_getWebserviceEntities();
}
$accessibleModules = array_values(array_intersect($webserviceEntities['module'], $allModuleNames));
$entities = $webserviceEntities['entity'];
$accessibleEntities = array();
if (empty($fieldTypeList)) {
foreach ($entities as $entity) {
$webserviceObject = VtigerWebserviceObject::fromName($db, $entity);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $db, $log);
$meta = $handler->getMeta();
if ($meta->hasAccess() === true) {
array_push($accessibleEntities, $entity);
}
}
}
} catch (WebServiceException $exception) {
throw $exception;
} catch (Exception $exception) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "An Database error occured while performing the operation");
}
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
global $current_language;
if (empty($current_language)) {
$current_language = $default_language;
}
$current_language = vtws_preserveGlobal('current_language', $current_language);
$appStrings = return_application_language($current_language);
$appListString = return_app_list_strings_language($current_language);
vtws_preserveGlobal('app_strings', $appStrings);
vtws_preserveGlobal('app_list_strings', $appListString);
$informationArray = array();
foreach ($accessibleModules as $module) {
$vtigerModule = $module == 'Events' ? 'Calendar' : $module;
$informationArray[$module] = array('isEntity' => true, 'label' => getTranslatedString($module, $vtigerModule), 'singular' => getTranslatedString('SINGLE_' . $module, $vtigerModule));
}
foreach ($accessibleEntities as $entity) {
$label = isset($appStrings[$entity]) ? $appStrings[$entity] : $entity;
$singular = isset($appStrings['SINGLE_' . $entity]) ? $appStrings['SINGLE_' . $entity] : $entity;
$informationArray[$entity] = array('isEntity' => false, 'label' => $label, 'singular' => $singular);
}
VTWS_PreserveGlobal::flush();
$types[$user->id][$fieldTypeString] = array("types" => array_merge($accessibleModules, $accessibleEntities), 'information' => $informationArray);
return $types[$user->id][$fieldTypeString];
//.........这里部分代码省略.........
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:101,代码来源:ModuleTypes.php
示例6: retrieveMeta
function retrieveMeta()
{
require_once 'modules/CustomView/CustomView.php';
$current_user = vtws_preserveGlobal('current_user', $this->user);
$theme = vtws_preserveGlobal('theme', $this->user->theme);
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
$current_language = vtws_preserveGlobal('current_language', $default_language);
$this->computeAccess();
$cv = new CustomView();
$module_info = $cv->getCustomViewModuleInfo($this->getTabName());
$blockArray = array();
foreach ($cv->module_list[$this->getTabName()] as $label => $blockList) {
$blockArray = array_merge($blockArray, explode(',', $blockList));
}
$this->retrieveMetaForBlock($blockArray);
$this->meta = true;
VTWS_PreserveGlobal::flush();
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:18,代码来源:VtigerCRMObjectMeta.php
示例7: getMapMenuStructure
function getMapMenuStructure()
{
$default_language = 'it_it';
global $current_language, $adb;
$current_language = $default_language;
$current_language = vtws_preserveGlobal('current_language', $current_language);
$appStrings = return_application_language($current_language);
$appListString = return_app_list_strings_language($current_language);
vtws_preserveGlobal('app_strings', $appStrings);
vtws_preserveGlobal('app_list_strings', $appListString);
$map = htmlspecialchars_decode($this->column_fields['content']);
$x = new crXml();
$x->loadXML($map);
$rows = array();
$columns = array();
$name = '';
foreach ($x->map->menus[0] as $k0 => $v0) {
if ($k0 == 'profile') {
$profile = (string) $v0;
} else {
foreach ($v0 as $k1 => $v1) {
if ($k1 == 'label') {
$label = (string) $v1;
}
if ($k1 == 'name') {
$res_entity = $adb->pquery("Select isentitytype" . " from vtiger_tab" . " where name=?", array((string) $v1));
$isentitytype = $adb->query_result($res_entity, 0, 'isentitytype');
$columns[$label][] = array('item' => (string) $v1, 'label' => getTranslatedString((string) $v1, (string) $v1), 'entitytype' => $isentitytype);
}
}
}
}
$res = array('modules' => $columns, 'profile' => $profile);
return $res;
}
开发者ID:kduqi,项目名称:corebos,代码行数:35,代码来源:cbMap_processes.php
注:本文中的vtws_preserveGlobal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论