<?php
 
require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

class modRunProgram  {
  private $prog_list;

  public function __construct() {

    $progPath = $_SERVER['DOCUMENT_ROOT'] . "/runprogram/ajax/*.php";
    $files = glob ($progPath);

    $firstOf = true;
    for ($i = 0; $i < count($files); $i ++) {
      $progName = substr ( strrchr ( $files[$i], "/" ), 1 );
      $list[] = array("name"=>$progName);    
    }
    $this->prog_list = $this->toObject($list);  
  }

  public function get($prop) {
    return $this->$prop;
  }
  
  private function toObject($array) {
    $object = new stdClass();
    foreach ($array as $key => $value) {
      if (is_array($value)) {
        $value = $this->toObject($value);
      }
      $object->$key = $value;
    }
    return $object;
  }
 
  
}

?>