[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Settings/ModuleManager/models/ -> Module.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  class Settings_ModuleManager_Module_Model extends Vtiger_Module_Model {
  12  
  13      public static function getNonVisibleModulesList() {
  14          return array('ModTracker','Webmails','Users','Mobile','Integration','WSAPP',
  15                       'ConfigEditor','FieldFormulas','VtigerBackup','CronTasks','Import' ,'Tooltip',
  16                      'CustomerPortal', 'Home', 'ExtensionStore');
  17      }
  18  
  19  
  20      /**
  21       * Function to get the url of new module import
  22       */
  23      public static function getNewModuleImportUrl() {
  24          return 'index.php?module=ExtensionStore&parent=Settings&view=ExtensionImport';
  25      }
  26      
  27      
  28      /**
  29       * Function to get the url of Extension store
  30       */
  31      public static function getExtensionStoreUrl() {
  32          return 'index.php?module=ExtensionStore&parent=Settings&view=ExtensionImport&mode=index';
  33      }
  34  
  35      /**
  36       * Function to get the url of new module import 
  37       */
  38      public static function getUserModuleFileImportUrl() {
  39              return 'index.php?module=ModuleManager&parent=Settings&view=ModuleImport&mode=importUserModuleStep1'; 
  40      }
  41      
  42      /**
  43       * Function to disable a module 
  44       * @param type $moduleName - name of the module
  45       */
  46      public function disableModule($moduleName) {
  47          //Handling events after disable module
  48          vtlib_toggleModuleAccess($moduleName, false);
  49      }
  50  
  51      /**
  52       * Function to enable the module
  53       * @param type $moduleName -- name of the module
  54       */
  55      public function enableModule($moduleName) {
  56          //Handling events after enable module
  57          vtlib_toggleModuleAccess($moduleName, true);
  58      }
  59  
  60  
  61      /**
  62       * Static Function to get the instance of Vtiger Module Model for all the modules
  63       * @return <Array> - List of Vtiger Module Model or sub class instances
  64       */
  65  	public static function getAll() {
  66           return parent::getAll(array(0,1), self::getNonVisibleModulesList());
  67      }
  68  
  69      /**
  70       * Function which will get count of modules
  71       * @param <Boolean> $onlyActive - if true get count of only active modules else all the modules
  72       * @return <integer> number of modules
  73       */
  74      public static function getModulesCount($onlyActive = false) {
  75          $db = PearDatabase::getInstance();
  76  
  77          $query = 'SELECT * FROM vtiger_tab';
  78          $params = array();
  79          if($onlyActive) {
  80              $presence = array(0);
  81              $nonVisibleModules = self::getNonVisibleModulesList();
  82              $query .= ' WHERE presence IN ('. generateQuestionMarks($presence) .')';
  83              $query .= ' AND name NOT IN ('.generateQuestionMarks($nonVisibleModules).')';
  84              array_push($params, $presence,$nonVisibleModules);
  85          }
  86          $result = $db->pquery($query, $params);
  87          return $db->num_rows($result);
  88      }
  89  
  90      /**
  91       * Function that returns all those modules that support Module Sequence Numbering
  92       * @global PearDatabase $db - database connector
  93       * @return <Array of Vtiger_Module_Model>
  94       */
  95  	public static function getModulesSupportingSequenceNumbering() {
  96          $db = PearDatabase::getInstance();
  97          $sql="SELECT tabid, name FROM vtiger_tab WHERE isentitytype = 1 AND presence = 0 AND tabid IN
  98              (SELECT DISTINCT tabid FROM vtiger_field WHERE uitype = '4')";
  99          $result = $db->pquery($sql, array());
 100  
 101          $moduleModels = array();
 102          for($i=0; $i<$db->num_rows($result); ++$i) {
 103              $row =  $db->query_result_rowdata($result, $i);
 104              $moduleModels[$row['name']] = self::getInstanceFromArray($row);
 105          }
 106          return $moduleModels;
 107      }
 108  
 109      /**
 110       * Function to get restricted modules list
 111       * @return <Array> List module names
 112       */
 113  	public static function getActionsRestrictedModulesList() {
 114          return array('Home', 'Emails', 'Webmails');
 115      }
 116  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1