当前位置: 首页>>代码示例>>PHP>>正文


PHP Software::add方法代码示例

本文整理汇总了PHP中Software::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Software::add方法的具体用法?PHP Software::add怎么用?PHP Software::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Software的用法示例。


在下文中一共展示了Software::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copySingleSoftware

 /**
  * Copy (if needed) One software to the destination entity
  *
  * @param $ID of the software
  *
  * @return $ID of the new software (could be the same)
  **/
 function copySingleSoftware($ID)
 {
     global $DB;
     if (isset($this->already_transfer['Software'][$ID])) {
         return $this->already_transfer['Software'][$ID];
     }
     $soft = new Software();
     if ($soft->getFromDB($ID)) {
         if ($soft->fields['is_recursive'] && in_array($soft->fields['entities_id'], getAncestorsOf("glpi_entities", $this->to))) {
             // no need to copy
             $newsoftID = $ID;
         } else {
             $query = "SELECT *\n                      FROM `glpi_softwares`\n                      WHERE `entities_id` = " . $this->to . "\n                            AND `name` = '" . addslashes($soft->fields['name']) . "'";
             if ($data = $DB->request($query)->next()) {
                 $newsoftID = $data["id"];
             } else {
                 // create new item (don't check if move possible => clean needed)
                 unset($soft->fields['id']);
                 $input = $soft->fields;
                 $input['entities_id'] = $this->to;
                 unset($soft->fields);
                 $newsoftID = $soft->add($input);
             }
         }
         $this->addToAlreadyTransfer('Software', $ID, $newsoftID);
         return $newsoftID;
     }
     return -1;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:36,代码来源:transfer.class.php

示例2: Software

*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("software", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$soft = new Software();
if (isset($_POST["add"])) {
    $soft->check(-1, CREATE, $_POST);
    if ($newID = $soft->add($_POST)) {
        Event::log($newID, "software", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($soft->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $soft->check($_POST["id"], DELETE);
        $soft->delete($_POST);
        Event::log($_POST["id"], "software", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $soft->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $soft->check($_POST["id"], DELETE);
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:software.form.php

示例3: Software

if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["sort"])) {
    $_GET["sort"] = "";
}
if (!isset($_GET["order"])) {
    $_GET["order"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$soft = new Software();
if (isset($_POST["add"])) {
    $soft->check(-1, 'w', $_POST);
    $newID = $soft->add($_POST);
    Event::log($newID, "software", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $soft->check($_POST["id"], 'd');
        $soft->delete($_POST);
        Event::log($_POST["id"], "software", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $soft->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $soft->check($_POST["id"], 'd');
            $soft->restore($_POST);
            Event::log($_POST["id"], "software", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][23]);
            $soft->redirectToList();
        } else {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:software.form.php

示例4: generate_entity

/** Generate bigdump : generate items for an entity
 *
 * @param $ID_entity entity ID
**/
function generate_entity($ID_entity) {
   global $MAX, $DB, $percent, $FIRST, $LAST, $MAX_KBITEMS_BY_CAT, $MAX_DISK,
         $DOCUMENTS, $NET_PORT, $NET_LOC;

   regenerateTreeCompleteName("glpi_entities");

   $current_year = date("Y");


   // DOMAIN
   $items = array("SP2MI", "CAMPUS"," IUT86", "PRESIDENCE", "CEAT", "D'omaine");
   $dp    = new Domain();
   $FIRST["domain"] = getMaxItem("glpi_domains")+1;

   for ($i=0 ; $i<$MAX['domain'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "domain $ID_entity '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'         => $val,
                                              'entities_id'  => $ID_entity,
                                              'is_recursive' => 1,
                                              'comment'      => "comment $val")));
   }
   $LAST["domain"] = getMaxItem("glpi_domains");


   // STATUS
   $items = array("Reparation", "En stock", "En fonction", "Retour SAV", "En attente d'");
   $dp    = new State();
   $FIRST["state"] = getMaxItem("glpi_states")+1;
   for ($i=0 ; $i<$MAX['state'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "State $ID_entity '$i";
      }
      $state_id = $dp->add(toolbox::addslashes_deep(array('name'         => $val,
                                                          'entities_id'  => $ID_entity,
                                                          'is_recursive' => 1,
                                                          'comment'      => "comment $val")));

      // generate sub status
      for ($j=0 ; $j<$MAX['state'] ; $j++) {
         $val2 = "Sub $val $j";

         $dp->add(toolbox::addslashes_deep(array('name'         => $val2,
                                                 'entities_id'  => $ID_entity,
                                                 'is_recursive' => 1,
                                                 'states_id'    => $state_id,
                                                 'comment'      => "comment $val")));
      }

   }
   $LAST["state"]      = getMaxItem("glpi_states");


   // glpi_groups
   $FIRST["groups"] = getMaxItem("glpi_groups")+1;
   $group           = new Group();
   for ($i=0 ; $i<$MAX['groups'] ; $i++) {
      $gID = $group->add(toolbox::addslashes_deep(
                         array('entities_id'  => $ID_entity,
                               'name'         => "group d'$i",
                               'comment'      => "comment group d'$i",
                               'is_assign'    => 0)));

      // Generate sub group
      for ($j=0 ; $j<$MAX['groups'] ; $j++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "subgroup d'$j",
                           'comment'      => "comment subgroup d'$j of group $i",
                           'groups_id'    => $gID,
                           'is_assign'    => 0)));
      }
   }

   $LAST["groups"]      = getMaxItem("glpi_groups");

   $FIRST["techgroups"] = $LAST["groups"]+1;

   for ($i=0 ; $i<$MAX['groups'] ; $i++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "tech group d'$i",
                           'comment'      => "comment tech group d'$i")));
   }

   $LAST["techgroups"] = getMaxItem("glpi_groups");
   regenerateTreeCompleteName("glpi_groups");


   // glpi_users
   $FIRST["users_sadmin"] = getMaxItem("glpi_users")+1;
//.........这里部分代码省略.........
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:101,代码来源:generate_bigdump.function.php


注:本文中的Software::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。