Documents module
This commit is contained in:
@@ -1,69 +0,0 @@
|
|||||||
<?php
|
|
||||||
if (!class_exists('DocumentsAdminManager')) {
|
|
||||||
class DocumentsAdminManager extends AbstractModuleManager{
|
|
||||||
|
|
||||||
public function initializeUserClasses(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initializeFieldMappings(){
|
|
||||||
$this->addFileFieldMapping('EmployeeDocument', 'attachment', 'name');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initializeDatabaseErrorMappings(){
|
|
||||||
$this->addDatabaseErrorMapping('CONSTRAINT `Fk_EmployeeDocuments_Documents` FOREIGN KEY','Can not delete Document Type, users have already uploaded these types of documents');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setupModuleClassDefinitions(){
|
|
||||||
|
|
||||||
$this->addModelClass('Document');
|
|
||||||
$this->addModelClass('EmployeeDocument');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!class_exists('Document')) {
|
|
||||||
class Document extends ICEHRM_Record {
|
|
||||||
var $_table = 'Documents';
|
|
||||||
|
|
||||||
public function getAdminAccess(){
|
|
||||||
return array("get","element","save","delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getUserAccess(){
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!class_exists('EmployeeDocument')) {
|
|
||||||
class EmployeeDocument extends ICEHRM_Record {
|
|
||||||
var $_table = 'EmployeeDocuments';
|
|
||||||
|
|
||||||
public function getAdminAccess(){
|
|
||||||
return array("get","element","save","delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getManagerAccess(){
|
|
||||||
return array("get","element","save","delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserAccess(){
|
|
||||||
return array("get");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserOnlyMeAccess(){
|
|
||||||
return array("element","save","delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Insert(){
|
|
||||||
if(empty($this->date_added)){
|
|
||||||
$this->date_added = date("Y-m-d H:i:s");
|
|
||||||
}
|
|
||||||
return parent::Insert();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?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 = 'documents';
|
|
||||||
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="tabDocument" href="#tabPageDocument">Document Types</a></li>
|
|
||||||
<li class=""><a id="tabEmployeeDocument" href="#tabPageEmployeeDocument">Employee Documents</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="tabPageDocument">
|
|
||||||
<div id="Document" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="DocumentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane" id="tabPageEmployeeDocument">
|
|
||||||
<div id="EmployeeDocument" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="EmployeeDocumentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var modJsList = new Array();
|
|
||||||
|
|
||||||
modJsList['tabDocument'] = new DocumentAdapter('Document','Document');
|
|
||||||
modJsList['tabEmployeeDocument'] = new EmployeeDocumentAdapter('EmployeeDocument','EmployeeDocument');
|
|
||||||
|
|
||||||
var modJs = modJsList['tabDocument'];
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?php include APP_BASE_PATH.'footer.php';?>
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
/**
|
|
||||||
* Author: Thilina Hasantha
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DocumentAdapter
|
|
||||||
*/
|
|
||||||
|
|
||||||
function DocumentAdapter(endPoint) {
|
|
||||||
this.initAdapter(endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
DocumentAdapter.inherits(AdapterBase);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DocumentAdapter.method('getDataMapping', function() {
|
|
||||||
return [
|
|
||||||
"id",
|
|
||||||
"name",
|
|
||||||
"details"
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
DocumentAdapter.method('getHeaders', function() {
|
|
||||||
return [
|
|
||||||
{ "sTitle": "ID" ,"bVisible":false},
|
|
||||||
{ "sTitle": "Name" },
|
|
||||||
{ "sTitle": "Details"}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
DocumentAdapter.method('getFormFields', function() {
|
|
||||||
return [
|
|
||||||
[ "id", {"label":"ID","type":"hidden"}],
|
|
||||||
[ "name", {"label":"Name","type":"text","validation":""}],
|
|
||||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}]
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
DocumentAdapter.method('getHelpLink', function () {
|
|
||||||
return 'http://blog.icehrm.com/?page_id=88';
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function EmployeeDocumentAdapter(endPoint) {
|
|
||||||
this.initAdapter(endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.inherits(AdapterBase);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getDataMapping', function() {
|
|
||||||
return [
|
|
||||||
"id",
|
|
||||||
"employee",
|
|
||||||
"document",
|
|
||||||
"details",
|
|
||||||
"date_added",
|
|
||||||
"status",
|
|
||||||
"attachment"
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getHeaders', function() {
|
|
||||||
return [
|
|
||||||
{ "sTitle": "ID" ,"bVisible":false},
|
|
||||||
{ "sTitle": "Employee" },
|
|
||||||
{ "sTitle": "Document" },
|
|
||||||
{ "sTitle": "Details" },
|
|
||||||
{ "sTitle": "Date Added"},
|
|
||||||
{ "sTitle": "Status"},
|
|
||||||
{ "sTitle": "Attachment","bVisible":false}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getFormFields', function() {
|
|
||||||
return [
|
|
||||||
[ "id", {"label":"ID","type":"hidden"}],
|
|
||||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}],
|
|
||||||
[ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}],
|
|
||||||
[ "date_added", {"label":"Date Added","type":"date","validation":""}],
|
|
||||||
[ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}],
|
|
||||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],
|
|
||||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
|
||||||
[ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}]
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getFilters', function() {
|
|
||||||
return [
|
|
||||||
[ "employee", {"label":"Employee","type":"select2","remote-source":["Employee","id","first_name+last_name"]}]
|
|
||||||
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getActionButtonsHtml', function(id,data) {
|
|
||||||
var html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img><img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download Document" onclick="download(\'_attachment_\');return false;"></img><img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img></div>';
|
|
||||||
html = html.replace(/_id_/g,id);
|
|
||||||
html = html.replace(/_attachment_/g,data[6]);
|
|
||||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
|
||||||
return html;
|
|
||||||
});
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"label":"Document Management",
|
|
||||||
"menu":"Employees",
|
|
||||||
"order":"2",
|
|
||||||
"icon":"fa-files-o",
|
|
||||||
"user_levels":["Admin"],
|
|
||||||
|
|
||||||
"permissions":
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
if (!class_exists('DocumentsModulesManager')) {
|
|
||||||
|
|
||||||
class DocumentsModulesManager extends AbstractModuleManager{
|
|
||||||
|
|
||||||
public function initializeUserClasses(){
|
|
||||||
if(defined('MODULE_TYPE') && MODULE_TYPE != 'admin'){
|
|
||||||
$this->addUserClass("EmployeeDocument");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initializeFieldMappings(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initializeDatabaseErrorMappings(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setupModuleClassDefinitions(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?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 = 'documents';
|
|
||||||
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="tabEmployeeDocument" href="#tabPageEmployeeDocument">My Documents</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="tabPageEmployeeDocument">
|
|
||||||
<div id="EmployeeDocument" class="reviewBlock" data-content="List" style="padding-left:5px;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="EmployeeDocumentForm" class="reviewBlock" data-content="Form" style="padding-left:5px;display:none;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var modJsList = new Array();
|
|
||||||
|
|
||||||
modJsList['tabEmployeeDocument'] = new EmployeeDocumentAdapter('EmployeeDocument','EmployeeDocument');
|
|
||||||
|
|
||||||
<?php if(isset($modulePermissions['perm']['Add Documents']) && $modulePermissions['perm']['Add Documents'] == "No"){?>
|
|
||||||
modJsList['tabEmployeeDocument'].setShowAddNew(false);
|
|
||||||
<?php }?>
|
|
||||||
<?php if(isset($modulePermissions['perm']['Delete Documents']) && $modulePermissions['perm']['Delete Documents'] == "No"){?>
|
|
||||||
modJsList['tabEmployeeDocument'].setShowDelete(false);
|
|
||||||
<?php }?>
|
|
||||||
<?php if(isset($modulePermissions['perm']['Edit Documents']) && $modulePermissions['perm']['Edit Documents'] == "No"){?>
|
|
||||||
modJsList['tabEmployeeDocument'].setShowEdit(false);
|
|
||||||
<?php }?>
|
|
||||||
|
|
||||||
var modJs = modJsList['tabEmployeeDocument'];
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?php include APP_BASE_PATH.'footer.php';?>
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
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)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function EmployeeDocumentAdapter(endPoint) {
|
|
||||||
this.initAdapter(endPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.inherits(AdapterBase);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getDataMapping', function() {
|
|
||||||
return [
|
|
||||||
"id",
|
|
||||||
"document",
|
|
||||||
"details",
|
|
||||||
"date_added",
|
|
||||||
"status",
|
|
||||||
"attachment"
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getHeaders', function() {
|
|
||||||
return [
|
|
||||||
{ "sTitle": "ID" ,"bVisible":false},
|
|
||||||
{ "sTitle": "Document" },
|
|
||||||
{ "sTitle": "Details" },
|
|
||||||
{ "sTitle": "Date Added"},
|
|
||||||
{ "sTitle": "Status"},
|
|
||||||
{ "sTitle": "Attachment","bVisible":false}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getFormFields', function() {
|
|
||||||
return [
|
|
||||||
[ "id", {"label":"ID","type":"hidden"}],
|
|
||||||
[ "document", {"label":"Document","type":"select2","remote-source":["Document","id","name"]}],
|
|
||||||
//[ "date_added", {"label":"Date Added","type":"date","validation":""}],
|
|
||||||
[ "valid_until", {"label":"Valid Until","type":"date","validation":"none"}],
|
|
||||||
[ "status", {"label":"Status","type":"select","source":[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],
|
|
||||||
[ "details", {"label":"Details","type":"textarea","validation":"none"}],
|
|
||||||
[ "attachment", {"label":"Attachment","type":"fileupload","validation":"none"}]
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
EmployeeDocumentAdapter.method('getActionButtonsHtml', function(id,data) {
|
|
||||||
var downloadButton = '<img class="tableActionButton" src="_BASE_images/download.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Download Document" onclick="download(\'_attachment_\');return false;"></img>';
|
|
||||||
var editButton = '<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>';
|
|
||||||
var deleteButton = '<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>';
|
|
||||||
var html = '<div style="width:80px;">_edit__download__delete_</div>';
|
|
||||||
|
|
||||||
html = html.replace('_download_',downloadButton);
|
|
||||||
|
|
||||||
if(this.showDelete){
|
|
||||||
html = html.replace('_delete_',deleteButton);
|
|
||||||
}else{
|
|
||||||
html = html.replace('_delete_','');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.showEdit){
|
|
||||||
html = html.replace('_edit_',editButton);
|
|
||||||
}else{
|
|
||||||
html = html.replace('_edit_','');
|
|
||||||
}
|
|
||||||
|
|
||||||
html = html.replace(/_id_/g,id);
|
|
||||||
html = html.replace(/_attachment_/g,data[5]);
|
|
||||||
html = html.replace(/_BASE_/g,this.baseUrl);
|
|
||||||
return html;
|
|
||||||
});
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"label":"My Documents",
|
|
||||||
"menu":"Documents",
|
|
||||||
"order":"1",
|
|
||||||
"icon":"fa-files-o",
|
|
||||||
"user_levels":["Admin","Manager","Employee"],
|
|
||||||
|
|
||||||
"permissions":
|
|
||||||
{
|
|
||||||
"Manager":{
|
|
||||||
"Add Documents":"Yes",
|
|
||||||
"Edit Documents":"Yes",
|
|
||||||
"Delete Documents":"Yes"
|
|
||||||
},
|
|
||||||
|
|
||||||
"Employee":{
|
|
||||||
"Add Documents":"Yes",
|
|
||||||
"Edit Documents":"Yes",
|
|
||||||
"Delete Documents":"Yes"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user