本文整理汇总了PHP中Vtiger_Functions类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions类的具体用法?PHP Vtiger_Functions怎么用?PHP Vtiger_Functions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Functions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: showTaxes
function showTaxes(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$record = $request->get('record');
$recordModule = $request->get('recordModule');
$currency = $request->get('currency');
$sourceRecord = $request->get('sourceRecord');
$taxType = $request->get('taxType');
$totalPrice = $request->get('totalPrice');
$inventoryModel = Vtiger_Inventory_Model::getInstance($moduleName);
$accountTaxs = $inventoryModel->getAccountTax($moduleName, $sourceRecord);
$config = $inventoryModel->getTaxesConfig();
$viewer = $this->getViewer($request);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RECORD', $record);
$viewer->assign('RECORD_MODULE', $recordModule);
$viewer->assign('GLOBAL_TAXS', $inventoryModel->getGlobalTaxs());
$viewer->assign('CURRENCY_SYMBOL', Vtiger_Functions::getCurrencySymbolandRate($currency)['symbol']);
$viewer->assign('TOTAL_PRICE', $totalPrice);
$viewer->assign('CONFIG', $config);
$viewer->assign('TAX_TYPE', $taxType);
$viewer->assign('TAX_FIELD', Vtiger_InventoryField_Model::getTaxField($recordModule));
$viewer->assign('AGGREGATION_TYPE', $config['aggregation']);
$viewer->assign('AGGREGATION_INPUT_TYPE', $config['aggregation'] == 0 ? 'radio' : 'checkbox');
$viewer->assign('GROUP_TAXS', $accountTaxs['taxs']);
$viewer->assign('ACCOUNT_NAME', $accountTaxs['name']);
echo $viewer->view('InventoryTaxes.tpl', $moduleName, true);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:28,代码来源:Inventory.php
示例2: getListFiledOfRelatedModule
function getListFiledOfRelatedModule($moduleName)
{
$db = PearDatabase::getInstance();
$tabid = getTabid($moduleName);
$sourceModule = $moduleName;
$sql = "select vtiger_field.fieldid, fieldlabel, uitype, vtiger_fieldmodulerel.relmodule from vtiger_field \n\t\t\t\tleft JOIN vtiger_fieldmodulerel ON vtiger_fieldmodulerel.fieldid = vtiger_field.fieldid where tabid = ? AND (uitype = '10' OR uitype = '59' OR uitype = '53' OR uitype = '51')";
$resultModuleList = $db->pquery($sql, array($tabid), true);
$moduleList = array();
for ($i = 0; $i < $db->num_rows($resultModuleList); $i++) {
$uitype = $db->query_result($resultModuleList, $i, 'uitype');
$fieldid = $db->query_result($resultModuleList, $i, 'fieldid');
$fieldlabel = $db->query_result($resultModuleList, $i, 'fieldlabel');
if ($uitype == 10) {
$moduleList[] = array(Vtiger_Functions::getModuleId($db->query_result($resultModuleList, $i, 'relmodule')), $fieldlabel, $fieldid);
} elseif ($uitype == 51) {
$moduleList[] = array(Vtiger_Functions::getModuleId('Accounts'), $fieldlabel, $fieldid);
} elseif ($uitype == 59) {
$moduleList[] = array(Vtiger_Functions::getModuleId('Products'), $fieldlabel, $fieldid);
} elseif ($uitype == 53) {
$moduleList[] = array(Vtiger_Functions::getModuleId('Users'), $fieldlabel, $fieldid);
}
}
$output = array();
for ($i = 0; $i < count($moduleList); $i++) {
$moduleInfoSql = "SELECT * FROM vtiger_tab WHERE tabid = ?";
$moduleInfoResult = $db->pquery($moduleInfoSql, array($moduleList[$i][0]), true);
$moduleName = $db->query_result($moduleInfoResult, 0, 'name');
$moduleTrLabal = vtranslate($moduleList[$i][1], $sourceModule);
$output[$moduleTrLabal] = array();
$output[$moduleTrLabal] = $this->getListFiledOfModule($moduleName, $moduleList[$i][2]);
}
return $output;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:33,代码来源:Module.php
示例3: getSelectableDashboard
public function getSelectableDashboard()
{
global $log;
$log->debug("Entering Settings_WidgetsManagement_Module_Model::getSelectableDashboard() method ...");
$db = PearDatabase::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$sql = 'SELECT * FROM vtiger_links WHERE linktype = ?';
$params = array('DASHBOARDWIDGET');
$result = $db->pquery($sql, $params);
$widgets = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$row = $db->query_result_rowdata($result, $i);
$moduleName = Vtiger_Functions::getModuleName($row['tabid']);
if ($moduleName != 'Home' && ($row['linklabel'] == 'Mini List' || $row['linklabel'] == 'Notebook')) {
continue;
}
if ($row['linklabel'] == 'Tag Cloud') {
$isTagCloudExists = getTagCloudView($currentUser->getId());
if ($isTagCloudExists == 'false') {
continue;
}
}
$moduleName = Vtiger_Functions::getModuleName($row['tabid']);
$widgets[$moduleName][] = Vtiger_Widget_Model::getInstanceFromValues($row);
}
$log->debug("Exiting Settings_WidgetsManagement_Module_Model::getSelectableDashboard() method ...");
return $widgets;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:28,代码来源:Module.php
示例4: getKeyMetricsWithCount
protected function getKeyMetricsWithCount()
{
global $log;
$log->debug("Entering ./dashboards/KeyMetrics.php::getKeyMetricsWithCount");
global $current_user, $adb;
$current_user = Users_Record_Model::getCurrentUserModel();
require_once 'modules/CustomView/ListViewTop.php';
$metriclists = getMetricList();
foreach ($metriclists as $key => $metriclist) {
$metricresult = NULL;
$queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
$queryGenerator->initForCustomViewById($metriclist['id']);
if ($metriclist['module'] == "Calendar") {
// For calendar we need to eliminate emails or else it will break in status empty condition
$queryGenerator->addCondition('activitytype', "Emails", 'n', QueryGenerator::$AND);
}
$metricsql = $queryGenerator->getQuery();
$metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
if ($metricresult) {
$rowcount = $adb->fetch_array($metricresult);
$metriclists[$key]['count'] = $rowcount['count'];
}
}
return $metriclists;
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:25,代码来源:KeyMetrics.php
示例5: edit
public function edit(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$wid = $request->get('id');
$moduleModel = Settings_Widgets_Module_Model::getInstance($qualifiedModuleName);
$WidgetInfo = $moduleModel->getWidgetInfo($wid);
$RelatedModule = $moduleModel->getRelatedModule($WidgetInfo['tabid']);
$type = $WidgetInfo['type'];
$viewer = $this->getViewer($request);
$viewer->assign('SOURCE', $WidgetInfo['tabid']);
$viewer->assign('SOURCEMODULE', Vtiger_Functions::getModuleName($WidgetInfo['tabid']));
$viewer->assign('WID', $wid);
$viewer->assign('WIDGETINFO', $WidgetInfo);
$viewer->assign('TYPE', $type);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('RELATEDMODULES', $RelatedModule);
$widgetName = 'Vtiger_' . $type . '_Widget';
if (class_exists($widgetName)) {
$widgetInstance = new $widgetName();
$tplName = $widgetInstance->getConfigTplName();
$viewer->view("widgets/{$tplName}.tpl", 'Vtiger');
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:Widget.php
示例6: process
function process(Vtiger_Request $request)
{
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$baseUserId = $currentUserModel->getId();
$userId = $request->get('id');
$user = new Users();
$currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
$name = $currentUserModel->getName();
$userName = $currentUser->column_fields['user_name'];
Vtiger_Session::set('AUTHUSERID', $userId);
Vtiger_Session::set('authenticated_user_id', $userId);
Vtiger_Session::set('user_name', $userName);
Vtiger_Session::set('full_user_name', $name);
$status = 'Switched';
if (Vtiger_Session::get('baseUserId') == '') {
Vtiger_Session::set('baseUserId', $baseUserId);
$status = 'Signed in';
} elseif ($userId == Vtiger_Session::get('baseUserId')) {
$baseUserId = $userId;
Vtiger_Session::set('baseUserId', '');
$status = 'Signed out';
} else {
$baseUserId = Vtiger_Session::get('baseUserId');
}
$dbLog = PearDatabase::getInstance('log');
$dbLog->insert('l_yf_switch_users', ['baseid' => $baseUserId, 'destid' => $userId, 'busername' => $currentUserModel->getName(), 'dusername' => $name, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $status]);
header('Location: index.php');
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:28,代码来源:SwitchUsers.php
示例7: getDisplayValue
/**
* Getting value to display
* @param type $value
* @return type
*/
public function getDisplayValue($value)
{
if ($value != 0) {
return Vtiger_Functions::getCRMRecordLabel($value);
}
return '';
}
开发者ID:noclav,项目名称:UpdatePackages,代码行数:12,代码来源:Reference.php
示例8: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$source = $request->get('source');
$sourceModule = $request->get('sourceModule');
if ($sourceModule != '') {
$source = Vtiger_Functions::getModuleId($sourceModule);
}
if ($source == '') {
$source = 6;
}
$moduleModel = Settings_Widgets_Module_Model::getInstance($qualifiedModuleName);
$RelatedModule = $moduleModel->getRelatedModule($source);
$viewer = $this->getViewer($request);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('SOURCE', $source);
$viewer->assign('SOURCEMODULE', Vtiger_Functions::getModuleName($source));
$viewer->assign('WIDGETS', $moduleModel->getWidgets($source));
$viewer->assign('RELATEDMODULES', $RelatedModule);
$viewer->assign('FILTERS', json_encode($moduleModel->getFiletrs($RelatedModule)));
$viewer->assign('CHECKBOXS', json_encode($moduleModel->getCheckboxs($RelatedModule)));
//$viewer->assign('EXCLUDEDTYPES', $moduleModel->excludedTypes($source) );
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('MODULE', $moduleName);
$viewer->view('Index.tpl', $qualifiedModuleName);
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:27,代码来源:Index.php
示例9: process
function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $this->getModule($request);
$template = $request->get('template');
$srcField = $request->get('src_field');
$srcRecord = $request->get('src_record');
if (!empty($template)) {
$recordModel = Settings_TreesManager_Record_Model::getInstanceById($template);
} else {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!$recordModel) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
$tree = $recordModel->getTree();
$viewer->assign('TREE', Zend_Json::encode($tree));
$viewer->assign('SRC_RECORD', $srcRecord);
$viewer->assign('SRC_FIELD', $srcField);
$viewer->assign('TEMPLATE', $template);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('TRIGGER_EVENT_NAME', $request->get('triggerEventName'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('TreePopup.tpl', $moduleName);
}
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:25,代码来源:TreePopup.php
示例10: showTree
public function showTree(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$sourceModule = $request->get('selectedModule');
$viewer = $this->getViewer($request);
$this->template = $this->getTemplate();
if ($this->template) {
$recordModel = Settings_TreesManager_Record_Model::getInstanceById($this->template);
} else {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!$recordModel) {
Vtiger_Functions::throwNewException(vtranslate('ERR_TREE_NOT_FOUND', $moduleName));
}
if (!in_array($sourceModule, $this->modules)) {
Vtiger_Functions::throwNewException(vtranslate('ERR_MODULE_NOT_FOUND', $moduleName));
}
$tree = $this->getCategory();
$treeWithItems = $this->getRecords();
$tree = array_merge($tree, $treeWithItems);
$viewer->assign('TREE', Zend_Json::encode($tree));
$viewer->assign('MODULES', $this->modules);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
$viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));
$viewer->view('AccountsListTree.tpl', $moduleName);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:27,代码来源:AccountsListTree.php
示例11: getKeyMetricsWithCount
protected function getKeyMetricsWithCount()
{
global $current_user, $adb;
$current_user = Users_Record_Model::getCurrentUserModel();
require_once 'modules/CustomView/ListViewTop.php';
$metriclists = getMetricList();
foreach ($metriclists as $key => $metriclist) {
$metricresult = NULL;
if ($metriclist['module'] == "Calendar") {
$listquery = getListQuery($metriclist['module']);
$oCustomView = new CustomView($metriclist['module']);
$metricsql = $oCustomView->getModifiedCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
$metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
} else {
$queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
$queryGenerator->initForCustomViewById($metriclist['id']);
$metricsql = $queryGenerator->getQuery();
$metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
}
if ($metricresult) {
$rowcount = $adb->fetch_array($metricresult);
$metriclists[$key]['count'] = $rowcount['count'];
}
}
return $metriclists;
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:26,代码来源:Notebook.php
示例12: getDisplayValue
/**
* Function to get the Display Value, for the current field type with given DB Insert Value
* @param <Object> $value
* @return <Object>
*/
public function getDisplayValue($values)
{
if ($values == '')
return;
foreach (Vtiger_Functions::getArrayFromValue($values) as $value) {
if (Vtiger_Owner_UIType::getOwnerType($value) === 'User') {
$userModel = Users_Record_Model::getCleanInstance('Users');
$userModel->set('id', $value);
$detailViewUrl = $userModel->getDetailViewUrl();
$currentUser = Users_Record_Model::getCurrentUserModel();
if ($currentUser->isAdminUser()) {
$displayvalue[] = '<a href=' . $detailViewUrl . '>' . rtrim(getOwnerName($value)) . '</a>';
} else {
$displayvalue[] = rtrim(getOwnerName($value));
}
} else {
$currentUser = Users_Record_Model::getCurrentUserModel();
if ($currentUser->isAdminUser()) {
$recordModel = new Settings_Groups_Record_Model();
$recordModel->set('groupid', $value);
$detailViewUrl = $recordModel->getDetailViewUrl();
$displayvalue[] = '<a href=' . $detailViewUrl . '>' . rtrim(getOwnerName($value)) . '</a>';
} else {
$displayvalue[] = rtrim(getOwnerName($value));
}
}
}
$displayvalue = implode(', ', $displayvalue);
return $displayvalue;
}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:36,代码来源:SharedOwner.php
示例13: addRelation
function addRelation($request)
{
$sourceModule = $request->getModule();
$sourceRecordId = $request->get('src_record');
$relatedModule = $request->get('related_module');
if (is_numeric($relatedModule)) {
$relatedModule = Vtiger_Functions::getModuleName($relatedModule);
}
$relatedRecordIdList = $request->get('related_record_list');
$sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);
$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
$relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);
foreach ($relatedRecordIdList as $relatedRecordId) {
$relationModel->addRelation($sourceRecordId, $relatedRecordId, $listPrice);
if ($relatedModule == 'PriceBooks') {
$recordModel = Vtiger_Record_Model::getInstanceById($relatedRecordId);
if ($sourceRecordId && ($sourceModule === 'Products' || $sourceModule === 'Services')) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModule);
$recordModel->updateListPrice($sourceRecordId, $parentRecordModel->get('unit_price'));
}
}
}
$response = new Vtiger_Response();
$response->setResult(true);
$response->emit();
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:RelationAjax.php
示例14: process
public function process(Vtiger_Request $request)
{
$qualifiedModuleName = $request->getModule(false);
$moduleModel = Settings_Vtiger_CompanyDetails_Model::getInstance();
$status = false;
if ($request->get('organizationname')) {
$saveLogo = $status = true;
if (!empty($_FILES['logo']['name'])) {
$logoDetails = $_FILES['logo'];
$fileType = explode('/', $logoDetails['type']);
$fileType = $fileType[1];
if (!$logoDetails['size'] || !in_array($fileType, Settings_Vtiger_CompanyDetails_Model::$logoSupportedFormats)) {
$saveLogo = false;
}
//mime type check
$mimeType = Vtiger_Functions::getMimeContentType($logoDetails['tmp_name']);
$mimeTypeContents = explode('/', $mimeType);
if (!$logoDetails['size'] || $mimeTypeContents[0] != 'image' || !in_array($mimeTypeContents[1], Settings_Vtiger_CompanyDetails_Model::$logoSupportedFormats)) {
$saveLogo = false;
}
// Check for php code injection
$imageContents = file_get_contents($_FILES["logo"]["tmp_name"]);
if (preg_match('/(<\?php?(.*?))/i', $imageContents) == 1) {
$saveLogo = false;
}
if ($saveLogo) {
$moduleModel->saveLogo();
}
} else {
$saveLogo = true;
}
$fields = $moduleModel->getFields();
foreach ($fields as $fieldName => $fieldType) {
$fieldValue = $request->get($fieldName);
if ($fieldName === 'logoname') {
if (!empty($logoDetails['name'])) {
$fieldValue = ltrim(basename(" " . $logoDetails['name']));
} else {
$fieldValue = $moduleModel->get($fieldName);
}
}
$moduleModel->set($fieldName, $fieldValue);
}
$moduleModel->save();
}
$reloadUrl = $moduleModel->getIndexViewUrl();
if ($saveLogo && $status) {
} else if (!$saveLogo) {
$reloadUrl .= '&error=LBL_INVALID_IMAGE';
} else {
$reloadUrl = $moduleModel->getEditViewUrl() . '&error=LBL_FIELDS_INFO_IS_EMPTY';
}
header('Location: ' . $reloadUrl);
}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:60,代码来源:CompanyDetailsSave.php
示例15: getRelatedSummary
public function getRelatedSummary($query)
{
$db = PearDatabase::getInstance();
$relationQuery = preg_replace("/[ \t\n\r]+/", " ", $query);
$position = stripos($relationQuery, ' from ');
if ($position) {
$split = explode(' FROM ', $relationQuery);
$mainQuery = '';
for ($i = 1; $i < count($split); $i++) {
$mainQuery = $mainQuery . ' FROM ' . $split[$i];
}
}
// Calculate total working time
$result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime' . $mainQuery);
$totalTime = $db->getSingleValue($result);
// Calculate total working time divided into users
$result = $db->query('SELECT SUM(vtiger_osstimecontrol.sum_time) AS sumtime, vtiger_crmentity.smownerid' . $mainQuery . ' GROUP BY vtiger_crmentity.smownerid');
$userTime = [];
$count = 1;
while ($row = $db->fetch_array($result)) {
$smownerid = Vtiger_Functions::getOwnerRecordLabel($row['smownerid']);
$userTime[] = ['name' => [$count, $smownerid], 'initial' => [$count, Vtiger_Functions::getInitials($smownerid)], 'data' => [$count, $row['sumtime']]];
$count++;
}
return ['totalTime' => $totalTime, 'userTime' => $userTime];
}
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:26,代码来源:Module.php
示例16: process
public function process(Vtiger_Request $request)
{
$adb = PearDatabase::getInstance();
$metod = $request->get('metod');
$params = $request->get('params');
$params['folder'] = urldecode($params['folder']);
$return = false;
if (Vtiger_Functions::getModuleId('OSSMailView') && Vtiger_Functions::getModuleId('OSSMailScanner')) {
$return = 0;
$account = OSSMail_Record_Model::get_account_detail_by_name($params['username']);
$result = $adb->pquery("SELECT ossmailviewid FROM vtiger_ossmailview WHERE id = ? AND mbox = ? AND rc_user = ?", array($params['uid'], $params['folder'], $account[0]['user_id']), true);
if ($adb->num_rows($result) > 0) {
$return = $adb->query_result($result, 0, 'ossmailviewid');
} else {
$scannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$params['actions'] = '0_created_Email';
$mail_Scan_mail = $scannerModel->manualScanMail($params);
if ($mail_Scan_mail['0_created_Email']) {
$return = $mail_Scan_mail['0_created_Email']['created_Email'];
}
}
}
$response = new Vtiger_Response();
$response->setResult($return);
$response->emit();
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:26,代码来源:getCrmId.php
示例17: process
public function process($instance)
{
$log = vglobal('log');
$log->debug("Entering SumTimeProjectTask::process() method ...");
$sum_time = Vtiger_Functions::decimalTimeFormat($instance->get('sum_time_pt'));
$log->debug("Exiting SumTimeProjectTask::process() method ...");
return $sum_time['short'];
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:8,代码来源:SumTimeProjectTask.php
示例18: getListViewEntries
/**
* Function to get the list view entries
* @param Vtiger_Paging_Model $pagingModel
* @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
*/
public function getListViewEntries($pagingModel)
{
$db = PearDatabase::getInstance();
$module = $this->getModule();
$moduleName = $module->getName();
$parentModuleName = $module->getParentName();
$qualifiedModuleName = $moduleName;
if (!empty($parentModuleName)) {
$qualifiedModuleName = $parentModuleName . ':' . $qualifiedModuleName;
}
$recordModelClass = Vtiger_Loader::getComponentClassName('Model', 'Record', $qualifiedModuleName);
$listQuery = $this->getBasicListQuery();
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$orderBy = $this->getForSql('orderby');
if (!empty($orderBy) && $orderBy === 'smownerid') {
$fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
if ($fieldModel->getFieldDataType() == 'owner') {
$orderBy = 'COALESCE(CONCAT(vtiger_users.first_name,vtiger_users.last_name),vtiger_groups.groupname)';
}
}
if (!empty($orderBy)) {
$listQuery .= ' ORDER BY ' . $orderBy . ' ' . $this->getForSql('sortorder');
}
$sourceModule = $this->get('sourceModule');
if (!empty($sourceModule)) {
$tabId = Vtiger_Functions::getModuleId($sourceModule);
$listQuery .= " WHERE `module` = '{$tabId}' ";
}
if ($module->isPagingSupported()) {
$nextListQuery = $listQuery . ' LIMIT ' . ($startIndex + $pageLimit) . ',1';
$listQuery .= " LIMIT {$startIndex}, {$pageLimit}";
}
$listResult = $db->pquery($listQuery, array());
$noOfRecords = $db->num_rows($listResult);
$listViewRecordModels = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$row = $db->query_result_rowdata($listResult, $i);
$record = new $recordModelClass();
$record->setData($row);
$recordModule = Vtiger_Functions::getModuleName($row['module']);
$record->set('module', vtranslate($recordModule, $recordModule));
if (method_exists($record, 'getModule') && method_exists($record, 'setModule')) {
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
$record->setModule($moduleModel);
}
$listViewRecordModels[$record->getId()] = $record;
}
if ($module->isPagingSupported()) {
$pagingModel->calculatePageRange($listViewRecordModels);
$nextPageResult = $db->pquery($nextListQuery, array());
$nextPageNumRows = $db->num_rows($nextPageResult);
if ($nextPageNumRows <= 0) {
$pagingModel->set('nextPageExists', false);
}
}
return $listViewRecordModels;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:63,代码来源:ListView.php
示例19: getRelatedModuleRecordIds
public function getRelatedModuleRecordIds(Vtiger_Request $request, $recordIds = [])
{
$db = PearDatabase::getInstance();
$basicModule = $request->getModule();
$relatedModules = $request->get('related_modules');
$parentModuleModel = Vtiger_Module_Model::getInstance($basicModule);
$relatedIds = [];
if (!empty($relatedModules)) {
foreach ($relatedModules as $relModData) {
$relModData = explode('::', $relModData);
$relatedModule = $relModData[0];
$type = $relModData[1];
switch ($type) {
case 0:
$field = $relModData[2];
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
if ($recordModel->get($field) != 0 && Vtiger_Functions::getCRMRecordType($recordModel->get($field)) == $relatedModule) {
$relatedIds[] = $recordModel->get($field);
}
}
break;
case 1:
$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
$instance = CRMEntity::getInstance($relatedModule);
$relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModuleModel);
$fieldModel = $relationModel->getRelationField();
$tablename = $fieldModel->get('table');
$tabIndex = $instance->table_index;
$relIndex = $this->getRelatedFieldName($relatedModule, $basicModule);
if (!$relIndex) {
break;
}
$sql = "SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN {$tablename} ON {$tablename}.{$tabIndex} = vtiger_crmentity.crmid\n\t\t\t\t\t\tWHERE {$tablename}.{$relIndex} IN (" . $db->generateQuestionMarks($recordIds) . ")";
$result = $db->pquery($sql, $recordIds);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
break;
case 2:
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $relatedModule);
$query = $relationListView->getRelationQuery();
$queryEx = explode('FROM', $query, 2);
$query = 'SELECT DISTINCT vtiger_crmentity.crmid FROM' . $queryEx[1];
$result = $db->query($query);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
}
break;
}
$relatedIds = array_unique($relatedIds);
}
}
return $relatedIds;
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:58,代码来源:TransferOwnership.php
示例20: __construct
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
Vtiger_Session::init();
$request = new Vtiger_Request($_REQUEST);
$dbLog = PearDatabase::getInstance('log');
$userName = Vtiger_Session::get('full_user_name');
$dbLog->insert('o_yf_access_for_api', ['username' => empty($userName) ? '-' : $userName, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'url' => Vtiger_Functions::getBrowserInfo()->url, 'agent' => $_SERVER['HTTP_USER_AGENT'], 'request' => json_encode($_REQUEST)]);
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:9,代码来源:AppException.php
注:本文中的Vtiger_Functions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论