本文整理汇总了PHP中vtws_describe函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_describe函数的具体用法?PHP vtws_describe怎么用?PHP vtws_describe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_describe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRetrieve
protected function processRetrieve(Mobile_API_Request $request)
{
$recordid = $request->get('record');
// Create a template record for use
if ($this->isTemplateRecordRequest($request)) {
$current_user = $this->getActiveUser();
$module = $this->detectModuleName($recordid);
$describeInfo = vtws_describe($module, $current_user);
Mobile_WS_Utils::fixDescribeFieldInfo($module, $describeInfo);
$this->cacheDescribeInfo($describeInfo);
$templateRecord = array();
foreach ($describeInfo['fields'] as $describeField) {
$templateFieldValue = '';
if (isset($describeField['type']) && isset($describeField['type']['defaultValue'])) {
$templateFieldValue = $describeField['type']['defaultValue'];
} else {
if (isset($describeField['default'])) {
$templateFieldValue = $describeField['default'];
}
}
$templateRecord[$describeField['name']] = $templateFieldValue;
}
if (isset($templateRecord['assigned_user_id'])) {
$templateRecord['assigned_user_id'] = sprintf("%sx%s", Mobile_WS_Utils::getEntityModuleWSId('Users'), $current_user->id);
}
// Reset the record id
$templateRecord['id'] = $recordid;
return $templateRecord;
}
// Or else delgate the action to parent
return parent::processRetrieve($request);
}
示例2: getModuleDescribe
static function getModuleDescribe($module)
{
if (!isset(self::$moduleDescribeCache[$module])) {
global $adb, $log, $current_user;
self::$moduleDescribeCache[$module] = vtws_describe($module, $current_user);
}
return self::$moduleDescribeCache[$module];
}
示例3: process
function process(Mobile_API_Request $request)
{
$current_user = $this->getActiveUser();
$module = $request->get('module');
$describeInfo = vtws_describe($module, $current_user);
Mobile_WS_Utils::fixDescribeFieldInfo($module, $describeInfo);
$response = new Mobile_API_Response();
$response->setResult(array('describe' => $describeInfo));
return $response;
}
示例4: getFieldInfo
function getFieldInfo($module, $fieldname)
{
global $current_user;
$describe = vtws_describe($module, $current_user);
foreach ($describe['fields'] as $index => $fieldInfo) {
if ($fieldInfo['name'] == $fieldname) {
return $fieldInfo;
}
}
return false;
}
示例5: processQueryResultRecord
function processQueryResultRecord($record, $user)
{
parent::processQueryResultRecord($record, $user);
if ($this->cachedDescribeInfo() === false) {
$describeInfo = vtws_describe($this->queryModule, $user);
$this->cacheDescribeInfo($describeInfo);
}
$transformedRecord = $this->transformRecordWithGrouping($record, $this->queryModule);
// Update entity fieldnames
$transformedRecord['labelFields'] = $this->cachedEntityFieldnames($this->queryModule);
return $transformedRecord;
}
示例6: transformToBlocks
protected function transformToBlocks($module)
{
$current_user = $this->getActiveUser();
$moduleFieldGroups = Mobile_WS_Utils::gatherModuleFieldGroupInfo($module);
$describeInfo = vtws_describe($module, $current_user);
Mobile_WS_Utils::fixDescribeFieldInfo($module, $describeInfo, $current_user);
$modifiedResult = array();
$blocks = array();
$labelFields = false;
foreach ($moduleFieldGroups as $blocklabel => $fieldgroups) {
$fields = array();
foreach ($fieldgroups as $fieldname => $fieldinfo) {
$field['name'] = $fieldname;
$field['value'] = '';
$field['label'] = $fieldinfo['label'];
$field['uitype'] = $fieldinfo['uitype'];
$field['typeofdata'] = $fieldinfo['typeofdata'];
foreach ($describeInfo['fields'] as $describeField) {
if ($describeField['name'] == $fieldname) {
$field['type'] = '';
if (isset($describeField['type']) && $describeField['type'] != '') {
$picklistValues = $describeField['type']['picklistValues'];
$field['type']['value'] = array('value' => $picklistValues, 'name' => $fieldname);
}
}
}
if ($field['uitype'] == '51' || $field['uitype'] == '59' || $field['uitype'] == '10') {
$field['relatedmodule'] = Mobile_WS_Utils::getEntityName($field['name'], $module);
}
$fields[] = $field;
}
$blocks[] = array('label' => $blocklabel, 'fields' => $fields);
}
$sections = array();
$moduleFieldGroupKeys = array_keys($moduleFieldGroups);
foreach ($moduleFieldGroupKeys as $blocklabel) {
// eliminate empty blocks
if (isset($groups[$blocklabel]) && !empty($groups[$blocklabel])) {
$sections[] = array('label' => $blocklabel, 'count' => count($groups[$blocklabel]));
}
}
$modifiedResult = array('blocks' => $blocks, 'id' => $resultRecord['id']);
if ($labelFields) {
$modifiedResult['labelFields'] = $labelFields;
}
return $modifiedResult;
}
示例7: prepareWhereClause
function prepareWhereClause($fieldnames = false)
{
$whereClause = '';
$searchString = $this->criterias['search'];
$fieldnames = isset($this->criterias['fieldnames']) ? $this->criterias['fieldnames'] : false;
include_once 'include/Webservices/DescribeObject.php';
$describeInfo = vtws_describe($this->moduleName, $this->getUser());
$fieldinfos = array();
if ($fieldnames === false) {
foreach ($describeInfo['fields'] as $fieldinfo) {
$fieldmodel = new Mobile_UI_FieldModel();
$fieldmodel->initData($fieldinfo);
if (!$fieldmodel->isReferenceType()) {
$fieldinfos[$fieldinfo['name']] = $fieldmodel;
}
}
} else {
foreach ($describeInfo['fields'] as $fieldinfo) {
if (in_array($fieldinfo['name'], $fieldnames)) {
$fieldmodel = new Mobile_UI_FieldModel();
$fieldmodel->initData($fieldinfo);
if (!$fieldmodel->isReferenceType()) {
$fieldinfos[$fieldinfo['name']] = $fieldmodel;
}
}
}
}
if (isset($fieldinfos['id'])) {
unset($fieldinfos['id']);
}
if (!empty($fieldinfos)) {
$fieldinfos['_'] = '';
// Hack to build the where clause at once
$whereClause = sprintf("WHERE %s", implode(" LIKE '%{$searchString}%' OR ", array_keys($fieldinfos)));
$whereClause = rtrim($whereClause, 'OR _');
}
return $whereClause;
}
示例8: getModuleDescribe
static function getModuleDescribe($module)
{
if (!isset(self::$moduleDescribeCache[$module])) {
$adb = PearDatabase::getInstance();
$current_user = vglobal('current_user');
$log = vglobal('log');
self::$moduleDescribeCache[$module] = vtws_describe($module, $current_user);
}
return self::$moduleDescribeCache[$module];
}
示例9: process
function process(Mobile_API_Request $request)
{
$current_user = $this->getActiveUser();
$current_user_wsid = sprintf("%sx%s", Mobile_WS_Utils::getEntityModuleWSId("Users"), $current_user->id);
$module = $request->get('module');
$lastSyncTime = $request->get('syncToken', 0);
$currentPage = intval($request->get('page', 0));
$isPrivateMode = $this->isModePrivate($request);
$FETCH_LIMIT = Mobile::config('API_RECORD_FETCH_LIMIT');
$startLimit = $currentPage * $FETCH_LIMIT;
// Keep track of sync-token for futher reference
$maxSyncTime = $lastSyncTime;
$describeInfo = vtws_describe($module, $current_user);
$this->cacheDescribeInfo($describeInfo);
$hasAssignedToField = false;
foreach ($describeInfo['fields'] as $fieldinfo) {
if ($fieldinfo['name'] == 'assigned_user_id') {
$hasAssignedToField = true;
break;
}
}
/////////////////////////////
// MODIFIED RECORDS TRACKING
/////////////////////////////
if (empty($lastSyncTime)) {
// No previous state information available? Lookup records recently modified
if ($hasAssignedToField && $isPrivateMode) {
$queryActive = sprintf("SELECT * FROM %s WHERE assigned_user_id = '%s' ORDER BY modifiedtime DESC", $module, $current_user_wsid);
} else {
$queryActive = sprintf("SELECT * FROM %s ORDER BY modifiedtime DESC", $module);
}
} else {
// Attempt to lookup records from previous state
if ($hasAssignedToField && $isPrivateMode) {
$queryActive = sprintf("SELECT * FROM %s WHERE assigned_user_id = '%s' AND modifiedtime > '%s'", $module, $current_user_wsid, date("Y-m-d H:i:s", $lastSyncTime));
} else {
$queryActive = sprintf("SELECT * FROM %s WHERE modifiedtime > '%s'", $module, date("Y-m-d H:i:s", $lastSyncTime));
}
}
// Try to fetch record with paging (one extra record fetch is attempted to determine presence of next page)
$activeQuery = sprintf("%s LIMIT %u,%u;", $queryActive, $startLimit, $FETCH_LIMIT + 1);
$activeResult = vtws_query($activeQuery, $current_user);
// Determine paging
$hasNextPage = count($activeResult) > $FETCH_LIMIT;
// Special case handling merge Events records
if ($module == 'Calendar') {
$activeResult2 = vtws_query(str_replace('Calendar', 'Events', $activeQuery), $current_user);
if (!empty($activeResult2)) {
$activeResult = array_merge($activeResult, $activeResult2);
if (!$hasNextPage) {
// If there was not Calendar next-page of records - check with Events
$hasNextPage = count($activeResult) > $FETCH_LIMIT;
}
}
// Indicator that we fetched both Calendar+Events
$FETCH_LIMIT *= 2;
}
$nextPage = 0;
if ($hasNextPage) {
array_pop($activeResult);
// Avoid sending next page record now
$nextPage = $currentPage + 1;
}
// Resolved record details
$resolvedModifiedRecords = array();
$resolvedDeletedRecords = array();
if (!empty($activeResult)) {
foreach ($activeResult as $recordValues) {
$this->resolveRecordValues($recordValues, $current_user);
$transformedRecord = $this->transformRecordWithGrouping($recordValues, $module);
// Update entity fieldnames
$transformedRecord['labelFields'] = $this->cachedEntityFieldnames($module);
$resolvedModifiedRecords[] = $transformedRecord;
$modifiedTimeInSeconds = strtotime($recordValues['modifiedtime']);
if ($maxSyncTime < $modifiedTimeInSeconds) {
$maxSyncTime = $modifiedTimeInSeconds;
}
}
}
////////////////////////////
// DELETED RECORDS TRACKING
////////////////////////////
// Only when there is previous state information and is first page
if (!empty($lastSyncTime) && $currentPage === 0) {
$adb = PearDatabase::getInstance();
$queryDeletedParameters = array($module, date('Y-m-d H:i:s', $lastSyncTime));
$andsmowneridequal = "";
if ($hasAssignedToField) {
if ($isPrivateMode) {
$queryDeletedParameters[] = $current_user->id;
$andsmowneridequal = " AND vtiger_crmentity.smownerid=?";
} else {
$andsmowneridequal = Mobile_WS_Utils::querySecurityFromSuffix($module, $current_user);
}
}
// Since Calendar and Events are merged
if ($module == 'Calendar') {
$queryDeleted = $adb->pquery("SELECT activityid as crmid, activitytype as setype FROM vtiger_activity\n\t\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_activity.activityid=vtiger_crmentity.crmid\n\t\t\t\t\tAND vtiger_crmentity.deleted=1 AND vtiger_crmentity.setype=? AND vtiger_crmentity.modifiedtime > ?\n\t\t\t\t\tLEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\t\tLEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid WHERE 1=1\t{$andsmowneridequal} ", $queryDeletedParameters);
} else {
if ($module == 'Leads') {
//.........这里部分代码省略.........
示例10: vtws_getConvertLeadFieldInfo
function vtws_getConvertLeadFieldInfo($module, $fieldname)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$describe = vtws_describe($module, vglobal('current_user'));
foreach ($describe['fields'] as $index => $fieldInfo) {
if ($fieldInfo['name'] == $fieldname) {
return $fieldInfo;
}
}
return false;
}
示例11: ws_describe
public function ws_describe($module)
{
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if (!isset($this->wsDescribeCache[$module])) {
$this->wsDescribeCache[$module] = vtws_describe($module, $currentUserModel);
}
return $this->wsDescribeCache[$module];
}
示例12: getSelectClauseFields
function getSelectClauseFields($module, $moduleMeta, $user)
{
$moduleFieldNames = $moduleMeta->getModuleFields();
$inventoryModules = getInventoryModules();
if (in_array($module, $inventoryModules)) {
$fields = vtws_describe('LineItem', $user);
foreach ($fields['fields'] as $field) {
unset($moduleFieldNames[$field['name']]);
}
foreach ($moduleFieldNames as $field => $fieldObj) {
if (substr($field, 0, 5) == 'shtax') {
unset($moduleFieldNames[$field]);
}
}
}
return array_keys($moduleFieldNames);
}
示例13: describe
public function describe($module)
{
return vtws_describe($module, $this->restUser);
}
示例14: describeModule
public static function describeModule($moduleName, $loadReferences = false, $nameFormat = "###")
{
global $current_user;
${${"GLOBALS"}["uhkocv"]} = array("assigned_user_id" => "smownerid");
${"GLOBALS"}["hkmwbevsdqg"] = "return";
${${"GLOBALS"}["lqknchhdhei"]} = array();
$qtbkdju = "return";
$jtxnyueqcz = "return";
$siqaaqkg = "user";
$zgsppbmobo = "a";
$zxkoteptgi = "moduleName";
require_once "include/Webservices/DescribeObject.php";
$ggfktqje = "return";
${"GLOBALS"}["hetdnksroqie"] = "availUser";
$vlxutd = "refFields";
${$vlxutd} = array();
${$ggfktqje} = array();
${"GLOBALS"}["xldevyyog"] = "sql";
${${"GLOBALS"}["jhobljegj"]} = vtws_describe(${$zxkoteptgi}, ${${"GLOBALS"}["cveuguwbj"]});
${${"GLOBALS"}["rfzzycoqwhw"]}["crmid"] = array("name" => "crmid", "label" => "ID", "mandatory" => false, "type" => array("name" => "string"), "editable" => false);
${"GLOBALS"}["uxurbdlld"] = "a";
$pdiyggeicd = "group";
$dafpvby = "sql";
foreach (${${"GLOBALS"}["jhobljegj"]}["fields"] as ${${"GLOBALS"}["iswxctbj"]}) {
${"GLOBALS"}["ioqymje"] = "columnsRewrites";
${"GLOBALS"}["cyinkwahefe"] = "return";
${"GLOBALS"}["xsptvgg"] = "field";
$hmmnqqbaqa = "field";
$ouvgdvatp = "field";
$ilapibb = "loadReferences";
if (!empty(${${"GLOBALS"}["ioqymje"]}[${$ouvgdvatp}["name"]])) {
${"GLOBALS"}["cwpknl"] = "field";
${"GLOBALS"}["iogfgqnp"] = "columnsRewrites";
${${"GLOBALS"}["cwpknl"]}["name"] = ${${"GLOBALS"}["iogfgqnp"]}[${${"GLOBALS"}["iswxctbj"]}["name"]];
}
${"GLOBALS"}["bvfqijt"] = "fieldName";
if (${${"GLOBALS"}["xsptvgg"]}["name"] == "smownerid") {
${${"GLOBALS"}["iswxctbj"]}["type"]["name"] = "reference";
${${"GLOBALS"}["iswxctbj"]}["type"]["refersTo"] = array("Users");
}
if (${$hmmnqqbaqa}["type"]["name"] == "reference" && ${$ilapibb} == true) {
foreach (${${"GLOBALS"}["iswxctbj"]}["type"]["refersTo"] as ${${"GLOBALS"}["qkbrwmmwlmib"]}) {
$bfzesvvbgw = "refFields";
${"GLOBALS"}["nhprxyye"] = "refModule";
$tcivtpb = "field";
$objevhwcxbw = "loadedRefModules";
${$bfzesvvbgw} = array_merge(${${"GLOBALS"}["novyhahuz"]}, self::describeModule(${${"GLOBALS"}["qkbrwmmwlmib"]}, false, "(" . ${$tcivtpb}["name"] . ": (" . ${${"GLOBALS"}["nhprxyye"]} . ") ###)"));
${$objevhwcxbw}[${${"GLOBALS"}["qkbrwmmwlmib"]}] = "1";
}
}
${"GLOBALS"}["smqweohswsw"] = "fieldName";
${${"GLOBALS"}["bvfqijt"]} = str_replace("###", ${${"GLOBALS"}["iswxctbj"]}["name"], ${${"GLOBALS"}["natytqu"]});
${${"GLOBALS"}["cyinkwahefe"]}[${${"GLOBALS"}["smqweohswsw"]}] = ${${"GLOBALS"}["iswxctbj"]};
}
global $adb;
${${"GLOBALS"}["fbcyfklnb"]} = "SELECT id,user_name,first_name,last_name FROM vtiger_users WHERE status = 'Active'";
${${"GLOBALS"}["rnuyovw"]} = $adb->pquery(${${"GLOBALS"}["fbcyfklnb"]});
while (${$siqaaqkg} = $adb->fetchByAssoc(${${"GLOBALS"}["rnuyovw"]})) {
$drhvgcgnt = "user";
${"GLOBALS"}["btzurxqljzd"] = "availUser";
${$drhvgcgnt}["id"] = "" . ${${"GLOBALS"}["dnqjgtwktyg"]}["id"];
${"GLOBALS"}["qvdrvuncpd"] = "user";
${${"GLOBALS"}["btzurxqljzd"]}["user"][] = ${${"GLOBALS"}["qvdrvuncpd"]};
}
${${"GLOBALS"}["xldevyyog"]} = "SELECT * FROM vtiger_groups ORDER BY groupname";
${${"GLOBALS"}["rnuyovw"]} = $adb->pquery(${$dafpvby});
while (${$pdiyggeicd} = $adb->fetchByAssoc(${${"GLOBALS"}["rnuyovw"]})) {
${"GLOBALS"}["vvsqrvmpde"] = "availUser";
$xeviiqflv = "group";
$qthgnnjov = "group";
${$qthgnnjov}["groupid"] = "" . ${${"GLOBALS"}["xlifgy"]}["groupid"];
${${"GLOBALS"}["vvsqrvmpde"]}["group"][] = ${$xeviiqflv};
}
$tnrbgrlswql = "return";
${"GLOBALS"}["wkdeuhq"] = "return";
${$qtbkdju}["assigned_user_id"]["type"]["name"] = "picklist";
${${"GLOBALS"}["rfzzycoqwhw"]}["assigned_user_id"]["type"]["picklistValues"] = array();
$kqtwigb = "availUser";
${"GLOBALS"}["mmbwcnsztet"] = "return";
${${"GLOBALS"}["hkmwbevsdqg"]}["assigned_user_id"]["type"]["picklistValues"][] = array("label" => "\$currentUser", "value" => "\$current_user_id");
${"GLOBALS"}["rqlhtitowxmp"] = "a";
for (${${"GLOBALS"}["hysqswqyxng"]} = 0; ${$zgsppbmobo} < count(${${"GLOBALS"}["hetdnksroqie"]}["user"]); ${${"GLOBALS"}["uxurbdlld"]}++) {
$veomxqkg = "availUser";
${"GLOBALS"}["byiotxbgnmr"] = "a";
$qcresygwc = "a";
${"GLOBALS"}["ewwopkji"] = "return";
${${"GLOBALS"}["ewwopkji"]}["assigned_user_id"]["type"]["picklistValues"][] = array("label" => ${${"GLOBALS"}["qzzrbpnvz"]}["user"][${${"GLOBALS"}["byiotxbgnmr"]}]["user_name"], "value" => ${$veomxqkg}["user"][${$qcresygwc}]["id"]);
}
for (${${"GLOBALS"}["hysqswqyxng"]} = 0; ${${"GLOBALS"}["rqlhtitowxmp"]} < count(${$kqtwigb}["group"]); ${${"GLOBALS"}["hysqswqyxng"]}++) {
${"GLOBALS"}["ybunnuhkaq"] = "availUser";
${"GLOBALS"}["pjifasvnkay"] = "a";
$dukyodmows = "return";
${$dukyodmows}["assigned_user_id"]["type"]["picklistValues"][] = array("label" => "Group: " . ${${"GLOBALS"}["qzzrbpnvz"]}["group"][${${"GLOBALS"}["pjifasvnkay"]}]["groupname"], "value" => ${${"GLOBALS"}["ybunnuhkaq"]}["group"][${${"GLOBALS"}["hysqswqyxng"]}]["groupid"]);
}
${${"GLOBALS"}["mmbwcnsztet"]}["smownerid"] = ${$tnrbgrlswql}["assigned_user_id"];
${${"GLOBALS"}["rfzzycoqwhw"]} = array_merge(${${"GLOBALS"}["wkdeuhq"]}, ${${"GLOBALS"}["novyhahuz"]});
return ${$jtxnyueqcz};
}
示例15: describeModule
public static function describeModule($moduleName, $loadReferences = false, $nameFormat = "###")
{
global $current_user;
$columnsRewrites = array("assigned_user_id" => "smownerid");
$loadedRefModules = array();
require_once "include/Webservices/DescribeObject.php";
$refFields = array();
$return = array();
$describe = vtws_describe($moduleName, $current_user);
$return["crmid"] = array("name" => "crmid", "label" => "ID", "mandatory" => false, "type" => array("name" => "string"), "editable" => false);
/** Current User mit aufnehmen! */
$describe["fields"][] = array('name' => 'current_user', 'label' => 'current user ', 'mandatory' => false, 'type' => array('name' => 'reference', 'refersTo' => array(0 => 'Users')));
foreach ($describe["fields"] as $field) {
if (!empty($columnsRewrites[$field["name"]])) {
$field["name"] = $columnsRewrites[$field["name"]];
}
if ($field["name"] == "smownerid") {
$field["type"]["name"] = "reference";
$field["type"]["refersTo"] = array("Users");
}
if ($field["type"]["name"] == "reference" && $loadReferences == true) {
foreach ($field["type"]["refersTo"] as $refModule) {
#if(!empty($loadedRefModules[$refModule])) continue;
$refFields = array_merge($refFields, self::describeModule($refModule, false, "(" . $field["name"] . ": (" . $refModule . ") ###)"));
#var_dump($refFields);
$loadedRefModules[$refModule] = "1";
}
}
$fieldName = str_replace("###", $field["name"], $nameFormat);
$return[$fieldName] = $field;
}
/** Assigned Users */
global $adb;
$sql = "SELECT id,user_name,first_name,last_name FROM vtiger_users WHERE status = 'Active'";
$result = $adb->query($sql);
while ($user = $adb->fetchByAssoc($result)) {
$user["id"] = "19x" . $user["id"];
$availUser["user"][] = $user;
}
$sql = "SELECT * FROM vtiger_groups ORDER BY groupname";
$result = $adb->query($sql);
while ($group = $adb->fetchByAssoc($result)) {
$group["groupid"] = "20x" . $group["groupid"];
$availUser["group"][] = $group;
}
/** Assigned Users End */
$return["assigned_user_id"]["type"]["name"] = "picklist";
$return["assigned_user_id"]["type"]["picklistValues"] = array();
$return["assigned_user_id"]["type"]["picklistValues"][] = array("label" => '$currentUser', "value" => '$current_user_id');
for ($a = 0; $a < count($availUser["user"]); $a++) {
$return["assigned_user_id"]["type"]["picklistValues"][] = array("label" => $availUser["user"][$a]["user_name"], "value" => $availUser["user"][$a]["id"]);
}
for ($a = 0; $a < count($availUser["group"]); $a++) {
$return["assigned_user_id"]["type"]["picklistValues"][] = array("label" => "Group: " . $availUser["group"][$a]["groupname"], "value" => $availUser["group"][$a]["groupid"]);
}
$return["smownerid"] = $return["assigned_user_id"];
$return = array_merge($return, $refFields);
return $return;
}