本文整理汇总了PHP中DataAccess类的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess类的具体用法?PHP DataAccess怎么用?PHP DataAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetSeqNextValue
public static function GetSeqNextValue(DataAccess $dataaccess, $table_name, $col_name, $count = 1)
{
if ($count == 1) {
$ds = $dataaccess->GetData("seq", "call p_seq_nextvalue(?, ?, 0, @nextvalue)", array((string) $table_name, (string) $col_name));
return $ds["seq"]["rows"][0]["nextvalue"];
} else {
$ds = $dataaccess->GetData("seq", "call p_seq_batchvalue(?, ?, ?, 0, @nextvalue)", array((string) $table_name, (string) $col_name, (int) $count));
return $ds["seq"]["rows"][0]["nextvalue"];
}
}
示例2: userExist
public static function userExist($user)
{
$dataAccess = new DataAccess();
$data = $dataAccess->getUser($user);
if (count($data) == 0) {
return false;
} else {
return $data[0];
}
}
示例3: GetCategories
public function GetCategories()
{
if (!$this->Categories) {
$this->Categories = DataAccess::GetCategoriesByUserID($this->ID);
}
return $this->Categories;
}
示例4: Execute
public function Execute()
{
$viewData = array();
$errors = array();
if (Helper::IsLoggedInAdmin() && isset($_GET["loginAsUser"])) {
// login as a certain user and redirect to his page
if (Helper::LoginUserByUsername($_GET["loginAsUser"])) {
Helper::Redirect("index.php?" . Helper::CreateQuerystring(getCurrentUser()));
}
}
$viewData["Users"] = DataAccess::GetAllUsers(!Helper::IsLoggedInAdmin());
$viewData["LastMapForEachUser"] = DataAccess::GetLastMapsForUsers("date");
// last x maps
$numberOfMaps = isset($_GET["lastMaps"]) && is_numeric($_GET["lastMaps"]) ? (int) $_GET["lastMaps"] : (isset($_GET["lastMaps"]) && $_GET["lastMaps"] == "all" ? 999999 : 10);
$viewData["LastMaps"] = DataAccess::GetMaps(0, 0, 0, 0, null, $numberOfMaps, "createdTime", Helper::GetLoggedInUserID());
// last x comments
$numberOfComments = isset($_GET["lastComments"]) && is_numeric($_GET["lastComments"]) ? (int) $_GET["lastComments"] : (isset($_GET["lastComments"]) && $_GET["lastComments"] == "all" ? 999999 : 10);
$viewData["LastComments"] = DataAccess::GetLastComments($numberOfComments, Helper::GetLoggedInUserID());
$viewData["OverviewMapData"] = null;
$categories = DataAccess::GetCategoriesByUserID();
foreach ($viewData["LastMaps"] as $map) {
$data = Helper::GetOverviewMapData($map, false, true, true, $categories);
if ($data != null) {
$viewData["OverviewMapData"][] = $data;
}
}
if (isset($_GET["error"]) && $_GET["error"] == "email") {
$errors[] = sprintf(__("ADMIN_EMAIL_ERROR"), ADMIN_EMAIL);
}
$viewData["Errors"] = $errors;
return $viewData;
}
示例5: GetUser
public function GetUser()
{
if (!$this->User) {
$this->User = DataAccess::GetUserByID($this->UserID);
}
return $this->User;
}
示例6: GetCategory
public function GetCategory()
{
if (!$this->Category) {
$this->Category = DataAccess::GetCategoryByID($this->CategoryID);
}
return $this->Category;
}
示例7: executeDatabaseScripts
function executeDatabaseScripts()
{
$allScripts = getScripts();
$errors = array();
foreach ($allScripts as $s) {
// check whether scripts should be run
if (isset($s["conditionFunction"])) {
$f = $s["conditionFunction"];
$runScripts = $f($s["conditionData"]);
} else {
$runScripts = true;
}
if ($runScripts) {
foreach ($s["scripts"] as $script) {
mysql_query($script);
Helper::WriteToLog($script);
$error = getMySQLErrorIfAny();
if ($error) {
Helper::WriteToLog($error);
$errors[] = $error;
}
}
}
}
if (count($errors) == 0) {
DataAccess::SetSetting("DATABASE_VERSION", DOMA_VERSION);
}
return array("errors" => $errors);
}
示例8: getMapCornerPositionsAndRouteCoordinates
function getMapCornerPositionsAndRouteCoordinates($id)
{
$map = new Map();
$map->Load($id);
$user = DataAccess::GetUserByID($map->UserID);
$categories = DataAccess::GetCategoriesByUserID($user->ID);
return Helper::GetOverviewMapData($map, true, false, false, $categories);
}
示例9: Execute
public function Execute()
{
$viewData = array();
// no user specified - redirect to user list page
if (!getCurrentUser()) {
Helper::Redirect("users.php");
}
// user is hidden - redirect to user list page
if (!getCurrentUser()->Visible) {
Helper::Redirect("users.php");
}
// the requested map
$map = new Map();
$map->Load($_GET["map"]);
if (!$map->ID) {
die("The map has been removed.");
}
DataAccess::UnprotectMapIfNeeded($map);
if (Helper::MapIsProtected($map)) {
die("The map is protected until " . date("Y-m-d H:i:s", Helper::StringToTime($map->ProtectedUntil, true)) . ".");
}
if ($map->UserID != getCurrentUser()->ID) {
die;
}
$viewData["Comments"] = DataAccess::GetCommentsByMapId($map->ID);
$viewData["Name"] = $map->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($map->Date, true)) . ')';
// previous map in archive
$previous = DataAccess::GetPreviousMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
$viewData["PreviousName"] = $previous == null ? null : $previous->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($previous->Date, true)) . ')';
// next map in archive
$next = DataAccess::GetNextMap(getCurrentUser()->ID, $map->ID, Helper::GetLoggedInUserID());
$viewData["NextName"] = $next == null ? null : $next->Name . ' (' . date(__("DATE_FORMAT"), Helper::StringToTime($next->Date, true)) . ')';
$size = $map->GetMapImageSize();
$viewData["ImageWidth"] = $size["Width"];
$viewData["ImageHeight"] = $size["Height"];
DataAccess::IncreaseMapViews($map);
$viewData["Map"] = $map;
$viewData["BackUrl"] = isset($_SERVER["HTTP_REFERER"]) && basename($_SERVER["HTTP_REFERER"]) == "users.php" ? "users.php" : "index.php?" . Helper::CreateQuerystring(getCurrentUser());
$viewData["Previous"] = $previous;
$viewData["Next"] = $next;
$viewData["ShowComments"] = isset($_GET["showComments"]) && ($_GET["showComments"] = true) || !__("COLLAPSE_VISITOR_COMMENTS");
$viewData["FirstMapImageName"] = Helper::GetMapImage($map);
if ($map->BlankMapImage) {
$viewData["SecondMapImageName"] = Helper::GetBlankMapImage($map);
}
$viewData["QuickRouteJpegExtensionData"] = $map->GetQuickRouteJpegExtensionData();
if (isset($viewData["QuickRouteJpegExtensionData"]) && $viewData["QuickRouteJpegExtensionData"]->IsValid) {
$categories = DataAccess::GetCategoriesByUserID(getCurrentUser()->ID);
$viewData["OverviewMapData"][] = Helper::GetOverviewMapData($map, true, false, false, $categories);
$viewData["GoogleMapsUrl"] = "http://maps.google.com/maps" . "?q=" . urlencode(Helper::GlobalPath("export_kml.php?id=" . $map->ID . "&format=kml")) . "&language=" . Session::GetLanguageCode();
}
if (USE_3DRERUN == '1' && DataAccess::GetSetting("LAST_WORLDOFO_CHECK_DOMA_TIME", "0") + RERUN_FREQUENCY * 3600 < time()) {
$viewData["RerunMaps"] = Helper::GetMapsForRerunRequest();
$viewData["TotalRerunMaps"] = count(explode(",", $viewData["RerunMaps"]));
$viewData["ProcessRerun"] = true;
}
return $viewData;
}
示例10: getRoles
private function getRoles()
{
$rolesUsuario = new Rol();
$roles = DataAccess::selectWhere($rolesUsuario, $usuario->idUsuario);
$count = count($roles);
for ($i = 0; $i < $count; $i++) {
$rolname = NameRoles::getName($roles['id_rol_roles']);
$rolUsuario = new Rol($roles);
$rolesSession[$rolname] = $rolUsuario;
$menuSession[$rolname] = $rolname;
}
}
示例11: canuse
function canuse($pid)
{
$p = new DataAccess();
$sql = "select pid from problem where pid = {$pid} and submitable = 1";
$cnt = $p->dosql($sql);
if ($cnt == 0) {
return false;
}
if ($_SESSION['ID']) {
$sql = "SELECT * FROM submit WHERE pid = {$pid} AND uid ={$_SESSION['ID']} order by accepted desc limit 1";
$ac = $p->dosql($sql);
if ($ac) {
$e = $p->rtnrlt(0);
if ($e['accepted']) {
return false;
} else {
true;
}
}
}
return true;
}
示例12: getDependencias
protected final function getDependencias($allData = false)
{
$dependencia = new Dependencia();
$dependencias = DataAccess::selectWhere($dependencia);
if ($allData) {
return $dependencias;
}
$count = count($dependencias);
for ($index = 0; $index < $count; $index++) {
//array asociativo idempresa-nombre
$id_Dependencia[$dependencias[$index]['iddependencia']] = $dependencias[$index]['nombre'];
}
return $id_Dependencia;
}
示例13: getLineas
protected final function getLineas($allData = false)
{
$linea = new Linea();
$lineas = DataAccess::selectWhere($linea);
if ($allData) {
return $lineas;
}
$count = count($lineas);
for ($index = 0; $index < $count; $index++) {
//array asociativo idempresa-nombre
$id_Linea[$lineas[$index]['idlinea']] = $lineas[$index]['nombre'];
}
return $id_Linea;
}
示例14: getEmpresas
protected final function getEmpresas($allData = false)
{
$empresa = new Empresa();
$empresas = DataAccess::selectWhere($empresa);
if ($allData) {
return $empresas;
}
$count = count($empresas);
for ($index = 0; $index < $count; $index++) {
//array asociativo idempresa-nombre
$id_Empresa[$empresas[$index]['idempresa']] = $empresas[$index]['nombre'];
}
return $id_Empresa;
}
示例15: Execute
public function Execute()
{
$viewData = array();
// load session
session_start();
Helper::SetUser(null);
$errors = array();
// load strings
Session::SetLanguageStrings(Helper::GetLanguageStrings());
// check php version
if (version_compare(phpversion(), "5.0.0") < 0) {
$errors[] = sprintf(__("TOO_OLD_PHP_VERSION"), phpversion());
}
if (count($errors) == 0) {
if (Helper::DatabaseVersionIsValid()) {
$errors[] = __("SITE_ALREADY_CREATED");
}
if (count($errors) == 0) {
$previousDatabaseVersion = DataAccess::GetSetting("DATABASE_VERSION", "0.0");
// create or update database
$result = executeDatabaseScripts();
$errors = $result["errors"];
// chmod only has effect on linux/unix systems
@mkdir(Helper::LocalPath(MAP_IMAGE_PATH));
@chmod(Helper::LocalPath(MAP_IMAGE_PATH), 0777);
@mkdir(Helper::LocalPath(TEMP_FILE_PATH));
@chmod(Helper::LocalPath(TEMP_FILE_PATH), 0777);
if (count($errors) == 0) {
if ($previousDatabaseVersion == "0.0") {
// created databse
Helper::LogUsage("createSite", "version=" . DOMA_VERSION);
Helper::LoginAdmin(ADMIN_USERNAME, ADMIN_PASSWORD);
} else {
// updated database
Helper::LogUsage("updateSite", "oldVersion={$previousDatabaseVersion}&newVersion=" . DOMA_VERSION);
// redirect to originally requested page
$redirectUrl = $_GET["redirectUrl"];
if (!isset($redirectUrl)) {
$redirectUrl = "users.php";
}
Helper::Redirect($redirectUrl);
}
}
}
}
$viewData["Errors"] = $errors;
return $viewData;
}