Пример #1
0
 /**
  * Method to link up the external css or js files associated with a set of code.
  * This is normally called internally by the control methods to ensure the required 
  * files are linked into the page so does not need to be called directly. However 
  * it can be useful when writing custom code that uses one of these standard
  * libraries such as jQuery. 
  * Ensures each file is only linked once and that dependencies are included
  * first and in the order given.
  *
  * @param string $resource Name of resource to link. The following options are available:
  * <ul>
  * <li>indiciaFns</li>
  * <li>jquery</li>
  * <li>openlayers</li>
  * <li>graticule</li>
  * <li>clearLayer</li>
  * <li>addrowtogrid</li>
  * <li>indiciaMapPanel</li>
  * <li>indiciaMapEdit</li>
  * <li>postcode_search</li>
  * <li>locationFinder</li>
  * <li>createPersonalSites</li>
  * <li>autocomplete</li>
  * <li>indicia_locks</li>
  * <li>jquery_cookie</li>
  * <li>jquery_ui</li>
  * <li>jquery_ui_fr</li>
  * <li>jquery_form</li>
  * <li>json</li>
  * <li>reportPicker</li>
  * <li>treeview</li>
  * <li>treeview_async</li>
  * <li>googlemaps</li>
  * <li>multimap</li>
  * <li>virtualearth</li>
  * <li>fancybox</li>
  * <li>treeBrowser</li>
  * <li>defaultStylesheet</li>
  * <li>validation</li>
  * <li>plupload</li>
  * <li>jqplot</li>
  * <li>jqplot_bar</li>
  * <li>jqplot_pie</li>
  * <li>jqplot_category_axis_renderer</li>
  * <li>jqplot_canvas_axis_label_renderer</li>
  * <li>jqplot_trendline</li>
  * <li>reportgrid</li>
  * <li>tabs</li>
  * <li>wizardprogress</li>
  * <li>spatialReports</li>
  * <li>jsonwidget</li>
  * <li>timeentry</li>
  * <li>verification</li>
  * <li>complexAttrGrid</li>
  * </ul>
  */
 public static function add_resource($resource)
 {
     // Ensure indiciaFns is always the first resource added
     if (!self::$indiciaFnsDone) {
         self::$indiciaFnsDone = true;
         self::add_resource('indiciaFns');
     }
     $resourceList = self::get_resources();
     // If this is an available resource and we have not already included it, then add it to the list
     if (array_key_exists($resource, $resourceList) && !in_array($resource, self::$required_resources)) {
         if (isset($resourceList[$resource]['deps'])) {
             foreach ($resourceList[$resource]['deps'] as $dep) {
                 self::add_resource($dep);
             }
         }
         self::$required_resources[] = $resource;
     }
 }