当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryGenerator::addCustomColumn方法代码示例

本文整理汇总了PHP中QueryGenerator::addCustomColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::addCustomColumn方法的具体用法?PHP QueryGenerator::addCustomColumn怎么用?PHP QueryGenerator::addCustomColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryGenerator的用法示例。


在下文中一共展示了QueryGenerator::addCustomColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUsersAndGroupForModuleList

 public function getUsersAndGroupForModuleList($module, $view)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     $userEntityInfo = Vtiger_Functions::getEntityModuleInfo('Users');
     $table = $userEntityInfo['tablename'];
     $columnsName = explode(',', $userEntityInfo['fieldname']);
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->initForCustomViewById($view);
     $queryGenerator->setFields(['assigned_user_id']);
     $queryGenerator->addCustomColumn('vtiger_groups.groupname');
     foreach ($columnsName as &$column) {
         $queryGenerator->addCustomColumn($table . '.' . $column);
     }
     $listQuery = $queryGenerator->getQuery('SELECT DISTINCT');
     $listQuery .= ' ORDER BY last_name ASC, first_name ASC';
     $result = $db->query($listQuery);
     $users = $group = [];
     while ($row = $db->fetch_array($result)) {
         if (isset($row['groupname'])) {
             $group[$row['smownerid']] = $row['groupname'];
         } else {
             $name = '';
             foreach ($columnsName as &$column) {
                 $name .= $row[$column] . ' ';
             }
             $users[$row['smownerid']] = trim($name);
         }
     }
     return ['users' => $users, 'group' => $group];
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:31,代码来源:Record.php

示例2: getUsersAndGroupForModuleList

 public function getUsersAndGroupForModuleList($module, $view)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $queryGenerator->initForCustomViewById($view);
     $queryGenerator->setFields(['assigned_user_id']);
     $queryGenerator->addCustomColumn('vtiger_users.first_name');
     $queryGenerator->addCustomColumn('vtiger_users.last_name');
     $queryGenerator->addCustomColumn('vtiger_groups.groupname');
     $listQuery = $queryGenerator->getQuery('SELECT DISTINCT');
     $result = $db->query($listQuery);
     $users = $group = [];
     while ($row = $db->fetch_array($result)) {
         if (isset($row['groupname'])) {
             $group[$row['smownerid']] = $row['groupname'];
         } else {
             $users[$row['smownerid']] = $row['last_name'] . ' ' . $row['first_name'];
         }
     }
     return ['users' => $users, 'group' => $group];
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:22,代码来源:Record.php

示例3: getSearchViewList

 public function getSearchViewList($module, $view)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     $queryGenerator = new QueryGenerator($module, $currentUser);
     $meta = $queryGenerator->getMeta($module);
     $baseTable = $meta->getEntityBaseTable();
     $tableIndexList = $meta->getEntityTableIndexList();
     $baseTableIndex = $tableIndexList[$baseTable];
     $queryGenerator->initForCustomViewById($view);
     $queryGenerator->setFields([]);
     $queryGenerator->addCustomColumn('userid');
     $queryGenerator->addCustomFrom(['joinType' => 'INNER', 'relatedTable' => 'u_yf_crmentity_showners', 'relatedIndex' => 'crmid', 'baseTable' => $baseTable, 'baseIndex' => $baseTableIndex]);
     $listQuery = $queryGenerator->getQuery('SELECT DISTINCT');
     $result = $db->query($listQuery);
     $users = $group = [];
     while ($id = $db->getSingleValue($result)) {
         $name = self::getUserName($id);
         if ($name !== false) {
             $users[$id] = $name;
             continue;
         }
         $name = self::getGroupName($id);
         if ($name !== false) {
             $group[$id] = $name;
             continue;
         }
     }
     asort($users);
     asort($group);
     return ['users' => $users, 'group' => $group];
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:32,代码来源:SharedOwner.php


注:本文中的QueryGenerator::addCustomColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。