public static function get_list_with_session($session_id) { $session = session::get_session($session_id); if ($session->is_valid()) { $user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id)); if ($user !== null && $user->id !== null && $user->id !== "") { if ($user->has_group(session::GROUP_METADATA) === true) { $metadata_list = ormlib::get_list_from_instance(new metadata()); $mw_list = array(); for ($i = 0; $i < count($metadata_list); $i++) { $md = $metadata_list[$i]; $mw = new metadata_wrapper($md); $mw->metadata_field_list = ormlib::get_list_from_instance(new metadata_field(), array("metadata_id"), array($md->id)); for ($j = 0; $j < count($mv->metadata_field_list); $j++) { $mw->metadata_field_selection[] = ormlib::get_list_from_instance(new metadata_field_selection(), array("metadata_field_id"), array($mv->metadata_field_list[$j]->id)); } $mw->metadata_table_list = ormlib::get_list_from_instance(new metadata_table(), array("metadata_id"), array($md->id)); $mw->metadata_table_relation = ormlib::get_list_from_instance(new metadata_table_relation(), array("metadata_id"), array($md->id)); $mw->metadata_relation = array_merge($mv->metadata_relation, ormlib::get_list_from_instance(new metadata_table_relation(), array("metadata_id1"), array($md->id))); $mw->metadata_relation = array_merge($mv->metadata_relation, ormlib::get_list_from_instance(new metadata_table_relation(), array("metadata_id2"), array($md->id))); $mw_list[] = $mw; } return $mw_list; } } } return null; }
public static function check_and_remove($session_id, $user_id, $group_id) { $session = session::get_session($session_id); if ($session != null && $session->is_valid()) { $user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id)); if ($user->has_group(session::GROUP_METADATA) === true) { if ($user_id != "" && $group_id != "" && $user_id * 1 > 0 && $group_id * 1 > 0) { ormlib::remove_from_instance(new user_group(), "`user_id` = {$user_id} and `group_id` = {$group_id}"); return array("response" => "OK"); } else { return array("response" => "error", "message" => "user_id or group_id is empty or zero."); } } } return array("response" => "error", "message" => "no privileg"); }
public static function load_structur_with_session($id, $session_id) { global $dbconnection; $object = new report(); $reportlist = $object->get_list_with_session($session_id); $found = false; for ($i = 0; $i < count($reportlist); $i++) { if ($reportlist[$i]->id * 1 === $id * 1) { $object = $reportlist[$i]; $found = true; } } if ($found === false) { return null; } $rw = new report_wrapper(); $rw->id = $object->id; $rw->name = $object->name; $rw->report_element_list = ormlib::get_list_from_instance(new report_element(), array("report_id"), array($id)); for ($i = 0; $i < count($rw->report_element_list); $i++) { $rw->report_element_field_list = array_merge($rw->report_element_field_list, ormlib::get_list_from_instance(new report_element_field(), array("report_element_id"), array($rw->report_element_list[$i]->id))); } for ($i = 0; $i < count($rw->report_element_field_list); $i++) { $rw->report_element_metadata_mapping[] = ormlib::get_from_instance(new metadata_field(), array("id"), array($rw->report_element_field_list[$i]->metadata_field_id)); } $help = ormlib::get_list_from_instance(new report_metadata_condition(), array("report_id"), array($rw->id)); for ($i = 0; $i < count($help); $i++) { $rw->report_metadata_field_condition[] = ormlib::get_from_instance(new metadata_field(), array("id"), array($help[$i]->metadata_field_id)); $table = ormlib::get_from_instance(new metadata_table(), array("id"), array($rw->report_metadata_field_condition[$i]->metadata_table_id)); $values = array(); if ($rw->report_metadata_field_condition[$i]->type * 1 === 1) { $result = $dbconnection->do_query_data_response("select " . $rw->report_metadata_field_condition[$i]->name_in_table . " from " . $table->name . " group by " . $rw->report_metadata_field_condition[$i]->name_in_table); while ($myrow = mysql_fetch_array($result)) { $values[] = $myrow[0]; } } $rw->report_values[$rw->report_metadata_field_condition[$i]->name] = $values; } return $rw; }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); if ($session->is_valid()) { ormlib::remove_from_instance(new user_settings(), "user_id = '" . $session->user_id . "'"); $user_settings = $_REQUEST["user_settings"]; for ($i = 0; $i < count($user_settings); $i++) { $users = new user_settings(); $users->user_id = $session->user_id; $users->key_value = $user_settings[$i]["key"]; $users->value = $user_settings[$i]["value"]; $users->insert(); } echo true; }
public function __construct() { parent::__construct("session", "id"); }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); $user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id)); if ($session->is_valid() === true && $user->has_group(session::GROUP_METADATA) === true) { $metadata_table = new metadata_table(); $metadata_table->name = $_REQUEST["table_name"]; $metadata_table->metadata_id = $_REQUEST["metadata_id"]; $metadata_table->id = $_REQUEST["table_id"]; if ($_REQUEST["table_id"] !== "-1") { $metadata_table->update(); } else { $metadata_table->insert(); } echo json_encode($metadata_table); } else { echo "no privileg"; }
function __construct() { parent::__construct("metadata_table_relation", "id"); }
if ($rw !== null && $rw->id !== "") { $values = array(); for ($i = 0; $i < count($rw->report_element_list); $i++) { $element_fields = array(); for ($j = 0; $j < count($rw->report_element_field_list); $j++) { if ($rw->report_element_list[$i]->id * 1 === $rw->report_element_field_list[$j]->report_element_id * 1) { $element_fields[] = $rw->report_element_field_list[$j]; } } $field = null; for ($j = 0; $j < count($rw->report_element_metadata_mapping); $j++) { if ($rw->report_element_metadata_mapping[$j]->id * 1 === $element_fields[0]->metadata_field_id * 1) { $field = $rw->report_element_metadata_mapping[$j]; } } $table = ormlib::get_from_instance(new metadata_table(), array("id"), array($field->metadata_table_id)); $query_elements = query::get_query_elements($table->metadata_id, $element_fields); for ($j = 0; $j < count($field_list_key); $j++) { $metadata_field = report_wrapper::get_from_instance(new metadata_field(), array("id"), array($field_list_key[$j])); $metadata_table = report_wrapper::get_from_instance(new metadata_table(), array("id"), array($metadata_field->metadata_table_id)); if ($metadata_table->id * 1 !== $table->metadata_id) { $query_elements1 = query::get_query_elements($metadata_table->metadata_id); $query_elements["from"] = array_merge($query_elements["from"], $query_elements1["from"]); $query_elements["relations"] = array_merge($query_elements["relations"], $query_elements1["relations"]); } } //Get Datastructur for Query for metadata $query_fields = implode($query_elements["fields"], ","); $query_from = implode($query_elements["from"], ","); $query_elements["relations"] = array_merge($query_elements["relations"], query::get_field_relations($field_list_key, $field_list_value)); $query_elements["relations"] = array_merge($query_elements["relations"], query::get_meta_relations($field_list_key, $table->metadata_id));
function __construct() { parent::__construct("user_settings", "id"); }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); if ($session->is_valid()) { echo json_encode(ormlib::get_list_from_instance(new user_settings(), array("user_id"), array($session->user_id))); }
function __construct() { parent::__construct("report_metadata_condition", "id"); }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); $user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id)); if ($session->is_valid() === true && $user->has_group(session::GROUP_METADATA) === true) { $metadata_field = ormlib::get_from_instance(new metadata_field(), array("id"), array($_REQUEST["field_id"])); $metadata_field->remove(); //TODO Remove more elements echo "true"; } else { echo "no privileg"; }
public static function get_meta_relations_2($metadata_field_id) { $metadata_field = ormlib::get_from_instance(new metadata_field(), array("id"), array($metadata_field_id)); $metadata_table = ormlib::get_from_instance(new metadata_table(), array("id"), array($metadata_field->metadata_table_id)); return $metadata_table->name . ".`" . $metadata_field->name_in_table . "`"; }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); if ($session->is_valid() && isset($_REQUEST["current_report"])) { ormlib::remove_from_instance(new user_settings(), "`key_value` = 'current_report'"); $users = new user_settings(); $users->user_id = $session->user_id; $users->key_value = "current_report"; $users->value = $_REQUEST["current_report"]; $users->insert(); } if ($session->is_valid() && isset($_REQUEST["current_metadata"])) { ormlib::remove_from_instance(new user_settings(), "`key_value` = 'current_metadata'"); $users = new user_settings(); $users->user_id = $session->user_id; $users->key_value = "current_metadata"; $users->value = $_REQUEST["current_metadata"]; $users->insert(); }
function __construct() { parent::__construct("report_navigation_report", "id"); }
<?php if (!defined('INTERFACE_ACCESS')) { die('Direct access not premitted'); } $session_id = $_REQUEST["session_id"]; $session = session::get_session($session_id); $user = ormlib::get_from_instance(new user(), array("id"), array($session->user_id)); if ($session->is_valid() === true && $user->has_group(session::GROUP_METADATA) === true) { $metadata_table = ormlib::get_from_instance(new metadata_table(), array("id"), array($_REQUEST["table_id"])); $metadata_table->remove(); //TODO Remove more elements echo "true"; } else { echo "no privileg"; }
public function __construct() { parent::__construct("report_privileg", "id"); }
function get_list($keys = array(), $values = array()) { return parent::get_list($keys, $values, "`index` desc"); }
function __construct() { parent::__construct("metadata_field", "id"); }