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; }
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; }
public function getContent() { if (empty($this->content)) { PHPWS_Core::initModClass('filecabinet', 'Cabinet.php'); $this->content = Cabinet::getTag($this->type_id); } return $this->content; }
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']); }
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']); } } }
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'); }
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'); }
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(); } }
} 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) {
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; } } $html = $table_head_html . $table_order_row . '</table>'; echo $html; }
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; } }
{ $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;
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;
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");
<?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)) {
$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'])) {
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(); } $this->PathError = 9; //not found return false; }
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; } }
protected function attach_client_to_request_AJAX() { include_once './libs/php/classes/client_class.php'; if ($_POST['client_id'] == 'new_client') { // не админ создаёт клиента if ($this->user_access != 1) { $_POST['AJAX'] = 'insert_new_client'; $client = new Client(); } else { $_POST['client_id'] = '0'; $_POST['manager_id'] = '0'; $this->get_a_list_of_managers_to_be_attached_to_the_request_AJAX(); return; } // $client -> get_new_client_form_from_query(); // echo '321321321sdsad'; // exit; } else { // получаем кураторов по выбранному клиенту // подключаем класс клиента if (isset($_POST['row_id'])) { $_POST['rt_list_id'] = $_POST['row_id']; } $managers_arr = Client::get_relate_managers_2($_POST['client_id']); switch (count($managers_arr)) { case '0': // если у нас не прикреплено к данному клиенту ни одного менеджера - выводим сообщение об ошибке $message = 'К данному клиенту не прикреплено ни одного менеджера.'; //echo '{"response":"show_new_window","title":"Ошибка","html":"'.base64_encode($html).'"}'; $this->responseClass->addMessage($message, 'system_message'); break; case '1': // echo '<pre>'; // print_r($_POST); // echo '</pre>'; // если прикреплен только 1 - никаких проблем. // прикрепляем к запросу клиента и менеджера // Переписываем менеджера, отправляем данные о нем в браузер, вызываем там функцию и меняем имя менеджера на странице global $mysqli; // прикрепить клиента и менеджера к запросу $query = "UPDATE `" . RT_LIST . "` SET "; $query .= "`manager_id` = '" . (int) $managers_arr[0]['id'] . "'"; $query .= ",`client_id` = '" . (int) $_POST['client_id'] . "'"; if ($this->user_id != $managers_arr[0]['id']) { $message = 'Запрос был перенаправлен менеджеру ' . $managers_arr[0]['name'] . ' ' . $managers_arr[0]['last_name'] . ''; $query .= ",`time_attach_manager` = NOW()"; $query .= ",`status` = 'not_process' "; } else { $message = 'Запрос был переведён в работу'; $query .= ",`time_attach_manager` = NOW()"; $query .= ",`status` = 'in_work' "; } $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: // если к клиенту присоединено несколько кураторов выполняем первый пункт по умолчанию, потом вызываем окно с выбором менеджера /* *************************************************************** временно отключаем прикрепление первого менеджера автоматически *************************************************************** global $mysqli; // прикрепить клиента и менеджера к запросу $query ="UPDATE `".RT_LIST."` SET `manager_id` = '".(int)$managers_arr[0]['id']."', `client_id` = '".(int)$_POST['client_id']."', `time_attach_manager` = NOW(), `status` = 'not_process' WHERE `id` = '".(int)$_POST['rt_list_id']."';"; $result = $mysqli->query($query) or die($mysqli->error); */ global $mysqli; // прикрепить клиента $query = "UPDATE `" . RT_LIST . "` SET \n\t\t\t\t\t\t\t\t`client_id` = '" . (int) $_POST['client_id'] . "', \n\t\t\t\t\t\t\t\t`time_attach_manager` = NOW(),\n\t\t\t\t\t\t\t\t`status` = 'not_process'\n\t\t\t\t\t\t\t\tWHERE `id` = '" . (int) $_POST['rt_list_id'] . "';"; $result = $mysqli->query($query) or die($mysqli->error); ////////////////////////// // осбираем форму для выбора одного из кураторов // ////////////////////////// $html = '<div id="chose_manager_tbl">'; $html .= '<table>'; for ($i = 0; $i < count($managers_arr); $i) { $html .= '<tr>'; for ($j = 1; $j <= 3; $j++) { if (isset($managers_arr[$i])) { //$checked = ($managers_arr[$i]['id'] == $managers_arr[0]['id'])?'class="checked"':''; $checked = ''; $name = trim($managers_arr[$i]['name']) == '' && trim($managers_arr[$i]['last_name']) == '' ? $managers_arr[$i]['nickname'] : $managers_arr[$i]['name'] . ' ' . $managers_arr[$i]['last_name']; $html .= '<td ' . $checked . ' data-id="' . $managers_arr[$i]['id'] . '">' . $name . "</td>"; } else { $html .= "<td></td>"; } $i++; } $html .= '</tr>'; } $html .= '</table>'; $html .= '<input type="hidden" value="attach_manager_to_request" name="AJAX">'; $html .= '<input type="hidden" value="' . (isset($_POST['manager_id']) ? $_POST['manager_id'] : '') . '" name="manager_id">'; $html .= '<input type="hidden" value="' . $_POST['rt_list_id'] . '" name="rt_list_id">'; $html .= '<input type="hidden" value="" name="client_id">'; $html .= '</div>'; // записываем на странице пользователя в строку с установленным клиентом имя первого куратора из списка // затем даём выбрать из иставшихся // echo '{"response":"show_new_window", // "html":"'.base64_encode($html).'", // "title":"Выберите куратора", // "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'].'" // }'; $this->responseClass->addPostWindow($html, 'Выберите куратора', array('width' => '1000')); $this->responseClass->addResponseFunction('change_attache_manager', array('rt_list_id' => $_POST['rt_list_id'], 'manager_id' => $managers_arr[0]['id'], 'name' => $managers_arr[0]['name'] . ' ' . $managers_arr[0]['last_name'])); $this->responseClass->addResponseFunction('reload_order_tbl'); break; } if (isset($_POST['row_id']) && (int) $_POST['row_id'] > 0) { $this->Query = $this->get_query((int) $_POST['row_id']); // echo '<pre>'; // print_r($this->Query); // echo '</pre>'; // echo '<pre>'; // print_r($_POST); // echo '</pre>'; if (isset($_POST['query_status']) && $_POST['query_status'] != $this->Query['status']) { if ((int) $_POST['client_id'] != $this->Query['client_id']) { include_once 'cabinet_class.php'; $cabinet = new Cabinet(); $cabinet->responseClass = new responseClass(); $cabinet->command_for_change_status_query_AJAX(); // echo $this->responseClass->getResponse(); exit; } } } } // exit; }
public function fileTypeAllowed($ext, $mode = 'all') { if (strpos($ext, '.')) { $ext = PHPWS_File::getFileExtension($ext); } $types = Cabinet::getAllowedTypes($mode); return in_array($ext, $types); }
<?php require_once 'db.inc.php'; require_once 'facilities.inc.php'; $subheader = __("Data Center Device Detail"); $dev = new Device(); $cab = new Cabinet(); $taginsert = ""; // Ajax functions // SNMP Test if (isset($_POST['snmptest'])) { // Parse through the post data and pull in site defaults if necessary $community = $_POST['SNMPCommunity'] == "" ? $config->ParameterArray["SNMPCommunity"] : $_POST['SNMPCommunity']; $version = $_POST['SNMPVersion'] == "" ? $config->ParameterArray["SNMPVersion"] : $_POST['SNMPVersion']; $v3SecurityLevel = $_POST['v3SecurityLevel'] == "" ? $config->ParameterArray["v3SecurityLevel"] : $_POST['v3SecurityLevel']; $v3AuthProtocol = $_POST['v3AuthProtocol'] == "" ? $config->ParameterArray["v3AuthProtocol"] : $_POST['v3AuthProtocol']; $v3AuthPassphrase = $_POST['v3AuthPassphrase'] == "" ? $config->ParameterArray["v3AuthPassphrase"] : $_POST['v3AuthPassphrase']; $v3PrivProtocol = $_POST['v3PrivProtocol'] == "" ? $config->ParameterArray["v3PrivProtocol"] : $_POST['v3PrivProtocol']; $v3PrivPassphrase = $_POST['v3PrivPassphrase'] == "" ? $config->ParameterArray["v3PrivPassphrase"] : $_POST['v3PrivPassphrase']; // Init the snmp handler $snmpHost = new OSS_SNMP\SNMP($_POST['PrimaryIP'], $community, $version, $v3SecurityLevel, $v3AuthProtocol, $v3AuthPassphrase, $v3PrivProtocol, $v3PrivPassphrase); // Try to connect to keep us from killing the system on a failure $error = false; try { $snmpresults = $snmpHost->useSystem()->name(); } catch (Exception $e) { $error = true; } // Show the end user something to make them feel good about it being correct if (!$error) { foreach ($snmpHost->realWalk('1.3.6.1.2.1.1') as $oid => $value) {
/** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ function blog_update(&$content, $currentVersion) { $home_directory = PHPWS_Boost::getHomeDir(); switch ($currentVersion) { case version_compare($currentVersion, '1.2.2', '<'): $content[] = 'This package will not update versions prior to 1.2.2.'; return false; case version_compare($currentVersion, '1.2.3', '<'): $content[] = '<pre> 1.2.3 Changes ------------- + Make call to resetKeywords in search to prevent old search word retention. </pre>'; case version_compare($currentVersion, '1.4.1', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('blog_entries'); $result = $db->addTableColumn('image_id', 'int NOT NULL default 0'); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = 'Unable to add image_id colume to blog_entries table.</pre>'; return false; } $files = array('templates/edit.tpl', 'templates/settings.tpl', 'templates/view.tpl', 'templates/submit.tpl', 'templates/user_main.tpl', 'templates/list_view.tpl'); blogUpdateFiles($files, $content); $content[] = ' 1.4.1 Changes ------------- + Added missing category tags to entry listing. + Added ability for anonymous and users without blog permission to submit entries for later approval. + Added setting to allow anonymous submission. + Added ability to place images on Blog entries without editor. + Added pagination to Blog view. + Added link to reset the view cache. + Added ability to add images to entry without editor. + Added missing translate calls. + Changed edit form layout. </pre>'; case version_compare($currentVersion, '1.4.2', '<'): $content[] = '<pre>'; $files = array('templates/list.tpl'); blogUpdateFiles($files, $content); $content[] = '1.4.2 Changes ------------- + Fixed bug causing error message when Blog listing moved off front page. + Changes "Entry" column to "Summary" on admin list. Was not updated since summary was added. </pre>'; case version_compare($currentVersion, '1.4.3', '<'): $content[] = '<pre>1.4.3 Changes -------------'; $db = new PHPWS_DB('blog_entries'); $result = $db->addTableColumn('expire_date', 'int not null default 0', 'publish_date'); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = 'Unable to create table column "expire_date" on blog_entries table.</pre>'; return false; } else { $content[] = '+ Created "expire_date" column on blog_entries table.'; } $result = $db->addTableColumn('sticky', 'smallint not null default 0'); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = 'Unable to create table column "sticky" on blog_entries table.</pre>'; return false; } else { $content[] = '+ Created "sticky" column on blog_entries table.'; } $files = array('img/blog.png', 'templates/edit.tpl', 'templates/list.tpl'); blogUpdateFiles($files, $content); $content[] = '+ Priviledged blog entries now forward to login page. + Added sticky option. + Added expiration options. + Removed fake French translation. + Changed Control Panel icon. </pre>'; case version_compare($currentVersion, '1.5.0', '<'): $content[] = '<pre>'; $files = array('templates/settings.tpl', 'templates/edit.tpl', 'conf/config.php', 'templates/list_view.tpl'); blogUpdateFiles($files); $content[] = ' 1.5.0 Changes ------------- + Increased default blog entry title size to 100. + Added setting to control whether to allow anonymous comments by default on new blog entries + Added Captcha option to submissions. + Fixed cache reset + Added define to determine the highest amount of blog pages to cache + Added extra checks for anonymous submission + Changed coding of image manager call. + Changed to new language functionality. + Fixed: logErrors called on blog object instead of image object on empty image id. + Fixed pagination on list view. + Now uses new File Cabinet module. </pre>'; case version_compare($currentVersion, '1.5.1', '<'): $content[] = '<pre> 1.5.1 Changes ------------- + Comments link points to comments anchor.</pre>'; case version_compare($currentVersion, '1.5.2', '<'): $content[] = '<pre> 1.5.2 Changes ------------- + Fixed previous blog listing.</pre>'; case version_compare($currentVersion, '1.6.0', '<'): $content[] = '<pre>'; $columns = array(); $columns['update_date'] = 'int not null default 0'; $columns['updater'] = 'varchar(50) NOT NULL'; $columns['updater_id'] = 'int not null default 0'; $db = new PHPWS_DB('blog_entries'); foreach ($columns as $column_name => $col_info) { $result = $db->addTableColumn($column_name, $col_info, 'create_date'); if (PHPWS_Error::logIfError($result)) { $content[] = "--- Unable to create table column '{$column_name}' on blog_entries table.</pre>"; return false; } else { $content[] = "--- Created '{$column_name}' column on blog_entries table."; } } $image_dir = $home_directory . 'images/blog/'; if (!is_dir($image_dir)) { if (mkdir($image_dir)) { $content[] = '--- Created Blog image directory for xmlrpc.'; } else { $content[] = '--- Unable to created Blog image directory for xmlrpc.'; } } elseif (!is_writable($image_dir)) { $content[] = '--- images/blog directory is not writable. XMLRPC upload will not function.'; } $files = array('templates/settings.tpl', 'templates/view.tpl'); blogUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '1.6.1', '<'): $content[] = '<pre>'; blogUpdateFiles(array('templates/settings.tpl'), $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_1.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '1.6.2', '<'): $content[] = '<pre>'; blogUpdateFiles(array('templates/view.tpl', 'templates/settings.tpl', 'templates/style.css'), $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_2.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '1.6.3', '<'): $content[] = '<pre> 1.6.3 changes ---------------- + Small fix to allow linkable images on cached pages. </pre>'; case version_compare($currentVersion, '1.7.0', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('blog_entries'); if (PHPWS_Error::logIfError($db->addTableColumn('image_link', "varchar(255) NOT NULL default 'default'"))) { $content[] = '--- Unable to create image_link column on blog_entries table.</pre>'; return false; } else { $content[] = '--- Created image_link column on blog_entries table'; } PHPWS_Core::initModClass('filecabinet', 'Cabinet.php'); if (Cabinet::convertImagesToFileAssoc('blog_entries', 'image_id')) { $content[] = '--- Converted images to new File Cabinet format.'; } else { $content[] = '--- Could not convert images to new File Cabinet format.</pre>'; return false; } blogUpdateFiles(array('templates/edit.tpl'), $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_7_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '1.7.1', '<'): if (!PHPWS_Boost::inBranch()) { $content[] = '<pre>' . file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_7_1.txt') . '</pre>'; } case version_compare($currentVersion, '1.7.2', '<'): $db = new PHPWS_DB('blog_entries'); if (PHPWS_Error::logIfError($db->addTableColumn('thumbnail', 'smallint not null default 0'))) { $content[] = 'Unable to create thumbnail column on blog_entries table.'; } $content[] = '<pre>'; blogUpdatefiles(array('templates/edit.tpl', 'templates/style.css', 'templates/view.tpl', 'templates/list.tpl', 'templates/settings.tpl'), $content); $content[] = '1.7.2 changes ------------- + Can use media or image thumbnails on blog listing page. + Blog uses new key datetime terminators. + File Cabinet style sheet called regardless of cache. + Indicators added for published status. + Fixed notice warning. + Re-added ability to limit folder view by module. + Blog uses new dbpager sorting headers. + Lets you use new comments approval. + Fixed bug with setting allow anonymous submissions. + Fixed forward message when entry creation encounters an error + js_calendar added to edit form. </pre>'; case version_compare($currentVersion, '1.8.0', '<'): $content[] = '<pre>'; $files = array('templates/list.tpl', 'templates/purge_confirm.tpl', 'conf/config.php', 'img/'); blogUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_8_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '1.8.1', '<'): $content[] = '<pre>'; $files = array('templates/settings.tpl'); blogUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = '1.8.1 changes --------------------- + Added ability to limit blog view to logged users only. + Added ability to lock view of all blog entries down to specific groups. + Blog uses break post. + /blog works again.'; } $content[] = '</pre>'; case version_compare($currentVersion, '1.8.2', '<'): $content[] = '<pre>'; $files = array('templates/view_full.tpl', 'templates/view_list.tpl'); blogUpdateFiles($files, $content); $content[] = '1.8.2 changes --------------------- + Blog templates now have have single view and multiple view templates.'; $content[] = '</pre>'; case version_compare($currentVersion, '1.8.3', '<'): $content[] = '<pre>1.8.3 changes --------------------- + Hub/Branch changes. + Updated code to conform to php 5 strict standards.</pre>'; case version_compare($currentVersion, '1.8.4', '<'): $content[] = '<pre>1.8.4 changes --------------------- + Removed caching to correct previous blog entries problems </pre>'; case version_compare($currentVersion, '1.9.0', '<'): $content[] = '<pre>1.9.0 changes --------------------- + Blog entry takes place in just one text field now.</pre>'; case version_compare($currentVersion, '1.10.0', '<'): $content[] = '<pre>1.10.0 changes --------------------- + Rewrote image url hiding script </pre>'; case version_compare($currentVersion, '1.10.1', '<'): $content[] = '<pre>1.10.1 changes --------------------- + Blog guesses an entry point for an hr tag. </pre>'; case version_compare($currentVersion, '1.10.2', '<'): $content[] = '<pre>1.10.2 changes --------------------- + Updated icons to Font Awesome + Removed Categories from Blog + Create Blog link in miniadmin now works as intended. + Static methods set to avoid error notices. </pre>'; case version_compare($currentVersion, '1.10.3', '<'): $content[] = '<pre>1.10.3 changes --------------------- + Horizontal rules are acknowledged on save. </pre>'; case version_compare($currentVersion, '1.10.4', '<'): $content[] = '<pre>1.10.4 changes --------------------- + Removed Version code </pre>'; case version_compare($currentVersion, '1.10.5', '<'): $content[] = <<<EOF <pre>1.10.5 ------------ + Added new datetimepicker for date fields. </pre> EOF; } // end of switch return true; }
static function save_to_tbl($json) { global $mysqli; global $user_id; //echo $json; $data_obj = json_decode($json); // print_r($data_obj); // exit; //предварительно получаем данные о контактном лице прикрепленном к запросу $query = "SELECT client_face_id FROM `" . RT_LIST . "` WHERE `query_num` = '" . $data_obj->query_num . "'"; $result = $mysqli->query($query) or die($mysqli->error); $row = $result->fetch_assoc(); $recipient_id = $row['client_face_id']; // $data->ids - это двухмерный массив первый уровеннь которого содержит id строк из таблицы RT_MAIN_ROWS // второй уровень содержит id дочерних строк из таблицы RT_DOP_DATA // проходим в цикле этот массив и поочередно копируем данные из таблиц РТ в таблицы КП // записываем данные о КП в таблицу KP_LIST $query = "INSERT INTO `" . KP_LIST . "` \n\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t `create_time` = NOW(),\n\t\t\t\t\t\t\t `client_id` = '" . $data_obj->client_id . "',\n\t\t\t\t\t\t\t `manager_id` = '" . $user_id . "',\n\t\t\t\t\t\t\t `theme` = '" . $data_obj->query_theme . "',\n\t\t\t\t\t\t\t `query_num` = '" . $data_obj->query_num . "',\n\t\t\t\t\t\t\t `recipient_id` = '" . $recipient_id . "'\n\t\t\t\t\t\t\t "; $result = $mysqli->query($query) or die($mysqli->error); if (!$result) { return 2; } $kp_id = $mysqli->insert_id; foreach ($data_obj->ids as $key => $dop_data) { // преобразуем объект в массив $dop_data = (array) $dop_data; if (count($dop_data) == 0) { continue; } // прежде чем данные в таблицы КП сверим совпадают ли количество в расчетах и в услугах // может получиться что они не совпадают ( было что-то не досохранено в РТ) // для этого делаем предварительные запросы к таблицам RT_DOP_DATA и RT_DOP_USLUGI foreach ($dop_data as $dop_key => $dop_val) { // RT_DOP_DATA $query_dop1 = "SELECT*FROM `" . RT_DOP_DATA . "` WHERE id = '" . $dop_key . "'"; //echo $query; $result_dop1 = $mysqli->query($query_dop1) or die($mysqli->error); if ($result_dop1->num_rows > 0) { $row_dop1 = $result_dop1->fetch_assoc(); //RT_DOP_USLUGI $query_dop2 = "SELECT*FROM `" . RT_DOP_USLUGI . "` WHERE dop_row_id = '" . $row_dop1['id'] . "'"; //echo $query; $result_dop2 = $mysqli->query($query_dop2) or die($mysqli->error); if ($result_dop2->num_rows > 0) { while ($row_dop2 = $result_dop2->fetch_assoc()) { if ($row_dop2['glob_type'] == 'print' && $row_dop2['quantity'] != $row_dop1['quantity']) { $reload['flag'] = true; //echo $dop_data['quantity']; include_once ROOT . "/libs/php/classes/rt_calculators_class.php"; $json_out = rtCalculators::change_quantity_and_calculators($row_dop1['quantity'], $row_dop1['id'], 'true', 'false'); $json_out_obj = json_decode($json_out); // если расчет не может быть произведен по причине outOfLimit или needIndividCalculation // сбрасываем количество тиража и нанесения до 1шт. if (isset($json_out_obj->print->outOfLimit) || isset($json_out_obj->print->needIndividCalculation)) { rtCalculators::change_quantity_and_calculators(1, $row_dop1['id'], 'true', 'false'); $query = "UPDATE `" . RT_DOP_DATA . "` SET `quantity` = '1' WHERE `id` = '" . $row_dop1['id'] . "'"; $result = $mysqli->query($query) or die($mysqli->error); } } if ($row_dop2['glob_type'] == 'extra' && $row_dop2['quantity'] != $row_dop1['quantity']) { $query = "UPDATE `" . RT_DOP_USLUGI . "` SET `quantity` = '" . $row_dop1['quantity'] . "' WHERE `id` = '" . $row_dop2['id'] . "'"; $result = $mysqli->query($query) or die($mysqli->error); } } } } } if (isset($reload['flag']) && $reload['flag'] == true) { header('Location:' . HOST . '/?' . $_SERVER['QUERY_STRING']); exit; } // Вставляем ряд в таблицу KP_MAIN_ROWS $query = "SELECT*FROM `" . RT_MAIN_ROWS . "` WHERE id = '" . $key . "'"; //echo $query; $rt_main_row_id = $key; $result = $mysqli->query($query) or die($mysqli->error); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $description = $row['description'] != '' ? 'описание: ' . $row['description'] : ''; if ($row['characteristics'] != '') { $arr = json_decode($row['characteristics'], TRUE); $ch_arr = array(); foreach ($arr as $key => $data) { if ($key == 'colors') { $ch_arr[] = 'цвет: ' . implode(', ', $data); } if ($key == 'materials') { $ch_arr[] = 'материал: ' . implode(', ', $data); } } $characteristics = count($ch_arr) > 0 ? implode('<br>', $ch_arr) : ''; } else { $characteristics = ''; } $query2 = "INSERT INTO `" . KP_MAIN_ROWS . "` \n\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t `kp_id` = '" . $kp_id . "',\n\t\t\t\t\t\t\t `sort` = '" . $row['sort'] . "',\n\t\t\t\t\t\t\t `art` = '" . $row['art'] . "',\n\t\t\t\t\t\t\t `type` = '" . $row['type'] . "',\n\t\t\t\t\t\t\t `art_id` = '" . $row['art_id'] . "',\n\t\t\t\t\t\t\t `name` = '" . $row['name'] . "',\n\t\t\t\t\t\t\t `description` = '" . $row['description'] . "',\n\t\t\t\t\t\t\t `characteristics` = '" . mysql_real_escape_string($characteristics) . "',\n\t\t\t\t\t\t\t `img_folder` = '" . ($row['img_type'] == 'g_std' ? 'img' : $row['img_folder']) . "'\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t "; $result2 = $mysqli->query($query2) or die($mysqli->error); $row_id = $mysqli->insert_id; // копируем выбранные для КП изображения $query7 = "SELECT * FROM `" . RT_MAIN_ROWS_GALLERY . "` WHERE `parent_id` = '" . $rt_main_row_id . "';"; $result7 = $mysqli->query($query7) or die($mysqli->error); // echo $query7.'<br>'; // echo '<pre>'; // print_r($result7); // echo '</pre>'; $choosen_img_arr = array(); if ($result7->num_rows > 0) { while ($row7 = $result7->fetch_assoc()) { // $row7 = $result7->fetch_assoc(); $choosen_img_arr[] = $row7; } } // echo '<pre>'; // print_r($choosen_img_arr); // echo '</pre>'; foreach ($choosen_img_arr as $key => $row7) { $query8 = "INSERT INTO `" . KP_MAIN_ROWS_GALLERY . "` \n\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t `parent_id` = '" . $row_id . "',\n\t\t\t\t\t\t\t `img_name` = '" . $row7['img_name'] . "',\n\t\t\t\t\t\t\t `folder` = '" . $row7['folder'] . "',\n\t\t\t\t\t\t\t `on` = '" . $row7['on'] . "',\n\t\t\t\t\t\t\t `sort` = '" . $row7['sort'] . "'\n\t\t\t\t\t\t\t "; // echo $query8.'<br>'; $result8 = $mysqli->query($query8) or die($mysqli->error); } // Проходим по второму уровню массива foreach ($dop_data as $dop_key => $dop_val) { //echo $dop_key.','; // Вставляем ряд в таблицу KP_DOP_DATA $query3 = "SELECT*FROM `" . RT_DOP_DATA . "` WHERE id = '" . $dop_key . "'"; //echo $query; $result3 = $mysqli->query($query3) or die($mysqli->error); if ($result3->num_rows > 0) { $row3 = $result3->fetch_assoc(); if ($row['type'] != 'cat') { include_once ROOT . "/libs/php/classes/os_form_class.php"; include_once ROOT . "/libs/php/classes/cabinet/cabinet_class.php"; //os_form_class.php $cabinet = new Cabinet(); $details = $cabinet->get_a_detailed_specifications($row['type'], $row3['no_cat_json']); $details = strip_tags($details, '<div><br><br/><br />'); $details = str_replace(array('<div>', '</div>'), array('<br>', ''), $details); $details = str_replace(array("\n", "\r", "\t"), '', $details); $details = str_replace('<br><br>', '<br>', $details); $details = preg_replace('/<div[^<]+>/', '', $details); $details = $row['name'] . '<br>' . $details; } else { $details = ''; } $query4 = "INSERT INTO `" . KP_DOP_DATA . "` \n\t\t\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t\t\t `row_id` = '" . $row_id . "',\n\t\t\t\t\t\t\t\t\t `expel` = '" . $row3['expel'] . "',\n\t\t\t\t\t\t\t\t\t `shipping_time` = '" . $row3['shipping_time'] . "',\n\t\t\t\t\t\t\t\t\t `shipping_date` = '" . $row3['shipping_date'] . "',\n\t\t\t\t\t\t\t\t\t `quantity` = '" . $row3['quantity'] . "',\n\t\t\t\t\t\t\t\t\t `price_in` = '" . $row3['price_in'] . "',\n\t\t\t\t\t\t\t\t\t `price_out` = '" . $row3['price_out'] . "',\n\t\t\t\t\t\t\t\t\t `discount` = '" . $row3['discount'] . "',\n\t\t\t\t\t\t\t\t\t `details` = '" . $details . "',\n\t\t\t\t\t\t\t\t\t `dop_men_text_details` = '" . $row['id'] . "|" . $dop_key . "',\n\t\t\t\t\t\t\t\t\t `tirage_str` = '" . Com_pred::convertTirageJSON($row3['tirage_json']) . "' \n\t\t\t\t\t\t\t\t\t "; $result4 = $mysqli->query($query4) or die($mysqli->error); $dop_row_id = $mysqli->insert_id; // Вставляем ряд в таблицу KP_DOP_USLUGI $query5 = "SELECT*FROM `" . RT_DOP_USLUGI . "` WHERE dop_row_id = '" . $row3['id'] . "'"; //echo $query; $result5 = $mysqli->query($query5) or die($mysqli->error); if ($result5->num_rows > 0) { while ($row5 = $result5->fetch_assoc()) { $query6 = "INSERT INTO `" . KP_DOP_USLUGI . "` \n\t\t\t\t\t\t\t\t\t\t SET \n\t\t\t\t\t\t\t\t\t\t `dop_row_id` = '" . $dop_row_id . "',\n\t\t\t\t\t\t\t\t\t\t `uslugi_id` = '" . $row5['uslugi_id'] . "',\n\t\t\t\t\t\t\t\t\t\t `glob_type` = '" . $row5['glob_type'] . "',\n\t\t\t\t\t\t\t\t\t\t `type` = '" . $row5['type'] . "',\n\t\t\t\t\t\t\t\t\t\t `quantity` = '" . $row5['quantity'] . "',\n\t\t\t\t\t\t\t\t\t\t `price_in` = '" . $row5['price_in'] . "',\n\t\t\t\t\t\t\t\t\t\t `price_out` = '" . $row5['price_out'] . "',\n\t\t\t\t\t\t\t\t\t\t `discount` = '" . $row5['discount'] . "',\n\t\t\t\t\t\t\t\t\t\t `for_how` = '" . $row5['for_how'] . "',\n\t\t\t\t\t\t\t\t\t\t `other_name` = '" . $row5['other_name'] . "',\n\t\t\t\t\t\t\t\t\t\t `print_details` = '" . $row5['print_details'] . "' \n\t\t\t\t\t\t\t\t\t\t "; $result6 = $mysqli->query($query6) or die($mysqli->error); } } } } } } return '1'; }
* Submit the id of the object you want a tooltip for as tooltip. * * $_POST['tooltip'] = id for object of tooltip - REQUIRED * $_POST['cab'] = Required for cabinet tooltips * $_POST['cdu'] = Required for cdu tooltips * $_POST['dev'] = Required for device tooltips */ // Use the global configuration global $config; global $dbh; // We're gonna use this as an intval wherever anyhow so just get it done. $object = isset($_POST['tooltip']) ? intval($_POST['tooltip']) : 0; // Default tooltip $tooltip = __('Error'); // Init Objects $cab = new Cabinet(); $dev = new Device(); $dep = new Department(); if ($config->ParameterArray["mUnits"] == "english") { $weightunit = "lbs"; $tempunit = "F"; } else { $weightunit = "Kg"; $tempunit = "C"; } // If the object id isn't set then don't bother with anything else. if ($object > 0) { // Cabinet if (isset($_POST['cab'])) { $cab->CabinetID = $object; $cab->GetCabinet();
function DeleteDepartment($TransferTo = null) { // Make sure we have a real department to delete so we don't pull some bonehead move and delete everything set to 0 if (!$this->GetDeptByID()) { return false; } // Get people and objects that still belong to this department $dev = new Device(); $cab = new Cabinet(); $dev->Owner = $cab->AssignedTo = $this->DeptID; $person = new People(); $devices = $dev->GetDevicesbyOwner(); $cabinets = $cab->GetCabinetsByDept(); $users = $person->GetPeopleByDepartment($this->DeptID); foreach ($devices as $d) { // We've designated a new owner for this equipment, zero is valid as they might be setting it to general if (!is_null($TransferTo)) { $d->Owner = $TransferTo; $d->UpdateDevice(); } else { // This option is not being provided but us at this time, maybe through the API $d->DeleteDevice(); } } foreach ($cabinets as $c) { // We've designated a new owner for these cabinets, zero is valid as they might be setting it to general if (!is_null($TransferTo)) { $c->AssignedTo = $TransferTo; $c->UpdateCabinet(); } else { // This option is not being provided but us at this time, maybe through the API $c->DeleteCabinet(); } } foreach ($users as $p) { // If we don't have a value over 0 then we're just removing this department and they won't be added to another group if (!is_null($TransferTo) && intval($TransferTo) > 0) { // Add this user into the new department $sql = "INSERT INTO fac_DeptContacts SET DeptID=" . intval($TransferTo) . ", ContactID={$p->PersonID};"; $this->exec($sql); } } // Clear any users from this department $sql = "DELETE FROM fac_DeptContacts WHERE DeptID={$this->DeptID};"; $this->exec($sql); // By this point all devices, objects, and users should have been shoved into a new department so finish cleaning up. $sql = "DELETE FROM fac_Department WHERE DeptID={$this->DeptID};"; if (!$this->exec($sql)) { global $dbh; $info = $dbh->errorInfo(); error_log("PDO Error: {$info[2]} SQL={$sql}"); return false; } class_exists('LogActions') ? LogActions::LogThis($this) : ''; return true; }
function getCabinetItems() { set_time_limit(0); $this->autoRender = false; $sql = "SELECT * FROM cabinetparts;"; $datas = $this->Cabinet->query($sql); App::uses("CabinetsItem", "Inventory.Model"); App::uses("Cabinet", "Inventory.Model"); $Cabinet_model = new Cabinet(); App::uses("Item", "Inventory.Model"); $Item_model = new Item(); foreach ($datas as $data) { $CabinetsItem_model = new CabinetsItem(); $cabinet_data['CabinetsItem']['lineid'] = $data['cabinetparts']['lineid']; $cabinet_data = $Cabinet_model->find('first', array('fields' => array('id', 'name'), 'conditions' => array('Cabinet.name' => $data['cabinetparts']['cabinet']), 'recursive' => -1)); $cabinet_data['CabinetsItem']['cabinet_id'] = !empty($cabinet_data['Cabinet']['id']) ? $cabinet_data['Cabinet']['id'] : "0"; $Item_data = $Item_model->find('first', array('fields' => array('id', 'number'), 'conditions' => array('Item.number' => $data['cabinetparts']['number']), 'recursive' => -1)); $cabinet_data['CabinetsItem']['item_id'] = !empty($Item_data['Item']['id']) ? $Item_data['Item']['id'] : "0"; if (!empty($Item_data)) { $item['Item']['id'] = $Item_data['Item']['id']; $item['Item']['item_department_id'] = 3; $item['Item']['Department'] = 'Accessories'; if (!$Item_model->save($item)) { pr($Item_model->validationErrors); } } $cabinet_data['CabinetsItem']['item_quantity'] = !empty($data['cabinetparts']['quantity']) ? $data['cabinetparts']['quantity'] : "1"; $cabinet_data['CabinetsItem']['component'] = $data['cabinetparts']['component']; $cabinet_data['CabinetsItem']['category'] = $data['cabinetparts']['category']; $cabinet_data['CabinetsItem']['number'] = $data['cabinetparts']['number']; $cabinet_data['CabinetsItem']['accessories'] = 1; if (!$CabinetsItem_model->save($cabinet_data)) { pr($CabinetsItem_model->validationErrors); } } }
if ($dev->DeviceType == "Patch Panel") { $path .= "\n\t\t<td class=\"connection-{$tipo_con}-1\">"; // I prepare row separation between patch rows $conex = "\t\t<td class=\"connection-{$tipo_con}-3\"> </td>\n"; $conex .= "\t\t<td class=\"connection-{$tipo_con}-2\"> </td>\n\t<td></td></tr>\n"; } else { $conex = "\t\t<td></td>\t\t<td></td>\n\t<td></td></tr>"; $path .= "\n\t\t<td>"; } //I get device Lineage (for multi level chassis) $devList = array(); $devList = $dev->GetDeviceLineage(); //Device Table $path .= "\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan=2>"; //cabinet $cab = new Cabinet(); $cab->CabinetID = $devList[sizeof($devList)]->Cabinet; $cab->GetCabinet(); $path .= __("Cabinet") . ": <a href=\"cabnavigator.php?cabinetid={$cab->CabinetID}\">{$cab->Location}</a>"; $path .= "</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>U:{$devList[sizeof($devList)]->Position}</td>\n"; //lineage $t = 5; for ($i = sizeof($devList); $i > 1; $i--) { $path .= str_repeat("\t", $t++) . "<td>\n"; $path .= str_repeat("\t", $t++) . "<table>\n"; $path .= str_repeat("\t", $t++) . "<tr>\n"; $path .= str_repeat("\t", $t--) . "<th colspan=2>"; $path .= "<a href=\"devices.php?DeviceID={$devList[$i]->DeviceID}\">" . $devList[$i]->Label . "</a>"; $path .= "</th>\n"; $path .= str_repeat("\t", $t) . "</tr>\n"; $path .= str_repeat("\t", $t++) . "<tr>\n";
<?php require_once "db.inc.php"; require_once "facilities.inc.php"; $subheader = __("Data Center Cabinet Inventory"); // Get the list of departments that this user is a member of $viewList = $person->isMemberOf(); $cab = new Cabinet(); $head = $legend = $zeroheight = $body = $deptcolor = ""; $deptswithcolor = array(); $dev = new Device(); $templ = new DeviceTemplate(); $tempDept = new Department(); $dc = new DataCenter(); $cabrow = new CabRow(); $cabrow->CabRowID = $_REQUEST['row']; $cabrow->GetCabRow(); $cab->CabRowID = $cabrow->CabRowID; $cabinets = $cab->GetCabinetsByRow(); $frontedge = $cabrow->GetCabRowFrontEdge(); if (isset($_GET["rear"])) { //opposite view $cabinets = array_reverse($cabinets); } //start loop to parse all cabinets in the row foreach ($cabinets as $index => $cabinet) { $currentHeight = $cabinet->CabinetHeight; if ($config->ParameterArray["ReservedColor"] != "#FFFFFF" || $config->ParameterArray["FreeSpaceColor"] != "#FFFFFF") { $head .= "\t\t<style type=\"text/css\">\n\t\t\t.reserved{background-color: {$config->ParameterArray['ReservedColor']};}\n\t\t\t.freespace{background-color: {$config->ParameterArray['FreeSpaceColor']};}\n"; } $side = null;
function notification() { if ($_POST) { $model = new Cabinet(); $model->saveNotification(); View::$layout = 'empty'; View::render('site/redirect', array('text' => 'Данные успешно сохранены', 'href' => '/cabinet/notification/')); } else { $model = new Cabinet(); $data = $model->getNotification(); View::render('cabinet/notification', $data); } }
<?php require_once "db.inc.php"; require_once "facilities.inc.php"; $subheader = __("Data Center Statistics"); $cab = new Cabinet(); $dc = new DataCenter(); $dev = new Device(); //setting airflow if (isset($_POST["cabinetid"]) && isset($_POST["airflow"]) && $person->SiteAdmin) { $cab->CabinetID = $_POST["cabinetid"]; if ($cab->GetCabinet()) { if ($cab->CabRowID > 0 && isset($_POST["row"]) && $_POST["row"] == "true") { //update all row $cabinets = $cab->GetCabinetsByRow(); foreach ($cabinets as $index => $cabinet) { $cabinet->FrontEdge = $_POST["airflow"]; $cabinet->UpdateCabinet(); } } else { //update cabinet $cab->FrontEdge = $_POST["airflow"]; $cab->UpdateCabinet(); } } exit; } if (isset($_POST['dc']) && (isset($_POST['getobjects']) || isset($_POST['getoverview']))) { $payload = array(); if (isset($_POST['getobjects'])) { $cab->DataCenterID = $_POST['dc'];