Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/mmishra/erp-18-06-18/views/ |
<?php
date_default_timezone_set('Asia/Kolkata');
class erpView {
var $controller;
var $model;
public function __construct($erpController, $erpModel) {
$this->controller = $erpController; // instantiate controller
$this->model = $erpModel; // instantiate model
}
public function __destruct() {
if ($this->controller->app == '/' || $this->controller->app == 'about' || $this->controller->app == 'upload' || $this->controller->app == 'logout') {
} else {
print(":|:" .$this->erpXupdate($this->controller->loginID, $this->controller->menu). ":|:" .$this->erpError(). ":|:" .$this->erpClock());
}
}
public function erpBanner() {
$str = "<div class='fixedbar'>
<div class='logo'><img src='images/iLogo.png' width='75' height='75' border='0'></div>
<h2 class='title'>INDIAN<img src='images/tricolor.png' width='175' height='22' border='0'><br>INSTITUTE OF<br>INFORMATION<br>TECHNOLOGY<br>ALLAHABAD</h2>
<div class='version'><sub><i>Ver. 1.0</i></sub></div>
<div class='helpbar' id='helpbar'></div>";
return $str;
}
function erpClock() {
return "<i style='font-size:14px;' class='fas fa-clock'></i> " .date("l, d M, Y h:i:s A");
}
function erpModule($moduleID, $app='erp') {
if ($moduleID) {
$this->controller->moduleID = $moduleID;
} else {
$moduleID = $this->controller->moduleID;
}
$modules = $this->model->erpModules();
$str = "<table width='200px'>";
foreach ($modules as $module) {
if ($moduleID == $module['moduleID']) {
$str .= "<tr><td align='center'><i class='" .$module['moduleIcon']. "' style='font-size:20px'></i></td><td><b>" .$module['moduleName']. " <i class='fas fa-check'></i></b></td></tr>";
$_SESSION["moduleID"] = $moduleID;
} else {
$str .= "<tr><td align='center'><a href='' onclick=\"inner('$app/module/render/" .$module['moduleID']. "'); return false;\" title='" .$module['description']. "'><i class='" .$module['moduleIcon']. "' style='font-size:20px'></i></a></td><td> " .$module['moduleName']. "</td></tr>";
}
}
$str .= "</table>";
if ($this->controller->app == '/' || $this->controller->app == 'about' || $this->controller->app == 'upload' || $this->controller->app == 'logout') {
} else {
$str .= ":|:" .$this->erpMenu($this->controller->loginID, $moduleID);
}
return $str;
}
function erpError($errorText='') {
if (!$errorText) {
$errorText = $this->controller->errorText;
$str = "<i class='fas fa-bullhorn'></i> " .$errorText;
}
return $str;
}
function erpHelper($tuple) {
if ($tuple == -1)
$str = '';
else {
$str = "<h3><span class='button'><i class='far fa-question-circle'></i></span> Help Tips <span class='toolbar'><a href='' onclick=\"inner('erp/helper/render/-1'); return false;\" title='Close Helper'><span class='button'><i class='far fa-times-circle'></i></span></a></span></h3>";
if ($tuple > 0) {
$str .= "<pre class='wordwrap'>" .$this->model->getMenuHelp($tuple). "</pre>";
} else {
$str .= "Helper does not offer any 'Help Tips' for this interface. Please contact support team for providing relevent 'Help Tips' here.";
}
}
return $str;
}
public function erpHeader($action='') {
$str = "
<div class='clockbar' id='clockbar'>" .$this->erpClock(). "</div>
<div class='modulebar' id='modulebar'>" .$this->erpModule($this->controller->moduleID). "</div><br>
<div class='errorbar' id='errorbar'>" .$this->erpError(). "</div>
<div class='loginbar'>";
if ($this->controller->sessionID) {
$str .= "Welcome <b>" .$this->controller->loginID. "</b> !!! <i style='font-size:14px; color:#247BBB' class='far fa-thumbs-up'></i>
you are logged in as <b>" .$this->model->getUserGroup($this->controller->loginID). "</b>. Please quit your session here...
<a href='/logout/'><i style='font-size:14px; color:#247BBB' class='fas fa-sign-out-alt'></i></a>";
} else {
$str .= "<form method='post' action='/' id='form'>Welcome to ERP @ IIITA !!!
<i style='font-size:14px;' class='fas fa-user'></i> <input type='text' name='uid' size='10' value='" .$this->controller->loginID. "' placeholder='login ID'>
<i style='font-size:14px;' class='fas fa-key'></i> <input type='password' name='pwd' size='10' placeholder='password' onchange=\"document.querySelector('form').submit(); return false;\">
<a href='javascript:void(0)' onclick=\"document.querySelector('form').submit(); return false;\"><i style='font-size:16px;' class='fas fa-sign-in-alt'></i></a></form>";
}
$str .= "</div><br>
<div class='menubar' id='menubar'>" .$this->erpMenu($this->controller->loginID, $this->controller->moduleID). "</div><br>
</div>";
return $str;
}
function erpXlogin($loginID) {
$str = "<i class='fas fa-exchange-alt'></i> ";
if ($loginID && $this->controller->sessionID) {
$str .= $this->model->getXlogin($loginID);
} else {
$str .= "ERP reports last login timestamp here.";
}
return $str;
}
function erpXupdate($loginID, $menu) {
$str = "<i class='far fa-clock'></i> ";
if ($loginID && $menu) { // && $this->controller->sessionID) {
$tmstamp = $this->model->getXupdate($loginID, $menu);
$str .= $tmstamp ? $tmstamp : "ERP reports update timestamp of current record here.";
} else {
$str .= "ERP reports update timestamp of current record here.";
}
return $str;
}
function erpMenu($loginID, $moduleID) {
if ($moduleID) $this->controller->moduleID = $moduleID;
$moduleID = $this->controller->moduleID;
// list menu items to interact with of ERP system, the first top level menu is HOME
$str = "<div align='left'>
<table><tr><td>
<!--sphider_noindex-->
<ul id='menu'>
<div class='spanx'>
<li><a href='/' class='drop'><font size=+1 color='skyblue'><i class='fa fa-home'></i></font> Home </a>
</li><!-- End 4 columns Item -->
</div>
</ul>
<!--/sphider_noindex--></td>";
// list top level other menu items to interact with applications of ERP system
$apps = $this->model->erpApps($moduleID);
foreach ($apps as $app) {
//if ($app['universal']) {
$str .= "<td><!--sphider_noindex-->
<ul id='menu'>
<div class='spanx'>";
if (substr($app['appURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$app['appURL']. "' class='drop' title='" .$app['description']. "' target='_new'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
</li><!-- End of top menu Item -->";
} else {
// list drop down menu items to list user interfaces for input, output and configuration of ERP system
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/dashboard/render/0'); return false;\" class='drop'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
<!-- Begin 4 columns Item -->
<div class='dropdown_4columns'><!-- Begin 4 columns container -->
<div class='col_4'>
<h2><i class='" .$app['appIcon']. "'></i> " .$this->model->getModuleName($app['moduleID']). " - " .$app['appName']. " panel</h2>
</div>
<div class='col_2'>
<h3><i class='far fa-question-circle'></i> ABOUT " .strtoupper($app['appCode']). "</h3>
<p>" .$app['description']. "</p>
<ul>";
// list interfaces for configuration of ERP system
$menus = $this->model->erpMenus($app['appID'], 'C');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
<div class='col_1'>
<h3><i class='far fa-keyboard'></i> INPUT</h3>
<ul>";
// list interfaces for input to the ERP system
$menus = $this->model->erpMenus($app['appID'], 'I');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
//$str .= "<li><a href='' onclick=\"inner('menuID=" .$menu['menuID']. "'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
<div class='col_1'>
<h3><i class='fa fa-print'></i> OUTPUT</h3>
<ul>";
// list interfaces for output from the ERP system
$menus = $this->model->erpMenus($app['appID'], 'O');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/list/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
";
}
$str .= "</div>
</ul>
<!--/sphider_noindex--></td>";
//}
}
$str .= "</tr></table></div>";
return $str;
}
function userMenu($loginID, $moduleID) {
if ($moduleID) $this->controller->moduleID = $moduleID;
$moduleID = $this->controller->moduleID;
// list menu items to interact with of ERP system, the first top level menu is HOME
$str = "<div align='left'>
<table><tr><td>
<!--sphider_noindex-->
<ul id='menu'>
<div class='spanx'>
<li><a href='/' class='drop'><font size=+1 color='skyblue'><i class='fa fa-home'></i></font> Home </a>
</li><!-- End 4 columns Item -->
</div>
</ul>
<!--/sphider_noindex--></td>";
// list top level other menu items to interact with applications of ERP system
$apps = $this->model->erpApps($moduleID);
foreach ($apps as $app) {
if ($app['universal']) {
$str .= "<td><!--sphider_noindex-->
<ul id='menu'>
<div class='spanx'>";
if (substr($app['appURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$app['appURL']. "' class='drop' title='" .$app['description']. "' target='_new'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
</li><!-- End of top menu Item -->";
} else {
// list drop down menu items to list user interfaces for input, output and configuration of ERP system
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/dashboard/render/0'); return false;\" class='drop'><font size=+1 color='" .$app['iconColor']. "'><i class='" .$app['appIcon']. "'></i></font> " .$app['appName']. " </a>
<!-- Begin 4 columns Item -->
<div class='dropdown_4columns'><!-- Begin 4 columns container -->
<div class='col_4'>
<h2><i class='" .$app['appIcon']. "'></i> " .$this->model->getModuleName($app['moduleID']). " - " .$app['appName']. " panel</h2>
</div>
<div class='col_2'>
<h3><i class='far fa-question-circle'></i> ABOUT " .strtoupper($app['appCode']). "</h3>
<p>" .$app['description']. "</p>
<ul>";
// list interfaces for configuration of ERP system
$menus = $this->model->erpMenus($app['appID'], 'C');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
<div class='col_1'>
<h3><i class='far fa-keyboard'></i> INPUT</h3>
<ul>";
// list interfaces for input to the ERP system
$menus = $this->model->erpMenus($app['appID'], 'I');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
//$str .= "<li><a href='' onclick=\"inner('menuID=" .$menu['menuID']. "'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/new/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
<div class='col_1'>
<h3><i class='fa fa-print'></i> OUTPUT</h3>
<ul>";
// list interfaces for output from the ERP system
$menus = $this->model->erpMenus($app['appID'], 'O');
foreach ($menus as $menu) {
if ($menu['protection'] == 0 || $this->model->checkUreadACL($loginID, $menu['menuID'])) {
if (substr($menu['menuURL'], 0, 4) == "http") {
$str .= "<li><a href='" .$menu['menuURL']. "' title='" .$menu['description']. "' target='_new'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
} else {
$str .= "<li><a href='' onclick=\"inner('" .$app['appCode']. "/".$menu['menuURL']."/list/0'); return false;\" title='" .$menu['description']. "'><font size=+1><i class='fa " .$menu['menuIcon']. "'></i></font> " .$menu['menuName']. "</a></li>";
}
}
}
$str .= "</ul>
</div>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
";
}
$str .= "</div>
</ul>
<!--/sphider_noindex--></td>";
}
}
$str .= "</tr></table></div>";
return $str;
}
function erpDashboard() {
$str = "<h3>Dashboard</h3>";
if ($this->model->getUserGroup($this->controller->loginID) == "Applicant") {
$str .= "<table width='60%' align='center' boder='1' style='border: red 1px dotted; border-collapse: collapse;'>
<tr><th align='center'>
Dear Freshers!!!<br>
<a href='' onclick=\"inner('aaa/applicant/edit/" .$this->controller->loginID. "'); return false;\">Please start with your <span class='button'><i class='fas fa-registered'></i></span>egistration here.</a>
<br><br>
</td></tr>
<tr><td>
It is advised to read once carefully
</td></tr>
<tr><td align='center'>
<a href='' onclick=\"inner('erp/helper/render/" .$this->model->getMenuID('applicant'). "'); return false;\" title='Helper Tips'><span class='button'><i class='far fa-question-circle'></i> Guidelines </span></a>
</td></tr>
<tr><td>
to avoid any mistake in online sumbission of your information.<br><br>
You have to upload image files of good quality
<ol>
<li>Photograph (coloured, passport size - 30 mm x 50 mm) and </li>
<li>Signature (30 mm x 10 mm)</li>
</ol>
These files will be used in your digital records at the institute.
</td></tr>
<tr><td align='justify'><br>
<code>
Note: Please do not press back button of browser to go back to previous page.
Instead use this button <span class='button'><i class='fas fa-arrow-circle-left'></i></span> where ever provided.
</code>
</td></tr>
</table>";
} else {
$data = $this->model->getDashboard();
foreach($data as $key => $value) {
$str1 .= "<th align='center' nowrap>" .ucfirst($key). "</th>";
$str2 .= "<td align='center'>" .$value. "</td>";
}
$str .= "<table width='60%' align='center' boder='1' style='border: red 1px dotted; border-collapse: collapse;'>
<tr><th align='center'>
Dear Freshers!!!<br><br>
Please login with your JEE<sup>Mains</sup> Roll No. as login ID and DoB (YYYY-MM-DD) as password to get into the system for online submission of your enrolment related details.
if DoB in YYYY-MM-DD format does not work please try with YYYY-DD-MM format specially where day value is in the range of 1-12.
After successful login, you can upload your photo, signature as image (.jpeg, .png) files and complete personal details as per format provided.
Also, online payment gateway of CANARA and HDFC banks are accessible to pay your FEES and MESS CHARGES as per fee structure of your targeted program.
<br><br>
</td></tr>
<tr><td>
<b>Others</b> may please use their LDAP user credentials to get into this system.
Navigation links in the form of drop-down menus are provided as per Access Control List (ACL) of signed-in user.
It is advised to read once </td></tr>
<tr><td align='center'>
<a href='http://erp.iiita.ac.in/about/' title='About ERP' target='_new'><span class='button'><i class='far fa-object-group'></i> About ERP </span></a>
</td></tr>
<tr><td>
for more information about this system. This will be of your help as you are here either<br>
<ul>
<li>To provide some INPUT to this system, OR</li>
<li>To get some OUTPUT from this system</li>
</ul>
Kindly note, your activities on this system are recorded in log files, so kindly avoid undesired clicks.
</td></tr>
<tr><td align='justify'><br>
<code>
Note: Please do not press back button of browser to go back to previous page.
Instead use this button <span class='button'><i class='fas fa-arrow-circle-left'></i></span> where ever provided.
</code>
</td></tr>
</table>
<div align='center'>
<b>Saliant Features</b>
<table class='report' width='60%'>
<tr>$str1</tr><tr>$str2</tr>
</table>
<i>This ERP system is still under development, more and more features are in pipeline to make this system a first and foremost interface to engage with IIIT Allahabad.<br>
Valuable feedbacks are solicited... Please keep on visiting...<br>
Thanks & wishes,
</div>";
}
return $str;
}
public function erpToolbar() {
$app = $this->controller->app;
$menu = $this->controller->menu;
$action = $this->controller->action;
$tuple = $this->controller->tuple ? $this->controller->tuple : 0;
$userACL = $this->model->getUserACLs($this->controller->loginID, $menu);
$filterText = $this->controller->filterText;
// toolbar according to aclInsert, acl Update, aclDelete privileges
$str = "<span class='toolbar'>
<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='Refresh page'><span class='button'><i class='fas fa-sync-alt'></i></span></a>";
// privileged insert operation
$str .= "<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='New record'><span class='button'><i class='far fa-file'></i></span></a>";
// privileged save operations
$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/edit/$tuple'); return false;\" title='Edit record'><span class='button'><i class='far fa-edit'></i></span></a>" : "<span class='button'><i class='far fa-edit'></i></span>");
$str .= (substr($userACL, 0, 1) == '1' || substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/save/$tuple'); return false;\" title='Save record'><span class='button'><i class='far fa-save'></i></span></a>" : "<span class='button'><i class='far fa-save'></i></span>");
$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/upper/$tuple'); return false;\" title='Move upward'><span class='button'><i class='fas fa-arrow-up'></i></span></a>" : "<span class='button'><i class='fas fa-arrow-up'></i></span>");
$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/lower/$tuple'); return false;\" title='Move downward'><span class='button'><i class='fas fa-arrow-down'></i></span></a>" : "<span class='button'><i class='fas fa-arrow-down'></i></span>");
$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/disable/$tuple'); return false;\" title='Disable record'><span class='button'><i class='far fa-thumbs-down'></i></span></a>" : "<span class='button'><i class='far fa-thumbs-down'></i></span>");
$str .= ($tuple && substr($userACL, 1, 1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/enable/$tuple'); return false;\" title='Enable record'><span class='button'><i class='far fa-thumbs-up'></i></span></a>" : "<span class='button'><i class='far fa-thumbs-up'></i></span>");
// privileged delete operation
$str .= ($tuple && substr($userACL, -1) == '1' ? "<a href='' onclick=\"inner('$app/$menu/trash/$tuple'); return false;\" title='Delete record'><span class='button'><i class='far fa-trash-alt'></i></span></a>" : "<span class='button'><i class='far fa-trash-alt'></i></span>");
// initiated delete confirmation
$str .= ($action == 'trash' ? "[<b class='alert'>Are you sure?</b><a href='' onclick=\"inner('$app/$menu/delete/$tuple'); return false;\" title='Confirm deletion'><span class='button'><i class='far fa-check-circle'></i></span></a>|<a href='' onclick=\"inner('$app/$menu/open/$tuple'); return false;\" title='Cancel deletion'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
// regular filter, print and help tool buttons
$str .= "<a href='' onclick=\"inner('$app/$menu/search/$tuple'); return false;\" title='Filter record'><span class='button'><i class='fas fa-search'></i></span></a>";
//$str .= ($action == 'search' || $filterText ? "[<b class='alert'>Filter on</b> <input type='text' id='filter' name='filterText' value='$filterText' size='10' autofocus='autofocus' onkeyup=\"if (this.value.length > 2) {inner('$app/$menu/filter/$tuple'); $('#filter').focus(); return false;}\"><a href='' onclick=\"$('#filter').val(''); inner('$app/$menu/open/$tuple'); return false;\" title='Cancel filter'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
$str .= ($action == 'search' || $filterText ? "[<b class='alert'>Filter on</b> <input type='text' id='filter' name='filterText' value='$filterText' size='10' autofocus='autofocus'><a href='' onclick=\"inner('$app/$menu/filter/$tuple'); return false;\" title='Filter list'><span class='button'><i class='far fa-check-circle'></i></span></a>|<a href='' onclick=\"$('#filter').val(''); inner('$app/$menu/open/$tuple'); return false;\" title='Cancel filter'><span class='button'><i class='far fa-times-circle'></i></span></a>]" : '');
$str .= "<a href='' onclick=\"printMe('contentbar'); return false;\" title='Print record'><span class='button'><i class='fa fa-print'></i></span></a>
<a href='' onclick=\"inner('$app/helper/render/" .$this->model->getMenuID($menu). "'); return false;\" title='Helper Tips'><span class='button'><i class='far fa-question-circle'></i></span></a>
</span>";
return $str;
}
public function erpPrintbar() {
$app = $this->controller->app;
$menu = $this->controller->menu;
$str = "<span class='toolbar'>
<a href='' onclick=\"inner('$app/$menu/new/0'); return false;\" title='Refresh page'><span class='button'><i class='fas fa-sync-alt'></i></span></a>
<a href='' onclick=\"printMe('contentbar'); return false;\" title='Print record'><span class='button'><i class='fa fa-print'></i></span></a>
</span>";
return $str;
}
public function erpPasswd($action, $tuple) {
$action = $this->controller->managePasswd($action, $this->controller->loginID);
$str = "<h3><i class='fas fa-street-view'></i> LDAP Password <a href='' onclick=\"inner('erp/passwd/reset/1'); return false;\" title='Change password'><span class='button'><i class='fas fa-save'></i></span></a></h3>
<table width='50%'>
<tr><th colspan='2'>Reset Password [ LoginID: " .$this->controller->loginID. " ]</th></tr>
<tr><td>New password</td><td><input type='password' name='passwd1' size='30'></td></tr>
<tr><td>Confirm password</td><td><input type='password' name='passwd2' size='30'></td></tr>
</table><br>
Try to set a complex password comprising alphbets, number and special characters.<br>
Please keep on changing your password once in every month for better security of your account.";
return $str; // required to split content in ajax
}
public function erpContent($action='') {
$str = "<div class='contentbar' id='contentbar'>";
//for file upload, ajax will not work so a form with action='includes/erp_upload.php' is needed
if ($action == "About") {
$app = $this->controller->app; // application envoked
$menu = $this->controller->menu; // menu envoked
include "includes/erp_about.inc";
//$str = "<h3>" .$this->model->getMenuTitle($action) .$this->erpPrintbar(). "</h3>";
$str .= $about;
} else {
$str .= $this->erpDashboard();
}
$str .= "</div>";
return $str;
}
function erpFooter() {
$str = "
<div class='xloginbar' id='xloginbar'>" .$this->erpXlogin($this->controller->loginID);
if ($this->controller->sessionID) $str .= "<br><a href='' onclick=\"inner('erp/passwd/open/0'); return false;\" title='Change LDAP password'><i style='font-size:12px;' class='fas fa-key'></i> Change Password</a>";
$str .= "</div>
<div class='xupdatebar' id='xupdatebar'>" .$this->erpXupdate($this->controller->loginID, $this->controller->menu);
if ($this->controller->sessionID) $str .= "<br><a href='backup.php' title='Take backup of database'><i style='font-size:12px;' class='fas fa-database'></i> Backup Database</a>";
$str .= "</div>
<div class='footer'>
[ Your IP <i style='font-size:14px; color:#247BBB' class='fa fa-laptop'></i> " .$this->controller->userIP. " ]
<hr>
<b><span style='font-size:14px;'>©</span>2017 ERP & Automation, IIIT Allahabad, Devghat, Jhalwa, Allahabad-211012 (UP) INDIA<br>
Institute ERP system is under development by internal automation team.<br>
Contact: 0532-2922011/2042/2238, erp.support@iiita.ac.in
<hr></div>";
return $str;
}
function erpUpload() {
$str = "<table width='100%'>
<tr><td>Select Certificate</td><td><select name='certCode' style='width: 265px'>";
foreach ($this->controller->certFiles as $code => $desc) {
$str .= "<option value='" .$code. "'>" .$desc. "</option>";
}
$str .= "</select></td>
<td>Select File</td><td><input type='file' name='fileToUpload' id='fileToUpload' size='50'></td>
<td><input type='submit' name='submit' value='UPLOAD'></td></tr>
</table>
<input type='hidden' name='callerID' value='" .$_POST['callerID']. "'>
<div align='center'>
[ <a href='' onclick=\"inner('" .$this->controller->app. "/" .$this->controller->menu. "/new/" .$this->controller->tuple. "'); return false;\" title='Refresh upload'>Refresh</a> ]
</div>";
return $str;
}
// online pg service integratiob
public function erpIPG() {
$str = "</form><form method='post' action='https://secure.ebs.in/pg/ma/payment/request/' name='frmTransaction' id='frmTransaction' >
<table width='600' cellpadding='2' cellspacing='2' border='0'>
<tr><th colspan='2'>Transaction Details</th></tr>
<tr>
<td class='fieldName'><span class='error'>*</span> Channel</td>
<td align='left'><select name='channel'>
<option value='10'>Standard</option>
</select></td>
</tr>
<tr>
<td class='fieldName' width='50%'><span class='error'>*</span> Account Id</td>
<td align='left' width='50%'> <input name='account_id' type='text' value='25146'/><br><span><font color='red'> Please Enter your Account ID provided.</font></span> </td>
</tr>
<tr>
<td class='fieldName' width='50%'><span class='error'>*</span> Secret Key</td>
<td align='left' width='50%'> <input name='secretkey' type='text' value='' size='35'/><br><span><font color='red'> Please Enter your Secret Key provided.</font></span></td>
</tr>
<tr>
<td class='fieldName' width='50%'><span class='error'>*</span> Reference No</td>
<td align='left' width='50%'> <input name='reference_no' type='text' value='<?php echo time();?>' /></td>
</tr>
<tr>
<td class='fieldName' width='50%'><span class='error'>*</span> Sale Amount</td>
<td align='left' width='50%'> <input name='amount' type='text' value='<?php echo rand(100,999);?>' /> <select name='currency' >
<option value='INR'>INR</option>
</select></td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span> Description</td>
<td align='left'><input name='description' type='text' value='Test Product' /></td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span> Return Url</td>
<td align='left'><input name='return_url' type='text' size='60' value='http://127.0.0.1/hdfcpg/response.php' /></td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span> Mode</td>
<td align='left'><select name='mode' >
<option value='LIVE' selected>LIVE</option>
</select></td>
</tr>
<tr><th colspan='2'>Billing Address</th></tr>
<tr>
<td class='fieldName'><span class='error'>*</span> Name</td>
<td align='left'>
<input name='name' type='text' value='Test Name' /></td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>Address</td>
<td align='left'>
<textarea name='address'>Test Address</textarea> </td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>City</td>
<td align='left'>
<input name='city' type='text' value='Mumbai' /> </td>
</tr>
<tr>
<td class='fieldName'>State/Province</td>
<td align='left'>
<input name='state' type='text' value='MH' /> </td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>ZIP/Postal Code</td>
<td align='left'>
<input name='postal_code' type='text' value='400069' /> </td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>Country</td>
<td align='left'>
<input name='country' type='text' value='IND' /> </td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>Email</td>
<td align='left'>
<input name='email' type='text' value='test@test.com' /> </td>
</tr>
<tr>
<td class='fieldName'><span class='error'>*</span>Telephone</td>
<td align='left'><input name='phone' type='text' value='2211112222' /></td>
</tr>
<tr>
<th colspan='2'>Delivery Address</th>
</tr>
<tr>
<td class='fieldName'> Name</td>
<td align='left'>
<input name='ship_name' type='text' value='Test Name' /></td>
</tr>
<tr>
<td class='fieldName'>Address</td>
<td align='left'>
<input name='ship_address' type='text' value='Test Address' /> </td>
</tr>
<tr>
<td class='fieldName'>City</td>
<td align='left'>
<input name='ship_city' type='text' value='Mumbai' /> </td>
</tr>
<tr>
<td class='fieldName'>State/Province</td>
<td align='left'>
<input name='ship_state' type='text' value='MH' /> </td>
</tr>
<tr>
<td class='fieldName'>ZIP/Postal Code</td>
<td align='left'>
<input name='ship_postal_code' type='text' value='400069' /> </td>
</tr>
<tr>
<td class='fieldName'>Country</td>
<td align='left'><input name='ship_country' type='text' value='IND' /></td>
</tr>
<tr>
<td class='fieldName'>Telephone</td>
<td align='left'><input name='ship_phone' type='text' value='2211112222' /></td>
</tr>
<tr>
<td valign='top' align='center' colspan='2'>
<input name='submitted' value='Submit' type='submit' />
<input value='Reset' type='reset' /> </td>
</tr>
<tr>
<td valign='top' align='center' colspan='2'>
<span class='error'>*</span>
<span>denotes required field</span> </td>
</tr>
</table>
</form><form>
";
return $str;
}
public function erpPGresponse() {
$HASHING_METHOD = 'sha512'; // md5,sha1
// This response.php used to receive and validate response.
if (!isset($_SESSION['SECRET_KEY']) || empty($_SESSION['SECRET_KEY']))
$_SESSION['SECRET_KEY'] = ''; //set your secretkey here
$hashData = $_SESSION['SECRET_KEY'];
ksort($_POST);
foreach ($_POST as $key => $value){
if (strlen($value) > 0 && $key != 'SecureHash') {
$hashData .= '|'.$value;
}
}
if (strlen($hashData) > 0) {
$secureHash = strtoupper(hash($HASHING_METHOD , $hashData));
if ($secureHash == $_POST['SecureHash']){
if($_POST['ResponseCode'] == 0) {
// update response and the order's payment status as SUCCESS in to database
//for demo purpose, its stored in session
$_POST['paymentStatus'] = 'SUCCESS';
$_SESSION['paymentResponse'][$_POST['PaymentID']] = $_POST;
} else {
// update response and the order's payment status as FAILED in to database
//for demo purpose, its stored in session
$_POST['paymentStatus'] = 'FAILED';
$_SESSION['paymentResponse'][$_POST['PaymentID']] = $_POST;
}
// Redirect to confirm page with reference.
$confirmData = array();
$confirmData['PaymentID'] = $_POST['PaymentID'];
$confirmData['Status'] = $_POST['paymentStatus'];
$confirmData['Amount'] = $_POST['Amount'];
$hashData = $_SESSION['SECRET_KEY'];
ksort($confirmData);
foreach ($confirmData as $key => $value){
if (strlen($value) > 0) {
$hashData .= '|'.$value;
}
}
if (strlen($hashData) > 0) {
$secureHash = strtoupper(hash($HASHING_METHOD , $hashData));
}
$str .= "<html>
<body onLoad='document.payment.submit();'>
<form action='confirm.php' name='payment' method='POST'>";
foreach($confirmData as $key => $value) {
$str .= "<input type='hidden' value='" .$value. "' name='" .$key. "'/>";
}
$str .= "<input type='hidden' value='" .$secureHash. "' name='SecureHash'/>
</form>
</body>
</html>";
} else {
$str .= "<h1>Error!</h1>
<p>Hash validation failed</p>";
}
} else {
$str .= "<h1>Error!</h1>
<p>Invalid response</p>";
}
return $str;
}
// erp backup generation
public function erpDb($action, $db) {
if ($action == 'backup') {
$str = $this->controller->erpBackup();
} else {
$str = "Action not mentioned.";
}
return $str;
}
//*********************************************** reports on session, log and sql commands
public function erpSession($action, $dated='') {
$app = $this->controller->app; // application envoked
$menu = $this->controller->menu; // menu envoked
if (!$dated) $dated = date("Y-m-d");
$rows = $this->model->listSessions($dated, $this->controller->loginID);
$str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
$str .= $this->dateTool($dated);
$str .= $this->printReport($rows);
return $str;
}
public function erpLog($action, $dated='') {
$app = $this->controller->app; // application envoked
$menu = $this->controller->menu; // menu envoked
if (!$dated) $dated = date("Y-m-d");
$rows = $this->model->listLogs($dated, $this->controller->loginID);
$str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
$str .= $this->dateTool($dated);
$str .= $this->printReport($rows);
return $str;
}
public function erpSql($action, $dated='') {
$app = $this->controller->app; // application envoked
$menu = $this->controller->menu; // menu envoked
if (!$dated) $dated = date("Y-m-d");
$rows = $this->model->listSqls($dated, $this->controller->loginID);
$str = "<h3>" .$this->model->getMenuTitle($menu) .$this->erpPrintbar(). "</h3>";
$str .= $this->dateTool($dated);
$str .= $this->printReport($rows);
return $str;
}
public function dateTool($dated) {
$app = $this->controller->app; // application envoked
$menu = $this->controller->menu; // menu envoked
if (!$dated) $dated = date("Y-m-d");
$yester = date('Y-m-d', strtotime($dated .' -1 day'));
$tomoro = date('Y-m-d', strtotime($dated .' +1 day'));
$str = "<div align='center'>
<a href='' onclick=\"inner('$app/$menu/filter/$yester'); return false;\" title='Previous'> <span class='button'><i class='fas fa-chevron-circle-left'></i></span></a>
<b>[ " .$dated. " ]</b>" .($dated != date("Y-m-d") ? "
<a href='' onclick=\"inner('$app/$menu/filter/$tomoro'); return false;\" title='Next'> <span class='button'><i class='fas fa-chevron-circle-right'></i></span></a>" : ''). "
</div>";
return $str;
}
public function printReport($rows) {
$str = "<table width='100%'>";
foreach($rows as $row) {
$i++;
if ($i == 1) {
$str .= "<tr><th>#</th>";
foreach ($row as $key => $value) {
$str .= "<th>" .ucfirst($key). "</th>";
}
$str .= "</tr>";
}
$str .= "<tr valign='top'><td>$i</td>";
foreach ($row as $key => $value) {
$str .= "<td>$value</td>";
}
$str .= "</tr>";
}
$str .= "</table>";
return $str;
}
}
//fpdf - pdf generator
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'../includes/fpdf.php');
class MCAIP extends FPDF {
function Header() {
if ($this->page == 1) {
//$this->Image('images/logo.png', 6, 8, 20);
//$this->Image('images/iiitahindi.png', 38, 7, 134, 6);
$this->SetXY(10, 8);
$this->SetFont('Helvetica','B', 15);
$this->Cell(0, 12, 'Mediclaim-cum-Accidental Insurence Benefits Scheme (MCAIP)', 0, 1, 'C');
$this->SetFont('Helvetica', 'B', 10);
$this->Cell(0, 3, 'Offered by', 0, 1, 'C');
$this->SetFont('Helvetica', 'B', 12);
$this->Cell(0, 7, 'National Insurence Company Limited EXECLUSIVELY for all ' .$this->banner['instituteCode']. ' Students', 0, 1, 'C');
$this->Line(0, 30, 500, 30);
$this->Ln(10);
}
}
function Footer() {
$this->SetY(-18);
$this->SetDrawColor(188, 188, 188);
$this->SetLineWidth(1);
$this->Line(startpoint, 45, endpoint-50, 45);
$this->SetXY(65, -15);
$this->SetFont('Helvetica', 'I', 8);
//$this->Write(5, 'Page 25 of 26');
}
}
class Receipt extends FPDF {
function Header() {
//if ($this->page == 1) {
if ($this->banner['logoImage']) $this->Image('images/' .$this->banner['logoImage'], 6, 8, 20);
$this->Image('images/' .str_replace('c.', '.', $this->banner['nameHindi']), 38, 7, 134, 6);
$this->SetXY(10, 12);
$this->SetFont('Helvetica','B', 15);
$this->Cell(0, 10, $this->banner['instituteName'], 0, 1, 'C');
$this->SetFont('Helvetica', 'B', 10);
$this->Cell(0, 5, $this->banner['address'], 0, 1, 'C');
$this->SetFont('Helvetica', 'B', 9);
$this->Cell(0, 4, 'Phone: ' .$this->banner['phoneNo']. ', Email: ' .$this->banner['email']. ', Web: ' .$this->banner['website'], 0, 1, 'C');
$this->Line(0, 32, 500, 32);
$this->Ln(14);
//}
}
function Footer() {
/*
$this->SetY(-10);
$this->SetDrawColor(188, 188, 188);
$this->SetLineWidth(1);
$this->Line(startpoint, 25, endpoint-30, 25);
$this->SetXY(65, -5);
$this->SetFont('Helvetica', 'I', 8);
$this->Write(5, 'Please use this receipt for your education loan from any bank.');
*/
}
}
class IDCard extends FPDF {
function Header() {
if ($this->page == 1) {
$this->Rect(0, 0, 100, 15 , F);
$this->SetFillColor(0, 32, 100);
if ($this->banner['logoImage']) $this->Image('images/' .$this->banner['logoImage'], 2, 3, 8, 10);
$this->Image('images/' .$this->banner['nameHindi'], 10, 2, 71, 4);
$this->SetTextColor(255, 245, 0);
$this->SetXY(16, 1);
$this->SetFont('Helvetica', 'B', 8);
$this->Cell(0, 14, $this->banner['instituteName'], 0, 1, 'C');
$this->SetXY(15, 12);
$this->SetFont('Helvetica', '', 6);
$this->Cell(0, 0, '(' .$this->banner['brandTagline']. ')', 0, 1, 'C');
$this->Line(0, 15, 100, 15);
$this->Ln(1);
}
}
}
?>