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


PHP QueryGenerator::setCustomColumn方法代码示例

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


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

示例1: 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->setCustomColumn('userid');
     $queryGenerator->setCustomFrom(['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:nikdejan,项目名称:YetiForceCRM,代码行数:32,代码来源:SharedOwner.php

示例2: getRelationQuery

 /**
  * Function to get relation query for particular module with function name
  * @param <record> $recordId
  * @param <String> $functionName
  * @param Vtiger_Module_Model $relatedModule
  * @return <String>
  */
 public function getRelationQuery($recordId, $functionName, $relatedModule, $relationModel = false)
 {
     $relatedModuleName = $relatedModule->getName();
     $focus = CRMEntity::getInstance($this->getName());
     $focus->id = $recordId;
     switch ($functionName) {
         case 'get_many_to_many':
             $query = $this->getRelationQueryM2M($recordId, $relatedModule, $relationModel);
             break;
         case 'get_activities':
             $query = $this->getRelationQueryForActivities($recordId, $relatedModule, $relationModel);
             break;
         default:
             $result = $focus->{$functionName}($recordId, $this->getId(), $relatedModule->getId());
             $query = $result['query'] . ' ' . $this->getSpecificRelationQuery($relatedModuleName);
             break;
     }
     //modify query if any module has summary fields, those fields we are displayed in related list of that module
     $relatedListFields = [];
     if ($relationModel) {
         $relatedListFields = $relationModel->getRelationFields(true, true);
     }
     if (count($relatedListFields) == 0) {
         $relatedListFields = $relatedModule->getConfigureRelatedListFields();
         if ($relatedModuleName == 'Documents') {
             $relatedListFields['filelocationtype'] = 'filelocationtype';
             $relatedListFields['filestatus'] = 'filestatus';
         }
     }
     if (count($relatedListFields) > 0) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($relatedModuleName, $currentUser);
         $queryGenerator->setFields($relatedListFields);
         if ($relationModel->showCreatorDetail()) {
             $queryGenerator->setCustomColumn('rel_created_user');
             $queryGenerator->setCustomColumn('rel_created_time');
         }
         if ($relationModel->showComment()) {
             $queryGenerator->setCustomColumn('rel_comment');
         }
         $selectColumnSql = $queryGenerator->getSelectClauseColumnSQL();
         $query = str_replace('FROM', 'from', $query);
         $newQuery = explode('from', $query);
         $selectColumnSql = 'SELECT DISTINCT vtiger_crmentity.crmid,' . $selectColumnSql;
         $query = $selectColumnSql . ' FROM ' . $newQuery[1];
     }
     $instance = CRMEntity::getInstance($relatedModuleName);
     $securityParameter = $instance->getUserAccessConditionsQuerySR($relatedModuleName, false, $recordId);
     if ($securityParameter != '') {
         $query .= $securityParameter;
     }
     return $query;
 }
开发者ID:HoererUndFlamme,项目名称:YetiForceCRM,代码行数:60,代码来源:Module.php

示例3: 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->setCustomColumn('vtiger_groups.groupname');
     foreach ($columnsName as &$column) {
         $queryGenerator->setCustomColumn($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:nikdejan,项目名称:YetiForceCRM,代码行数:31,代码来源:Record.php


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