diff --git a/framework/model.class.php b/framework/model.class.php index 9a6e6f9a97..3a6fb5affc 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -124,84 +124,6 @@ class model extends baseModel return false; } - /** - * Build menu of a module. - * - * @param string $moduleName - * @param string $methodName - * @param string $params - * @param object $data - * @param string $type - * @param string $icon - * @param string $target - * @param string $class - * @param bool $onlyBody - * @param string $misc - * @param string $title - * @param bool $returnHtml - * @access public - * @return string - */ - - public function buildMenu($moduleName, $methodName, $params, $data, $type = 'view', $icon = '', $target = '', $class = '', $onlyBody = false, $misc = '' , $title = '', $returnHtml = true) - { - if(str_contains($moduleName, '.')) [$appName, $moduleName] = explode('.', $moduleName); - - if(str_contains($methodName, '_') && strpos($methodName, '_') > 0) [$module, $method] = explode('_', $methodName); - - if(empty($module)) $module = $moduleName; - if(empty($method)) $method = $methodName; - - static $actions = array(); - static $hasAction = array(); - if(!isset($hasAction[$moduleName])) $hasAction[$moduleName] = true; - - if($this->config->edition != 'open') - { - if($hasAction[$moduleName] and empty($actions[$moduleName])) - { - $actions[$moduleName] = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) - ->where('module')->eq($moduleName) - ->andWhere('buildin')->eq('1') - ->andWhere('status')->eq('enable') - ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() - ->fetchAll('action'); - - if(empty($actions[$moduleName])) $hasAction[$moduleName] = false; - } - } - - $enabled = true; - if(!empty($actions) and isset($actions[$moduleName][$methodName])) - { - $action = $actions[$moduleName][$methodName]; - - if($action->extensionType == 'override') return $this->loadModel('flow')->buildActionMenu($moduleName, $action, $data, $type); - - $conditions = json_decode((string) $action->conditions); - if($conditions and $action->extensionType == 'extend') - { - if($icon != 'copy' and $methodName != 'create') $title = $action->name; - if($conditions) $enabled = $this->loadModel('flow')->checkConditions($conditions, $data); - } - else - { - if(method_exists($this, 'isClickable')) $enabled = $this->isClickable($data, $method, $module); - } - } - else - { - if(method_exists($this, 'isClickable')) $enabled = $this->isClickable($data, $method, $module); - } - - if(!$returnHtml) return $enabled; - - $html = ''; - $type = $type == 'browse' ? 'list' : 'button'; - $html = common::buildIconButton($module, $method, $params, $data, $type, $icon, $target, $class, $onlyBody, $misc, $title, '', $enabled); - return $html; - } - /** * Build menu of actions created by workflow action. *