Shortcodes

Shortcodes - What are they? 

Shortcodes are small bits of code that allow you to do various things with little effort. They allow you to implement functionality that would normally require complicated code to use.

Shortcodes are tied to predefined elements and can be used throughout the system with minimal effort.

Articles detailing different shortcodes available for use are located here.

Form 11 Shortcodes

Information

When issuing a Form 11, there are a number of shortcodes that can be placed in the template to auto-fill values relating to the violation.

The base short code is formatted like:

The blank value must be filled with a value to pull from the violation info.

For each nested value in the data packet, the packet name must be added as part of the variable name, each part separated by a period, with the variable to be output by the shortcode as the final part of the variable.

The packet itself is called by 'violation', and the name must be placed at the start of any value call.

Violation Packet

The violation info packet is formatted like this example.

The values on the left are the variable names, the values on the right are the example values returned by this packet.

{
    "ViolationID": 237,
    "SemPermitID": null,
    "Ticket": "TT-19026",
    "VehicleID": 5,
    "Spoiled": 0,
    "TicketType": 1,
    "Issued": "2024-07-17 16:11:00",
    "convNotice": null,
    "Due": "2024-07-27 16:11:00",
    "ViolationTypeID": -1,
    "Fine": "50.0000",
    "AdjustedFine": "20.0000",
    "Towing": "0.0000",
    "taxAmount": "0.0000",
    "Writer": 7,
    "LocationID": 10,
    "Comment": null,
    "TicketAppeal": null,
    "appealType": 0,
    "appealFormat": null,
    "AccessAdminID": 50,
    "ActionedPer": null,
    "Created": "2024-07-17 20:12:08",
    "AppealUserID": 0,
    "AppealProcessDate": null,
    "AppealAdminID": 0,
    "AppealComment": null,
    "AppealAdminComment": null,
    "AutoNotice": 0,
    "ProcessedByCollection": null,
    "SentToCollections": null,
    "PrivateComments": "",
    "DriveAway": 0,
    "UUID": null,
    "VioNotice": null,
    "latitude": null,
    "longitude": null,
    "Warning": null,
    "userid": null,
    "incidentID": null,
    "failToIdentify": null,
    "pin": "YL",
    "duplicate": null,
    "AdjustmentReason": null,
    "notices_count": 1,
  
    "user_info": {
            "UserID": 5,
            "studentNo": null,
            "employNo": "00800147",
            "username": "mashbury",
            "firstName": "Michael",
            "preferredname": null,
            "lastName": "Ashbury",
            "street": "688 Zaproxy Ridge",
            "city": "East Romaineburgh",
            "prov": 9,
            "postal": "K2G5B1",
            "email": "mash-bury@tomahawk.ca",
            "display_name": "Michael Ashbury",
            "account_no": "00800147",
            "prov_name": "Ontario",
    },
  
    "writer": {
            "AdminAccessID": 7,
            "Username": "admin",
            "DisplayName": "Administrator"
    },
  
    "vehicle": {
            "VehicleID": 5,
            "Active": 1,
            "Plate": "MASH",
            "Year": 1998,
            "TotalVio": 12,
            "TotalUnpaid": 2,
            "TotalWarning": 0,
            "vehicleAlert": true,
            "vin": "JNAMA43H9XGE50339",
            "electric_vehicle": false,
          
            "province": {
                    "ProvName": "West Virginia",
                    "ProvCode": "WV",
            },

            "make": {
                  "MakeName": "Toyota"
            },
            
            "colour": {
                  "ColourName": "Black"
            },
            
            "plate_type": {
                  "TypeName": " Passenger"
            }
        
            "vehicle_type": {
                  "TypeName": " Van"
            },
      
    },
  
    "location": {
            "LocationID": 10,
            "LocationName": "Hospital & Administration Building",
    },
  
    "details": {
            "ViolationsDetailID": 359,
            "ViolationID": 237,
            "Ticket": "TT-19026",
            "ViolationTypeID": 16,
            "LocationID": 10,
            "offenceFine": 50,
            "discountFlag": 1,
            "discountAmount": 20,
            "discountHours": 240,
          
            "type": {
                    "ViolationTypeID": 16,
                    "ViolationDescr": "No Parking Snow Route - Mandatory Towing",
                    "DefaultCost": 50,
                    "discountFlag": true,
                    "discountAmount": 20,
                    "discountHours": 240,
            }
    }
}

Examples

An example shortcode is provided for each section. To return a specific value in the same section, replace the provided variable name with the sibling value wanted for output.

Example Shortcode
Description

[values show=violation.Ticket]

Returns the violation ticket number.
[values show=violation.user_info.username] Returns the username of the user the violation belongs to.
[values show=violation.writer.DisplayName] Returns the display name of the admin who assigned the violation to the user.
[values show=violation.vehicle.Plate] Returns the plate of the vehicle the violation was assigned to, if applicable.
[values show=violation.vehicle.province.ProvName] Returns the province or state of the vehicle plate.
[values show=violation.vehicle.colour.ColourName] Returns the colour of the vehicle.
[values show=violation.vehicle.plate_type.TypeName] Returns the plate type of the vehicle.
[values show=violation.vehicle.vehicle_type.TypeName] Returns the type of the vehicle.
[values show=violation.vehicle.make.MakeName] Returns the make of the vehicle.
[values show=violation.location.LocationName] Returns the name of the location the infraction happened.
[values show=violation.details.0.Ticket] Returns the violation ticket number. Alternate value location.
[values show=violation.details.0.type.ViolationDescr] Returns the violation type description.

User_card Shortcode

How to use the Shortcode

To use the User_card shortcode simply add [user_card] anywhere to the content of your Page or System Message.  

Example

Using the [user_card] shortcode will display useful user information as seen below. 

image.png

User Information Shortcodes

Shortcodes

Shortcodes used to display user information.

Keep in mind that the shortcode descriptions are also on the email template page for lost passwords. 

Shortcode
Description
 [user show="firstname"] The first name of the user account receiving the email or messaging. 
 [user show="lastname"] The last name of the user account receiving the email or messaging. 
 [user show="email"] The email address of the user account receiving the email or messaging. 
 [user show="username"] The username of the user account receiving the email or messaging. 
 [user show="salutation"] The salutation of the user account receiving the email or messaging. 











System_code Shortcode

Special System_Code Shortcode

The system_code is the most common short code used on the OPS-COM system. It will provide and display the system information related to that page.

For example, if you were to add the system_code shortcode to the end of the Permits page you will see system information related to permits such as available permits and lots. 

If the page is a system page, like /login, and it doesn't have the shortcode anywhere, it will append it to the bottom of the content page at least once.

Example Uses

Vehicles Page 

Using the system_code tag on the Vehicles page will show you all of the vehicles you have registered to that user. 

image.png

Permits Page

Using the system_code tag on the Permits page will provide information related to all the permits and lots your users have available to them.  

image.png

As an option, on the permits page, you can display the current permits the user has. Using the shortcode [permit_card] on the permits page will display the list of the user's current permits. In fact, using this code on whatever page you wish it to be on, will show the permit_card which is the list of current permits.

image.png

Here is the resulting page content.

image.png


Appeals Page

Using the system_code tag on the Appeals page will provide a convenient search window to search for plates or tickets. 

image.png

PermitTempPdf and Conditional Shortcode

PermitTempPdf Shortcode

The use of permittemppdf is fairly straight forward.

The shortcode has two different arguments it can accept to change the information it will output: permit and vehicle.

 

Permit

Shortcode format:

The options to fill the blank space are:

Expiry will show a snippet of html that is not editable because of the complexity of the expiry information.

 

Vehicle

Shortcode format:

The options to fill the blank space are:


Conditional Shortcode

The conditional shortcode is somewhat complex.

It will only work with shortcodes that have been set it up for. Right now, that only includes the permittemppdf shortcode.

The formats that can be used are as follows:

This will test the value of ******. If the value is a success, then it will show the CONTENT.

The options for var currently are:

For example, to test if there are hours on a temp permit, the value would be: var=permittemp.hours

This is the variable name that has been defined (permittemp) and the case-sensitive column to return the information of.

The second argument "test" can take the following values:

Lot Information Shortcode

Lot Information Display

This shortcode can be used anywhere on the site. It does not need to be initialized. You simply need to add it to your template to display it.

The available options are: 

Option Type Default Purpose
price boolean true Shows the price. Set to false/off/0 etc. to turn off
sold_out boolean false If true, it will include the lots that are sold out. They will have the warning background to highlight they are sold out
remaining boolean false If true, it will show a column for how many remaining permits are in this lot
type string
If a value is set, it will filter the list to only show this lot type. Blank, or not set, will show all


[permitlots remaining=true sold_out=true price=true]

In the example above, this shortcode would display all lots even if they are sold out, the price of the permits for that lot, and the total number spaces in the lots.  Refer to the screenshot below.

image.png