Ejemplo n.º 1
0
 /**
  * Return parent category
  *
  * @param void
  * @return DocumentCategory
  */
 function getCategory()
 {
     if ($this->category === false) {
         $this->category = DocumentCategories::findByDocument($this);
     }
     // if
     return $this->category->getId();
 }
/**
 * Render select Document Category helper
 * 
 * Params:
 * 
 * - Standard select box attributes
 * - value - ID of selected role
 * - optional - Wether value is optional or not
 * - can_create_new - Can the user create new category or not, default is true
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_document_category($params, &$smarty)
{
    static $ids = array();
    $user = array_var($params, 'user', null, true);
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is expected to be a valid User object', true);
    }
    // if
    $value = array_var($params, 'value', null, true);
    $can_create_new = array_var($params, 'can_create_new', true, true);
    $id = array_var($params, 'id', null, true);
    if (empty($id)) {
        $counter = 1;
        do {
            $id = "select_document_category_dropdown_{$counter}";
            $counter++;
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    $params['id'] = $id;
    $options = array();
    $categories = DocumentCategories::findAll($user);
    if (is_foreachable($categories)) {
        foreach ($categories as $category) {
            $option_attributes = array('class' => 'object_option');
            if ($value == $category->getId()) {
                $option_attributes['selected'] = true;
            }
            // if
            $options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
        }
        // foreach
    }
    // if
    if ($can_create_new) {
        $params['add_object_url'] = assemble_url('document_categories_quick_add');
        $params['object_name'] = 'document_category';
        $params['add_object_message'] = lang('Please insert new document category name');
        $logged_user = get_logged_user();
        if (instance_of($logged_user, 'User') && DocumentCategory::canAdd($logged_user)) {
            $options[] = option_tag('', '');
            $options[] = option_tag(lang('New Category...'), '', array('class' => 'new_object_option'));
        }
        // if
    }
    // if
    return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
 /**
  * Delete document category
  *
  * @param void
  * @return void
  */
 function delete()
 {
     if ($this->active_document_category->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_document_category->canDelete($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $delete = $this->active_document_category->delete();
         if ($delete && !is_error($delete)) {
             db_commit();
             if ($this->request->isApiCall()) {
                 $this->httpOk();
             } else {
                 flash_success('Document category ":name" has been deleted', array('name' => $this->active_document_category->getName()));
                 $this->redirectTo('document_categories');
             }
             // if
         } else {
             db_rollback();
             if ($this->request->isAsyncCall()) {
                 $this->serveData($delete);
             } else {
                 flash_success('Failed to delete ":name" document category', array('name' => $this->active_document_category->getName()));
                 $this->redirectTo('document_categories');
             }
             // if
         }
         // if
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
    echo $row['name'];
    ?>
</option>
                                                        <?php 
}
?>
                                                    </select>

                                                </div>

                                            </td>
                                        </tr>
                                        <?php 
$id = Request::get("id");
if (is_numeric($id) && $id > 0) {
    $documentcategoryObj = new DocumentCategory();
    $documentcategoryObj->set("id", $id);
    $result = $documentcategoryObj->getName();
    if (count($result)) {
        $row = $result[0];
        $id = $row['id'];
        $doc_type_id = $row['doc_type_id'];
        $name = $row['name'];
        $active = $row['active'];
    }
}
?>
                                        <tr>
                                            <td><label class="control-label" for="selectError">type of Document Category</label></td>
                                            <td><div class="input-group" style="width: 50%">
                                                    <span class="input-group-addon"></span>
Ejemplo n.º 5
0
 /**
  * Exclude object from result
  *
  * @param   DocumentCategory $documentCategory Object to remove from the list of results
  *
  * @return DocumentCategoryQuery The current query, for fluid interface
  */
 public function prune($documentCategory = null)
 {
     if ($documentCategory) {
         $this->addUsingAlias(DocumentCategoryPeer::ID, $documentCategory->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Ejemplo n.º 6
0
 public function showForm()
 {
     $this->getFromDB(1);
     echo "<div class='center'>";
     echo "<form name='form' method='post' action='" . $this->getFormURL() . "'>";
     echo "<input type='hidden' name='id' value='1'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __("Plugin configuration", "order") . "</th></tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Default VAT", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderTax::Dropdown(array('name' => "default_taxes", 'value' => $this->fields["default_taxes"], 'display_emptychoice' => true, 'emptylabel' => __("No VAT", "order")));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Use validation process", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo("use_validation", $this->fields["use_validation"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Order generation in ODT", "order") . "</td><td>";
     Dropdown::showYesNo("generate_order_pdf", $this->fields["generate_order_pdf"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Activate suppliers quality satisfaction", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo("use_supplier_satisfaction", $this->fields["use_supplier_satisfaction"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Display order's suppliers informations", "order") . "</td><td>";
     Dropdown::showYesNo("use_supplier_informations", $this->fields["use_supplier_informations"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Color to be displayed when order due date is overtaken", "order") . "</td>";
     echo "<td>";
     echo "<input type='color' name='shoudbedelivered_color'\n               value='" . $this->fields['shoudbedelivered_color'] . "'>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Copy order documents when a new item is created", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo("copy_documents", $this->fields["copy_documents"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Default heading when adding a document to an order", "order") . "</td>";
     echo "<td>";
     DocumentCategory::Dropdown(array('value' => $this->fields["documentcategories_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Author group", "order") . ' (' . __("Default values") . ")</td>";
     echo "<td>";
     Group::Dropdown(array('value' => $this->fields["groups_id_author"], 'name' => 'groups_id_author'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Recipient group", "order") . ' (' . __("Default values") . ")</td>";
     echo "<td>";
     Group::Dropdown(array('value' => $this->fields["groups_id_recipient"], 'name' => 'groups_id_recipient'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Recipient") . ' (' . __("Default values") . ")</td>";
     echo "<td>";
     User::Dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'right' => 'all', 'entity' => 0));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Hide inactive budgets", 'order') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("hide_inactive_budgets", $this->fields["hide_inactive_budgets"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Transmit budget change to linked assets", 'order') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("transmit_budget_change", $this->fields["transmit_budget_change"]);
     echo "</td>";
     echo "</tr>";
     // Automatic actions
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<th colspan='2'>" . __("Automatic actions when delivery", "order") . "</th>";
     echo "</tr>";
     // ASSETS
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<th colspan='2'>" . __('Item') . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Enable automatic generation", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo("generate_assets", $this->canGenerateAsset());
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Default state", "order") . "</td>";
     echo "<td>";
     State::Dropdown(array('name' => 'default_asset_states_id', 'value' => $this->fields["default_asset_states_id"], 'entity' => $_SESSION["glpiactiveentities"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Add order location to item", "order") . "</td>";
     echo "<td>";
     Dropdown::showYesNo("add_location", $this->canAddLocation());
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Add billing details to item", "order") . "</td><td>";
     Dropdown::showYesNo("add_bill_details", $this->canAddBillDetails());
     echo "</td>";
     echo "</tr>";
     if ($this->canGenerateAsset()) {
         echo "<tr class='tab_bg_1' align='center'>";
         echo "<td>" . __("Default name", "order") . "</td>";
         echo "<td>";
         Html::autocompletionTextField($this, "generated_name");
         echo "</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1' align='center'>";
         echo "<td>" . __("Default serial number", "order") . "</td>";
         echo "<td>";
         Html::autocompletionTextField($this, "generated_serial");
         echo "</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1' align='center'>";
         echo "<td>" . __("Default inventory number", "order") . "</td>";
         echo "<td>";
         Html::autocompletionTextField($this, "generated_otherserial");
         echo "</td>";
         echo "</tr>";
         // TICKETS
         echo "<tr class='tab_bg_1' align='center'>";
         echo "<th colspan='2'>" . __("Ticket") . "</th>";
         echo "</tr>";
         echo "<tr class='tab_bg_1' align='center'>";
         echo "<td>" . TicketTemplate::getTypeName(1) . "</td>";
         echo "<td>";
         Dropdown::show('TicketTemplate', array('name' => 'tickettemplates_id_delivery', 'value' => $this->fields['tickettemplates_id_delivery']));
         echo "</td>";
         echo "</tr>";
     }
     /* Workflow */
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<th colspan='2'>" . __("Order lifecycle", "order") . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("State before validation", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_draft', 'value' => $this->fields["order_status_draft"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Waiting for validation state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_waiting_approval', 'value' => $this->fields["order_status_waiting_approval"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Validated order state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_approved', 'value' => $this->fields["order_status_approved"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Order being delivered state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_partially_delivred', 'value' => $this->fields["order_status_partially_delivred"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Order delivered state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_completly_delivered', 'value' => $this->fields["order_status_completly_delivered"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Order paied state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_paid', 'value' => $this->fields["order_status_paid"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td>" . __("Canceled order state", "order") . "</td>";
     echo "<td>";
     PluginOrderOrderState::Dropdown(array('name' => 'order_status_canceled', 'value' => $this->fields["order_status_canceled"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' align='center'>";
     echo "<td colspan='2' align='center'>";
     echo "<input type='submit' name='update' value=\"" . _sx("button", "Post") . "\" class='submit' >";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
 /**
  * Print the document form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     //       $options['formoptions'] = " enctype='multipart/form-data'";
     $this->showFormHeader($options);
     $showuserlink = 0;
     if (Session::haveRight('user', READ)) {
         $showuserlink = 1;
     }
     if ($ID > 0) {
         echo "<tr><th colspan='2'>";
         if ($this->fields["users_id"] > 0) {
             printf(__('Added by %s'), getUserName($this->fields["users_id"], $showuserlink));
         } else {
             echo "&nbsp;";
         }
         echo "</th>";
         echo "<th colspan='2'>";
         //TRANS: %s is the datetime of update
         printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
         echo "</th></tr>\n";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     if ($ID > 0) {
         echo "<td>" . __('Current file') . "</td>";
         echo "<td>" . $this->getDownloadLink('', 45);
         echo "<input type='hidden' name='current_filepath' value='" . $this->fields["filepath"] . "'>";
         echo "<input type='hidden' name='current_filename' value='" . $this->fields["filename"] . "'>";
         echo "</td>";
     } else {
         echo "<td colspan=2>&nbsp;</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Heading') . "</td>";
     echo "<td>";
     DocumentCategory::dropdown(array('value' => $this->fields["documentcategories_id"]));
     echo "</td>";
     if ($ID > 0) {
         echo "<td>" . sprintf(__('%1$s (%2$s)'), __('Checksum'), __('SHA1')) . "</td>";
         echo "<td>" . $this->fields["sha1sum"];
         echo "</td>";
     } else {
         echo "<td colspan=2>&nbsp;</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Web Link') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "link");
     echo "</td>";
     echo "<td rowspan='3' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='middle' rowspan='3'>";
     echo "<textarea cols='45' rows='6' name='comment' class='form-control' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('MIME type') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "mime");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Blacklisted for import') . "</td>";
     echo "<td>";
     Dropdown::showYesNo("is_blacklisted", $this->fields["is_blacklisted"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Use a FTP installed file') . "</td>";
     echo "<td>";
     $this->showUploadedFilesDropdown("upload_file");
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s (%2$s)'), __('File'), self::getMaxUploadSize()) . "</td>";
     echo "<td>";
     echo Html::file();
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
Ejemplo n.º 8
0
 /**
  * @since version 0.90
  *
  * @param $item
  * @param $withtemplate    (default '')
  * @param $options         array
  *
  * @return boolean
  **/
 static function showAddFormForItem(CommonDBTM $item, $withtemplate = '', $options = array())
 {
     global $DB, $CFG_GLPI;
     //default options
     $params['rand'] = mt_rand();
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $params[$key] = $val;
         }
     }
     if (!$item->can($item->fields['id'], READ)) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     // find documents already associated to the item
     $doc_item = new self();
     $used_found = $doc_item->find("`items_id` = '" . $item->getID() . "'\n                                    AND `itemtype` = '" . $item->getType() . "'");
     $used = array_keys($used_found);
     $used = array_combine($used, $used);
     if ($item->canAddItem('Document') && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             /// Case of personal items : entity = -1 : create on active entity (Reminder case))
             if ($item->getEntityID() >= 0) {
                 $entity = $item->getEntityID();
             }
             if ($item->isRecursive()) {
                 $entities = getSonsOf('glpi_entities', $entity);
             } else {
                 $entities = $entity;
             }
         }
         $limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
         $q = "SELECT COUNT(*)\n               FROM `glpi_documents`\n               WHERE `is_deleted` = '0'\n               {$limit}";
         $result = $DB->query($q);
         $nb = $DB->result($result, 0, 0);
         if ($item->getType() == 'Document') {
             $used[$item->getID()] = $item->getID();
         }
         echo "<div class='firstbloc'>";
         echo "<form name='documentitem_form" . $params['rand'] . "' id='documentitem_form" . $params['rand'] . "' method='post' action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td class='center'>";
         _e('Heading');
         echo "</td><td width='20%'>";
         DocumentCategory::dropdown(array('entity' => $entities));
         echo "</td>";
         echo "<td class='right'>";
         echo "<input type='hidden' name='entities_id' value='{$entity}'>";
         echo "<input type='hidden' name='is_recursive' value='" . $item->isRecursive() . "'>";
         echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
         echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>";
         if ($item->getType() == 'Ticket') {
             echo "<input type='hidden' name='tickets_id' value='" . $item->getID() . "'>";
         }
         echo Html::file(array('multiple' => true));
         echo "</td><td class='left'>(" . Document::getMaxUploadSize() . ")&nbsp;</td>";
         echo "<td class='center' width='20%'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n                class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         if (Document::canView() && $nb > count($used)) {
             echo "<form name='document_form" . $params['rand'] . "' id='document_form" . $params['rand'] . "' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='" . $item->getID() . "'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
 }
Ejemplo n.º 9
0
 /**
  * Paginate documents by category
  *
  * @param DocumentCategory $category
  * @param integer	$min_visibility
  * @param integer $page
  * @param integer $per_page
  * @return array
  */
 function paginateByCategory($category, $min_visibility = VISIBILITY_PRIVATE, $page = 1, $per_page = 30)
 {
     return Documents::paginate(array('conditions' => array('category_id = ? AND visibility >= ?', $category->getId(), $min_visibility), 'order' => 'is_pinned DESC, name'), $page, $per_page);
 }
Ejemplo n.º 10
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Document Category (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'parent', 'type' => 'raw', 'value' => DocumentCategory::getCategoryName($model->parent)), 'title', array('name' => 'description', 'type' => 'raw', 'value' => $model->description, 'htmlOptions' => array('style' => "text-align:left;")), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), array('name' => 'created_by', 'type' => 'raw', 'value' => $this->getUserNameByID($model->created_by)), array('name' => 'created_time', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_time)), array('name' => 'modified_by', 'type' => 'raw', 'value' => $this->getUserNameByID($model->modified_by)), array('name' => 'modified_time', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_time)))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Ejemplo n.º 11
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'document-category-form', 'enableAjaxValidation' => false));
?>
<p class="help-block">Fields with <span class="required">*</span> are required.</p>
<?php 
echo $form->errorSummary($model);
?>
<div class="row-fluid">
    <div class="span12">
        <?php 
if ($model->isNewRecord) {
    echo DocumentCategory::get_category_new('DocumentCategory', 'parent');
} else {
    echo DocumentCategory::get_category_update('DocumentCategory', 'parent', $model->parent);
}
?>
    </div>
</div>
<?php 
echo $form->textFieldControlGroup($model, 'title', array('class' => 'span5', 'maxlength' => 255));
echo $form->labelEx($model, 'description');
$this->widget('application.extensions.xheditor.JXHEditor', array('model' => $model, 'attribute' => 'description', 'htmlOptions' => array('class' => 'xheditor', 'style' => 'width: 100%; height: 150px;', 'placeholder' => 'Description')));
echo $form->dropDownListControlGroup($model, 'published', array('1' => 'Yes', '0' => 'No'), array('class' => 'span2'));
?>
<div class="form-actions">
    <?php 
echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    <?php 
echo TbHtml::resetButton('Reset', array('color' => TbHtml::BUTTON_COLOR_INFO));
Ejemplo n.º 12
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param DocumentCategory $obj A DocumentCategory object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         DocumentCategoryPeer::$instances[$key] = $obj;
     }
 }
 /**
  * Show documents associated to an item
  *
  * @since version 0.84
  *
  * @param $item            CommonDBTM object for which associated documents must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if ($item->getType() != 'Ticket' && $item->getType() != 'KnowbaseItem' && $item->getType() != 'Reminder' && !Document::canView()) {
         return false;
     }
     if (!$item->can($item->fields['id'], READ)) {
         return false;
     }
     $columns = array('name' => __('Name'), 'entity' => __('Entity'), 'filename' => __('File'), 'link' => __('Web link'), 'headings' => __('Heading'), 'mime' => __('MIME type'));
     if ($CFG_GLPI['use_rich_text']) {
         $columns['tag'] = __('Tag');
     }
     $columns['assocdate'] = __('Date');
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $linkparam = '';
     if (get_class($item) == 'Ticket') {
         $linkparam = "&amp;tickets_id=" . $item->fields['id'];
     }
     if (isset($_GET["order"]) && $_GET["order"] == "ASC") {
         $order = "ASC";
     } else {
         $order = "DESC";
     }
     if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) {
         $sort = "`" . $_GET["sort"] . "`";
     } else {
         $sort = "`assocdate`";
     }
     $canedit = $item->canAddItem('Document') && Document::canView();
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                       `glpi_documents_items`.`date_mod` AS assocdate,\n                       `glpi_entities`.`id` AS entityID,\n                       `glpi_entities`.`completename` AS entity,\n                       `glpi_documentcategories`.`completename` AS headings,\n                       `glpi_documents`.*\n                FROM `glpi_documents_items`\n                LEFT JOIN `glpi_documents`\n                          ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                LEFT JOIN `glpi_documentcategories`\n                        ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                WHERE `glpi_documents_items`.`items_id` = '{$ID}'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
     if (Session::getLoginUserID()) {
         $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $query .= " AND `glpi_documents`.`entities_id`= '0' ";
     }
     // Document : search links in both order using union
     if ($item->getType() == 'Document') {
         $query .= "UNION\n                    SELECT `glpi_documents_items`.`id` AS assocID,\n                           `glpi_documents_items`.`date_mod` AS assocdate,\n                           `glpi_entities`.`id` AS entityID,\n                           `glpi_entities`.`completename` AS entity,\n                           `glpi_documentcategories`.`completename` AS headings,\n                           `glpi_documents`.*\n                    FROM `glpi_documents_items`\n                    LEFT JOIN `glpi_documents`\n                        ON (`glpi_documents_items`.`items_id`=`glpi_documents`.`id`)\n                    LEFT JOIN `glpi_entities`\n                        ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                    LEFT JOIN `glpi_documentcategories`\n                        ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                    WHERE `glpi_documents_items`.`documents_id` = '{$ID}'\n                          AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
         if (Session::getLoginUserID()) {
             $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $query .= " AND `glpi_documents`.`entities_id`='0' ";
         }
     }
     $query .= " ORDER BY {$sort} {$order}";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $documents = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $documents[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($item->canAddItem('Document') && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             /// Case of personal items : entity = -1 : create on active entity (Reminder case))
             if ($item->getEntityID() >= 0) {
                 $entity = $item->getEntityID();
             }
             if ($item->isRecursive()) {
                 $entities = getSonsOf('glpi_entities', $entity);
             } else {
                 $entities = $entity;
             }
         }
         $limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
         $q = "SELECT COUNT(*)\n               FROM `glpi_documents`\n               WHERE `is_deleted` = '0'\n               {$limit}";
         $result = $DB->query($q);
         $nb = $DB->result($result, 0, 0);
         if ($item->getType() == 'Document') {
             $used[$ID] = $ID;
         }
         echo "<div class='firstbloc'>";
         echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n                action='" . Toolbox::getItemTypeFormURL('Document') . "' enctype=\"multipart/form-data\">";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td class='center'>";
         _e('Heading');
         echo "</td><td width='20%'>";
         DocumentCategory::dropdown(array('entity' => $entities));
         echo "</td>";
         echo "<td class='right'>";
         echo "<input type='hidden' name='entities_id' value='{$entity}'>";
         echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
         echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
         echo "<input type='hidden' name='items_id' value='{$ID}'>";
         if ($item->getType() == 'Ticket') {
             echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
         }
         echo Html::file();
         echo "</td><td class='left'>";
         echo "(" . Document::getMaxUploadSize() . ")&nbsp;";
         echo "</td>";
         echo "<td class='center' width='20%'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n                class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         if (Document::canView() && $nb > count($used)) {
             echo "<form name='document_form{$rand}' id='document_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     $sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
     echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && $number && $withtemplate < 2) {
         $header_top .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_top .= "</th>";
         $header_bottom .= "<th width='11'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= "</th>";
     }
     foreach ($columns as $key => $val) {
         $header_end .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&amp;order=" . ($order == "ASC" ? "DESC" : "ASC") . "&amp;start=0\");'>{$val}</a></th>";
     }
     $header_end .= "</tr>";
     echo $header_begin . $header_top . $header_end;
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             Session::initNavigateListItems('Document', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         }
         $document = new Document();
         foreach ($documents as $data) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 Session::addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . $data['entity'] . "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
             echo "<td class='center'>";
             if (!empty($data["link"])) {
                 echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                 echo "</a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
             echo "</td>";
             echo "<td class='center'>" . $data["mime"] . "</td>";
             if ($CFG_GLPI['use_rich_text']) {
                 echo "<td class='center'>";
                 echo !empty($data["tag"]) ? Document::getImageTag($data["tag"]) : '';
                 echo "</td>";
             }
             echo "<td class='center'>" . Html::convDateTime($data["assocdate"]) . "</td>";
             echo "</tr>";
             $i++;
         }
         echo $header_begin . $header_bottom . $header_end;
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
Ejemplo n.º 14
0
 /**
  * Filter the query by a related DocumentCategory object
  *
  * @param   DocumentCategory|PropelObjectCollection $documentCategory  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 UserQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByDocumentCategoryRelatedByUpdatedBy($documentCategory, $comparison = null)
 {
     if ($documentCategory instanceof DocumentCategory) {
         return $this->addUsingAlias(UserPeer::ID, $documentCategory->getUpdatedBy(), $comparison);
     } elseif ($documentCategory instanceof PropelObjectCollection) {
         return $this->useDocumentCategoryRelatedByUpdatedByQuery()->filterByPrimaryKeys($documentCategory->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByDocumentCategoryRelatedByUpdatedBy() only accepts arguments of type DocumentCategory or PropelCollection');
     }
 }
 static function showSubFormDocument_Item($ID, $params)
 {
     global $DB, $CFG_GLPI;
     $item = new Ticket();
     $item->getFromDB($ID);
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $linkparam = '';
     if (get_class($item) == 'Ticket') {
         $linkparam = "&amp;tickets_id=" . $item->fields['id'];
     }
     $canedit = $item->canAddItem('Document') && Document::canView();
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $order = "DESC";
     $sort = "`assocdate`";
     $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                       `glpi_documents_items`.`date_mod` AS assocdate,\n                       `glpi_entities`.`id` AS entityID,\n                       `glpi_entities`.`completename` AS entity,\n                       `glpi_documentcategories`.`completename` AS headings,\n                       `glpi_documents`.*\n                FROM `glpi_documents_items`\n                LEFT JOIN `glpi_documents`\n                          ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                LEFT JOIN `glpi_documentcategories`\n                        ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                WHERE `glpi_documents_items`.`items_id` = '{$ID}'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
     if (Session::getLoginUserID()) {
         $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $query .= " AND `glpi_documents`.`entities_id`= '0' ";
     }
     // Document : search links in both order using union
     if ($item->getType() == 'Document') {
         $query .= "UNION\n                    SELECT `glpi_documents_items`.`id` AS assocID,\n                           `glpi_documents_items`.`date_mod` AS assocdate,\n                           `glpi_entities`.`id` AS entityID,\n                           `glpi_entities`.`completename` AS entity,\n                           `glpi_documentcategories`.`completename` AS headings,\n                           `glpi_documents`.*\n                    FROM `glpi_documents_items`\n                    LEFT JOIN `glpi_documents`\n                              ON (`glpi_documents_items`.`items_id`=`glpi_documents`.`id`)\n                    LEFT JOIN `glpi_entities`\n                              ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                    LEFT JOIN `glpi_documentcategories`\n                              ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                    WHERE `glpi_documents_items`.`documents_id` = '{$ID}'\n                          AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
         if (Session::getLoginUserID()) {
             $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $query .= " AND `glpi_documents`.`entities_id`='0' ";
         }
     }
     $query .= " ORDER BY {$sort} {$order} ";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $documents = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $documents[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($item->canAddItem('Document') && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             /// Case of personal items : entity = -1 : create on active entity (Reminder case))
             if ($item->getEntityID() >= 0) {
                 $entity = $item->getEntityID();
             }
             if ($item->isRecursive()) {
                 $entities = getSonsOf('glpi_entities', $entity);
             } else {
                 $entities = $entity;
             }
         }
         $limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
         $q = "SELECT COUNT(*)\n               FROM `glpi_documents`\n               WHERE `is_deleted` = '0'\n               {$limit}";
         $result = $DB->query($q);
         $nb = $DB->result($result, 0, 0);
         if ($item->getType() == 'Document') {
             $used[$ID] = $ID;
         }
         if (!isset($params['no_form']) || $params['no_form'] == false) {
             echo "<div class='firstbloc'>";
             echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL('Document') . "'  enctype=\"multipart/form-data\">";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
         }
         echo "<tr class='tab_bg_1'>";
         if (!isset($params['no_form']) || $params['no_form'] == false) {
             echo "<td class='center'>";
             _e('Heading');
             echo "</td><td>";
             DocumentCategory::dropdown(array('entity' => $entities));
             echo "</td>";
             echo "<td class='right'>";
         } else {
             echo "<td class='center'>" . __('Add a document') . "</td>";
             echo "<td style='padding-left:50px'>";
         }
         echo "<input type='hidden' name='entities_id' value='{$entity}'>";
         echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
         echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
         echo "<input type='hidden' name='items_id' value='{$ID}'>";
         if ($item->getType() == 'Ticket') {
             echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
         }
         echo Html::file();
         echo "</td><td class='left'>";
         echo "(" . Document::getMaxUploadSize() . ")&nbsp;";
         echo "</td>";
         if (!isset($params['no_form']) || $params['no_form'] == false) {
             echo "<td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n                   class='submit'></td>";
         }
         echo "</tr>";
         if (!isset($params['no_form']) || $params['no_form'] == false) {
             echo "</table>";
             Html::closeForm();
         }
         if (Session::haveRight('document', READ) && $nb > count($used) && (!isset($params['no_form']) || $params['no_form'] == false)) {
             echo "<form name='document_form{$rand}' id='document_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL('Document') . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td>";
             echo "<td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
 }
                        <i class="glyphicon glyphicon-edit icon-white"></i>
                        Add Data
                    </a><br/><br/>
                    <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                        <thead>
                            <tr>
                                <th>Id</th>
                                <th>Type Document Name </th>
                                <th> Category Name</th>
                                <th>Status</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
$documentcategorytObj = new DocumentCategory();
$rows = $documentcategorytObj->getAll();
foreach ($rows as $row) {
    ?>
  

                                <tr>
                                    <td><?php 
    echo $row['id'];
    ?>
</td>
                                    <td class="center"><?php 
    echo $row['DocumentType_name'];
    ?>
</td>
                                    <td><?php 
Ejemplo n.º 17
0
 /**
  * Filter the query by a related DocumentCategory object
  *
  * @param   DocumentCategory|PropelObjectCollection $documentCategory The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 DocumentQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByDocumentCategory($documentCategory, $comparison = null)
 {
     if ($documentCategory instanceof DocumentCategory) {
         return $this->addUsingAlias(DocumentPeer::DOCUMENT_CATEGORY_ID, $documentCategory->getId(), $comparison);
     } elseif ($documentCategory instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(DocumentPeer::DOCUMENT_CATEGORY_ID, $documentCategory->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByDocumentCategory() only accepts arguments of type DocumentCategory or PropelCollection');
     }
 }
Ejemplo n.º 18
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
echo $form->dropDownListControlGroup($model, 'parent', CHtml::listData(DocumentCategory::model()->findAll(array('condition' => 'parent=0', "order" => "title")), 'id', 'title'), array('empty' => '--please select--', 'class' => 'span5'));
echo $form->textFieldControlGroup($model, 'title', array('class' => 'span5', 'maxlength' => 255));
echo $form->dropDownListControlGroup($model, 'published', array('' => 'All', '1' => 'Yes', '0' => 'No'), array('class' => 'span5'));
echo $form->dropDownListControlGroup($model, 'created_by', CHtml::listData(UserAdmin::model()->findAll(array('select' => 'id, name', 'condition' => '', "order" => "name")), 'id', 'name'), array('empty' => '--please select--', 'class' => 'span5'));
?>
<div class="form-actions">
    <?php 
echo TbHtml::submitButton('Search', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    <?php 
echo TbHtml::resetButton('Reset', array('color' => TbHtml::BUTTON_COLOR_INFO));
?>
</div>
<?php 
$this->endWidget();
            <?php 
include 'sitebar.php';
?>
            <div class="col-sm-9 padding-right">
                <div class="category-tab" ><!--category-tab-->
                    
                    <div class="tab-content">
                        <form id="form_background" action="#" method="POST" enctype="multipart/form-data">
                            <table height="680" align="center" width="80%">
                                <tr>  
                                    <td id="label">Choose the document types</td>
                                    <td >
                                        <select id="text" name="doc_type_id">
                                            <option  value="">Types of document</option>
                                            <?php 
$documentcategoeyObj = new DocumentCategory();
$rows = $documentcategoeyObj->getAll();
foreach ($rows as $row) {
    ?>
                                              <option value="<?php 
    echo $row['id'];
    ?>
"><?php 
    echo $row['name'];
    ?>
 </option>
                                              <?php 
}
?>
                                        </select>
                                    </td>   
Ejemplo n.º 20
0
 /**
  * Show documents associated to an item
  *
  * @since version 0.84
  *
  * @param $item            CommonDBTM object for which associated documents must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if ($item->getType() != 'Ticket' && $item->getType() != 'KnowbaseItem' && !Session::haveRight('document', 'r')) {
         return false;
     }
     if (!$item->can($item->fields['id'], 'r')) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $linkparam = '';
     if (get_class($item) == 'Ticket') {
         $linkparam = "&amp;tickets_id=" . $item->fields['id'];
     }
     $canedit = $item->canadditem('Document');
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                       `glpi_entities`.`id` AS entity,\n                       `glpi_documents`.`name` AS assocName,\n                       `glpi_documents`.*\n                FROM `glpi_documents_items`\n                LEFT JOIN `glpi_documents`\n                          ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                WHERE `glpi_documents_items`.`items_id` = '{$ID}'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
     if (Session::getLoginUserID()) {
         $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $query .= " AND `glpi_documents`.`entities_id`= '0' ";
     }
     // Document : search links in both order using union
     if ($item->getType() == 'Document') {
         $query .= "UNION\n                    SELECT `glpi_documents_items`.`id` AS assocID,\n                           `glpi_entities`.`id` AS entity,\n                           `glpi_documents`.`name` AS assocName,\n                           `glpi_documents`.*\n                    FROM `glpi_documents_items`\n                    LEFT JOIN `glpi_documents`\n                              ON (`glpi_documents_items`.`items_id`=`glpi_documents`.`id`)\n                    LEFT JOIN `glpi_entities`\n                              ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                    WHERE `glpi_documents_items`.`documents_id` = '{$ID}'\n                          AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "' ";
         if (Session::getLoginUserID()) {
             $query .= getEntitiesRestrictRequest(" AND", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $query .= " AND `glpi_documents`.`entities_id`='0' ";
         }
     }
     $query .= " ORDER BY `assocName`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $documents = array();
     $used = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $documents[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($canedit && $withtemplate < 2) {
         // Restrict entity for knowbase
         $entities = "";
         $entity = $_SESSION["glpiactive_entity"];
         if ($item->isEntityAssign()) {
             /// Case of personal items : entity = -1 : create on active entity (Reminder case))
             if ($item->getEntityID() >= 0) {
                 $entity = $item->getEntityID();
             }
             if ($item->isRecursive()) {
                 $entities = getSonsOf('glpi_entities', $entity);
             } else {
                 $entities = $entity;
             }
         }
         $limit = getEntitiesRestrictRequest(" AND ", "glpi_documents", '', $entities, true);
         $q = "SELECT COUNT(*)\n               FROM `glpi_documents`\n               WHERE `is_deleted` = '0'\n               {$limit}";
         $result = $DB->query($q);
         $nb = $DB->result($result, 0, 0);
         if ($item->getType() == 'Document') {
             $used[$ID] = $ID;
         }
         echo "<div class='firstbloc'>";
         echo "<form name='documentitem_form{$rand}' id='documentitem_form{$rand}' method='post'\n                action='" . Toolbox::getItemTypeFormURL('Document') . "'  enctype=\"multipart/form-data\">";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='5'>" . __('Add a document') . "</th></tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td class='center'>";
         _e('Heading');
         echo '</td><td>';
         DocumentCategory::dropdown(array('entity' => $entities));
         echo "</td>";
         echo "<td class='right'>";
         echo "<input type='hidden' name='entities_id' value='{$entity}'>";
         echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
         echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
         echo "<input type='hidden' name='items_id' value='{$ID}'>";
         if ($item->getType() == 'Ticket') {
             echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
         }
         echo "<input type='file' name='filename' size='25'>";
         echo "</td><td class='left'>";
         echo "(" . Document::getMaxUploadSize() . ")&nbsp;";
         echo "</td>";
         echo "<td class='center' width='20%'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add a new file') . "\"\n                class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         if (Session::haveRight('document', 'r') && $nb > count($used)) {
             echo "<form name='document_form{$rand}' id='document_form{$rand}' method='post'\n                   action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'>";
             echo "<td colspan='4' class='center'>";
             echo "<input type='hidden' name='entities_id' value='{$entity}'>";
             echo "<input type='hidden' name='is_recursive' value='{$is_recursive}'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             if ($item->getType() == 'Ticket') {
                 echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
                 echo "<input type='hidden' name='documentcategories_id' value='" . $CFG_GLPI["documentcategories_id_forticket"] . "'>";
             }
             Document::dropdown(array('entity' => $entities, 'used' => $used));
             echo "</td><td class='center' width='20%'>";
             echo "<input type='submit' name='add' value=\"" . _sx('button', 'Associate an existing document') . "\" class='submit'>";
             echo "</td>";
             echo "</tr>";
             echo "</table>";
             Html::closeForm();
         }
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number);
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     if ($canedit && $number && $withtemplate < 2) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Entity') . "</th>";
     echo "<th>" . __('File') . "</th>";
     echo "<th>" . __('Web link') . "</th>";
     echo "<th>" . __('Heading') . "</th>";
     echo "<th>" . __('MIME type') . "</th>";
     echo "</tr>";
     $used = array();
     if ($number) {
         // Don't use this for document associated to document
         // To not loose navigation list for current document
         if ($item->getType() != 'Document') {
             Session::initNavigateListItems('Document', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         }
         $document = new Document();
         foreach ($documents as $data) {
             $docID = $data["id"];
             $link = NOT_AVAILABLE;
             $downloadlink = NOT_AVAILABLE;
             if ($document->getFromDB($docID)) {
                 $link = $document->getLink();
                 $downloadlink = $document->getDownloadLink($linkparam);
             }
             if ($item->getType() != 'Document') {
                 Session::addToNavigateListItems('Document', $docID);
             }
             $used[$docID] = $docID;
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit && $withtemplate < 2) {
                 echo "<td width='10'>";
                 Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
                 echo "</td>";
             }
             echo "<td class='center'>{$link}</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entity']);
             echo "</td>";
             echo "<td class='center'>{$downloadlink}</td>";
             echo "<td class='center'>";
             if (!empty($data["link"])) {
                 echo "<a target=_blank href='" . formatOutputWebLink($data["link"]) . "'>" . $data["link"];
                 echo "</a>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"]);
             echo "</td>";
             echo "<td class='center'>" . $data["mime"] . "</td>";
             echo "</tr>";
             $i++;
         }
     }
     echo "</table>";
     if ($canedit && $number && $withtemplate < 2) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = DocumentCategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 22
0
        <h5>Manage Document Categories</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-search"></i>', '#', array('class' => 'search-button', 'data-rel' => 'tooltip', 'title' => 'Search', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <div class="search-form" style="display:none">
                <?php 
$this->renderPartial('_search', array('model' => $model));
?>
            </div><!-- search-form -->
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'document-category-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'parent', 'type' => 'raw', 'value' => 'DocumentCategory::getCategoryName($data->parent)', 'filter' => DocumentCategory::get_category_new('DocumentCategory', 'parent'), 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Document Category')), array('name' => 'title', 'type' => 'raw', 'value' => '$data->title', 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Title')), array('name' => 'published', 'value' => '$data->published?Yii::t(\'app\',\'Yes\'):Yii::t(\'app\', \'No\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')), 'htmlOptions' => array('style' => "text-align:center; width:100px;")), array('header' => 'Actions', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Ejemplo n.º 23
0
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-search"></i>', '#', array('class' => 'search-button', 'data-rel' => 'tooltip', 'title' => 'Search', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <div class="search-form" style="display:none">
                <?php 
$this->renderPartial('_search', array('model' => $model));
?>
            </div><!-- search-form -->
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'document-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'catid', 'type' => 'raw', 'value' => 'DocumentCategory::getCategoryName($data->catid)', 'filter' => DocumentCategory::get_category_new('Document', 'catid'), 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Document Category')), array('name' => 'title', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->title),array("document/download","id"=>$data->id))'), 'doc_type', array('name' => 'doc_size', 'header' => "Size", 'value' => 'Document::byteToMbyte($data->doc_size)'), array('name' => 'published', 'value' => '$data->published?Yii::t(\'app\',\'Yes\'):Yii::t(\'app\', \'No\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')), 'htmlOptions' => array('style' => "text-align:center;")), array('header' => 'Actions', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
Ejemplo n.º 24
0
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'document-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php 
echo $form->errorSummary($model);
?>
<div class="row-fluid">
    <div class="span12">
        <?php 
if ($model->isNewRecord) {
    echo DocumentCategory::get_category_new('Document', 'catid');
} else {
    echo DocumentCategory::get_category_update('Document', 'catid', $model->catid);
}
?>
    </div>
</div>
<?php 
echo $form->textFieldControlGroup($model, 'title', array('class' => 'span5', 'maxlength' => 255));
?>
<div class="row-fluid">
    <div class="span5">
        <?php 
echo $form->fileFieldControlGroup($model, 'doc_file', array('maxlength' => 255, 'class' => 'span12'));
?>
    </div>
</div>
<?php 
Ejemplo n.º 25
0
/** Generate bigdump : generate global dropdowns
**/
function generateGlobalDropdowns() {
   global $MAX, $DB;

   $items = array("CD", "CD-RW", "DVD-R", "DVD+R", "DVD-RW", "DVD+RW", "ramette papier",
                  "disk'ette", "ZIP");

   $dp = new ConsumableItemType();
   for ($i=0 ; $i<$MAX['consumable_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d' consommable $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("phone d'power");
   $dp    = new PhonePowerSupply();
   for ($i=0 ; $i<$MAX['phone_power'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "power ' $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Grand", "Moyen", "Mic'ro", "1U", "5U");
   $dp    = new DeviceCaseType();
   for ($i=0 ; $i<$MAX['case_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "power ' $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Laser", "Jet d'Encre", "Encre Solide");
   $dp    = new CartridgeItemType();
   for ($i=0 ; $i<$MAX['cartridge_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d' cartouche $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Technicien", "Commercial", "Technico-Commercial", "President", "Secretaire",
                  "Directeur d'agence");
   $dp    = new ContactType();
   for ($i=0 ; $i<$MAX['contact_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d' contact $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }

   $items = array("Maintenance", "Support", "Location", "Adhesion");
   $dp    = new ContractType();
   for ($i=0 ; $i<$MAX['contract_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d' crontact $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Fournisseur", "Transporteur", "SSII", "Revendeur d'", "Assembleur", "SSLL",
                  "Financeur", "Assureur");
   $dp    = new SupplierType();
   for ($i=0 ; $i<$MAX['enttype'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d'entreprise $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("H.07.02", "I.07.56", "P51", "P52", "1.60", "4.06", "43-4071299", "1.0.14",
                  "3.0.1", "rev 1.0", "rev 1.1", "rev 1.2", "rev 1.2.1", "rev 2.0", "rev 3.0");
   $dp    = new NetworkEquipmentFirmware();
   for ($i=0 ; $i<$MAX['firmware'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "firmware  $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Fire'wire");
   $dp    = new InterfaceType();
   for ($i=0 ; $i<$MAX['interface'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d' disque dur $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("100 Base TX", "100 Base T4", "10 base T", "1000 Base SX", "1000 Base LX",
                  "1000 Base T", "ATM", "802.3 10 Base 2", "IEEE 803.3 10 Base 5");
   $dp    = new NetworkInterface();
   for ($i=0 ; $i<$MAX['iface'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type carte reseau $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Non", "Oui - generique", "Oui - specifique d'entite");
   $dp    = new AutoUpdateSystem();
   for ($i=0 ; $i<$MAX['auto_update'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type de mise a jour '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Assemble", "Latitude C600", "Latitude C700", "VAIO FX601", "VAIO FX905P",
                  "VAIO TR5MP", "L5000C", "A600K", "PowerBook G4");
   $dp    = new ComputerModel();
   for ($i=0 ; $i<$MAX['model'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "Modele $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment' $val")));
   }


   $items = array("4200 DTN", "4200 DN", "4200 N", "8400 ADP", "7300 ADP", "5550 DN",
                  "PIXMA iP8500", "Stylus Color 3000", "DeskJet 5950");
   $dp    = new PrinterModel();
   for ($i=0 ; $i<$MAX['model_printers'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "modele imprimante $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("LS902UTG", "MA203DT", "P97F+SB", "G220F", "10-30-75", "PLE438S-B0S",
                  "PLE481S-W", "L1740BQ", "L1920P", "SDM-X73H");
   $dp    = new MonitorModel();
   for ($i=0 ; $i<$MAX['model_monitors'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "modele moniteur $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("HP 4108GL", "HP 2524", "HP 5308", "7600", "Catalyst 4500", "Catalyst 2950",
                  "Catalyst 3750", "Catalyst 6500");
   $dp    = new NetworkEquipmentModel();
   for ($i=0 ; $i<$MAX['model_networking'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "modele materiel reseau $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("DCS-2100+", "DCS-2100G", "KD-P35B", "Optical 5000", "Cordless", "ASR 600",
                  "ASR 375", "CS21", "MX5020", "VS4121", "T3030", "T6060");
   $dp    = new PeripheralModel();
   for ($i=0 ; $i<$MAX['model_peripherals'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "modele peripherique $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Alcatel Temporis 22", "Aastra 5370ip", "Alcatel-Lucent 400 DECT Handset",
                  "BlackBerry Curve 9300");
   $dp    = new PhoneModel();
   for ($i=0 ; $i<$MAX['model_phones'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "modele phone $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment' $val")));
   }


   $items = array("SIC", "LMS", "LMP", "LEA", "SP2MI", "STIC", "MATH", "ENS-MECA", "POUBELLE",
                  "WIFI");
   $dp    = new Network();
   for ($i=0 ; $i<$MAX['network'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "reseau $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Windows XP Pro SP2", "Linux (Debian)", "Mac OS X", "Linux (Mandriva 2006)",
                  "Linux (Redhat)", "Windows 98", "Windows 2000", "Windows XP Pro SP1",
                  "LINUX (Suse)", "Linux (Mandriva 10.2)");
   $dp    = new OperatingSystem();
   for ($i=0 ; $i<$MAX['os'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "os $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("XP Pro", "XP Home", "10.0", "10.1", "10.2", "2006", "Sarge");
   $dp    = new operatingSystemVersion();
   for ($i=0 ; $i<$MAX['os_version'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "osversion $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Service Pack 1", "Service Pack 2", "Service Pack 3", "Service Pack 4");
   $dp    = new OperatingSystemServicePack();
   for ($i=0 ; $i<$MAX['os_sp'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "ossp $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("DDR2");
   $dp    = new DeviceMemoryType();
   for ($i=0 ; $i<$MAX['ram_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type de ram $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment' $val")));
   }

   $items = array('Bureautique', 'Calcul', "logiciel d'antivirus", 'Multimédia');
   $dp    = new SoftwareCategory();
   for ($i=0 ; $i<max(1,pow($MAX['softwarecategory'],1/2)) ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "category $i";
      }
      $newID = $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                                       'comment' => "comment $val")));

      for ($j=0 ; $j<mt_rand(0,pow($MAX['softwarecategory'],1/2)) ; $j++) {
         $newID2 = $dp->add(toolbox::addslashes_deep(array('name'    => "s-category '$j",
                                                           'comment' => "comment d' $val s-category $j",
                                                           'softwarecategories_id'
                                                                     => $newID)));
      }
   }
   $MAX['rubdocs'] = getMaxItem('glpi_softwarecategories');

   $dp = new SoftwareLicenseType();
   for ($i=0 ; $i<$MAX['licensetype'] ; $i++) {
      $val = "type ' $i";
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("SIC", "LMS", "LMP", "LEA", "SP2MI", "STIC", "MATH", "ENS-MECA", "POUBELLE",
                  "WIFI");
   $dp    = new Vlan();
   for ($i=0 ; $i<$MAX['vlan'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "VLAN $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val",
                                              'tag'     => $i)));
   }


   $items = array("Portable", "Desktop", "Tour");
   $dp    = new ComputerType();
   for ($i=0 ; $i<$MAX['type_computers'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type ordinateur $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Laser A4", "Jet d'Encre", "Laser A3", "Encre Solide A4", "Encre Solide A3");
   $dp    = new PrinterType();
   for ($i=0 ; $i<$MAX['type_printers'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type d'imprimante $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("TFT 17", "TFT 19", "TFT 21", "CRT 17", "CRT 19", "CRT 21", "CRT 15");
   $dp    = new MonitorType();
   for ($i=0 ; $i<$MAX['type_monitors'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type ecran $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Switch", "Routeur", "Hub", "Borne Wifi", "borne d'accueil");
   $dp    = new NetworkEquipmentType();
   for ($i=0 ; $i<$MAX['type_networking'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type de materiel reseau '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Clavier", "Souris", "Webcam", "Enceintes", "Scanner", "Clef USB", "d'autres");
   $dp    = new PeripheralType();
   for ($i=0 ; $i<$MAX['type_peripherals'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type de peripheriques '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Analogique", "IP", );
   $dp    = new PhoneType();
   for ($i=0 ; $i<$MAX['type_phones'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "type de phone $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("DELL", "HP", "IIYAMA", "CANON", "EPSON", "LEXMARK", "ASUS", "MSI");
   $dp    = new Manufacturer();
   for ($i=0 ; $i<$MAX['manufacturer'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "manufacturer $i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment '$val")));
   }


   $items = array("Ingénieur", "Stagiaire", "Secrétaire", "ouvrier d'atelier");
   $dp    = new UserCategory();
   for ($i=0 ; $i<$MAX['user_type'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "user type d'$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }


   $items = array("Président", "Agent Comptable", "Directeur d'agence");
   $dp    = new UserTitle();
   for ($i=0 ; $i<$MAX['user_title'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "user type '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                              'comment' => "comment $val")));
   }

   $items = array("Documentation", "Facture", "Bon Livraison", "Bon commande", "Capture d'Ecran",
                  "Dossier Technique");
   $dp    = new DocumentCategory();
   for ($i=0 ; $i<max(1,pow($MAX['rubdocs'],1/2)) ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "category $i";
      }
      $newID = $dp->add(toolbox::addslashes_deep(array('name'    => $val,
                                                       'comment' => "comment $val")));

      for ($j=0 ; $j<mt_rand(0,pow($MAX['rubdocs'],1/2)) ; $j++) {
         $newID2 = $dp->add(toolbox::addslashes_deep(
                            array('name'                        => "s-category '$j",
                                  'comment'                     => "comment d' $val s-category $j",
                                  'documentcategories_id'       => $newID)));
      }
   }
   $MAX['rubdocs'] = getMaxItem('glpi_documentcategories');

   $dp = new ItilCategory();
   // GLobal ticket categories : also specific ones by entity
   for ($i=0 ; $i<max(1,pow($MAX['tracking_category'],1/3)) ; $i++) {
      $newID = $dp->add(toolbox::addslashes_deep(
                        array('name'                        => "category '$i",
                              'comment'                     => "comment ' category $i",
                              'is_recursive'                => 1,
                              'tickettemplates_id_incident' => 1,
                              'tickettemplates_id_demand'   => 1)));

      for ($j=0 ; $j<mt_rand(0,pow($MAX['tracking_category'],1/2)) ; $j++) {
         $newID2 = $dp->add(toolbox::addslashes_deep(
                            array('name'                        => "s-category '$j",
                                  'comment'                     => "comment 'category $i s-category $j",
                                  'is_recursive'                => 1,
                                  'tickettemplates_id_incident' => 1,
                                  'tickettemplates_id_demand'   => 1,
                                  'itilcategories_id'           => $newID)));

         for ($k=0 ; $k<mt_rand(0,pow($MAX['tracking_category'],1/2)) ; $k++) {
            $newID3 = $dp->add(toolbox::addslashes_deep(
                               array('name'                        => "ss-category' $k",
                                     'comment'      => "comment ' category $i s-category $j ss-category $k",
                                     'is_recursive'                => 1,
                                     'tickettemplates_id_incident' => 1,
                                     'tickettemplates_id_demand'   => 1,
                                     'itilcategories_id'           => $newID2)));
         }
      }
   }

   $query = "OPTIMIZE TABLE `glpi_itilcategories`";
   $DB->query($query) or die("PB REQUETE ".$query);

   regenerateTreeCompleteName("glpi_itilcategories");

   $MAX['tracking_category'] = getMaxItem('glpi_itilcategories');

   // DEVICE
   $items = array("Textorm 6A19", "ARIA", "SLK3000B-EU", "Sonata II", "TA-212", "TA-551", "TA-581",
                  "TAC-T01", "CS-512", "Li PC-60891", "STT-TJ02S");
   $dp    = new DeviceCase();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "case $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment '$val",
                     'devicecasetypes_id' => mt_rand(0,$MAX["case_type"]),
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']))));
   }


   $items = array("Escalade 8006-2LP", "Escalade 8506-4LP", "2810SA", "1210SA", "DuoConnect",
                  "DU-420", "DUB-A2", "FastTrak SX4100B", "DC-395U", "TFU-H33PI");
   $dp    = new DeviceControl();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "control $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment ' $val",
                     'interfacetypes_id'  => mt_rand(0,$MAX["interface"]),
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']))));
   }


   $items = array("DUW1616", "DRW-1608P", "DW1625", "GSA-4160B", "GSA-4165B", "GSA-4167RBB",
                  "SHW-16H5S", "SOHW-1673SX", "DVR-110D", "PX-716AL", "PX-755A");
   $dp    = new DeviceDrive();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "drive $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment '$val",
                     'is_writer'          => mt_rand(0,1),
                     'speed'              => mt_rand(0,60),
                     'interfacetypes_id'  => mt_rand(0,$MAX["interface"]),
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']))));
   }


   $items = array("A9250/TD", "AX550/TD", "Extreme N5900", "V9520-X/TD", "All-In-Wonder X800 GT",
                  "GV-NX66256D", "GV-RX80256DE", "Excalibur 9600XT", "X1300 IceQ",
                  "WinFast PX6200 TD", "Millenium 750","NX6600GT");
   $dp    = new DeviceGraphicCard();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "gfxcard $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment ' $val",
                     'interfacetypes_id'  => mt_rand(0,$MAX["interface"]),
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'memory_default'     => 256*mt_rand(0,8))));
   }


   $items = array("Deskstar 7K500", "Deskstar T7K250", "Atlas 15K II", "DiamondMax Plus",
                  "SpinPoint P - SP2514N", "Barracuda 7200.9", "WD2500JS", "WD1600JB", "WD1200JD");
   $dp    = new DeviceHardDrive();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "hdd  $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment' $val",
                     'interfacetypes_id'  => mt_rand(0,$MAX["interface"]),
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'capacity_default'   => mt_rand(0,300),
                     'rpm'                => mt_rand(0,15000),
                     'cache'              => 51200*mt_rand(0,10))));
   }


   $items = array("DFE-530TX", "DFE-538TX", "PWLA8492MF", "PWLA8492MT", "USBVPN1", "GA311", "FA511",
                  "TEG-PCBUSR", "3C996-SX", "3C996B-T", "3C905C-TX-M");
   $dp    = new DeviceNetworkCard();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "iface  $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment' $val",
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'bandwidth'          => mt_rand(0,1000))));
   }


   $items = array("AW8-MAX", "NV8", "AK86-L", "P4V88", "A8N-SLI", "A8N-VM", "K8V-MX", "K8N4-E",
                  "P5LD2", "GA-K8NE", "GA-8I945P Pro", "D945PBLL", "SE7525GP2", "865PE Neo3-F",
                  "K8N Neo4-F", "Thunder i7520 (S5360G2NR)", "Thunder K8SR - S2881UG2NR",
                  "Tiger K8QS Pro - S4882UG2NR", "Tomcat i875PF (S5105G2NR)");
   $dp    = new DeviceMotherBoard();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "moboard $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment' $val",
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'chipset'            => 'chipset '.mt_rand(0,1000))));
   }


   $items = array("Instant TV Cardbus", "WinTV Express", "WinTV-NOVA-S-Plus", "WinTV-NOVA-T",
                  "WinTV-PVR-150");
   $dp    = new DevicePci();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "pci $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment '$val",
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']))));
   }


   $items = array("DB-Killer PW335", "DB-Killer PW385", "NeoHE 380", "NeoHE 450", "Phantom 500-PEC",
                  "TruePower 2.0 550", "Master RS-380", "EG375AX-VE-G-SFMA", "EG495AX");
   $dp    = new DevicePowerSupply();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "power $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment '$val",
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'power'              => mt_rand(0,500).'W',
                     'is_atx'             => mt_rand(0,1))));
   }


   $items = array("Athlon 64 FX-57", "Athlon 64 FX-55", "Sempron 2400+", "Sempron 2600+",
                  "Celeron D 325", "Celeron D 330J", "Pentium 4 530J", "Pentium 4 631",
                  "Pentium D 830", "Pentium D 920");
   $dp    = new DeviceProcessor();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "processor $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'        => $val,
                     'is_recursive'       => 1,
                     'comment'            => "comment' $val",
                     'manufacturers_id'   => mt_rand(1,$MAX['manufacturer']),
                     'frequence'          => mt_rand(1000,3000),
                     'frequency_default'  => 1000+200*mt_rand(0,10),
                     'nbcores_default'    => mt_rand(1,8),
                     'nbthreads_default'  => mt_rand(1,4),
                     )));
   }


   $items = array("CM2X256A-5400C4", "CMX1024-3200C2", "CMXP512-3200XL", "TWIN2X1024-4300C3PRO",
                  "KTD-DM8400/1G", "KTH8348/1G", "KTD4400/256", "D6464D30A", "KTA-G5400/512",
                  "KVR667D2N5/1G", "KVR133X64C3/256");
   $dp    = new DeviceMemory();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "ram $i";
      }
      $dp->add(toolbox::addslashes_deep(
               array('designation'          => $val,
                     'is_recursive'         => 1,
                     'comment'              => "comment' $val",
                     'manufacturers_id'     => mt_rand(1,$MAX['manufacturer']),
                     'frequence'            => 100*mt_rand(0,10),
                     'size_default'         => 1024*mt_rand(0,6),
                     'devicememorytypes_id' => mt_rand(1,$MAX['ram_type']))));
   }


   $items = array("DDTS-100", "Audigy 2 ZS Platinum", "Audigy SE", "DJ Console Mk2",
                  "Gamesurround Muse Pocket USB", "Phase 22", "X-Fi Platinum", "Live! 24-bit",
                  "X-Fi Elite Pro");
   $dp    = new DeviceSoundCard();
   for ($i=0 ; $i<$MAX['device'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "sndcard $i";
      }
       $dp->add(toolbox::addslashes_deep(
                array('designation'         => $val,
                     'is_recursive'         => 1,
                     'comment'              => "comment '$val",
                     'manufacturers_id'     => mt_rand(1,$MAX['manufacturer']),
                     'type'                 => 'type '.mt_rand(0,100))));
   }

} // Fin generation global dropdowns
Ejemplo n.º 26
0
/images/folder.jpg" name="" rel="" height="30px" width="30px"/>
                                            <a href=""><?php 
    echo $row["name"];
    ?>
 </a>
                                        </td>
                                        <?php 
}
?>
                                    </tr>                              
                            </table> 
                            <table class="documenttbl">
                                <tr class="documentshow"><td>&nbsp;&nbsp;&nbsp;&nbsp;Judgements</td></tr>
                                    <tr class="trboder">
                                          <?php 
$documentcategoeyObj = new DocumentCategory();
$result = $documentcategoeyObj->getJudgements();
foreach ($result as $row) {
    ?>
                                <tr class="trboder">
                                    <td><img src="<?php 
    echo SERVER_URL;
    ?>
/images/folder.jpg" name="" rel="" height="30px" width="30px"/>
                                            <a href=""><?php 
    echo $row["name"];
    ?>
 </a>
                                        </td>
                                        <?php 
}
 /**
  * Print the config form for connections
  *
  * @return Nothing (display)
  **/
 function showFormHelpdesk()
 {
     global $DB, $CFG_GLPI;
     if (!self::canView()) {
         return false;
     }
     $canedit = Config::canUpdate();
     if ($canedit) {
         echo "<form name='form' action=\"" . Toolbox::getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     }
     echo "<div class='center spaced' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __('Assistance') . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td width='30%'>" . __('Step for the hours (minutes)') . "</td>";
     echo "<td width='20%'>";
     Dropdown::showNumber('time_step', array('value' => $CFG_GLPI["time_step"], 'min' => 30, 'max' => 60, 'step' => 30, 'toadd' => array(1 => 1, 5 => 5, 10 => 10, 15 => 15, 20 => 20)));
     echo "</td>";
     echo "<td width='30%'>" . __('Limit of the schedules for planning') . "</td>";
     echo "<td width='20%'>";
     Dropdown::showHours('planning_begin', array('value' => $CFG_GLPI["planning_begin"]));
     echo "&nbsp;->&nbsp;";
     Dropdown::showHours('planning_end', array('value' => $CFG_GLPI["planning_end"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Default file size limit imported by the mails receiver') . "</td><td>";
     MailCollector::showMaxFilesize('default_mailcollector_filesize_max', $CFG_GLPI["default_mailcollector_filesize_max"]);
     echo "</td>";
     echo "<td>" . __('Use rich text for helpdesk') . "</td><td>";
     $id = 'alert' . mt_rand();
     $param['on_change'] = '$("#' . $id . '").html("");
         if ($(this).val() == 0) {
            $("#' . $id . '").html("<br>' . __('You will lose the formatting of your data') . '");
         }';
     Dropdown::showYesNo("use_rich_text", $CFG_GLPI["use_rich_text"], -1, $param);
     echo "<span class='red' id='" . $id . "'></span>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Default heading when adding a document to a ticket') . "</td><td>";
     DocumentCategory::dropdown(array('value' => $CFG_GLPI["documentcategories_id_forticket"], 'name' => "documentcategories_id_forticket"));
     echo "</td>";
     echo "<td>" . __('By default, a software may be linked to a ticket') . "</td><td>";
     Dropdown::showYesNo("default_software_helpdesk_visible", $CFG_GLPI["default_software_helpdesk_visible"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Keep tickets when purging hardware in the inventory') . "</td><td>";
     Dropdown::showYesNo("keep_tickets_on_delete", $CFG_GLPI["keep_tickets_on_delete"]);
     echo "</td><td>" . __('Show personnal information in new ticket form (simplified interface)');
     echo "</td><td>";
     Dropdown::showYesNo('use_check_pref', $CFG_GLPI['use_check_pref']);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . __('Allow anonymous ticket creation (helpdesk.receiver)') . "</td><td>";
     Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]);
     echo "</td><td>" . __('Allow anonymous followups (receiver)') . "</td><td>";
     Dropdown::showYesNo("use_anonymous_followups", $CFG_GLPI["use_anonymous_followups"]);
     echo "</td></tr>";
     echo "</table>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='7'>" . __('Matrix of calculus for priority');
     echo "<input type='hidden' name='_matrix' value='1'></th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td class='b right' colspan='2'>" . __('Impact') . "</td>";
     for ($impact = 5; $impact >= 1; $impact--) {
         echo "<td class='center'>" . Ticket::getImpactName($impact) . '<br>';
         if ($impact == 3) {
             $isimpact[3] = 1;
             echo "<input type='hidden' name='_impact_3' value='1'>";
         } else {
             $isimpact[$impact] = ($CFG_GLPI['impact_mask'] & 1 << $impact) > 0;
             Dropdown::showYesNo("_impact_{$impact}", $isimpact[$impact]);
         }
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='b' colspan='2'>" . __('Urgency') . "</td>";
     for ($impact = 5; $impact >= 1; $impact--) {
         echo "<td>&nbsp;</td>";
     }
     echo "</tr>";
     for ($urgency = 5; $urgency >= 1; $urgency--) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . Ticket::getUrgencyName($urgency) . "&nbsp;</td>";
         echo "<td>";
         if ($urgency == 3) {
             $isurgency[3] = 1;
             echo "<input type='hidden' name='_urgency_3' value='1'>";
         } else {
             $isurgency[$urgency] = ($CFG_GLPI['urgency_mask'] & 1 << $urgency) > 0;
             Dropdown::showYesNo("_urgency_{$urgency}", $isurgency[$urgency]);
         }
         echo "</td>";
         for ($impact = 5; $impact >= 1; $impact--) {
             $pri = round(($urgency + $impact) / 2);
             if (isset($CFG_GLPI['priority_matrix'][$urgency][$impact])) {
                 $pri = $CFG_GLPI['priority_matrix'][$urgency][$impact];
             }
             if ($isurgency[$urgency] && $isimpact[$impact]) {
                 $bgcolor = $_SESSION["glpipriority_{$pri}"];
                 echo "<td class='center' bgcolor='{$bgcolor}'>";
                 Ticket::dropdownPriority(array('value' => $pri, 'name' => "_matrix_{$urgency}_{$impact}"));
                 echo "</td>";
             } else {
                 echo "<td><input type='hidden' name='_matrix_{$urgency}_{$impact}' value='{$pri}'>\n                     </td>";
             }
         }
         echo "</tr>\n";
     }
     if ($canedit) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='7' class='center'>";
         echo "<input type='submit' name='update' class='submit' value=\"" . _sx('button', 'Save') . "\">";
         echo "</td></tr>";
     }
     echo "</table></div>";
     Html::closeForm();
 }
Ejemplo n.º 28
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aLanguage instanceof Persistent) {
             $this->aLanguage->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByOwnerId instanceof Persistent) {
             $this->aUserRelatedByOwnerId->clearAllReferences($deep);
         }
         if ($this->aDocumentType instanceof Persistent) {
             $this->aDocumentType->clearAllReferences($deep);
         }
         if ($this->aDocumentCategory instanceof Persistent) {
             $this->aDocumentCategory->clearAllReferences($deep);
         }
         if ($this->aDocumentData instanceof Persistent) {
             $this->aDocumentData->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByCreatedBy instanceof Persistent) {
             $this->aUserRelatedByCreatedBy->clearAllReferences($deep);
         }
         if ($this->aUserRelatedByUpdatedBy instanceof Persistent) {
             $this->aUserRelatedByUpdatedBy->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aLanguage = null;
     $this->aUserRelatedByOwnerId = null;
     $this->aDocumentType = null;
     $this->aDocumentCategory = null;
     $this->aDocumentData = null;
     $this->aUserRelatedByCreatedBy = null;
     $this->aUserRelatedByUpdatedBy = null;
 }