本文整理汇总了PHP中Vtiger_Loader::getComponentClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Loader::getComponentClassName方法的具体用法?PHP Vtiger_Loader::getComponentClassName怎么用?PHP Vtiger_Loader::getComponentClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Loader
的用法示例。
在下文中一共展示了Vtiger_Loader::getComponentClassName方法的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: 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 ...');
}
示例3: 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();
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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);
}
示例11: 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;
}
示例12: 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;
}
示例13: 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();
$parentModuleName = $module->getParentName();
if (!empty($parentModuleName)) {
$qualifiedModuleName = $parentModuleName . ':' . $module->getName();
}
$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 = [];
$sourceModule = $this->get('sourceModule');
if (!empty($sourceModule)) {
$sourceModule = Vtiger_Functions::getModuleName($sourceModule);
$listQuery .= ' WHERE `tabid` = ?';
$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);
$listViewRecordModels = [];
while ($row = $db->getRow($listResult)) {
$recordModel = new $recordModelClass();
$moduleName = Vtiger_Functions::getModuleName($row['tabid']);
$relModuleName = Vtiger_Functions::getModuleName($row['reltabid']);
$row['tabid'] = vtranslate($moduleName, $moduleName);
$row['reltabid'] = vtranslate($relModuleName, $relModuleName);
$recordModel->setData($row);
$listViewRecordModels[$recordModel->getId()] = $recordModel;
}
$pagingModel->calculatePageRange($listViewRecordModels);
if ($listResult->rowCount() > $pageLimit) {
array_pop($listViewRecordModels);
$pagingModel->set('nextPageExists', true);
} else {
$pagingModel->set('nextPageExists', false);
}
$nextPageResult = $db->pquery($nextListQuery, $params);
if ($nextPageResult->rowCount() <= 0) {
$pagingModel->set('nextPageExists', false);
}
return $listViewRecordModels;
}
示例14: getInstance
/**
* Get invnetory instance
* @param string $moduleName Module name
* @return Vtiger_Inventory_Model instance
*/
public static function getInstance($moduleName)
{
$instance = Vtiger_Cache::get('Inventory', $moduleName);
if (!$instance) {
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Inventory', $moduleName);
$instance = new $modelClassName();
$instance->initialize($moduleName);
Vtiger_Cache::set('Inventory', $moduleName, $instance);
}
return $instance;
}
示例15: getInstance
/**
* Static Function to get the instance of Vtiger TreeView Model for the given Vtiger Module Model
* @param string name of the module
* @return Vtiger_TreeView_Model instance
*/
public static function getInstance($moduleModel)
{
$moduleName = $moduleModel->get('name');
if (isset(self::$_cached_instance[$moduleName])) {
return self::$_cached_instance[$moduleName];
}
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'TreeView', $moduleName);
$instance = new $modelClassName();
self::$_cached_instance[$moduleName] = $instance->set('module', $moduleModel);
return self::$_cached_instance[$moduleName];
}