本文整理汇总了PHP中Vtiger_Functions::getEntityModuleSQLColumnString方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::getEntityModuleSQLColumnString方法的具体用法?PHP Vtiger_Functions::getEntityModuleSQLColumnString怎么用?PHP Vtiger_Functions::getEntityModuleSQLColumnString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getEntityModuleSQLColumnString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntityField
/**
* this function returns the entity field name for a given module; for e.g. for Contacts module it return concat(lastname, ' ', firstname)
* @param string $module - the module name
* @return string $fieldsname - the entity field name for the module
*/
function getEntityField($module)
{
return Vtiger_Functions::getEntityModuleSQLColumnString($module);
}
示例2: getAllUsersOnRoles
/**
* Function to get the users based on Roles
* @param type $roles
* @return <array>
*/
public function getAllUsersOnRoles($roles)
{
$db = PearDatabase::getInstance();
$roleIds = array();
foreach ($roles as $key => $role) {
$roleIds[] = $role->getId();
}
if (empty($roleIds)) {
return array();
}
$sql = 'SELECT userid FROM vtiger_user2role WHERE roleid IN (' . generateQuestionMarks($roleIds) . ')';
$result = $db->pquery($sql, $roleIds);
$noOfUsers = $db->num_rows($result);
$userIds = array();
$subUsers = array();
if ($noOfUsers > 0) {
for ($i = 0; $i < $noOfUsers; ++$i) {
$userIds[] = $db->query_result($result, $i, 'userid');
}
$entityData = Vtiger_Functions::getEntityModuleSQLColumnString('Users');
$query = 'SELECT id, ' . $entityData['colums'] . ' FROM vtiger_users WHERE status = ? AND id IN (' . generateQuestionMarks($userIds) . ')';
$query .= ' order by last_name ASC, first_name ASC';
$result = $db->pquery($query, array('ACTIVE', $userIds));
while ($row = $db->fetch_array($result)) {
$colums = [];
foreach (explode(',', $entityData['fieldname']) as $fieldname) {
$colums[] = $row[$fieldname];
}
$subUsers[$row['id']] = implode(' ', $colums);
}
}
return $subUsers;
}
示例3: getUserName
public static function getUserName($id)
{
$adb = PearDatabase::getInstance();
if (!isset(self::$userIdNameCache[$id])) {
$userModuleInfo = Vtiger_Functions::getEntityModuleSQLColumnString('Users');
$result = $adb->query('SELECT id,' . $userModuleInfo['colums'] . ' FROM vtiger_users');
while ($row = $adb->getRow($result)) {
$userid = $row['id'];
unset($row['id']);
self::$userIdNameCache[$userid] = trim(implode(' ', $row));
}
}
return isset(self::$userIdNameCache[$id]) ? self::$userIdNameCache[$id] : false;
}