[ Index ]

PHP Cross Reference of Yamoon 0.9.0

title

Body

[close]

/Yamoon/ -> Global.php (source)

   1  <?php
   2  
   3  require_once ('Config.php');
   4  require_once ('Company.php');
   5  require_once ('Service.php');
   6  require_once ('Host.php');
   7  require_once ('Language.php');
   8  require_once ('Mrtg.php');
   9  
  10  /**
  11    * Global.php - This is not a class, only a set of functions. Including
  12    * this file you get "for free" the $config object and four list methods
  13    * to build form selects.
  14    */
  15  
  16  $config = new Config();
  17  $config->getDB();
  18  
  19  /**
  20    * getCompanies get all companies from database. It's used on the main
  21    * page index.php.
  22    *
  23    * $companyList = getCompanies();
  24    */
  25  function getCompanies () {
  26      global $config;
  27      $rows = $config->select("select id from companies");
  28      $companyList = array();
  29      if (isset($rows[0]) && $rows[0]->id > 0)
  30          foreach ($rows as $item)
  31              array_push($companyList, new Company($config, $item->id));
  32      return $companyList;
  33  }
  34  
  35  /**
  36    * getProbes get all probes from database. It's used on the poller.php
  37    * script to get all active probes without going inside each company.
  38    * This method also lists inactive probes.
  39    *
  40    * As the Company class does it i'm still thinking if it makes sense.
  41    *
  42    * $probeList = getProbes();
  43    */
  44  function getProbes ($onlyActive="") {
  45      global $config;
  46      $active = "";
  47      if ($onlyActive)
  48          $active = "where active = 'Y'";
  49      $rows = $config->select("select id from probes $active");
  50      $probeList = array();
  51      if (isset($rows[0]) && $rows[0]->id > 0)
  52          foreach ($rows as $item)
  53              array_push($probeList, new Probe($config, $item->id));
  54      return $probeList;
  55  }
  56  
  57  /**
  58    * getServices get all services from database. It's used on the admin
  59    * page admin.php and on the edit company page for insert probe select.
  60    *
  61    * $serviceList = getServices();
  62    */
  63  function getServices () {
  64      global $config;
  65      $rows = $config->select("select id from services");
  66      $serviceList = array();
  67      if (isset($rows[0]) && $rows[0]->id > 0)
  68          foreach ($rows as $item)
  69              array_push($serviceList, new Service($config, $item->id));
  70      return $serviceList;
  71  }
  72  
  73  /**
  74    * getLanguage get all languages from database. It's used on the admin
  75    * page admin.php and on the edit service page on admin.
  76    *
  77    * $languageList = getLanguages();
  78    */
  79  function getLanguages () {
  80      global $config;
  81      $rows = $config->select("select id from languages");
  82      $languageList = array();
  83      if (isset($rows[0]) && $rows[0]->id > 0)
  84          foreach ($rows as $item)
  85              array_push($languageList, new Language($config, $item->id));
  86      return $languageList;
  87  }
  88  
  89  ?>


Generated: Sat Feb 19 17:29:53 2005 Cross-referenced by PHPXref 0.6