public static function shortcut_menu() { PHPWS_Core::initModClass('access', 'Shortcut.php'); $sch_id = filter_input(INPUT_GET, 'sch_id', FILTER_SANITIZE_NUMBER_INT); if ($sch_id === false) { $sch_id = 0; } if (!$sch_id) { @($key_id = $_REQUEST['key_id']); if (!$key_id) { javascript('close_window'); return; } else { $shortcut = new Access_Shortcut(); $key = new Key($key_id); if (!$key->id) { javascript('close_window'); return; } $shortcut->keyword = trim(preg_replace('/[^\\w\\s\\-]/', '', $key->title)); } } else { $shortcut = new Access_Shortcut($sch_id); if (!$shortcut->id) { return 'Error: shortcut not found'; } } $form = new \Form(); $form->setAction('index.php'); $form->appendCSS('bootstrap'); $form->setId('shortcut-menu'); $form->addHidden('authkey', \Current_User::getAuthKey()); $form->addHidden('module', 'access'); $form->addHidden('command', 'post_shortcut'); if (isset($key_id)) { $form->addHidden('key_id', $key_id); } else { $form->addHidden('sch_id', $shortcut->id); } $keyword = $form->addTextField('keyword', $shortcut->keyword)->setRequired(); $keyword->setPlaceholder(dgettext('access', 'Type in a keyword')); $tpl = $form->getInputStringArray(); $template = new \Template($tpl); $template->setModuleTemplate('access', 'shortcut_menu.tpl'); $content = $template->render(); return $content; }