public function fetch()
 {
     $db = new dbConnection();
     if ($this->name != "") {
         //$res = $db->exec_sp("getProject", array($this->name));
         $res = $db->do_query("SELECT * FROM project WHERE name = '{$this->name}'");
         if ($res !== true) {
             return $res;
         }
         while ($arr = $db->get_row_array()) {
             $this->fromArr($arr);
         }
         if (preg_match('/^ec_ade::/', $this->submission_id)) {
             $this->submission_id = str_replace('ec_ade::', '', $this->submission_id);
             $this->allowDownloadEdits = true;
         }
         $db = new dbConnection();
         //get forms
         $res = $db->exec_sp("getForms", array($this->name));
         if ($res === true) {
             while ($arr = $db->get_row_array()) {
                 $frm = new EcTable($this);
                 $frm->fromArray($arr);
                 //get fields
                 $frm->fetch();
                 //get options
                 if ($frm->number > 0) {
                     $this->tables[$frm->name] = $frm;
                 }
             }
             foreach ($this->tables as $tname => $tbl) {
                 foreach ($tbl->branches as $branch) {
                     $this->tables[$branch]->branchOf = $tname;
                 }
             }
         } else {
             return false;
         }
     }
 }
Beispiel #2
0
 public function fetch()
 {
     $db = new dbConnection();
     if ($this->name != "") {
         $db->exec_sp("getProject", array($this->name));
         if ($arr = $db->get_row_array()) {
             $this->fromArr($arr);
         }
         $db = new dbConnection();
         //get forms
         $res = $db->exec_sp("getForms", array($this->name));
         if ($res === true) {
             while ($arr = $db->get_row_array()) {
                 $frm = new EcTable($this);
                 $frm->fromArray($arr);
                 //get fields
                 $frm->fetch();
                 //get options
                 $this->tables[$frm->name] = $frm;
             }
         } else {
             return false;
         }
     }
 }