Skip to content

CAP Processor alert

Niklas Spanring edited this page Oct 17, 2016 · 1 revision

Table of Contents

alertBlock

The alertBlock Class initializes the alert part of a CAP

Variables:

  $alert->identifier; // WMO Organisation ID green -> Your Country ISO Code -> Your File Date/Time "YYMMDDHHMMSS" -> your warning ID (CHAR max Len: 20 / special characters are not allowed only a-Z 0-9 and "_") -> 2.49.0.3.0.AT.150112080000.52550478
  $alert->sender; // link to Homepage Guaranteed by assigner to be unique globally
  $alert->sent; // <yyyy>-<MM>-<dd>T<HH>:<mm>:<ss>+<hour>:<min><P> Offset to UTC (e.g. CET: +01:00; CEST: +02:00) -> 2014-07-15T06:03:02+01:00
  $alert->status; // Actual / Test / Exercise / System / Test / Draft
  $alert->msgType; // Alert / Update / Cancel / Ack / Error
  $alert->source;
  $alert->scope; // Public / Restricted / Private
  $alert->restriction;
  $alert->addresses;
  $alert->code = array();
  $alert->note;
  $alert->references; // web / identifier / sent [from the older Cap (only fore Update and Cancel)] -> http://www.zamg.ac.at/warnsys/public/aus_all.html,2.49.0.3.0.AT.150115080000.52550477,2015-01-08T10:05:02+01:00
  $alert->incidents;
  $alert->info = array();
  $alert = $cap->addAlert();

getIdentifier()

returns the identifier

The identifier of the alert message (REQUIRED)
(1)   A number or string uniquely identifying this message, assigned by the sender.
(2)   MUST NOT include spaces, commas or restricted characters (< and &)
  $alert->getIdentifier();

setIdentifier($val)

sets the value of the identifier

The identifier of the alert message (REQUIRED)
(1)   A number or string uniquely identifying this message, assigned by the sender.
(2)   MUST NOT include spaces, commas or restricted characters (< and &)
  $alert->setIdentifier('IDENTIFIER');

getSender()

returns the sender

The identifier of the sender of the alert message (REQUIRED)
(1)   Identifies the originator of this alert. Guaranteed by assigner to be unique globally; e.g., may be based on an Internet domain name.
(2)   MUST NOT include spaces, commas or restricted characters (< and &).
  $alert->getSender();

setSender($val)

sets the value of the sender

The identifier of the sender of the alert message (REQUIRED)
(1)   Identifies the originator of this alert. Guaranteed by assigner to be unique globally; e.g., may be based on an Internet domain name.
(2)   MUST NOT include spaces, commas or restricted characters (< and &).
  $alert->setSender('SENDER');

getSent()

returns the sent time

The time and date of the origination of the alert message (REQUIRED)
(1) The date and time SHALL be represented in the DateTime Data Type (See Implementation Notes) format (e.g., "2002-05-24T16:49:00-07:00" for 24 May 2002 at 16:49 PDT).
(2) Alphabetic timezone designators such as “Z” MUST NOT be used.  The timezone for UTC MUST be represented as “-00:00”.
  $alert->getSender();

setSent($val)

sets the value of the send time

This method uses strtotime() to convert a given time string to the CAP DateTime

posible values:

  2002-05-24T16:49:00-07:00
  24 May 2002 at 16:49 PDT
  now + 1 day + 1 hour + 1 min + 1 sec
The time and date of the origination of the alert message (REQUIRED)
(1) The date and time SHALL be represented in the DateTime Data Type (See Implementation Notes) format (e.g., "2002-05-24T16:49:00-07:00" for 24 May 2002 at 16:49 PDT).
(2) Alphabetic timezone designators such as “Z” MUST NOT be used.  The timezone for UTC MUST be represented as “-00:00”.
  $alert->setSent('2002-05-24T16:49:00-07:00');

getStatus()

returns the status

The code denoting the appropriate handling of the alert message (REQUIRED)
  Actual - Actionable by all targeted recipients
  Exercise - Actionable only by designated exercise participants; exercise identifier SHOULD appear in <note>
  System - For messages that support alert network internal functions
  Test - Technical testing only, all recipients disregard
  Draft – A preliminary template or draft, not actionable in its current form
  $alert->getStatus();

setStatus($val)

sets the value of the status

This method will return false if not one of thes values is used:

The code denoting the appropriate handling of the alert message (REQUIRED)
  Actual - Actionable by all targeted recipients
  Exercise - Actionable only by designated exercise participants; exercise identifier SHOULD appear in <note>
  System - For messages that support alert network internal functions
  Test - Technical testing only, all recipients disregard
  Draft – A preliminary template or draft, not actionable in its current form
  $alert->setStatus('POS_VALUE');

getMsgType()

returns the MsgType

The code denoting the nature of the alert message (REQUIRED)
  Alert - Initial information requiring attention by targeted recipients
  Update - Updates and supercedes the earlier message(s) identified in <references>
  Cancel - Cancels the earlier message(s) identified in <references>
  Ack - Acknowledges receipt and acceptance of the message(s) identified in <references>
  Error - Indicates rejection of the message(s) identified in <references>; explanation SHOULD appear in <note>
  $alert->getMsgType();

setMsgType($val)

sets the value of the MsgType

This method will return false if not one of thes values is used:

The code denoting the nature of the alert message (REQUIRED)
  Alert - Initial information requiring attention by targeted recipients
  Update - Updates and supercedes the earlier message(s) identified in <references>
  Cancel - Cancels the earlier message(s) identified in <references>
  Ack - Acknowledges receipt and acceptance of the message(s) identified in <references>
  Error - Indicates rejection of the message(s) identified in <references>; explanation SHOULD appear in <note>
  $alert->setMsgType('POS_VALUE');

getSource()

returns the Source

The text identifying the source of the alert message (OPTIONAL)
The particular source of this alert; e.g., an operator or a specific device.
  $alert->getSource();

setSource($val)

sets the value of the Source

The text identifying the source of the alert message (OPTIONAL)
The particular source of this alert; e.g., an operator or a specific device.
  $alert->setSource('SOURCE');

getScope()

returns the Scope

The code denoting the intended distribution of the alert message (REQUIRED)
  Public - For general dissemination to unrestricted audiences
  Restricted - For dissemination only to users with a known operational requirement (see <restriction>, below)
  Private - For dissemination only to specified addresses (see <addresses>, below)
  $alert->getScope();

setScope($val)

sets the value of the Scope

This method will return false if not one of thes values is used:

The code denoting the intended distribution of the alert message (REQUIRED)
  Public - For general dissemination to unrestricted audiences
  Restricted - For dissemination only to users with a known operational requirement (see <restriction>, below)
  Private - For dissemination only to specified addresses (see <addresses>, below)
  $alert->setScope('POS_VALUE');

getRestriction()

returns the Restriction

The text describing the rule for limiting distribution of the restricted alert message (CONDITIONAL)
Used when <scope> value is "Restricted".
  $alert->getSource();

setRestriction($val)

sets the value of the Restriction

The text describing the rule for limiting distribution of the restricted alert message (CONDITIONAL)
Used when <scope> value is "Restricted".
  $alert->setRestriction('SOURCE');

getAddresses()

returns the Addresses

The group listing of intended recipients of the alert message (CONDITIONAL)
(1)   Required when <scope> is “Private”, optional when <scope> is “Public” or “Restricted”.
(2)   Each recipient SHALL be identified by an identifier or an address.
(3)   Multiple space-delimited addresses MAY be included.  Addresses including whitespace MUST be enclosed in double-quotes.
  $alert->getAddresses();

setAddresses($val)

sets the value of the Addresses

The group listing of intended recipients of the alert message (CONDITIONAL)
(1)   Required when <scope> is “Private”, optional when <scope> is “Public” or “Restricted”.
(2)   Each recipient SHALL be identified by an identifier or an address.
(3)   Multiple space-delimited addresses MAY be included.  Addresses including whitespace MUST be enclosed in double-quotes.
  $alert->setAddresses('ADDRESSES');

getCode()

returns the Code

The code denoting the special handling of the alert message (OPTIONAL)
(1)   Any user-defined flag or special code used to flag the alert message for special handling.
(2)   Multiple instances MAY occur.
  $alert->getCode();

setCode($val, $index = false)

sets the value of the Code

if $index is set the Code with this index will be edited

The code denoting the special handling of the alert message (OPTIONAL)
(1)   Any user-defined flag or special code used to flag the alert message for special handling.
(2)   Multiple instances MAY occur.
  $alert->setCode('CODE', INDEX_NUMBER);

getNote()

returns the Note

The text describing the purpose or significance of the alert message (OPTIONAL)
The message note is primarily intended for use with <status> “Exercise” and <msgType> “Error”.
  $alert->getCode();

setNote($val)

sets the value of the Note

The text describing the purpose or significance of the alert message (OPTIONAL)
The message note is primarily intended for use with <status> “Exercise” and <msgType> “Error”.
  $alert->setNote('NOTE');

getReferences()

returns the Note

The group listing identifying earlier message(s) referenced by the alert message (OPTIONAL)
(1)   The extended message identifier(s) (in the form sender,identifier,sent) of an earlier CAP message or messages referenced by this one.
(2)   If multiple messages are referenced, they SHALL be separated by whitespace.
  $alert->getIncidents();

setReferences($val)

sets the value of the References

The group listing identifying earlier message(s) referenced by the alert message (OPTIONAL)
(1)   The extended message identifier(s) (in the form sender,identifier,sent) of an earlier CAP message or messages referenced by this one.
(2)   If multiple messages are referenced, they SHALL be separated by whitespace.
  $alert->setReferences('REFERENC');

getIncidents()

returns the Incidents

The group listing naming the referent incident(s) of the alert message (OPTIONAL)
(1)   Used to collate multiple messages referring to different aspects of the same incident.
(2)   If multiple incident identifiers are referenced, they SHALL be separated by whitespace.  Incident names including whitespace SHALL be surrounded by double-quotes.
  $alert->getIncidents();

setIncidents($val)

sets the value of the Incidents

The group listing naming the referent incident(s) of the alert message (OPTIONAL)
(1)   Used to collate multiple messages referring to different aspects of the same incident.
(2)   If multiple incident identifiers are referenced, they SHALL be separated by whitespace.  Incident names including whitespace SHALL be surrounded by double-quotes.
  $alert->getIncidents('INCIDENTS');

getInfo($index)

returns the instanz of the infoBlock on the given index (default: 0)

setInfo($index = false)

create a new infoBlock instanz at the given index

this will create a new info block part of the cap

  $cap->setInfo();

addInfo($index = false)

redirect of setInfo()

  $cap->addInfo();
Clone this wiki locally