Esempio n. 1
0
 /**
  * Runs all the set hooks for the given problem. 
  */
 function run_hooks()
 {
     $sub = SubmissionTable::get_submission($this->id);
     $this->info['problem'] = $sub->problemid;
     $xml = new DOMDocument();
     $xml_path = ProblemTable::get_problem_xml_file($sub->problemid);
     if (empty($xml_path) or !is_file($xml_path)) {
         return;
     }
     $xml->load($xml_path);
     $xp = new DOMXPath($xml);
     $res = $xp->query("/problem/hook");
     foreach ($res as $hook) {
         $this->run_single_hook($hook->nodeValue);
     }
     /* run hooks on the submission file */
     $xml = new DOMDocument();
     $xml_path = SubmissionTable::get_submission_xml_file($this->id);
     if (empty($xml_path) or !is_file($xml_path)) {
         return;
     }
     $xml->load($xml_path);
     $xp = new DOMXPath($xml);
     $res = $xp->query("/submission/hook");
     foreach ($res as $hook) {
         $this->run_single_hook($hook->nodeValue);
     }
 }