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


PHP Device::get_id方法代码示例

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


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

示例1: catch

            break;
        case 'import_readtext':
            try {
                $import_data = import_text_to_array($import_file_content, $import_format, $import_separator);
                match_devicepart_names_to_ids($database, $current_user, $log, $import_data);
                $import_loop = build_deviceparts_import_template_loop($database, $current_user, $log, $import_data);
            } catch (Exception $e) {
                $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
            }
            break;
        case 'import':
            $only_check_data = isset($_REQUEST['check_import_data']);
            try {
                $import_data = extract_import_data_from_request($import_rowcount);
                $import_loop = build_deviceparts_import_template_loop($database, $current_user, $log, $import_data);
                import_device_parts($database, $current_user, $log, $device->get_id(), $import_data, $only_check_data);
                $import_data_is_valid = true;
                // no exception in "import_device_parts()", so the data is valid
                if (!$only_check_data) {
                    // clear import variables, so the import table is no longer visible in the HTML output
                    $import_file_content = '';
                    unset($import_data);
                    unset($import_loop);
                }
            } catch (Exception $e) {
                $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
            }
            break;
    }
}
if (isset($reload_site) && $reload_site) {
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:show_device_parts.php

示例2: array

if (!$fatal_error) {
    try {
        $order_devices = Device::get_order_devices($database, $current_user, $log);
        $order_devices_loop = array();
        $row_odd = true;
        foreach ($order_devices as $device) {
            $too_less_parts = 0;
            foreach ($device->get_parts() as $devicepart) {
                $needed = $devicepart->get_mount_quantity() * $device->get_order_quantity();
                $instock = $devicepart->get_part()->get_instock();
                $mininstock = $devicepart->get_part()->get_mininstock();
                if ($instock - $needed < $mininstock) {
                    $too_less_parts++;
                }
            }
            $order_devices_loop[] = array('row_odd' => $row_odd, 'id' => $device->get_id(), 'name' => $device->get_name(), 'full_path' => $device->get_full_path(), 'order_quantity' => $device->get_order_quantity(), 'only_missing_parts' => $device->get_order_only_missing_parts(), 'parts_count' => $device->get_parts_count(), 'parts_count_to_order' => $too_less_parts);
            $row_odd = !$row_odd;
        }
        $html->set_loop('order_devices_loop', $order_devices_loop);
    } catch (Exception $e) {
        $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
        $fatal_error = true;
    }
}
/********************************************************************************
 *
 *   Set the rest of the HTML variables
 *
 *********************************************************************************/
$html->use_javascript(array('popup', 'validatenumber'));
if (!$fatal_error) {
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:show_order_parts.php

示例3: save

 /**
  * 
  * Enter description here ...
  * @param Device $d
  */
 public static function save(Device $d)
 {
     $dbh = $GLOBALS['dbh'];
     if ($d->get_id()) {
         // Update
         $data = $dbh->prepare("\n\t\t\t\tUPDATE \n\t\t\t\t\tdevice\n\t\t\t\tSET \n\t\t\t\t\tuid=:uid, name=:name, cost=:cost, `range`=:range, `status`=:status\n\t\t\t\tWHERE \n\t\t\t\t\tid=:id\n\t\t\t");
         $data->execute(array(':uid' => $d->get_uid(), ':name' => $d->get_name(), ':cost' => $d->get_cost(), ':range' => $d->get_range(), ':status' => $d->get_status(), ':id' => $d->get_id()));
     } else {
         // Insert
         $data = $dbh->prepare("\n\t\t\t\tINSERT \n\t\t\t\t\tINTO device (uid, name, cost, `range`)\n\t\t\t\tVALUES\n\t\t\t\t\t(:uid, :name, :cost, :range)\n\t\t\t");
         $data->execute(array(':uid' => $d->get_uid(), ':name' => $d->get_name(), ':cost' => $d->get_cost(), ':range' => $d->get_range()));
     }
 }
开发者ID:nguyentien,项目名称:ps3,代码行数:18,代码来源:device.class.php

示例4: copy

 /**
  * @brief Create a new Device as a copy from this one. All DeviceParts will be copied too.
  *
  * @param string $name                  The name of the new device
  * @param integer $parent_id            The ID of the new device's parent device
  * @param boolean   $with_subdevices    If true, all subdevices will be copied too
  *
  * @throws Exception if there was an error
  */
 public function copy($name, $parent_id, $with_subdevices = false)
 {
     try {
         if ($with_subdevices && $parent_id > 0) {
             // check if $parent_id is NOT a child of this device
             $parent_device = new Device($this->database, $this->current_user, $this->log, $parent_id);
             if ($parent_device->get_id() == $this->get_id() || $parent_device->is_child_of($this)) {
                 throw new Exception('Eine Baugruppe kann nicht in sich selber kopiert werden!');
             }
         }
         $transaction_id = $this->database->begin_transaction();
         // start transaction
         $new_device = Device::add($this->database, $this->current_user, $this->log, $name, $parent_id);
         $device_parts = $this->get_parts();
         foreach ($device_parts as $part) {
             $new_part = DevicePart::add($this->database, $this->current_user, $this->log, $new_device->get_id(), $part->get_part()->get_id(), $part->get_mount_quantity(), $part->get_mount_names());
         }
         if ($with_subdevices) {
             $subdevices = $this->get_subelements(false);
             foreach ($subdevices as $device) {
                 $device->copy($device->get_name(), $new_device->get_id(), true);
             }
         }
         $this->database->commit($transaction_id);
         // commit transaction
     } catch (Exception $e) {
         $this->database->rollback();
         // rollback transaction
         throw new Exception("Die Baugruppe \"" . $this->get_name() . "\"konnte nicht kopiert werden!\nGrund: " . $e->getMessage());
     }
 }
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:40,代码来源:class.Device.php


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