• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Software类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: pdfForSoftware

 static function pdfForSoftware(PluginPdfSimplePDF $pdf, Software $item)
 {
     global $DB;
     $sID = $item->getField('id');
     $query = "SELECT `glpi_softwareversions`.*,\n                       `glpi_states`.`name` AS sname,\n                       `glpi_operatingsystems`.`name` AS osname\n                FROM `glpi_softwareversions`\n                LEFT JOIN `glpi_states`\n                     ON (`glpi_states`.`id` = `glpi_softwareversions`.`states_id`)\n                LEFT JOIN `glpi_operatingsystems`\n                     ON (`glpi_operatingsystems`.`id` = `glpi_softwareversions`.`operatingsystems_id`)\n                WHERE (`softwares_id` = '" . $sID . "')\n                ORDER BY `name`";
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . SoftwareVersion::getTypeName(2) . '</b>');
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result) > 0) {
             $pdf->setColumnsSize(13, 13, 30, 14, 30);
             $pdf->displayTitle('<b><i>' . SoftwareVersion::getTypeName(2) . '</i></b>', '<b><i>' . __('Status') . '</i></b>', '<b><i>' . __('Operating system') . '</i></b>', '<b><i>' . _n('Installation', 'Installations', 2) . '</i></b>', '<b><i>' . __('Comments') . '</i></b>');
             $pdf->setColumnsAlign('left', 'left', 'left', 'right', 'left');
             for ($tot = $nb = 0; $data = $DB->fetch_assoc($result); $tot += $nb) {
                 $nb = Computer_SoftwareVersion::countForVersion($data['id']);
                 $pdf->displayLine(empty($data['name']) ? "(" . $data['id'] . ")" : $data['name'], $data['sname'], $data['osname'], $nb, str_replace(array("\r", "\n"), " ", $data['comment']));
             }
             $pdf->setColumnsAlign('left', 'right', 'left', 'right', 'left');
             $pdf->displayTitle('', '', "<b>" . sprintf(__('%1$s: %2$s'), __('Total') . "</b>", ''), $tot, '');
         } else {
             $pdf->displayLine(__('No item found'));
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:softwareversion.class.php


示例2: index

 function index()
 {
     $conn = Db::get_connection();
     if (isset($_GET['software_name'])) {
         $software_factory = new Software();
         $softwares = $software_factory->find_all(array('where_clause' => "`name` = '{$conn->escape($_GET['software_name'])}' AND (`name` != 'guidatv' OR `type` = 'macosx')", 'limit' => 1));
         if (count($softwares) > 0) {
             $this->software = $softwares[0];
             $this->software->has_many('software_releases');
             // Sort releases
             $releases = $this->software->software_releases;
             usort($releases, array($releases[0], 'sort_releases'));
             $this->software->release = $releases[0];
             $this->software->release->has_many('software_artifacts');
             // Horrible hack to enable per-software caching.
             $_REQUEST['id'] = $this->software->id;
         }
     } else {
         if (isset($_GET['id'])) {
             $this->software = new Software();
             $this->software->find_by_id($_GET['id']);
             $this->software->has_many('software_releases');
             // Sort releases
             $releases = $this->software->software_releases;
             usort($releases, array($releases[0], 'sort_releases'));
             $this->software->release = $releases[0];
             $this->software->release->has_many('software_artifacts');
         } else {
             $this->render_error();
         }
     }
     Db::close_connection($conn);
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:33,代码来源:sparkle_controller.php


示例3: pdfForSoftware

 static function pdfForSoftware(PluginPdfSimplePDF $pdf, Software $software, $infocom = false)
 {
     global $DB;
     $sID = $software->getField('id');
     $license = new SoftwareLicense();
     $query = "SELECT `id`\n                FROM `glpi_softwarelicenses`\n                WHERE `softwares_id` = '" . $sID . "' " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true) . "\n                ORDER BY `name`";
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . _n('License', 'Licenses', 2) . '</b>');
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result)) {
             for ($tot = 0; $data = $DB->fetch_assoc($result);) {
                 if ($license->getFromDB($data['id'])) {
                     self::pdfMain($pdf, $license, false);
                     if ($infocom) {
                         PluginPdfInfocom::pdfForItem($pdf, $license);
                     }
                 }
             }
         } else {
             $pdf->displayLine(__('No item found'));
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:softwarelicense.class.php


示例4: inserir

 /**
  * Este serve para inserir objeto em um software.  
  * @param Objeto $objeto
  * @param Software $software
  * @return boolean
  */
 public function inserir(Objeto $objeto, Software $software)
 {
     $idSoftware = $software->getId();
     $nomeDoObjeto = $objeto->getNome();
     $persistenciaObjeto = $objeto->getPersistencia();
     $insert = "INSERT into objeto\n\t\t(software_id_software, nome, persistencia) \n\t\tvalues({$idSoftware}, '{$nomeDoObjeto}', '{$persistenciaObjeto}')";
     if ($this->conexao->query($insert)) {
         return true;
     } else {
         //echo "<br>".$insert;
         return false;
     }
 }
开发者ID:joseolinda,项目名称:escritordesoftware,代码行数:19,代码来源:ObjetoDAO.class.php


示例5: update_versiontracker_ratings

 /**
  *	@fn update_versiontracker_ratings
  *	@short Action method that updates the VersionTracker ratings for software products.
  */
 public function update_versiontracker_ratings()
 {
     $conn = Db::get_connection();
     error_reporting(E_ALL | E_STRICT);
     $sw = new Software();
     $softwares = $sw->find_all();
     foreach ($softwares as $software) {
         $software->has_one('version_tracker_entries');
         if ($software->version_tracker_entry && $software->version_tracker_entry->vt_id != 0) {
             $vt = new VTRatingsParser($software->version_tracker_entry->vt_id);
             $vt->parse();
             $software->version_tracker_entry->rating = $vt->rating;
             $software->version_tracker_entry->save();
         }
     }
     $this->render(NULL);
     Db::close_connection($conn);
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:22,代码来源:maintenance_controller.php


示例6: showUsersLicenses

 /**
  * Show table with linked licenses to user
  * @param Software $software
  * @return bool
  */
 private static function showUsersLicenses(Software $software)
 {
     global $DB;
     $softwareId = $software->getField("id");
     $totalRecordsCount = self::countLicenses($software);
     $currentPage = isset($_GET["start"]) ? $_GET["start"] : 0;
     $sortingOrder = SortingOrder::getFromString($_GET["order"]);
     $columnKeys = array_keys(self::getColumns());
     $sortingColumn = array_key_exists($_GET["sort"], self::getColumns()) ? $_GET["sort"] : reset($columnKeys);
     $queryResult = $DB->query(self::getDataQuery($softwareId, $currentPage, $sortingColumn, $sortingOrder));
     $options = PluginFpsoftwareConfig::getConfigValues(array('group_by_users'));
     Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount);
     echo self::printTableBegin();
     echo self::printGridColumnsHeaders($sortingOrder, $sortingColumn);
     if ($totalRecordsCount > 0) {
         while ($data = $DB->fetch_assoc($queryResult)) {
             echo "<tr class='tab_bg_1'>";
             echo "<td class='left'><a href='softwarelicense.form.php?id=" . $data['license_id'] . "'>" . $data["license_name"] . "</a> - " . $data["license_serial"] . " (" . $data["license_type"] . ") " . "</td>";
             echo "<td class='left'><a href='user.form.php?id=" . $data['user_id'] . "'>" . $data["user_name"] . "</a></td>";
             if ($options['group_by_users']) {
                 $computers = array();
                 if ($data['computer_ids']) {
                     $computer_ids = explode(';|;', $data['computer_ids']);
                     $computer_names = explode(';|;', $data['computer_names']);
                     foreach ($computer_ids as $index => $computer_id) {
                         $computers[] = " <a href='computer.form.php?id=" . $computer_id . "'>" . $computer_names[$index] . "</a>";
                     }
                 }
                 echo "<td class='left'>";
                 echo implode("<br /><br />", $computers) . "</td>";
             } else {
                 echo "<td class='left'><a href='computer.form.php?id=" . $data['computer_id'] . "'>" . $data["computer_name"] . "</a></td>";
             }
             echo "<td class='left'><a href='location.form.php?id=" . $data['location_id'] . "'>" . $data["location_name"] . "</a></td>";
             echo "</tr>";
         }
     } else {
         echo "<tr class='tab_bg_1'><td class='center' colspan='3'>No results.</td></tr>";
     }
     Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount);
     echo self::printTableEnd();
     return true;
 }
开发者ID:dawidplocki,项目名称:glpi-fpsoftware,代码行数:48,代码来源:userslicenses.class.php


示例7: showAdditionalInformation

 /**
  * @param $info      array
  * @param $option    array
  **/
 function showAdditionalInformation($info = array(), $option = array())
 {
     $name = "info[" . $option['linkfield'] . "]";
     switch ($option['displaytype']) {
         case 'computer':
             Computer::dropdown(array('name' => $name, 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => false));
             break;
         case 'software':
             Software::dropdown(array('name' => $name, 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => false));
             break;
         default:
             break;
     }
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:18,代码来源:softwareversioninjection.class.php


示例8: retornaSoftwareDetalhado

 public function retornaSoftwareDetalhado(Software $software)
 {
     if ($software->getId()) {
         //Pega dados do software.
         $idSoftware = $software->getId();
         $selectSoftware = "Select * From software Where id_software = {$idSoftware}";
         $result = $this->conexao->query($selectSoftware);
         foreach ($result as $linha) {
             $software->setLinguagem($linha['linguagem']);
             $software->setNome($linha['nome']);
         }
         //Buscaremos dados a respeito do banco de dados escolhido.
         $selectBanco = "SELECT * FROM banco_de_dados WHERE software_id_software";
         $result = $this->conexao->query($selectBanco);
         $banco = new BancoDeDados();
         foreach ($result as $linha) {
             $banco->setSistemaGerenciadorDeBancoDeDados($linha['sistema_gerenciador_de_banco']);
             $banco->setNomeDoBanco($linha['nome_do_banco']);
             $banco->setHost($linha['host']);
             $banco->setPass($linha['pass']);
             $banco->setUsuario($linha['usuario']);
         }
         if ($banco) {
             $software->setBancoDeDados($banco);
         }
         //Pegaremos agora a lista de Objetos
         //Aqui também podemos buscar os atributos, mas implementarei isso daqui a pouco
         $selectObjetos = "SELECT * FROM objeto WHERE software_id_software = {$idSoftware}";
         $result = $this->conexao->query($selectObjetos);
         foreach ($result as $linha) {
             $objeto = new Objeto();
             $objeto->setNome($linha['nome']);
             $objeto->setPersistencia($linha['persistencia']);
             $objeto->setId($linha['id_objeto']);
             $idObjeto = $linha['id_objeto'];
             $selectAtributo = "SELECT * FROM atributo WHERE objeto_id_objeto = {$idObjeto}";
             $resultAtributo = $this->conexao->query($selectAtributo);
             foreach ($resultAtributo as $linhaatributo) {
                 $atributo = new Atributo();
                 $atributo->setId($linhaatributo['id_atributo']);
                 $atributo->setNome($linhaatributo['nome']);
                 $atributo->setTipo($linhaatributo['tipo']);
                 $atributo->setIndice($linhaatributo['indice']);
                 $atributo->setTipoDeRelacionamentoComObjeto($linhaatributo['relacionamento_com_objeto']);
                 $objeto->addAtributo($atributo);
             }
             $software->addObjetoNaLista($objeto);
         }
         return $software;
     } else {
         return null;
     }
 }
开发者ID:joseolinda,项目名称:escritordesoftware,代码行数:53,代码来源:SoftwareDAO.class.php


示例9: generate_entity


//.........这里部分代码省略.........
                                 )));

      addDocuments('Peripheral', $periphID);
      addContracts('Peripheral', $periphID);

      // Add trackings
      addTracking('Peripheral', $periphID, $ID_entity);

      // Add reservation
      addReservation('Peripheral', $periphID, $ID_entity);

      // AJOUT INFOCOMS
      addInfocoms('Peripheral', $periphID, $ID_entity);

      // Add connections
      $val = mt_rand(1,$MAX['connect_for_peripherals']);
      for ($j=1 ; $j<$val ; $j++) {
         $ci->add(array('itemtype'     => 'Peripheral',
                        'items_id'     => $periphID,
                        'computers_id' => mt_rand($FIRST["computers"],$LAST['computers'])));
      }
   }

   $LAST["peripherals"] = getMaxItem("glpi_peripherals");

   $FIRST["software"]   = getMaxItem("glpi_softwares")+1;

   // Ajout logiciels + licences associees a divers PCs
   $items = array(array("Open'Office", "1.1.4", "2.0", "2.0.1"),
                  array("Microsoft Office", "95", "97", "XP", "2000", "2003", "2007"),
                  array("Acrobat Reader", "6.0", "7.0", "7.04"),
                  array("Gimp", "2.0", "2.2"),
                  array("InkScape", "0.4"));
   $soft       = new Software();
   $softvers   = new SoftwareVersion();
   $softlic    = new SoftwareLicense();
   $csv        = new Computer_SoftwareVersion();
   $csl        = new Computer_SoftwareLicense();
   for ($i=0 ; $i<$MAX['software'] ; $i++) {

      if (isset($items[$i])) {
         $name = $items[$i][0];
      } else {
         $name = "software '$i";
      }

      $loc       = mt_rand(1,$MAX['locations']);
      $techID    = mt_rand($FIRST['users_sadmin'],$LAST['users_admin']);
      $gtechID   = mt_rand($FIRST["techgroups"],$LAST["techgroups"]);
      $recursive = mt_rand(0,1);

      $softID = $soft->add(toolbox::addslashes_deep(
                           array('entities_id'           => $ID_entity,
                                 'is_recursive'          => $recursive,
                                 'name'                  => $name,
                                 'comment'               => "comment '$i",
                                 'locations_id'          => $loc,
                                 'users_id_tech'         => $techID,
                                 'groups_id_tech'        => $gtechID,
                                 'manufacturers_id'      => mt_rand(1,$MAX['manufacturer']),
                                 'notepad'               => "notes software '$i",
                                 'users_id'              => mt_rand($FIRST['users_admin'],
                                                                    $LAST['users_admin']),
                                 'groups_id'             => mt_rand($FIRST["groups"], $LAST["groups"]),
                                 'is_helpdesk_visible'   => 1,
                                 'softwarecategories_id' => mt_rand(1,$MAX['softwarecategory'])
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:67,代码来源:generate_bigdump.function.php


示例10: showForItem

 /**
  * Display form to unlock fields and links
  *
  * @param CommonDBTM $item the source item
  **/
 static function showForItem(CommonDBTM $item)
 {
     global $DB;
     $ID = $item->getID();
     $itemtype = $item->getType();
     $header = false;
     //If user doesn't have write right on the item, lock form must not be displayed
     if (!$item->canCreate()) {
         return false;
     }
     echo "<div width='50%'>";
     echo "<form method='post' id='lock_form'\n             name='lock_form' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
     echo "<input type='hidden' name='id' value='{$ID}'>\n";
     echo "<input type='hidden' name='itemtype' value='{$itemtype}'>\n";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2''>" . __('Locked items') . "</th></tr>";
     //Use a hook to allow external inventory tools to manage per field lock
     $results = Plugin::doHookFunction('display_locked_fields', array('item' => $item, 'header' => $header));
     $header |= $results['header'];
     //Special locks for computers only
     if ($itemtype == 'Computer') {
         //Locks for items recorded in glpi_computers_items table
         $types = array('Monitor', 'Peripheral', 'Printer');
         foreach ($types as $type) {
             $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID, 'itemtype' => $type);
             $params['FIELDS'] = array('id', 'items_id');
             $first = true;
             foreach ($DB->request('glpi_computers_items', $params) as $line) {
                 $tmp = new $type();
                 $tmp->getFromDB($line['items_id']);
                 $header = true;
                 if ($first) {
                     echo "<tr><th colspan='2'>" . $type::getTypeName(2) . "</th></tr>\n";
                     $first = false;
                 }
                 echo "<tr class='tab_bg_1'><td class='center' width='10'>";
                 echo "<input type='checkbox' name='Computer_Item[" . $line['id'] . "]'></td>";
                 echo "<td class='left' width='95%'>" . $tmp->getName() . "</td>";
                 echo "</tr>\n";
             }
         }
         $types = array('ComputerDisk', 'ComputerVirtualMachine');
         foreach ($types as $type) {
             $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID);
             $params['FIELDS'] = array('id', 'name');
             $first = true;
             foreach ($DB->request(getTableForItemType($type), $params) as $line) {
                 $header = true;
                 if ($first) {
                     echo "<tr><th colspan='2'>" . $type::getTypeName(2) . "</th></tr>\n";
                     $first = false;
                 }
                 echo "<tr class='tab_bg_1'><td class='center' width='10'>";
                 echo "<input type='checkbox' name='" . $type . "[" . $line['id'] . "]'></td>";
                 echo "<td class='left' width='95%'>" . $line['name'] . "</td>";
                 echo "</tr>\n";
             }
         }
         //Software versions
         $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID);
         $first = true;
         $query = "SELECT `csv`.`id` AS `id`,\n                           `sv`.`name` AS `version`,\n                           `s`.`name` AS `software`\n                    FROM `glpi_computers_softwareversions` AS csv\n                    LEFT JOIN `glpi_softwareversions` AS sv\n                       ON (`csv`.`softwareversions_id` = `sv`.`id`)\n                    LEFT JOIN `glpi_softwares` AS s\n                       ON (`sv`.`softwares_id` = `s`.`id`)\n                    WHERE `csv`.`is_deleted` = '1'\n                          AND `csv`.`is_dynamic` = '1'\n                          AND `csv`.`computers_id` = '{$ID}'";
         foreach ($DB->request($query) as $line) {
             $header = true;
             if ($first) {
                 echo "<tr><th colspan='2'>" . Software::getTypeName(2) . "</th></tr>\n";
                 $first = false;
             }
             echo "<tr class='tab_bg_1'><td class='center' width='10'>";
             echo "<input type='checkbox' name='Computer_SoftwareVersion[" . $line['id'] . "]'></td>";
             echo "<td class='left' width='95%'>" . $line['software'] . " " . $line['version'] . "</td>";
             echo "</tr>\n";
         }
         //Software licenses
         $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID);
         $first = true;
         $query = "SELECT `csv`.`id` AS `id`,\n                           `sv`.`name` AS `version`,\n                           `s`.`name` AS `software`\n                    FROM `glpi_computers_softwarelicenses` AS csv\n                    LEFT JOIN `glpi_softwarelicenses` AS sv\n                       ON (`csv`.`softwarelicenses_id` = `sv`.`id`)\n                    LEFT JOIN `glpi_softwares` AS s\n                       ON (`sv`.`softwares_id` = `s`.`id`)\n                    WHERE `csv`.`is_deleted` = '1'\n                          AND `csv`.`is_dynamic` = '1'\n                          AND `csv`.`computers_id` = '{$ID}'";
         foreach ($DB->request($query) as $line) {
             $header = true;
             if ($first) {
                 echo "<tr><th colspan='2'>" . SoftwareLicense::getTypeName(2) . "</th>" . "</tr>\n";
                 $first = false;
             }
             echo "<tr class='tab_bg_1'><td class='center' width='10'>";
             echo "<input type='checkbox' name='Computer_SoftwareLicense[" . $line['id'] . "]'></td>";
             echo "<td class='left' width='95%'>" . $line['software'] . " " . $line['version'] . "</td>";
             echo "</tr>\n";
         }
     }
     $first = true;
     $item = new NetworkPort();
     $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'items_id' => $ID, 'itemtype' => $itemtype);
     $params['FIELDS'] = array('id');
     foreach ($DB->request('glpi_networkports', $params) as $line) {
         $item->getFromDB($line['id']);
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:lock.class.php


示例11: cleanSoftwares

 function cleanSoftwares()
 {
     if (!isset($this->already_transfer['Software'])) {
         return;
     }
     $soft = new Software();
     foreach ($this->already_transfer['Software'] as $old => $new) {
         if (countElementsInTable("glpi_softwarelicenses", "softwares_id={$old}") == 0 && countElementsInTable("glpi_softwareversions", "softwares_id={$old}") == 0) {
             if ($this->options['clean_software'] == 1) {
                 // delete
                 $soft->delete(array('id' => $old), 0);
             } else {
                 if ($this->options['clean_software'] == 2) {
                     // purge
                     $soft->delete(array('id' => $old), 1);
                 }
             }
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:20,代码来源:transfer.class.php


示例12: showForm

 /**
  * Print the Software / version form
  *
  * @param $ID Integer : Id of the version or the template to print
  * @param $options array
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  *
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if (!haveRight("software", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         $soft = new Software();
         $soft->getFromDB($softwares_id);
         // Create item
         $input = array('entities_id' => $soft->getEntityID(), 'is_recursive' => $soft->isRecursive());
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'><td>" . $LANG['help'][31] . "&nbsp;:</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center middle' rowspan='4'>";
     echo "<textarea cols='45' rows='3' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][5] . "&nbsp;:</td><td>";
     Dropdown::show('OperatingSystem', array('value' => $this->fields["operatingsystems_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td>" . $LANG['state'][0] . "&nbsp;:</td><td>";
     Dropdown::show('State', array('value' => $this->fields["states_id"]));
     echo "</td></tr>\n";
     // Only count softwareversions_id_buy (don't care of softwareversions_id_use if no installation)
     if (SoftwareLicense::countForVersion($ID) > 0 || Computer_SoftwareVersion::countForVersion($ID) > 0) {
         $options['candel'] = false;
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:63,代码来源:softwareversion.class.php


示例13: get_version_list

function get_version_list($conn, $data)
{
    $response = array();
    $model = $data['model'];
    ossim_valid($model, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC_EXT, 'illegal:' . _("Model"));
    check_ossim_error();
    if (empty($model)) {
        $items = array();
    } else {
        $model = escape_sql($model, $conn);
        $items = Software::get_versions_by_cpe($conn, $model, TRUE);
    }
    $response['error'] = FALSE;
    $response['data']['items'] = $items;
    return $response;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:16,代码来源:plugin_ajax.php


示例14: AddComputerStep3

 /**
  * @test
  */
 public function AddComputerStep3()
 {
     global $DB;
     $this->mark_incomplete();
     return;
     // TODO: recode this test
     $DB->connect();
     $DB->query("UPDATE `glpi_entities`\n         SET `entities_id_software` = '-2'\n         WHERE `id`='1'");
     $_SESSION['glpiactive_entity'] = 0;
     $_SESSION['glpiactiveentities_string'] = 0;
     $_SESSION['glpishowallentities'] = 1;
     $_SESSION['glpiname'] = 'glpi';
     $pfiComputerInv = new PluginFusioninventoryInventoryComputerInventory();
     $computer = new Computer();
     $software = new Software();
     $input = array('id' => 1, 'is_recursive' => 0);
     $software->update($input);
     $computer->add(array('name' => 'pc2', 'entities_id' => 1));
     $a_inventory = array();
     $a_inventory['CONTENT']['HARDWARE'] = array('NAME' => 'pc2');
     $a_inventory['CONTENT']['SOFTWARES'][] = array('COMMENTS' => "Non-interactive tool to get files from FTP, GOPHER, HTTP(S)", 'NAME' => "curl", 'VERSION' => "7.24.0_1");
     // ** Add agent
     $pfAgent = new PluginFusioninventoryAgent();
     $a_agents_id = $pfAgent->add(array('name' => 'pc-2013-02-13', 'device_id' => 'pc-2013-02-13'));
     $_SESSION['plugin_fusioninventory_agents_id'] = $a_agents_id;
     // ** Add
     $pfiComputerInv->import("pc2-2013-02-13", "", $a_inventory);
     // creation
     $computer->getFromDB(2);
     $this->assertEquals(1, $computer->fields['entities_id'], 'Add computer');
     $nbSoftwares = countElementsInTable("glpi_softwares");
     $softs = getAllDatasFromTable("glpi_softwares");
     $this->assertEquals(2, $nbSoftwares, 'Nb softwares ' . print_r($softs, true));
     $software->getFromDB(2);
     $this->assertEquals(1, $software->fields['entities_id'], "May be on entity 1");
     // Software not in same entity as computer, may be recursive
     $this->assertEquals(0, $software->fields['is_recursive'], 'Software may have recursive = 0');
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:41,代码来源:SoftwareEntityCreationTest.php


示例15: define

// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
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);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:software.form.php


示例16: dropdownMyDevices

 /**
  * Make a select box for Ticket my devices
  *
  *
  * @param $userID User ID for my device section
  * @param $entity_restrict restrict to a specific entity
  * @param $itemtype of selected item
  * @param $items_id of selected item
  *
  * @return nothing (print out an HTML select box)
  **/
 static function dropdownMyDevices($userID = 0, $entity_restrict = -1, $itemtype = 0, $items_id = 0)
 {
     global $DB, $LANG, $CFG_GLPI;
     if ($userID == 0) {
         $userID = getLoginUserID();
     }
     $rand = mt_rand();
     $already_add = array();
     if ($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] & pow(2, HELPDESK_MY_HARDWARE)) {
         $my_devices = "";
         $my_item = $itemtype . '_' . $items_id;
         // My items
         foreach ($CFG_GLPI["linkuser_types"] as $itemtype) {
             if (class_exists($itemtype) && self::isPossibleToAssignType($itemtype)) {
                 $itemtable = getTableForItemType($itemtype);
                 $item = new $itemtype();
                 $query = "SELECT *\n                         FROM `{$itemtable}`\n                         WHERE `users_id` = '{$userID}'";
                 if ($item->maybeDeleted()) {
                     $query .= " AND `is_deleted` = '0' ";
                 }
                 if ($item->maybeTemplate()) {
                     $query .= " AND `is_template` = '0' ";
                 }
                 if (in_array($itemtype, $CFG_GLPI["helpdesk_visible_types"])) {
                     $query .= " AND `is_helpdesk_visible` = '1' ";
                 }
                 $query .= getEntitiesRestrictRequest("AND", $itemtable, "", $entity_restrict, $item->maybeRecursive());
                 "\n                         ORDER BY `name` ";
                 $result = $DB->query($query);
                 $nb = $DB->numrows($result);
                 if ($DB->numrows($result) > 0) {
                     $type_name = $item->getTypeName($nb);
                     while ($data = $DB->fetch_array($result)) {
                         $output = $data["name"];
                         if (empty($output) || $_SESSION["glpiis_ids_visible"]) {
                             $output .= " (" . $data['id'] . ")";
                         }
                         $output = $type_name . " - " . $output;
                         if ($itemtype != 'Software') {
                             if (!empty($data['serial'])) {
                                 $output .= " - " . $data['serial'];
                             }
                             if (!empty($data['otherserial'])) {
                                 $output .= " - " . $data['otherserial'];
                             }
                         }
                         $my_devices .= "<option title=\"{$output}\" value='" . $itemtype . "_" . $data["id"] . "' " . ($my_item == $itemtype . "_" . $data["id"] ? "selected" : "") . ">" . utf8_substr($output, 0, $_SESSION["glpidropdown_chars_limit"]) . "</option>";
                         $already_add[$itemtype][] = $data["id"];
                     }
                 }
             }
         }
         if (!empty($my_devices)) {
             $my_devices = "<optgroup label=\"" . $LANG['tracking'][1] . "\">" . $my_devices . "</optgroup>";
         }
         // My group items
         if (haveRight("show_group_hardware", "1")) {
             $group_where = "";
             $query = "SELECT `glpi_groups_users`.`groups_id`, `glpi_groups`.`name`\n                      FROM `glpi_groups_users`\n                      LEFT JOIN `glpi_groups`\n                           ON (`glpi_groups`.`id` = `glpi_groups_users`.`groups_id`)\n                      WHERE `glpi_groups_users`.`users_id` = '{$userID}' " . getEntitiesRestrictRequest("AND", "glpi_groups", "", $entity_restrict, true);
             $result = $DB->query($query);
             $first = true;
             if ($DB->numrows($result) > 0) {
                 while ($data = $DB->fetch_array($result)) {
                     if ($first) {
                         $first = false;
                     } else {
                         $group_where .= " OR ";
                     }
                     $group_where .= " `groups_id` = '" . $data["groups_id"] . "' ";
                 }
                 $tmp_device = "";
                 foreach ($CFG_GLPI["linkgroup_types"] as $itemtype) {
                     if (class_exists($itemtype) && self::isPossibleToAssignType($itemtype)) {
                         $itemtable = getTableForItemType($itemtype);
                         $item = new $itemtype();
                         $query = "SELECT *\n                               FROM `{$itemtable}`\n                               WHERE ({$group_where}) " . getEntitiesRestrictRequest("AND", $itemtable, "", $entity_restrict, $item->maybeRecursive());
                         if ($item->maybeDeleted()) {
                             $query .= " AND `is_deleted` = '0' ";
                         }
                         if ($item->maybeTemplate()) {
                             $query .= " AND `is_template` = '0' ";
                         }
                         $result = $DB->query($query);
                         if ($DB->numrows($result) > 0) {
                             $type_name = $item->getTypeName();
                             if (!isset($already_add[$itemtype])) {
                                 $already_add[$itemtype] = array();
                             }
                             while ($data = $DB->fetch_array($result)) {
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:ticket.class.php


示例17: showForLicense

 /**
  * Show computers linked to a License
  *
  * @param $license SoftwareLicense object
  *
  * @return nothing
  **/
 static function showForLicense(SoftwareLicense $license)
 {
     global $DB, $CFG_GLPI;
     $searchID = $license->getField('id');
     if (!Software::canView() || !$searchID) {
         return false;
     }
     $canedit = Session::haveRightsOr("software", array(CREATE, UPDATE, DELETE, PURGE));
     $canshowcomputer = Computer::canView();
     if (isset($_GET["start"])) {
         $start = $_GET["start"];
     } else {
         $start = 0;
     }
     if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
         $order = "DESC";
     } else {
         $order = "ASC";
     }
     if (isset($_GET["sort"]) && !empty($_GET["sort"])) {
         // manage several param like location,compname : order first
         $tmp = explode(",", $_GET["sort"]);
         $sort = "`" . implode("` {$order},`", $tmp) . "`";
     } else {
         $sort = "`entity` {$order}, `compname`";
     }
     //SoftwareLicense ID
     $query_number = "SELECT COUNT(*) AS cpt\n                       FROM `glpi_computers_softwarelicenses`\n                       INNER JOIN `glpi_computers`\n                           ON (`glpi_computers_softwarelicenses`.`computers_id`\n                                 = `glpi_computers`.`id`)\n                       WHERE `glpi_computers_softwarelicenses`.`softwarelicenses_id` = '{$searchID}'" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n                             AND `glpi_computers`.`is_deleted` = '0'\n                             AND `glpi_computers`.`is_template` = '0'\n                             AND `glpi_computers_softwarelicenses`.`is_deleted` = '0'";
     $number = 0;
     if ($result = $DB->query($query_number)) {
         $number = $DB->result($result, 0, 0);
     }
     echo "<div class='center'>";
     if ($canedit) {
         echo "<form method='post' action='" . $CFG_GLPI["root_doc"] . "/front/computer_softwarelicense.form.php'>";
         echo "<input type='hidden' name='softwarelicenses_id' value='{$searchID}'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2 center'>";
         echo "<td>";
         Computer::dropdown(array('entity' => $license->fields['entities_id'], 'entity_sons' => $license->fields['is_recursive']));
         echo "</td>";
         echo "<td><input type='submit' name='add' va 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Solar类代码示例发布时间:2022-05-23
下一篇:
PHP Societe类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap