/** * * @param string $name * @param type $fields * @param type $paginator * @param type $extracolumn * @param type $sorting * @param type $jsGridFnname * @param type $perPage * @param type $page * @param type $jsFillFnName * @param type $searchArray * @param type $formgrid * @param type $addaction * @param type $menuName * @param type $unitId * @param type $addpermission * @param type $menunamestr * @param type $call * @param type $sortStr * @param type $conText * @param type $search_filters * @param type $dashboardCall * @param type $actnArr * @param type $sortname * @param type $by * @return string */ public function generateGrid($name, $fields = null, $paginator = null, $extracolumn = array(), $sorting = false, $jsGridFnname = '', $perPage = '5', $page = '1', $jsFillFnName = '', $searchArray = '', $formgrid = 'false', $addaction = '', $menuName = '', $unitId, $addpermission, $menunamestr, $call = '', $sortStr = '', $conText = "", $search_filters = '', $dashboardCall = 'No', $actnArr, $sortname = '', $by = '') { $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != 'ajaxcall') { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; $popupaction = 'addpopup'; } else { $action = "edit"; $popupaction = 'editpopup'; } $con = ''; if ($formgrid != '') { $urlString = $_SERVER['REQUEST_URI']; $urlData = explode('/', $urlString); if ($unitId != '') { $con = 'unitId/' . $unitId; } else { $con = 'unitId/' . $params['userid']; } $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='displaydeptform(\"" . DOMAIN . $name . '/' . $popupaction . "/{$con}/popup/1\",\"" . $menunamestr . "\")' value='Add Record' class='sprite addrecord' /></div>"; } else { if ($name == "employee" && $action == "edit") { $actionStr = 'add'; $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $actionStr . "\"' value='Add Record' class='sprite addrecord' /></div>"; } else { $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $action . "\"' value='Add Record' class='sprite addrecord' /></div>"; } } if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in �th� tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; if (empty($actnArr)) { unset($fields['action']); } foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'welcome') !== false) { $welcome = 'true'; } if ($formgrid == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/context/" . $conText . "');>" . $value . "</a>"; //For Sort Icons.... if ($sortStr == $key) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { // For HR >> Employees & ESS > My Team we are using index action not edit action .. if ($name == "employee" || ($name = "myemployees")) { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; } //For Sort Icons.... if ($sortStr == $key) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "');>" . $value . "</a>"; //For Sort Icons.... if ($sortStr == $key) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($sortStr == $key) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } //'width='.$eachColumnWidth; $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = $searchArray[$key]; } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","' . $conText . '","' . $key . '",event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function); } else { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value='{$sText}' onkeydown='getsearchdata(\"{$name}\",\"{$conText}\",\"{$key}\",event,\"text\")' />"; } } } } else { //For Sort Icons.... if ($sortStr == $key) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop } $output .= "</tr>\r\n\r\n </thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; $output .= "<tr onclick='selectrow({$name},this);' class='{$cell_color}'>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { $output .= "<td {$tdclass}>"; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { if ($bodyCount == 0 && $jsFillFnName != '') { $valToInclude = strlen(trim($p[$k])) > $characterlimit ? substr(trim($p[$k]), 0, $characterlimit) . ".." : trim($p[$k]); $output .= "<a onclick= " . $jsFillFnName . "(\"/id/{$p['id']}\") href= 'javascript:void(0)' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</a>"; } else { $p = (array) $p; if (isset($p[$k])) { $valToInclude = strlen(trim($p[$k])) > $characterlimit ? substr(trim($p[$k]), 0, $characterlimit) . ".." : trim($p[$k]); $output .= "<span title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; } } } $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\r\n <script type='text/javascript' language='javascript'>\r\n \$(document).ready(function(){\r\n \r\n \r\n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\r\n {\r\n \r\n \$('#search_tr_" . $name . "').show();\t\r\n }\r\n else \r\n {\r\n \r\n \$('#search_tr_" . $name . "').hide();\t\r\n \r\n }\r\n });\r\n </script> \r\n</div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['context'] = $conText; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript'>\$('#{$name}').slimScrollHorizontal({\r\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\r\n\t\t\t\t\t\t\t\t\t start: 'left',\r\n\t\t\t\t\t\t\t\t\t position: 'bottom',\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript'>\r\n\t\t\t\t\t\tvar id = \$('#columnId').val();\r\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\r\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\r\n var fval = \$('#'+focusID).attr('data-focus');\r\n if(fval == '' || fval == null)\r\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\r\n\t\t\t\t\t</script>"; return $output; }
/** * * @param string $name * @param array $fields * @param Zend_Paginator Instance $paginator * @param array $extracolumn * @param Bool $sorting * * @return string */ public function generateGrid($name, $fields = null, $paginator = null, $extracolumn = array(), $sorting = false, $jsGridFnname = '', $perPage = '5', $page = '1', $jsFillFnName = '', $searchArray = '', $formgrid = 'false', $addaction = '', $menuName = '', $unitId, $addpermission, $menunamestr, $call = '', $sortStr = '', $search_filters = '', $dashboardCall = 'No', $empstatus = '', $actnArr, $empscreenTotalCount = '', $sortname = '', $by = '') { $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); $controllerName = $request->getRequest()->getControllerName(); $actionName = $request->getRequest()->getActionName(); $dataclass = ''; // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != "ajaxcall") { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; $popupaction = 'addpopup'; } else { $action = "edit"; $popupaction = 'editpopup'; } $con = ''; if ($formgrid != '') { $urlString = trim($_SERVER['REQUEST_URI']); $serverUrl = $_SERVER['HTTP_HOST']; $urlData = explode('/', $urlString); if ($unitId != '') { $con = 'unitId/' . $unitId; } else { if (isset($params['id'])) { $con = 'unitId/' . $params['id']; } } if ($name == 'empscreening') { $empaction = 'add'; $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $empaction . "\"' value='Add Record' class='sprite addrecord' /></div>"; } else { if ($name == 'processes' && $empstatus != 'Active' && $empstatus != '') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } else { $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='displaydeptform(\"" . DOMAIN . $name . '/' . $popupaction . "/{$con}/popup/1\",\"" . $menunamestr . "\")' value='Add Record' class='sprite addrecord' /></div>"; } } } else { $output = "<div class='table-header'><span>" . $menuName . "</span>"; //Hide Add Multiple CVs functionality /* if ($name == 'candidatedetails') { $output .= "<div class='add-multi-resume'><a href='" . DOMAIN . "candidatedetails/multipleresume'>Add multiple CVs</a></div>"; } */ $output .= "<input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $action . "\"' value='Add Record' class='sprite addrecord' /></div>"; } if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in �th� tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; if (empty($actnArr)) { unset($fields['action']); } foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } //'width='.$eachColumnWidth; $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'welcome') !== false) { $welcome = 'true'; } if ($formgrid == 'true') { if ($value == 'Explanation' && ($name = "processes")) { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "<img title='Reason to complete the process.' src='" . DOMAIN . "/public/media/images/help.png' /></a>"; } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; } //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = $searchArray[$key]; } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","",this.id,event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function); } else { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value='{$sText}' onkeydown='getsearchdata(\"{$name}\",\"\",this.id,event,\"text\")' />"; } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop } $output .= "</tr>\r\n\r\n </thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; $output .= "<tr onclick='selectrow({$name},this);' class='{$cell_color}'>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { if ($k == 'description' && $menuName == 'Screening Types') { $characterlimit = 80; } $output .= "<td {$tdclass}>"; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { if ($bodyCount == 0 && $jsFillFnName != '') { $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; $output .= "<a onclick= " . $jsFillFnName . "(\"/id/{$p['id']}\") href= 'javascript:void(0)' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</a>"; } else { $p = (array) $p; if (isset($p[$k])) { $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; if ($k == 'isactive' && ($p[$k] == 'Process deleted' || $p[$k] == 'Agency User deleted' || $p[$k] == 'POC deleted' || $p[$k] == 'Agency deleted') && $menuName == 'Background check Process') { $dataclass = 'class="reddata"'; echo "<script type='text/javascript'>\r\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \r\n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\r\n\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } else { if ($menuName == 'Manage External Users') { echo "<script type='text/javascript'>\r\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \r\n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } } if ($empstatus != 'Active' && $empstatus != '' && $menuName == 'Background check Process') { echo "<script type='text/javascript'>\r\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \r\n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\r\n\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } if ($k == 'backgroundchk_status' && $p[$k] == 'Complete' && $menuName == 'Employee/Candidate Screening') { $dataclass = 'class="greendata"'; } // Customize grid fields data - START switch ($menuName) { case 'Resource Pooling': switch ($k) { case 'cand_resume': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/download/id/' . $p["id"] . "'>View Resume</a></span>"; } break; case 'cand_followup': if (!empty($valToInclude)) { if ($valToInclude == "Pending") { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/followup/id/' . $p["id"] . "'>Send Email</a></span>"; } } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Openings/Positions': switch ($k) { case 'jdfilename': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/download/id/' . $p["id"] . "'>View JD</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Policies': switch ($k) { case 'policydocumentname': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/download/id/' . $p["id"] . "'>Download Policy Document</a></span>"; } break; case 'policyhistorydocumentname': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/downloadhistory/id/' . $p["id"] . "'>Download Policy Document</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } // Customize grid fields data - END } } } $dataclass = ''; $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\r\n <script type='text/javascript' language='javascript'>\r\n \$(document).ready(function(){\r\n \r\n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\r\n {\r\n \r\n \$('#search_tr_" . $name . "').show();\t\r\n }\r\n else \r\n \r\n \$('#search_tr_" . $name . "').hide();\t\r\n });\r\n </script> \r\n </div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; if (isset($empscreenTotalCount) && $perPage != 0) { $empscreen_lastpage = ceil($empscreenTotalCount / $perPage); $params['empscreen_lastpage'] = $empscreen_lastpage; } $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript' language='javascript'>\$('#{$name}').slimScrollHorizontal({\r\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\r\n\t\t\t\t\t\t\t\t\t start: 'left',\r\n\t\t\t\t\t\t\t\t\t position: 'bottom',\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript' language='javascript'>\r\n\t\t\t\t\t\tvar id = \$('#columnId').val();\r\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\r\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\r\n var fval = \$('#'+focusID).attr('data-focus');\r\n if(fval == '' || fval == null)\r\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\r\n \r\n\t\t\t\t\t</script>"; return $output; }
/** * * @param string $name * @param array $fields * @param Zend_Paginator Instance $paginator * @param array $extracolumn * @param Bool $sorting * * @return string */ public function generateGrid($name, $fields = null, $paginator = null, $extracolumn = array(), $sorting = false, $jsGridFnname = '', $perPage = '5', $page = '1', $jsFillFnName = '', $searchArray = '', $formgrid = 'false', $addaction = '', $menuName = '', $unitId, $addpermission, $menunamestr, $call = '', $sortStr = '', $search_filters = '', $dashboardCall = 'No', $empstatus = '', $actnArr, $empscreenTotalCount = '', $sortname = '', $by = '') { $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); $controllerName = $request->getRequest()->getControllerName(); $actionName = $request->getRequest()->getActionName(); $dataclass = ''; // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != "ajaxcall") { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; $popupaction = 'addpopup'; } else { $action = "edit"; $popupaction = 'editpopup'; } $con = ''; if ($formgrid != '') { $urlString = trim($_SERVER['REQUEST_URI']); $serverUrl = $_SERVER['HTTP_HOST']; $urlData = explode('/', $urlString); if ($unitId != '') { $con = 'unitId/' . $unitId; } else { if (isset($params['id'])) { $con = 'unitId/' . $params['id']; } } if ($name == 'empscreening') { $empaction = 'add'; $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $empaction . "\"' value='Add Record' class='sprite addrecord' /></div>"; } else { if ($name == 'processes' && $empstatus != 'Active' && $empstatus != '') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } else { $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='displaydeptform(\"" . DOMAIN . $name . '/' . $popupaction . "/{$con}/popup/1\",\"" . $menunamestr . "\")' value='Add Record' class='sprite addrecord' /></div>"; } } } else { $output = "<div class='table-header'><span>" . $menuName . "</span>"; if ($name == 'candidatedetails') { $output .= "<div class='add-multi-resume'><a href='" . DOMAIN . "candidatedetails/multipleresume'>Add multiple CVs</a></div>"; } $output .= "<input type='button' title = 'Add' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $action . "\"' value='Add Record' class='sprite addrecord' /></div>"; } if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in �th� tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; if (empty($actnArr)) { unset($fields['action']); } foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } //'width='.$eachColumnWidth; $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'welcome') !== false) { $welcome = 'true'; } if ($formgrid == 'true') { if ($value == 'Explanation' && ($name = "processes")) { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "<img title='Reason to complete the process.' src='" . DOMAIN . "/public/media/images/help.png' /></a>"; } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; } //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if ($controllerName == 'myemployees' && $actionName == 'index') { $display = ''; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = $searchArray[$key]; } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","",this.id,event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function); } else { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value=\"{$sText}\" onKeypress='if (!((event.keyCode || event.which) > 47 && (event.keyCode || event.which) < 58) && !((event.keyCode || event.which) > 64 && (event.keyCode || event.which) < 91) && !((event.keyCode || event.which) > 96 && (event.keyCode || event.which) < 123) && ((event.keyCode || event.which) != 45) && ((event.keyCode || event.which) != 63) && ((event.keyCode || event.which) != 39) && ((event.keyCode || event.which) != 46) && ((event.keyCode || event.which) != 44) && ((event.keyCode || event.which) != 47) && ((event.keyCode || event.which) != 35) && ((event.keyCode || event.which) != 64) && ((event.keyCode || event.which) != 36) && ((event.keyCode || event.which) != 38) && ((event.keyCode || event.which) != 42) && ((event.keyCode || event.which) != 40) && ((event.keyCode || event.which) != 41) && ((event.keyCode || event.which) != 33) && ((event.keyCode || event.which) != 32)) event.preventDefault();' onkeydown='getsearchdata(\"{$name}\",\"\",this.id,event,\"text\")' />"; } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop } $output .= "</tr>\n\n </thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; $output .= "<tr onclick='selectrow({$name},this);' class='{$cell_color}'>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { if ($k == 'description' && $menuName == 'Screening Types') { $characterlimit = 80; } $output .= "<td {$tdclass}>"; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { if ($bodyCount == 0 && $jsFillFnName != '') { $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; $output .= "<a onclick= " . $jsFillFnName . "(\"/id/{$p['id']}\") href= 'javascript:void(0)' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</a>"; } else { $p = (array) $p; if (isset($p[$k])) { $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; if ($k == 'isactive' && ($p[$k] == 'Process deleted' || $p[$k] == 'Agency User deleted' || $p[$k] == 'POC deleted' || $p[$k] == 'Agency deleted') && $menuName == 'Background check Process') { $dataclass = 'class="reddata"'; echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } else { if ($menuName == 'Manage External Users') { echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } } if ($empstatus != 'Active' && $empstatus != '' && $menuName == 'Background check Process') { echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } if ($k == 'backgroundchk_status' && $p[$k] == 'Complete' && $menuName == 'Employee/Candidate Screening') { $dataclass = 'class="greendata"'; } if ($controllerName == 'appraisalmanager' && ($p['org_status'] == 2 || $p['org_status'] == 3 || $p['enable_step'] == 2 || $p['managerid_status'] != 0)) { //echo '<pre>';print_r($p); //if($p['org_status'] == 2 || $p['org_status'] == 3 || $p['enable_step']==2 || $p['managerid_status']!=0) //{ echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\t\$('#del" . $p['id'] . "').remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t</script>"; //} } if ($controllerName == 'appraisalquestions' || $controllerName == 'appraisalcategory' || $controllerName == 'feedforwardquestions') { if ($p['isused'] == 1) { echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\t\$('#del" . $p['id'] . "').remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t</script>"; } } /** added on 27-04-2015 by sapplica ** to remove edit buttons in appraisal settings page when status is not empty **/ if ($controllerName == 'appraisalconfig' && $p['status'] != '') { echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t</script>"; } //removing edit,dele icons for announcements if ($controllerName == 'announcements') { //echo "<pre>";print_r($p); $businessunit_id = $department_id = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; } //checking roles and Removing Edit & Delete previliges if ($loginuserGroup == HR_GROUP && (!empty($businessunit_id) || !empty($department_id))) { $bunitArr = isset($p['businessunit_id']) ? explode(',', $p['businessunit_id']) : array(); $deptArr = isset($p['department_id']) ? explode(',', $p['department_id']) : array(); if (!in_array($businessunit_id, $bunitArr) && !in_array($department_id, $deptArr)) { echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#del" . $p['id'] . "').remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t</script>"; } } } // /** * Customize grid fields data - START * In the below code, First Case - Menu name * Second Case - Grid field * Keep 'default' case to allow display other Grids, normal. */ //echo $menuName." - ".$k; switch ($menuName) { case 'CV Management': switch ($k) { case 'cand_resume': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/download/id/' . $p["id"] . "'>View Resume</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; // Strip HTML tags for 'description' field in Organization->Announcements grid // Strip HTML tags for 'description' field in Organization->Announcements grid case 'Announcements': switch ($k) { case 'description': $valToInclude = strip_tags($valToInclude); $output .= "<span " . $dataclass . " title='" . htmlentities(strip_tags(trim($p[$k])), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "ISO-8859-1") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "ISO-8859-1") . "</span>"; break; } // Customize grid fields data - END } } } $dataclass = ''; $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\n <script type='text/javascript' language='javascript'>\n \$(document).ready(function(){\n \n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\n {\n \n \$('#search_tr_" . $name . "').show();\t\n }\n else \n \n \$('#search_tr_" . $name . "').hide();\t\n });\n </script> \n </div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; if (isset($empscreenTotalCount) && $perPage != 0) { $empscreen_lastpage = ceil($empscreenTotalCount / $perPage); $params['empscreen_lastpage'] = $empscreen_lastpage; } $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript' language='javascript'>\$('#{$name}').slimScrollHorizontal({\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\n\t\t\t\t\t\t\t\t\t start: 'left',\n\t\t\t\t\t\t\t\t\t position: 'bottom',\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\tvar id = \$('#columnId').val();\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\n var fval = \$('#'+focusID).attr('data-focus');\n if(fval == '' || fval == null)\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\n \n\t\t\t\t\t</script>"; return $output; }
public function generateGridTm($name, $fields = null, $paginator = null, $extracolumn = array(), $sorting = false, $jsGridFnname = '', $perPage = '5', $page = '1', $jsFillFnName = '', $searchArray = '', $formgrid = 'false', $addaction = '', $menuName = '', $unitId, $addpermission, $menunamestr, $call = '', $sortStr = '', $search_filters = '', $dashboardCall = 'No', $empstatus = '', $actnArr, $empscreenTotalCount = '', $sortname = '', $by = '', $projectId = '', $otherAction = '', $start_date = '', $end_date = '', $emp_id = '') { $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); $controllerName = $request->getRequest()->getControllerName(); $actionName = $request->getRequest()->getActionName(); $dataclass = ''; // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != "ajaxcall") { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; $popupaction = 'addpopup'; } else { $action = "edit"; $popupaction = 'editpopup'; } $con = ''; if ($formgrid != '') { $urlString = trim($_SERVER['REQUEST_URI']); $serverUrl = $_SERVER['HTTP_HOST']; $urlData = explode('/', $urlString); if ($unitId != '') { $con = 'unitId/' . $unitId; } else { if (isset($params['id'])) { $con = 'unitId/' . $params['id']; } } $output = "<div class='table-header'><span>" . $menuName . "</span><input type='button' title = 'Add' onclick='displaydeptform(\"" . BASE_URL . $name . '/' . $popupaction . "/{$con}/popup/1\",\"" . $menunamestr . "\")' value='Add Record' class='sprite addrecord' /></div>"; } else { $output = "<div class='table-header'><span>" . $menuName . "</span>"; /*if($controllerName == 'projects'){ $output .= "<a href='".BASE_URL.$this->moduleName.$name.'/add'."'><input type='button' title = 'Add' value='Add Record' class='sprite addrecord' /></a></div>"; }else{*/ //echo $menuName; if ($menuName != 'Tasks' && $menuName != 'Resources' && $name != 'employeeprojects' && $name != 'leadprojects' && $name != 'reports' && $menuName != 'view expenses') { $output .= "<a href='" . BASE_URL . $this->moduleName . $name . '/' . $action . "'><input type='button' title = 'Add' value='Add Record' class='sprite addrecord' /></a></div>"; } else { $output .= "</div>"; } //} } if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in �th� tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; if (empty($actnArr)) { unset($fields['action']); } foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } //'width='.$eachColumnWidth; $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; echo $key; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'projects') !== false && $otherAction != 'projectsreports') { $welcome = 'true'; } if ($formgrid == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . BASE_URL . $this->moduleName . $name . "/" . $otherAction . "/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/',\"{$projectId}\",\"{$otherAction}\",\"{$start_date}\",\"{$end_date}\",\"{$emp_id}\");>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . BASE_URL . $this->moduleName . $name . "/" . $otherAction . "/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/projectId/" . $projectId . "/start_date/" . $start_date . "/end_date/" . $end_date . "/emp_id/" . $emp_id . "/call/ajaxcall/{$con}/',\"{$projectId}\",\"{$otherAction}\",\"{$start_date}\",\"{$end_date}\",\"{$emp_id}\");>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "',\"{$projectId}\",\"{$otherAction}\",\"{$start_date}\",\"{$end_date}\",\"{$emp_id}\");>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if ($controllerName == 'myemployees' && $actionName == 'index') { $display = ''; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = $searchArray[$key]; } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","",this.id,event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function, $projectId, $otherAction, $start_date, $end_date, $emp_id); } else { //echo $name; if ($key != 'viewtasks' && $key != 'viewresources' && $key != 'duration') { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value=\"{$sText}\" onKeypress='if (!((event.keyCode || event.which) > 47 && (event.keyCode || event.which) < 58) && !((event.keyCode || event.which) > 64 && (event.keyCode || event.which) < 91) && !((event.keyCode || event.which) > 96 && (event.keyCode || event.which) < 123) && ((event.keyCode || event.which) != 45) && ((event.keyCode || event.which) != 63) && ((event.keyCode || event.which) != 39) && ((event.keyCode || event.which) != 46) && ((event.keyCode || event.which) != 44) && ((event.keyCode || event.which) != 47) && ((event.keyCode || event.which) != 35) && ((event.keyCode || event.which) != 64) && ((event.keyCode || event.which) != 36) && ((event.keyCode || event.which) != 38) && ((event.keyCode || event.which) != 42) && ((event.keyCode || event.which) != 40) && ((event.keyCode || event.which) != 41) && ((event.keyCode || event.which) != 33) && ((event.keyCode || event.which) != 32) && ((event.keyCode || event.which) != 8)) event.preventDefault();' \n\t\t\t\t\t\t\t\t \t\t\t\t\tonkeydown='getsearchdata(\"{$name}\",\"\",this.id,event,\"text\",\"{$projectId}\",\"{$otherAction}\",\"{$start_date}\",\"{$end_date}\",\"{$emp_id}\")' />"; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop } $output .= "</tr>\n\n </thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; $output .= "<tr onclick='selectrow({$name},this);' class='{$cell_color}'>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { if ($k == 'description' && $menuName == 'Screening Types') { $characterlimit = 80; } $output .= "<td {$tdclass}> "; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { if ($bodyCount == 0 && $jsFillFnName != '') { $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; $output .= "<a onclick= " . $jsFillFnName . "(\"/id/{$p['id']}\") href= 'javascript:void(0)' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</a>"; } else { $p = (array) $p; if (isset($p[$k])) { // Customize grid field data switch ($menuName) { case 'Announcements': switch ($k) { // Strip tags case 'description': $stip_tags_text = strip_tags($p[$k]); $valToInclude = strlen($stip_tags_text) > $characterlimit ? substr($stip_tags_text, 0, $characterlimit) . ".." : $stip_tags_text; break; default: $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; break; } break; default: $valToInclude = strlen($p[$k]) > $characterlimit ? substr($p[$k], 0, $characterlimit) . ".." : $p[$k]; break; } // /** * Customize grid fields data - START * In the below code, First Case - Menu name * Second Case - Grid field * Keep 'default' case to allow display other Grids, normal. */ //echo $menuName." - ".$k; switch ($menuName) { case 'CV Management': switch ($k) { case 'cand_resume': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . BASE_URL . $name . '/download/id/' . $p["id"] . "'>View Resume</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Tasks': switch ($k) { case 'viewresources': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='View Resource' ><a href='javascript:void(0);' class='sprite view' onclick = javascript:" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "></a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Resources': switch ($k) { case 'viewtasks': if (!empty($valToInclude)) { $output .= "<span " . $dataclass . " title='View Tasks' ><a href='javascript:void(0);' class='sprite view' onclick = javascript:" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "></a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Expenses': switch ($k) { // Strip tags case 'expense_status': //$stip_tags_text = strip_tags($p[$k]); //$valToInclude = (strlen($stip_tags_text)>$characterlimit)? substr($stip_tags_text,0,$characterlimit)."..":$stip_tags_text; $output .= "<span class='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . " capitalize' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . (htmlentities($valToInclude, ENT_QUOTES, "UTF-8") == 'submitted' ? 'For Approval' : htmlentities($valToInclude, ENT_QUOTES, "UTF-8")) . "</span>"; break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Employee Reports': switch ($k) { case 'duration': if (!empty($valToInclude)) { $param = ""; if (isset($params['selected_period_hidden'])) { $param = $params['selected_period_hidden']; if ($params['selected_period_hidden'] == "Last 7 days") { $param = "Last7days"; } else { if ($params['selected_period_hidden'] == "Month to date") { $param = "Monthtodate"; } else { if ($params['selected_period_hidden'] == "Year to date") { $param = "Yeartodate"; } else { if ($params['selected_period_hidden'] == "Previous Month") { $param = "PreviousMonth"; } } } } } $output .= "<span " . $dataclass . " title='Project Time' ><a href='javascript:void(0);' onclick = javascript:getEmpDuration(" . $p['userId'] . ",'" . $start_date . "','" . $end_date . "','" . $projectId . "','" . $param . "');>" . $valToInclude . "</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; case 'Project Reports': switch ($k) { case 'duration': if (!empty($valToInclude)) { $param = ""; if (isset($params['selected_period_hidden'])) { $param = $params['selected_period_hidden']; if ($params['selected_period_hidden'] == "Last 7 days") { $param = "Last7days"; } else { if ($params['selected_period_hidden'] == "Month to date") { $param = "Monthtodate"; } else { if ($params['selected_period_hidden'] == "Year to date") { $param = "Yeartodate"; } else { if ($params['selected_period_hidden'] == "Previous Month") { $param = "PreviousMonth"; } } } } } $output .= "<span " . $dataclass . " title='Project Time' ><a href='javascript:void(0);' onclick = javascript:getProjectTaskDuration('" . $emp_id . "','" . $start_date . "','" . $end_date . "','" . $p['id'] . "','" . $param . "');>" . $valToInclude . "</a></span>"; } break; default: $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } break; default: $output .= "<span " . $dataclass . " title='" . trim($p[$k]) . "' >" . htmlentities($valToInclude, ENT_QUOTES, "ISO-8859-1") . "</span>"; break; } // Customize grid fields data - END htmlentities(trim($p[$k]), ENT_QUOTES, "ISO-8859-1") //echo $controllerName.'--'.$k.'--'.$p[$k]; if ($controllerName == 'expenses' && $k == 'expense_status' && $p[$k] != 'saved') { $dataclass = 'class="reddata"'; echo "<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\t\t\$(document).ready(function() { \n\t\t\t\t\t\t\t\t\t\t\t\$('#del'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t\$('#edit'+" . $p['id'] . ").remove();\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t</script>"; } } } } $dataclass = ''; $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\n <script type='text/javascript' language='javascript'>\n \$(document).ready(function(){\n \n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\n {\n \n \$('#search_tr_" . $name . "').show();\t\n }\n else \n \n \$('#search_tr_" . $name . "').hide();\t\n });\n </script> \n </div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; $params['projectId'] = $projectId; $params['start_date'] = $start_date; $params['end_date'] = $end_date; $params['emp_id'] = $emp_id; $params['otherAction'] = $otherAction; if (isset($empscreenTotalCount) && $perPage != 0) { $empscreen_lastpage = ceil($empscreenTotalCount / $perPage); $params['empscreen_lastpage'] = $empscreen_lastpage; } $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript' language='javascript'>\$('#{$name}').slimScrollHorizontal({\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\n\t\t\t\t\t\t\t\t\t start: 'left',\n\t\t\t\t\t\t\t\t\t position: 'bottom',\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\tvar id = \$('#columnId').val();\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\n var fval = \$('#'+focusID).attr('data-focus');\n if(fval == '' || fval == null)\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\n \n\t\t\t\t\t</script>"; return $output; }
/** * * @param string $name * @param array $fields * @param Zend_Paginator Instance $paginator * @param array $extracolumn * @param Bool $sorting * * @return string */ public function generateGrid($name, $fields = null, $paginator = null, $extracolumn = array(), $sorting = false, $jsGridFnname = '', $perPage = '5', $page = '1', $jsFillFnName = '', $searchArray = '', $formgrid = 'false', $addaction = '', $menuName = '', $unitId, $addpermission, $menunamestr, $call = '', $sortStr = '', $search_filters = '', $dashboardCall = 'No', $sortname = '', $by = '') { $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); $viewLinkArray = array('Cities', 'States'); // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\n\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != "ajaxcall") { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; $popupaction = 'addpopup'; } else { $action = "edit"; $popupaction = 'editpopup'; } $con = ''; if ($formgrid != '') { $urlString = $_SERVER['REQUEST_URI']; $urlData = explode('/', $urlString); if ($unitId != '') { $con = 'unitId/' . $unitId; } else { if (sizeof($urlData) > 4) { if (isset($params['id'])) { $con = 'unitId/' . $params['id']; } } } if ($name == 'empscreening') { $empaction = 'add'; $output = ""; } else { $output = ""; } } else { $output = ""; } if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in ?th? tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; foreach ($fields as $key => $value) { if ($value != 'Profile' && $value != 'ID' && $value != 'Url') { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } //'width='.$eachColumnWidth; $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'welcome') !== false) { $welcome = 'true'; } if ($formgrid == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if ($key != 'profileimg' && $key != 'id' && $key != 'menuUrl') { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = urldecode($searchArray[$key]); } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","",this.id,event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function); } else { if ($key != 'key_flag') { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value='{$sText}' onkeydown='getsearchdata(\"{$name}\",\"\",this.id,event,\"text\")' />"; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } } //end of for each loop } $output .= "</tr>\n\n </thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; $output .= "<tr onclick='selectrow({$name},this);' class='{$cell_color}'>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $imgtag = ''; if ($k == 'profileimg' || $k == 'id' || $k == 'menuUrl') { continue; } $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { if ($k == 'description' && $menuName == 'Screening Types') { $characterlimit = 80; } $output .= "<td {$tdclass}>"; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { if ($bodyCount == 0 && $jsFillFnName != '') { $valToInclude = strlen(trim($p[$k])) > $characterlimit ? substr(trim($p[$k]), 0, $characterlimit) . ".." : trim($p[$k]); $output .= "<a onclick= " . $jsFillFnName . "(\"/id/{$p['id']}\") href= 'javascript:void(0)' title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</a>"; } else { $p = (array) $p; if (isset($p[$k])) { $valToInclude = strlen(trim($p[$k])) > $characterlimit ? substr(trim($p[$k]), 0, $characterlimit) . ".." : trim($p[$k]); if ($k == 'user_action') { switch ($p[$k]) { case '1': $valToInclude = 'ADD'; break; case '2': $valToInclude = "Edit"; break; case '3': $valToInclude = "Delete"; break; } } else { if ($k == 'userfullname') { $errorImg = DOMAIN . 'public/media/images/profile_pic.png'; if (isset($p['profileimg']) && !empty($p['profileimg'])) { $imageUrl = DOMAIN . 'public/uploads/profile/' . $p['profileimg']; } else { $imageUrl = DOMAIN . 'public/media/images/profile_pic.png'; } $imgtag = '<img src="' . $imageUrl . '" onerror="this.src=\'' . $errorImg . '\'" class="pic-grid">'; } else { if ($k == 'last_modifieddate' || $k == 'logindatetime') { $valToInclude = sapp_Global::getDisplayDate($valToInclude); } else { if ($k == 'empipaddress' && $valToInclude == '::1') { $valToInclude = '127.0.0.1'; } } } } if ($k == 'status' && $p[$k] == 'Complete' && $menuName == 'Employee Screening') { $dataclass = 'class="greendata"'; } else { $dataclass = ''; } if ($k == 'user_action') { switch ($p[$k]) { case '1': $menunamestr = $p['menuName'] . ' - Add'; $output .= "<a name='' class='' title='Add' onclick='displaydeptform(\"" . DOMAIN . "logmanager/view/id/" . $p['id'] . "\",\"" . $menunamestr . "\")'>Add</a>"; break; case '2': $menunamestr = $p['menuName'] . ' - Edit'; $output .= "<a name='' class='' title='Edit' onclick='displaydeptform(\"" . DOMAIN . "logmanager/view/id/" . $p['id'] . "\",\"" . $menunamestr . "\")'>Edit</a>"; break; case '3': $valToInclude = "Delete"; $output .= " <span " . $dataclass . " title='Delete' class='emp-name' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; case '5': $valToInclude = "Cancel"; $output .= " <span " . $dataclass . " title='Cancel' class='emp-name' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; break; } } else { if ($k == 'key_flag') { $modurl = ltrim($p['menuUrl'], '/'); if ($p['user_action'] != 3 && $p['user_action'] != 5 && $p['menuName'] != 'Leave Request' && $p['menuName'] != 'Manage Employee Leaves' && $p['menuName'] != 'Manage Modules') { if (in_array($p['menuName'], $viewLinkArray)) { $urlink = DOMAIN . $modurl . '/view/id/' . $p[$k]; } else { $urlink = DOMAIN . $modurl . '/edit/id/' . $p[$k]; } $output .= '<a href= "' . $urlink . '" target="_blank" name="" class="" title="View Record">View Record</a>'; } else { if ($p['menuName'] == 'Manage Modules') { $output .= "<span " . $dataclass . " title=" . $p[$k] . " class='emp-name' >" . htmlentities($p[$k], ENT_QUOTES, "UTF-8") . "</span>"; } else { $output .= ''; } } } else { if ($k == 'last_modifieddate' || $k == 'logindatetime') { $output .= $imgtag . " <span " . $dataclass . " title='" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "' class='emp-name' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; } else { $output .= $imgtag . " <span " . $dataclass . " title='" . htmlentities($p[$k], ENT_QUOTES, "UTF-8") . "' class='emp-name' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; } } } } } } $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\n <script type='text/javascript' language='javascript'>\n \$(document).ready(function(){\n \n \n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\n {\n \n \$('#search_tr_" . $name . "').show();\t\n }\n else \n \n \$('#search_tr_" . $name . "').hide();\t\n });\n </script> \n </div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript' language='javascript'>\$('#{$name}').slimScrollHorizontal({\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\n\t\t\t\t\t\t\t\t\t start: 'left',\n\t\t\t\t\t\t\t\t\t position: 'bottom',\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript' language='javascript'>\n\t\t\t\t\t\tvar id = \$('#columnId').val();\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\n var fval = \$('#'+focusID).attr('data-focus');\n if(fval == '' || fval == null)\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\n \n\t\t\t\t\t</script>"; return $output; }
/** * * @param string $name * @param array $fields * @param Zend_Paginator_Instance $paginator * @param array $extracolumn * @param Bool $sorting * * @return string */ public function generateGrid($dataArray, $paginator, $extracolumn = array(), $sorting = false, $formgrid = 'false', $addaction = '', $menuName = '', $addpermission, $sortStr = '', $actnArr) { $view_link = isset($dataArray['view_link']) ? $dataArray['view_link'] : ""; $name = isset($dataArray['objectname']) ? $dataArray['objectname'] : ""; $by = isset($dataArray['by']) ? $dataArray['by'] : ""; $search_filters = isset($dataArray['search_filters']) ? $dataArray['search_filters'] : array(); $fields = isset($dataArray['tableheader']) ? $dataArray['tableheader'] : array(); $searchArray = isset($dataArray['searchArray']) ? $dataArray['searchArray'] : array(); $jsGridFnname = isset($dataArray['jsGridFnName']) ? $dataArray['jsGridFnName'] : ""; $perPage = isset($dataArray['perPage']) ? $dataArray['perPage'] : "20"; $page = isset($dataArray['pageNo']) ? $dataArray['pageNo'] : "1"; $call = isset($dataArray['call']) ? $dataArray['call'] : ""; $dashboardCall = isset($dataArray['dashboardcall']) ? $dataArray['dashboardcall'] : "No"; $sortname = isset($dataArray['sort']) ? $dataArray['sort'] : ""; $grid_type = isset($dataArray['grid_type']) ? $dataArray['grid_type'] : ""; $status_value = isset($dataArray['status_value']) ? $dataArray['status_value'] : ""; $add_link = isset($dataArray['add_link']) ? $dataArray['add_link'] : ""; $sd_req_model = new Default_Model_Servicerequests(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $request = Zend_Controller_Front::getInstance(); $params = $request->getRequest()->getParams(); $dataclass = ''; // Store Extra Columns $this->extra = $extracolumn; $sortIconStr = ""; $sort = Zend_Controller_Front::getInstance()->getRequest()->getParam('sort', 'DESC'); // checking and handling sorting. if ($sort == "") { $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t<span class='ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-s'></span></span>"; } else { if ($sort == 'ASC') { $sort = 'DESC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-desc ui-icon ui-icon-triangle-1-n'></span>\r\n\t\t\t</span>"; } else { $sort = 'ASC'; //For Sort Icons.... $sortIconStr = "<span class='s-ico'>\r\n\t\t\t<span class='ui-icon-asc ui-icon ui-icon-triangle-1-s'></span></span>"; } } if ($call != "ajaxcall") { $sortIconStr = ""; } if ($addaction != '') { $action = $addaction; } $con = ''; $output = "<div class='table-header'><span>" . $menuName . "</span>"; if ($addaction != '') { $output .= "<div class='add-btn-div'>"; if ($add_link != '') { $output .= "<input type='button' title = 'Raise a Request' onclick='window.location.href=\"" . $add_link . "\"' value='Raise a Request' class='sprite addrequest' />"; } else { $output .= "<input type='button' title = 'Raise a Request' onclick='window.location.href=\"" . DOMAIN . $name . '/' . $action . "\"' value='Raise a Request' class='sprite addrequest' />"; } $output .= "</div>"; } $output .= "</div>"; if ($addpermission == 'false') { $output = "<div class='table-header'><span>" . $menuName . "</span></div>"; } $output .= "<div id='" . $name . "' class='details_data_display_block newtablegrid'>"; $output .= "<table class='grid' align='center' width='100%' cellspacing='0' cellpadding='4' border='0'><thead><tr>"; // this foreach loop display the column header in �th� tag. $colinr = 0; if (!empty($fields)) { $tabindx = 0; if (empty($actnArr)) { unset($fields['action']); } foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = $value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = $value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = $value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'>Action</span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if (strpos($urlString, 'welcome') !== false) { $welcome = 'true'; } if ($formgrid == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { if ($welcome == 'true') { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . DOMAIN . $name . "/index/sort/" . $sort . "/by/" . $key . "/objname/" . $name . "/page/" . $page . "/per_page/" . $perPage . "/call/ajaxcall/{$con}/');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } else { $output .= "<a href='javascript:void(0);' onclick=javascript:paginationndsorting('" . $this->view->url(array('sort' => $sort, 'by' => $key, 'objname' => $name, 'page' => $page, 'per_page' => $perPage)) . "');>" . $value . "</a>"; //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop $output .= "</tr><tr id='search_tr_{$name}'>"; $tabindx = 0; foreach ($fields as $key => $value) { if (isset($value['align'])) { $align = @$value['align'] != '' ? 'align="' . $value['align'] . '" ' : ''; } if (isset($value['sortkey'])) { $sortkey = @$value['sortkey'] != '' ? 'align="' . $value['sortkey'] . '" ' : ''; } if (isset($value['style'])) { $style = @$value['style'] != '' ? 'style="' . $value['style'] . '" ' : ''; } $value = is_array($value) && !isset($value['sortkey']) ? $value['value'] : $value; if ($value == 'Action') { $width = 'width=90'; } else { $width = ''; } $output .= "<th " . $width . ">"; // Check if Sorting is set to True if ($sorting) { // Disable Sorting if Key is in Extra Columns if (@$this->extra[$key]['name'] != '' && !is_array($value)) { if ($value == "Action") { $output .= "<span class='action-text'></span>"; } else { $output .= $value; } } else { if (is_array($value)) { $key = $value['sortkey']; $value = $value['value']; } $welcome = 'false'; $urlString = $_SERVER['REQUEST_URI']; if ($key != 'id') { $sText = ''; if (!empty($searchArray)) { $display = 'display: block;'; } else { $display = 'display: none;'; } if (is_array($searchArray)) { if (array_key_exists($key, $searchArray)) { $sText = $searchArray[$key]; } else { $sText = ''; } } if (isset($search_filters[$key])) { $search_function = 'getsearchdata("' . $name . '","",this.id,event'; $output .= sapp_Global::grid_data($search_filters, $key, $name, $display, $sText, $tabindx, $search_function); } else { $output .= "<input tabIndex={$tabindx} type='text' name='{$name}' id='{$key}' style='{$display}' class='searchtxtbox_{$name} table_inputs grid_search_inputs' value='{$sText}' onkeydown='getsearchdata(\"{$name}\",\"\",this.id,event,\"text\")' />"; } } } } else { //For Sort Icons.... if ($key == $sortStr) { $output .= $sortIconStr; } $output .= $value; } $output .= "</th>"; $colinr++; $tabindx++; } //end of for each loop } if ($grid_type != '') { $output .= "<input type='hidden' id='service_grid' value='" . sapp_Global::_encrypt($grid_type) . "' />"; } if ($status_value != '') { $output .= "<input type='hidden' id='service_grid_status' value='" . sapp_Global::_encrypt($status_value) . "' />"; } $output .= "</tr></thead>"; $output .= "<tbody>"; // Start Looping Data $ii = 0; foreach ($paginator as $p) { $cell_color = $ii % 2 == 0 ? "row1" : "row2"; $ii++; $bodyCount = 0; //$output.="<tr onclick='window.location=\"" . $this->_parseString($view_link, $p) . "\"' class='$cell_color cursor'>"; $output .= "<tr class='{$cell_color} '>"; // Reset Fields Array to Top if (!empty($fields)) { reset($fields); foreach ($fields as $k => $v) { $tdclass = ''; // Look for additional attributes $characterlimit = 40; if (is_array($v)) { $class = @$v['class'] != '' ? 'class="' . $v['class'] . '" ' : ''; $align = @$v['align'] != '' ? 'align="' . $v['align'] . '" ' : ''; $valign = @$v['valign'] != '' ? 'valign="' . $v['valign'] . '" ' : ''; if (isset($v['characterlimit'])) { $characterlimit = $v['characterlimit']; } $output .= "<td {$tdclass}{$align}{$valign}>"; } else { if ($k == 'description' && $menuName == 'Screening Types') { $characterlimit = 80; } $output .= "<td {$tdclass}>"; } // Check to see if this Field is in Extra Columns if (isset($this->extra[$k]['value'])) { $output .= $this->_parseExtra($k, $p); } else { $valToInclude = strlen(trim($p[$k])) > $characterlimit ? substr(trim($p[$k]), 0, $characterlimit) . ".." : trim($p[$k]); if ($k == 'executor_id') { if (!empty($valToInclude)) { #$output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a onclick='displaydeptform(\'' . DOMAIN . $name . '/assignservicerequestpopup/id/{{id}}') name='{{id}}'>Allocate Executor</a></span>"; $isAdmin = $sd_req_model->IsAdminForServiceTicket($loginUserId, $p["ticket_number"]); if ($isAdmin == "1") { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . DOMAIN . $name . '/assignservicerequestpopup/id/' . $p["id"] . "' target='_blank'>" . ($valToInclude == -1 ? "Allocate" : "Reallocate") . " Executor</a></span>"; } } } else { if ($k == 'ticket_number') { if (!empty($valToInclude)) { $temp_ticketnumber = "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' ><a href='" . $this->_parseString($view_link, $p) . "'>" . $temp_ticketnumber . "</a></span>"; } } else { $p = (array) $p; if (isset($p[$k])) { $output .= "<span " . $dataclass . " title='" . htmlentities(trim($p[$k]), ENT_QUOTES, "UTF-8") . "' >" . htmlentities($valToInclude, ENT_QUOTES, "UTF-8") . "</span>"; } // Customize grid fields data - END } } } $dataclass = ''; $output .= "</td>"; $bodyCount++; } } // Close the Table Row $output .= "</tr>"; } if ($ii == 0) { $output .= "<tr><td colspan='{$colinr}' class='no-data-td'><p class='no-data'>No data found</p></td></tr>"; } $output .= "</tbody>"; $output .= "</table>\r\n <script type='text/javascript' language='javascript'>\r\n \$(document).ready(function(){ \r\n if(\$('.searchtxtbox_" . $name . "').is(':visible'))\r\n { \r\n \$('#search_tr_" . $name . "').show();\t\r\n }\r\n else \r\n \$('#search_tr_" . $name . "').hide();\t\r\n });\r\n </script> \r\n </div>"; // Attach Pagination if ($paginator) { $params = array(); $params['jsGridFnName'] = $jsGridFnname; $params['perPage'] = $perPage; $params['objname'] = $name; $params['searchArray'] = $searchArray; $params['formgrid'] = $formgrid; $params['con'] = $con; $params['dashboardcall'] = $dashboardCall; $params['sortname'] = $sortname; $params['by'] = $by; $output .= $this->view->paginationControl($paginator, 'Sliding', 'partials/pagination.phtml', $params); } $output .= "<script type='text/javascript' language='javascript'>\$('#{$name}').slimScrollHorizontal({\r\n\t\t\t\t\t\t\t\t\t alwaysVisible: false,\r\n\t\t\t\t\t\t\t\t\t start: 'left',\r\n\t\t\t\t\t\t\t\t\t position: 'bottom',\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t}).css({ background: '#ccc', paddingBottom: '10px' }); </script>"; $output .= "<script type='text/javascript' language='javascript'>\r\n\t\t\t\t\t\tvar id = \$('#columnId').val();\r\n\t\t\t\t\t\tvar coldata = \$('#'+id).val();\r\n\t\t\t\t\t\tvar focusID = \$('#columnId').val();\r\n var fval = \$('#'+focusID).attr('data-focus');\r\n if(fval == '' || fval == null)\r\n\t\t\t\t\t\t\$('#'+focusID).focus().val('').val(coldata);\r\n \r\n\t\t\t\t\t</script>"; return $output; }