function XML_Read($Object, $Level = 1) { #----------------------------------------------------------------------------- static $Index = 1; #----------------------------------------------------------------------------- $Md5 = Md5($Index++); #----------------------------------------------------------------------------- $Attribs = $Object->Attribs; #----------------------------------------------------------------------------- $Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name; #----------------------------------------------------------------------------- $P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name)); #----------------------------------------------------------------------------- $Node = new Tag('DIV', array('class' => 'Node'), $P); #----------------------------------------------------------------------------- if (Count($Attribs)) { #--------------------------------------------------------------------------- foreach (Array_Keys($Attribs) as $AttribID) { $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID]))); } } #----------------------------------------------------------------------------- if (Count($Childs = $Object->Childs)) { #--------------------------------------------------------------------------- $Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5)); #--------------------------------------------------------------------------- foreach ($Childs as $Child) { $Content->AddChild(XML_Read($Child, $Level + 1)); } #--------------------------------------------------------------------------- $Node->AddChild($Content); } #----------------------------------------------------------------------------- return $Node; }
$Links =& Links(); #------------------------------------------------------------------------------- $Links['DOM'] =& $DOM; #------------------------------------------------------------------------------- if (Is_Error($DOM->Load('Base'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddAttribs('MenuLeft', array('args' => 'Administrator/AddIns')); #------------------------------------------------------------------------------- $DOM->AddText('Title', 'Дополнения → Мастера настройки → Прочее'); #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('BR')); $List = new Tag('UL', array('class' => 'Standard')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Menus = Styles_XML('Menus/Administrator/Masters.Other.xml'); #Debug(SPrintF("[comp/www/Administrator/SystemMaintenance]: Menus = %s",print_r($Menus,true))); #------------------------------------------------------------------------------- foreach ($Menus['Items'] as $Menu) { #------------------------------------------------------------------------------- $A = new Tag('A', array('class' => 'Standard', 'href' => $Menu['Href']), $Menu['Text']); #------------------------------------------------------------------------------- if (isset($Menu['Prompt'])) { #------------------------------------------------------------------------------- $LinkID = UniqID('Href'); #------------------------------------------------------------------------------- $Links[$LinkID] =& $A;
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = $Comp; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Div = new Tag('DIV', array('align' => 'right')); #------------------------------------------------------------------------------- if ($DSSchemeID) { #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'onclick' => 'form.DSSchemeID.value = (checked?0:value);', 'value' => $DSSchemeID)); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div->AddChild($Comp); #------------------------------------------------------------------------------- $Div->AddChild(new Tag('SPAN', array('class' => 'Comment'), 'создать новый тариф')); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => SPrintF("FormEdit('/Administrator/API/DSSchemeEdit','DSSchemeEditForm','%s');", $Title), 'value' => $DSSchemeID ? 'Сохранить' : 'Добавить')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div->AddChild($Comp); #------------------------------------------------------------------------------- $Table[] = $Div; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Comp = Comp_Load('Buttons/Panel', array('Comp' => $Comp, 'Name' => 'Новый тариф')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY', $Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Super', 'VPSSchemes'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody->AddChild($Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tab', 'Administrator/VPS', $NoBody); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddChild('Into', $Comp); #------------------------------------------------------------------------------- $Out = $DOM->Build(); #------------------------------------------------------------------------------- if (Is_Error($Out)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- return $Out;
$Replacing = Array_ToLine($WorkComplite, '%'); #------------------------------------------------- $Tr = new Tag('TR'); #------------------------------------------------- foreach ($Childs as $Child) { #----------------------------------------------- $Td = clone $Child; #----------------------------------------------- foreach (Array_Keys($Replacing) as $Pattern) { #--------------------------------------------- $String = $Replacing[$Pattern] ? $Replacing[$Pattern] : '-'; #--------------------------------------------- $Td->Text = Str_Replace($Pattern, $String, $Td->Text); } #----------------------------------------------- $Tr->AddChild($Td); } #------------------------------------------------- $DOM->AddChild('WorksComplite', $Tr); break; default: return ERROR | @Trigger_Error(101); } } #------------------------------------------------------- $DOM->Delete('WorkComplite'); #------------------------------------------------------- $Comp = Comp_Load('Formats/WorkComplite/Report/Number', $ContractID, $Month); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); }
$Links[$LinkID] =& $Image; #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, $Collation['Prompt']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- unset($Links[$LinkID]); #------------------------------------------------------------------------------- $Div1 = new Tag('DIV', $Image, new Tag('DIV', array('style' => 'margin:0 0 0 3px; width:145px; white-space:nowrap; overflow:hidden;'), $Collation['Description'])); #------------------------------------------------------------------------------- $List->AddChild(new Tag('LI', array('class' => 'pp-rounded-5px'), $Div1)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Div->AddChild($List); #------------------------------------------------------------------------------- $Table[] = $Div; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => 'PaymentSystemID', 'type' => 'hidden', 'value' => '')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form->AddChild($Comp); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Count = DB_Count('BasketOwners', array('Where' => SPrintF('`ContractID` = %u', $Contract['ID'])));
$Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => isset($GLOBALS['__USER']['IsEmulate']) ? "javascript:ShowConfirm('Вы действительно хотите написать в тикет от чужого имени?','TicketAddMessage();');" : 'TicketAddMessage();', 'value' => 'Добавить')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div = new Tag('DIV', $Comp, new Tag('SPAN', 'и')); #------------------------------------------------------------------------------- if ($__USER['ID'] == $Ticket['UserID']) { # is ordinar user #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => 'Flags', 'type' => 'checkbox', 'value' => 'Closed')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div->AddChild(new Tag('NOBODY', $Comp, new Tag('SPAN', array('style' => 'cursor:pointer;', 'onclick' => 'ChangeCheckBox(\'Flags\'); return false;'), 'закрыть запрос (проблема решена)'))); #------------------------------------------------------------------------------- } else { # user -> support #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Positions = $Config['Edesks']['Flags']; #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Select', array('name' => 'Flags'), $Positions, $Ticket['Flags']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div->AddChild(new Tag('NOBODY', $Comp)); #-------------------------------------------------------------------------------
$Columns = array('ID', 'Name', 'ServersGroupID', 'Comment', 'CostMonth', 'CostInstall', 'disklimit', 'ncpu', 'cpu', 'mem', '(SELECT `Name` FROM `ServersGroups` WHERE `ServersGroups`.`ID` = `ServersGroupID`) as `ServersGroupName`', '(SELECT `Comment` FROM `ServersGroups` WHERE `ServersGroups`.`ID` = `ServersGroupID`) as `ServersGroupComment`', '(SELECT `SortID` FROM `ServersGroups` WHERE `ServersGroups`.`ID` = `ServersGroupID`) as `ServersGroupSortID`'); #------------------------------------------------------------------------- $VPSSchemes = DB_Select($UniqID, $Columns, array('SortOn' => array('ServersGroupSortID', 'SortID'), 'Where' => "`IsActive` = 'yes'")); #------------------------------------------------------------------------- switch (ValueOf($VPSSchemes)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('VPS_SCHEMES_NOT_FOUND', 'Тарифные планы на виртуальные сервера не определены'); case 'array': #--------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #--------------------------------------------------------------------- $Tr = new Tag('TR'); #--------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('class' => 'Head', 'colspan' => 2), 'Тариф')); $Tr->AddChild(new Tag('TD', array('class' => 'Head', 'align' => 'center'), 'Цена в мес.')); $Tr->AddChild(new Tag('TD', array('class' => 'Head', 'align' => 'center'), 'Цена установки')); #--------------------------------------------------------------------- $Td = new Tag('TD', array('class' => 'Head', 'align' => 'center'), new Tag('SPAN', 'Место'), new Tag('SPAN', array('style' => 'font-weight:bold;font-size:14px;'), '?')); #--------------------------------------------------------------------- $LinkID = UniqID('Prompt'); #--------------------------------------------------------------------- $Links[$LinkID] =& $Td; #--------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, 'Размер диска'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------- $Tr->AddChild($Td);
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Attrib['Type'] == 'Hidden') { #------------------------------------------------------------------------------- $Form->AddChild($Comp); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY', new Tag('SPAN', isset($Attrib['CommentAttribs']) ? $Attrib['CommentAttribs'] : array(), $Attrib['Comment'])); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- if (isset($Attrib['Example'])) { $NoBody->AddChild(new Tag('SPAN', array('class' => 'Comment'), SPrintF('Например: %s', $Attrib['Example']))); } #------------------------------------------------------------------------------- $Table[] = array($NoBody, $Comp); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table[] = 'Служба мониторинга';
#------------------------------------------------------------------------------- $Table[] = $Comp; #------------------------------------------------------------------------------- $Comp = Comp_Load('Edesks/Panel', array('hidden')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr = new Tag('TR', $Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => "FormEdit('/API/EdeskEdit','EdeskEditForm','Добавление нового обсуждения');", 'value' => 'Добавить')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('align' => 'right'), $Comp)); #------------------------------------------------------------------------------- $Table[] = new Tag('TABLE', array('width' => '100%'), $Tr); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Standard', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddChild('Into', new Tag('FORM', array('name' => 'EdeskEditForm', 'onsubmit' => 'return false;'), $Comp)); #------------------------------------------------------------------------------- if (Is_Error($DOM->Build(FALSE))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- return array('Status' => 'Ok', 'DOM' => $DOM->Object);
switch (ValueOf($Images)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new Tag('SPAN', 'Изображений не найдено'); case 'array': #--------------------------------------------------------------------------- $Table = new Tag('TABLE', array('cellspacing' => 10)); #--------------------------------------------------------------------------- $Tr = new Tag('TR'); #--------------------------------------------------------------------------- foreach ($Images as $Image) { #------------------------------------------------------------------------- if (Count($Tr->Childs) % $Groups == 0) { #----------------------------------------------------------------------- $Table->AddChild($Tr); #----------------------------------------------------------------------- $Tr = new Tag('TR'); } #------------------------------------------------------------------------- $Size = Image_Get_Size($Image['FileData']); if (Is_Error($Size)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $Index = $Size['Height'] / $Size['Width']; #------------------------------------------------------------------------- $Height = $Width * $Index; #------------------------------------------------------------------------- $Img = new Tag('IMG', array('border' => 0, 'width' => $Width, 'height' => $Height, 'style' => 'border:1px solid #DCDCDC;cursor:pointer;', 'title' => $Image['Comment'], 'src' => SPrintF('/ClauseImage?ImageID=%u&Width=%u', $Image['ID'], $Width))); #-------------------------------------------------------------------------
# если общая сумма больше нуля - добавляем строку - иначе - смысла нет if (IntVal($Total['Summ']) > 0) { #$Table[] = $TableLine; $Table[] = $Tr; CacheManager::add($CacheID1, $Tr, 24 * 3600); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # полная статистика за год $Tr = new Tag('TR'); #------------------------------------------------------------------------------- # ячейка с датой $Tr->AddChild(new Tag('TD', array('align' => 'center', 'class' => 'Standard'), 'Итого:')); #------------------------------------------------------------------------------- $TimeBegin = MkTime(0, 0, 0, 1, 1, $Year); $TimeEnd = MkTime(23, 59, 59, 12, 31, $Year); #------------------------------------------------------------------------------- # ячейка с общей суммой за месяц $Columns = array('SUM(`Summ`) AS `Summ`'); $Where = "`StatusID` = 'Payed' AND `StatusDate` BETWEEN {$TimeBegin} AND {$TimeEnd}"; $Total = DB_Select('Invoices', $Columns, array('UNIQ', 'Where' => $Where)); switch (ValueOf($Total)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': Debug("[comp/www/Administrator/PaymentsSystemsStatistics]: общая сумма за {$Year} = " . $Total['Summ']);
} } #----------------------------------------------------------------------------- if (Count($Finded) < 1) { continue; } #----------------------------------------------------------------------------- $Tr = new Tag('TR'); #----------------------------------------------------------------------------- foreach ($Finded as $Color) { #--------------------------------------------------------------------------- if (In_Array($Color, $Colors)) { continue; } #--------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('align' => 'center', 'bgcolor' => SPrintF('#%s', $Color), 'height' => 50, 'width' => 50), $Color)); } #----------------------------------------------------------------------------- if (Count($Tr->Childs) < 1) { continue; } #----------------------------------------------------------------------------- $DOM->AddChild('Into', new Tag('H1', $HostsID)); #----------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 0, 'cellpadding' => 0), $Tr); #----------------------------------------------------------------------------- $DOM->AddChild('Into', $Table); } #------------------------------------------------------------------------------- $Out = $DOM->Build(); #-------------------------------------------------------------------------------
function String_Xml_Parse($String, $IsUseCache = TRUE) { #------------------------------------------------------------------------------- # костыль для удаления не-UTF8 символов $String = iconv('UTF-8', 'UTF-8//IGNORE', $String); #------------------------------------------------------------------------------- $Length = Mb_StrLen($String); #------------------------------------------------------------------------------- $IsUseCache = $IsUseCache && $Length > 1024; #------------------------------------------------------------------------------- if ($IsUseCache) { #------------------------------------------------------------------------------- $CacheID = SPrintF('String_XML_Parse[%s]', Md5(Crc32($String))); #------------------------------------------------------------------------------- $Result = CacheManager::get($CacheID); if ($Result) { return $Result; } } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- Debug(SPrintF('[String_XML_Parse]: парсирование строки (%u bytes)', $Length)); #------------------------------------------------------------------------------- $XmlParser = Xml_Parser_Create('UTF-8'); #------------------------------------------------------------------------------- if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_CASE_FOLDING, FALSE)) { return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_CASE_FOLDING)'); } #------------------------------------------------------------------------------- if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_SKIP_WHITE, FALSE)) { return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_SKIP_WHITE)'); } #------------------------------------------------------------------------------- if (!Xml_Parse_Into_Struct($XmlParser, $String, $Nodes)) { #------------------------------------------------------------------------------- $ByteIndex = Xml_Get_Current_Byte_Index($XmlParser); #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/auto/String.php]: xml_error_string = %s', Xml_Error_String(Xml_Get_Error_Code($XmlParser)))); #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/auto/String.php]: %s', Mb_SubStr($String, $ByteIndex - 100, $ByteIndex + 100))); #------------------------------------------------------------------------------- $Buffer = Mb_SubStr($String, 0, $ByteIndex); #------------------------------------------------------------------------------- $Line = Preg_Match_All("/(\r\n|\n)/sU", $Buffer, $Matches) + 1; #------------------------------------------------------------------------------- return new gException('XML_PARSE_ERROR', SPrintF('%s в линии %u', Xml_Error_String($XmlParser), $Line)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #----------------------------------------------------------------------------- Xml_Parser_Free($XmlParser); #----------------------------------------------------------------------------- $Root = new Tag('__ROOT__'); #----------------------------------------------------------------------------- $Links = array(&$Root); #----------------------------------------------------------------------------- foreach ($Nodes as $Node) { #--------------------------------------------------------------------------- $Current = $Links[Count($Links) - 1]; #--------------------------------------------------------------------------- switch ($Node['type']) { case 'open': #----------------------------------------------------------------------- $Tag = new Tag($Node['tag']); #----------------------------------------------------------------------- if (isset($Node['attributes'])) { $Tag->AddAttribs($Node['attributes']); } #----------------------------------------------------------------------- if (isset($Node['value'])) { #--------------------------------------------------------------------- $Value = $Node['value']; #--------------------------------------------------------------------- if (Trim($Value)) { $Tag->AddChild(new Tag('CDATA', $Value)); } } #----------------------------------------------------------------------- $Current->Childs[] = $Tag; #----------------------------------------------------------------------- $Links[] =& $Current->Childs[Count($Current->Childs) - 1]; break; case 'cdata': #----------------------------------------------------------------------- $Value = $Node['value']; #----------------------------------------------------------------------- if (Trim($Value)) { #--------------------------------------------------------------------- $Tag = new Tag('CDATA', $Value); #--------------------------------------------------------------------- $Current->Childs[] = $Tag; } break; case 'complete': #----------------------------------------------------------------------- $Tag = new Tag($Node['tag']); #----------------------------------------------------------------------- if (isset($Node['attributes'])) { $Tag->AddAttribs($Node['attributes']); } #----------------------------------------------------------------------- if (isset($Node['value'])) { $Tag->AddText($Node['value']); } #----------------------------------------------------------------------- $Current->Childs[] = $Tag; break; case 'close': Array_Pop($Links); break; default: # No more... } } #----------------------------------------------------------------------------- if ($IsUseCache) { CacheManager::add($CacheID, $Root); } #----------------------------------------------------------------------------- return $Root; }
} #------------------------------------------------------------------------------- foreach ($Notes as $Note) { #------------------------------------------------------------------------------- $MessageID = SPrintF('note_%s_%s', $GLOBALS['__USER']['ID'], SubStr(Md5(JSON_Encode($Note)), 0, 6)); #------------------------------------------------------------------------------- if (isset($_COOKIE[$MessageID])) { continue; } #------------------------------------------------------------------------------- $Comp = Comp_Load('Information', $Note, 'Warning', $MessageID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table->AddChild(new Tag('TR', new Tag('TD', $Comp))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Table->Childs = Array_Reverse($Table->Childs); #------------------------------------------------------------------------------- $Out = Count($Table->Childs) ? $Table : new Tag('NOBODY', 'No nodes...'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Out; #------------------------------------------------------------------------------- }
eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ if (Is_Error(System_Load('libs/Artichow.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Result = array('Title' => 'Распределение доходов/заказов на VPS по тарифам'); #------------------------------------------------------------------------------- if (!$IsCreate) { return $Result; } #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('P', 'Данный вид статистики содержит информацию о доходности/нагрузке каждого из имеющихся тарифов VPS за 1 месяц (30 дней)')); $NoBody->AddChild(new Tag('P', 'Суммируются цены за месяц, всех активных заказов тарифа.')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Graphs = array(); # для построения графиков на выхлопе #------------------------------------------------------------------------------- # перебираем группы серверов, ищщем те где автобалансировка не отключена $VPSSchemes = DB_Select('VPSSchemes', array('*'), array('SortOn' => 'SortID')); switch (ValueOf($VPSSchemes)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': Debug("[comp/Statistics/VPSSchemesIncome]: hosting shemes not found"); break; case 'array':
Debug(SPrintF("[comp/www/Administrator/PersonalStatistics]: Построение данных для сотрудника #%s", $UserID)); #------------------------------------------------------------------------------- $Tr = new Tag('TR'); #------------------------------------------------------------------------------- $IsAdd = FALSE; #------------------------------------------------------------------------------- # Имя сотрудника / мыло сотрудника $Employee = DB_Select('Users', array('Name', 'Email'), array('UNIQ', 'ID' => $UserID)); #------------------------------------------------------------------------------- switch (ValueOf($Employee)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': $Tr->AddChild(new Tag('TD', array('align' => 'left', 'class' => 'Standard', 'style' => 'background-color:#FDF6D3;'), $Employee['Name'])); $Tr->AddChild(new Tag('TD', array('align' => 'left', 'class' => 'Standard', 'style' => 'background-color:#B9CCDF;'), $Employee['Email'])); break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # число запросов по HTTP к биллингу $Where = array(); $Where[] = SPrintF('`UserID` = %u', $UserID); $Where[] = SPrintF('`CreateDate` BETWEEN %u AND %u', $StartDate, $FinishDate); #------------------------------------------------------------------------------- $HTTPQuery = DB_Select('RequestLog', array('COUNT(*) AS Counter'), array('UNIQ', 'Where' => $Where)); switch (ValueOf($HTTPQuery)) { case 'error':
break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- foreach ($StatusesHistory as $StatusHistory) { #------------------------------------------------------------------------------- $Tr = new Tag('TR'); #------------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Date/Extended', $StatusHistory['StatusDate']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('class' => 'Standard'), $Comp)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # для JBS-512 $Comp = Comp_Load(SPrintF('Colors/%s', $ModeID), $StatusHistory['StatusID']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Style = array('class' => 'Standard', 'style' => SPrintF('background-color:%s;', $Comp['bgcolor'])); #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Style, $Statuses[$StatusHistory['StatusID']]['Name'])); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Initiator = $GLOBALS['__USER']['IsAdmin'] ? $StatusHistory['Initiator'] : Preg_Replace('/\\s(\\(\\H+\\))$/', '', $StatusHistory['Initiator']); #-------------------------------------------------------------------------------
} #--------------------------------------------------------------------------- $Session['SchemeID'] = $SchemeID; #--------------------------------------------------------------------------- $AddingWhere =& $Template['Source']['Adding']['Where']; #--------------------------------------------------------------------------- if ($SchemeID != 'Default') { $AddingWhere[] = SPrintF('`SchemeID` = %u', $SchemeID); } #--------------------------------------------------------------------------- $Comp = Comp_Load('Form/Select', array('name' => 'SchemeID', 'onchange' => 'TableSuperReload();'), $Options, $SchemeID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $Tr->AddChild(new Tag('NOBODY', new Tag('TD', array('class' => 'Comment'), 'Тарифный план'), new Tag('TD', $Comp))); break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- $Servers = DB_Select('Servers', array('ID', 'Address'), array('Where' => '(SELECT `ServiceID` FROM `ServersGroups` WHERE `ServersGroups`.`ID` = `Servers`.`ServersGroupID`) = 40000', 'SortOn' => 'Address')); #------------------------------------------------------------------------------- switch (ValueOf($Servers)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #---------------------------------------------------------------------------
case 'exception': return new Tag('SPAN', SPrintF('Файл не найден (%s)', $FileID)); break; case 'array': #--------------------------------------------------------------------------- $FileName = $ClauseFile['FileName']; #--------------------------------------------------------------------------- $Mime = SubStr($FileName, StrRiPos($FileName, '.') + 1); #--------------------------------------------------------------------------- $Element = SPrintF('Images/Mime/%s.gif', $Mime); #--------------------------------------------------------------------------- if (Is_Error(Styles_Element($Element))) { $Element = 'Images/Mime/unknown.gif'; } #--------------------------------------------------------------------------- $Img = new Tag('IMG', array('title' => $ClauseFile['Comment'], 'border' => 0, 'width' => 48, 'height' => 48, 'src' => SPrintF('SRC:{%s}', $Element))); #--------------------------------------------------------------------------- $Table = new Tag('TABLE', new Tag('TR', new Tag('TD', array('align' => 'center'), new Tag('A', array('class' => 'Image', 'href' => SPrintF('/ClauseFileDownload?ClauseFileID=%s', $ClauseFile['ID'])), $Img)))); #--------------------------------------------------------------------------- $Comp = Comp_Load('Formats/String', $FileName, 10); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $Table->AddChild(new Tag('TR', new Tag('TD', array('align' => 'center'), new Tag('FONT', array('size' => '1'), $Comp)))); #--------------------------------------------------------------------------- return $Table; default: return ERROR | @Trigger_Error(101); } #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!$UserNotice['UserNotice']) { $Comp->AddAttribs(array('disabled' => 'true')); } #------------------------------------------------------------------------------- $Div = new Tag('DIV', array('align' => 'right'), $Comp); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => 'NoticeEdit();', 'value' => 'Изменить')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Div->AddChild($Comp); #------------------------------------------------------------------------------- $Table[] = $Div; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Standard', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form = new Tag('FORM', array('name' => 'NoticeEditForm', 'onsubmit' => 'return false;', 'OnKeyPress' => 'ctrlEnterEvent(event) && NoticeEdit();'), $Comp); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => 'TableID', 'type' => 'hidden', 'value' => $TableID)); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500);
#--------------------------------------------------------------------------- $Option = new Tag('OPTION', array('value' => $OptionID), $Options[$OptionID]); #--------------------------------------------------------------------------- if (!Is_Null($SelectedIDs)) { #------------------------------------------------------------------------- if (!Is_Array($SelectedIDs)) { $SelectedIDs = array($SelectedIDs); } #------------------------------------------------------------------------- if (In_Array($OptionID, $SelectedIDs)) { $Option->AddAttribs(array('selected' => 'true')); } } #--------------------------------------------------------------------------- if (!Is_Null($DisabledIDs)) { #------------------------------------------------------------------------- if (!Is_Array($DisabledIDs)) { $DisabledIDs = array($DisabledIDs); } #------------------------------------------------------------------------- if (In_Array($OptionID, $DisabledIDs)) { $Option->AddAttribs(array('disabled' => 'true')); } } } #----------------------------------------------------------------------------- $Select->AddChild($Option); } #------------------------------------------------------------------------------- return $Select; #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # проверяем наличие заполненного профиля $Where = array('`UserID` = @local.__USER_ID', '`TypeID` != "Default"', '`StatusID` = "Complite" OR `StatusID` = "Public"'); $Profiles = DB_Select('Contracts', array('*'), array('Where' => $Where)); #------------------------------------------------------------------------------- switch (ValueOf($Profiles)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': #------------------------------------------------------------------------------- # нету подходящих профилей $NoBody->AddHTML(TemplateReplace('Notes.User.OrdersTransfer.Contracts', $Params)); $NoBody->AddChild(new Tag('STRONG', new Tag('A', array('href' => "javascript:ShowWindow('/ContractMake');"), '[создать договор]'))); #------------------------------------------------------------------------------- $Result[] = $NoBody; #------------------------------------------------------------------------------- return $Result; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'array': # No more... break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $NoBody->AddHTML(TemplateReplace('Notes.User.OrdersTransfer.Message', $Params));
/******************************************************************************/ /******************************************************************************/ $Table = new Tag('TABLE', array('class' => 'Standard')); #------------------------------------------------------------------------------- for ($i = 1; $i < Count($__args__); $i++) { #----------------------------------------------------------------------------- $__arg__ = $__args__[$i]; #----------------------------------------------------------------------------- if (Is_Array($__arg__)) { if (Array_Key_Exists('cellspacing', $__arg__)) { $CellSpacing = 1; } #----------------------------------------------------------------------------- $Table->AddAttribs($__arg__); } else { $Table->AddChild(new Tag('CAPTION', $__arg__)); } } #------------------------------------------------------------------------------- if (!isset($CellSpacing)) { $Table->AddAttribs(array('cellspacing' => 5)); } #------------------------------------------------------------------------------- $Max = 1; #------------------------------------------------------------------------------- foreach ($Rows as $Row) { #----------------------------------------------------------------------------- $Count = Count($Row); #----------------------------------------------------------------------------- if ($Count > $Max) { $Max = $Count;
#----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'submit', 'value' => 'Обновить')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Table[] = $Comp; #----------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Standard', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Form = new Tag('FORM', array('name' => 'LogsForm', 'action' => 'LogScan', 'target' => 'LogScan', 'method' => 'POST'), $Comp); #----------------------------------------------------------------------------- $NoBody->AddChild($Form); #----------------------------------------------------------------------------- $IFrame = new Tag('IFRAME', array('name' => 'LogScan', 'src' => '/Administrator/LogScan?Log=http-send.log', 'width' => '100%', 'height' => '240px'), 'Загрузка...'); #----------------------------------------------------------------------------- $NoBody->AddChild($IFrame); } else { #----------------------------------------------------------------------------- $Comp = Comp_Load('Information', 'Логи системы пока еще не ведутся.', 'Notice'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $NoBody->AddChild($Comp); } #------------------------------------------------------------------------------- #$Comp = Comp_Load('Tab','Administrator/Billing',$NoBody);
/******************************************************************************/ if (Is_Error(System_Load('libs/Artichow.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Result = array('Title' => 'Планирование поступлений по VPS'); #------------------------------------------------------------------------------- $MonthsNames = array('Декабрь', 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'); #------------------------------------------------------------------------------- if (!$IsCreate) { return $Result; } #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('P', 'Данный вид аналитики позволяет произвести планирование будущих поступлений по заказам VPS, продление которых предполагается в будущем.')); #------------------------------------------------------------------------------- $Query = "CREATE TEMPORARY TABLE `%s`(\n `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n `OrderID` int(11),\n `Customer` text,\n `Login` char(20),\n `Domain` char(100),\n `ExpirationDate` int(11),\n `MinDaysPay` int(6),\n `CostDay` float(6,2),\n `ContractID` int(11),\n `Balance` float(7,2)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8"; #------------------------------------------------------------------------------- $UniqID = UniqID('ID'); #------------------------------------------------------------------------------- $IsQuery = DB_Query(SPrintF($Query, $UniqID)); if (Is_Error($IsQuery)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Epoches = 3; #------------------------------------------------------------------------------- $Incomes = array(); #------------------------------------------------------------------------------- $Orders = DB_Select(array('VPSOrders', 'Orders', 'Contracts'), array('ContractID', 'Balance', 'OrderID', 'Customer', 'Login', 'Domain', '(UNIX_TIMESTAMP() + `DaysRemainded`*86400) as `ExpirationDate`', '(SELECT `MinDaysPay` FROM `VPSSchemes` WHERE `VPSSchemes`.`ID` = `VPSOrders`.`SchemeID`) as `MinDaysPay`', '(SELECT `CostDay` FROM `VPSSchemes` WHERE `VPSSchemes`.`ID` = `VPSOrders`.`SchemeID`) as `CostDay`'), array('Where' => SPrintF('(UNIX_TIMESTAMP() + `DaysRemainded`*86400) < %u AND `Orders`.`ID` = `VPSOrders`.`OrderID` AND `Contracts`.`ID` = `Orders`.`ContractID`', MkTime(0, 0, 1, Date('n') + $Epoches)), 'SortOn' => 'ExpirationDate'));
#------------------------------------------------------------------------------- $Where = SPrintF('`%s` < %u', $ColumnID, MkTime(23, 59, 59, Date('n', $Date2), Date('j', $Date2), Date('Y', $Date2))); #------------------------------------------------------------------------------- $Template['Source']['Adding']['Where'][] = $Where; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Tr = new Tag('TR', new Tag('TD', 'С даты')); #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s1', $ColumnID), $Date1 ? $Date1 : Time() - 189216000); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Comp)); #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', 'по дату')); #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s2', $ColumnID), $Date2 ? $Date2 : Time()); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Comp)); #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('onclick' => 'TableSuperReload();', 'type' => 'button', 'value' => 'Вывести')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------------
eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ if (Is_Error(System_Load('libs/Artichow.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Result = array('Title' => 'Распределение доходов по серверам'); #------------------------------------------------------------------------------- if (!$IsCreate) { return $Result; } #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('P', 'Данный вид статистики содержит информацию о доходности каждого из имеющихся серверов за 1 месяц (30 дней)')); $NoBody->AddChild(new Tag('P', 'Суммируются цены за месяц тарифов всех активных заказов размещенных на сервере.')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Graphs = array(); # для построения графиков на выхлопе #------------------------------------------------------------------------------- # перебираем группы серверов $ServersGroups = DB_Select('ServersGroups', array('*'), array('SortOn' => 'SortID')); switch (ValueOf($ServersGroups)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': Debug("[comp/Statistics/ServersIncome]: no groups found"); break; case 'array':
} #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'button', 'onclick' => 'form.submit();', 'value' => 'Сформировать')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = $Comp; #------------------------------------------------------------------------------- $Table[] = new Tag('IFRAME', array('height' => 120, 'width' => '100%', 'name' => 'Statistics'), 'Загрузка...'); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Standard', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form = new Tag('FORM', array('target' => 'Statistics', 'method' => 'POST', 'onsubmit' => 'return false;'), $Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('type' => 'hidden', 'name' => 'IsCreate', 'value' => 'yes')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form->AddChild($Comp); #------------------------------------------------------------------------------- $DOM->AddChild('Into', $Form); #------------------------------------------------------------------------------- $Out = $DOM->Build(); #------------------------------------------------------------------------------- return $Out; #-------------------------------------------------------------------------------
case 'exception': # No more... break; case 'array': #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 5), new Tag('CAPTION', 'Сейчас в сети')); #------------------------------------------------------------------------------- $Block = new Tag('TR'); #------------------------------------------------------------------------------- foreach ($Users as $User) { #------------------------------------------------------------------------------- $Block->AddHTML(TemplateReplace('www.TicketEdit', $User)); #------------------------------------------------------------------------------- if (Count($Block->Childs) % 2 == 0) { #------------------------------------------------------------------------------- $Table->AddChild($Block); #------------------------------------------------------------------------------- $Block = new Tag('TR'); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (Count($Block->Childs)) { $Table->AddChild($Block); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', array('valign' => 'top'), $Table)); #------------------------------------------------------------------------------- break; #-------------------------------------------------------------------------------