예제 #1
0
 /**
  * Retrieves a constant from the manifest.php file of the extension.
  *
  * @author Joel Bout, <*****@*****.**>
  * @param  string $key
  * @return mixed
  * @throws common_exception_Error If the constant cannot be found.
  */
 public function getConstant($key)
 {
     $returnValue = null;
     $constants = $this->getConstants();
     if (isset($constants[$key])) {
         $returnValue = $constants[$key];
     } elseif (defined($key)) {
         common_logger::w('constant outside of extension called: ' . $key);
         $returnValue = constant($key);
     } else {
         throw new common_exception_Error('Unknown constant \'' . $key . '\' for extension ' . $this->id);
     }
     return $returnValue;
 }
예제 #2
0
 /**
  * Short description of method getSection
  *
  * @access public
  * @author Jerome Bogaerts, <*****@*****.**>
  * @param  string extension
  * @param  string perspectiveId
  * @param  string sectionId
  * @return Section
  */
 public static function getSection($extension, $perspectiveId, $sectionId)
 {
     $returnValue = null;
     $structure = self::getPerspective($extension, $perspectiveId);
     foreach ($structure->getChildren() as $section) {
         if ($section->getId() == $sectionId) {
             $returnValue = $section;
             break;
         }
     }
     if (empty($returnValue)) {
         \common_logger::w('Section ' . $sectionId . ' not found found for perspective ' . $perspectiveId);
     }
     return $returnValue;
 }