本文整理汇总了PHP中Vtiger_Module_Model::getCleanInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Module_Model::getCleanInstance方法的具体用法?PHP Vtiger_Module_Model::getCleanInstance怎么用?PHP Vtiger_Module_Model::getCleanInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Module_Model
的用法示例。
在下文中一共展示了Vtiger_Module_Model::getCleanInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEnable
public function checkEnable(\Vtiger_Request $request)
{
$moduleModel = Vtiger_Module_Model::getCleanInstance($request->getModule());
$response = new Vtiger_Response();
$response->setResult($moduleModel->isActive());
$response->emit();
}
示例2: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$buttonsReturn = false;
$mode = $request->get('mode');
$formodule = $request->get('formodule');
$recordModel = Vtiger_Module_Model::getCleanInstance('OSSPdf');
if ($mode == 'create_buttons') {
$recordModel->add_links($formodule);
$buttonsReturn = true;
}
if ($mode == 'delete_buttons') {
$modCommentsModule = Vtiger_Module::getInstance($formodule);
$modCommentsModule->deleteLink('LISTVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL');
// do ewentualnej poprawy
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'Generate default PDF');
$buttonsReturn = true;
}
if ($buttonsReturn === false) {
$result = array('success' => false, 'message' => vtranslate('Error', $moduleName));
} else {
$result = array('success' => true, 'message' => 'Ok');
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例3: getWidget
function getWidget($srecord, $smodule)
{
$db = PearDatabase::getInstance();
$return = array();
$ModuleModel = Vtiger_Module_Model::getCleanInstance('OSSCosts');
$field = $ModuleModel->modules_fields_ids[$smodule];
$limit = $ModuleModel->widget_no_rows;
$sql = "SELECT osscosts_no,total FROM vtiger_osscosts INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_osscosts.osscostsid WHERE vtiger_crmentity.deleted=0 AND {$field} = '{$srecord}' ORDER BY osscostsid DESC LIMIT {$limit}";
$result = $db->query($sql, true);
$return['rows'] = $result->GetArray();
$sql = "SELECT COUNT(osscostsid) AS count,SUM(total) AS sum FROM vtiger_osscosts INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_osscosts.osscostsid WHERE vtiger_crmentity.deleted=0 AND {$field} = '{$srecord}'";
$result = $db->query($sql, true);
$return['summary'] = $result->GetArray();
return $return;
}
示例4: process
public function process(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
$moduleName = $request->getModule(FALSE);
$names = array('Emails', 'PBXManager', 'ModComments', 'SMSNotifier', 'OSSPdf');
foreach ($names as $id) {
$in .= "'" . $id . "',";
}
$in = trim($in, ',');
$wynik = $db->query("select tabid,name,customized from vtiger_tab where isentitytype='1' and presence<> '2' and name not in ( {$in} )", true);
$modules = array();
$BUTTONINFO = array();
for ($i = 0; $i < $db->num_rows($wynik); $i++) {
$label = $db->query_result($wynik, $i, "name");
$modules[$label] = vtranslate($label, $label);
$tabid = $db->query_result($wynik, $i, "tabid");
$wyn = $db->query("select * from vtiger_links where linklabel='Pdf' and tabid='{$tabid}'", true);
if ($db->num_rows($wyn) > 0) {
$BUTTONINFO[$db->query_result($wynik, $i, "name")] = 1;
} else {
$BUTTONINFO[$db->query_result($wynik, $i, "name")] = 0;
}
}
$mode = $request->get('mode');
$viewer = $this->getViewer($request);
if ($mode == 'delete_buttons') {
$name = $request->get('formodule');
include_once 'vtlib/Vtiger/Module.php';
$modCommentsModule = Vtiger_Module::getInstance($name);
$modCommentsModule->deleteLink('LISTVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL');
// do ewentualnej poprawy
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'Generate default PDF');
$viewer->assign('deleted_buttons', $name);
$request->set('mode', '');
}
if ($mode == 'create_buttons') {
$name = $request->get('formodule');
$recordModel = Vtiger_Module_Model::getCleanInstance('OSSPdf');
$recordModel->add_links($name);
$viewer->assign('created_buttons', $name);
$request->set('mode', '');
}
$users = getAllUserName();
$groups = getAllGroupName();
$viewer->assign('users', $users);
$viewer->assign('groups', $groups);
$viewer->assign('modules', $modules);
$viewer->assign('BUTTONINFO', $BUTTONINFO);
if (empty($mode)) {
$pobierz = $db->query("select * from vtiger_osspdf_config where conf_id = 'GENERALCONFIGURATION'", true);
$selected = array();
for ($i = 0; $i < $db->num_rows($pobierz); $i++) {
$viewer->assign($db->query_result($pobierz, $i, "name"), $db->query_result($pobierz, $i, "value"));
$selected[$db->query_result($pobierz, $i, "name")] = $db->query_result($pobierz, $i, "value");
}
$viewer->assign('SELECTED', $selected);
} elseif ('update' == $mode) {
if ($request->get('ifsave') != '') {
$ifsave = 'yes';
} else {
$ifsave = 'no';
}
if ($request->get('ifattach') != '') {
$ifattach = 'yes';
} else {
$ifattach = 'no';
}
$names = array('Emails', 'PBXManager', 'ModComments', 'SMSNotifier', 'OSSPdf');
foreach ($names as $id) {
$in .= "'" . $id . "',";
}
$in = trim($in, ',');
$wynik = $db->query("select tabid,name from vtiger_tab where isentitytype='1' and presence<> '2' and name not in ( {$in} )", true);
$modules = array();
for ($i = 0; $i < $db->num_rows($wynik); $i++) {
$name = $db->query_result($wynik, $i, "name");
$val = $request->get($name);
// echo '<br/>'.$name.' wartosc: '.$val;
$wart = $db->query("update vtiger_osspdf_config set value='{$val}' where name = '{$name}' and conf_id='GENERALCONFIGURATION'", true);
}
$wynik = $db->query("update vtiger_osspdf_config set value='{$ifsave}' where name = 'ifsave' and conf_id='GENERALCONFIGURATION'", true);
$wynik = $db->query("update vtiger_osspdf_config set value='{$ifattach}' where name = 'ifattach' and conf_id='GENERALCONFIGURATION'", true);
$pobierz = $db->query("select * from vtiger_osspdf_config where conf_id = 'GENERALCONFIGURATION'", true);
$selected = array();
for ($i = 0; $i < $db->num_rows($pobierz); $i++) {
$viewer->assign($db->query_result($pobierz, $i, "name"), $db->query_result($pobierz, $i, "value"));
$selected[$db->query_result($pobierz, $i, "name")] = $db->query_result($pobierz, $i, "value");
}
$viewer->assign('SELECTED', $selected);
}
// Operation to be restricted for non-admin users.
if (!Users_Record_Model::getCurrentUserModel()->isAdminUser()) {
$viewer->assign('IS_ADMIN', 'false');
} else {
///Wczytanie pliku konfiguracyjnego
$includes_dir = "modules/" . $module . "/config";
$viewer->assign('IS_ADMIN', 'true');
$mode = $request->get('mode');
//.........这里部分代码省略.........
示例5: BindRecords
public function BindRecords()
{
$adb = PearDatabase::getInstance();
$actions = array('2_bind_Accounts', '3_bind_Contacts', '4_bind_Leads', '5_bind_HelpDesk', '6_bind_Potentials', '7_bind_Project', '8_bind_ServiceContracts', '9_bind_Campaigns');
$result = $adb->pquery("SELECT * FROM vtiger_ossmailview WHERE verify = '1' ", array());
$num_rows = $adb->num_rows($result);
if ($num_rows == 0) {
return false;
}
$return = array();
$OSSMailScannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$scan_id = $OSSMailScannerModel->add_scan_history(array('user' => PHP_SAPI));
for ($i = 0; $i < $num_rows; $i++) {
$mail_detail['ossmailviewid'] = $adb->query_result($result, $i, 'ossmailviewid');
$mail_detail['message_id'] = $adb->query_result($result, $i, 'uid');
$mail_detail['fromaddress'] = $adb->query_result($result, $i, 'from_email');
$mail_detail['toaddress'] = $adb->query_result($result, $i, 'to_email');
$mail_detail['ccaddress'] = $adb->query_result($result, $i, 'cc_email');
$mail_detail['bccaddress'] = $adb->query_result($result, $i, 'bcc_email');
$mail_detail['subject'] = $adb->query_result($result, $i, 'subject');
$mail_detail['folder'] = $adb->query_result($result, $i, 'mbox');
foreach ($actions as $user_action) {
$OSSMailScanner_Module_Model = Vtiger_Module_Model::getCleanInstance('OSSMailScanner');
$action_adress = $OSSMailScanner_Module_Model->ActionsDirector . '/' . $user_action . '.php';
if (file_exists($action_adress)) {
require_once $action_adress;
$fn_name = '_' . $user_action;
$return[$mail_detail['ossmailviewid']][$user_action] = $fn_name('', $mail_detail, $mail_detail['folder'], $return[$mail_detail['ossmailviewid']]);
}
}
$adb->pquery("update vtiger_ossmailview set verify = '0' WHERE ossmailviewid = ?", array($mail_detail['ossmailviewid']));
self::update_scan_history($scan_id, array('status' => '1', 'count' => $i, 'action' => 'Action_CronBind'));
}
$OSSMailScannerModel->update_scan_history($scan_id, array('status' => '0', 'count' => $num_rows, 'action' => 'Action_CronBind'));
return $return;
}
示例6: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$modules = $request->get('modules');
$assignId = $request->get('assigned_user_id');
$currentUser = Users_Record_Model::getCurrentUserModel();
$entityValues = array();
$entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
$entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
$createAlways = Vtiger_Processes_Model::getConfig('marketing', 'conversion', 'create_always');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
$convertLeadFields = $recordModel->getConvertLeadFields();
$availableModules = array('Accounts', 'Contacts', 'Potentials');
foreach ($availableModules as $module) {
if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
$entityValues['entities'][$module]['create'] = true;
$entityValues['entities'][$module]['name'] = $module;
foreach ($convertLeadFields[$module] as $fieldModel) {
$fieldName = $fieldModel->getName();
$fieldValue = $request->get($fieldName);
//Potential Amount Field value converting into DB format
if ($fieldModel->getFieldDataType() === 'currency') {
$fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'date') {
$fieldValue = DateTimeField::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
$ids = vtws_getIdComponents($fieldValue);
if (count($ids) === 1) {
$fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
}
}
$entityValues['entities'][$module][$fieldName] = $fieldValue;
}
}
}
try {
$results = true;
if ($createAlways === true || $createAlways === 'true') {
$leadModel = Vtiger_Module_Model::getCleanInstance($request->getModule());
$results = $leadModel->searchAccountsToConvert($recordModel);
$entityValues['entities']['Accounts']['convert_to_id'] = $results;
}
if (!$results) {
$message = vtranslate('LBL_TOO_MANY_ACCOUNTS_TO_CONVERT', $request->getModule(), '');
if ($currentUser->isAdminUser()) {
$message = vtranslate('LBL_TOO_MANY_ACCOUNTS_TO_CONVERT', $request->getModule(), '<a href="index.php?module=MarketingProcesses&view=Index&parent=Settings"><span class="glyphicon glyphicon-folder-open"></span></a>');
}
$this->showError($request, '', $message);
exit;
}
} catch (Exception $e) {
$this->showError($request, $e);
exit;
}
try {
$result = vtws_convertlead($entityValues, $currentUser);
} catch (Exception $e) {
$this->showError($request, $e);
exit;
}
if (!empty($result['Accounts'])) {
$accountIdComponents = vtws_getIdComponents($result['Accounts']);
$accountId = $accountIdComponents[1];
}
if (!empty($result['Contacts'])) {
$contactIdComponents = vtws_getIdComponents($result['Contacts']);
$contactId = $contactIdComponents[1];
}
if (!empty($accountId)) {
ModTracker_Record_Model::addConvertToAccountRelation('Accounts', $accountId, $assignId);
header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
} elseif (!empty($contactId)) {
header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
} else {
$this->showError($request);
exit;
}
}