public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'Autoassigner.php'); // TODO: PULSE! echo "<html><head><title>AUTOASSIGNER TEST MODE</title></head><body><pre>\n\n"; echo "AUTOASSIGNER 1970s MODE\n\n"; try { $assigner = new Autoassigner(Term::getSelectedTerm()); $assigner->autoassign(); } catch (Exception $e) { echo "EXCEPTION CAUGHT: " . $e->getMessage() . "<br /><br />\n\n"; var_dump($e->getTrace()); } echo "</pre></body></html>\n\n"; exit(0); }
public static function execute() { PHPWS_Core::initModClass('hms', 'HMS.php'); PHPWS_Core::initModClass('hms', 'Autoassigner.php'); ob_start(); echo "<html><head><title>AUTOASSIGNER - SCHEDULED BY PULSE</title></head><body><pre>\n\n"; echo "AUTOASSIGNER 1970s MODE\n\n"; try { $assigner = new Autoassigner(Term::getSelectedTerm()); $assigner->autoassign(); } catch (Exception $e) { echo "EXCEPTION CAUGHT: " . $e->getMessage(); } echo "</pre></body></html>\n\n"; $message = ob_get_contents(); ob_end_clean(); // TODO: Email the person that scheduled the autoassign. mail(HMS_AUTOASSIGN_EMAIL, 'Autoassign Complete', $message); return TRUE; }
public function run() { global $Conf, $Me, $Qreq, $SSel, $pcsel, $badpairs, $scoreselector; assert($this->ok); session_write_close(); // this might take a long time set_time_limit(240); // prepare autoassigner if ($Qreq->seed && is_numeric($Qreq->seed)) { srand((int) $Qreq->seed); } $this->autoassigner = $autoassigner = new Autoassigner($SSel->selection()); if ($Qreq->pctyp === "sel") { $n = $autoassigner->select_pc(array_keys($pcsel)); if ($n == 0) { Conf::msg_error("Select one or more PC members to assign."); return null; } } if ($Qreq->balance === "all") { $autoassigner->set_balance(Autoassigner::BALANCE_ALL); } foreach ($badpairs as $cid1 => $bp) { foreach ($bp as $cid2 => $x) { $autoassigner->avoid_pair_assignment($cid1, $cid2); } } if ($Qreq->method === "random") { $autoassigner->set_method(Autoassigner::METHOD_RANDOM); } else { $autoassigner->set_method(Autoassigner::METHOD_MCMF); } $autoassigner->add_progressf(array($this, "progress")); $this->live = true; echo '<div id="propass" class="propass">'; $this->start_at = microtime(true); if ($this->atype === "prefconflict") { $autoassigner->run_prefconflict($Qreq->t); } else { if ($this->atype === "clear") { $autoassigner->run_clear($this->reviewtype); } else { if ($this->atype === "lead" || $this->atype === "shepherd") { $autoassigner->run_paperpc($this->atype, $Qreq["{$this->atype}score"]); } else { if ($this->atype === "revpc") { $autoassigner->run_reviews_per_pc($this->reviewtype, $Qreq->rev_roundtag, cvtint($Qreq->revpcct)); } else { if ($this->atype === "revadd") { $autoassigner->run_more_reviews($this->reviewtype, $Qreq->rev_roundtag, cvtint($Qreq->revaddct)); } else { if ($this->atype === "rev") { $autoassigner->run_ensure_reviews($this->reviewtype, $Qreq->rev_roundtag, cvtint($Qreq->revct)); } else { if ($this->atype === "discorder") { $autoassigner->run_discussion_order($this->discordertag); } } } } } } } if ($this->live) { echo $this->result_html(), "</div>\n"; } else { PaperList::$include_stash = false; $result_html = $this->result_html(); echo Ht::take_stash(), '<script>$$("propass").innerHTML=', json_encode($result_html), ";</script>\n"; } if ($this->autoassigner->assignments()) { $Conf->footer(); exit; } }