Exemple #1
0
 * style_str - style string
 * styletype - stype of style change
 */
ini_set("display_errors", "1");
ini_set("display_startup_errors", "1");
include "include/dbcommon.php";
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
include "include/reportfunctions.php";
// #9875 It's expected that webreport_style table belongs to the webreport db connection
$_connection = $cman->getForWebReports();
$xml = new xml();
if (!postvalue('str_xml')) {
    echo "Error: No se han obtenido resultados. Inténtelo de nuevo.";
    exit(0);
}
$arr = $xml->xml_to_array(postvalue('str_xml'));
$repname = postvalue('repname');
if ($_POST['str_xml'] == "del_all") {
    $strSQL = "DELETE FROM " . $_connection->addTableWrappers("webreport_style") . " WHERE " . $_connection->addFieldWrappers("repname") . "=" . $_connection->prepareString($repname);
    $_connection->exec($strSQL);
    die;
}
$arrayer = array();
foreach ($arr as $key => $style_record) {
    if ($style_record['type'] == "table") {
        $strSQL = "DELETE FROM " . $_connection->addTableWrappers("webreport_style") . " WHERE (" . $_connection->addFieldWrappers("repname") . "=" . $_connection->prepareString($repname) . " AND " . $_connection->addFieldWrappers("styletype") . "='" . $style_record['params']['styleType'] . "')";
        $_connection->exec($strSQL);
    }
    if ($style_record['type'] == "group") {
        if ($style_record['params']['groupName'] != 0) {
            $strSQL = "DELETE FROM " . $_connection->addTableWrappers("webreport_style") . " WHERE (" . $_connection->addFieldWrappers("group") . " = " . (0 + $style_record["params"]["groupName"]) . " AND " . $_connection->addFieldWrappers("repname") . "=" . $_connection->prepareString($repname) . " AND " . $_connection->addFieldWrappers("styletype") . "='" . $style_record["params"]["styleType"] . "' AND (" . $_connection->addFieldWrappers("type") . "='cell' OR " . $_connection->addFieldWrappers("type") . "='group'))";
require_once "include/dbcommon.php";
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
require_once "classes/charts.php";
require_once getabspath("include/xml.php");
require_once getabspath("classes/searchclause.php");
if (!isLogged()) {
    Security::saveRedirectURL();
    HeaderRedirect("login", "", "message=expired");
    return;
}
$xml = new xml();
$chrt_strXML = "";
if (checkTableName(postvalue("chartname"), titCHART)) {
    include_once "include/" . postvalue("chartname") . "_variables.php";
    $chrt_strXML = GetChartXML(postvalue("chartname"));
    $chrt_array = $xml->xml_to_array($chrt_strXML);
    $_SESSION["webobject"]["table_type"] = "project";
    $_SESSION["object_sql"] = "";
}
$webchart = false;
if (!$chrt_strXML) {
    $sessPrefix = "webchart" . postvalue('cname');
    $chrt_strXML = LoadSelectedChart(postvalue('cname'));
    $webchart = true;
    $chrt_array = $xml->xml_to_array($chrt_strXML);
    if (is_wr_project()) {
        include_once "include/" . $chrt_array['settings']['short_table_name'] . "_variables.php";
    }
}
$param = array();
$param["webchart"] = $webchart;
Exemple #3
0
 /**
  * 将XMLL               字符串或文件转为数组
  * @param string $xml   XML字符串或XML文件
  * @return array        解析后的数组
  */
 public function xml_to_array($xml)
 {
     return xml::xml_to_array($xml);
 }
Exemple #4
0
function GetReportsList()
{
    $connection = getWebreportConnection();
    // #9875
    $xml = new xml();
    $arr = array();
    $arrUserGroup = GetUserGroup();
    $strSQL = "SELECT " . $connection->addFieldWrappers("rpt_name") . ", " . $connection->addFieldWrappers("rpt_title") . ", " . $connection->addFieldWrappers("rpt_owner") . ", " . $connection->addFieldWrappers("rpt_status") . ", " . $connection->addFieldWrappers("rpt_content") . " FROM " . $connection->addTableWrappers("webreports") . " WHERE " . $connection->addFieldWrappers("rpt_type") . " = 'report' order by " . $connection->addFieldWrappers("rpt_title");
    $qResult = $connection->query($strSQL);
    while ($row = $qResult->fetchNumeric()) {
        $report_arr = $xml->xml_to_array(escapeEntities($row[4]));
        $view = 0;
        $edit = 0;
        if (isset($report_arr['permissions'])) {
            foreach ($report_arr['permissions'] as $arr_prm) {
                if (in_array($arr_prm['id'], $arrUserGroup)) {
                    $view = $arr_prm['view'] == "true" ? 1 : 0;
                    $edit = $arr_prm['edit'] == "true" ? 1 : 0;
                }
            }
        } else {
            $view = 1;
        }
        if (!$report_arr["tmp_active"]) {
            $arr[] = array("name" => $row[0], "title" => $row[1], "owner" => $row[2], "status" => $row[3], "view" => $view, "edit" => $edit);
        }
    }
    return $arr;
}
function GetReportsList() {
	global $conn;

	$xml = new xml();
	$arr=array();
	$strSQL = "SELECT ".AddFieldWrappers("rpt_name").", ".AddFieldWrappers("rpt_title").", ".AddFieldWrappers("rpt_owner").", ".AddFieldWrappers("rpt_status").", ".AddFieldWrappers("rpt_content");
	$strSQL .= " FROM ".AddTableWrappers("webreports")." WHERE ".AddFieldWrappers("rpt_type")." = 'report' order by ".AddFieldWrappers("rpt_title");
	$rsReport = db_query($strSQL,$conn);
	
	$arrUserGroup = GetUserGroup();
	while( $row = db_fetch_numarray( $rsReport ) ) {
		$report_arr = $xml->xml_to_array( escapeEntities($row[4]) );
        $view = 0;
		$edit = 0;

		if ( isset($report_arr['permissions']) ) {
			foreach ( $report_arr['permissions'] as $arr_prm ) {
				if (in_array($arr_prm['id'], $arrUserGroup)) {
					$view = ( $arr_prm['view'] == "true" ) ? 1 : 0;
					$edit = ( $arr_prm['edit'] == "true" ) ? 1 : 0;
				}
			}
		}
		else
		{
			$view=1;
		}

		if(!$report_arr["tmp_active"])
		{
		$arr[] = array(
			"name"		=> $row[0],
			"title"		=> $row[1],
			"owner"		=> $row[2],
			"status"	=> $row[3],
			"view"		=> $view,
			"edit"		=> $edit
		);
	}
	}
	
	return $arr;
}