Initial checkin v13.0
This commit is contained in:
60
ext/admin/projects/api/ProjectsAdminManager.php
Normal file
60
ext/admin/projects/api/ProjectsAdminManager.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
if (!class_exists('ProjectsAdminManager')) {
|
||||
class ProjectsAdminManager extends AbstractModuleManager{
|
||||
|
||||
public function initializeUserClasses(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeFieldMappings(){
|
||||
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings(){
|
||||
$this->addDatabaseErrorMapping("key 'EmployeeProjectsKey'", "Employee already added to this project");
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions(){
|
||||
|
||||
$this->addModelClass('Client');
|
||||
$this->addModelClass('Project');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('Client')) {
|
||||
class Client extends ICEHRM_Record {
|
||||
var $_table = 'Clients';
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Project')) {
|
||||
class Project extends ICEHRM_Record {
|
||||
var $_table = 'Projects';
|
||||
public function getAdminAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getManagerAccess(){
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess(){
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
}
|
||||
113
ext/admin/projects/index.php
Normal file
113
ext/admin/projects/index.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of iCE Hrm.
|
||||
|
||||
iCE Hrm is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
iCE Hrm is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with iCE Hrm. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah)
|
||||
*/
|
||||
|
||||
$moduleName = 'projects';
|
||||
define('MODULE_PATH',dirname(__FILE__));
|
||||
include APP_BASE_PATH.'header.php';
|
||||
include APP_BASE_PATH.'modulejslibs.inc.php';
|
||||
?><div class="span9">
|
||||
|
||||
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
|
||||
<li class="active"><a id="tabClient" href="#tabPageClient">Clients</a></li>
|
||||
<li><a id="tabProject" href="#tabPageProject">Projects</a></li>
|
||||
<li><a id="tabEmployeeProject" href="#tabPageEmployeeProject">Employee Projects</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tabPageClient">
|
||||
<div id="Client" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ClientForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageProject">
|
||||
<div id="Project" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="ProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tabPageEmployeeProject">
|
||||
<div id="EmployeeProject" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
||||
|
||||
</div>
|
||||
<div id="EmployeeProjectForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
var modJsList = new Array();
|
||||
|
||||
modJsList['tabClient'] = new ClientAdapter('Client','Client');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Clients']) && $modulePermissions['perm']['Add Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Clients']) && $modulePermissions['perm']['Delete Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Clients']) && $modulePermissions['perm']['Edit Clients'] == "No"){?>
|
||||
modJsList['tabClient'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
modJsList['tabProject'] = new ProjectAdapter('Project','Project');
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowDelete(false);
|
||||
<?php }?>
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
|
||||
modJsList['tabProject'].setShowSave(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
modJsList['tabEmployeeProject'] = new EmployeeProjectAdapter('EmployeeProject','EmployeeProject');
|
||||
modJsList['tabEmployeeProject'].setRemoteTable(true);
|
||||
|
||||
<?php if(isset($modulePermissions['perm']['Add Projects']) && $modulePermissions['perm']['Add Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowAddNew(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Delete Projects']) && $modulePermissions['perm']['Delete Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowDelete(false);
|
||||
<?php }?>
|
||||
<?php if(isset($modulePermissions['perm']['Edit Projects']) && $modulePermissions['perm']['Edit Projects'] == "No"){?>
|
||||
modJsList['tabEmployeeProject'].setShowEdit(false);
|
||||
<?php }?>
|
||||
|
||||
|
||||
var modJs = modJsList['tabClient'];
|
||||
|
||||
</script>
|
||||
<?php include APP_BASE_PATH.'footer.php';?>
|
||||
177
ext/admin/projects/lib.js
Normal file
177
ext/admin/projects/lib.js
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Author: Thilina Hasantha
|
||||
*/
|
||||
|
||||
/**
|
||||
* ClientAdapter
|
||||
*/
|
||||
|
||||
function ClientAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ClientAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ClientAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"details",
|
||||
"address",
|
||||
"contact_number"
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Details"},
|
||||
{ "sTitle": "Address"},
|
||||
{ "sTitle": "Contact Number"}
|
||||
];
|
||||
});
|
||||
|
||||
ClientAdapter.method('getFormFields', function() {
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"textarea","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"text","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"text","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"text","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"date","validation":"none"}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "address", {"label":"Address","type":"placeholder","validation":"none"}],
|
||||
[ "contact_number", {"label":"Contact Number","type":"placeholder","validation":"none"}],
|
||||
[ "contact_email", {"label":"Contact Email","type":"placeholder","validation":"none"}],
|
||||
[ "company_url", {"label":"Company Url","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}],
|
||||
[ "first_contact_date", {"label":"First Contact Date","type":"placeholder","validation":"none"}]
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
ClientAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
/**
|
||||
* ProjectAdapter
|
||||
*/
|
||||
|
||||
function ProjectAdapter(endPoint,tab,filter,orderBy) {
|
||||
this.initAdapter(endPoint,tab,filter,orderBy);
|
||||
}
|
||||
|
||||
ProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
ProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"name",
|
||||
"client"
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID","bVisible":false },
|
||||
{ "sTitle": "Name" },
|
||||
{ "sTitle": "Client"},
|
||||
];
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getFormFields', function() {
|
||||
if(this.showSave){
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"text"}],
|
||||
[ "client", {"label":"Client","type":"select2","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"]]}]
|
||||
];
|
||||
}else{
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "name", {"label":"Name","type":"placeholder"}],
|
||||
[ "client", {"label":"Client","type":"placeholder","allow-null":true,"remote-source":["Client","id","name"]}],
|
||||
[ "details", {"label":"Details","type":"placeholder","validation":"none"}],
|
||||
[ "status", {"label":"Status","type":"placeholder","source":[["Active","Active"],["Inactive","Inactive"]]}]
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
ProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* EmployeeProjectAdapter
|
||||
*/
|
||||
|
||||
|
||||
function EmployeeProjectAdapter(endPoint) {
|
||||
this.initAdapter(endPoint);
|
||||
}
|
||||
|
||||
EmployeeProjectAdapter.inherits(AdapterBase);
|
||||
|
||||
|
||||
|
||||
EmployeeProjectAdapter.method('getDataMapping', function() {
|
||||
return [
|
||||
"id",
|
||||
"employee",
|
||||
"project",
|
||||
"status"
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHeaders', function() {
|
||||
return [
|
||||
{ "sTitle": "ID" ,"bVisible":false},
|
||||
{ "sTitle": "Employee" },
|
||||
{ "sTitle": "Project" },
|
||||
/*{ "sTitle": "Start Date"},*/
|
||||
{ "sTitle": "Status"}
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFormFields', function() {
|
||||
return [
|
||||
[ "id", {"label":"ID","type":"hidden"}],
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
||||
[ "project", {"label":"Project","type":"select2","remote-source":["Project","id","name"]}],
|
||||
/*[ "date_start", {"label":"Start Date","type":"date","validation":""}],
|
||||
[ "date_end", {"label":"End Date","type":"date","validation":"none"}],*/
|
||||
[ "status", {"label":"Status","type":"select","source":[["Current","Current"],["Inactive","Inactive"],["Completed","Completed"]]}],
|
||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getFilters', function() {
|
||||
return [
|
||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}]
|
||||
|
||||
];
|
||||
});
|
||||
|
||||
EmployeeProjectAdapter.method('getHelpLink', function () {
|
||||
return 'http://blog.icehrm.com/?page_id=85';
|
||||
});
|
||||
|
||||
19
ext/admin/projects/meta.json
Normal file
19
ext/admin/projects/meta.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"label":"Projects/Client Setup",
|
||||
"menu":"Admin",
|
||||
"order":"5",
|
||||
"icon":"fa-list-alt",
|
||||
"user_levels":["Admin","Manager"],
|
||||
|
||||
"permissions":
|
||||
{
|
||||
"Manager":{
|
||||
"Add Projects":"Yes",
|
||||
"Edit Projects":"Yes",
|
||||
"Delete Projects":"No",
|
||||
"Add Clients":"Yes",
|
||||
"Edit Clients":"Yes",
|
||||
"Delete Clients":"No"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user