本文整理汇总了PHP中Vtiger_Loader类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Loader类的具体用法?PHP Vtiger_Loader怎么用?PHP Vtiger_Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchRecord
public function searchRecord($searchValue, $searchModule, $potentialId)
{
$db = PearDatabase::getInstance();
$potentialId = intval($potentialId);
if ($searchModule == 'Products') {
$sql = "SELECT\n\t\t\t\t\t\tcrm.*,\n\t\t\t\t\t\tprod.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`vtiger_products` prod\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentity` crm\n\t\t\t\t\t\t\tON crm.`crmid` = prod.`productid`\n\t\t\t\t\t\tINNER JOIN `vtiger_seproductsrel` prodrel\n\t\t\t\t\t\t\tON prod.`productid` = prodrel.`productid`\n\t\t\t\t\t\t\tAND prodrel.`setype` = 'Potentials'\n\t\t\t\t\tWHERE prod.`productname` LIKE '%{$searchValue}%'\n\t\t\t\t\t\tAND crm.`setype` = 'Products'\n\t\t\t\t\t\tAND crm.`deleted` = 0\n\t\t\t\t\t\tAND prodrel.`crmid` = '{$potentialId}';";
} else {
$sql = "SELECT\n\t\t\t\t\t\tcrm.*,\n\t\t\t\t\t\tserv.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`vtiger_service` serv\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentity` crm\n\t\t\t\t\t\t\tON crm.`crmid` = serv.`serviceid`\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentityrel` crmrel\n\t\t\t\t\t\t\tON serv.`serviceid` = crmrel.`relcrmid`\n\t\t\t\t\t\t\tAND crmrel.`module` = 'Potentials'\n\t\t\t\t\tWHERE serv.`servicename` LIKE '%{$searchValue}%'\n\t\t\t\t\t\tAND crm.`setype` = 'Services'\n\t\t\t\t\t\tAND crm.`deleted` = 0\n\t\t\t\t\t\tAND crmrel.`crmid` = '{$potentialId}';";
}
$result = $db->pquery($sql, array());
$noOfRows = $db->num_rows($result);
$moduleModels = array();
$matchingRecords = array();
for ($i = 0; $i < $noOfRows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
if (Users_Privileges_Model::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {
$row['id'] = $row['crmid'];
$moduleName = $row['setype'];
if (!array_key_exists($moduleName, $moduleModels)) {
$moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
}
$moduleModel = $moduleModels[$moduleName];
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
$recordInstance = new $modelClassName();
$matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
}
}
return $matchingRecords;
}
示例2: getInstanceFromServerType
public static function getInstanceFromServerType($type,$componentName) {
// SalesPlatform.ru begin
require_once 'includes/SalesPlatform/NetIDNA/idna_convert.class.php';
// SalesPlatform.ru end
$db = PearDatabase::getInstance();
$query = 'SELECT * FROM '.self::tableName.' WHERE server_type=?';
$params = array($type);
$result = $db->pquery($query,$params);
try{
$modelClassName = Vtiger_Loader::getComponentClassName('Model', $componentName, 'Settings:Vtiger');
}catch(Exception $e) {
$modelClassName = self;
}
$instance = new $modelClassName();
if($db->num_rows($result) > 0 ){
$rowData = $db->query_result_rowdata($result,0);
$instance->setData($rowData);
}
// SalesPlatform.ru begin
$idn = new idna_convert();
$mail_server_username = $idn->decode($instance->get('server_username'));
$from_email_field = $idn->decode($instance->get('from_email_field'));
$instance->set('server_username', $mail_server_username);
$instance->set('from_email_field', $from_email_field);
// SalesPlatform.ru end
return $instance;
}
示例3: getInstanceFromField
/**
* Static function to get the UIType object from Vtiger Field Model
* @param Vtiger_Field_Model $fieldModel
* @return Vtiger_Base_UIType or UIType specific object instance
*/
public static function getInstanceFromField($fieldModel)
{
$fieldDataType = $fieldModel->getFieldDataType();
$uiTypeClassSuffix = ucfirst($fieldDataType);
$moduleName = $fieldModel->getModuleName();
$moduleSpecificUiTypeClassName = $moduleName . '_' . $uiTypeClassSuffix . '_UIType';
$uiTypeClassName = 'Vtiger_' . $uiTypeClassSuffix . '_UIType';
$fallBackClassName = 'Vtiger_Base_UIType';
$moduleSpecificFileName = 'modules.' . $moduleName . '.uitypes.' . $uiTypeClassSuffix;
$uiTypeClassFileName = 'modules.Vtiger.uitypes.' . $uiTypeClassSuffix;
$moduleSpecificFilePath = Vtiger_Loader::resolveNameToPath($moduleSpecificFileName);
$completeFilePath = Vtiger_Loader::resolveNameToPath($uiTypeClassFileName);
if (file_exists($moduleSpecificFilePath)) {
$instance = new $moduleSpecificUiTypeClassName();
} else if (file_exists($completeFilePath)) {
$instance = new $uiTypeClassName();
} else {
$instance = new $fallBackClassName();
}
$instance->set('field', $fieldModel);
return $instance;
}
示例4: process
public function process(Vtiger_Request $request)
{
$nbmdinwllij = "moduleModel";
sw_autoload_register("SWExtension", "~/modules/Workflow2/libs");
${"GLOBALS"}["lbrvcglwt"] = "sql";
${$nbmdinwllij} = Vtiger_Module_Model::getInstance("Workflow2");
${"GLOBALS"}["rzvthtpq"] = "repos";
${${"GLOBALS"}["orsfdwhbz"]} = new SWExtension_GenKey("Workflow2", $moduleModel->version);
$vvirsh = "repo";
$fievvrk = "repos";
${${"GLOBALS"}["ksmqgls"]} = PearDatabase::getInstance();
${${"GLOBALS"}["lbrvcglwt"]} = "UPDATE vtiger_wf_repository SET licenseCode = \"" . md5($request->get("license")) . "\" WHERE url LIKE \"%repository.stefanwarnat.de%\"";
$adb->query(${${"GLOBALS"}["tddsprktk"]});
${${"GLOBALS"}["rzvthtpq"]} = \Workflow\Repository::getAll(true);
foreach (${$fievvrk} as ${$vvirsh}) {
try {
$repo->installAll(\Workflow\Repository::INSTALL_ALL);
} catch (Exception $exp) {
}
}
${${"GLOBALS"}["qcqdlactbzp"]} = new Vtiger_Response();
try {
$GenKey->removeLicense();
$GenKey->g7cd354a00dadcd8c4600f080755860496d0c03d5($request->get("license"), array(__FILE__, Vtiger_Loader::resolveNameToPath("modules.Settings.Workflow2.views.Config")));
$response->setResult(array("success" => true));
} catch (Exception $exp) {
$response->setResult(array("success" => false, "error" => $exp->getMessage()));
}
$response->emit();
}
示例5: getSearchResult
/**
* Static Function to get the list of records matching the search key
* @param <String> $searchKey
* @return <Array> - List of Vtiger_Record_Model or Module Specific Record Model instances
*/
public static function getSearchResult($searchKey, $module = false)
{
$db = PearDatabase::getInstance();
$deletedCondition = $this->getModule()->getDeletedRecordCondition();
$query = 'SELECT * FROM vtiger_crmentity
INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid
WHERE label LIKE ? AND ' . $deletedCondition;
$params = array("%{$searchKey}%");
$result = $db->pquery($query, $params);
$noOfRows = $db->num_rows($result);
$moduleModels = array();
$matchingRecords = array();
for ($i = 0; $i < $noOfRows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
$row['id'] = $row['crmid'];
$moduleName = $row['setype'];
if (!array_key_exists($moduleName, $moduleModels)) {
$moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
}
$moduleModel = $moduleModels[$moduleName];
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
$recordInstance = new $modelClassName();
$matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
}
return $matchingRecords;
}
示例6: process
function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleName = $request->getModule();
$componentName = $request->get('name');
$linkId = $request->get('linkid');
if (!empty($componentName)) {
$className = Vtiger_Loader::getComponentClassName('Dashboard', $componentName, $moduleName);
if (!empty($className)) {
$widget = NULL;
if (!empty($linkId)) {
$widget = new Vtiger_Widget_Model();
$widget->set('linkid', $linkId);
$widget->set('userid', $currentUser->getId());
$widget->set('filterid', $request->get('filterid', NULL));
if ($request->has('data')) {
$widget->set('data', $request->get('data'));
}
$widget->add();
}
$classInstance = new $className();
$classInstance->process($request, $widget);
return;
}
}
$response = new Vtiger_Response();
$response->setResult(array('success' => false, 'message' => vtranslate('NO_DATA')));
$response->emit();
}
示例7: process
function process(Vtiger_Request $request)
{
$log = vglobal('log');
$log->debug('Entering ' . __CLASS__ . '::' . __METHOD__ . '() method ...');
$moduleName = $request->getModule();
$recordId = $request->get('record');
$view = $request->get('fromview');
$viewer = $this->getViewer($request);
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'MappedFields', $moduleName);
$mfModel = new $handlerClass();
if ($view == 'List') {
$allRecords = Vtiger_Mass_Action::getRecordsListFromRequest($request);
$templates = $mfModel->getActiveTemplatesForModule($moduleName, $view);
$viewer->assign('ALL_RECORDS', $allRecords);
} else {
$templates = $mfModel->getActiveTemplatesForRecord($recordId, $view, $moduleName);
$viewer->assign('RECORD', $recordId);
}
$viewer->assign('TEMPLATES', $templates);
$viewer->assign('VIEW', $view);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('BASE_MODULE_NAME', 'Vtiger');
$this->preProcess($request);
$viewer->view('GenerateModal.tpl', $qualifiedModule);
$this->postProcess($request);
$log->debug('Exiting ' . __CLASS__ . '::' . __METHOD__ . ' method ...');
}
示例8: getInstance
/**
* Static Function to get the Instance of Vtiger ListView model for a given module and custom view
* @param <String> $moduleName - Module Name
* @param <Number> $viewId - Custom View Id
* @return Vtiger_ListView_Model instance
*/
public static function getInstance($moduleName, $viewId = 0)
{
$db = PearDatabase::getInstance();
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'ListView', $moduleName);
$instance = new $modelClassName();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
return $instance->set('module', $moduleModel);
}
示例9: getInstance
/**
* Function to get the instance
* @param <String> $moduleName - module name
* @param <String> $recordId - record id
* @return <Vtiger_DetailView_Model>
*/
public static function getInstance($moduleName, $recordId)
{
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DetailView', $moduleName);
$instance = new $modelClassName();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordModel = Reports_Record_Model::getCleanInstance($recordId, $moduleName);
return $instance->setModule($moduleModel)->setRecord($recordModel);
}
示例10: 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;
}
示例11: getInstance
/**
* Function to get instance of provider model
* @param <String> $providerName
* @return <SMSNotifier_Provider_Model> provider object
*/
public static function getInstance($providerName)
{
if (!empty($providerName)) {
$providerName = trim($providerName);
$className = Vtiger_Loader::getComponentClassName('Provider', $providerName, 'SMSNotifier');
return new $className();
}
return false;
}
示例12: getInstance
/**
* Function to get the instance
* @param <String> $moduleName - module name
* @param <String> $recordId - record id
* @return <Vtiger_DetailView_Model>
*/
public static function getInstance($moduleName, $recordId)
{
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DetailView', $moduleName);
$instance = new $modelClassName();
$moduleModel = EmailTemplates_Module_Model::getInstance($moduleName);
$recordModel = EmailTemplates_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->trackView();
return $instance->setModule($moduleModel)->setRecord($recordModel);
}
示例13: getInstance
public static function getInstance($record, $moduleName, $relatedRecord, $relatedModuleName)
{
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'RelatedCommentModal', $moduleName);
$instance = new $modelClassName();
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $relatedModuleName);
$instance->set('relationListView', $relationListView)->set('record', $record)->set('moduleName', $moduleName)->set('relatedRecord', $relatedRecord)->set('relatedModuleName', $relatedModuleName);
return $instance;
}
示例14: 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);
$listFields = $module->listFields;
$listQuery = "SELECT ";
foreach ($listFields as $fieldName => $fieldLabel) {
$listQuery .= "{$fieldName}, ";
}
$listQuery .= $module->baseIndex . " FROM " . $module->baseTable;
$params = array();
$sourceModule = $this->get('sourceModule');
if (!empty($sourceModule)) {
$listQuery .= ' WHERE module_name = ?';
$params[] = $sourceModule;
}
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$orderBy = $this->getForSql('orderby');
if (!empty($orderBy)) {
$listQuery .= ' ORDER BY ' . $orderBy . ' ' . $this->getForSql('sortorder');
}
$nextListQuery = $listQuery . ' LIMIT ' . ($startIndex + $pageLimit) . ',1';
$listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
$listResult = $db->pquery($listQuery, $params);
$noOfRecords = $db->num_rows($listResult);
$listViewRecordModels = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$row = $db->query_result_rowdata($listResult, $i);
$record = new $recordModelClass();
$row['module_name'] = vtranslate($row['module_name'], $row['module_name']);
$row['execution_condition'] = vtranslate($record->executionConditionAsLabel($row['execution_condition']), 'Settings:Workflows');
$record->setData($row);
$listViewRecordModels[$record->getId()] = $record;
}
$pagingModel->calculatePageRange($listViewRecordModels);
if ($db->num_rows($listResult) > $pageLimit) {
array_pop($listViewRecordModels);
$pagingModel->set('nextPageExists', true);
} else {
$pagingModel->set('nextPageExists', false);
}
$nextPageResult = $db->pquery($nextListQuery, $params);
$nextPageNumRows = $db->num_rows($nextPageResult);
if ($nextPageNumRows <= 0) {
$pagingModel->set('nextPageExists', false);
}
return $listViewRecordModels;
}
示例15: getLayoutFile
public static function getLayoutFile($name)
{
$basePath = 'layouts' . '/' . vglobal('defaultLayout') . '/';
$filePath = Vtiger_Loader::resolveNameToPath('~' . $basePath . $name);
if (is_file($filePath)) {
return $basePath . $name;
}
$basePath = 'layouts' . '/' . Vtiger_Viewer::getDefaultLayoutName() . '/';
return $basePath . $name;
}