示例#1
0
文件: tabs.php 项目: kimblemj/server
 public static function getTabsForGame($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $sql_tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE game_id = '{$pack->game_id}' ORDER BY sort_index");
     $tabs = array();
     for ($i = 0; $i < count($sql_tabs); $i++) {
         if ($ob = tabs::tabObjectFromSQL($sql_tabs[$i])) {
             $tabs[] = $ob;
         }
     }
     return new return_package(0, $tabs);
 }
示例#2
0
 public static function deleteWebPage($pack)
 {
     $webpage = dbconnection::queryObject("SELECT * FROM web_pages WHERE web_page_id = '{$pack->web_page_id}'");
     $pack->auth->game_id = $webpage->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM web_pages WHERE web_page_id = '{$pack->web_page_id}' LIMIT 1");
     //cleanup
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_WEB_PAGE' AND link_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'WEB_PAGE' AND object_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_WEB_PAGE' AND content_id = '{$pack->web_page_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
 public function buildNuevo($inputs, $opcion = "")
 {
     //@session_start();
     $html = $this->getCSS();
     $html .= "<form name='{$this->identificador}_name' id='{$this->identificador}_id' class='{$this->identificador}_class' method='POST'  enctype='multipart/form-data'>";
     $html .= "<div id='form_container_{$this->identificador}' >";
     /***/
     $content = array();
     if (count($this->tabs) != 0) {
         foreach ($this->tabs as $clave => $valor) {
             $content[$clave] = "";
         }
     } else {
         $content['default'] = "";
     }
     foreach ($inputs as $clave) {
         $tab = $this->input[$clave]['tab'];
         $content[$tab] .= "\t<div class='form_input' id='form_" . $this->input[$clave]['name'] . "' name='" . $this->input[$clave]['name'] . "'>";
         $content[$tab] .= "\t<div class='form_input_label'>";
         $content[$tab] .= $this->input[$clave]['ayuda'] != "" ? "<img class='tooltip' src='grafico/help.png' title='{$this->input[$clave]['ayuda']}'/>" : "";
         $content[$tab] .= $this->input[$clave]['etiqueta'];
         $content[$tab] .= "\t</div>";
         $content[$tab] .= "\t<div class='form_input_input'>";
         if ($this->input[$clave]['input'] != "") {
             $content[$tab] .= $this->input[$clave]['input'];
         } else {
             $content[$tab] .= $this->pintarInput($this->input[$clave]['name'], $this->input[$clave]['clase'], $this->input[$clave]['tipo'], $this->input[$clave]['complemento'], $this->input[$clave]['value'], $this->input[$clave]['data'], $this->input[$clave]['ayuda']);
         }
         $content[$tab] .= "\t</div>";
         $content[$tab] .= "</div>";
     }
     /***/
     if (count($this->tabs) != 0) {
         include_once $this->configuracion["raiz_documento"] . $this->configuracion["clases"] . "/tabs.class.php";
         $tabs = new tabs($this->configuracion);
         $tabs->addJquery = FALSE;
         foreach ($content as $clave => $valor) {
             $tabs->tab($valor, $this->tabs[$clave]);
         }
         $html .= $tabs->armar_tabs($this->configuracion);
     } else {
         $html .= $content['default'];
     }
     if ($this->captcha == true) {
         $html .= $this->imprimirCaptcha($this->configuracion);
     }
     $html .= "<input type='hidden' name='action' value='" . $this->action . "'>";
     switch ($opcion) {
         case "filtrar":
             $html .= "<div class='form_input' id='form_submit_{$this->identificador}'>";
             $html .= "\t<input class='SUBMIT' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' type='SUBMIT' value='CONSULTAR'/>";
             $html .= "</div>";
             $html .= "<input type='hidden' name='opcion' value='filtrar'>";
             break;
         case "enviar":
             $html .= "<div class='form_input' id='form_submit_{$this->identificador}'>";
             $html .= "\t<input class='SUBMIT' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' type='SUBMIT' value='ENVIAR'/>";
             $html .= "</div>";
             $html .= "<input type='hidden' name='opcion' value='consultar'>";
             break;
         default:
             $html .= "<div class='form_input' id='form_submit_{$this->identificador}'>";
             $html .= "\t<input class='SUBMIT' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' type='SUBMIT' value='GUARDAR'/>";
             $html .= "</div>";
             $html .= "<input type='hidden' name='opcion' value='insertar'>";
             break;
     }
     $html .= "</div>";
     $html .= "</form>";
     return $html;
 }
示例#4
0
    $edituser = db()->id_get('user_data', $_GET['profil']);
    $uri = MODUL_SELF . '&profil=' . $edituser['id'];
    $userprofil = new data_options('user_details', $profilInfo, array('user' => $edituser['id']));
    if (isset($_POST['options'])) {
        $userprofil->saveData();
        throw new redirect($uri);
    }
    $form = $userprofil->getForm($uri);
    $form->linkbutton('Abbrechen', MODUL_SELF);
    $grid[1]->box($form, 'Profil', '500px');
} elseif (empty($_GET['edit']) || !$modulrights['edit']) {
    $grid[1]->box($rc->get_create(), 'User erstellen');
} else {
    $form = $rc->get_edit($_GET['edit']);
    $edituser = db()->id_get('user_data', $_GET['edit']);
    $tabs = new tabs();
    $uri = MODUL_SELF . '&edit=' . $edituser['id'];
    if ($modulrights['password']) {
        $i++;
        if (!empty($_POST['pass_new']) && $_POST['pass_new'] == $_POST['pass_rep']) {
            $pass = session_iv::crypt($_POST['pass_new'], $salt = uniqid());
            db()->id_update('user_data', array('pass_type' => 0, 'pass_hash' => $pass, 'pass_salt' => $salt), $_GET['edit']);
            $msg = alert('Passwort geändert.', 'success');
        }
        $passform = new form_renderer($uri . '#tabs-' . $i . '-hash');
        $passform->password('pass_new', 'Neues Passwort');
        $passform->password('pass_rep', 'Passwort Wiederholung');
        $tabs->add('Password', $msg . $passform);
    }
    if ($modulrights['rights']) {
        $i++;
 function pintarForm($configuracion, $opcion = array("form1" => "nuevo", "form2" => "nuevo", "form3" => "nuevo"))
 {
     include_once $configuracion["raiz_documento"] . $configuracion["clases"] . "/tabs.class.php";
     $form1 = $this->armarForm1($configuracion);
     $form2 = $this->armarForm2($configuracion);
     $form3 = $this->armarForm3($configuracion);
     $html1 = $form1->buildForm($this->usuario, $opcion['form1']);
     $html2 = $form2->buildForm($this->usuario, $opcion['form2']);
     $html3 = $form3->buildForm($this->usuario, $opcion['form3']);
     $tabs = new tabs($configuracion);
     $tabs->addJquery = FALSE;
     $tabs->tab($html1, "Informaci&oacute;n. B&aacute;sica");
     $tabs->tab($html2, "Actividad Comercial");
     $tabs->tab($html3, "Descripción Servicio o Producto");
     $html = $tabs->armar_tabs($configuracion);
     return $html;
 }
示例#6
0
 public static function getTabsForPlayer($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $gameTabs = tabs::getTabsForGame($pack)->data;
     $playerTabs = array();
     for ($i = 0; $i < count($gameTabs); $i++) {
         $gameTabs[$i]->user_id = $pack->auth->user_id;
         if (requirements::evaluateRequirementPackage($gameTabs[$i])) {
             $playerTabs[] = $gameTabs[$i];
         }
     }
     return new return_package(0, $playerTabs);
 }
示例#7
0
$my = $authClass->isAdmin() ? "" : " my";
define("PP_PENDING", "manage" . $my . " pending preprints");
define("PP_ALL", "manage all" . $my . " preprints");
/*
 * draw tabs
 */
$links = array();
if ($pendingHash = getPendingPreprints()) {
    $links[PP_PENDING] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_PENDING);
}
if ($allHash = getAllPreprints()) {
    if ($dbClass->num_rows($pendingHash) != $dbClass->num_rows($allHash)) {
        $links[PP_ALL] = $_SERVER["PHP_SELF"] . "?show=" . urlencode(PP_ALL);
    }
}
$tabs = new tabs();
$tabs->show($links);
$t = new table("cellpadding='5'", "</center>");
if ($authClass->isAdmin() && $tabs->active == PP_ALL) {
    // provide the "year selection" option
    for ($i = $nor_pp_year0; $i <= $year; $i++) {
        $sel[] = x("option" . ($i == $nor_pp_period ? " selected='selected'" : ""), $i);
    }
    $t->tr("", "colspan='9'", x("form action='" . $links[$tabs->active] . "' method='post'", x("b", "Managing preprints for the year&nbsp;") . x("select name='nor_pp_period' onchange='submit()'", join("\n", $sel))));
}
$l = nbsp("Action legend:");
$t->tro();
foreach (array(NOR_PP_MODE_ACCEPT, NOR_PP_MODE_EDIT, NOR_PP_MODE_DELETE) as $a) {
    if ($a == NOR_PP_MODE_ACCEPT && !$authClass->isAdmin()) {
        continue;
    }
示例#8
0
<?php

$rights = iv::get('rights');
$_POST['rights'] = serialize($_POST['r']);
$rc = new data_controller('user_groups', MODUL_SELF);
$rc->add('name', 'Name', 1, 1, 1, 1);
$rc->add('rights', 'Rechte', 0, 0, 1, 0, 'hidden');
if ($rc->run()) {
    throw new redirect(MODUL_SELF . '&edit=' . intval($_GET['update']));
}
$grid = $view->grid();
$grid[0]->box($rc->get_create(), 'Gruppe erstellen');
$grid[0]->box($rc->get_list(), 'Gruppen verwalte');
if (!empty($_GET['edit']) && ($group = db()->id_get('user_groups', $_GET['edit']))) {
    $form = $rc->get_edit($_GET['edit']);
    $form->append($tabs = new tabs());
    $grouprights = (array) unserialize($group['rights']);
    foreach ($rights->providers as $type => $provider) {
        $inputs = array();
        $typerights = $grouprights[$type] ?: array();
        foreach ($provider->keys() as $key => $caption) {
            if (!isset($provider->always[$key])) {
                $inputs[] = $inp = new form_field_boxtree("r[{$type}][{$key}]", $caption, isset($typerights[$key]));
                foreach ($provider->flagNames($key) as $flag => $caption) {
                    $inp->sub("r[{$type}][{$key}][{$flag}]", $caption, isset($typerights[$key][$flag]));
                }
            }
        }
        $tabs->add($provider->name, implode($inputs));
    }
    $grid[1]->box($form, 'Rechte bearbeiten');
示例#9
0
 public static function deletePlaque($pack)
 {
     $plaque = dbconnection::queryObject("SELECT * FROM plaques WHERE plaque_id = '{$pack->plaque_id}'");
     $pack->auth->game_id = $plaque->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM plaques WHERE plaque_id = '{$pack->plaque_id}' LIMIT 1");
     //cleanup
     /* Comment out until we've decided on desired behavior...
        $eventpack = dbconnection::queryObject("SELECT * FROM event_packages WHERE event_package_id = '{$plaque->event_package_id}'");
        if($eventpack)
        {
            $pack->event_package_id = $eventpack->event_package_id;
            events::deleteEventPackage($pack);
        }
        */
     $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_PLAQUE' AND link_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($options); $i++) {
         $pack->dialog_option_id = $options[$i]->dialog_option_id;
         dialogs::deleteDialogOption($pack);
     }
     $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tabs); $i++) {
         $pack->tab_id = $tabs[$i]->tab_id;
         tabs::deleteTab($pack);
     }
     $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($tags); $i++) {
         $pack->object_tag_id = $tags[$i]->object_tag_id;
         tags::deleteObjectTag($pack);
     }
     $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($instances); $i++) {
         $pack->instance_id = $instances[$i]->instance_id;
         instances::deleteInstance($pack);
     }
     $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'PLAQUE' AND object_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($factories); $i++) {
         $pack->factory_id = $factories[$i]->factory_id;
         factories::deleteFactory($pack);
     }
     $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_PLAQUE' AND content_id = '{$pack->plaque_id}'");
     for ($i = 0; $i < count($reqAtoms); $i++) {
         $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id;
         requirements::deleteRequirementAtom($pack);
     }
     games::bumpGameVersion($pack);
     return new return_package(0);
 }