本文整理汇总了PHP中VTWS_PreserveGlobal::getGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP VTWS_PreserveGlobal::getGlobal方法的具体用法?PHP VTWS_PreserveGlobal::getGlobal怎么用?PHP VTWS_PreserveGlobal::getGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTWS_PreserveGlobal
的用法示例。
在下文中一共展示了VTWS_PreserveGlobal::getGlobal方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: getPickListOptions
function getPickListOptions($fieldName)
{
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = html_entity_decode($picklistValue, ENT_QUOTES, $default_charset);
$elem["label"] = getTranslatedString($picklistValue, $this->getMeta()->getTabName());
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$details = getPickListValues($fieldName, $this->user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = html_entity_decode($details[$i], ENT_QUOTES, $default_charset);
$elem["label"] = getTranslatedString($picklistValue, $this->getMeta()->getTabName());
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
return $options;
}
示例3: getDescribeFieldArray
function getDescribeFieldArray($webserviceField)
{
$app_strings = VTWS_PreserveGlobal::getGlobal('app_strings');
$fieldLabel = $webserviceField->getFieldLabelKey();
if (isset($app_strings[$fieldLabel])) {
$fieldLabel = $app_strings[$fieldLabel];
}
if (strcasecmp($webserviceField->getFieldName(), $this->meta->getObectIndexColumn()) === 0) {
return $this->getIdField($fieldLabel);
}
$typeDetails = $this->getFieldTypeDetails($webserviceField);
//set type name, in the type details array.
$typeDetails['name'] = $webserviceField->getFieldDataType();
$editable = $this->isEditable($webserviceField);
$describeArray = array('name' => $webserviceField->getFieldName(), 'label' => $fieldLabel, 'mandatory' => $webserviceField->isMandatory(), 'type' => $typeDetails, 'nullable' => $webserviceField->isNullable(), "editable" => $editable);
if ($webserviceField->hasDefault()) {
$describeArray['default'] = $webserviceField->getDefault();
}
return $describeArray;
}
示例4: getPickListOptions
function getPickListOptions()
{
global $app_strings, $mod_strings, $log, $current_language;
static $purified_plcache = array();
$fieldName = $this->getFieldName();
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$temp_mod_strings = $moduleName != '' ? return_module_language($current_language, $moduleName) : $mod_strings;
if (array_key_exists($moduleName . $fieldName, $purified_plcache)) {
return $purified_plcache[$moduleName . $fieldName];
}
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = decode_html($picklistValue);
$trans_str = $temp_mod_strings[$picklistValue] != '' ? $temp_mod_strings[$picklistValue] : ($app_strings[$picklistValue] != '' ? $app_strings[$picklistValue] : $picklistValue);
while ($trans_str != preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str)) {
$trans_str = preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str);
}
$elem["label"] = $trans_str;
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$user = VTWS_PreserveGlobal::getGlobal('current_user');
$details = getPickListValues($fieldName, $user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = decode_html($details[$i]);
$trans_str = $temp_mod_strings[$picklistValue] != '' ? $temp_mod_strings[$picklistValue] : ($app_strings[$picklistValue] != '' ? $app_strings[$picklistValue] : $picklistValue);
while ($trans_str != preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str)) {
$trans_str = preg_replace('/(.*) {.+}(.*)/', '$1$2', $trans_str);
}
$elem["label"] = $trans_str;
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
$purified_plcache[$moduleName . $fieldName] = $options;
return $options;
}
示例5: getDescribeFieldArray
function getDescribeFieldArray($webserviceField)
{
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
$fieldLabel = getTranslatedString($webserviceField->getFieldLabelKey(), $this->meta->getTabName());
$typeDetails = array();
if (!is_array($this->partialDescribeFields)) {
$typeDetails = $this->getFieldTypeDetails($webserviceField);
} else {
if (in_array($webserviceField->getFieldName(), $this->partialDescribeFields)) {
$typeDetails = $this->getFieldTypeDetails($webserviceField);
}
}
//set type name, in the type details array.
$typeDetails['name'] = $webserviceField->getFieldDataType();
$editable = $this->isEditable($webserviceField);
$describeArray = array('name' => $webserviceField->getFieldName(), 'label' => $fieldLabel, 'mandatory' => $webserviceField->isMandatory(), 'type' => $typeDetails, 'nullable' => $webserviceField->isNullable(), "editable" => $editable);
if ($webserviceField->hasDefault()) {
$describeArray['default'] = $webserviceField->getDefault();
}
return $describeArray;
}
示例6: getPickListOptions
function getPickListOptions()
{
$fieldName = $this->getFieldName();
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$options = array();
$sql = "select * from vtiger_picklist where name=?";
$result = $this->pearDB->pquery($sql, array($fieldName));
$numRows = $this->pearDB->num_rows($result);
if ($numRows == 0) {
$sql = "select * from vtiger_{$fieldName}";
$result = $this->pearDB->pquery($sql, array());
$numRows = $this->pearDB->num_rows($result);
for ($i = 0; $i < $numRows; ++$i) {
$elem = array();
$picklistValue = $this->pearDB->query_result($result, $i, $fieldName);
$picklistValue = decode_html($picklistValue);
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$elem["label"] = getTranslatedString($picklistValue, $moduleName);
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
} else {
$user = VTWS_PreserveGlobal::getGlobal('current_user');
$details = getPickListValues($fieldName, $user->roleid);
for ($i = 0; $i < sizeof($details); ++$i) {
$elem = array();
$picklistValue = decode_html($details[$i]);
$moduleName = getTabModuleName($this->getTabId());
if ($moduleName == 'Events') {
$moduleName = 'Calendar';
}
$elem["label"] = getTranslatedString($picklistValue, $moduleName);
$elem["value"] = $picklistValue;
array_push($options, $elem);
}
}
return $options;
}
示例7: 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];
//.........这里部分代码省略.........
示例8: sanitizeFields
function sanitizeFields($row, $meta)
{
$default_charset = VTWS_PreserveGlobal::getGlobal('default_charset');
$recordString = DataTransform::$recordString;
$recordModuleString = DataTransform::$recordModuleString;
if (isset($row[$recordModuleString])) {
unset($row[$recordModuleString]);
}
if (isset($row['id'])) {
if (strpos($row['id'], 'x') === false) {
$row['id'] = vtws_getId($meta->getEntityId(), $row['id']);
}
}
if (isset($row[$recordString])) {
$row['id'] = vtws_getId($meta->getEntityId(), $row[$recordString]);
unset($row[$recordString]);
}
if (!isset($row['id'])) {
if ($row[$meta->getObectIndexColumn()]) {
$row['id'] = vtws_getId($meta->getEntityId(), $row[$meta->getObectIndexColumn()]);
} else {
//TODO Handle this.
//echo 'error id noy set' ;
}
} else {
if (isset($row[$meta->getObectIndexColumn()]) && strcmp($meta->getObectIndexColumn(), "id") !== 0) {
unset($row[$meta->getObectIndexColumn()]);
}
}
foreach ($row as $field => $value) {
$row[$field] = html_entity_decode($value, ENT_QUOTES, $default_charset);
}
return $row;
}
示例9: getDescribeFieldArray
function getDescribeFieldArray($webserviceField)
{
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
require 'modules/' . $this->meta->getTabName() . "/language/{$default_language}.lang.php";
$fieldLabel = $webserviceField->getFieldLabelKey();
if (isset($mod_strings[$fieldLabel])) {
$fieldLabel = $mod_strings[$fieldLabel];
}
$typeDetails = $this->getFieldTypeDetails($webserviceField);
//set type name, in the type details array.
$typeDetails['name'] = $webserviceField->getFieldDataType();
$editable = $this->isEditable($webserviceField);
$describeArray = array('name' => $webserviceField->getFieldName(), 'label' => $fieldLabel, 'mandatory' => $webserviceField->isMandatory(), 'type' => $typeDetails, 'nullable' => $webserviceField->isNullable(), "editable" => $editable);
if ($webserviceField->hasDefault()) {
$describeArray['default'] = $webserviceField->getDefault();
}
return $describeArray;
}
示例10: 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();
}
示例11: getDescribeFieldArray
function getDescribeFieldArray($webserviceField)
{
static $purified_dfcache = array();
$dfkey = $webserviceField->getFieldName() . $webserviceField->getTabId();
if (array_key_exists($dfkey, $purified_dfcache)) {
return $purified_dfcache[$dfkey];
}
$default_language = VTWS_PreserveGlobal::getGlobal('default_language');
require 'modules/' . $this->meta->getTabName() . "/language/{$default_language}.lang.php";
$fieldLabel = $webserviceField->getFieldLabelKey();
if (isset($mod_strings[$fieldLabel])) {
$fieldLabel = $mod_strings[$fieldLabel];
}
$typeDetails = $this->getFieldTypeDetails($webserviceField);
//set type name, in the type details array.
$typeDetails['name'] = $webserviceField->getFieldDataType();
$editable = $this->isEditable($webserviceField);
$blkname = $webserviceField->getBlockName();
$describeArray = array('name' => $webserviceField->getFieldName(), 'label' => $fieldLabel, 'mandatory' => $webserviceField->isMandatory(), 'type' => $typeDetails, 'nullable' => $webserviceField->isNullable(), "editable" => $editable, 'uitype' => $webserviceField->getUIType(), 'typeofdata' => $webserviceField->getTypeOfData(), 'sequence' => $webserviceField->getFieldSequence(), 'block' => array('blockid' => $webserviceField->getBlockId(), 'blocksequence' => $webserviceField->getBlockSequence(), 'blocklabel' => $blkname, 'blockname' => getTranslatedString($blkname, $this->meta->getTabName())));
if ($webserviceField->hasDefault()) {
$describeArray['default'] = $webserviceField->getDefault();
}
$purified_dfcache[$dfkey] = $describeArray;
return $describeArray;
}