/** * Creates the form for action parameters, if params are required for the current action * @return null if no param * @return HTML_QuickForm if params */ public function createParamsForm() { $tpl = Mreg::get('tpl'); $tpl->concat('adminTitle', ' :: ' . $this->getActionTitle()); if ($this->actiondo instanceof M_Plugin) { $tpl->addPath('M/DB/DataObject/Plugin/' . $this->actiondo->getFolderName() . '/templates/', 'before'); } $prepareMethod = 'prepare' . $this->actionName; if (method_exists($this->actiondo, $prepareMethod) || is_array($this->_actionInfo['chainable'])) { $qfAction = new MyQuickForm('actionparamsForm', 'POST', M_Office_Util::getQueryParams(array(), array('selected', 'doaction', 'glaction', 'doSingleAction'), false), '_self', null, true); Mreg::get('tpl')->addJSinline('$("input[type=text],textarea","form[name=actionparamsForm]").eq(0).focus()', 'ready'); Mreg::get('tpl')->assign('do', $do); $qfAction->addElement('header', 'qfActionHeader', $this->getActionTitle()); $qfAction->addElement('hidden', $this->typeval, $this->actionName); $qfAction->addElement('hidden', '__actionscope', $this->scope); if ($this->scope == 'selected') { M_Office_Util::addHiddenField($qfAction, 'selected', $this->getSelectedIds()); } $selectedDo = $this->getSelected(true); if ('single' == $this->type) { $selectedDo->fetch(); } if (method_exists($this->actiondo, $prepareMethod)) { if (is_a($this->actiondo, 'M_Plugin')) { call_user_func(array($this->actiondo, $prepareMethod), $qfAction, $selectedDo); } else { call_user_func(array($selectedDo, $prepareMethod), $qfAction); } } if ($this->_actionInfo['chainable'] && count($this->nextactions) == 0) { $qfAction->addElement('select', '__nextaction', __('Execute this action then ...'), array_merge(array('' => ''), $this->getNextActions())); } if (count($this->nextactions) > 0) { $qfAction->addElement('hidden', '__actionchain', implode(',', $this->nextactions)); } $qfAction->addElement('submit', '__submit__', __('Execute')); return $qfAction; } else { return null; } }