function plugin_genericobject_getDropdown() { $dropdowns = array('PluginGenericobjectTypeFamily' => PluginGenericobjectTypeFamily::getTypeName(2)); $plugin = new Plugin(); if ($plugin->isActivated("genericobject")) { foreach (PluginGenericobjectType::getTypes(true) as $idx => $type) { //_log($idx, var_export($type, true)); $itemtype = $type['itemtype']; foreach (PluginGenericobjectType::getDropdownForItemtype($itemtype) as $table) { $dropdown_itemtype = getItemTypeForTable($table); if (class_exists($dropdown_itemtype)) { $dropdowns[$dropdown_itemtype] = $dropdown_itemtype::getTypeName(); } } } } return $dropdowns; }
static function getFamilyNameByItemtype($itemtype) { $types = getAllDatasFromTable("glpi_plugin_genericobject_types", "`itemtype`='{$itemtype}' AND `is_active`='1'"); if (empty($types)) { return false; } else { $type = array_pop($types); if ($type['plugin_genericobject_typefamilies_id'] > 0) { $family = new PluginGenericobjectTypeFamily(); $family->getFromDB($type['plugin_genericobject_typefamilies_id']); return $family->getName(); } else { return false; } } }
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Genericobject. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- @package genericobject @author the genericobject plugin team @copyright Copyright (c) 2010-2011 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/genericobject @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include '../../../inc/includes.php'; $family = new PluginGenericobjectTypeFamily(); if (!isset($_GET['id']) || !$family->getFromDB($_GET['id'])) { Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "assets", "genericobject"); echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><th>" . __("Empty family", "genericobject") . "</th></tr>"; echo "</table>"; } else { $family->getFromDB($_GET['id']); Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "assets", $family->getName()); echo "<table class='tab_cadre_fixe'>"; $types = PluginGenericobjectTypeFamily::getItemtypesByFamily($_GET['id']); echo "<tr class='tab_bg_2'><th>" . Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $_GET['id']) . "</th></tr>"; foreach ($types as $type) { $itemtype = $type['itemtype']; echo "<tr class='tab_bg_1'><td align='center'>"; echo "<a href='" . $itemtype::getSearchURL() . "'>";
function showBehaviorForm($ID, $options=array()) { if ($ID > 0) { $this->check($ID, READ); } else { // Create item $this->check($ID, CREATE); $use_cache = false; $this->getEmpty(); } $this->fields['id'] = $ID; $right_name = PluginGenericobjectProfile::getProfileNameForItemtype( __CLASS__ ); $canedit = Session::haveRight($right_name, UPDATE); self::includeLocales($this->fields["name"]); self::includeConstants($this->fields["name"]); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __("Internal identifier", "genericobject") . "</td>"; echo "<td>"; if (!$ID) { Html::autocompletionTextField($this, 'name', array('value' => $this->fields["name"])); } else { echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>"; echo $this->fields["name"]; } echo "</td>"; echo "<td class='middle right'>".__('Icon')."</td>"; echo "<td class='icon_preview'>".PluginGenericobjectObject::getMenuIcon($this->fields['itemtype'])."</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __("Label") . "</td>"; echo "<td>"; if ($ID) { $itemtype = $this->fields["itemtype"]; echo $itemtype::getTypeName(); } echo "</td>"; echo "<td rowspan='3' class='middle right'>".__("Comments")." : </td>"; echo "<td class='center middle' rowspan='3'><textarea cols='45' rows='4' name='comment' >".$this->fields["comment"]."</textarea></td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>".__("Active")."</td>"; echo "<td>"; if (!$ID) { echo __("No"); } else { Dropdown::showYesNo("is_active", $this->fields["is_active"]); } echo "</td></td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>".__("Family of type of objects",'genericobject')."</td>"; echo "<td>"; PluginGenericobjectTypeFamily::dropdown( array('value' => $this->fields["plugin_genericobject_typefamilies_id"])); echo "</td></td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'></td>"; echo "</tr>"; if (!$this->isNewID($ID)) { $canedit = $this->can($ID, CREATE); echo "<tr class='tab_bg_1'><th colspan='4'>"; echo __("Behaviour", "genericobject"); echo "</th></tr>"; $use = array ("use_recursivity" => __("Child entities"), "use_tickets" => __("Assistance"), "use_deleted" => __("Item in the dustbin"), "use_notes" => _n('Note', 'Notes', 2), "use_history" => __("Historical"), "use_template" => __("Templates"), "use_infocoms" => __("Financial and administratives information"), "use_contracts" => _n("Contract", "Contracts", 2), "use_documents" => _n("Document", "Documents", 2), "use_loans" => _n("Reservation", "Reservations", 2), "use_unicity" => __("Fields unicity"), "use_global_search" => __("Global search"), // "use_direct_connections" => __("Link to other objects", "genericobject"), "use_network_ports" => __("Network connections", "genericobject"), "use_plugin_datainjection" => __("injection file plugin", "genericobject"), // "use_plugin_pdf" => __("PDF plugin", "genericobject"), "use_plugin_order" => __("order plugin", "genericobject"), "use_plugin_uninstall" => __("item's uninstallation plugin", "genericobject")); $plugin = new Plugin(); $odd=0; foreach ($use as $right => $label) { if (!$odd) { echo "<tr class='tab_bg_2'>"; } echo "<td>" . _sx('button','Use') . " " . $label . "</td>"; echo "<td>"; switch ($right) { case 'use_deleted': Dropdown::showYesno('use_deleted', $this->canBeDeleted()); break; case 'use_recursivity': Dropdown::showYesno('use_recursivity', $this->canBeRecursive()); break; case 'use_notes': Dropdown::showYesno('use_notes', $this->canUseNotepad()); break; case 'use_template': Dropdown::showYesno('use_template', $this->canUseTemplate()); break; case 'use_plugin_datainjection' : if ($plugin->isActivated('datainjection')) { Dropdown::showYesNo($right, $this->fields[$right]); } else { echo Dropdown::EMPTY_VALUE; echo "<input type='hidden' name='use_plugin_datainjection' value='0'>\n"; } break; case 'use_plugin_pdf' : if ($plugin->isActivated('pdf')) { Dropdown::showYesNo($right, $this->fields[$right]); } else { echo Dropdown::EMPTY_VALUE; echo "<input type='hidden' name='use_plugin_pdf' value='0'>\n"; } break; case 'use_plugin_order' : if ($plugin->isActivated('order')) { Dropdown::showYesNo($right, $this->fields[$right]); } else { echo Dropdown::EMPTY_VALUE; echo "<input type='hidden' name='use_plugin_order' value='0'>\n"; } break; case 'use_plugin_uninstall' : if ($plugin->isActivated('uninstall')) { Dropdown::showYesNo($right, $this->fields[$right]); } else { echo Dropdown::EMPTY_VALUE; echo "<input type='hidden' name='use_plugin_uninstall' value='0'>\n"; } break; default : Dropdown::showYesNo($right, $this->fields[$right]); break; } echo "</td>"; if ($odd == 1) { $odd = 0; echo "</tr>"; } else { $odd++; } } if ($odd != 0) { echo "<td></td></tr>"; } } $this->showFormButtons($options); }