Example #1
0
 public static function getInstance($value, $force = false)
 {
     if (!self::$cachedInstances || $force) {
         self::$cachedInstances = self::getAll();
     }
     if (self::$cachedInstances) {
         $actionid = Vtiger_Utils::isNumber($value) ? $value : false;
         foreach (self::$cachedInstances as $instance) {
             if ($actionid !== false) {
                 if ($instance->get('actionid') == $actionid) {
                     return $instance;
                 }
             } else {
                 if ($instance->get('actionname') == $value) {
                     return $instance;
                 }
             }
         }
     }
     return null;
 }