예제 #1
0
 function showBehaviorForm($ID, $options = array())
 {
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
         $use_cache = false;
         $this->getEmpty();
     }
     $this->fields['id'] = $ID;
     $canedit = $this->can($ID, 'w');
     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 rowspan='4' class='middle right'>" . __("Comments") . "&nbsp;: </td>";
     echo "<td class='center middle' rowspan='4'><textarea cols='45' rows='4'\n             name='comment' >" . $this->fields["comment"] . "</textarea></td></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 "</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 colspan='2'></td>";
     echo "</tr>";
     if (!$this->isNewID($ID)) {
         $canedit = $this->can($ID, 'w');
         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_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);
 }