public static function sendWarningNoticeToUser(Warning $warning) { $user = UserDao::getUserByID($warning->userId); if ($warning->type == RES_WARNING_NOTE) { $body = "You have been issued a Notification, you can view it at: " . Config::location . "index.php?pageid=viewWarning&warnid=" . $warning->id; EmailUtil::sendEmail($user->email, "New Notification", $body); } else { $body = "You have been issued an " . $warning->getTypeString() . " Warning, you can view it at: " . Config::location . "index.php?pageid=viewWarning&warnid=" . $warning->id; EmailUtil::sendEmail($user->email, "New " . $warning->getTypeString() . " Warning Notice", $body); } }
/** * @see DatabaseObjectList::readObjects() */ public function readObjects() { // get ids $userWarningIDArray = $objectIDArray = $objects = array(); $sql = "SELECT\t\tuser_warning.userWarningID,\n\t\t\t\t\tuser_warning.objectID, user_warning.objectType\n\t\t\tFROM\t\twcf" . WCF_N . "_user_infraction_warning_to_user user_warning\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_infraction_warning warning\n\t\t\tON\t\t(warning.warningID = user_warning.warningID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user_table\n\t\t\tON\t\t(user_table.userID = user_warning.userID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user judge\n\t\t\tON\t\t(judge.userID = user_warning.judgeID)\n\t\t\t" . $this->sqlJoins . "\n\t\t\t" . (!empty($this->sqlConditions) ? "WHERE " . $this->sqlConditions : '') . "\n\t\t\t" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : ''); $result = WCF::getDB()->sendQuery($sql, $this->sqlLimit, $this->sqlOffset); while ($row = WCF::getDB()->fetchArray($result)) { $userWarningIDArray[] = $row['userWarningID']; if ($row['objectID'] != 0 && $row['objectType'] != '') { if (!isset($objectIDArray[$row['objectType']])) { $objectIDArray[$row['objectType']] = array(); } $objectIDArray[$row['objectType']][] = $row['objectID']; } } if (count($userWarningIDArray)) { // get warning objects foreach ($objectIDArray as $objectType => $idArray) { if (($result = Warning::getWarningObjectByID($objectType, $idArray)) !== null) { $objects[$objectType] = $result; } } // get warnings $sql = "SELECT\t\t" . (!empty($this->sqlSelects) ? $this->sqlSelects . ',' : '') . "\n\t\t\t\t\t\tuser_table.username, judge.username AS judgeUsername,\n\t\t\t\t\t\twarning.*, user_warning.*\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_infraction_warning_to_user user_warning\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user_infraction_warning warning\n\t\t\t\tON\t\t(warning.warningID = user_warning.warningID)\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user_table\n\t\t\t\tON\t\t(user_table.userID = user_warning.userID)\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user judge\n\t\t\t\tON\t\t(judge.userID = user_warning.judgeID)\n\t\t\t\t" . $this->sqlJoins . "\n\t\t\t\tWHERE\t\tuser_warning.userWarningID IN (" . implode(',', $userWarningIDArray) . ")\n\t\t\t\t" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : ''); $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if (isset($objects[$row['objectType']]) && isset($objects[$row['objectType']][$row['objectID']])) { $row['object'] = $objects[$row['objectType']][$row['objectID']]; } $this->userWarnings[] = new UserWarning(null, $row); } } }
function IsEmptySelectByValue($value, $label = null, $modul = null, $sub_modul = null, $css = 'notebox-alert') { if (isset($value) && trim($value) == '') { if (!is_null($modul) && !is_null($sub_modul) && !is_null($label)) { Warning::SendAlert('empty_input', array($label), $modul, $sub_modul, $css); } return true; } else { return false; } }
/** * * @param \webignition\CssValidatorOutput\Message\Error $error * @return \webignition\CssValidatorOutput\Message\Warning */ public static function fromError(Error $error) { $warning = new Warning(); $warning->setContext($error->getContext()); $warning->setLineNumber($error->getLineNumber()); $warning->setMessage($error->getMessage()); $warning->setRef($error->getRef()); return $warning; }
/** * @see Page::readData() */ public function readData() { parent::readData(); // get predefined warnings $this->warnings = Warning::getWarnings(); // get warning object if ($this->userWarning->objectID != 0 && $this->userWarning->objectType != '') { $this->object = Warning::getWarningObjectByID($this->userWarning->objectType, $this->userWarning->objectID); } // get default values if (!count($_POST)) { $this->warningID = $this->userWarning->warningID; $this->title = $this->userWarning->title; $this->points = $this->userWarning->points; $this->reason = $this->userWarning->reason; if ($this->userWarning->expires != 0) { $expires = DateUtil::getLocalTimestamp($this->userWarning->expires); $this->expiresDay = gmdate('j', $expires); $this->expiresMonth = gmdate('n', $expires); $this->expiresYear = gmdate('Y', $expires); $this->expiresHour = gmdate('G', $expires); $this->expiresMinute = gmdate('i', $expires); $this->expiresMinute -= $this->expiresMinute % 5; } } }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); InlineCalendar::assignVariables(); WCF::getTPL()->assign(array('userWarnings' => $this->userWarningList->getObjects(), 'deletedUserWarningID' => $this->deletedUserWarningID, 'username' => $this->username, 'judge' => $this->judge, 'warningID' => $this->warningID, 'status' => $this->status, 'fromDay' => $this->fromDay, 'fromMonth' => $this->fromMonth, 'fromYear' => $this->fromYear, 'untilDay' => $this->untilDay, 'untilMonth' => $this->untilMonth, 'untilYear' => $this->untilYear, 'availableWarnings' => Warning::getWarnings())); }
/** * @see Page::readData() */ public function readData() { parent::readData(); // get predefined warnings $this->warnings = Warning::getWarnings(); }