@@ -61,6 +61,7 @@ public function grid ($dataArray)
6161 {
6262 $ actions_arr = array ();
6363 }
64+
6465 $ gridFieldsArr =array ();$ tmpActionsArr =array ();
6566 $ tmpActionsArr = $ actions_arr ;
6667 array_pop ($ tmpActionsArr ); //last element of actions array is menuname so delete that & check the privileges are empty or not...
@@ -225,6 +226,77 @@ public function grid ($dataArray)
225226 </div> ' );
226227 }
227228 }
229+ //for exit types grid and all exit types grid
230+ if ($ dataArray ['objectname ' ] == 'exittypes ' || $ dataArray ['objectname ' ] == 'configureexitqs ' )
231+ {
232+ $ view_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/view/id/{{id}}" name="{{id}}" class="sprite view" title= \'View \'></a> ' ;
233+ $ edit_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/edit/id/{{id}}" name="{{id}}" id="edit{{id}}" class="sprite edit" title= \'Edit \'></a> ' ;
234+
235+ $ delete_str = '<a id="del{{id}}" name="{{id}}" onclick= changestatus( \'' .$ dataArray ['objectname ' ].'\', \'{{id}} \', \'' .$ msgdta .'\') href= javascript:void(0) title= \'Delete \' class="sprite delete" ></a> ' ;
236+
237+ $ extra ['action ' ] = array ('name ' => 'edit ' , 'value ' =>'<div class="grid-action-align">
238+ ' .((in_array ('view ' ,$ actions_arr )?$ view_str :'' )).'
239+ ' .((in_array ('edit ' ,$ actions_arr )?$ edit_str :'' )).'
240+ ' .((in_array ('delete ' ,$ actions_arr )?$ delete_str :'' )).'
241+ </div> ' );
242+ }
243+
244+ if ($ dataArray ['objectname ' ] == 'allexitproc ' || $ dataArray ['objectname ' ] == 'exitproc ' )
245+ {
246+ $ view_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/view/id/{{id}}" name="{{id}}" class="sprite view" title= \'View \'></a> ' ;
247+
248+ /*if($dataArray['objectname'] == 'exitproc')
249+ $edit_str = '<a href= "'.BASE_URL.'exit'.'/'.$dataArray['objectname'].'/questions/id/{{id}}" name="{{id}}" id="questions{{id}}" class="sprite assign_view_questions" title=\'Edit\'></a>';
250+ else
251+ $edit_str = '<a href= "'.BASE_URL.'exit'.'/'.$dataArray['objectname'].'/edit/id/{{id}}" name="{{id}}" id="edit{{id}}" class="sprite assign_view_questions" title=\'Edit\'></a>';*/
252+
253+ $ auth = Zend_Auth::getInstance ();
254+ if ($ auth ->hasIdentity ())
255+ {
256+ $ loginUserId = $ auth ->getStorage ()->read ()->id ;
257+ $ loginuserGroup = $ auth ->getStorage ()->read ()->group_id ;
258+ $ loginuserRole = $ auth ->getStorage ()->read ()->emprole ;
259+ $ is_og_head = $ auth ->getStorage ()->read ()->is_orghead ;
260+ }
261+ if ($ dataArray ['objectname ' ] == 'exitproc ' )
262+ $ edit_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/questions/id/{{id}}" name="{{id}}" id="questions{{id}}" class="sprite assign_view_questions" title= \'Answer and View Questions/Comments \'></a> ' ;
263+ elseif ($ loginuserRole != SUPERADMINROLE && $ is_og_head !=1 )
264+ $ edit_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/edit/id/{{id}}" name="{{id}}" id="edit{{id}}" class="sprite edit" title= \'Edit \'></a> ' ;
265+ else
266+ $ edit_str ='' ;
267+
268+ // assign questions icon only for hr, management and superadmin
269+ if (($ loginuserRole == SUPERADMINROLE || $ loginuserGroup == HR_GROUP || $ loginuserGroup == MANAGEMENT_GROUP ) && $ dataArray ['objectname ' ] == 'allexitproc ' ){
270+ $ assign_questions_str = '<a href= " ' .BASE_URL .'exit ' .'/ ' .$ dataArray ['objectname ' ].'/assignquestions/id/{{id}}" name="{{id}}" class="sprite assign_view_questions" id="assign_ques{{id}}" title= \'Assign and View Questions/Comments \'></a> ' ;
271+
272+ }
273+ else {
274+ $ assign_questions_str = '' ;
275+ }
276+
277+ // no delete action for all exit process
278+ if ($ loginuserRole == SUPERADMINROLE || $ loginuserGroup == HR_GROUP || $ loginuserGroup == MANAGEMENT_GROUP ){
279+ $ delete_str = '<a name="{{id}}" id="overallupdate_{{id}}" onclick= displayexitform( \'' .BASE_URL .'exit/allexitproc/editpopup/id/{{id}} ' .'\', \'\') href= javascript:void(0) title= \'Update Overall Status \' class="fa fa-ellipsis-v" ></a> ' ;
280+ }else {
281+ $ delete_str = '' ;
282+ }
283+
284+
285+
286+ if ($ dataArray ['objectname ' ] == 'exitproc ' )
287+ $ delete_str = '' ;
288+ $ extra ['action ' ] = array ('name ' => 'edit ' , 'value ' =>'<div class="grid-action-align">
289+ ' .((in_array ('view ' ,$ actions_arr )?$ view_str :'' )).'
290+ ' .((in_array ('edit ' ,$ actions_arr )?$ edit_str :'' )).'
291+ ' .((in_array ('assign ' ,$ actions_arr )?'' :$ assign_questions_str )).'
292+ ' .((in_array ('update ' ,$ actions_arr )?'' :$ delete_str )).'
293+
294+ </div> ' );
295+ }
296+
297+
298+
299+
228300 }
229301 $ extra ['options ' ] = array ();
230302 $ addaction = '' ;
@@ -362,7 +434,27 @@ public function generateGrid ($name, $fields = null,$paginator=null,$extracolumn
362434 $ output .= "<div class='add-btn-div'> " ;
363435 $ output .= "<input type='button' onclick='window.location.href= \"" .BASE_URL .$ name .'/ ' .$ action ."\"' title = 'Raise an Incident' value='Raise an Incident' class='sprite addrequest' /> " ;
364436 $ output .= "</div> " ;
365- }else {
437+ }
438+ elseif ($ name == 'exittypes ' || $ name == 'configureexitqs ' )
439+ {
440+ $ output .= "<a href=' " .BASE_URL .'exit ' .'/ ' .$ name .'/ ' .$ action ."'><input type='button' title = 'Add' value='Add Record' class='sprite addrecord' /></a> " ;
441+ }elseif ($ name == 'allexitproc ' )
442+ {
443+ $ output .= "" ;
444+ }else if ($ name =='exitproc ' ){
445+ $ auth = Zend_Auth::getInstance ();
446+ if ($ auth ->hasIdentity ())
447+ {
448+ $ loginUserId = $ auth ->getStorage ()->read ()->id ;
449+ $ loginuserGroup = $ auth ->getStorage ()->read ()->group_id ;
450+ $ loginuserRole = $ auth ->getStorage ()->read ()->emprole ;
451+ }
452+ if ($ loginuserRole == SUPERADMINROLE )
453+ $ output .= "" ;
454+ else
455+ $ output .= "<a href=' " .BASE_URL .'exit ' .'/ ' .$ name .'/ ' .$ action ."'><input type='button' title = 'Add' value='Add Record' class='sprite addrecord' /></a> " ;
456+ }
457+ else {
366458 $ output .= "<a href=' " .BASE_URL .$ name .'/ ' .$ action ."'><input type='button' title = 'Add' value='Add Record' class='sprite addrecord' /></a> " ;
367459 }
368460 $ output .= "</div> " ;
@@ -710,6 +802,60 @@ public function generateGrid ($name, $fields = null,$paginator=null,$extracolumn
710802 });
711803 </script> " ;
712804 }
805+ // remove edit and delete if isused=1
806+ if ($ controllerName == 'exittypes ' || $ controllerName == 'configureexitqs ' )
807+ {
808+ if ($ p ['isused ' ] == 1 )
809+ {
810+ echo "<script type='text/javascript'>
811+ $(document).ready(function() {
812+ $('#del " .$ p ['id ' ]."').remove();
813+ $('#edit'+ " .$ p ['id ' ].").remove();
814+ });
815+ </script> " ;
816+ }
817+ }
818+
819+
820+ //hide edit when overall status is approved in exitprocess
821+ if ($ controllerName == 'allexitproc ' && $ p ['overall_status ' ] == 'Approved ' )
822+ {
823+ echo "<script type='text/javascript'>
824+ $(document).ready(function() {
825+
826+ $('#edit'+ " .$ p ['id ' ].").remove();
827+ });
828+ </script> " ;
829+ echo "<script type='text/javascript'>
830+ $(document).ready(function() {
831+
832+ $('#overallupdate_'+ " .$ p ['id ' ].").remove();
833+ });
834+ </script> " ;
835+
836+
837+ }
838+ //hide edit when overall status is approved in exitprocess
839+ if ($ controllerName == 'allexitproc ' && $ p ['overall_status ' ] != 'Approved ' )
840+ {
841+ echo "<script type='text/javascript'>
842+ $(document).ready(function() {
843+
844+ $('#assign_ques'+ " .$ p ['id ' ].").remove();
845+ });
846+ </script> " ;
847+ }
848+
849+ if ($ controllerName == 'exitproc ' && $ p ['overall_status ' ] != 'Approved ' )
850+ {
851+ echo "<script type='text/javascript'>
852+ $(document).ready(function() {
853+
854+ $('#questions'+ " .$ p ['id ' ].").remove();
855+ });
856+ </script> " ;
857+ }
858+
713859 // hr can edit and delete any businessunit and dept announcemets---3.1
714860 //removing edit,dele icons for announcements
715861 /* if($controllerName == 'announcements')
@@ -753,7 +899,6 @@ public function generateGrid ($name, $fields = null,$paginator=null,$extracolumn
753899 * Second Case - Grid field
754900 * Keep 'default' case to allow display other Grids, normal.
755901 */
756-
757902 switch ($ menuName ) {
758903 case 'CV Management ' :
759904 switch ($ k ) {
@@ -801,9 +946,19 @@ public function generateGrid ($name, $fields = null,$paginator=null,$extracolumn
801946 }
802947 break ;
803948 case 'All Exit Procedures ' :
804- if ($ k == 'createddate ' )
949+ if ($ k == 'initiateddate ' )
950+ {
951+ $ output .= "<span " .$ dataclass ."> " .sapp_Global::change_date ($ p [$ k ],'view ' )."</span> " ;
952+ }
953+ else
954+ {
955+ $ output .= "<span " .$ dataclass ." title=' " .htmlentities (trim ($ p [$ k ]), ENT_QUOTES , "UTF-8 " )."' > " .htmlentities ($ valToInclude , ENT_QUOTES , "UTF-8 " )."</span> " ;
956+ }
957+ break ;
958+ case 'Initiate/Check Status ' :
959+ if ($ k == 'initiateddate ' )
805960 {
806- $ output .= "<span " .$ dataclass ."> " .sapp_Global::getDisplayDate ($ p [$ k ])."</span> " ;
961+ $ output .= "<span " .$ dataclass ."> " .sapp_Global::change_date ($ p [$ k ], ' view ' )."</span> " ;
807962 }
808963 else
809964 {
@@ -827,7 +982,7 @@ public function generateGrid ($name, $fields = null,$paginator=null,$extracolumn
827982 $ output .="</tr> " ;
828983 }
829984 if ($ ii == 0 ){
830- $ output .= "<tr><td colspan=' $ colinr' class='no-data-td'><p class='no-data'>No data found</p></td></tr> " ;
985+ $ output .= "<tr><td colspan=' $ colinr' class='no-data-td'><p class='no-data'>No data found. </p></td></tr> " ;
831986 }
832987 $ output .= "</tbody> " ;
833988 $ output .="</table>
0 commit comments