log(__METHOD__, 'BEGIN'); $action_id = $this->params['class_action_id'] ?? 4040; $name = $this->params['name'] ?? 'World'; $order = 40; if (! empty($this->object_link_instance)) { $order = $this->object_link_instance->getVal('ordre'); if (empty($order)) { $order = 0; } } // nouvelle action de portlet: test-overlay $action_name = 'hello-'.preg_replace('/[^a-z-]/', '', preg_replace('/ +/', '-', strtolower($name))); //$portlet = new action_portlet($this, 'action-self'); $portlet = new portlet($this, 'action-overlay'); $portlet->libelle = "Hello $name"; $portlet->order = $order; $portlet->class = 'helloworld'; $action_class = new portlet_action_class('self'); $action = new portlet_action($this, $action_name); $action->portlet = $portlet; $action->action = $action_class; $action->callback = array($this, 'hello_object'); $ret = array($action_id => $action); $this->log(__METHOD__, 'return: '.var_export(array($action_id => get_class($action)), true)); $this->log(__METHOD__, 'END'); return $ret; } public function get_inline_scripts_js(string $position) { $this->log(__METHOD__, 'BEGIN'); if($position == 'bottom') { return array($this->get_url_assets_path_base().'/helloworld.js'); } $ret = array(); $this->log(__METHOD__, 'return: '.var_export($ret, true)); $this->log(__METHOD__, 'END'); return $ret; } public function get_inline_styles_css(string $position) { $this->log(__METHOD__, 'BEGIN'); if($position == 'top') { return array($this->get_url_assets_path_base().'/helloworld.css'); } $ret = array(); $this->log(__METHOD__, 'return: '.var_export($ret, true)); $this->log(__METHOD__, 'END'); return $ret; } /** * Affiche l'objet défini dans les paramètres du module, * avec en entête le numéro de l'instruction courante. * * @return void */ public function hello_object(om_dbform $instruction) { $this->log(__METHOD__, 'BEGIN'); echo '

Instruction '.$instruction->getVal('instruction').'

'; $object_name = $this->params['object_name'] ?? 'phase'; $object_id = $this->params['object_id'] ?? 1; $object = $this->framework->findObjectById($object_name, $object_id); if (! empty($object)) { $this->log(__METHOD__, "displaying object: $object_name#$object_id"); echo '

'.ucfirst($object_name).' '.$object->getVal($object_name).'

'; //$phase->sousformulaire(); $url = OM_ROUTE_SOUSFORM.'&objsf='.$object_name.'&idxformulaire='.$instruction->getVal('instruction').'&retourformulaire=instruction&obj='.$object_name.'&action=3&idx='.$object->getVal($object_name); echo '

URL

'.$url.'

'; echo '
'; echo ' '; } else { $this->log(__METHOD__, "object: $object_name#$object_id not found"); } $this->log(__METHOD__, 'END'); } }