本文整理汇总了PHP中Cabinet类的典型用法代码示例。如果您正苦于以下问题:PHP Cabinet类的具体用法?PHP Cabinet怎么用?PHP Cabinet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Cabinet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: AdjustPOItem
public function AdjustPOItem($data = array())
{
if ($data && is_array($data)) {
foreach ($data['quantity_list'] as $key => $val) {
//debug(strripos($key, 'cabinet'));
if (strripos($key, 'cabinet')) {
$id = explode('|', $key);
//debug($id);
App::uses("Cabinet", "Inventory.Model");
$list_Item = new Cabinet();
$query = "SELECT i.id as id, i.number as number, i.item_title as title, i.price as price, ci.item_quantity as quantity FROM cabinets_items as ci INNER JOIN items as i ON i.id=ci.item_id WHERE ci.cabinet_id={$id['0']}";
$list_data = $list_Item->query($query);
//debug($list_data);
foreach ($list_data as $row) {
$tmp_key = $row['i']['id'] . '|item';
if (array_key_exists($tmp_key, $data['quantity_list'])) {
$data['quantity_list'][$tmp_key] = $data['quantity_list'][$tmp_key] + $row['ci']['quantity'] * $val;
} else {
$data['quantity_list'] = array_merge($data['quantity_list'], array($tmp_key => $row['ci']['quantity'] * $val));
$data['name_list'] = array_merge($data['name_list'], array($tmp_key => $row['ci']['number']));
$data['price_list'] = array_merge($data['price_list'], array($tmp_key => $row['ci']['price']));
$data['title_list'] = array_merge($data['title_list'], array($tmp_key => $row['ci']['title']));
}
unset($data['quantity_list'][$key]);
unset($data['name_list'][$key]);
unset($data['price_list'][$key]);
unset($data['title_list'][$key]);
}
}
}
}
return $data;
}
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:33,代码来源:QuoteItemComponent.php
示例2: action_change
public function action_change()
{
if (isset($_SESSION['user'])) {
$form_data = Cabinet::filling_form();
$login = '';
$password = '';
$first_name = '';
$last_name = '';
$errors = false;
if (isset($_POST['change'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$result = Cabinet::change($login, $password, $first_name, $last_name);
if ($result) {
$errors[] = "Замена данных успешно произведена.";
$_SESSION['user'] = $login;
header('Location: /cabinet/change');
} else {
$errors[] = "Указанный логин уже существует.";
}
}
include_once dir . '/view/cabinet/change.php';
} else {
header('Location: /');
}
return true;
}
开发者ID:Gr1n4,项目名称:analys,代码行数:29,代码来源:Cabinet_controller.php
示例3: getContent
public function getContent()
{
if (empty($this->content)) {
PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
$this->content = Cabinet::getTag($this->type_id);
}
return $this->content;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:8,代码来源:PS_Block.php
示例4: testFactoryArrayOverrideArray
public function testFactoryArrayOverrideArray()
{
$config1 = array('adapter' => 'DotsUnited\\Cabinet\\TestAsset\\TestAdapter', 'config' => array('test' => 'dummy'));
$config2 = array('test' => 'vanilla');
$adapter = Cabinet::factory($config1, $config2);
$this->assertInstanceOf('DotsUnited\\Cabinet\\TestAsset\\TestAdapter', $adapter);
// second arg should be ignored
$this->assertEquals('dummy', $adapter->config['test']);
}
开发者ID:dotsunited,项目名称:cabinet,代码行数:9,代码来源:CabinetTest.php
示例5: afterSave
public function afterSave($created)
{
parent::afterSave($created);
if (isset($this->data['CabinetOrder']['resource_type']) && $this->data['CabinetOrder']['resource_type'] == 'cabinet') {
App::import('Model', 'Inventory.Cabinet');
$cabinet_model = new Cabinet();
$cabinet_model->recursive = 1;
$cabinet_detail = $cabinet_model->find('first', array('conditions' => array('Cabinet.id' => $this->data['CabinetOrder']['resource_id'])));
if (!empty($cabinet_detail['CabinetsItem']) && is_array($cabinet_detail['CabinetsItem'])) {
foreach ($cabinet_detail['CabinetsItem'] as $key => $cabinet_item) {
$this->data['CabinetOrderItem'][$key] = array('cabinet_order_id' => $this->data['CabinetOrder']['id'], 'quote_id' => $this->data['CabinetOrder']['quote_id'], 'cabinet_id' => $this->data['CabinetOrder']['resource_id'], 'quantity' => $this->data['CabinetOrder']['quantity'] * $cabinet_item['item_quantity'], 'item_id' => $cabinet_item['item_id'], 'code' => "{$cabinet_item['item_id']}|item", 'type' => 'Cabinet Order');
}
}
}
if (isset($this->data['CabinetOrderItem'])) {
// delete CabinetOrderItem
$this->CabinetOrderItem->deleteAll(array('cabinet_order_id' => $this->id));
if (is_array($this->data['CabinetOrderItem'])) {
// save CabinetOrderItem
// $cabinetOrderItems = array();
// $index = 0;
// foreach ($this->data['CabinetOrderItem'] as $cabinetOrderItem) {
// if (trim($cabinetOrderItem['quantity']) == '' || trim($cabinetOrderItem['code']) == '') {
// continue; // skip if no data
// }
// $cabinetOrderItems[$index]['cabinet_order_id'] = $this->id;
// $cabinetOrderItems[$index]['item_id'] = trim($cabinetOrderItem['item_id']);
// $cabinetOrderItems[$index]['cabinet_id'] = trim($cabinetOrderItem['cabinet_id']);
//// $cabinetOrderItems[$index]['door_id'] = trim($cabinetOrderItem['door_id']);
//// $cabinetOrderItems[$index]['door_information'] = trim($cabinetOrderItem['door_information']);
//// $cabinetOrderItems[$index]['open_frame_door'] = trim($cabinetOrderItem['open_frame_door']);
//// $cabinetOrderItems[$index]['do_not_drill_door'] = trim($cabinetOrderItem['do_not_drill_door']);
//// $cabinetOrderItems[$index]['no_doors'] = trim($cabinetOrderItem['no_doors']);
// $cabinetOrderItems[$index]['quantity'] = trim($cabinetOrderItem['quantity']);
// $cabinetOrderItems[$index]['code'] = trim($cabinetOrderItem['code']);
// $cabinetOrderItems[$index]['type'] = "Cabinet Order";
//
// $index++;
// }
$this->CabinetOrderItem->saveAll($this->data['CabinetOrderItem']);
}
}
}
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:43,代码来源:CabinetOrder.php
示例6: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
$floor = new HMS_Floor($this->floorId);
$tpl = array();
$tpl['HALL_FLOOR'] = $floor->where_am_i();
if (isset($floor->floor_plan_image_id) && $floor->floor_plan_image_id != 0) {
$file = Cabinet::getFile($floor->floor_plan_image_id);
//if the image loaded properly
if ($file->id == $floor->floor_plan_image_id) {
$tpl['FLOOR_PLAN_IMAGE'] = $file->parentLinked();
}
}
if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
$rlcId = $this->rlcAssignment->getRlc()->getId();
} else {
$rlcId = null;
}
$rooms = $floor->get_rooms();
$tpl['room_list'] = array();
foreach ($rooms as $room) {
$row = array();
$num_avail_beds = $room->count_avail_lottery_beds();
// We list the room dispite whether it's actually available to choose or not,
// so decide whether to "gray out" this row in the room list or not
if ($room->gender_type != $this->student->getGender() && $room->gender_type != AUTO || $num_avail_beds == 0 || $room->reserved == 1 || $room->offline == 1 || $room->private == 1 || $room->overflow == 1 || $room->parlor == 1 || $room->getReservedRlcId() != $rlcId) {
// Show a grayed out row and no link
$row['ROOM_NUM'] = $room->room_number;
$row['ROW_TEXT_COLOR'] = 'text-muted';
$row['AVAIL_BEDS'] = 0;
// show 0 available beds since this room is unavailable to the user
} else {
// Show the room number as a link
$roomCmd = CommandFactory::getCommand('LotteryChooseRoom');
$roomCmd->setRoomId($room->id);
$row['ROOM_NUM'] = $roomCmd->getLink($room->room_number);
$row['ROW_TEXT_COLOR'] = 'black';
$row['AVAIL_BEDS'] = $num_avail_beds;
}
if ($room->isADA()) {
$row['ADA'] = '<i class="fa fa-wheelchair" title="ADA Compliant"></i>';
}
if ($room->isHearingImpaired()) {
$row['HEARING_IMPAIRED'] = '<i class="fa fa-bell-slash" title="Equiped for Hearing Impaired"></i>';
}
if ($room->bathEnSuite()) {
$row['BATH_EN_SUITE'] = '<i class="fa fa-female" title="Bathroom en Suite">|</i><i class="fa fa-male" title="Bathroom en Suite"></i>';
}
$row['NUM_BEDS'] = $room->get_number_of_beds();
$tpl['room_list'][] = $row;
}
Layout::addPageTitle("Lottery Choose Room");
return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_room.tpl');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:54,代码来源:LotteryChooseRoomView.php
示例7: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
$hall = new HMS_Residence_Hall($this->hallId);
$tpl = array();
$tpl['HALL'] = $hall->hall_name;
if (isset($hall->exterior_image_id)) {
$tpl['EXTERIOR_IMAGE'] = Cabinet::getTag($hall->exterior_image_id);
}
if (isset($hall->room_plan_image_id) && $hall->room_plan_image_id != 0) {
$file = Cabinet::getFile($hall->room_plan_image_id);
$tpl['ROOM_PLAN_IMAGE'] = $file->parentLinked();
}
if (isset($hall->map_image_id)) {
$tpl['MAP_IMAGE'] = Cabinet::getTag($hall->map_image_id);
}
if (isset($hall->other_image_id) && $hall->other_image_id != 0 && $hall->other_image_id != '0') {
$file = Cabinet::getFile($hall->other_image_id);
$tpl['OTHER_IMAGE'] = $file->parentLinked();
}
if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) {
$rlcId = $this->rlcAssignment->getRlc()->getId();
} else {
$rlcId = null;
}
$floors = $hall->get_floors();
foreach ($floors as $floor) {
$row = array();
if ($floor->count_avail_lottery_rooms($this->student->getGender(), $rlcId) <= 0) {
$row['FLOOR'] = HMS_Util::ordinal($floor->floor_number);
$row['ROW_TEXT_COLOR'] = 'class="text-muted"';
$tpl['floor_list'][] = $row;
continue;
}
$floorCmd = CommandFactory::getCommand('LotteryChooseFloor');
$floorCmd->setFloorId($floor->id);
$row['FLOOR'] = $floorCmd->getLink(HMS_Util::ordinal($floor->floor_number) . ' floor');
$row['ROW_TEXT_COLOR'] = 'grey';
$tpl['floor_list'][] = $row;
}
Layout::addPageTitle("Choose Floor");
return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_floor.tpl');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:45,代码来源:LotteryChooseFloorView.php
示例8: getFile
public function getFile($thumbnail = false)
{
if (!$this->image_id) {
return null;
}
$file = Cabinet::getFile($this->image_id);
if ($file->isImage(true)) {
if ($this->image_link == 'default') {
if ($thumbnail) {
return $file->getThumbnail();
} else {
return $file->getTag();
}
}
$file->allowImageLink(false);
if ($this->image_link == 'none') {
if ($thumbnail) {
return $file->getThumbnail();
} else {
return $file->getTag();
}
}
if ($this->image_link == 'parent') {
return $file->parentLinked($thumbnail);
} elseif ($this->image_link == 'readmore') {
$url = $this->getViewLink(true);
} else {
$url = $this->image_link;
}
if ($thumbnail) {
return sprintf('<a href="%s">%s</a>', $url, $file->getThumbnail());
} else {
return sprintf('<a href="%s">%s</a>', $url, $file->getTag());
}
} elseif ($thumbnail && ($file->isMedia() && $file->_source->isVideo())) {
return sprintf('<a href="%s">%s</a>', $this->getViewLink(true), $file->getThumbnail());
} else {
return $file->getTag();
}
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:40,代码来源:Blog.php
示例9: __
}
echo ' </select>
</div>
<div>
<button id="generate" type="submit">' . __("Generate") . '</button>
</div>
</div>
</div>
</form>
</div> <!-- END .center -->
</div> <!-- END .main -->
</div> <!-- END .page -->
</body>
</html>';
} else {
$cab = new Cabinet();
$dev = new Device();
$datacenter->DataCenterID = $_REQUEST["datacenterid"];
$datacenter->GetDataCenter();
$cab->DataCenterID = $datacenter->DataCenterID;
$cabList = $cab->ListCabinetsByDC();
header('Content-type: text/xml');
header('Cache-Control: no-store, NO-CACHE');
header('Content-Disposition: attachment; filename="opendcim.xml"');
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<datacenter>\n\n\t<ID>{$datacenter->DataCenterID}</ID>\n\t<Name>{$datacenter->Name}</Name>\n\t<Size>{$datacenter->SquareFootage}</Size>\n";
foreach ($cabList as $cabRow) {
print "\t<cabinet>\n\t\t<ID>{$cabRow->CabinetID}</ID>\n\t\t<Location>{$cabRow->Location}</Location>\n\t\t<Height>{$cabRow->CabinetHeight}</Height>\n\t\t<FrontEdge>{$cabRow->FrontEdge}</FrontEdge>\n\t\t<MapX1>{$cabRow->MapX1}</MapX1>\n\t\t<MapY1>{$cabRow->MapY1}</MapY1>\n\t\t<MapX2>{$cabRow->MapX2}</MapX2>\n\t\t<MapY2>{$cabRow->MapY2}</MapY2>\n";
$dev->Cabinet = $cabRow->CabinetID;
$devList = $dev->ViewDevicesByCabinet();
$totalWatts = 0;
foreach ($devList as $devRow) {
开发者ID:paragm,项目名称:openDCIM,代码行数:31,代码来源:report_xml_CFD.php
示例10: order_standart_rows_Template
private function order_standart_rows_Template($id_row = 0)
{
$html = '';
$table_head_html = '
<table id="general_panel_orders_tbl">
<tr>
<th colspan="3">Артикул/номенклатура/печать</th>
<th>тираж<br>запас</th>
<th>поставщик товара и резерв</th>
<th>подрядчик печати</th>
<th>сумма</th>
<th>тех + доп инфо</th>
<th>дата утв. макета</th>
<th>дата сдачи</th>
<th colspan="2">статус</th>
</tr>
';
$this->collspan = 12;
// запрос строк заказов
$this->get_the_orders_Database($id_row);
$table_order_row = '';
// создаем экземпляр класса форм
$this->FORM = new Forms();
// тут будут храниться операторы
$this->Order['operators_listiong'] = '';
// ПЕРЕБОР ЗАКАЗОВ
foreach ($this->Order_arr as $this->Order) {
// переменные для вычисления даты сдачи заказа
// обнуляются при начале обсчётак каждого заказа
$this->order_shipping_date = '';
$this->order_shipping_date_timestamp = 0;
$this->one_specificate_is_not_approval = 0;
// одна из спецификаций не утверждена
$this->price_order = 0;
// стоимость заказа
//////////////////////////
// open_close -- start
//////////////////////////
// получаем флаг открыт/закрыто
$this->open__close = $this->get_open_close_for_this_user($this->Order['open_close']);
//////////////////////////
// open_close -- end
//////////////////////////
// запоминаем обрабатываемые номера заказа и запроса
// номер запроса
$this->query_num = $this->Order['query_num'];
// номер заказа
$this->order_num = $this->Order['order_num'];
// преобразовываем вид номера заказа для пользователя (подставляем впереди 0000)
$this->order_num_for_User = Cabinet::show_order_num($this->Order['order_num']);
// запрашиваем информацию по позициям
$this->order_deadline = '';
// дата отгрузки заказа (из спецификации)
$this->order_date_of_delivery = '';
// количество рабочих дней на работу над заказом (из спецификации)
$this->position_item = 1;
// порядковый номер позиции
$table_order_positions_rows = $this->table_specificate_for_order_Html();
// $table_order_positions_rows = '';
if ($table_order_positions_rows == '') {
continue;
}
// формируем строку с информацией о заказе
$table_order_row .= '<tr class="order_head_row" data-id="' . $this->Order['id'] . '" data-order_num="' . $this->Order['order_num'] . '">';
//////////////////////////
// тело строки заказа -- start ---
//////////////////////////
$table_order_row2_body = '<td class="show_hide" ' . $this->open_close_rowspan . '="' . ($this->rows_num + 1) . '"><span class="cabinett_row_hide_orders' . $this->open_close_class . '"></span></td>';
$table_order_row2_body .= '<td colspan="4" class="orders_info">';
// исполнители заказа
$table_order_row2_body .= $this->performer_table_for_order();
$table_order_row2_body .= '</td>';
// стоимость заказа
$table_order_row2_body .= '<td><span class="show_the_full_information">' . $this->price_order . '</span> р.</td>';
// бух учет
$table_order_row2_body .= '<td class="buh_uchet_for_order" data-id="' . $this->Order['order_num'] . '"></td>';
// платёжная информация
$this->Order_payment_percent = $this->calculation_percent_of_payment($this->price_order, $this->Order['payment_status']);
// комментарии
$table_order_row2_body .= '<td>';
$table_order_row2_body .= '<span data-cab_list_order_num="' . $this->order_num . '" data-cab_list_query_num="' . $this->Order['query_num'] . '" class="icon_comment_order_show white ' . Comments_for_order_class::check_the_empty_order_coment_Database($this->Order['order_num']) . '"></span>';
$table_order_row2_body .= '</td>';
// срок по ДС
$table_order_row2_body .= '<td></td>';
// $table_order_row2_body .= '<td><input type="text" name="date_of_delivery_of_the_order" class="date_of_delivery_of_the_order" value="'.$this->Order['date_of_delivery_of_the_order'].'"></td>';
// дата сдачи / отгрузки
$table_order_row2_body .= '<td>';
$table_order_row2_body .= $this->order_shipping_date;
$table_order_row2_body .= '</td>';
$table_order_row2_body .= '<td style="width:78px"><span class="greyText black">Заказа: </span></td>';
$table_order_row2_body .= '<td class="' . ($this->user_access == 5 || $this->user_access == 1 ? 'order_status_chenge' : '') . '">' . $this->decoder_statuslist_order_and_paperwork($this->Order['global_status']) . '</td>';
/////////////////////////////////////
// тело строки заказа -- end ---
/////////////////////////////////////
$table_order_row2 = '</tr>';
// включаем вывод позиций
$table_order_row .= $table_order_row2_body . $table_order_row2 . $table_order_positions_rows;
// запрос по одной строке без подробностей
if ($id_row != 0) {
return $table_order_row2_body;
//.........这里部分代码省略.........
开发者ID:apelburg,项目名称:test,代码行数:101,代码来源:cabinet_order_shipping_class.php
示例11: postMultimediaUpload
public function postMultimediaUpload()
{
$this->loadMultimedia();
$result = $this->multimedia->importPost('file_name');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$vars['timeout'] = '3';
$vars['refresh'] = 0;
$this->content = dgettext('filecabinet', 'An error occurred when trying to save your multimedia file.');
javascript('close_refresh', $vars);
return;
} elseif ($result) {
if (empty($_FILES['file_name']['name'])) {
$result = $this->multimedia->save(false, false);
} else {
$result = $this->multimedia->save();
}
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->content = dgettext('filecabinet', 'An error occurred when trying to save your multimedia file.');
$this->content .= '<br /><strong>' . $result->getMessage() . '</strong>';
$this->content .= '<br /><br />' . javascript('close_window', array('value' => dgettext('filecabinet', 'Close this window')));
return;
}
$this->multimedia->moveToFolder();
javascript('close_refresh');
} else {
Cabinet::setMessage($this->multimedia->printErrors());
return;
}
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:31,代码来源:Multimedia_Manager.php
示例12: array
{
$retstr = $noTemplate = $noOwnership = '';
if ($device->TemplateID == 0) {
$noTemplate = '(T)';
$noTemplFlag = true;
}
if ($device->Owner == 0) {
$noOwnership = '(O)';
$noOwnerFlag = true;
}
if ($noTemplFlag or $noOwnerFlag) {
$retstr = '<span class="hlight">' . $noTemplate . $noOwnership . '</span>';
}
return array($noTemplFlag, $noOwnerFlag, $retstr);
}
$cab = new Cabinet();
$cab->CabinetID = $_REQUEST["cabinetid"];
$cab->GetCabinet();
// Check to see if this user is allowed to see anything in ihere
if (!$person->SiteAdmin && !$person->ReadAccess && $cab->Rights == 'None' && !array_intersect($person->isMemberOf(), Cabinet::GetOccupants($cab->CabinetID))) {
// This cabinet belongs to a department you don't have affiliation with, so no viewing at all
header('Location: ' . redirect());
exit;
}
// If you're deleting the cabinet, no need to pull in the rest of the information, so get it out of the way
// Only a site administrator can create or delete a cabinet
if (isset($_POST["delete"]) && $_POST["delete"] == "yes" && $person->SiteAdmin) {
$cab->DeleteCabinet();
header('Content-Type: application/json');
echo json_encode(array('url' => redirect("dc_stats.php?dc={$cab->DataCenterID}")));
exit;
开发者ID:olivierbeytrison,项目名称:openDCIM,代码行数:31,代码来源:cabnavigator.php
示例13: Department
print "<p>Anything shown here is just a notice. It is not necessarily an error. We will occasionally have to repeat database modifications that will fail and will show here. <b>This is behavior is to be expected</b>. Take note of any errors displayed in red then press F5 to reload this page until it goes to the configuration screen.</p>";
} else {
echo '<p class="success">All is well. Please remove install.php to return to normal functionality</p>';
}
?>
</body>
</html>
<?php
exit;
}
require_once "facilities.inc.php";
$dept = new Department();
$dc = new DataCenter();
$cab = new Cabinet();
function BuildFileList()
{
$imageselect = '<div id="preview"></div><div id="filelist">';
$path = './images';
$dir = scandir($path);
foreach ($dir as $i => $f) {
if (is_file($path . DIRECTORY_SEPARATOR . $f) && round(filesize($path . DIRECTORY_SEPARATOR . $f) / 1024, 2) >= 4 && $f != "serverrack.png" && $f != "gradient.png") {
$imageinfo = getimagesize($path . DIRECTORY_SEPARATOR . $f);
if (preg_match('/^image/i', $imageinfo['mime'])) {
$imageselect .= "<span>{$f}</span>\n";
}
}
}
$imageselect .= "</div>";
return $imageselect;
开发者ID:Gusenichka,项目名称:openDCIM,代码行数:31,代码来源:install.php
示例14: echoResponse
echoResponse(200, $response);
});
//
// Copy an existing device to the new position, adjusting the name automagically per rules in the CopyDevice method
// URL: /api/v1/device/:deviceid/copyto/:newposition
// Method: PUT
// Params: deviceid (passed in URL)
// Required: Label, cabinetid
// Optional: everything else
// Returns: record as created
//
$app->put('/device/:deviceid/copyto/:newposition', function ($deviceid, $newposition) use($app) {
$dev = new Device();
$dev->DeviceID = $deviceid;
$dev->GetDevice();
$cab = new Cabinet();
$cab->CabinetID = $dev->Cabinet;
if (!$cab->GetCabinet()) {
$response['error'] = true;
$response['errorcode'] = 404;
$response['message'] = __("Cabinet not found");
} else {
if ($cab->Rights != "Write") {
$response['error'] = true;
$response['errorcode'] = 403;
$response['message'] = __("Unauthorized");
} else {
if (!$dev->CopyDevice(null, $newposition)) {
$response['error'] = true;
$response['errorcode'] = 404;
$response['message'] = __("Device creation failed");
开发者ID:mnibbelink,项目名称:openDCIM,代码行数:31,代码来源:index.php
示例15: __
<?php
require_once "db.inc.php";
require_once "facilities.inc.php";
$subheader = __("Map Selector");
if (!$person->SiteAdmin) {
// No soup for you.
header("Location: " . redirect());
exit;
}
$dc = new DataCenter();
$cab = new Cabinet();
$cab->CabinetID = $_REQUEST["cabinetid"];
$cab->GetCabinet();
$dc->DataCenterID = $cab->DataCenterID;
$dc->GetDataCenter();
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "Submit") {
$cab->MapX1 = intval($_REQUEST["x1"]);
$cab->MapX2 = intval($_REQUEST["x2"]);
$cab->MapY1 = intval($_REQUEST["y1"]);
$cab->MapY2 = intval($_REQUEST["y2"]);
$cab->FrontEdge = $_REQUEST["frontedge"];
$cab->UpdateCabinet();
$url = redirect("cabnavigator.php?cabinetid={$cab->CabinetID}");
header("Location: {$url}");
}
$height = 0;
$width = 0;
if (strlen($dc->DrawingFileName) > 0) {
$mapfile = "drawings/{$dc->DrawingFileName}";
if (file_exists($mapfile)) {
开发者ID:paragm,项目名称:openDCIM,代码行数:31,代码来源:mapmaker.php
示例16: foreach
$datacenter->GetDataCenter();
$graphname .= "Row " . $cabrow->Name . " in Data Center " . $datacenter->Name;
foreach ($cabinetList as $cab) {
$device = new Device();
$device->Cabinet = $cab->CabinetID;
foreach ($device->ViewDevicesByCabinet(true) as $dev) {
if (!isset($devList[$dev->DeviceType])) {
$devList[$dev->DeviceType] = array();
}
$devList[$dev->DeviceType][$dev->DeviceID] = array();
}
}
}
} elseif (isset($_REQUEST['cabid'])) {
$cabid = isset($_POST['cabid']) ? $_POST['cabid'] : $_GET['cabid'];
$cabinet = new Cabinet();
$cabinet->CabinetID = $cabid;
$cabinet->GetCabinet();
$datacenter = new DataCenter();
$datacenter->DataCenterID = $cabinet->DataCenterID;
$datacenter->GetDataCenter();
$graphname .= "Cabinet " . $cabinet->Location . " in Data Center " . $datacenter->Name;
$device = new Device();
$device->Cabinet = $cabid;
foreach ($device->ViewDevicesByCabinet(true) as $dev) {
if (!isset($devList[$dev->DeviceType])) {
$devList[$dev->DeviceType] = array();
}
$devList[$dev->DeviceType][$dev->DeviceID] = array();
}
} elseif (isset($_REQUEST['tagname'])) {
开发者ID:paragm,项目名称:openDCIM,代码行数:31,代码来源:report_network_map.php
示例17: MakePath
function MakePath()
{
$this->MakeSafe();
//reset PathError
$this->PathError = 0;
//check devices/ports
$device = new Device();
$device->DeviceID = $this->devID1;
if (!$device->GetDevice()) {
$this->PathError = 1;
//dev1 does not exist
return false;
}
$devType1 = $device->DeviceType;
if ($device->DeviceType == "Patch Panel") {
$this->PathError = 2;
//dev1 is a Patch Pannel
return false;
}
$port1 = new DevicePorts();
$port1->DeviceID = $this->devID1;
$port1->PortNumber = $this->port1;
if (!$port1->getPort()) {
$this->PathError = 3;
//dev1,port1 is missing
return False;
}
if ($port1->ConnectedDeviceID > 0 && $port1->ConnectedPort > 0) {
$this->PathError = 4;
//dev1,port1 is connected
return False;
}
$device->DeviceID = $this->devID2;
if (!$device->GetDevice()) {
$this->PathError = 5;
//dev2 does not exist
return false;
}
$devType2 = $device->DeviceType;
if ($device->DeviceType == "Patch Panel") {
$this->PathError = 6;
//dev2 is a Patch Pannel
return false;
}
$port2 = new DevicePorts();
$port2->DeviceID = $this->devID2;
$port2->PortNumber = $this->port2;
if (!$port2->getPort()) {
$this->PathError = 7;
//dev2,port2 is missing
return False;
}
if ($port2->ConnectedDeviceID > 0 && $port2->ConnectedPort > 0) {
$this->PathError = 8;
//dev2,port2 is connected
return False;
}
//get dev2 info
$this->cab2 = $device->GetDeviceCabinetID();
//cab2
$cabinet = new Cabinet();
$cabinet->CabinetID = $this->cab2;
$cabinet->GetCabinet();
$this->row2 = $cabinet->CabRowID;
//row2
//if dev2 is panel protected device (connected to rear connection of a panel)
$this->espejo2 = $port2->ConnectedDeviceID > 0 && $port2->ConnectedPort < 0;
@unlink('ppath.log');
$this->escribe_log("**** NEW PATH ****");
$this->escribe_log("DEV1: ID=" . $this->devID1 . " PORT=" . $this->port1);
$this->escribe_log("DEV2: ID=" . $this->devID2 . " PORT=" . $this->port2 . " CAB_ID=" . $this->cab2 . " ROW_ID=" . $this->row2);
$this->escribe_log("-------------------");
//reset Path
$this->ClearPath();
//initiate list with device1, port1, weitgh=0, prev_dev=0, prev_port=0
$this->AddNodeToList($this->devID1, $this->port1, 0, 0, 0);
while ($this->SelectNode()) {
if ($this->DeviceID == $this->devID2) {
$this->escribe_log("Target found. Making the PATH...");
//make the path
$i = 1;
while ($this->DeviceID > 0) {
$dev = $this->DeviceID;
$port = $this->PortNumber;
$Path[$i]["DeviceID"] = $dev;
$Path[$i]["PortNumber"] = $port;
$this->DeviceID = $this->nodes[$dev][$port]["prev_dev"];
$this->PortNumber = $this->nodes[$dev][$port]["prev_port"];
$i++;
}
for ($j = 1; $j < $i; $j++) {
$this->Path[$j]["DeviceID"] = $Path[$i - $j]["DeviceID"];
$this->Path[$j]["PortNumber"] = $Path[$i - $j]["PortNumber"];
}
$this->escribe_log("PATH created.");
$this->escribe_log("");
return true;
}
$this->UpdateList();
}
//.........这里部分代码省略.........
开发者ID:ghasedak,项目名称:openDCIM,代码行数:101,代码来源:assets.inc.php
示例18: DeletePDU
function DeletePDU()
{
global $person;
$this->MakeSafe();
// Do not attempt anything else if the lookup fails
if (!$this->GetPDU()) {
return false;
}
// Check rights
$cab = new Cabinet();
$cab->CabinetID = $this->CabinetID;
$cab->GetCabinet();
if (!$person->canWrite($cab->AssignedTo)) {
return false;
}
// First, remove any connections to the PDU
$tmpConn = new PowerConnection();
$tmpConn->PDUID = $this->PDUID;
$connList = $tmpConn->GetConnectionsByPDU();
foreach ($connList as $delConn) {
$delConn->RemoveConnection();
}
// Clear out any records from PDUStats, possible S.U.T. involving changing
// a devicetype but leaving behind a phantom reading for a non-power device
$sql = "DELETE FROM fac_PDUStats WHERE PDUID={$this->PDUID};";
$this->exec($sql);
$sql = "DELETE FROM fac_PowerDistribution WHERE PDUID={$this->PDUID};";
if (!$this->exec($sql)) {
// Something went south and this didn't delete.
return false;
} else {
class_exists('LogActions') ? LogActions::LogThis($this) : '';
return true;
}
}
开发者ID:ghasedak,项目名称:openDCIM,代码行数:35,代码来源:power.inc.php
示例19: attach_client_to_request_AJAX
//.........这里部分代码省略.........
}
$query .= " WHERE `id` = '" . (int) $_POST['rt_list_id'] . "';";
$result = $mysqli->query($query) or die($mysqli->error);
// if($this->user_access != 5){
// echo '{"response":"OK","function2":"change_attache_manager","function":"echo_message","message_type":"system_message","message":"'.base64_encode($message).'"}';
// }else{
// echo '{"response":"OK","function":"reload_order_tbl"}';
// }
// echo '{"response":"OK","function":"change_attache_manager","rt_list_id":"'.$_POST['rt_list_id'].'", "manager_id":"'.$managers_arr[0]['id'].'","manager_name":"'.$managers_arr[0]['name'].' '.$managers_arr[0]['last_name'].'"}';
// $options['width'] = 1200;
// $this->responseClass->addSimpleWindow($query,"",$options);
$this->responseClass->addMessage($message, 'system_message');
// $this->responseClass->addResponseFunction('change_attache_manager',array('rt_list_id'=>$_POST['rt_list_id'],'manager_id'=>$managers_arr[0]['id'],'name'=>$manager));
$this->responseClass->addResponseFunction('reload_order_tbl');
break;
default:
// если к клиенту присоединено несколько кураторов выполняем первый пункт по умолчанию, потом вызываем окно с выбором менеджера
/*
|
请发表评论