Skip to content

Commit

Permalink
Master
Browse files Browse the repository at this point in the history
First commit including the core system
  • Loading branch information
aswzen committed Jun 5, 2015
1 parent 36c5f25 commit 94ed0ff
Show file tree
Hide file tree
Showing 141 changed files with 39,989 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>

# Prevent file browsing
Options -Indexes
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#PIP

PIP is a tiny application framework built for people who use a LAMP stack. PIP aims to be as simple as possible to set up and use.

Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) for more information and documentation.

## Requirements

* PHP 5.1 or greater
* MySQL 4.1.2 or greater
* The mod_rewrite Apache module

## Installation

* Download PIP and extract
* Navigate to `application/config/config.php` and fill in your `base_url`
* You are ready to rock! Point your browser to your `base_url` and hopefully see a welcome message.

## Documentation

Visit [http://gilbitron.github.com/PIP](http://gilbitron.github.com/PIP/) to see the documentation.

## License

PIP is released under the MIT license.

Want to say thanks? [Consider tipping me](https://www.gittip.com/gilbitron).
15 changes: 15 additions & 0 deletions application/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$config['base_url'] = 'http://localhost/mlead/'; // Base URL including trailing slash (e.g. http://localhost/)

$config['default_controller'] = 'main'; // Default controller to load
$config['error_controller'] = 'main'; // Controller used for errors (e.g. 404, 500 etc)

$config['db_host'] = 'localhost'; // Database host (e.g. localhost)
$config['db_name'] = 'monolead'; // Database name
$config['db_username'] = 'root'; // Database username
$config['db_password'] = ''; // Database password

define('version', 'Alpha 1.0');

?>
110 changes: 110 additions & 0 deletions application/controllers/activity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

class Activity extends Controller {

function insert_activity($task_id = null)
{
$_ACT = $this->loadModel('ActivityModel');
$array = array(
"id" => '',
"task_id" => $task_id,
"comment" => $_POST['record']['message'],
"visible" => 'Y',
"progress" => $_POST['record']['progress'],
"status_id" => $_POST['record']['status_id']['id'],
"input_date" => date('Y-m-d H:i:s'),
"user_id" => Session::r('USER_ID')
);
$_ACT->saveActivity($array);

$_TASK = $this->loadModel('TaskModel');
$arrayTaskHeader = array(
"id" => $task_id,
"status_id" => $_POST['record']['status_id']['id'],
"progress" => $_POST['record']['progress']
);
$_TASK->updateTask($arrayTaskHeader);

die();
}

function get_activity($activity_id = null)
{
$_ACT = $this->loadModel('ActivityModel');
$_ACT_DATA = $_ACT->getActivity($activity_id);

$result['status'] = 'success';
$result['record'] = array(
'id' => $_ACT_DATA['id'],
'progress' => $_ACT_DATA['progress'],
'message' => $_ACT_DATA['comment'],
'status_id' => $_ACT_DATA['status_id']
);
echo json_encode($result);
die();
}

function go_edit_activity()
{
$_ACT = $this->loadModel('ActivityModel');

$id = $_POST['record']['id'];

$arrayActHeader = array(
"id" => $id,
"progress" => $_POST['record']['progress'],
"comment" => $_POST['record']['message'],
"status_id" => $_POST['record']['status_id']['id']
);

$_ACT->updateActivity($arrayActHeader);

$_ACT_DATA_ONE = $_ACT->getActivity($id);
$_ACT_DATA_TASK = $_ACT->getLastActivityByTask($_ACT_DATA_ONE['task_id']);

foreach ($_ACT_DATA_TASK as $key => $value) {
if($value['id'] == $id){
$_TASK = $this->loadModel('TaskModel');
$arrayTaskHeader = array(
"id" => $_ACT_DATA_ONE['task_id'],
"status_id" => $_POST['record']['status_id']['id'],
"progress" => $_POST['record']['progress']
);
$_TASK->updateTask($arrayTaskHeader);
}
}

die();
}

function delete_activity()
{
$_ACT = $this->loadModel('ActivityModel');
$_TASK = $this->loadModel('TaskModel');

$id = $_POST['id'];

$_ACT_DATA_ONE = $_ACT->getActivity($id);
$_IS_LAST_ACTIVITY = $_ACT->getLastActivityByTask($_ACT_DATA_ONE['task_id']);

foreach ($_IS_LAST_ACTIVITY as $key => $value) {
if($value['id'] == $id){
$_ACT->deleteActivity($id);

$_GET_LAST_ACTIVITY = $_ACT->getLastActivityByTask($_ACT_DATA_ONE['task_id']);
foreach ($_GET_LAST_ACTIVITY as $key2 => $value2) {
$arrayTaskHeader = array(
"id" => $_ACT_DATA_ONE['task_id'],
"status_id" => $value2['status_id'],
"progress" => $value2['progress']
);
$_TASK->updateTask($arrayTaskHeader);
}
} else {
$_ACT->deleteActivity($id);
}
}

die();
}
}
41 changes: 41 additions & 0 deletions application/controllers/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
class Config extends Controller {

function index()
{
$template = $this->loadView('config_view');

//$_CONFIG = $this->loadModel('ConfigModel');
$_CONFIG = Handler::$_CONFIG;
$_CONFIG_DATA = $_CONFIG->loadConfig();

$result = array(
'site_name' => $_CONFIG_DATA['site_name'],
'maintenance_mode' => $_CONFIG_DATA['maintenance_mode'],
'additional_footer' => $_CONFIG_DATA['additional_footer']
);

$template->set('_CONFIG_DATA',json_encode($result));
$template->render();
}

function go_edit_config()
{

//$_CONFIG = $this->loadModel('ConfigModel');
$_CONFIG = Handler::$_CONFIG;

$array = array(
"site_name" => $_POST['record']['site_name'],
"additional_footer" => $_POST['record']['additional_footer'],
"maintenance_mode" => $_POST['record']['maintenance_mode']['id']
);

$_CONFIG->saveConfig($array);

die();
}

}

?>
18 changes: 18 additions & 0 deletions application/controllers/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

class Error extends Controller {

function index()
{
$this->error404();
}

function error404()
{
$template = $this->loadView('error');
$template->render();;
}

}

?>
63 changes: 63 additions & 0 deletions application/controllers/handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

class Handler extends Controller {

public static $_LOGIN_STATUS = 0;
public static $_LOGIN_USER_NAME = '-';
public static $_LOGIN_USER_ID = '-';
public static $_LOGIN_USER_EMAIL = '-';
public static $_LOGIN_ACT_NAME = 'login';
public static $_LOGIN_ACT_LABEL = 'Login';
public static $_CONTROLLER_NAME = 'None';
public static $_ACTION_NAME = 'None';
public static $_IS_ADMIN = false;

public static $_SITE_NAME = '';
public static $_ADDITIONAL_FOOTER = '';
public static $_IS_MAINTENANCE = 'No';
public static $_DF = 'Y-m-d H:i:s';
public static $_CONFIG = null;

function __construct()
{

$this->helperLoader('Session');

self::$_CONTROLLER_NAME = ucfirst($this->getController());
self::$_ACTION_NAME = ucfirst($this->getAction());

if($this->getController() == 'login' || $this->getAction() == 'login'){
if(!empty(Session::r('LOGIN_STATUS'))){
$this->redirect('main/');
}
} else {
if(!empty(Session::r('LOGIN_STATUS'))){
self::$_LOGIN_STATUS = 1;
self::$_LOGIN_USER_NAME = Session::r('USER_NAME');
self::$_LOGIN_USER_ID = Session::r('USER_ID');
self::$_LOGIN_USER_EMAIL = Session::r('USER_EMAIL');
self::$_LOGIN_ACT_NAME = 'logout';
self::$_LOGIN_ACT_LABEL = 'Logout';

if(Session::r('USER_GROUP') == 'ADM'){
self::$_IS_ADMIN = true;
}

} else {
$this->redirect('login/');
}
}

self::$_CONFIG = $this->loadModel('ConfigModel');
$_CONFIG_DATA = self::$_CONFIG->loadConfig();

self::$_SITE_NAME = $_CONFIG_DATA['site_name'];
self::$_ADDITIONAL_FOOTER = $_CONFIG_DATA['additional_footer'];
self::$_IS_MAINTENANCE = $_CONFIG_DATA['maintenance_mode'];
self::$_DF = $_CONFIG_DATA['datetime_format'];

}

}

?>
12 changes: 12 additions & 0 deletions application/controllers/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
class Login extends Controller {

function index()
{
$template = $this->loadView('login_form');
$template->render();
}

}

?>
15 changes: 15 additions & 0 deletions application/controllers/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
class Main extends Controller {

function index()
{
$template = $this->loadView('main_view');
//echo $this->getRN('PROJECT');
$template->set('_DATA','');
$template->render();

}

}

?>
Loading

0 comments on commit 94ed0ff

Please sign in to comment.