/** * Determine the status of all extensions. * * @return array * ($key => status_constant) */ public function getStatuses() { if (!is_array($this->statuses)) { $this->statuses = array(); foreach ($this->fullContainer->getKeys() as $key) { $this->statuses[$key] = self::STATUS_UNINSTALLED; } $sql = ' SELECT full_name, is_active FROM civicrm_extension '; $dao = CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { try { $path = $this->fullContainer->getPath($dao->full_name); $codeExists = !empty($path) && is_dir($path); } catch (CRM_Extension_Exception $e) { $codeExists = FALSE; } if ($dao->is_active) { $this->statuses[$dao->full_name] = $codeExists ? self::STATUS_INSTALLED : self::STATUS_INSTALLED_MISSING; } else { $this->statuses[$dao->full_name] = $codeExists ? self::STATUS_DISABLED : self::STATUS_DISABLED_MISSING; } } } return $this->statuses; }
/** * Given the class, provides the template path. * * * @param string $clazz * Extension class name. * * @return string * path to extension's templates directory */ public function getTemplatePath($clazz) { $path = $this->container->getPath($this->classToKey($clazz)); return $path . DIRECTORY_SEPARATOR . self::EXT_TEMPLATES_DIRNAME; /* $path = $this->classToPath($clazz); $pathElm = explode(DIRECTORY_SEPARATOR, $path); array_pop($pathElm); return implode(DIRECTORY_SEPARATOR, $pathElm) . DIRECTORY_SEPARATOR . self::EXT_TEMPLATES_DIRNAME; */ }