Пример #1
0
 public static function register($name, $package, $displayname, $desc = null, $edit_user_type = user::TYPE_NORMAL_USER, $mode = 'SAFE')
 {
     // see if the package is already registered
     $featobj = null;
     try {
         $featobj =& self::getFeatureByName($name);
     } catch (Exception $e) {
         if (!$e->getCode() == 0) {
             throw $e;
         }
     }
     if ($featobj && $mode == 'SAFE') {
         throw new featureException('This feature is already registered and registration was attempted in safe mode.', 0);
     }
     // find the package attempting registration
     try {
         if (!($packageobj = Package_Catalog::getInstalledPackage($package))) {
             throw new featureException('The package "' . $package . '" that attempted to register feature "' . $name . '" was not found.', -1);
         }
     } catch (Package_Catalog_Exception $e) {
         throw new featureException('The package "' . $package . '" that attempted to register feature "' . $name . '" was not found.', -1);
     }
     $package = $packageobj['datastore_id'];
     // if we are reregging (e.g. to handle a package upgrade) then make sure that package matches what is on file
     if ($mode == 'REREG' && $featobj && $featobj->ftr_package_id !== $package) {
         // Make sure the package that is on file still exists, otherwise allow the rereg
         $ftr_package_obj = Doctrine::getTable('package')->findOne($featobj->ftr_package_id);
         if ($ftr_package_obj && $ftr_package_obj->name !== $packageobj->name) {
             throw new featureException('Rereg was attempted on the feature named "' . $featobj->ftr_name . '" but the package that tried to reregister named "' . $packageobj->name . '" does not match the currently registerd feature named "' . $ftr_package_obj->name . '".', -2);
         }
     }
     if (!$featobj) {
         $featobj = new feature();
     }
     $featobj->ftr_name = $name;
     $featobj->ftr_display_name = $displayname;
     $featobj->ftr_package_id = $package;
     $featobj->ftr_desc = $desc;
     $featobj->ftr_edit_user_type = $edit_user_type;
     $featobj->save();
 }
Пример #2
0
            echo $seq;
            ?>
" class="col-md-4 homePanel <?php 
            echo $pageClass;
            ?>
" >
                              <div class="homePanelInner">  
                                <p class="hidden"><?php 
            echo $item["id"];
            ?>
</p>
                                <div class="news">
                                    <h2>Latest News</h2>
                                    <?php 
            // spin up a features collection with latest news
            $class = new feature($userID, $tenantID);
            $filters = array('news' => 'true', 'status' => 'Published');
            $newsItems = $class->getEntities($filters, 4, 0);
            foreach ($newsItems as $newsItem) {
                echo '<h3 class="headline"><a href="feature.php?id=' . $newsItem["id"] . '">' . $newsItem["headline"] . '</a></h3>';
                echo '<p class="dateline">' . Format::formatDateLine($newsItem["datePosted"], true) . '</p>';
            }
            ?>
                                    <p class="more"><a href="news.php">More <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></a></p>
                                </div>
                                <div class="buttonPane"></div>
                              </div>
                           </div>                               
                            <?php 
        } else {
            ?>