/** * * Method to return a customised input to the sysconfig form * * @access public * @return string $string The html string to be displayed in sysconfig */ public function show() { $string = $this->objLanguage->languageText('mod_jquerycore_selecttheme', 'jquerycore', 'ERROR: mod_jquerycore_selecttheme'); $objDrop = new dropdown('pvalue'); foreach ($this->themes as $theme) { $objDrop->addOption($theme, ucfirst($theme)); } $objDrop->setSelected($this->defaultValue); $string .= ' ' . $objDrop->show(); return $string; }
/** * * Method to return a customised input to the sysconfig form * * @access public * @return string $string The html string to be displayed in sysconfig */ public function show() { $string = $this->objLanguage->languageText('mod_jquerycore_selectversion', 'jquerycore', 'ERROR: mod_jquerycore_selectversion'); $objDrop = new dropdown('pvalue'); foreach ($this->coreVersions as $version) { $objDrop->addOption($version, $version); } $objDrop->setSelected($this->defaultValue); $string .= ' ' . $objDrop->show(); return $string; }
$objTable->startRow(); $objTable->addCell($objLabel->show()); $objTable->addCell($closeField); $objTable->endRow(); /* $objElement = new checkbox('studentsonly', '', true); // this will checked $check = $objElement->show(); $objTable->addRow(array( $userOptLabel, $check )); */ $objContextModules = $this->getObject('dbcontextmodules', 'context'); $objModules = $this->getObject('modules', 'modulecatalogue'); $contextModules = $objContextModules->getContextModules($contextCode); $plugins = $objModules->getListContextPlugins(); $dropDown = new dropdown('moduleid'); //$dropDown->addOption('all','All'); foreach ($plugins as $plugin) { $dropDown->addOption($plugin['module_id'], $plugin['title']); } if ($action == 'showuseractivitybymodule') { $objTable->addRow(array('<b>' . $selectModuleLabel . '</b>', $dropDown->show())); } $saveLabel = "View"; $objButton = new button('save', $saveLabel); $objButton->setToSubmit(); $btnSave = $objButton->show(); $objForm = new form('showuseractivity', $this->uri(array('action' => $action))); $objForm->addToForm($objTable->show()); $objForm->addToForm($btnSave); echo $objForm->show();
$table->startRow(); $label = new label($this->objLanguage->languageText('word_title', 'system'), 'input_useradmin_title'); $objDropdown = new dropdown('useradmin_title'); $titles = array("title_mr", "title_miss", "title_mrs", "title_ms", "title_dr", "title_prof", "title_rev", "title_assocprof"); foreach ($titles as $title) { $_title = trim($objLanguage->languageText($title)); $objDropdown->addOption($_title, $_title); } if ($mode == 'addfixup') { $objDropdown->setSelected($this->getParam('useradmin_title')); } else { $objDropdown->setSelected($user['title']); } $table->addCell($label->show(), 140); $table->addCell(' '); $table->addCell($objDropdown->show()); $table->endRow(); // Firstname $table->startRow(); $label = new label($this->objLanguage->languageText('phrase_firstname', 'system'), 'input_useradmin_firstname'); $table->addCell($label->show()); $table->addCell(' '); $table->addCell($firstname->show()); $table->endRow(); // Surname $table->startRow(); $label = new label($this->objLanguage->languageText('word_surname', 'system'), 'input_useradmin_surname'); $table->addCell($label->show()); $table->addCell(' '); $table->addCell($surname->show()); $table->endRow();
function showForm($items_id, $options = array()) { if ($items_id == '-1') { $items_id = ''; } $this->initForm($items_id, $options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . " :</td>"; echo "<td>"; echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='30'/>"; echo "</td>"; echo "<td>" . __('Check definition', 'monitoring') . " :</td>"; echo "<td>"; Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _n('Comment', 'Comments', 2) . " : </td>"; echo "<td>"; echo "<textarea cols='45' rows='2' name='comment'>" . $this->fields["comment"] . "</textarea>"; echo "</td>"; echo "<td>" . __('Check period', 'monitoring') . " :</td>"; echo "<td>"; dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td>" . __('Interval between 2 notifications', 'monitoring') . " :</td>"; echo "<td>"; Dropdown::showNumber('notification_interval', array('value' => $this->fields['notification_interval'], 'min' => 0, 'max' => 2880, 'unit' => 'minute(s)')); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td>" . __('Business priority level', 'monitoring') . " :</td>"; echo "<td>"; Dropdown::showNumber('business_priority', array('value' => $this->fields['business_priority'], 'min' => 1, 'max' => 5)); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "<td>" . __('Services catalog template ?', 'monitoring') . " :</td>"; echo "<td>"; if (PluginMonitoringServicescatalog::canUpdate()) { Dropdown::showYesNo('is_generic', $this->fields['is_generic']); } else { echo Dropdown::getYesNo($this->fields['is_generic']); } echo "</td>"; echo "</tr>"; $this->showFormButtons($options); return true; }
/** * Standard block show method. */ public function show() { try { $objContext = $this->getObject('dbcontext', 'context'); $courses = $objContext->getListOfPublicContext(); if (count($courses) == 0) { $msg = $this->objLanguage->code2Txt('mod_context_nocontexts', 'context'); return "<span class='noRecordsMessage'>{$msg}</span>"; } else { $form = new form('joincontext', $this->uri(array('action' => 'joincontext'), 'context')); $dropdown = new dropdown('contextcode'); foreach ($courses as $course) { $dropdown->addOption($course['contextcode'], $course['menutext']); } $dropdown->setSelected($objContext->getContextCode()); $button = new button('submitform', ucwords($this->objLanguage->code2Txt('mod_context_entercourse', 'context', NULL, 'Enter [-context-]'))); $button->setToSubmit(); $form->addToForm($dropdown->show() . '<br />' . $button->show()); return $form->show(); } } catch (customException $e) { customException::cleanUp(); } }
function showForm($items_id, $options=array(), $services_id='') { $pMonitoringCommand = new PluginMonitoringCommand(); $pMonitoringServicedef = new PluginMonitoringServicedef(); if (isset($_GET['withtemplate']) AND ($_GET['withtemplate'] == '1')) { $options['withtemplate'] = 1; } else { $options['withtemplate'] = 0; } if ($services_id!='') { $this->getEmpty(); } else { $this->getFromDB($items_id); } $this->showTabs($options); $this->showFormHeader($options); if (!isset($this->fields['plugin_monitoring_servicedefs_id']) OR empty($this->fields['plugin_monitoring_servicedefs_id'])) { $pMonitoringServicedef->getEmpty(); } else { $pMonitoringServicedef->getFromDB($this->fields['plugin_monitoring_servicedefs_id']); } $template = false; echo "<tr>"; echo "<td>"; if ($services_id!='') { echo "<input type='hidden' name='plugin_monitoring_services_id' value='".$services_id."' />"; } echo __('Name')." :"; echo "</td>"; echo "<td>"; $objectName = autoName($this->fields["name"], "name", ($template === "newcomp"), $this->getType()); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>"; echo __('Template')." :"; echo "</td>"; echo "<td>"; if ($items_id != '0') { echo "<input type='hidden' name='update' value='update'>\n"; } echo "<input type='hidden' name='plugin_monitoring_servicedefs_id_s' value='".$this->fields['plugin_monitoring_servicedefs_id']."'>\n"; if ($pMonitoringServicedef->fields['is_template'] == '0') { $this->fields['plugin_monitoring_servicedefs_id'] = 0; } Dropdown::show("PluginMonitoringServicetemplate", array( 'name' => 'plugin_monitoring_servicetemplates_id', 'value' => $this->fields['plugin_monitoring_servicetemplates_id'], 'auto_submit' => true )); echo "</td>"; echo "<td>"; if ($this->fields["items_id"] == '') { } else { echo "<input type='hidden' name='items_id' value='".$this->fields["items_id"]."'>\n"; echo "<input type='hidden' name='itemtype' value='".$this->fields["itemtype"]."'>\n"; } echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<th colspan='4'> </th>"; echo "</tr>"; echo "<tr>"; // * itemtype link if ($this->fields['itemtype'] != '') { $itemtype = $this->fields['itemtype']; $item = new $itemtype(); $item->getFromDB($this->fields['items_id']); echo "<td>"; echo __('Item Type')." <i>".$item->getTypeName()."</i>"; echo " :</td>"; echo "<td>"; echo $item->getLink(1); echo "</td>"; } else { echo "<td colspan='2' align='center'>"; echo __('No type associated', 'monitoring'); echo "</td>"; } // * command echo "<td>"; echo __('Command', 'monitoring')." :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { $pMonitoringServicetemplate = new PluginMonitoringServicetemplate(); $pMonitoringServicetemplate->getFromDB($this->fields['plugin_monitoring_servicetemplates_id']); $pMonitoringCommand->getFromDB($pMonitoringServicetemplate->fields['plugin_monitoring_commands_id']); echo $pMonitoringCommand->getLink(1); } else { $pMonitoringCommand->getFromDB($pMonitoringServicedef->fields['plugin_monitoring_commands_id']); Dropdown::show("PluginMonitoringCommand", array( 'name' =>'plugin_monitoring_commands_id', 'value'=>$pMonitoringServicedef->fields['plugin_monitoring_commands_id'] )); } echo "</td>"; echo "</tr>"; echo "<tr>"; // * checks echo "<td>".__('Check definition', 'monitoring')." :</td>"; echo "<td align='center'>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { $pMonitoringCheck = new PluginMonitoringCheck(); $pMonitoringCheck->getFromDB($pMonitoringServicetemplate->fields['plugin_monitoring_checks_id']); echo $pMonitoringCheck->getLink(1); } else { Dropdown::show("PluginMonitoringCheck", array('name'=>'plugin_monitoring_checks_id', 'value'=>$pMonitoringServicedef->fields['plugin_monitoring_checks_id'])); } echo "</td>"; // * active check echo "<td>"; echo __('Active check', 'monitoring')." :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['active_checks_enabled']); } else { Dropdown::showYesNo("active_checks_enabled", $pMonitoringServicedef->fields['active_checks_enabled']); } echo "</td>"; echo "</tr>"; echo "<tr>"; // * passive check echo "<td>"; echo __('Passive check', 'monitoring')." :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['passive_checks_enabled']); } else { Dropdown::showYesNo("passive_checks_enabled", $pMonitoringServicedef->fields['passive_checks_enabled']); } echo "</td>"; // * calendar echo "<td>".__('Check period', 'monitoring')." :</td>"; echo "<td align='center'>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { $calendar = new Calendar(); $calendar->getFromDB($pMonitoringServicetemplate->fields['calendars_id']); echo $calendar->getLink(1); } else { dropdown::show("Calendar", array('name'=>'calendars_id', 'value'=>$pMonitoringServicedef->fields['calendars_id'])); } echo "</td>"; echo "</tr>"; if (!($this->fields['plugin_monitoring_servicetemplates_id'] > 0 AND $pMonitoringServicetemplate->fields['remotesystem'] == '')) { echo "<tr>"; echo "<th colspan='4'>".__('Remote check', 'monitoring')."</th>"; echo "</tr>"; echo "<tr>"; // * remotesystem echo "<td>"; echo __('Utility used for remote check', 'monitoring')." :"; echo "</td>"; echo "<td>"; $input = array(); $input[''] = '------'; $input['byssh'] = 'byssh'; $input['nrpe'] = 'nrpe'; $input['nsca'] = 'nsca'; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { echo $input[$pMonitoringServicetemplate->fields['remotesystem']]; } else { Dropdown::showFromArray("remotesystem", $input, array('value'=>$pMonitoringServicedef->fields['remotesystem'])); } echo "</td>"; // * is_argument echo "<td>"; echo __('Use arguments (NRPE only)', 'monitoring')." :"; echo "</td>"; echo "<td>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { echo Dropdown::getYesNo($pMonitoringServicetemplate->fields['is_arguments']); } else { Dropdown::showYesNo("is_arguments", $pMonitoringServicedef->fields['is_arguments']); } echo "</td>"; echo "</tr>"; echo "<tr>"; // alias command echo "<td>"; echo __('Alias command if required (NRPE only)', 'monitoring')." :"; echo "</td>"; echo "<td>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { echo "<input type='text' name='alias_commandservice' value='".$this->fields['alias_command']."' />"; } else { echo "<input type='text' name='alias_command' value='".$pMonitoringServicedef->fields['alias_command']."' />"; } echo "</td>"; echo "<td>"; echo __('Template (for graphs generation)', 'monitoring')." :GHJKL"; echo "</td>"; echo "<td>"; if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) { $pMonitoringCommand->getEmpty(); $pMonitoringCommand->getFromDB($pMonitoringServicetemplate->fields['aliasperfdata_commands_id']); echo $pMonitoringCommand->getLink(1); } else { $pMonitoringCommand->getFromDB($pMonitoringServicedef->fields['aliasperfdata_commands_id']); Dropdown::show("PluginMonitoringCommand", array( 'name' =>'aliasperfdata_commands_id', 'value'=>$pMonitoringServicedef->fields['aliasperfdata_commands_id'] )); } echo "</td>"; echo "</tr>"; } // * Manage arguments $array = array(); $a_displayarg = array(); if (isset($pMonitoringCommand->fields['command_line'])) { preg_match_all("/\\$(ARG\d+)\\$/", $pMonitoringCommand->fields['command_line'], $array); $a_arguments = importArrayFromDB($this->fields['arguments']); foreach ($array[0] as $arg) { if (strstr($arg, "ARG")) { $arg = str_replace('$', '', $arg); if (!isset($a_arguments[$arg])) { $a_arguments[$arg] = ''; } $a_displayarg[$arg] = $a_arguments[$arg]; } } } if (count($a_displayarg) > 0) { $a_argtext = importArrayFromDB($pMonitoringCommand->fields['arguments']); echo "<tr>"; echo "<th colspan='4'>".__('Argument ([text:text] is used to get values dynamically)', 'monitoring')." </th>"; echo "</tr>"; foreach ($a_displayarg as $key=>$value) { echo "<tr>"; echo "<th>".$key."</th>"; echo "<td colspan='2'>"; if (isset($a_argtext[$key])) { echo nl2br($a_argtext[$key])." :"; } else { echo __('Argument', 'monitoring')." :"; } if ($value == '') { $matches = array(); preg_match('/(\[\w+\:\w+\])/', nl2br($a_argtext[$key]), $matches); if (isset($matches[0])) { $value = $matches[0]; } } echo "</td>"; echo "<td>"; echo "<input type='text' name='arg[".$key."]' value='".$value."'/><br/>"; echo "</td>"; echo "</tr>"; } } $this->showFormButtons($options); return true; }
} $objHead->str = $heading; $objHead->type = 1; $str = $objHead->show(); $str .= '<p><b>' . $moduleLabel . ':</b> ' . $modName . '</p>'; // Drop down to select a different module $objLabel = new label($selectLabel, 'input_modulename'); $objDrop = new dropdown('modulename'); $objDrop->extra = 'onchange="document.forms[\'modselect\'].submit()"'; foreach ($moduleList as $item) { $modName = $objLanguage->code2Txt('mod_' . $item['module_id'] . '_name', $item['module_id']); $objDrop->addOption($item['module_id'], $modName); } $objDrop->setSelected($moduleName); $objForm = new form('modselect', $this->uri(array('action' => 'editlinks'))); $objForm->addToForm('<b>' . $objLabel->show() . ':</b> ' . $objDrop->show()); $str .= '<p>' . $objForm->show() . '</p>'; // Toolbar links $addTool = $objIcon->getAddIcon($this->uri(array('action' => 'addtool', 'modulename' => $moduleName))); $objHead->str = $toolbarLabel . ' ' . $addTool; $objHead->type = 3; $str .= $objHead->show(); $objTable = new htmltable(); $objTable->width = '99%'; $objTable->cellspacing = 2; $objTable->cellpadding = 5; $tableHd = array(); $tableHd[] = $categoryLabel; $tableHd[] = ''; $objTable->addHeader($tableHd, 'heading', "align='left'"); if (!empty($toolBar)) {
/** * Standard block show method. */ public function show() { // Get all user contents $contexts = $this->objUserContext->getUserContext($this->objUser->userId()); if (count($contexts) == 0) { return $this->objLanguage->code2Txt('mod_context_youdonotbelongtocontexts', 'context', NULL, 'You do not belong to any [-contexts-]'); } else { $form = new form('joincontext', $this->uri(array('action' => 'joincontext'), 'context')); $dropdown = new dropdown('contextcode'); $contextArray = array(); foreach ($contexts as $contextCode) { $contextDetails = $this->objContext->getContextDetails($contextCode); //check if this course is unpublished if ($contextDetails["status"] == "Unpublished") { //if so check if this person is lecturer lecturer of the course $groupId = $this->objGroups->getLeafId(array($contextCode, 'Lecturers')); $ret = $this->objGroups->isGroupMember($this->objUser->userId(), $groupId); if ($ret) { $contextArray[$contextDetails['title']] = $contextCode; } } else { $contextArray[$contextDetails['title']] = $contextCode; } } if (count($contextArray) < 1) { return $this->objLanguage->code2Txt('mod_context_youdonotbelongtocontexts', 'context', NULL, 'You do not belong to any [-contexts-]'); } ksort($contextArray); foreach ($contextArray as $title => $code) { $dropdown->addOption($code, $title); } $dropdown->setSelected($this->objContext->getContextCode()); $button = new button('submitform', ucwords($this->objLanguage->code2Txt('mod_context_entercourse', 'context', NULL, 'Enter [-context-]'))); $button->setToSubmit(); $form->addToForm($dropdown->show() . '<br />' . $button->show()); return $form->show(); } }
/** * Display form for service configuration * * @param $items_id integer ID * @param $options array * *@return bool true if form is ok * **/ function showForm($items_id, $options = array(), $copy = array()) { global $DB, $CFG_GLPI; $pMonitoringCommand = new PluginMonitoringCommand(); if (count($copy) > 0) { foreach ($copy as $key => $value) { $this->fields[$key] = stripslashes($value); } } $this->initForm($items_id, $options); if ($this->fields['id'] == 0) { $this->fields['active_checks_enabled'] = 1; $this->fields['passive_checks_enabled'] = 1; } $this->showFormHeader($options); if (isset($_SESSION['plugin_monitoring_components'])) { $this->fields = $_SESSION['plugin_monitoring_components']; if (!isset($this->fields["id"])) { $this->fields["id"] = ''; } if (!isset($this->fields["arguments"])) { $this->fields["arguments"] = ''; } unset($_SESSION['plugin_monitoring_components']); } echo "<tr>"; echo "<td>"; echo __('Name') . "<font class='red'>*</font> :"; echo "</td>"; echo "<td>"; echo "<input type='hidden' name='is_template' value='1' />"; $objectName = autoName($this->fields["name"], "name", 1, $this->getType()); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; // * checks echo "<td>" . __('Check definition', 'monitoring') . "<font class='red'>*</font> :</td>"; echo "<td>"; Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id'])); echo "</td>"; echo "</tr>"; // * Link echo "<tr>"; echo "<td>"; echo __('Alias (Shinken service_description)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; $objectDescription = autoName($this->fields["description"], "name", 1, $this->getType()); Html::autocompletionTextField($this, 'description', array('value' => $objectDescription)); echo "</td>"; /* echo "<td>"; // echo "Type of template :"; echo "</td>"; echo "<td>"; // $a_types = array(); // $a_types[''] = Dropdown::EMPTY_VALUE; // $a_types['partition'] = "Partition"; // $a_types['processor'] = "Processor"; // Dropdown::showFromArray("link", $a_types, array('value'=>$this->fields['link'])); echo "</td>"; */ // * active check echo "<td>"; echo __('Active check', 'monitoring') . "<font class='red'>*</font> :"; echo "</td>"; echo "<td>"; Dropdown::showYesNo("active_checks_enabled", $this->fields['active_checks_enabled']); echo "</td>"; echo "</tr>"; // * command echo "<tr>"; echo "<td>"; echo __('Command', 'monitoring') . "<font class='red'>*</font> :"; echo "</td>"; echo "<td>"; $pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']); Dropdown::show("PluginMonitoringCommand", array('name' => 'plugin_monitoring_commands_id', 'value' => $this->fields['plugin_monitoring_commands_id'])); echo "</td>"; // * passive check echo "<td>"; echo __('Passive check', 'monitoring') . "<font class='red'>*</font> :"; echo "</td>"; echo "<td>"; Dropdown::showYesNo("passive_checks_enabled", $this->fields['passive_checks_enabled']); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo __('Template (for graphs generation)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; Dropdown::show('PluginMonitoringPerfdata', array('name' => 'graph_template', 'value' => $this->fields['graph_template'])); echo "</td>"; // * freshness echo "<td>" . __('Freshness (for passive mode)', 'monitoring') . " :</td>"; echo "<td>"; if ($this->fields['freshness_count'] == '') { $this->fields['freshness_count'] = 0; } Dropdown::showNumber("freshness_count", array('value' => $this->fields['freshness_count'], 'min' => 0, 'max' => 300)); $a_time = array(); $a_time['seconds'] = __('Second(s)', 'monitoring'); $a_time['minutes'] = __('Minute(s)', 'monitoring'); $a_time['hours'] = __('Hour(s)', 'monitoring'); $a_time['days'] = __('Day(s)', 'monitoring'); Dropdown::showFromArray("freshness_type", $a_time, array('value' => $this->fields['freshness_type'])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo __('Event handler', 'monitoring') . " :"; echo "</td>"; echo "<td>"; dropdown::show("PluginMonitoringEventhandler", array('name' => 'plugin_monitoring_eventhandlers_id', 'value' => $this->fields['plugin_monitoring_eventhandlers_id'])); echo "</td>"; // * calendar echo "<td>" . __('Check period', 'monitoring') . "<font class='red'>*</font> :</td>"; echo "<td>"; dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id'])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<th colspan='4'>" . __('Remote check', 'monitoring') . "</th>"; echo "</tr>"; echo "<tr>"; // * remotesystem echo "<td>"; echo __('Utility used for remote check', 'monitoring') . " :"; echo "</td>"; echo "<td>"; $input = array(); $input[''] = '------'; $input['byssh'] = 'byssh'; $input['nrpe'] = 'nrpe'; $input['nsca'] = 'nsca'; Dropdown::showFromArray("remotesystem", $input, array('value' => $this->fields['remotesystem'])); echo "</td>"; // * is_argument echo "<td>"; echo __('Use arguments (NRPE only)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; Dropdown::showYesNo("is_arguments", $this->fields['is_arguments']); echo "</td>"; echo "</tr>"; echo "<tr>"; // alias command echo "<td>"; echo __('Alias command if required (NRPE only)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; echo "<input type='text' name='alias_command' value='" . $this->fields['alias_command'] . "' size='35' />"; echo "</td>"; echo "<td colspan='2'></td>"; echo "</tr>"; // * Manage arguments $array = array(); $a_displayarg = array(); if (isset($pMonitoringCommand->fields['command_line'])) { preg_match_all("/\\\$(ARG\\d+)\\\$/", $pMonitoringCommand->fields['command_line'], $array); $a_arguments = importArrayFromDB($this->fields['arguments']); foreach ($array[0] as $arg) { if (strstr($arg, "ARG")) { $arg = str_replace('$', '', $arg); if (!isset($a_arguments[$arg])) { $a_arguments[$arg] = ''; } $a_displayarg[$arg] = $a_arguments[$arg]; } } } if (count($a_displayarg) > 0) { $a_tags = $this->tagsAvailable(); $a_argtext = importArrayFromDB($pMonitoringCommand->fields['arguments']); echo "<tr>"; echo "<th colspan='4'>" . __('Arguments', 'monitoring') . " </th>"; echo "</tr>"; foreach ($a_displayarg as $key => $value) { echo "<tr>"; echo "<td>"; if (isset($a_argtext[$key]) and $a_argtext[$key] != '') { echo nl2br($a_argtext[$key]) . " :"; } else { echo __('Argument', 'monitoring') . " (" . $key . ") :"; } echo "</td>"; echo "<td>"; echo "<input type='text' name='arg[" . $key . "]' value='" . $value . "' size='35' /><br/>"; echo "</td>"; if (count($a_tags) > 0) { foreach ($a_tags as $key => $value) { echo "<td class='tab_bg_3'>"; echo "<strong>" . $key . "</strong> :"; echo "</td>"; echo "<td class='tab_bg_3'>"; echo $value; echo "</td>"; unset($a_tags[$key]); break; } } else { echo "<td colspan='2'></td>"; } echo "</tr>"; } foreach ($a_tags as $key => $value) { echo "<tr>"; echo "<td colspan='2'></td>"; echo "<td class='tab_bg_3'>"; echo "<strong>" . $key . "</strong> :"; echo "</td>"; echo "<td class='tab_bg_3'>"; echo $value; echo "</td>"; echo "</tr>"; } } if (Session::haveRight("plugin_monitoring_weathermap", READ)) { echo "<tr>"; echo "<th colspan='4'>" . __('Weathermap', 'monitoring') . " </th>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo __('Use this component for Weathermap', 'monitoring') . " :"; echo "</td>"; echo "<td>"; Dropdown::showYesNo("is_weathermap", $this->fields['is_weathermap']); echo "</td>"; echo "<td>"; $tooltip = __('Example', 'monitoring') . " :<br/><br/>"; $tooltip .= "perfdata : <i>inUsage=0.00%;85;98 outUsage=0.00%;85;98 inBandwidth=<strong>789944</strong>.00bps outBandwidth=486006.00bps inAbsolut=0 outAbsolut=12665653</i><br/><br/>"; $tooltip .= __('Regex bandwidth input', 'monitoring') . " : <i><strong>(?:.*)inBandwidth=(\\d+)(?:.*)</strong></i><br/><br/>"; $tooltip .= __('Assign the value from regular expression') . " : <strong>789944</strong>"; echo __('Regex bandwidth input', 'monitoring') . " "; Html::showToolTip($tooltip, array('autoclose' => false)); echo " :"; echo "</td>"; echo "<td>"; echo "<input type='text' name='weathermap_regex_in' value='" . $this->fields['weathermap_regex_in'] . "' size='40' />"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='2'>"; echo "</td>"; echo "<td>"; $tooltip = __('Example', 'monitoring') . " :<br/><br/>"; $tooltip .= "perfdata : <i>inUsage=0.00%;85;98 outUsage=0.00%;85;98 inBandwidth=789944.00bps outBandwidth=<strong>486006</strong>.00bps inAbsolut=0 outAbsolut=12665653</i><br/><br/>"; $tooltip .= __('Regex bandwidth output', 'monitoring') . " : <i><strong>(?:.*)outBandwidth=(\\d+)(?:.*)</strong></i><br/><br/>"; $tooltip .= __('Assign the value from regular expression') . " : <strong>789944</strong>"; echo __('Regex bandwidth output', 'monitoring') . " "; Html::showToolTip($tooltip, array('autoclose' => false)); echo " :"; echo "</td>"; echo "<td>"; echo "<input type='text' name='weathermap_regex_out' value='" . $this->fields['weathermap_regex_out'] . "' size='40' />"; echo "</td>"; echo "</tr>"; } $this->showFormButtons($options); return true; }
/** * Method to render Language Chooser on the * index page. * Construct a form and populate it with all available * language translations for selection * @access public * @return form */ public function putlanguageChooser() { try { //$ret = $this->languageText("phrase_languagelist",'language') . ":<br />\n"; $script = $_SERVER['PHP_SELF']; $objNewForm = new form('languageCheck', $script); $objDropdown = new dropdown('Languages'); $objDropdown->extra = "onchange =\"document.forms['languageCheck'].submit();\""; $results = $this->languagelist(); foreach ($results as $list) { foreach ($list as $key) { $objDropdown->addOption($key, $key); } } $objNewForm->addToForm($this->languageText("phrase_languagelist") . ":<br />\n"); $objNewForm->addToForm($objDropdown->show()); $ret = $objNewForm->show(); return $ret; } catch (Exception $e) { $this->errorCallback($this->languageText('word_caught_exception') . $e->getMessage()); exit; } }
$table->addCell(' '); $table->endRow(); $showcomment = new dropdown('showcomment'); //$status->setBreakSpace('<br />'); $showcomment->addOption('1', $this->objLanguage->languageText('word_yes', 'system', 'No') . " "); $showcomment->addOption('0', $this->objLanguage->languageText('word_no', 'system', 'No') . " "); if ($mode == 'add' && is_array($fixup)) { $showcomment->setSelected($fixup['showcomment']); } else { if ($mode == 'edit') { $showcomment->setSelected($context['showcomment']); } } $table->startRow(); $table->addCell($this->objLanguage->languageText('mod_contextadmin_comment', 'contextadmin', 'Comment')); $table->addCell($showcomment->show() . " *" . $this->objLanguage->languageText('mod_contextadmin_comments', 'contextadmin', 'Enable or Disable users to post comments on page content')); $table->endRow(); $table->startRow(); $table->addCell(' '); $table->addCell(' '); $table->endRow(); if ($objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') { $table->startRow(); $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access')); $table->addCell($access->show()); $table->endRow(); } $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalertwhat', 'contextadmin', 'Send email alerts'), true); // this will checked if ($mode == 'add' && is_array($fixup)) { $emailAlert->setChecked($fixup['alerts']);
/** * Method to create a dropdown list on interest groups (workgroups). * @param string $filter Determines if users should be filtered by context or not (alumni users). * @return the html string. */ function joinInterestGroup($filter = 'context') { // Check if workgroup is registered and active for the context $objModule = $this->getObject('modules', 'modulecatalogue'); $objCondition = $this->getObject('contextcondition', 'contextpermissions'); ///////////////////+> $notaMember = $this->objLanguage->code2Txt('mod_toolbar_notingroup', 'toolbar'); ///////////////////+> $leaveGroup = $this->objLanguage->code2Txt('mod_workgroup_leavegroup', 'workgroup'); ///////////////////+> $join = ucwords($this->objLanguage->code2Txt('mod_toolbar_joingroup', 'toolbar')); ////////////////+> $notInGroup = $this->objLanguage->code2Txt('phrase_notinworkgroup'); $inGroup = $this->objLanguage->code2Txt('mod_workgroup_currentlyinworkgroup', 'workgroup'); $go = $this->objLanguage->languageText('word_go'); $str = ''; if ($objModule->checkIfRegistered('workgroup', 'workgroup')) { $objDBWorkgroup = $this->getObject('dbworkgroup', 'workgroup'); $this->objHeading = $this->newObject('htmlheading', 'htmlelements'); $this->objHeading->str = $join; $this->objHeading->type = 4; $str = $this->objHeading->show(); if ($filter == 'context') { // Get available workgroups. Lecturers - all in context if ($objCondition->isContextMember('Lecturers')) { $workgroups = $objDBWorkgroup->getAll($this->contextcode); } else { $workgroups = $objDBWorkgroup->getAllForUser($this->contextcode, $this->objUser->userId()); } } else { $workgroups = $objDBWorkgroup->getAllForUser(NULL, $this->objUser->userId()); } // No workgroups are available. if (count($workgroups) == 0) { $str .= $notaMember; } else { $workgroupId = $objDBWorkgroup->getWorkgroupId(); if ($workgroupId == NULL) { $workgroupTitle = ''; //"<strong>".$notInGroup."</strong>"; } else { $objLink = new link($this->uri(null, 'workgroup')); $objLink->link = $objDBWorkgroup->getDescription($workgroupId); $workGroupLink = $objLink->show(); $this->objIcon->setIcon('leavecourse'); $this->objIcon->alt = $leaveGroup; $this->objIcon->title = $leaveGroup; $objLink = new link($this->uri(array('action' => 'leaveworkgroup'), 'workgroup')); $objLink->link = $this->objIcon->show(); $workgroupTitle = $workGroupLink . ' ' . $objLink->show(); $workgroupTitle = str_replace('{workgroup}', '<strong>' . $workgroupTitle . '</strong>', $inGroup); } $str .= '<p>' . $workgroupTitle . '</p>'; $objForm = new form('joinworkgroup', $this->uri(array('action' => 'joinworkgroup'), 'workgroup')); $objForm->setDisplayType(3); $dropdown = new dropdown('workgroup'); $dropdown->cssClass = 'coursechooser'; $dropdown->addFromDB($workgroups, 'description', 'id', $workgroupId); $button = new button('save', $go); $button->setToSubmit(); $objForm->addToForm('<p>' . $dropdown->show() . '</p>'); $objForm->addToForm('<p>' . $button->show() . '</p>'); $str .= $objForm->show(); } } return $str; }
$objFmTable->startRow(); $objFmTable->addCell($objLanguage->languageText("word_language") . ": ", NULL, "top", "right"); $objTextInput = new textinput('language', $language); $objTextInput->extra = 'readonly="READONLY"'; $objForm->addRule(array('name' => 'language', 'length' => 2), $objLanguage->languageText("mod_stories_val_lang2chargt", "stories"), 'maxlength'); $objForm->addRule('language', $objLanguage->languageText("mod_stories_val_langnotnull", "stories"), 'required'); //Create a dropdown for the language selector $objCat = new dropdown('language_selector'); $objCat->extra = " onchange=\"document.forms['storyinput'].language.value=document.forms['storyinput'].language_selector.value;\""; $objCat->addOption("", "Clear input"); $objLangList = $this->newObject('languagecode', 'language'); $objCat->selected = $language; foreach ($objLangList->iso_639_2_tags->codes as $key => $value) { $objCat->addOption($key, $value); } $objFmTable->addCell($objTextInput->show() . " " . $objCat->show(), NULL, "top", "left"); $objFmTable->endRow(); //Add a row for the parentId $objFmTable->startRow(); $objTextInput = new textinput('parentId', $parentId); $objTextInput->fldType = 'hidden'; if ($parentId != 'base') { $parentIdInput = $objTextInput->show(); } else { $objTextInput->fldType = "hidden"; $parentIdInput = $objTextInput->show(); } $objFmTable->addCell($parentIdInput, NULL, "top", "left"); $objFmTable->endRow(); //Add a row for the make sticky $stick = 0;
} $course1Dropdown = new dropdown('context1'); foreach ($data as $contextCode) { $row = $this->objContext->getContextDetails($contextCode); $course1Dropdown->addOption($row['contextcode'], $row['menutext']); } $course2Dropdown = new dropdown('context2'); foreach ($data as $contextCode) { $row = $this->objContext->getContextDetails($contextCode); $course2Dropdown->addOption($row['contextcode'], $row['menutext']); } $objTable = $this->newObject('htmltable', 'htmlelements'); $objTable->startRow(); $objTable->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextfrom', 'context', null, '[-context-] from')) . ":"); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($course1Dropdown->show()); $objTable->endRow(); $objTable->startRow(); $objTable->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextto', 'context', null, '[-context-] to')) . ":"); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($course2Dropdown->show()); $objTable->endRow(); $objButton = new button('save', $this->objLanguage->languageText('word_save')); $objButton->extra = 'onclick="javascript:if(confirm(\'' . $this->objLanguage->code2Txt('mod_contextgroups_confirmtransfer', 'context', NULL, 'Are you sure you want to transfer these [-readonlys-]') . '?\')){document.confirmtransfercontextusers.submit();;}else{return false;}"'; $buttons = $objButton->show(); $objForm = new form('confirmtransfercontextusers', $this->uri(array('action' => 'savetransfercontextusers'))); $objForm->addToForm($objTable->show()); $objForm->addToForm($buttons); echo $objForm->show();
/** * Method to show the time picker * @return string The time picker */ public function show() { $dropdown = new dropdown($this->name); $dropdown->cssClass = 'timepicker'; for ($hour = 0; $hour < 24; $hour++) { $time = $hour . ':00'; $dropdown->addOption($time, $time); for ($minute = 1; $minute < 4; $minute++) { $time = $hour . ':' . $minute * 15; $dropdown->addOption($time, $time); } } $dropdown->setSelected($this->value); return $dropdown->show(); }
/** * Display form for service configuration * * @param $items_id integer ID * @param $options array * *@return bool true if form is ok * **/ function showForm($items_id, $options = array()) { $pMonitoringCommand = new PluginMonitoringCommand(); if ($items_id == '0') { $this->getEmpty(); } else { $this->getFromDB($items_id); } $this->showFormHeader($options); echo "<tr>"; echo "<td>"; echo __('Template name') . " :"; echo "</td>"; echo "<td>"; echo "<input type='hidden' name='is_template' value='1' />"; $objectName = autoName($this->fields["name"], "name", 1, $this->getType()); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; // * commande echo "<td>"; echo __('Command', 'monitoring') . " :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['is_template'] == '1') { $pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']); echo $pMonitoringCommand->getLink(1); } else { $pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']); Dropdown::show("PluginMonitoringCommand", array('name' => 'plugin_monitoring_commands_id', 'value' => $this->fields['plugin_monitoring_commands_id'])); } echo "</td>"; echo "</tr>"; echo "<tr>"; // * checks echo "<td>" . __('Check definition', 'monitoring') . " :</td>"; echo "<td align='center'>"; if ($this->fields['is_template'] == '1') { $pMonitoringCheck = new PluginMonitoringCheck(); $pMonitoringCheck->getFromDB($this->fields['plugin_monitoring_checks_id']); echo $pMonitoringCheck->getLink(1); } else { Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id'])); } echo "</td>"; // * active check echo "<td>"; echo __('Active checks enable', 'monitoring') . " :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['is_template'] == '1') { echo Dropdown::getYesNo($this->fields['active_checks_enabled']); } else { Dropdown::showYesNo("active_checks_enabled", $this->fields['active_checks_enabled']); } echo "</td>"; echo "</tr>"; echo "<tr>"; // * passive check echo "<td>"; echo __('Passive checks enable', 'monitoring') . " :"; echo "</td>"; echo "<td align='center'>"; if ($this->fields['is_template'] == '1') { echo Dropdown::getYesNo($this->fields['passive_checks_enabled']); } else { Dropdown::showYesNo("passive_checks_enabled", $this->fields['passive_checks_enabled']); } echo "</td>"; // * calendar echo "<td>" . __('Check period', 'monitoring') . " :</td>"; echo "<td align='center'>"; if ($this->fields['is_template'] == '1') { $calendar = new Calendar(); $calendar->getFromDB($this->fields['calendars_id']); echo $calendar->getLink(1); } else { dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id'])); } echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<th colspan='4'>" . __('Remote check', 'monitoring') . "</th>"; echo "</tr>"; echo "<tr>"; // * remotesystem echo "<td>"; echo __('Utility used for remote check', 'monitoring') . " :"; echo "</td>"; echo "<td>"; $input = array(); $input[''] = '------'; $input['byssh'] = __('By ssh', 'monitoring'); $input['nrpe'] = 'nrpe'; $input['nsca'] = 'nsca'; if ($this->fields['is_template'] == '1') { echo $input[$this->fields['remotesystem']]; } else { Dropdown::showFromArray("remotesystem", $input, array('value' => $this->fields['remotesystem'])); } echo "</td>"; // * is_argument echo "<td>"; echo __('Use arguments (Only for NRPE)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; if ($this->fields['is_template'] == '1') { echo Dropdown::getYesNo($this->fields['is_arguments']); } else { Dropdown::showYesNo("is_arguments", $this->fields['is_arguments']); } echo "</td>"; echo "</tr>"; echo "<tr>"; // alias command echo "<td>"; echo __('Alias command if required (Only for NRPE)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; if ($this->fields['is_template'] == '1') { echo "<input type='text' name='alias_commandservice' value='" . $this->fields['alias_command'] . "' />"; } else { echo "<input type='text' name='alias_command' value='" . $this->fields['alias_command'] . "' />"; } echo "</td>"; echo "<td>"; echo __('Command link (used for graphs generation)', 'monitoring') . " :"; echo "</td>"; echo "<td>"; if ($this->fields['is_template'] == '1') { $pMonitoringCommand->getFromDB($this->fields['aliasperfdata_commands_id']); echo $pMonitoringCommand->getLink(1); } else { $pMonitoringCommand->getFromDB($this->fields['aliasperfdata_commands_id']); Dropdown::show("PluginMonitoringCommand", array('name' => 'aliasperfdata_commands_id', 'value' => $this->fields['aliasperfdata_commands_id'])); } echo "</td>"; echo "</tr>"; // * Manage arguments $array = array(); $a_displayarg = array(); if (isset($pMonitoringCommand->fields['command_line'])) { preg_match_all("/\\\$(ARG\\d+)\\\$/", $pMonitoringCommand->fields['command_line'], $array); $a_arguments = importArrayFromDB($this->fields['arguments']); foreach ($array[0] as $arg) { if (strstr($arg, "ARG")) { $arg = str_replace('$', '', $arg); if (!isset($a_arguments[$arg])) { $a_arguments[$arg] = ''; } $a_displayarg[$arg] = $a_arguments[$arg]; } } } if (count($a_displayarg) > 0) { $a_argtext = importArrayFromDB($pMonitoringCommand->fields['arguments']); echo "<tr>"; echo "<th colspan='4'>" . __('Arguments', 'monitoring') . " </th>"; echo "</tr>"; foreach ($a_displayarg as $key => $value) { echo "<tr>"; echo "<th>" . $key . "</th>"; echo "<td colspan='2'>"; if (isset($a_argtext[$key])) { echo nl2br($a_argtext[$key]) . " :"; } else { echo __('Argument', 'monitoring') . " :"; } echo "</td>"; echo "<td>"; echo "<input type='text' name='arg[" . $key . "]' value='" . $value . "'/><br/>"; echo "</td>"; echo "</tr>"; } } $this->showFormButtons($options); return true; }
/** * * Method to put a dropdown list of categories * */ function putCategoryChooser() { $objCat = $this->getObject('dbstorycategory', 'storycategoryadmin'); $ar = $objCat->getAll(); //Load the form class that I need $this->loadClass('form', 'htmlelements'); $this->loadClass('dropdown', 'htmlelements'); //Instantiate the form class $objForm = new form('chCat'); //Instantiate a dropdown $objCatDrd = new dropdown('category_selector'); $objCatDrd->extra = " onchange=\"document.location=document.forms['chCat'].category_selector.value;\""; //Add the categories $objCatDrd->addOption("", $this->objLanguage->languageText("mod_stories_anothercat", 'stories')); foreach ($ar as $line) { $link = $this->uri(array('action' => $this->getParam('action', NULL), 'storycategory' => $line['category']), $this->getParam('module', '_default')); $objCatDrd->addOption($link, $line['title']); } $objForm->addToForm($objCatDrd->show()); return $objForm->show(); }
/** * Display form for agent configuration * * @param $items_id integer ID * @param $options array * *@return bool true if form is ok * **/ function showForm($items_id, $options = array()) { global $DB, $CFG_GLPI; if ($items_id == '') { if (isset($_POST['id'])) { $a_list = $this->find("`users_id`='" . $_POST['id'] . "'", '', 1); if (count($a_list)) { $array = current($a_list); $items_id = $array['id']; } } } if ($items_id != '') { $this->getFromDB($items_id); } else { $this->getEmpty(); } $this->showFormHeader($options); $this->getFromDB($items_id); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . " :</td>"; echo "<td align='center'>"; $objectName = autoName($this->fields["name"], "name", false, $this->getType()); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>" . __('Default template', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("is_default", $this->fields['is_default']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th colspan='2'>" . __('Hosts', 'monitoring') . "</th>"; echo "<th colspan='2'>" . __('Services', 'monitoring') . "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notifications', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notifications_enabled', $this->fields['host_notifications_enabled']); echo "</td>"; echo "<td>" . __('Notifications', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notifications_enabled', $this->fields['service_notifications_enabled']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notification command', 'monitoring') . " :</td>"; echo "<td align='center'>"; dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'host_notification_commands', 'value' => $this->fields['host_notification_commands'])); echo "</td>"; echo "<td>" . __('Notification command', 'monitoring') . " :</td>"; echo "<td align='center'>"; dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'service_notification_commands', 'value' => $this->fields['service_notification_commands'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Period', 'monitoring') . " :</td>"; echo "<td align='center'>"; dropdown::show("Calendar", array('name' => 'host_notification_period', 'value' => $this->fields['host_notification_period'])); echo "</td>"; echo "<td>" . __('Period', 'monitoring') . " :</td>"; echo "<td align='center'>"; dropdown::show("Calendar", array('name' => 'service_notification_period', 'value' => $this->fields['service_notification_period'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notify on DOWN host states', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_d', $this->fields['host_notification_options_d']); echo "</td>"; echo "<td>" . __('Notify on WARNING service states', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_w', $this->fields['service_notification_options_w']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notify on UNREACHABLE host states', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_u', $this->fields['host_notification_options_u']); echo "</td>"; echo "<td>" . __('Notify on UNKNOWN service states', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_u', $this->fields['service_notification_options_u']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notify on host recoveries (UP states)', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_r', $this->fields['host_notification_options_r']); echo "</td>"; echo "<td>" . __('Notify on CRITICAL service states', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_c', $this->fields['service_notification_options_c']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notify when the host starts and stops flapping', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_f', $this->fields['host_notification_options_f']); echo "</td>"; echo "<td>" . __('Notify on service recoveries (OK states)', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_r', $this->fields['service_notification_options_r']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Send notifications when host or service scheduled downtime starts and ends', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_s', $this->fields['host_notification_options_s']); echo "</td>"; echo "<td>" . __('Notify when the service starts and stops flapping', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_f', $this->fields['service_notification_options_f']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('The contact will not receive any type of host notifications', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_n', $this->fields['host_notification_options_n']); echo "</td>"; echo "<td>" . __('The contact will not receive any type of service notifications', 'monitoring') . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_n', $this->fields['service_notification_options_n']); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); return true; }
/** * Display form for agent configuration * * @param $items_id integer ID * @param $options array * *@return bool true if form is ok * **/ function showForm($items_id, $options = array()) { global $DB, $CFG_GLPI, $LANG; if ($items_id == '') { if (isset($_POST['id'])) { $a_list = $this->find("`users_id`='" . $_POST['id'] . "'", '', 1); if (count($a_list)) { $array = current($a_list); $items_id = $array['id']; } } } if ($items_id != '') { $this->getFromDB($items_id); } else { $this->getEmpty(); } $this->showFormHeader($options); $this->getFromDB($items_id); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . " :</td>"; echo "<td align='center'>"; $objectName = autoName($this->fields["name"], "name", false, $this->getType()); autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contacttemplate'][1] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("is_default", $this->fields['is_default']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th colspan='2'>" . $LANG['plugin_monitoring']['contact'][3] . "</th>"; echo "<th colspan='2'>" . $LANG['plugin_monitoring']['contact'][4] . "</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][5] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notifications_enabled', $this->fields['host_notifications_enabled']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][5] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notifications_enabled', $this->fields['service_notifications_enabled']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][19] . " :</td>"; echo "<td align='center'>"; dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'host_notification_commands', 'value' => $this->fields['host_notification_commands'])); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][19] . " :</td>"; echo "<td align='center'>"; dropdown::show("PluginMonitoringNotificationcommand", array('name' => 'service_notification_commands', 'value' => $this->fields['service_notification_commands'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][6] . " :</td>"; echo "<td align='center'>"; dropdown::show("Calendar", array('name' => 'host_notification_period', 'value' => $this->fields['host_notification_period'])); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][6] . " :</td>"; echo "<td align='center'>"; dropdown::show("Calendar", array('name' => 'service_notification_period', 'value' => $this->fields['service_notification_period'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][7] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_d', $this->fields['host_notification_options_d']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][8] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_w', $this->fields['service_notification_options_w']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][9] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_u', $this->fields['host_notification_options_u']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][10] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_u', $this->fields['service_notification_options_u']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][11] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_r', $this->fields['host_notification_options_r']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][12] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_c', $this->fields['service_notification_options_c']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][13] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_f', $this->fields['host_notification_options_f']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][14] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_r', $this->fields['service_notification_options_r']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][15] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_s', $this->fields['host_notification_options_s']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][16] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_f', $this->fields['service_notification_options_f']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][17] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('host_notification_options_n', $this->fields['host_notification_options_n']); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['contact'][18] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo('service_notification_options_n', $this->fields['service_notification_options_n']); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); return true; }
/** * * Render the dropdown skin chooser so that it is processed * by the skinselect module, for use with Ajax * * @return string Form with dropdown * @access public * */ public function show() { $script = $this->uri(array('action' => 'save'), 'skinselect'); $objNewForm = new form('selectskin', $script); $objDropdown = new dropdown('skinlocation'); $objDropdown->extra = "onchange =\"document.forms['selectskin'].submit();\""; $skins = array(); $curPage = $this->curPageURL(); $objSelf = new textinput('returnUri', $curPage); $objSelf->fldType = "hidden"; // Get all the skins as an array $dirList = $this->getAllSkins(); // Sort the array of skins alphabetically asort($dirList); // Loop and add them to the dropdown foreach ($dirList as $element => $value) { $objDropdown->addOption($element, $value); } $objNewForm->addToForm($this->objLanguage->languageText('phrase_selectskin') . ":<br />\n"); // Set the current skin as the default selected skin $objDropdown->setSelected($this->getSession('skin')); $objDropdown->cssClass = 'coursechooser'; $objNewForm->addToForm($objDropdown->show()); $objNewForm->addToForm($objSelf->show()); return $objNewForm->show(); }
/** * * Method to show the user selectable grades * * @acces public * @return VOID */ public function showGrades() { $selectGradeLabel = $this->objLanguage->code2Txt('mod_grades_grade', 'grades', NULL, 'ERROR: mod_grades_grade'); $selectLabel = $this->objLanguage->languageText('word_select', 'system', 'ERROR: word_select'); $successTitleLabel = $this->objLanguage->languageText('word_success', 'system', 'ERROR: word_success'); $successLabel = $this->objLanguage->code2Txt('mod_userdetails_gradesuccess', 'userdetails', NULL, 'ERROR: mod_userdetails_gradesuccess'); $errorTitleLabel = $this->objLanguage->languageText('word_error', 'system', 'ERROR: word_error'); $errorLabel = $this->objLanguage->code2Txt('mod_userdetails_gradeerror', 'userdetails', NULL, 'ERROR: mod_userdetails_gradeerror'); $grades = $this->objDBgrades->getAll(); $userGroups = $this->objGroups->getUserGroups($this->objUser->userId()); $name = NULL; if (!empty($userGroups)) { foreach ($userGroups as $group) { foreach ($grades as $grade) { if ($group['group_define_name'] == $grade['name']) { $name = $grade['name']; break; break; } } } } $objDrop = new dropdown('new_name'); $objDrop->addFromDB($grades, 'name', 'name'); $objDrop->setSelected($name); $gradeDrop = $objDrop->show(); $objInput = new textinput('old_name', $name, 'hidden', '50'); $nameInput = $objInput->show(); $objButton = new button('select', $selectLabel); $objButton->setId('grade_select'); $selectButton = $objButton->show(); $objTable = new htmltable(); $objTable->cellpadding = '4'; $objTable->startRow(); $objTable->addCell('<b>' . ucfirst(strtolower($selectGradeLabel)) . ': </b>', '', '', '', '', '', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($nameInput . $gradeDrop, '', '', '', '', '', ''); $objTable->endRow(); $objTable->startRow(); $objTable->addCell($selectButton, '', '', '', '', '', ''); $objTable->endRow(); $gradeTable = $objTable->show(); $objForm = new form('user', $this->uri(array('action' => 'change_grade'))); $objForm->extra = ' enctype="multipart/form-data"'; $objForm->addToForm($gradeTable); $gradeForm = $objForm->show(); $string = $gradeForm; $this->objDialog = $this->newObject('dialog', 'jquerycore'); $this->objDialog->setCssId('dialog_grade_success'); $this->objDialog->setTitle(ucwords($successTitleLabel)); $this->objDialog->setCloseOnEscape(FALSE); $this->objDialog->setContent('<span class="success">' . $successLabel . '</span>'); $this->objDialog->setAutoOpen(FALSE); $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();"); $dialog = $this->objDialog->show(); $this->objDialog = $this->newObject('dialog', 'jquerycore'); $this->objDialog->setCssId('dialog_grade_error'); $this->objDialog->setTitle(ucwords($errorTitleLabel)); $this->objDialog->setCloseOnEscape(FALSE); $this->objDialog->setContent('<span class="error">' . $errorLabel . '</span>'); $this->objDialog->setAutoOpen(FALSE); $this->objDialog->setOpen("jQuery('.ui-dialog-titlebar-close').hide();"); $dialog .= $this->objDialog->show(); return $string . $dialog; }
/** * Method to generate an edit context settings form * @param array $context Current Context Settings * @return str */ public function editContextForm($context) { $header = new htmlheading(); $header->type = 1; $header->str = $this->objLanguage->languageText('word_edit', 'system', 'Edit') . ': ' . $context['title']; $str = $header->show(); $title = new textinput('title'); $title->size = 50; if ($context != NULL) { $title->value = htmlentities($context['title']); } $titleLabel = new label($this->objLanguage->languageText('word_title', 'system', 'Title'), 'input_title'); $status = new dropdown('status'); //$status->setBreakSpace('<br />'); $status->addOption('Published', $this->objLanguage->languageText('word_published', 'system', 'Published')); $status->addOption('Unpublished', $this->objLanguage->languageText('word_unpublished', 'system', 'Unpublished')); if ($context != NULL) { $status->setSelected($context['status']); } if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') { if (is_null($context)) { $access_ = 'Private'; } else { $access_ = $context['access']; } $access = new hiddeninput('access', $access_); } else { $access = new radio('access'); $access->setBreakSpace('<br />'); $access->addOption('Public', '<strong>' . $this->objLanguage->languageText('word_public', 'system', 'Public') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_publiccontextdescription', 'context', NULL, '[-context-] can be accessed by all users, including anonymous users')) . '</span>'); $access->addOption('Open', '<strong>' . $this->objLanguage->languageText('word_open', 'system', 'Open') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_opencontextdescription', 'context', NULL, '[-context-] can be accessed by all users that are logged in')) . '</span>'); $access->addOption('Private', '<strong>' . $this->objLanguage->languageText('word_private', 'system', 'Private') . '</strong> - <span class="caption">' . $this->objLanguage->code2Txt('mod_context_privatecontextdescription', 'context', NULL, 'Only [-context-] members can enter the [-context-]') . '<span class="caption">'); if ($context != NULL) { $access->setSelected($context['access']); } else { $access->setSelected('Public'); } } $table = $this->newObject('htmltable', 'htmlelements'); if ($context != NULL) { $table->startRow(); $table->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')) . ':', 100); $table->addCell('<strong>' . $context['contextcode'] . '</strong>'); $table->endRow(); } else { $code = new textinput('contextcode'); $codeLabel = new label(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')), 'input_contextcode'); $table->startRow(); $table->addCell($codeLabel->show(), 100); $table->addCell($code->show() . ' <span id="contextcodemessage"></span>'); $table->endRow(); } $table->startRow(); $table->addCell($titleLabel->show() . ':'); $table->addCell($title->show()); $table->endRow(); $table->startRow(); $table->addCell(' '); $table->addCell(' '); $table->endRow(); $table->startRow(); $table->addCell($this->objLanguage->languageText('word_status', 'system', 'Status') . ':'); $table->addCell($status->show()); $table->endRow(); if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') { $table->startRow(); $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access') . ':'); $table->addCell($access->show()); $table->endRow(); } $alerts = explode("|", $context['alerts']); $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Email alerts'), $alerts[0] == 'e' || $alerts[0] == '1'); // this will checked //$alerts=array(); //$emailchecked=; //$emailAlert->setChecked(FALSE); //if($emailchecked) { // $emailAlert->setChecked($emailchecked); //} $table->startRow(); $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts')); $table->addCell($emailAlert->show()); $table->endRow(); $objSelectImage = $this->getObject('selectimage', 'filemanager'); $objSelectImage->context = TRUE; $table2 = $this->newObject('htmltable', 'htmlelements'); $table2->startRow(); $table2->addCell($table->show(), 600, NULL, NULL, NULL, 'colspan="2"'); $table2->addCell($objSelectImage->show()); $table2->endRow(); $table2->startRow(); $table2->addCell(' '); $table2->addCell(' '); $table2->addCell(' '); $table2->endRow(); $table2->startRow(); $table2->addCell(ucwords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context', NULL, 'About [-context-]')) . ':', 100); $htmlEditor = $this->newObject('htmlarea', 'htmlelements'); $htmlEditor->name = 'about'; $htmlEditor->toolbarSet = 'advanced'; if ($context != NULL) { $htmlEditor->value = $context['about']; } $table2->addCell($htmlEditor->show(), NULL, NULL, NULL, NULL, 'colspan="2"'); $table2->endRow(); $table2->startRow(); $table2->addCell(' '); $table2->addCell(' '); $table2->addCell(' '); $table2->endRow(); $table2->startRow(); $table2->addCell(' ', 100); if ($context == NULL) { $button = new button('savecontext', $formButton); } else { $button = new button('savecontext', ucwords($this->objLanguage->code2Txt('mod_context_updatecontext', 'context', NULL, 'Update [-context-]'))); } $button->setToSubmit(); $table2->addCell($button->show(), NULL, NULL, NULL, NULL, 'colspan="2"'); $table2->endRow(); $form = new form('createcontext', $this->uri(array('action' => $this->formAction), $this->formModule)); $form->addToForm($table2->show()); if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') { $form->addToForm($access->show()); } if ($context != NULL) { $hiddenInput = new hiddeninput('contextcode', $context['contextcode']); $form->addToForm($hiddenInput->show()); } $form->addRule('title', $this->objLanguage->code2Txt('mod_context_entertitleofcontext', 'context', NULL, 'Please enter the title of your [-context-]'), 'required'); $str .= $form->show(); return $str; }
$form->addToForm($fieldset->show()); $form->addToForm('<br />'); $table = $this->newObject('htmltable', 'htmlelements'); $titlesDropdown = new dropdown('register_title'); $titlesLabel = new label($this->objLanguage->languageText('word_title', 'system') . ' ', 'input_register_title'); $titles = array("title_mr", "title_miss", "title_mrs", "title_ms", "title_dr", "title_prof", "title_rev", "title_assocprof"); foreach ($titles as $title) { $_title = trim($this->objLanguage->languageText($title)); $titlesDropdown->addOption($_title, $_title); } if ($mode == 'addfixup') { $titlesDropdown->setSelected($this->getParam('register_title')); } $table->startRow(); $table->addCell($titlesLabel->show(), 150, NULL, 'right'); $table->addCell($titlesDropdown->show()); $table->endRow(); $firstname = new textinput('register_firstname'); $firstnameLabel = new label($this->objLanguage->languageText('phrase_firstname', 'system', "First name") . ' ', 'input_register_firstname'); if ($mode == 'addfixup') { $firstname->value = $this->getParam('register_firstname'); if ($this->getParam('register_firstname') == '') { $messages[] = $this->objLanguage->languageText('mod_userdetails_enterfirstname', 'userdetails'); } } if (isset($userstring) && $mode == 'add') { $firstname->value = $userstring[0]; } $table->startRow(); $table->addCell($firstnameLabel->show(), 150, NULL, 'right'); $table->addCell($firstname->show() . $required);
function showForm($items_id, $options = array()) { global $LANG; if ($items_id != '' and $items_id != '-1') { $this->getFromDB($items_id); } else { $this->getEmpty(); } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . " :</td>"; echo "<td>"; echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='30'/>"; echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['check'][0] . " :</td>"; echo "<td>"; Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id'])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][25] . " : </td>"; echo "<td>"; echo "<textarea cols='45' rows='2' name='comment'>" . $this->fields["comment"] . "</textarea>"; echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['host'][9] . " :</td>"; echo "<td>"; dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id'])); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
$table->addCell($this->objLanguage->languageText('mod_forum_searchfor', 'system', 'Search for')); $table->addCell($searchFor->show()); $orderBy1 = new dropdown('orderBy_user'); $orderBy1->addOption('quotausage_desc', $this->objLanguage->languageText('mod_filemanager_mostusage', 'filemanager', 'Most Usage')); $orderBy1->addOption('quotausage', $this->objLanguage->languageText('mod_filemanager_leastusage', 'filemanager', 'Least Usage')); $orderBy1->addOption('firstname', $this->objLanguage->languageText('phrase_firstname', 'system', 'First Name')); $orderBy1->addOption('surname', $this->objLanguage->languageText('word_surname', 'system', 'Surname')); $orderBy1->setSelected($this->getParam('orderBy_user')); $div1 = '<div class="userform" style="display: ' . $userDisplay . '">' . $orderBy1->show() . '</div>'; $orderBy2 = new dropdown('orderBy_context'); $orderBy2->addOption('quotausage_desc', $this->objLanguage->languageText('mod_filemanager_mostusage', 'filemanager', 'Most Usage')); $orderBy2->addOption('quotausage', $this->objLanguage->languageText('mod_filemanager_leastusage', 'filemanager', 'Least Usage')); $orderBy2->addOption('title', ucwords($this->objLanguage->code2Txt('mod_context_contexttitle', 'context', NULL, '[-context-] Title'))); $orderBy2->addOption('contextcode', ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code'))); $orderBy2->setSelected($this->getParam('orderBy_context')); $div2 = '<div class="contextform" style="display: ' . $contextDisplay . '">' . $orderBy2->show() . '</div>'; $table->addCell($this->objLanguage->languageText('mod_filemanager_orderby', 'filemanager', 'Order By')); $table->addCell($div1 . $div2); $button = new button('go', $this->objLanguage->languageText('word_go', 'system', 'Go')); $button->setToSubmit(); $table->addCell($button->show()); $table->endRow(); $form->addToForm($table->show()); echo $form->show(); $objPagination = $this->newObject('pagination', 'navigation'); $objPagination->id = 'quotalist'; $numItemsPerPage = 20; $objPagination->numPageLinks = $this->objQuotas->getNumPages($searchType, $searchField, $this->getParam('searchfor'), $orderBy, $numItemsPerPage); $objPagination->module = 'filemanager'; $objPagination->action = 'ajaxgetquotas'; $objPagination->extra = array('searchType' => $searchType, 'searchField' => $searchField, 'searchFor' => $this->getParam('searchfor'), 'orderBy' => $orderBy, 'numItemsPerPage' => $numItemsPerPage);
$table->startRow(); $orderLabel = new label($this->objLanguage->languageText('mod_contextgroups_orderresultsby', 'contextgroups') . ': ', 'input_order'); $searchdropdown->name = 'order'; $searchdropdown->cssId = 'input_order'; $searchdropdown->setSelected($order); //$table->addCell($orderLabel->show().$searchdropdown->show()); $label = new label($this->objLanguage->languageText('mod_contextgroups_noofresults', 'contextgroups') . ': ', 'input_results'); $dropdown = new dropdown('results'); $dropdown->addOption('20', '20'); $dropdown->addOption('30', '30'); $dropdown->addOption('50', '50'); $dropdown->addOption('75', '75'); $dropdown->addOption('100', '100'); //$dropdown->addOption('all', 'All Results'); $dropdown->setSelected($numresults); $table->addCell($orderLabel->show() . $searchdropdown->show() . " " . $label->show() . $dropdown->show()); $table->endRow(); $button = new button('searchbutton'); $button->value = $this->objLanguage->languageText('word_search'); $button->setToSubmit(); $table->addCell($button->show()); $table->addCell(' '); $table->endRow(); $form = new form('searchforusers', $this->uri(array('action' => 'searchforusers'))); $form->addToForm($table->show()); echo $form->show(); // -------------------------------- if (count($results) == 0) { echo '<div class="noRecordsMessage">' . $this->objLanguage->languageText('mod_contextgroups_nousersfoundsearchcriteria', 'contextgroups', 'No Users found with search criteria') . '</div>'; } else { $start = ($page - 1) * $numresults + 1;
$lnkBack->extra = 'onclick="javascript:document.frmCond[\'button\'].value=\'cancel\';document.frmCond.submit();"'; $lnkBack->link = $this->objLanguage->languageText("word_back"); $arrControls = array($lnkSave->show(), $lnkBack->show()); $lblConditionType = $this->objLanguage->code2Txt('mod_contextpermissions_lblConditionType', 'contextpermissions'); $objLabel = new label($lblConditionType, 'input_type'); $lblType = $objLabel->show(); $frmCond = $this->newObject('form', 'htmlelements'); $frmCond->name = 'frmCond'; $frmCond->displayType = '3'; $frmCond->action = $this->uri(array('action' => 'condition_form')); $frmCond->addToForm("<input type=hidden name=button value=''>\n"); $frmCond->addToForm("<input type=hidden name=id value={$id}>\n"); $frmCond->addToForm("<DIV id=blog-content>\n"); $frmCond->addToForm(" <DIV id=formline>\n"); $frmCond->addToForm(" <DIV id=formlabel>{$lblType}</DIV>\n"); $frmCond->addToForm(" <DIV id=formelement>" . $ddbType->show() . "</DIV>\n"); $frmCond->addToForm(" </DIV>\n"); $frmCond->addToForm(" <DIV id=formline>\n"); $frmCond->addToForm(" <DIV id=formlabel>{$lblName}</DIV>\n"); $frmCond->addToForm(" <DIV id=formelement>{$element}</DIV>\n"); $frmCond->addToForm(" </DIV>\n"); $frmCond->addToForm("</DIV>\n"); $frmCond->addToForm("<DIV id=blog-footer>\n"); $frmCond->addToForm(implode(' / ', $arrControls)); $frmCond->addToForm("</DIV>\n"); if ($msg) { $timer = $this->getObject('timeoutmessage', 'htmlelements'); $timer->setMessage($msg); echo $timer->show(); } echo $frmCond->show();
/** * * Method to parse the string * @param String $str The string to parse * @return The parsed string * */ public function parse($txt) { preg_match_all('/\\[LIBRARYSEARCH\\](.*)\\[\\/LIBRARYSEARCH\\]/U', $txt, $results, PREG_PATTERN_ORDER); preg_match_all('/\\[LIBRARYSEARCH:(.*?)\\]/', $txt, $results2, PREG_PATTERN_ORDER); $counter = 0; foreach ($results[1] as $item) { $objForm = new form('library_search_form', $this->uri(array('action' => 'search'), 'librarysearch')); $searchInput = new textinput('search_key'); $selectCluster = new dropdown('subject_cluster'); $selectCluster->addOption('database', 'Database'); $selectCluster->addOption('books', 'Books'); $selectCluster->addOption('websites', 'Websites'); $selectCluster->selected = 'websites'; // Submit Button $button = new button('submit_search', $this->objLanguage->languageText('word_search')); $button->setToSubmit(); $objForm->addToForm($searchInput->show() . ' '); $objForm->addToForm($selectCluster->show() . ' '); $objForm->addToForm($button->show()); $replacement = $objForm->show(); $txt = str_replace($results[0][$counter], $replacement, $txt); $counter++; } return $txt; }
/** * * Gets the wide blocks for the template middle. It renders the dropdown * for selecting wide blocks when 'Turn editing on' is enabled. * * @return string A dropdown for selecting blocks * @access public * */ public function getWideBlocks() { // Create array for sorting $wideBlockOptions = array(); $wideBlocksDropDown = new dropdown('middleblocks'); $wideBlocksDropDown->cssId = 'ddmiddleblocks'; $wideBlocksDropDown->addOption('', $this->objLanguage->languageText('phrase_selectone', 'context', 'Select One') . '...'); foreach ($this->wideDynamicBlocks as $wideBlock) { $smallBlockOptions['dynamicblock|' . $wideBlock['id'] . '|' . $wideBlock['module']] = htmlentities($wideBlock['title']); } $wideBlocks = $this->objBlocks->getBlocks('wide', 'site|user'); foreach ($wideBlocks as $wideBlock) { if ($wideBlock["moduleid"] != "contentblocks") { $block = $this->newObject('block_' . $wideBlock['blockname'], $wideBlock['moduleid']); $title = $block->title; if ($title == '') { $title = $wideBlock['blockname'] . ' (' . $wideBlock['moduleid'] . ')'; } else { $title = $title . " (" . $wideBlock['moduleid'] . ")"; } $wideBlockOptions['block|' . $wideBlock['blockname'] . '|' . $wideBlock['moduleid']] = htmlentities($title); } else { // fetch contentblock data //$block = $this->objBlocks->showBlock($wideBlock["id"], "contentblocks"); $bData = $this->objBlocksContent->getBlockById($wideBlock["id"]); if (!empty($bData)) { $bData = $bData[0]; $title = $bData["title"]; //parse some abstractions $title = $this->objLanguage->abstractText($title); if ($title == '') { $title = $wideBlock['blockname'] . ' | '; } $title .= " (" . $wideBlock['moduleid'] . ")"; $wideBlockOptions['block|' . $bData["id"] . '|' . "contentblocks"] = htmlentities($bData["title"] . ' (contentblocks)'); } } } // Sort Alphabetically asort($wideBlockOptions); // Add wide Blocks foreach ($wideBlockOptions as $block => $title) { $wideBlocksDropDown->addOption($block, $title); } //Add content blocks if any $contentWideBlocks = ""; if ($this->cbExists) { $contentWideBlocks = $this->objBlocksContent->getBlocksArr('content_widetext'); //Add content sideblocks to options if (!empty($contentWideBlocks)) { foreach ($contentWideBlocks as $contentWideBlock) { $wideBlocksDropDown->addOption('block|' . $contentWideBlock["id"] . '|' . "contentblocks", htmlentities($contentWideBlock["title"]) . '(contentblocks)'); } } } return $wideBlocksDropDown->show(); }