[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/com_vtiger_workflow/ -> VTEntityMethodManager.inc (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  require_once ("include/events/SqlResultIterator.inc");
  11  class VTEntityMethodManager{
  12      
  13  	function __construct($adb){
  14          $this->adb = $adb;
  15      }
  16      
  17      
  18  	function addEntityMethod($moduleName, $methodName, $functionPath, $functionName){
  19          $adb = $this->adb;
  20          $id = $adb->getUniqueId("com_vtiger_workflowtasks_entitymethod");
  21          $adb->pquery("insert into com_vtiger_workflowtasks_entitymethod (workflowtasks_entitymethod_id, module_name, function_path, function_name, method_name) values (?,?,?,?,?)", array($id, $moduleName, $functionPath, $functionName, $methodName));
  22      }
  23      
  24      
  25      
  26  	function executeMethod($entityData, $methodName){
  27          $adb = $this->adb;
  28          $moduleName = $entityData->getModuleName();
  29          $result = $adb->pquery("select function_path, function_name from com_vtiger_workflowtasks_entitymethod where module_name=? and method_name=?", array($moduleName, $methodName));
  30          if($adb->num_rows($result)!=0){
  31              $data = $adb->raw_query_result_rowdata($result, 0);
  32              $functionPath = $data['function_path'];
  33              $functionName = $data['function_name'];
  34              require_once($functionPath);
  35              $functionName($entityData);
  36          }
  37      }
  38      
  39  	function methodsForModule($moduleName){
  40          $adb = $this->adb;
  41          $result = $adb->pquery("select method_name from com_vtiger_workflowtasks_entitymethod where module_name=?", array($moduleName));
  42          $it = new SqlResultIterator($adb, $result);
  43          $methodNames = array();
  44          foreach($it as $row){
  45              $methodNames[] = $row->method_name;
  46          }
  47          return $methodNames;
  48      }
  49      /*
  50      private function methodExists($object, $methodName){
  51          $className = get_class($object);
  52          $class = new ReflectionClass($className);
  53          $methods = $class->getMethods();
  54          foreach($methods as $method){
  55              if($method->getName()==$methodName){
  56                  return true;
  57              }
  58          }
  59          return false;
  60      }*/
  61  
  62      /**
  63       * Function to remove workflowtasks entity method 
  64       * @param <String> Module Name
  65       * @param <String> Entity Method Name.
  66       */
  67  	function removeEntityMethod($moduleName, $methodName){
  68          $adb = $this->adb;
  69          $adb->pquery("DELETE FROM com_vtiger_workflowtasks_entitymethod WHERE module_name = ? and method_name= ?", array($moduleName, $methodName));
  70      }
  71  }
  72  ?>


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