offer fileupload and comments
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/01/2018
|
||||
* Time: 14:20
|
||||
*/
|
||||
|
||||
class CommentsController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getComments( $foreignID, $tablename )
|
||||
{
|
||||
$comments = Comment::getComments( $foreignID, $tablename );
|
||||
|
||||
$this->json( $comments );
|
||||
}
|
||||
|
||||
public function getComment( $commentID )
|
||||
{
|
||||
$comment = Comment::find( $commentID );
|
||||
|
||||
$comment->comment = base64_decode( $comment->comment );
|
||||
|
||||
$this->json( $comment );
|
||||
}
|
||||
|
||||
public function addComment( $foreignID, $tablename )
|
||||
{
|
||||
$commentID = Comment::addComment( $foreignID, $tablename );
|
||||
|
||||
$this->json( $commentID );
|
||||
}
|
||||
|
||||
public function saveComment( $commentID )
|
||||
{
|
||||
$comment = $this->input->post( 'comment' );
|
||||
|
||||
$comment = base64_encode( $comment );
|
||||
|
||||
Comment::whereId( $commentID )->update( ['comment' => $comment] );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user