<?php /** * administer dimension level tree * * @author Juris Malinens <*****@*****.**> * @author Uldis Nelsons <*****@*****.**> */ use DBRisinajumi\Dimensions\Level; $sViewMode = isset($_GET['view_mode']) ? $_GET['view_mode'] : 'tree'; $sAction = isset($_GET['action']) ? $_GET['action'] : 'get_tree'; require 'init.php'; if ($sAction == 'add_root') { $sCode = $_GET['code']; $sLabel = $_GET['label']; $oLevel = new Level($Database); if (!$oLevel->addLevel(null, 1, $sCode, $sLabel, Level::VISIBLE)) { var_dump($oLevel->getErrors()); } unset($oLevel); } if ($sViewMode == 'tree') { $sTitle = "Define levels"; require 'views/header.php'; ?> <a href="?view_mode=edit">Add root level</a> <table class="dim_table"> <tr> <td id="dim_tree"></td> <td id="dim_form"></td> </tr>
*/ use DBRisinajumi\Dimensions\Period; use DBRisinajumi\Dimensions\Data; use DBRisinajumi\Dimensions\Level; if (!isset($_REQUEST['table_id']) || !isset($_REQUEST['record_id']) || !isset($_REQUEST['amt'])) { echo "not all params provided"; exit; } require 'init.php'; $nTableId = (int) $_GET['table_id']; $nRecordId = (int) $_GET['record_id']; $nAmt = (double) $_GET['amt']; $oPeriod = new Period($Database); $oPeriod->setPeriodType('monthly'); $oData = new Data($Database, $oPeriod); $oLevel = new Level($Database); $aDimData = $oData->getDimData($nTableId, $nRecordId); //var_dump($aDimData); $sDateFrom = $sDateTo = date($oData->getUserDateFormat()); if (!empty($aDimData['date_from'])) { $sDateFrom = date($oData->getUserDateFormat(), strtotime($aDimData['date_from'])); } if (!empty($aDimData['date_to'])) { $sDateTo = date($oData->getUserDateFormat(), strtotime($aDimData['date_to'])); } $sTitle = "Set levels for items and split sums by periods"; require 'views/header.php'; ?> <form method="post" action=""> <input type="hidden" id="record_id" name="record_id" value="<?php echo $nRecordId;
* @author Uldis Nelsons <*****@*****.**> */ header('Content-Type: text/html; charset=utf-8'); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); use DBRisinajumi\Dimensions\Level; use DBRisinajumi\Dimensions\Table; use DBRisinajumi\Dimensions\Data; use DBRisinajumi\Dimensions\Period; $sAction = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'get_tree'; $nLevel = isset($_REQUEST['level']) ? (int) $_REQUEST['level'] : 1; $nParrentLevelId = isset($_REQUEST['parent_level_id']) ? (int) $_REQUEST['parent_level_id'] : 0; require 'init.php'; $nId = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $aDirectJson = array(); $oLevel = new Level($Database); $oTable = new Table($Database); switch ($sAction) { case 'get_selectbox_values': $aLevel = $oLevel->listLevel($nParrentLevelId, $nLevel); if ($nLevel < 3) { $sNextLevel = '_' . ($nLevel + 1); } else { $sNextLevel = ''; } foreach ($aLevel as $aLevelRecord) { $aData = array('title' => $aLevelRecord['code'], 'id' => $aLevelRecord['id']); if ($aLevelRecord['hidden']) { continue; } $a = array('data' => $aData, "attr" => array('id' => $aLevelRecord['id']));