Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

View File

@ -0,0 +1,140 @@
<?php
/**
* app/plugins/reviews/controllers/admin/reviews.php
*
* This is the reviews admin controller.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Controllers\Admin;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Houdini\Classes\Navigation;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Classes\AdminController;
use TheTempusProject\Models\Review;
use TheTempusProject\Models\Reviewcategory;
use TheTempusProject\Classes\Forms;
class Reviews extends AdminController {
protected static $reviews;
protected static $categories;
public function __construct() {
parent::__construct();
self::$title = 'Admin - Reviews';
self::$reviews = new Review;
self::$categories = new Reviewcategory;
$view = Navigation::activePageSelect( 'nav.admin', '/admin/reviews' );
Components::set( 'ADMINNAV', $view );
}
public function index( $data = null ) {
$reviews = Views::simpleView( 'reviews.admin.reviewList', self::$reviews->list() );
$categories = Views::simpleView( 'reviews.admin.categoryList', self::$categories->list() );
Components::set( 'reviews', $reviews );
Components::set( 'reviewCategories', $categories );
Views::view( 'reviews.admin.dashboard' );
}
public function categoryView( $id = null ) {
$category = self::$categories->findById( $id );
if ( ! $category ) {
Issues::add( 'error', 'Unknown Category.' );
return $this->index();
}
Views::view( 'reviews.admin.category', $category );
}
public function categoryCreate( ) {
if ( ! Input::exists( 'submit' ) ) {
return Views::view( 'reviews.admin.categoryCreate' );
}
if ( ! Forms::check( 'categoryCreate' ) ) {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
return Views::view( 'reviews.admin.categoryCreate' );
}
$result = self::$categories->create(
Input::post( 'name' ),
Input::post( 'slug' ),
);
if ( $result ) {
Issues::add( 'success', 'Your review category has been created.' );
return $this->index();
}
Issues::add( 'error', [ 'There was an unknown error submitting your data.' => Check::userErrors() ] );
Views::view( 'reviews.admin.categoryCreate' );
}
public function categoryEdit( $id = null ) {
$category = self::$categories->findById( $id );
if ( ! $category ) {
Issues::add( 'error', 'Unknown Category.' );
return $this->index();
}
if ( ! Input::exists( 'submit' ) ) {
return Views::view( 'reviews.admin.categoryEdit', $category );
}
if ( ! Forms::check( 'categoryEdit' ) ) {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
return Views::view( 'reviews.admin.categoryEdit', $category );
}
$result = self::$categories->update(
$id,
Input::post( 'name' ),
Input::post( 'slug' ),
);
if ( $result ) {
Issues::add( 'success', 'Your review category has been updated.' );
return $this->index();
}
Issues::add( 'error', [ 'There was an unknown error submitting your data.' => Check::userErrors() ] );
Views::view( 'reviews.admin.categoryEdit', $category );
}
public function categoryDelete( $id = null ) {
if ( self::$categories->delete( $id ) ) {
Issues::add( 'success', 'review category deleted' );
} else {
Issues::add( 'error', 'There was an error with your request.' );
}
$this->index();
}
public function reviewView( $id = null ) {
Views::view( 'reviews.admin.review', self::$reviews->findById( $id ) );
}
public function reviewApprove( $id = null ) {
if ( self::$reviews->approve( $id ) ) {
Issues::add( 'success', 'review approved' );
} else {
Issues::add( 'error', 'There was an error with your request.' );
}
$this->index();
}
public function reviewHide( $id = null ) {
if ( self::$reviews->hide( $id ) ) {
Issues::add( 'success', 'review hidden' );
} else {
Issues::add( 'error', 'There was an error with your request.' );
}
$this->index();
}
public function reviewDelete( $id = null ) {
if ( self::$reviews->delete( $id ) ) {
Issues::add( 'success', 'review deleted' );
} else {
Issues::add( 'error', 'There was an error with your request.' );
}
$this->index();
}
}

View File

@ -0,0 +1,89 @@
<?php
/**
* app/plugins/reviews/controllers/reviews.php
*
* This is the reviews controller.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Controllers;
use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Session;
use TheTempusProject\Houdini\Classes\Issues;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\Controller;
use TheTempusProject\Classes\Forms;
use TheTempusProject\Models\Review;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Template;
use TheTempusProject\Models\Reviewcategory;
use TheTempusProject\Houdini\Classes\Forms as HoudiniForms;
class Reviews extends Controller {
protected static $reviews;
protected static $categories;
public function __construct() {
self::$title = 'Reviews - {SITENAME}';
self::$pageDescription = 'On this page you can submit a reviews for a product from the site.';
if ( ! App::$isLoggedIn ) {
Session::flash( 'notice', 'You must be logged in to review products.' );
return Redirect::home();
}
parent::__construct();
self::$reviews = new Review;
self::$categories = new Reviewcategory;
Components::append( 'TEMPLATE_JS_INCLUDES', Template::parse('<script language="JavaScript" crossorigin="anonymous" type="text/javascript" src="{ROOT_URL}app/plugins/reviews/js/reviews.js"></script>' ) );
Components::append( 'TEMPLATE_CSS_INCLUDES', Template::parse('<link rel="stylesheet" href="{ROOT_URL}app/plugins/reviews/css/reviews.css" />') );
}
public function index() {
$reviews = Views::simpleView( 'reviews.list', self::$reviews->byUser() );
Components::set( 'reviews', $reviews );
Views::view( 'reviews.index' );
}
public function review( $slug = null ) {
$category = self::$categories->findBySlug( $slug );
if ( ! $category ) {
$selectedCategory = '0';
$reviewCategorySelect = HoudiniForms::getSelectHtml(
'review_category_id',
self::$categories->simple(),
$selectedCategory,
);
Components::set( 'reviewCategorySelect', $reviewCategorySelect );
} else {
$selectedCategory = $category->ID;
Components::set(
'reviewCategorySelect',
'<input type="hidden" name="review_category_id" id="review_category_id" value="' . $selectedCategory . '" />'
);
}
if ( ! Input::exists('submit') ) {
return Views::view( 'reviews.create' );
}
if ( ! Forms::check( 'createReview' ) ) {
Issues::add( 'error', [ 'There was an error with your review.' => Check::userErrors() ] );
return Views::view( 'reviews.create' );
}
$result = self::$reviews->create( Input::post('title'), Input::post('rating'), Input::post('review'), Input::post('review_category_id') );
if ( true === $result ) {
Session::flash( 'success', 'Your review has been received.' );
Redirect::to( 'home/index' );
} else {
Issues::add( 'error', 'There was an unresolved error while submitting your review.' );
return Views::view( 'reviews.create' );
}
}
}

View File

@ -0,0 +1,9 @@
.star-rating .fa-star {
font-size: 24px;
color: grey;
cursor: pointer;
}
.star-rating .fa-star.checked {
color: gold;
}

View File

@ -0,0 +1,93 @@
<?php
/**
* app/plugins/reviews/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Reviews;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Classes\Forms;
class ReviewForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'createReview', __CLASS__, 'createReview' );
self::addHandler( 'editReview', __CLASS__, 'editReview' );
self::addHandler( 'categoryCreate', __CLASS__, 'categoryCreate' );
self::addHandler( 'categoryEdit', __CLASS__, 'categoryEdit' );
}
/**
* Validates the createReview form.
*
* @return {bool}
*/
public static function createReview() {
if ( ! Input::exists( 'review' ) ) {
Check::addUserError( 'You must provide a review.' );
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must provide a title.' );
return false;
}
if ( ! Input::exists( 'rating' ) ) {
Check::addUserError( 'You must provide a rating.' );
return false;
}
if ( ! Input::exists( 'review_category_id' ) ) {
Check::addUserError( 'You must provide a review_category_id.' );
return false;
}
return true;
}
public static function editReview() {
if ( ! Input::exists( 'review' ) ) {
Check::addUserError( 'You must provide a review.' );
return false;
}
if ( ! Input::exists( 'title' ) ) {
Check::addUserError( 'You must provide a title.' );
return false;
}
if ( ! Input::exists( 'rating' ) ) {
Check::addUserError( 'You must provide a rating.' );
return false;
}
return true;
}
public static function categoryCreate() {
if ( ! Input::exists( 'name' ) ) {
Check::addUserError( 'You must provide a name.' );
return false;
}
if ( ! Input::exists( 'slug' ) ) {
Check::addUserError( 'You must provide a slug.' );
return false;
}
return true;
}
public static function categoryEdit() {
if ( ! Input::exists( 'name' ) ) {
Check::addUserError( 'You must provide a name.' );
return false;
}
if ( ! Input::exists( 'slug' ) ) {
Check::addUserError( 'You must provide a slug.' );
return false;
}
return true;
}
}
new ReviewForms;

View File

@ -0,0 +1,20 @@
$(document).ready(function() {
var $star_rating = $('.star-rating .fa-star');
var SetRatingStar = function() {
return $star_rating.each(function() {
if (parseInt($(this).siblings('input.rating-value').val()) >= parseInt($(this).data('rating'))) {
return $(this).addClass('checked');
} else {
return $(this).removeClass('checked');
}
});
};
$star_rating.on('click', function() {
$(this).siblings('input.rating-value').val($(this).data('rating'));
return SetRatingStar();
});
SetRatingStar();
});

View File

@ -0,0 +1,149 @@
<?php
/**
* app/plugins/reviews/models/review.php
*
* This class is used for the manipulation of the reviews database table.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Canary as Debug;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Plugins\Reviews as Plugin;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Classes\CustomException;
class Review extends DatabaseModel {
public $tableName = 'reviews';
public $databaseMatrix = [
[ 'review_category_id', 'int', '11' ],
[ 'title', 'varchar', '128' ],
[ 'rating', 'int', '1' ],
[ 'review', 'text', '' ],
[ 'createdBy', 'int', '11' ],
[ 'createdAt', 'int', '11' ],
[ 'approvedAt', 'int', '11' ],
[ 'approvedBy', 'int', '11' ],
];
public $plugin;
/**
* The model constructor.
*/
public function __construct() {
parent::__construct();
$this->plugin = new Plugin;
}
public function create( $title, $rating, $review, $review_category_id = '0' ) {
if ( ! $this->plugin->checkEnabled() ) {
Debug::info( 'Reviews are disabled in the config.' );
return false;
}
$fields = [
'title' => $title,
'rating' => $rating,
'review' => $review,
'review_category_id' => $review_category_id,
'createdAt' => time(),
'createdBy' => App::$activeUser->ID,
];
if ( ! self::$db->insert( $this->tableName, $fields ) ) {
Debug::info( 'Reviews::create - failed to insert to db' );
return false;
}
return self::$db->lastId();
}
public function update( $id, $title, $rating, $review, $review_category_id = '0' ) {
if ( ! $this->plugin->checkEnabled() ) {
Debug::info( 'Reviews are disabled in the config.' );
return false;
}
if ( !Check::dataTitle( $slug ) ) {
Debug::info( 'Review Categories: illegal title.' );
return false;
}
$fields = [
'title' => $title,
'rating' => $rating,
'review' => $review,
'review_category_id' => $review_category_id,
];
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
new CustomException( 'reviewUpdate' );
Debug::error( "Review: $id not updated: $fields" );
return false;
}
return true;
}
public function approve( $ID ) {
if ( !Check::id( $ID ) ) {
Debug::info( 'Review Categories: illegal ID.' );
return false;
}
$fields = [
'approvedAt' => time(),
'approvedBy' => App::$activeUser->ID,
];
if ( !self::$db->update( $this->tableName, $ID, $fields ) ) {
new CustomException( $this->tableName );
Debug::error( "Review Categories: $ID Approved: $fields" );
return false;
}
return true;
}
public function hide( $ID ) {
// if ( !Check::id( $ID ) ) {
// Debug::info( 'Review Categories: illegal ID.' );
// return false;
// }
// $fields = [
// 'approvedAt' => null,
// 'approvedBy' => null,
// ];
// if ( !self::$db->update( $this->tableName, $ID, $fields ) ) {
// new CustomException( $this->tableName );
// Debug::error( "Review Categories: $ID not Approved: $fields" );
// return false;
// }
return true;
}
public function byUser( $limit = null ) {
$whereClause = ['createdBy', '=', App::$activeUser->ID];
if ( empty( $limit ) ) {
$reviews = self::$db->get( $this->tableName, $whereClause );
} else {
$reviews = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$reviews->count() ) {
Debug::info( 'No Reviews found.' );
return false;
}
return $this->filter( $reviews->results() );
}
public function byCategory( $id, $limit = null ) {
$whereClause = [ 'review_category_id', '=', $id ];
if ( empty( $limit ) ) {
$reviews = self::$db->get( $this->tableName, $whereClause );
} else {
$reviews = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$reviews->count() ) {
Debug::info( 'No Reviews found.' );
return false;
}
return $this->filter( $reviews->results() );
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* app/plugins/reviews/models/reviewcategory.php
*
* This class is used for the manipulation of the review_categories database table.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Models;
use TheTempusProject\Bedrock\Classes\Config;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Canary\Canary as Debug;
use TheTempusProject\Classes\DatabaseModel;
use TheTempusProject\Plugins\Reviews as Plugin;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Bedrock\Classes\CustomException;
class Reviewcategory extends DatabaseModel {
public $tableName = 'review_categories';
public $databaseMatrix = [
[ 'name', 'varchar', '128' ],
[ 'slug', 'varchar', '64' ],
[ 'createdBy', 'int', '11' ],
[ 'createdAt', 'int', '11' ],
];
public $plugin;
/**
* The model constructor.
*/
public function __construct() {
parent::__construct();
$this->plugin = new Plugin;
}
public function create( $name, $slug ) {
if ( ! $this->plugin->checkEnabled() ) {
Debug::info( 'Reviews are disabled in the config.' );
return false;
}
if ( !Check::dataTitle( $slug ) ) {
Debug::info( 'Review Categories: illegal title.' );
return false;
}
$fields = [
'name' => $name,
'slug' => $slug,
'createdAt' => time(),
'createdBy' => App::$activeUser->ID,
];
if ( ! self::$db->insert( $this->tableName, $fields ) ) {
Debug::info( 'ReviewCategories::create - failed to insert to db' );
return false;
}
return self::$db->lastId();
}
public function update( $id, $name, $slug ) {
if ( ! $this->plugin->checkEnabled() ) {
Debug::info( 'Reviews are disabled in the config.' );
return false;
}
if ( !Check::dataTitle( $slug ) ) {
Debug::info( 'Review Categories: illegal title.' );
return false;
}
$fields = [
'name' => $name,
'slug' => $slug,
];
if ( !self::$db->update( $this->tableName, $id, $fields ) ) {
new CustomException( 'reviewCategoryUpdate' );
Debug::error( "Review Categories: $id not updated: $fields" );
return false;
}
return true;
}
public function findBySlug( $slug, $limit = null ) {
$whereClause = [ 'slug', '=', $slug ];
if ( empty( $limit ) ) {
$categories = self::$db->get( $this->tableName, $whereClause );
} else {
$categories = self::$db->get( $this->tableName, $whereClause, 'ID', 'DESC', [0, $limit] );
}
if ( !$categories->count() ) {
Debug::info( 'No categories found.' );
return false;
}
return $this->filter( $categories->first() );
}
public function simple() {
$categories = self::$db->get( $this->tableName, '*' );
if ( !$categories->count() ) {
Debug::warn( 'Could not find any categories' );
return false;
}
$categories = $categories->results();
$out = [];
foreach ( $categories as &$category ) {
$out[ $category->name ] = $category->ID;
}
return $out;
}
}

View File

@ -0,0 +1,51 @@
<?php
/**
* app/plugins/reviews/plugin.php
*
* This houses all of the main plugin info and functionality.
*
* @package TP Reviews
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins;
use TheTempusProject\Classes\Plugin;
class Reviews extends Plugin {
public $pluginName = 'TP Reviews';
public $pluginAuthor = 'JoeyK';
public $pluginWebsite = 'https://TheTempusProject.com';
public $modelVersion = '1.0';
public $pluginVersion = '3.0';
public $pluginDescription = 'A simple plugin which adds a site wide review system.';
public $permissionMatrix = [
'review' => [
'pretty' => 'Can create reviews',
'default' => false,
],
'createReviewCategory' => [
'pretty' => 'Can create review categories',
'default' => false,
],
];
public $admin_links = [
[
'text' => '<i class="fa fa-fw fa-copy"></i> Reviews',
'url' => '{ROOT_URL}admin/reviews',
],
];
public $footer_links = [
[
'text' => 'Reviews',
'url' => '{ROOT_URL}reviews/index/',
'filter' => 'loggedin',
],
];
}
// need a setting to allow reviewing a category from the dropdown
// if disabled, "I'm sorry but reviews are invite only. If you have been asked to review a product, double check the link and make sure its been entered correctly
// if you have not been invited to review a product, please feel free to leave any feedback in the feedback section.

View File

@ -0,0 +1,35 @@
<div class="container col-md-4 col-lg-4">
<div class="row">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Review Category</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="">
<table class="table table-user-primary">
<tbody>
<tr>
<td align="left" width="200"><b>Name</b></td>
<td align="right">{name}</td>
</tr>
<tr>
<td><b>Slug</b></td>
<td align="right">{slug}</td>
</tr>
<tr>
<td><b>Created</b></td>
<td align="right">{DTC}{createdAt}{/DTC}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel-footer">
<a href="{ROOT_URL}admin/reviews/categoryEdit/{ID}" class="btn btn-md btn-warning" role="button">Edit</a>
<a href="{ROOT_URL}admin/reviews/categoryDelete/{ID}" class="btn btn-md btn-danger" role="button">Delete</a>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,22 @@
<legend>Create Review Category</legend>
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<div class="form-group">
<label for="name" class="col-lg-3 control-label">Name</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="name" id="name">
</div>
</div>
<div class="form-group">
<label for="slug" class="col-lg-3 control-label">Slug (the public link for reviews would be {ROOT_URL}reviews/YOUR_SLUG_HERE)</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="slug" id="slug">
</div>
</div>
<div class="form-group">
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-3">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,22 @@
<legend>Edit Review Category</legend>
<form action="" method="post" class="form-horizontal">
<input type="hidden" name="token" value="{TOKEN}">
<div class="form-group">
<label for="name" class="col-lg-3 control-label">Name</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="name" id="name" value="{name}">
</div>
</div>
<div class="form-group">
<label for="slug" class="col-lg-3 control-label">Slug (the public link for reviews would be {ROOT_URL}reviews/YOUR_SLUG_HERE)</label>
<div class="col-lg-3">
<input type="text" class="form-control" name="slug" id="slug" value="{slug}">
</div>
</div>
<div class="form-group">
<label for="submit" class="col-lg-3 control-label"></label>
<div class="col-lg-3">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</div>
</div>
</form>

View File

@ -0,0 +1,33 @@
<legend>Review Categories</legend>
<table class="table table-striped">
<thead>
<tr>
<th style="width: 10%">ID</th>
<th style="width: 30%">Name</th>
<th style="width: 30%">Slug</th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
</tr>
</thead>
<tbody>
{LOOP}
<tr>
<td align="center">{ID}</td>
<td>{name}</td>
<td>{slug}</td>
<td><a href="{ROOT_URL}admin/reviews/categoryView/{ID}" class="btn btn-sm btn-primary" role="button"><i class="glyphicon glyphicon-info-sign"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/categoryEdit/{ID}" class="btn btn-sm btn-warning" role="button"><i class="glyphicon glyphicon-edit"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/categoryDelete/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a></td>
</tr>
{/LOOP}
{ALT}
<tr>
<td align="center" colspan="6">
No results to show.
</td>
</tr>
{/ALT}
</tbody>
</table>
<a href="{ROOT_URL}admin/reviews/categoryCreate" class="btn btn-sm btn-primary" role="button">Create</a>

View File

@ -0,0 +1,9 @@
<div class="row">
<div class="col-xlg-6 col-lg-6 col-md-6 col-sm-6 col-xs-6">
{reviews}
</div>
<div class="col-xlg-6 col-lg-6 col-md-6 col-sm-6 col-xs-6">
{reviewCategories}
</div>
</div>

View File

@ -0,0 +1,42 @@
<div class="container col-md-4 col-lg-4">
<div class="row">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Review</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="">
<table class="table table-user-primary">
<tbody>
<tr>
<td align="left" width="200"><b>Title</b></td>
<td align="right">{title}</td>
</tr>
<tr>
<td><b>Rating</b></td>
<td align="right">{rating}</td>
</tr>
<tr>
<td><b>Created</b></td>
<td align="right">{DTC}{createdAt}{/DTC}</td>
</tr>
<tr>
<td align="center" colspan="2"><b>Review</b></td>
</tr>
<tr>
<td colspan="2">{review}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel-footer">
<a href="{ROOT_URL}admin/reviews/reviewApprove/{ID}" class="btn btn-sm btn-success" role="button"><i class="glyphicon glyphicon-info-check"></i></a>
<a href="{ROOT_URL}admin/reviews/reviewHide/{ID}" class="btn btn-sm btn-info" role="button"><i class="glyphicon glyphicon-eye-closed"></i></a>
<a href="{ROOT_URL}admin/reviews/reviewDelete/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,32 @@
<legend>Reviews</legend>
<table class="table table-striped">
<thead>
<tr>
<th style="width: 10%">ID</th>
<th style="width: 30%">Title</th>
<th style="width: 30%">Rating</th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
</tr>
</thead>
<tbody>
{LOOP}
<tr>
<td align="center">{ID}</td>
<td><a href="{ROOT_URL}admin/reviews/reviewView/{ID}" class="btn btn-sm btn-primary" role="button">{title}</a></td>
<td align="center">{rating}</td>
<td><a href="{ROOT_URL}admin/reviews/reviewApprove/{ID}" class="btn btn-sm btn-success" role="button"><i class="glyphicon glyphicon-info-check"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/reviewHide/{ID}" class="btn btn-sm btn-info" role="button"><i class="glyphicon glyphicon-eye-closed"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/reviewDelete/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a></td>
</tr>
{/LOOP}
{ALT}
<tr>
<td align="center" colspan="6">
No results to show.
</td>
</tr>
{/ALT}
</tbody>
</table>

View File

@ -0,0 +1,29 @@
<div class="container mt-5">
<h2>Write a Review</h2>
<form id="review-form" method="post">
<div class="form-group">
<label for="review_category_id">Review Category:</label>
{reviewCategorySelect}
</div>
<div class="form-group">
<label for="title">Title your review:</label>
<input type="text" class="form-control" id="title" name="title" required>
</div>
<div class="form-group">
<label>Rating:</label>
<div class="star-rating">
<span class="fa fa-star" data-rating="1"></span>
<span class="fa fa-star" data-rating="2"></span>
<span class="fa fa-star" data-rating="3"></span>
<span class="fa fa-star" data-rating="4"></span>
<span class="fa fa-star" data-rating="5"></span>
<input type="hidden" name="rating" class="rating-value" value="0">
</div>
</div>
<div class="form-group">
<label for="review">Your Review:</label>
<textarea class="form-control" id="review" name="review" rows="5" required></textarea>
</div>
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block ">Submit</button>
</form>
</div>

View File

@ -0,0 +1 @@
{reviews}

View File

@ -0,0 +1,32 @@
<legend>Reviews</legend>
<table class="table table-striped">
<thead>
<tr>
<th style="width: 10%">ID</th>
<th style="width: 30%">Title</th>
<th style="width: 30%">Rating</th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
<th style="width: 10%"></th>
</tr>
</thead>
<tbody>
{LOOP}
<tr>
<td align="center">{ID}</td>
<td><a href="{ROOT_URL}admin/reviews/reviewView/{ID}" class="btn btn-sm btn-primary" role="button">{title}</a></td>
<td align="center">{rating}</td>
<td><a href="{ROOT_URL}admin/reviews/reviewApprove/{ID}" class="btn btn-sm btn-success" role="button"><i class="glyphicon glyphicon-info-check"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/reviewHide/{ID}" class="btn btn-sm btn-info" role="button"><i class="glyphicon glyphicon-eye-closed"></i></a></td>
<td><a href="{ROOT_URL}admin/reviews/reviewDelete/{ID}" class="btn btn-sm btn-danger" role="button"><i class="glyphicon glyphicon-trash"></i></a></td>
</tr>
{/LOOP}
{ALT}
<tr>
<td align="center" colspan="6">
No results to show.
</td>
</tr>
{/ALT}
</tbody>
</table>