コード例 #1
0
ファイル: Listings.php プロジェクト: cannking/vtigercrm-debug
 /**
  * Function to get news listings by passing type as News
  */
 protected function getPromotions(Vtiger_Request $request)
 {
     $modelInstance = Settings_ExtensionStore_Extension_Model::getInstance();
     $promotions = $modelInstance->getListings('', 'Promotion');
     $qualifiedModuleName = $request->getModule(false);
     $viewer = $this->getViewer($request);
     $viewer->assign('PROMOTIONS', $promotions);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->view('Promotions.tpl', $qualifiedModuleName);
 }
コード例 #2
0
 protected function maxCreatedOn(Vtiger_Request $request)
 {
     $modelInstance = Settings_ExtensionStore_Extension_Model::getInstance();
     $promotions = $modelInstance->getMaxCreatedOn('Promotion', 'max', 'createdon');
     $response = new Vtiger_Response();
     if ($promotions['success'] != 'true') {
         $response->setError('', $promotions['error']);
     } else {
         $response->setResult($promotions['response']);
     }
     $response->emit();
 }
コード例 #3
0
 protected function oneClickInstall(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     global $Vtiger_Utils_Log;
     $viewer->assign('VTIGER_UTILS_LOG', $Vtiger_Utils_Log);
     $Vtiger_Utils_Log = true;
     $upgradeError = true;
     $qualifiedModuleName = $request->getModule(false);
     $extensionId = $request->get('extensionId');
     $moduleAction = $request->get('moduleAction');
     //Import/Upgrade
     $trial = $request->get('trial');
     $modelInstance = $this->getModelInstance();
     $response = $modelInstance->getInstanceById($extensionId, $trial);
     if ($response['success']) {
         $extensionModel = $response['result'];
         $package = $extensionModel->getPackage();
         if ($package) {
             $importedModuleName = $package->getModuleName();
             $isLanguagePackage = $package->isLanguageType();
             if ($moduleAction === 'Upgrade') {
                 $targetModuleName = $request->get('extensionName');
                 if ($isLanguagePackage && trim($package->xpath_value('prefix')) == $targetModuleName || !$isLanguagePackage && $importedModuleName === $targetModuleName) {
                     $upgradeError = false;
                 }
             } else {
                 $upgradeError = false;
             }
             if (!$upgradeError) {
                 if (!$isLanguagePackage) {
                     $moduleModel = Vtiger_Module_Model::getInstance($importedModuleName);
                     if (!$extensionModel->isUpgradable()) {
                         $viewer->assign('SAME_VERSION', true);
                     }
                 }
                 $moduleType = $packageType = $package->type();
                 $fileName = $extensionModel->getFileName();
             } else {
                 $viewer->assign('ERROR', true);
                 $viewer->assign('ERROR_MESSAGE', vtranslate('LBL_INVALID_FILE', $qualifiedModuleName));
             }
         } else {
             $viewer->assign('ERROR', true);
             $viewer->assign('ERROR_MESSAGE', vtranslate('LBL_INVALID_FILE', $qualifiedModuleName));
         }
     } else {
         $viewer->assign('ERROR', true);
         $viewer->assign('ERROR_MESSAGE', $response['message']);
     }
     if ($extensionId && $extensionModel) {
         if ($moduleAction !== 'Upgrade') {
             $extensionModel->installTrackDetails();
         }
         if (strtolower($moduleType) === 'language') {
             $package = new Vtiger_Language();
         } else {
             $package = new Vtiger_Package();
         }
         $viewer->assign('MODULE_ACTION', $moduleAction);
         $viewer->assign('MODULE_PACKAGE', $package);
         $viewer->assign('TARGET_MODULE_INSTANCE', Vtiger_Module_Model::getInstance($targetModuleName));
         $viewer->assign('MODULE_FILE_NAME', Settings_ExtensionStore_Extension_Model::getUploadDirectory() . '/' . $fileName);
     }
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->view('InstallationLog.tpl', $qualifiedModuleName);
 }
コード例 #4
0
ファイル: Basic.php プロジェクト: cannking/vtigercrm-debug
 protected function uninstallExtension(Vtiger_Request $request)
 {
     $extensionName = $request->get('extensionName');
     $extensionInstance = Settings_ExtensionStore_Extension_Model::getModuleFromExtnName($extensionName);
     $extnType = $extensionInstance->get('extnType');
     $response = new Vtiger_Response();
     if ($extnType == 'module') {
         $extensionInstance->delete();
         //Remove extension files
         global $root_directory;
         $deletePaths = array();
         $pathToExtensionLayouts = $root_directory . "layouts/vlayout/modules/{$extensionName}";
         $layoutDirAccessible = isFileAccessible($pathToExtensionLayouts);
         if ($layoutDirAccessible) {
             $deletePaths['layouts'] = $pathToExtensionLayouts;
         }
         $pathToExtensionModule = $root_directory . "modules/{$extensionName}";
         $moduleDirAccessible = isFileAccessible($pathToExtensionModule);
         if ($moduleDirAccessible) {
             $deletePaths['modules'] = $pathToExtensionModule;
         }
         foreach ($deletePaths as $dirName) {
             $this->deleteRecursively($dirName);
         }
         $response->setResult(array('success' => true, 'message' => 'extension deleted'));
     } else {
         if ($extnType == 'language') {
             $languageInstance = Settings_ExtensionStore_Extension_Model::getLanguageInstance($extensionName);
             if ($languageInstance) {
                 $langPrefix = $languageInstance->get('prefix');
                 Vtiger_Language::deregister($langPrefix);
                 //remove files
                 $langDir = "languages/{$langPrefix}";
                 if (isFileAccessible($langDir)) {
                     $this->deleteRecursively($langDir);
                 }
             }
             $response->setResult(array('success' => true, 'message' => 'extension deleted'));
         } else {
             $response->setError('Error in deleting extension');
         }
     }
     $response->emit();
 }