Beispiel #1
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);
    }
Beispiel #2
0
 public function createorremoveshortcutAction()
 {
     $auth = Zend_Auth::getInstance();
     $role_id = 1;
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $role_id = $auth->getStorage()->read()->emprole;
     }
     $this->_helper->layout->disableLayout();
     $settingsmodel = new Default_Model_Settings();
     $privilege_model = new Default_Model_Privileges();
     $menuid = $this->_request->getParam('menuid');
     $shortcutflag = $this->_request->getParam('shortcutflag');
     $date = new Zend_Date();
     $where = '';
     $menuidstring = '';
     $error = '';
     $id = '';
     $idCsv = 0;
     $result = 'error';
     if ($menuid) {
         $privilegesofObj = $privilege_model->getObjPrivileges($menuid, "", $role_id, $idCsv);
         if ($privilegesofObj['isactive'] == 1) {
             if ($shortcutflag == 1 || $shortcutflag == 2) {
                 $settingsmenuArr = $settingsmodel->getMenuIds($loginUserId, 2);
                 if (!empty($settingsmenuArr)) {
                     $settingsmenustring = $settingsmenuArr[0]['menuid'];
                     if (strlen($settingsmenustring) == 0) {
                         $settingsmenuArray = array();
                     } else {
                         $settingsmenuArray = explode(",", $settingsmenustring);
                     }
                     if (sizeof($settingsmenuArray) == 16 && $shortcutflag != 2) {
                         $error = "Limit";
                     } else {
                         if (in_array($menuid, $settingsmenuArray)) {
                             $key = array_search($menuid, $settingsmenuArray);
                             if ($key !== false) {
                                 unset($settingsmenuArray[$key]);
                             }
                         } else {
                             array_push($settingsmenuArray, $menuid);
                         }
                         if (strlen($settingsmenustring) == 0) {
                             $menuidstring = $menuid;
                         } else {
                             $menuidstring = implode(",", $settingsmenuArray);
                         }
                         $where = array('userid=?' => $loginUserId, 'flag=?' => 2, 'isactive=?' => 1);
                         $data = array('menuid' => $menuidstring, 'modified' => $date->get('yyyy-MM-dd HH:mm:ss'));
                         $id = $settingsmodel->addOrUpdateMenus($data, $where);
                     }
                 }
             } else {
                 if ($shortcutflag == 3) {
                     $data = array('userid' => $loginUserId, 'menuid' => $menuid, 'flag' => 2, 'isactive' => 1, 'created' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modified' => $date->get('yyyy-MM-dd HH:mm:ss'));
                     $id = $settingsmodel->addOrUpdateMenus($data, $where);
                 }
             }
             if ($id != '') {
                 if ($id == 'update') {
                     $result = 'update';
                 } else {
                     $result = 'newrecord';
                 }
             } else {
                 if ($error != '') {
                     $result = 'limit';
                 } else {
                     $result = 'error';
                 }
             }
         } else {
             $result = 'inactive';
         }
         $this->_helper->_json(array('result' => $result));
     }
 }
Beispiel #3
0
 /**
  * This function is used to check privileges of a menu item of a particular login.
  * @param Integer $objectId = id of the menu item.
  * @param Integer $groupId  = group id
  * @param Integer $roleId   = role id
  * @return string  Returns Yes/No
  */
 public static function _check_menu_access($objectId, $groupId = '', $roleId)
 {
     $privilege_model = new Default_Model_Privileges();
     $privilegesofObj = $privilege_model->getObjPrivileges($objectId, $groupId, $roleId);
     $result = "No";
     if (!empty($privilegesofObj) && count($privilegesofObj) > 0) {
         $result = "Yes";
     }
     return $result;
 }
Beispiel #4
0
 /**
  * This function is used as helper function for building menu.
  * @param Integer $group_id   = id of group
  * @param Integer $role_id    = id of role(useful when calling from different controller)
  * @param Integer $id         = id of role(fetch privileges of a particular role)
  * @return Array Array of menu items,privileges etc.
  */
 public function getgroup_formenu($group_id, $role_id, $id)
 {
     $priveleges_model = new Default_Model_Privileges();
     $group_model = new Default_Model_Groups();
     $group_data = $group_model->getGroupDataById($group_id);
     $res = $this->getMenuArray_formenu($role_id, $group_id);
     $tmpArr = array();
     $tmpMenuArr = array();
     $tmpMenuDataArr = array();
     for ($i = 0; $i < sizeof($res); $i++) {
         $tmpMenuArr[$res[$i]['id']] = $res[$i]['parent'];
         $tmp = array();
         $tmp['id'] = $res[$i]['id'];
         $tmp["parent"] = $res[$i]['parent'];
         $tmp["menuName"] = $this->getMenuText($res[$i]['menuName'], $role_id);
         $tmp["iconPath"] = $res[$i]['iconPath'];
         $tmp["url"] = $res[$i]['url'];
         $tmp['default_permissions']["addpermission"] = $res[$i]['addpermission'];
         $tmp['default_permissions']["editpermission"] = $res[$i]['editpermission'];
         $tmp['default_permissions']["deletepermission"] = $res[$i]['deletepermission'];
         $tmp['default_permissions']["viewpermission"] = $res[$i]['viewpermission'];
         $tmp['default_permissions']["uploadattachments"] = $res[$i]['uploadattachments'];
         $tmp['default_permissions']["viewattachments"] = $res[$i]['viewattachments'];
         $tmpMenuDataArr[$res[$i]['id']] = $tmp;
     }
     /**
      ** prepare an array with parent and second level menus - $tmpArr
      **/
     $emptyArr = array();
     foreach ($tmpMenuArr as $key => $value) {
         if ($value == 0 && !array_key_exists($value, $tmpArr)) {
             $tmpArr[$key] = $emptyArr;
             $tmpArr[$key] = $tmpMenuDataArr[$key];
         } else {
             if (array_key_exists($value, $tmpArr) && !array_key_exists($key, $tmpArr[$value])) {
                 $tmpArr[$value]['childs'][$key] = $tmpMenuDataArr[$key];
             }
         }
     }
     foreach ($tmpArr as $key => $value_arr) {
         if (is_array($value_arr)) {
             if (isset($value_arr['childs']) && is_array($value_arr['childs'])) {
                 foreach ($value_arr['childs'] as $c_key => $ch_value) {
                     foreach ($tmpMenuArr as $tkey => $tvalue) {
                         if ($tvalue == $c_key && !array_key_exists($tkey, $tmpArr)) {
                             $tmpArr[$key]['childs'][$c_key]['childs'][$tkey] = $tmpMenuDataArr[$tkey];
                         }
                     }
                 }
             }
         }
     }
     //end of foreach.
     $menu_data = array();
     $menu_data_post = array();
     $permission_data = array();
     if ($id != '') {
         $mdata = $priveleges_model->getMenuItemsByRoleId($id);
         foreach ($mdata as $val_arr) {
             $menu_data[] = $val_arr['object'];
             $menu_data_post[$val_arr['id']] = $val_arr['object'];
             if (isset($tmpMenuArr[$val_arr['object']])) {
                 if ($tmpMenuArr[$val_arr['object']] != 0) {
                     $menu_data[] = $tmpMenuArr[$val_arr['object']];
                 }
             }
             $permission_data[$val_arr['object']]['addpermission'] = $val_arr['addpermission'];
             $permission_data[$val_arr['object']]['editpermission'] = $val_arr['editpermission'];
             $permission_data[$val_arr['object']]['deletepermission'] = $val_arr['deletepermission'];
             $permission_data[$val_arr['object']]['viewpermission'] = $val_arr['viewpermission'];
             $permission_data[$val_arr['object']]['uploadattachments'] = $val_arr['uploadattachments'];
             $permission_data[$val_arr['object']]['viewattachments'] = $val_arr['viewattachments'];
         }
         $menu_data1 = array();
         foreach ($menu_data as $menu_id) {
             if (array_key_exists($menu_id, $tmpMenuArr)) {
                 $menu_data1[] = $tmpMenuArr[$menu_id];
             }
         }
         $menu_data1 = array_unique($menu_data1);
         $menu_data = array_unique($menu_data);
         $menu_data = array_merge_recursive($menu_data, $menu_data1);
     }
     $return_arr = array('tmpArr' => $tmpArr, 'menu_data_post' => $menu_data_post, 'menu_data' => $menu_data, 'permission_data' => $permission_data, 'group_data' => $group_data);
     return $return_arr;
 }
 public function fetchmenunameAction()
 {
     $auth = Zend_Auth::getInstance();
     $role_id = 1;
     if ($auth->hasIdentity()) {
         $role_id = $auth->getStorage()->read()->emprole;
     }
     $menuid = $this->_request->getParam('menuid');
     $tabFlag = $this->_request->getParam('tabFlag');
     $successmessage['result'] = '';
     $idCsv = 0;
     $privilege_model = new Default_Model_Privileges();
     $settingsmodel = new Default_Model_Settings();
     if (is_numeric($menuid)) {
         $privilegesofObj = $privilege_model->getObjPrivileges($menuid, "", $role_id, $idCsv);
         $getmenuname = $settingsmodel->fetchMenuName($menuid);
         if ($privilegesofObj['isactive'] == 1) {
             if (!empty($getmenuname)) {
                 $data = array('menuname' => $getmenuname[0]['menuName'], 'menuicon' => $getmenuname[0]['iconPath'], 'menuurl' => $getmenuname[0]['url'], 'message' => 'success');
             } else {
                 $data = array('message' => 'error');
             }
         } else {
             $data = array('message' => 'error');
         }
         /**
          *	Added By	:	Sapplica.
          *	Date of Modification	:	30/08/2013
          *	Purpose	:	Some of the menus should not be draggable for widgets
          *	Modified By	:	MAINAK.		
          **/
         //	Only for Widgets, Organisation Info,Organisation structure,Organisation hierarchy, Site Preferences,leave request,My details,Identity codes and some menus should not be draggable ....
         if ($tabFlag != "" && $tabFlag == "widgets") {
             $menusNotdraggable = array(REPORTS, ORGANISATIONINFO, STRUCTURE, HEIRARCHY, MYDETAILS, LEAVEREQUEST, SITEPREFERENCE, IDENTITYCODES, IDENTITYDOCUMENTS, EMPLOYEETABS, MANAGEMODULE);
             if (in_array($menuid, $menusNotdraggable)) {
                 $data = array('message' => 'error');
             }
         }
     } else {
         $data = array('message' => 'error');
     }
     $this->_helper->json($data);
 }
Beispiel #6
0
 public function shortcuticons($userId)
 {
     $role_id = "";
     $privilegedmenuIdsArr = array();
     $privilegedmenuIdsCsv = "";
     $settingsModel = new Default_Model_Settings();
     $session = new Zend_Auth_Storage_Session();
     $data = $session->read();
     //echo "Session Data : <pre>";print_r($data);die;
     if (!empty($data)) {
         $role_id = $data['emprole'];
     }
     $iconidcount = $settingsModel->getActiveiconCount($userId);
     $shortcutsStr = '<ul>';
     if ($iconidcount[0]['count'] > 0) {
         $menuIdsArr = $settingsModel->getMenuIds($userId, 2);
         if (!empty($menuIdsArr) === true) {
             $menuIdsStr = $menuIdsArr[0]['menuid'];
             /*
             					Modified By:	Yamini
             					Purpose:	Checking the privileges for shortcut icons for logged in role...
             					Modified Date:	26/09/2013.
             */
             $idCsv = 1;
             //Flag
             $privilege_model = new Default_Model_Privileges();
             $privilegesofObj = $privilege_model->getObjPrivileges($menuIdsStr, "", $role_id, $idCsv);
             $menuwithaddprivilegeArr = array(SITEPREFERENCE, LEAVEREQUEST, IDENTITYCODES, IDENTITYDOCUMENTS);
             /* This condition is to check whether the menu is active. If active then only the shortcut will be displayed.*/
             if (!empty($privilegesofObj) && isset($privilegesofObj)) {
                 for ($i = 0; $i < sizeof($privilegesofObj); $i++) {
                     //if($privilegesofObj[$i]['viewpermission'] == "Yes" || (in_array($privilegesofObj[$i]['object'],$menuwithaddprivilegeArr) && $privilegesofObj[$i]['addpermission'] == "Yes" ))
                     if ($privilegesofObj[$i]['isactive'] == 1) {
                         array_push($privilegedmenuIdsArr, $privilegesofObj[$i]['object']);
                     }
                 }
                 $privilegedmenuIdsCsv = implode(",", $privilegedmenuIdsArr);
             }
             if ($privilegedmenuIdsCsv != "") {
                 $menuIdsStr = $privilegedmenuIdsCsv;
             }
             $menuDetailsArr = $settingsModel->getMenuName($menuIdsStr, 1);
             $betaFlag = 0;
             if (!empty($menuDetailsArr)) {
                 for ($s = 0; $s < sizeof($menuDetailsArr); $s++) {
                     $menuName = $menuDetailsArr[$s]['menuName'];
                     $tmpMenuUrl = $menuDetailsArr[$s]['url'];
                     //echo $s." >> ".(strpos($tmpMenuUrl,'http://') === false)."<br/>";
                     if ($tmpMenuUrl && (strpos($tmpMenuUrl, 'http://') === false || strpos($tmpMenuUrl, 'http://') === false || strpos($tmpMenuUrl, 'http://') === false)) {
                         $menuUrl = BASE_URL . substr($tmpMenuUrl, 1, strlen($tmpMenuUrl));
                     } else {
                         if (strpos($tmpMenuUrl, 'http://') === true || strpos($tmpMenuUrl, 'http://') === true || strpos($tmpMenuUrl, 'http://') === true) {
                             $menuUrl = $tmpMenuUrl;
                         } else {
                             $menuUrl = 'javascript:void(0);';
                         }
                     }
                     if ($menuDetailsArr[$s]['iconPath'] != '') {
                         $menuIcon = 'images/menuIcons/shortcuts/' . $menuDetailsArr[$s]['iconPath'];
                     } else {
                         $menuIcon = 'images/sampleimg.png';
                     }
                     //$shortcutsStr.='<li><a href="'.$menuUrl.'"><img src="'.MEDIA_PATH.'images/'.$menuIcon.'" onerror=this.src="'.MEDIA_PATH.'images/sampleimg.png"; height="33" width="33" border="0" /></a></li>';
                     $shortcutsStr .= '<li><a href="' . $menuUrl . '" title="' . $menuName . '" ><img src="' . MEDIA_PATH . '' . $menuIcon . '"  onerror=this.src="' . MEDIA_PATH . 'images/sampleimg.png"; height="33" width="33" border="0" /></a></li>';
                     if ($menuDetailsArr[$s]['id'] > 148 && $menuDetailsArr[$s]['id'] < 175) {
                         $betaFlag = 1;
                     }
                 }
                 echo $shortcutsStr .= '</ul></div>';
                 if ($betaFlag == 1) {
                     echo '<div class="beta_info" title="beta version">Beta</div>';
                 }
             } else {
                 echo "No active shortcut icons. " . '<a href="' . BASE_URL . 'viewsettings/2">' . "Click here" . '</a> ' . "to configure.";
             }
         } else {
             echo "You have not configured your shortcut icons. " . '<a href="' . BASE_URL . 'viewsettings/2">' . "Click here" . '</a> ' . "to configure.";
         }
     } else {
         echo "You have not configured your shortcut icons. " . ' <a href="' . BASE_URL . 'viewsettings/2">' . "Click here" . '</a> ' . "to configure";
     }
 }
Beispiel #7
0
 /**
  * This action is used to delete roles and their child data.
  * @parameters
  * @param $objid    =   id of role.
  * 
  * @return   {String}   success/failure message 
  */
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $actionflag = 3;
     if ($id) {
         $roles_model = new Default_Model_Roles();
         $user_model = new Default_Model_Usermanagement();
         $user_cnt = $user_model->getUserCntByRole($id);
         if ($user_cnt == 0) {
             $previleges_model = new Default_Model_Privileges();
             $menumodel = new Default_Model_Menu();
             $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $where = array('id=?' => $id);
             $Id = $roles_model->SaveorUpdateRolesData($data, $where);
             if ($Id == 'update') {
                 sapp_Global::generateAccessControl();
                 $prev_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 $where_prev = "role = " . $id;
                 $previleges_model->SaveorUpdatePrivilegesData($prev_data, $where_prev);
                 $objidArr = $menumodel->getMenuObjID('/roles');
                 $objID = $objidArr[0]['id'];
                 $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id);
                 $messages['message'] = 'Role deleted successfully';
                 $messages['msgtype'] = 'success';
             } else {
                 $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
                 $messages['msgtype'] = 'error';
             }
         } else {
             $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }