offer fileupload and comments
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 05/01/2018
|
||||
* Time: 15:03
|
||||
*/
|
||||
class ProjectsController 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 getAllProjects( $archive = 'F' )
|
||||
{
|
||||
$projects = Project::getAllProjects( $archive );
|
||||
|
||||
$this->json( $projects );
|
||||
}
|
||||
|
||||
public function saveProject()
|
||||
{
|
||||
$projectValidation = new ProjectValidation();
|
||||
|
||||
if ( ! $projectValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $projectValidation->getErrorMessages()] );
|
||||
|
||||
$project = $this->input->post();
|
||||
|
||||
$projectID = $project['id'];
|
||||
unset( $project['id'] );
|
||||
|
||||
$projectID = Project::saveProject( $projectID, $project );
|
||||
|
||||
$this->json( ['success' => TRUE, 'projectID' => $projectID] );
|
||||
}
|
||||
|
||||
public function archiveProject( $projectID, $status )
|
||||
{
|
||||
Project::whereId( $projectID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeProject( $projectID )
|
||||
{
|
||||
$removeProject = new RemoveProject( $projectID );
|
||||
|
||||
if ( $removeProject->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Project::removeProject( $projectID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user