Example #1
0
 /**
  * 
  * @param type $dataArray
  * @return type
  */
 public function servicegrid($dataArray)
 {
     $actnArr = array();
     $sortStr = isset($dataArray['by']) ? $dataArray['by'] : "";
     if (isset($dataArray['menuName']) && $dataArray['menuName'] != '') {
         $menuName = $dataArray['menuName'];
     }
     $gridFieldsArr = array();
     $tmpActionsArr = array();
     array_pop($tmpActionsArr);
     //last element of actions array is menuname so delete that & check the privileges are empty or not...
     $actnArr = $tmpActionsArr;
     if (($key = array_search('add', $actnArr)) !== false) {
         unset($actnArr[$key]);
     }
     if (empty($tmpActionsArr)) {
         unset($gridFieldsArr['action']);
         $gridFieldsArr = $dataArray['tableheader'];
         $dataArray['tableheader'] = $gridFieldsArr;
     }
     if (isset($dataArray['menuName'])) {
         $menuName = $dataArray['menuName'];
     }
     $page_adapter = new Zend_Paginator_Adapter_DbSelect($dataArray['tablecontent']);
     $page_adapter->setRowCount($dataArray['row_count']);
     $paginator = new Zend_Paginator($page_adapter);
     $paginator->setItemCountPerPage($dataArray['perPage'])->setCurrentPageNumber($dataArray['pageNo']);
     if (empty($dataArray['tableheader'])) {
         $widgetsModel = new Default_Model_Widgets();
         $columnData = $widgetsModel->getTableFields('/' . $dataArray['objectname']);
         $dataArray['tableheader'] = json_decode($columnData['menufields'], true);
     }
     $msgtitle = $dataArray['objectname'] . '_delete';
     $msgtitle = strtoupper($msgtitle);
     $formgridVal = '';
     $extra['action'] = array();
     $extra['options'] = array();
     $addaction = '';
     if (isset($dataArray['add']) && $dataArray['add'] != '') {
         $addaction = $dataArray['add'];
         $addpermission = "true";
     } else {
         $addaction = '';
         $addpermission = "false";
     }
     return $this->generateGrid($dataArray, $paginator, $extra, true, $formgridVal, $addaction, $menuName, $addpermission, $sortStr, $actnArr);
 }
Example #2
0
 public function welcomeAction()
 {
     $auth = Zend_Auth::getInstance();
     $businessunit_id = '';
     $department_id = '';
     if ($auth->hasIdentity()) {
         $businessunit_id = $auth->getStorage()->read()->businessunit_id;
         $department_id = $auth->getStorage()->read()->department_id;
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
     }
     $widgetsModel = new Default_Model_Widgets();
     // Birthdays & Announcements
     $birthdaysRes = $widgetsModel->getTodaysBirthdays($businessunit_id, $department_id);
     $upcomingBirthdyas = $widgetsModel->getUpcomingBirthdays($businessunit_id, $department_id);
     $this->view->todyasBirthdays = $birthdaysRes;
     $this->view->upcomingBirthdyas = $upcomingBirthdyas;
     // Announcements - START
     $announcementsModel = new Default_Model_Announcements();
     $announcementsData = $announcementsModel->getAllByBusiAndDeptId();
     $this->view->announcementsData = $announcementsData;
     // Announcements - END
     //Widgets formats
     //Interview Schedules = 'format1';
     //My Service Request = 'format2';
     //Request Pending Approval = 'format3';
     //Leaves Available = 'format4';
     //My Leaves This Month = 'format5';
     //Leave Management Options = 'format6';
     //My details = 'format7';
     $menuIdsArr = array(57 => 'format1', 10 => 'format5', 11 => 'format5', 20 => 'format5', 21 => 'format5', 14 => 'format4', 23 => 'format2', 32 => 'format7', 34 => 'format4', 35 => 'format5', 41 => 'format5', 42 => 'format5', 45 => 'format3', 54 => 'format4', 55 => 'format5', 56 => 'format4', 61 => 'format3', 65 => 'format3', 44 => 'format6', 43 => 'format5', 80 => 'format5', 86 => 'format5', 87 => 'format5', 88 => 'format5', 89 => 'format5', 90 => 'format5', 91 => 'format5', 92 => 'format5', 93 => 'format5', 100 => 'format5', 101 => 'format5', 102 => 'format5', 103 => 'format5', 107 => 'format5', 108 => 'format5', 110 => 'format5', 111 => 'format5', 114 => 'format5', 115 => 'format5', 116 => 'format5', 117 => 'format5', 118 => 'format5', 120 => 'format5', 121 => 'format5', 123 => 'format5', 124 => 'format5', 125 => 'format5', 126 => 'format5', 127 => 'format5', 128 => 'format5', 132 => 'format5', 136 => 'format5', 140 => 'format5', 143 => 'format3', 144 => 'format5', 145 => 'format5', 146 => 'format5', 148 => 'format3', 150 => 'format5', 151 => 'format5', 152 => 'format5', 154 => 'format4', 155 => 'format5', 165 => 'format5', 166 => 'format5', 62 => 'format3', 63 => 'format3', 64 => 'format3', 68 => 'format3', 69 => 'format3', 85 => 'format3', 131 => 'format5', 134 => 'format3', 135 => 'format3', 138 => 'format3', 139 => 'format3', 140 => 'format5', 142 => 'format5', 151 => 'format5', 154 => 'format6', 158 => 'format5', 159 => 'format5', 160 => '', 161 => 'format3', 165 => 'format5', 166 => 'format5', 167 => 'format6', 168 => '', 174 => 'format5', 169 => 'format3', 170 => 'format3', 172 => 'format5', 174 => 'format5');
     $getMenuIds = $widgetsModel->getWidgets($loginUserId, $loginuserRole);
     $htmlcontent = '';
     $tmpHtml1 = "";
     $tmpHtml5 = "";
     $tmpHtml2 = "";
     $tmpHtml3 = "";
     $tmpHtml4 = "";
     $format = '';
     if (!empty($getMenuIds)) {
         //$i,j for css color changing for widgets
         $i = 1;
         $j = 1;
         foreach ($getMenuIds as $getMenuIdArr) {
             $i = $i >= 5 ? $i - 4 : $i;
             // I for format 2,3,4
             $j = $i >= 5 ? $j - 4 : $j;
             // J for format 5
             $menuId = $getMenuIdArr['id'];
             $url = $getMenuIdArr['url'];
             $format = isset($menuIdsArr[$menuId]) ? $menuIdsArr[$menuId] : '';
             if ($menuId == 57) {
                 $tmpHtml1 = sapp_Global::format1($url);
             } else {
                 if ($format == 'format2') {
                     $tmpHtml2 .= sapp_Global::format2($menuId, $i, $url);
                     $i++;
                 } else {
                     if ($format == 'format3') {
                         $tmpHtml2 .= sapp_Global::format3($menuId, $i, $url);
                         $i++;
                     } else {
                         if ($format == 'format4') {
                             $tmpHtml2 .= sapp_Global::format4($menuId, $i, $url);
                             $i++;
                         } else {
                             if ($format == 'format5') {
                                 $tmpHtml5 .= sapp_Global::format5($menuId, $j, $url);
                                 $j++;
                             } else {
                                 if ($format == 'format6') {
                                     $tmpHtml5 .= sapp_Global::format6($menuId, $url);
                                     $j++;
                                 } else {
                                     if ($format != '') {
                                         $htmlcontent .= sapp_Global::format7($menuId, $url);
                                     } else {
                                         if ($format == '') {
                                             $htmlcontent = '';
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //$htmlcontent = '<div class="left_dashboard">'.$tmpHtml1.$tmpHtml2.$tmpHtml4.$tmpHtml3.$tmpHtml5.$htmlcontent.'</div>';
         $htmlcontent = '<div class="left_dashboard">' . $tmpHtml1 . $tmpHtml2 . '<div class="clear"></div>' . $tmpHtml5 . $htmlcontent . '</div>';
     }
     $this->view->htmlcontent = $htmlcontent;
 }
Example #3
0
    /**
     * 
     * @param type $dataArray
     * @param type $ViewOnly
     * @return type
     */
    public function employeegrid($dataArray, $ViewOnly = null)
    {
        $request = Zend_Controller_Front::getInstance();
        $params = $request->getRequest()->getParams();
        $employeeTabs = array('employee', 'dependencydetails', 'creditcarddetails', 'visaandimmigrationdetails', 'workeligibilitydetails', 'disabilitydetails', 'empcommunicationdetails', 'empskills', 'empleaves', 'empholidays', 'medicalclaims', 'educationdetails', 'experiencedetails', 'trainingandcertificationdetails', 'emppersonaldetails', 'myemployees', 'empperformanceappraisal', 'emppayslips', 'empbenefits', 'emprenumerationdetails', 'emprequisitiondetails', 'empadditionaldetails', 'empsecuritycredentials', 'empsalarydetails', 'empjobhistory');
        $controllerNamesArr = array('empleaves', 'empholidays', 'myemployees');
        $request = Zend_Controller_Front::getInstance();
        $dynamiccontrollerName = $request->getRequest()->getControllerName();
        //Give all 24tabs of employee.
        $view = Zend_Layout::getMvcInstance()->getView();
        $session = new Zend_Auth_Storage_Session();
        $data = $session->read();
        $role_id = $data['emprole'];
        $group_id = $data['group_id'];
        $loggedinEmpId = $data['id'];
        $useridFromURL = $dataArray['userid'];
        $controllerName = $dataArray['objectname'];
        $menunamestr = '';
        $sortStr = "";
        $objId = '';
        $context = "";
        $actnArr = array();
        $sortStr = $dataArray['by'];
        $actions_arr = array();
        $privilegesofObj = array();
        if (in_array($dataArray['objectname'], $employeeTabs)) {
            if (array_key_exists("context", $dataArray)) {
                $context = $dataArray['context'];
                if ($dataArray['context'] == "mydetails") {
                    $objId = MYDETAILS;
                } else {
                    if ($dataArray['context'] == "myteam") {
                        $objId = MYEMPLOYEES;
                    } else {
                        if ($dataArray['context'] == "") {
                            $objId = EMPLOYEE;
                        }
                    }
                }
            } else {
                $objId = EMPLOYEE;
            }
            if ($role_id != "") {
                $privilege_model = new Default_Model_Privileges();
                //For grids... From mydetails controller,privileges are sending to grid in dataArray
                if (array_key_exists("actions_arr", $dataArray)) {
                    $actions_arr = $dataArray['actions_arr'];
                    array_push($actions_arr, $dataArray['menuName']);
                } else {
                    $idCsv = 0;
                    //flag 	- No id is single id not Csv... in dashboard we are sending CSV....
                    $privilegesofObj = $privilege_model->getObjPrivileges($objId, "", $role_id, $idCsv);
                    if (!empty($privilegesofObj)) {
                        //If the logged in employee is HR or Superadmin(role =1) or Employee himself want to edit his record.....
                        if ($privilegesofObj['viewpermission'] == 'Yes') {
                            array_push($actions_arr, 'view');
                        }
                        //For Leaves,Holidays there shoould be only view privilege.....
                        if (!in_array($controllerName, $controllerNamesArr)) {
                            if ($privilegesofObj['editpermission'] == 'Yes') {
                                array_push($actions_arr, 'edit');
                            }
                            if ($privilegesofObj['deletepermission'] == 'Yes') {
                                array_push($actions_arr, 'delete');
                            }
                            if ($privilegesofObj['addpermission'] == 'Yes') {
                                array_push($actions_arr, 'add');
                            }
                            if ($privilegesofObj['uploadattachments'] == 'Yes') {
                                array_push($actions_arr, 'upload');
                            }
                            if ($privilegesofObj['viewattachments'] == 'Yes') {
                                array_push($actions_arr, 'uploadview');
                            }
                        }
                        array_push($actions_arr, $dataArray['menuName']);
                    } else {
                        $actions_arr[0] = 'view';
                        $actions_arr[1] = $dataArray['menuName'];
                    }
                }
            }
        } else {
            $actions_arr = array();
        }
        $gridFieldsArr = array();
        $tmpActionsArr = array();
        $tmpActionsArr = $actions_arr;
        array_pop($tmpActionsArr);
        //last element of actions array is menuname so delete that & check the privileges are empty or not...
        $actnArr = $tmpActionsArr;
        if (($key = array_search('add', $actnArr)) !== false) {
            unset($actnArr[$key]);
        }
        if (empty($tmpActionsArr)) {
            $gridFieldsArr = $dataArray['tableheader'];
            unset($gridFieldsArr['action']);
            $dataArray['tableheader'] = $gridFieldsArr;
        }
        if (isset($dataArray['menuName'])) {
            $menuName = $dataArray['menuName'];
        }
        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($dataArray['tablecontent']));
        $paginator->setItemCountPerPage($dataArray['perPage'])->setCurrentPageNumber($dataArray['pageNo']);
        if (empty($dataArray['tableheader'])) {
            $widgetsModel = new Default_Model_Widgets();
            $columnData = $widgetsModel->getTableFields('/' . $dataArray['objectname']);
            $dataArray['tableheader'] = json_decode($columnData['menufields'], true);
        }
        $msgtitle = $dataArray['objectname'] . '_delete';
        $msgtitle = strtoupper($msgtitle);
        $msgflag = constant($msgtitle);
        $msgAr = explode(' ', $msgflag);
        $msgdta = implode('@#$', $msgAr);
        if (isset($dataArray['formgrid']) && $dataArray['formgrid'] == 'true') {
            $urlString = $_SERVER['REQUEST_URI'];
            $urlData = explode('/', $urlString);
            $con = '';
            if (isset($dataArray['unitId'])) {
                $con = '/unitId/' . $dataArray['unitId'];
            } else {
                if (isset($params['id'])) {
                    $con = '/unitId/' . $params['id'];
                }
            }
            $formgridVal = $dataArray['formgrid'];
            if ($dataArray['objectname'] == 'departments') {
                $viewaction = 'view';
            } else {
                $viewaction = 'viewpopup';
            }
            $editaction = 'editpopup';
            if ($dataArray['menuName'] != '') {
                $menunamestr = $dataArray['menuName'];
            }
            $viewpopup_str = '<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $viewaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite view"  title=\'View\'></a>';
            $editpopup_str = '<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $editaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite edit"  title=\'Edit\' ></a>';
            $deletepopup_str = '<a name="{{id}}" onclick= changeEmployeestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\',\'' . $dataArray['userid'] . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
            if (!in_array('view', $actions_arr) && !in_array('edit', $actions_arr) && !in_array('delete', $actions_arr)) {
                if ($dataArray['objectname'] == 'processes') {
                    $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
								<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $viewaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite view"  title=\'View\'></a>
								<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $editaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite edit"  title=\'Edit\' ></a>
								<a name="{{id}}" onclick= changeEmployeestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\',\'' . $dataArray['userid'] . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>
							</div>');
                } else {
                    $extra['action'] = array();
                }
            } else {
                $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
								' . (in_array('view', $actions_arr) ? $viewpopup_str : '') . '
								' . (in_array('edit', $actions_arr) ? $editpopup_str : '') . '
								' . (in_array('delete', $actions_arr) ? $deletepopup_str : '') . '
							</div>');
            }
        } else {
            $formgridVal = '';
            $view_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/view/id/{{id}}" name="{{id}}" class="sprite view"  title=\'View\'></a>';
            $edit_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/edit/id/{{id}}" name="{{id}}" class="sprite edit"  title=\'Edit\'></a>';
            if ($dataArray['objectname'] == 'employee') {
                $delete_str = '';
            } else {
                $delete_str = '<a name="{{id}}" onclick= changeEmployeestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\',\'' . $dataArray['userid'] . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
            }
            if (!in_array('view', $actions_arr) && !in_array('edit', $actions_arr) && !in_array('delete', $actions_arr)) {
                $extra['action'] = array();
            } else {
                $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
										' . (in_array('view', $actions_arr) ? $view_str : '') . '
										' . (in_array('edit', $actions_arr) ? $edit_str : '') . '
										' . (in_array('delete', $actions_arr) ? $delete_str : '') . '
									</div>');
            }
        }
        $extra['options'] = array();
        $addaction = '';
        if (isset($dataArray['add']) && $dataArray['add'] != '') {
            $addaction = $dataArray['add'];
        } else {
            $addaction = '';
        }
        $unitId = '';
        if (in_array('add', $actions_arr)) {
            if ($ViewOnly == 1) {
                $addpermission = "false";
            } else {
                $addpermission = "true";
            }
        } else {
            $addpermission = "false";
        }
        if (isset($dataArray['unitId'])) {
            $unitId = $dataArray['unitId'];
        }
        return $this->generateGrid($dataArray['objectname'], $dataArray['tableheader'], $paginator, $extra, true, $dataArray['jsGridFnName'], $dataArray['perPage'], $dataArray['pageNo'], $dataArray['jsFillFnName'], $dataArray['searchArray'], $formgridVal, $addaction, $menuName, $unitId, $addpermission, $menunamestr, isset($dataArray['call']) ? $dataArray['call'] : "", $sortStr, $context, isset($dataArray['search_filters']) ? $dataArray['search_filters'] : "", isset($dataArray['dashboardcall']) ? $dataArray['dashboardcall'] : "No", $actnArr, isset($dataArray['sort']) ? $dataArray['sort'] : "", isset($dataArray['by']) ? $dataArray['by'] : "", $ViewOnly);
    }
Example #4
0
    public function grid($dataArray)
    {
        $request = Zend_Controller_Front::getInstance();
        $params = $request->getRequest()->getParams();
        $menu_model = new Default_Model_Menu();
        $session = new Zend_Auth_Storage_Session();
        $data = $session->read();
        $role_id = $data['emprole'];
        $menunamestr = '';
        $sortStr = '';
        $actnArr = array();
        $sortStr = $dataArray['by'];
        $controllers_arr = $menu_model->getControllersByRole($role_id);
        if ($dataArray['objectname'] == 'processes') {
            $actionsobjname = 'empscreening';
        } else {
            $actionsobjname = $dataArray['objectname'];
        }
        if (isset($controllers_arr[$actionsobjname . "controller.php"])) {
            $actions_arr = $controllers_arr[$actionsobjname . "controller.php"]['actions'];
            $menuName = $actions_arr[sizeof($actions_arr) - 1];
        } else {
            $actions_arr = array();
        }
        $gridFieldsArr = array();
        $tmpActionsArr = array();
        $tmpActionsArr = $actions_arr;
        array_pop($tmpActionsArr);
        //last element of actions array is menuname so delete that & check the privileges are empty or not...
        $actnArr = $tmpActionsArr;
        if (($key = array_search('add', $actnArr)) !== false) {
            unset($actnArr[$key]);
        }
        if (empty($tmpActionsArr)) {
            $gridFieldsArr = $dataArray['tableheader'];
            unset($gridFieldsArr['action']);
            $dataArray['tableheader'] = $gridFieldsArr;
        }
        if (isset($dataArray['menuName'])) {
            $menuName = $dataArray['menuName'];
        }
        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($dataArray['tablecontent']));
        $paginator->setItemCountPerPage($dataArray['perPage'])->setCurrentPageNumber($dataArray['pageNo']);
        if (empty($dataArray['tableheader'])) {
            $widgetsModel = new Default_Model_Widgets();
            $columnData = $widgetsModel->getTableFields('/' . $dataArray['objectname']);
            $dataArray['tableheader'] = json_decode($columnData['menufields'], true);
        }
        $msgtitle = $dataArray['objectname'] . '_delete';
        $msgtitle = strtoupper($msgtitle);
        $msgflag = constant($msgtitle);
        $msgAr = explode(' ', $msgflag);
        $msgdta = implode('@#$', $msgAr);
        if (isset($dataArray['formgrid']) && $dataArray['formgrid'] == 'true') {
            if (isset($dataArray['unitId'])) {
                $con = '/unitId/' . $dataArray['unitId'];
            } else {
                if (isset($params['id'])) {
                    $con = '/unitId/' . $params['id'];
                }
            }
            $formgridVal = $dataArray['formgrid'];
            if ($dataArray['objectname'] == 'departments') {
                $viewaction = 'view';
            } else {
                $viewaction = 'viewpopup';
            }
            $editaction = 'editpopup';
            if (isset($dataArray['menuName']) && $dataArray['menuName'] != '') {
                $menunamestr = $dataArray['menuName'];
            }
            $viewpopup_str = '<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $viewaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite view"  title=\'View\'></a>';
            $editpopup_str = '<a id="edit{{id}}" onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $editaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite edit"  title=\'Edit\' ></a>';
            $deletepopup_str = '<a name="{{id}}" id="del{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
            if (!in_array('view', $actions_arr) && !in_array('edit', $actions_arr) && !in_array('delete', $actions_arr)) {
                if ($dataArray['objectname'] == 'processes') {
                    $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
								<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $viewaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite view"  title=\'View\'></a>
								<a onclick="displaydeptform(\'' . DOMAIN . $dataArray['objectname'] . '/' . $editaction . '/id/{{id}}' . $con . '/popup/1\',\'' . $menunamestr . '\')" name="{{id}}" class="sprite edit"  title=\'Edit\' ></a>
								<a name="{{id}}" id="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>
							</div>');
                } else {
                    $extra['action'] = array();
                }
            } else {
                if ($dataArray['objectname'] == 'empleavesummary' || $dataArray['objectname'] == 'empscreening') {
                    $view_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/view/id/{{id}}" name="{{id}}" class="sprite view"  title=\'View\'></a>';
                    $edit_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/edit/id/{{id}}" name="{{id}}" class="sprite edit"  title=\'Edit\'></a>';
                    $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
                    $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
										' . (in_array('view', $actions_arr) ? $view_str : '') . '
										' . (in_array('edit', $actions_arr) ? $edit_str : '') . '
										' . (in_array('delete', $actions_arr) ? $delete_str : '') . '
									</div>');
                } else {
                    $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
									' . (in_array('view', $actions_arr) ? $viewpopup_str : '') . '
									' . (in_array('edit', $actions_arr) ? $editpopup_str : '') . '
									' . (in_array('delete', $actions_arr) ? $deletepopup_str : '') . '
								</div>');
                }
            }
        } else {
            $formgridVal = '';
            $view_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/view/id/{{id}}" name="{{id}}" class="sprite view"  title=\'View\'></a>';
            $edit_str = '<a href= "' . DOMAIN . $dataArray['objectname'] . '/edit/id/{{id}}" name="{{id}}" class="sprite edit"  title=\'Edit\'></a>';
            if ($dataArray['objectname'] == 'pendingleaves') {
                $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Cancel Leave\' class="sprite cancel-lev" ></a>';
            } else {
                if ($dataArray['objectname'] == 'createprojects') {
                    $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Cancel Project\' class="sprite cancel-lev" ></a>';
                } else {
                    if ($dataArray['objectname'] == 'createtasks') {
                        $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Cancel Tasks\' class="sprite cancel-lev" ></a>';
                    } else {
                        if ($dataArray['objectname'] == 'approvedleaves') {
                            $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Cancel Approved Leave\' class="sprite cancel-lev" ></a>';
                        } else {
                            if ($dataArray['objectname'] == 'manageremployeevacations') {
                                if ($params['action'] == "approved" || $_SESSION["manageremployeevacations_view"] == "2") {
                                    $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Cancel Approved Leave\' class="sprite cancel-lev" ></a>';
                                }
                            } else {
                                if ($dataArray['objectname'] == 'usermanagement') {
                                    $delete_str = '<a id="del{{id}}" name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
                                } else {
                                    $delete_str = '<a name="{{id}}" onclick= changestatus(\'' . $dataArray['objectname'] . '\',\'{{id}}\',\'' . $msgdta . '\')	href= javascript:void(0) title=\'Delete\' class="sprite delete" ></a>';
                                }
                            }
                        }
                    }
                }
            }
            if (!in_array('view', $actions_arr) && !in_array('edit', $actions_arr) && !in_array('delete', $actions_arr)) {
                $extra['action'] = array();
            } else {
                $extra['action'] = array('name' => 'edit', 'value' => '<div class="grid-action-align">
										' . (in_array('view', $actions_arr) ? $view_str : '') . '
										' . (in_array('edit', $actions_arr) ? $edit_str : '') . '
										' . (in_array('delete', $actions_arr) ? $delete_str : '') . '
									</div>');
                //onclick ="javascript:editlocdata(\'{{id}}\')"
            }
        }
        $extra['options'] = array();
        $addaction = '';
        if (isset($dataArray['add']) && $dataArray['add'] != '') {
            $addaction = $dataArray['add'];
        } else {
            $addaction = '';
        }
        $unitId = '';
        if (in_array('add', $actions_arr)) {
            $addpermission = "true";
        } else {
            $addpermission = "false";
        }
        if (isset($dataArray['unitId'])) {
            $unitId = $dataArray['unitId'];
        }
        return $this->generateGrid($dataArray['objectname'], $dataArray['tableheader'], $paginator, $extra, true, $dataArray['jsGridFnName'], $dataArray['perPage'], $dataArray['pageNo'], $dataArray['jsFillFnName'], $dataArray['searchArray'], $formgridVal, $addaction, $menuName, $unitId, $addpermission, $menunamestr, isset($dataArray['call']) ? $dataArray['call'] : "", $sortStr, isset($dataArray['search_filters']) ? $dataArray['search_filters'] : "", isset($dataArray['dashboardcall']) ? $dataArray['dashboardcall'] : "No", isset($dataArray['empstatus']) ? $dataArray['empstatus'] : "", $actnArr, isset($dataArray['empscreentotalcount']) ? $dataArray['empscreentotalcount'] : "", isset($dataArray['sort']) ? $dataArray['sort'] : "", isset($dataArray['by']) ? $dataArray['by'] : "");
    }
Example #5
0
    public static function format7($id = '', $url = '')
    {
        // Get login user data
        $auth = Zend_Auth::getInstance();
        $session = $auth->getStorage()->read();
        $loginUserId = $session->id;
        $widgetsModel = new Default_Model_Widgets();
        $format7 = $widgetsModel->format7($id);
        $title = self::titleArr($id, 'title');
        $btnText = self::titleArr($id, 'btnText');
        $emptyText = self::titleArr($id, 'emptyText');
        if (!empty($url)) {
            $url = substr($url, 1);
        }
        $htmlContent = '<div class="dashboard_bottom_box my_details_box" ><h4 >' . $title . '</h4>';
        if (!empty($format7)) {
            $jobtitlename = strlen($format7['jobtitlename']) > 27 ? substr($format7['jobtitlename'], 0, 25) . '..' : $format7['jobtitlename'];
            $emailaddress = strlen($format7['emailaddress']) > 27 ? substr($format7['emailaddress'], 0, 25) . '..' : $format7['emailaddress'];
            $empname = strlen($format7['empname']) > 27 ? substr($format7['empname'], 0, 25) . '..' : $format7['empname'];
            $htmlContent .= '<div class="tot_cnt"><div class="profile_img ">
						<img src="' . DOMAIN . 'public/uploads/profile/' . $format7['profileimg'] . '" width="53px" height="53px" onerror=\'this.src="' . DOMAIN . 'public/media/images/default-profile-pic.jpg"\'>
					</div></div><div class="dashboard_bottom_div"> ';
            $htmlContent .= "<ul class='leave_mana'><li><span>Name</span>:<span class='ul_span_2' title = '" . $format7['empname'] . "'>" . $empname . "</span></li>";
            $htmlContent .= "<li><span>ID</span>:<span class='ul_span_2' title = '" . $format7['employeeId'] . "'>" . $format7['employeeId'] . "</span></li>";
            $htmlContent .= "<li><span>Job Title</span>:<span class='ul_span_2' title = '" . $format7['jobtitlename'] . "'>" . $jobtitlename . "</span></li>";
            $htmlContent .= "<li><span>Email</span>:<span class='ul_span_2' title = '" . $format7['emailaddress'] . "'>" . $emailaddress . "</span></li>";
            if (strlen($format7['contact']) > 1) {
                $htmlContent .= "<li><span>Contact</span>:<span class='ul_span_2' title = '" . $format7['contact'] . "'>" . $format7['contact'] . "</span></li>";
            }
            $htmlContent .= "</ul></div>";
        } else {
            $htmlContent .= "<div class='dashboard_bottom_div' ><span class='no_text no_data'>No data</span></div>";
        }
        if (!empty($url)) {
            $htmlContent .= '<a href="' . BASE_URL . $url . '"class="box_link view_link">' . $btnText . '</a>';
        }
        $htmlContent .= '</div>';
        return $htmlContent;
    }
Example #6
0
 public function welcomeAction()
 {
     try {
         $call = $this->_getParam('call');
         if ($call == 'ajaxcall') {
             $this->_helper->layout->disableLayout();
         }
         $emptyRoles = 0;
         $dataemptyFlag = '';
         $extraParam1 = '';
         $extraParam2 = '';
         $extraParam3 = '';
         $extraParam4 = '';
         $loginUserId = '';
         $loginRoleId = '';
         $loginuserGroup = '';
         $data = array();
         $datacontent = '';
         $defaultOrderBy = "";
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $loginUserId = $auth->getStorage()->read()->id;
             $loginRoleId = $auth->getStorage()->read()->emprole;
             $loginuserGroup = $auth->getStorage()->read()->group_id;
         }
         $objname = $this->_getParam('objname');
         $refresh = $this->_getParam('refresh');
         $widgetsModel = new Default_Model_Widgets();
         if ($call == 'ajaxcall') {
             $widgetsArr = array($objname);
         } else {
             $widgetsArr = $widgetsModel->getWidgets($loginUserId, $loginRoleId);
         }
         if (!empty($widgetsArr)) {
             for ($i = 0; $i < sizeof($widgetsArr); $i++) {
                 //Url
                 $url = $widgetsArr[$i]['url'];
                 //objectname
                 $objectName = ltrim($widgetsArr[$i]['url'], '/');
                 //menuName
                 $menuName = $widgetsArr[$i]['menuName'];
                 //model name
                 $modelName = $widgetsArr[$i]['modelName'];
                 //Default order by
                 if ($widgetsArr[$i]['defaultOrderBy'] != "") {
                     $defaultOrderBy = $widgetsArr[$i]['defaultOrderBy'];
                 } else {
                     $defaultOrderBy = "";
                 }
                 //	Flag for Leaves status....	like approved,rejected,pending,cancel
                 if ($url == "/rejectedleaves") {
                     $extraParam1 = "rejectedleaves";
                     $extraParam2 = "rejected";
                 }
                 if ($url == "/approvedleaves") {
                     $extraParam1 = "approvedleaves";
                     $extraParam2 = "approved";
                 }
                 if ($url == "/pendingleaves") {
                     $extraParam1 = "pendingleaves";
                     $extraParam2 = "pending";
                 }
                 if ($url == "/cancelleaves") {
                     $extraParam1 = "cancelleaves";
                     $extraParam2 = "cancel";
                 }
                 if ($url == "/manageremployeevacations") {
                     $extraParam1 = "manageremployeevacations";
                     $extraParam2 = "";
                 }
                 if ($url == "/myemployees") {
                     $extraParam1 = $loginUserId;
                     $extraParam2 = $loginUserId;
                 }
                 if ($url == "/holidaydates") {
                     $extraParam1 = "holidaydates";
                     $extraParam2 = "";
                 }
                 if ($url == "/myholidaycalendar") {
                     $extraParam1 = "myholidaycalendar";
                     $extraParam2 = "";
                 }
                 if ($url == "/employee") {
                     $extraParam = '';
                     $extraParam2 = $loginUserId;
                 }
                 if ($url == "/myemployees") {
                     $extraParam1 = $loginUserId;
                     $extraParam2 = $loginUserId;
                 }
                 if ($url == "/empleavesummary") {
                     $extraParam1 = "empleavesummary";
                 }
                 if ($url == "/approvedrequisitions") {
                     $extraParam1 = $loginuserGroup;
                     $extraParam4 = 'Yes';
                     $extraParam2 = 2;
                     //reqType
                 }
                 if ($url == "/requisition") {
                     $extraParam1 = $loginuserGroup;
                     $extraParam4 = 'Yes';
                     $extraParam2 = 1;
                     //reqType
                 }
                 if ($url == "/empscreening") {
                     $extraParam1 = 1;
                 }
                 if ($url == "/rejectedrequisitions") {
                     $extraParam1 = $loginuserGroup;
                     $extraParam4 = 'Yes';
                     $extraParam2 = 3;
                     //reqType
                 }
                 if ($refresh == 'refresh') {
                     $sort = 'DESC';
                     $by = $defaultOrderBy;
                     $perPage = DASHBOARD_PERPAGE;
                     $pageNo = 1;
                     $searchData = '';
                 } else {
                     $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                     $by = $this->_getParam('by') != '' ? $this->_getParam('by') : $defaultOrderBy;
                     $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                     $pageNo = $this->_getParam('page', 1);
                     $searchData = $this->_getParam('searchData');
                 }
                 if (isset($modelName)) {
                     $menuWidgetModel = new $modelName();
                     if ($objectName == 'employee') {
                         $extraParam1 = $loginUserId;
                     }
                     if ($modelName == 'Default_Model_Requisition') {
                         $dataTmp = $menuWidgetModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $loginUserId, $extraParam1, $extraParam2, '', $extraParam4);
                     } else {
                         $dataTmp = $menuWidgetModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, 'Yes', $extraParam1, $extraParam2, $extraParam3, $extraParam4);
                     }
                     if ($dataTmp['tablecontent'] == "emptyroles") {
                         $emptyRoles = 1;
                     } else {
                         $emptyRoles = 0;
                     }
                     $dataTmp['emptyRoles'] = $emptyRoles;
                     $dataTmp['objectname'] = $objectName;
                     $dataTmp['dataemptyFlag'] = $dataemptyFlag;
                     $dataTmp['menuName'] = $menuName;
                     $dataTmp['userid'] = $loginUserId;
                     $dataTmp['dashboardcall'] = 'Yes';
                     array_push($data, $dataTmp);
                 }
             }
             $datacontent = 'full';
         } else {
             $datacontent = 'null';
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $this->view->call = $call;
     $this->view->datacontent = $datacontent;
     $this->view->dataArray = $data;
 }
Example #7
0
 public static function format6($id = '', $url = '')
 {
     $widgetsModel = new Default_Model_Widgets();
     $format6 = $widgetsModel->format6($id);
     $title = self::titleArr($id, 'title');
     $btnText = self::titleArr($id, 'btnText');
     $emptyText = self::titleArr($id, 'emptyText');
     if (!empty($url)) {
         $url = substr($url, 1);
     }
     $htmlContent = '<div class="dashboard_bottom_box" ><h4 >' . $title . '</h4>';
     if (!empty($format6)) {
         foreach ($format6 as $format6) {
             $dept_name = strlen($format6['deptname']) > 30 ? substr($format6['deptname'], 0, 30) : $format6['deptname'];
             $htmlContent .= "<div class='dashboard_bottom_div'><ul class='leave_mana'><li><span>Department</span>:<span class='ul_span_2' title=" . $format6['deptname'] . ">" . $dept_name . "</span></li>";
             $htmlContent .= "<li><span>Calender start month</span>:<span class='ul_span_2'>" . $format6['month_name'] . "</span></li>";
             $htmlContent .= "<li><span>Weekend</span>:<span class='ul_span_2'>" . $format6['weekend_start'] . " to " . $format6['weekend_end'] . "</span></li>";
             $htmlContent .= "<li><span>Half day</span>:<span class='ul_span_2'>" . $format6['is_halfday'] . "</span></li>";
             $htmlContent .= "<li><span>Leave transferable</span>:<span class='ul_span_2'>" . $format6['is_leavetransfer'] . "</span></li></ul></div>";
         }
     } else {
         $htmlContent .= "<div class='dashboard_bottom_div' ><span class='no_text no_data'>No leave management options</span></div>";
     }
     if (!empty($url)) {
         $htmlContent .= '<a href="' . DOMAIN . $url . '"class="box_link view_link">' . $btnText . '</a>';
     }
     $htmlContent .= '</div>';
     return $htmlContent;
     //.='<a href="'.DOMAIN.$url.'"class="box_link view_link">'.$btnText.'</a></div>';
 }