/** * Method used to update a round robin entry in the system. * * @access public * @return integer 1 if the update worked, -1 otherwise */ function update() { global $HTTP_POST_VARS; $blackout_start = $HTTP_POST_VARS['blackout_start']['Hour'] . ':' . $HTTP_POST_VARS['blackout_start']['Minute'] . ':00'; $blackout_end = $HTTP_POST_VARS['blackout_end']['Hour'] . ':' . $HTTP_POST_VARS['blackout_end']['Minute'] . ':00'; $stmt = "UPDATE\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_round_robin\n SET\n prr_prj_id=" . Misc::escapeInteger($HTTP_POST_VARS["project"]) . ",\n prr_blackout_start='" . Misc::escapeString($blackout_start) . "',\n prr_blackout_end='" . Misc::escapeString($blackout_end) . "'\n WHERE\n prr_id=" . Misc::escapeInteger($HTTP_POST_VARS["id"]); $res = $GLOBALS["db_api"]->dbh->query($stmt); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return -1; } else { // remove all of the associations with users, then add them all again Round_Robin::removeUserAssociations($HTTP_POST_VARS['id']); foreach ($HTTP_POST_VARS['users'] as $usr_id) { Round_Robin::addUserAssociation($HTTP_POST_VARS['id'], $usr_id); } return 1; } }