oa.php 1.1 KB

123456789101112131415161718192021222324
  1. <?php
  2. public static function printLink($module, $method, $vars = '', $label = '', $misc = '', $print = true, $onlyBody = false, $type = '', $object = null, $programID = 0)
  3. {
  4. if(strpos($module, '.') !== false) list($appName, $module) = explode('.', $module);
  5. if($module == 'trip' or $module == 'egress') return false;
  6. if(!commonModel::hasPriv($module, $method)) return false;
  7. $content = '';
  8. $canClick = true;
  9. $link = helper::createLink($module, $method, $vars, '', $onlyBody);
  10. if(!$canClick)
  11. {
  12. $misc = str_replace("class='", "disabled='disabled' class='disabled ", $misc);
  13. $misc = str_replace("data-toggle='modal'", ' ', $misc);
  14. $misc = str_replace("deleter", ' ', $misc);
  15. if(strpos($misc, "class='") === false) $misc .= " class='disabled' disabled='disabled'";
  16. }
  17. if($type == 'li') $content .= '<li' . ($canClick ? '' : " disabled='disabled' class='disabled'") . '>';
  18. $content .= html::a($canClick ? $link : 'javascript:void(0)', $label, '', $misc);
  19. if($type == 'li') $content .= '</li>';
  20. if($print !== false) echo $content;
  21. return $content;
  22. }