Editor's Choice

In all our components you can use three comment systems: Onis, Facebook and Disqus.

comment preferences

Preferences: list of available comment systems.

First thing to do is to make sure that comments are enabled and that one of the comment systems is selected. Below you can see how to use the comment systems.


Onis comments

This is the default comments system used in all our components and can be used by registered users.

comment default

Onis comments, default style.

Users can use 500 characters for a comment and if it moderation of comments is enabled, administrator of the site can approve or not the comment. If it is approved and published other users can rate or report the comment. They can also reply with 500 characters. Administrator or the user who posted the comment can remove it. The comment is not actually removed, it is just unpublished and can be removed forever from the backend.

API example

jimport('oniscore.comment'); //import comments libraries
$commentsModel = onisCore::getModel('comments'); //get comments model
$comments      = $commentsModel->comments($petition->id, 'petition', '1', CCOMPONENT);
$pagination    = $commentsModel->getPagination();

$commentsHTML  = onisComment::commentsHTML($petition->id, 'petition', $comments, $pagination, CCOMPONENT);

How to use the model:

$commentsModel->comments($id = null, $item = null, $state = null, $component, $limit = null, $limitstart = null);
  • $id - unique, numerical item id;
  • $item - unique item name;
  • $state - comment state;
  • $component - component name;
  • $limit - number of comments to show;
  • $limitstart - comment number to start from;

Generate the HTML code:

onisComment::commentsHTML($itemid, $item, $comments, $pagination = null, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $comments - comments list from model;
  • $pagination - comments pagination from model;
  • $component - component name;

You can change HTML code here:

components/component_name/templates/default/comments.onis.list.php

Backend

comment backend

 On the backend the administrator can see the list of comments for every component as long with some details of the comment.

  • comment - text of the comment;
  • item - name of the commented item;
  • user - name of the user that commented the item;
  • date - date when the item was commented;
  • status - current status of the comment, can be under moderation(purple), published(green) or unpublished(orange) and also from here the comment can be removed(red);
  • id - unique, numerical comment id;

Facebook comments

To use the Facebook comments you need an app ID, you can check here how to get it if you don`t have one yet. After you get your app ID you need to copy-paste it on the field from the backend. You can also add admins to moderate the comments, just write the Facebook user id on the field from backend.

comment facebook preferences

Preferences: Facebook comments preferences.

You can find the Facebook comments Javascript here:

libraries/oniscore/comment.php

and HTML here:

components/component_name/templates/default/comments.facebook.list.php

In both these files you can edit the Facebook comments. You can find more settings and configurations tips on the official docs page.


Disqus comments

If you want to use the Disqus comments you need to register for an application here then create a new site here. After you created your new site on Disqus that will give you a new unique shortname, for example: shortdis.disqus.com, where shortdis is your shortname that you need to write in the field from the backend.

comment disqus preferences

Preferences: Disqus comments preferences.

You can find more JavaScript variables on the official page and you can change them here:

components/component_name/templates/default/comments.facebook.list.php

Editor's Choice

With reports API you can generate a link or button, depending on the classes that you are using, that will allow users to report an item.

report mod

Report modal.


API example

jimport('oniscore.report'); //import reports libraries

$reportsHTML  = onisReport::report((int)$petition->id, 'petition', 'btn btn-xs btn-default', false, CCOMPONENT);

Generate the HTML code:

onisReport::report($itemid, $item, $class = NULL, $title = TRUE, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css classes for the button;
  • $title - if true, show button title;
  • $component - component name;

You can change HTML code here:

components/component_name/templates/default/report.mod.php

When reporting an item, users have the option to write the reason why they are reporting the item.


Backend

report backend

 On the backend the administrator can see the list of reports for every component as long with some details of the report.

  • reason - reason of the report, can be empty;
  • item - name of the reported item;
  • user - name of the user that reported the item;
  • date - date when the item was reported;
  • status - current status of the report, can be solved(green) or unsolved(orange) and also from here the report can be removed(red);
  • id - unique, numerical report id;
Editor's Choice

With favorites API you can generate a link or button, depending on the classes that you are using, that will allow users to favorite an item.

favorite

Left: Item can be favorited. Right: Item is favorited, can be unfavorited.


API example

jimport('oniscore.favorite'); //import favorites libraries

$favoritesHTML  = onisFavorite::favorite((int)$petition->id, 'petition', 'btn btn-xs btn-default', CCOMPONENT);

Generate the HTML code:

onisFavorite::favorite($itemid, $item, $class = NULL, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css classes for the button;
  • $component - component name;

You can change HTML code here:

libraries/oniscore/favorite.php

Editor's Choice

With images API you can generate the image and the image gallery for an item and also the upload forms for both of them.

image

Left: Default image with the "edit" button. Right: Image with "edit" button.

image gallery

Up: Default image gallery with no images and the "add images" button. Down: Default image gallery with images and the "add images" button. 


API example

Item image
jimport('oniscore.image'); //import images libraries

$imageHTML  = onisImage::imageHTML($petition, 'petition', CCOMPONENT);

Generate the HTML code:

onisImage::imageHTML($itemData, $item, $component);
  • $itemData - item data;
  • $item - unique item name;
  • $component - component name;

You can change HTML code here:

components/component_name/templates/default/images.item.php

Item image gallery
jimport('oniscore.image'); //import images libraries

$galleryHTML  = onisImage::galleryHTML($petition, 'petition', CCOMPONENT);

Generate the HTML code:

onisImage::galleryHTML($itemData, $item, $component);
  • $itemData - item data;
  • $item - unique item name;
  • $component - component name;

You can change HTML code here:

components/component_name/templates/default/images.gallery.php


Preferences

image preferences

From the component preferences you can change a few options about the image and image gallery:

  • image folder - folder where item image will be uploaded;
  • max image size - maximum file size of the image an user can upload for the item, not bigger than the upload_max_filesize defined in your php.ini;
  • gallery images folder - folder where gallery images will be uploaded;
  • gallery image size - maximum file size of each image an user can upload in the gallery, not bigger than the upload_max_filesize defined in your php.ini;
  • gallery images limit - maximum number of images an user can upload, 0 for unlimited;
Editor's Choice

With promotes API you can generate a link or button, depending on the classes that you are using, that will allow administrators to promote an item.

promote

Left: Item can be promoted. Right: Item is promoted, can be unpromoted.


API example

jimport('oniscore.promote'); //import promotes libraries

$promotesHTML  = onisPromote::promote((int)$petition->id, 'petition', 'btn btn-xs btn-default', CCOMPONENT);

Generate the HTML code:

onisPromote::promote($itemid, $item, $class = NULL, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css class for the button;
  • $component - component name;

You can change HTML code here:

libraries/oniscore/promote.php

When an item is promoted it will be added on the mainpage of the component, if more items are promoted there will be a carousel with all the promoted items. The HTML code for the promoted items can be found here:

components/component_name/templates/default/item.promoted.list.php

promote carousel

Carousel with promoted items.

Editor's Choice

onisCore contains libraries, plugins, modules and the component which helps all Onis components to run, it has most of the functions needed by the components and also the CSS and JS files.

The most important APIs that you can find and use are:

Editor's Choice

With ratings API you can generate links or buttons, depending on the classes that you are using, that will allow users to rate an item. It can be used only with the like button or it can be used with the dislike button.

rating

Left: Default rating style. Center: Item is liked, can be disliked or remove the like. Right: Item is disliked, can be liked or remove the dislike.

rating dislike disabled

Left: Default rating style, dislike disabled. Right: Item is liked, can be unliked.


API example

jimport('oniscore.rating'); //import ratings libraries

$ratingsHTML  = onisRating::rating((int)$petition->id, 'petition', 'btn btn-xs btn-default', CCOMPONENT);

Generate the HTML code:

onisRating::rating($itemid, $item, $class = NULL, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css classes for the button;
  • $component - component name;

You can change HTML code here:

libraries/oniscore/rating.php

To show the rating for an item you can use:

onisRating::ratingLabel($rating);
  • $rating - numerical rating count, can be negative;

Example:

$ratingCount     = onisRating::ratingCount((int)$petition->id, 'petition', CCOMPONENT);
$ratingLabelHTML = onisRating::ratingLabel($ratingCount);