Exemplo n.º 1
0
function clm_api_view_tournament()
{
    $lang = clm_core::$lang->tournament;
    $table = new clm_class_table("tournament", "db_tournament", 15, 13);
    if (clm_core::$access->access('BE_tournament_create') !== false) {
        $table->add_button($lang->categories, $lang->categories_title, clm_core::$load->gen_url(array("view" => "catmain")), "clm_table_url clm_button clm_button_big clm_button_big_article");
        $table->add_button($lang->special, $lang->special_title, clm_core::$load->gen_url(array("view" => "sonderranglistenmain")), "clm_table_url clm_button clm_button_big clm_button_big_article");
        $table->add_button($lang->new, $lang->new_title, clm_core::$load->gen_url(array("view" => "turform")), "clm_table_url clm_button clm_button_new clm_button_big clm_button_big_new");
    }
    if (clm_core::$access->access('BE_tournament_create') !== false) {
        $table->add_button($lang->copy, $lang->copy_title, json_encode(array("db_tournament_copy", array("", false))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_save-copy");
    }
    if (clm_core::$access->access('BE_tournament_delete') !== false) {
        $table->add_button($lang->del, $lang->del_title, json_encode(array("db_tournament_del", array("", false))), "clm_table_event clm_button clm_button_del clm_table_confirm clm_button_big clm_button_big_delete");
    }
    if (clm_core::$access->access('BE_tournament_edit_detail') !== false) {
        $table->add_button($lang->edit, $lang->edit_title, clm_core::$load->gen_url(array("view" => "turform", "task" => "edit"), array("id")) . "&id=", "clm_table_multi clm_button clm_button_edit clm_button_big clm_button_big_edit");
    }
    if (clm_core::$access->access('BE_tournament_edit_round') !== false) {
        $table->add_button($lang->newRounds, $lang->newRounds_title, json_encode(array("db_tournament_genRounds", array("", false))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_back");
        $table->add_button($lang->delRounds, $lang->delRounds_title, json_encode(array("db_tournament_delRounds", array("", false))), "clm_table_event clm_button clm_button_del clm_table_confirm clm_button_big clm_button_big_cancel");
        $table->add_button($lang->dwzUpdate, $lang->dwzUpdate_title, json_encode(array("db_tournament_updateDWZ", array("", false))), "clm_table_event clm_button clm_button_edit clm_table_confirm clm_button_big clm_button_big_default");
        $table->add_button($lang->dwzGen, $lang->dwzGen_title, json_encode(array("db_tournament_genDWZ", array("", false))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_refresh");
        $table->add_button($lang->dwzDel, $lang->dwzDel_title, json_encode(array("db_tournament_delDWZ", array("", false))), "clm_table_event clm_button clm_button_del clm_button_big clm_button_big_cancel");
    }
    if (clm_core::$access->access('BE_tournament_edit_detail') !== false) {
        $table->add_button($lang->public, $lang->public_title, json_encode(array("db_tournament_publish", array("", true, false))), "clm_table_event clm_button clm_button_edit clm_button_big clm_button_big_publish");
        $table->add_button($lang->hide, $lang->hide_title, json_encode(array("db_tournament_publish", array("", false, false))), "clm_table_event clm_button clm_button_edit clm_button_big clm_button_big_unpublish");
    }
    // Ordering (besondere Behandlung)
    if (clm_core::$access->access('BE_tournament_edit_detail') !== false) {
        $table->add_button($lang->ordering, $lang->ordering_title, json_encode(array("db_ordering", array("", "", "turniere"))), "clm_table_ordering clm_button clm_button_save_icon");
    }
    $season = array("" => $lang->season);
    $category = array("" => $lang->category);
    $fix = clm_core::$api->db_season_array(1);
    $season += $fix[2];
    list($parentArray, $parentKeys, $parentChilds) = clm_class_category::get();
    $category += $parentArray;
    $table->add_filter_field("catidAlltime:catidEdition", $category);
    $table->add_filter_field("sid", $season, clm_core::$access->getSeason());
    $table->add_filter_field("typ", array("" => $lang->mode0, 1 => $lang->mode1, 2 => $lang->mode2, 3 => $lang->mode3, 4 => $lang->mode4, 5 => $lang->mode5, 6 => $lang->mode6));
    $table->add_filter_field("published", array("" => $lang->status0, 1 => $lang->status1, 0 => $lang->status2));
    $fix = clm_core::$load->load_view("table", $table->result());
    return array(true, "m_tableSuccess", "<div class='clm'>" . $fix[1] . "</div>");
}
function clm_api_view_tournament_group($liga = 2)
{
    if (clm_core::$access->access('BE_league_general') == 0 && clm_core::$access->access('BE_teamtournament_general') == 0) {
        return array(false, "e_noRights");
    }
    $table = new clm_class_table("tournament_group", "db_tournament_group", 15, 13);
    //Andere Position?
    clm_core::$load->load_js("modal");
    clm_core::$load->load_css("modal");
    //Andere Position?
    $lang = clm_core::$lang->tournament_group;
    //CLM parameter auslesen
    $config = clm_core::$db->config();
    $countryversion = $config->countryversion;
    if (clm_core::$access->access('BE_teamtournament_create') !== false or clm_core::$access->access('BE_league_create') !== false) {
        $table->add_button($lang->categories, $lang->categories_title, clm_core::$load->gen_url(array("view" => "catmain")), "clm_table_url clm_button clm_button_big clm_button_big_article");
    }
    if (clm_core::$access->access('BE_league_create') !== false) {
        $table->add_button($lang->newLeague, $lang->newLeague_title, clm_core::$load->gen_url(array("section" => "ligen"), array("view")), "clm_table_url clm_button clm_button_new clm_button_big clm_button_big_new");
    }
    if (clm_core::$access->access('BE_teamtournament_create') !== false) {
        $table->add_button($lang->newNoneLeague, $lang->newNoneLeague_title, clm_core::$load->gen_url(array("section" => "mturniere"), array("view")), "clm_table_url clm_button clm_button_new clm_button_big clm_button_big_new");
    }
    if (clm_core::$access->access('BE_league_create') !== false || clm_core::$access->access('BE_teamtournament_create') !== false) {
        $table->add_button($lang->copy, $lang->copy_title, json_encode(array("db_tournament_copy", array("", true))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_save-copy");
    }
    if (clm_core::$access->access('BE_league_delete') !== false || clm_core::$access->access('BE_teamtournament_delete') !== false) {
        $table->add_button($lang->del, $lang->del_title, json_encode(array("db_tournament_del", array("", true))), "clm_table_event clm_button clm_button_del clm_table_confirm clm_button_big clm_button_big_delete");
    }
    if (clm_core::$access->access('BE_league_edit_detail') !== false || clm_core::$access->access('BE_teamtournament_edit_detail') !== false) {
        /* Erst wenn Ligen und Mannschaftsturniere mit der selben Ansicht bearbeitet werden können, kann dies hier angepasst wieder aktiviert werden.
        		$table->add_button($lang->edit,$lang->edit_title,clm_core::$load->gen_url(array("view"=>"ligen","task"=>"edit"),array("id"))."&id=","clm_table_multi clm_button clm_button_edit clm_button_big clm_button_big_edit");
        */
        $table->add_button($lang->ranking, $lang->ranking_title, json_encode(array("db_tournament_ranking", array("", true))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_default");
        $table->add_button($lang->sort, $lang->sort_title, json_encode(array("db_tournament_sortByTWZ", array("", true))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_default");
    }
    if (clm_core::$access->access('BE_league_edit_round') !== false || clm_core::$access->access('BE_teamtournament_edit_round') !== false) {
        $table->add_button($lang->newRounds, $lang->newRounds_title, json_encode(array("db_tournament_genRounds", array("", true))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_back");
        $table->add_button($lang->delRounds, $lang->delRounds_title, json_encode(array("db_tournament_delRounds", array("", true))), "clm_table_event clm_button clm_button_del clm_table_confirm clm_button_big clm_button_big_cancel");
        if ($countryversion == "de") {
            $table->add_button($lang->dwzUpdate, $lang->dwzUpdate_title, json_encode(array("db_tournament_updateDWZ", array("", true))), "clm_table_event clm_button clm_button_edit clm_table_confirm clm_button_big clm_button_big_default");
            $table->add_button($lang->dwzGen, $lang->dwzGen_title, json_encode(array("db_tournament_genDWZ", array("", true))), "clm_table_event clm_button clm_button_new clm_button_big clm_button_big_refresh");
            $table->add_button($lang->dwzDel, $lang->dwzDel_title, json_encode(array("db_tournament_delDWZ", array("", true))), "clm_table_event clm_button clm_button_del clm_button_big clm_button_big_cancel");
        }
    }
    if (clm_core::$access->access('BE_league_edit_detail') !== false || clm_core::$access->access('BE_teamtournament_edit_detail') !== false) {
        $table->add_button($lang->public, $lang->public_title, json_encode(array("db_tournament_publish", array("", true, true))), "clm_table_event clm_button clm_button_edit clm_button_big clm_button_big_publish");
        $table->add_button($lang->hide, $lang->hide_title, json_encode(array("db_tournament_publish", array("", false, true))), "clm_table_event clm_button clm_button_edit clm_button_big clm_button_big_unpublish");
    }
    // Ordering (besondere Behandlung)
    if (clm_core::$access->access('BE_league_edit_detail') !== false || clm_core::$access->access('BE_teamtournament_edit_detail') !== false) {
        $table->add_button($lang->ordering, $lang->ordering_title, json_encode(array("db_ordering", array("", "", "liga"))), "clm_table_ordering clm_button clm_button_save_icon");
    }
    $season = array("" => $lang->season);
    $category = array("" => $lang->category);
    $fix = clm_core::$api->db_season_array(1);
    $season += $fix[2];
    list($parentArray, $parentKeys, $parentChilds) = clm_class_category::get();
    $category += $parentArray;
    $table->add_filter_field("catidAlltime:catidEdition", $category);
    $table->add_filter_field("sid", $season, clm_core::$access->getSeason());
    $table->add_filter_field("runden_modus", array("" => $lang->mode0, 1 => $lang->mode1, 2 => $lang->mode2, 3 => $lang->mode3, 4 => $lang->mode4, 5 => $lang->mode5));
    // Freie Auswahl zwischen Ligen und Mannschaftsturniere
    if (clm_core::$access->access('BE_league_general') == 1 && clm_core::$access->access('BE_teamtournament_general') == 1) {
        if ($liga == 2) {
            $selected = "";
        } elseif ($liga == 1) {
            $selected = 0;
        } else {
            $selected = 1;
        }
        $table->add_filter_field("liga_mt", array("" => $lang->liga_mt0, 0 => $lang->liga_mt1, 1 => $lang->liga_mt2), $selected);
    } else {
        if (clm_core::$access->access('BE_league_general') == 1) {
            $table->add_filter_field("liga_mt", array(0 => $lang->liga_mt1));
        } else {
            if (clm_core::$access->access('BE_teamtournament_general') == 1) {
                $table->add_filter_field("liga_mt", array(1 => $lang->liga_mt2));
            }
        }
    }
    $table->add_filter_field("published", array("" => $lang->status0, 1 => $lang->status1, 0 => $lang->status2));
    $fix = clm_core::$load->load_view("table", $table->result());
    return array(true, "m_tableSuccess", "<div class='clm'>" . $fix[1] . "</div>");
}
Exemplo n.º 3
0
function clm_api_db_tournament()
{
    $table = '#__clm_turniere';
    $primaryKey = 'id';
    $columns = array(array('db' => 'id', 'dt' => 0), array('db' => 'name', 'dt' => 1), array('db' => 'sid', 'dt' => 2), array('db' => 'dateStart', 'dt' => 3), array('db' => 'invitationText', 'dt' => 4), array('db' => 'vereinZPS', 'dt' => 5), array('db' => 'typ', 'dt' => 6), array('db' => 'runden', 'dt' => 7), array('db' => 'teil', 'dt' => 8), array('db' => 'tl', 'dt' => 9), array('db' => 'id', 'dt' => 10), array('db' => 'rnd', 'dt' => 11), array('db' => 'published', 'dt' => 12), array('db' => 'ordering', 'dt' => 13), array('db' => 'id', 'dt' => 14));
    $allowed = array("typ" => "i", "published" => "i", "sid" => "i", "catidAlltime:catidEdition" => "i");
    $out = clm_class_DataTables::simple($_POST, $table, $primaryKey, $columns, $allowed, clm_core::$db);
    $lang = clm_core::$lang->tournament;
    $clmAccess = clm_core::$access;
    for ($i = 0; $i < count($out["data"]); $i++) {
        $out["data"][$i][0] = $i + 1;
        $out["data"][$i][1] = clm_class_category::name($out["data"][$i][14], false);
        if (!($out["data"][$i][9] != $clmAccess->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $clmAccess->access('BE_tournament_edit_detail') === false)) {
            $out["data"][$i][1] = '<a href="' . clm_core::$load->gen_url(array("view" => "turform", "task" => "edit", "id" => $out["data"][$i][14])) . '">' . $out["data"][$i][1] . '</a>';
        }
        // Saisonname statt sid Anzeigen
        $sid = intval($out["data"][$i][2]);
        $out["data"][$i][2] = clm_core::$db->saison->get($sid)->name;
        // dateStart durch dateStart und dateEnd ersetzen
        if (clm_core::$db->turniere->get($out["data"][$i][14])->dateStart != '0000-00-00') {
            $out["data"][$i][3] = clm_core::$load->date_to_string(clm_core::$db->turniere->get($out["data"][$i][14])->dateStart, false, true);
            if (clm_core::$db->turniere->get($out["data"][$i][14])->dateEnd != '0000-00-00') {
                $out["data"][$i][3] .= " " . $lang->until . " " . clm_core::$load->date_to_string(clm_core::$db->turniere->get($out["data"][$i][14])->dateEnd, false, true);
            }
        } else {
            $out["data"][$i][3] = $lang->unknownDate;
        }
        // Veranstalter / Ausrichter
        $out["data"][$i][5] = clm_core::$load->zps_to_district($out["data"][$i][5]);
        if (clm_core::$db->turniere->get($out["data"][$i][14])->bezirkTur == 1) {
            $out["data"][$i][5] = $lang->districtEvent . ($out["data"][$i][5] != "" ? "<br />" . $out["data"][$i][5] : "");
        }
        // Ausschreibung
        if ($out["data"][$i][4] == "") {
            $out["data"][$i][4] = $lang->column3_no;
        } else {
            $out["data"][$i][4] = $lang->column3_yes;
        }
        if (!($out["data"][$i][9] != $clmAccess->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $clmAccess->access('BE_tournament_edit_detail') === false)) {
            $out["data"][$i][4] = '<a href="' . clm_core::$load->gen_url(array("view" => "turinvite", "task" => "edit", "id" => $out["data"][$i][14])) . '">' . $out["data"][$i][4] . '</a>';
        }
        // Modus ID in Name umsetzen
        $out["data"][$i][6] = clm_core::$load->mode_to_name(intval($out["data"][$i][6]), false);
        // eingetragene Teilnehmer
        $query = 'SELECT COUNT(id)' . ' FROM #__clm_turniere_tlnr' . ' WHERE turnier = ' . $out["data"][$i][14];
        if (!($out["data"][$i][9] != $clmAccess->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $clmAccess->access('BE_tournament_edit_detail') === false)) {
            $out["data"][$i][8] = '<a href="' . clm_core::$load->gen_url(array("view" => "turplayers", "task" => "edit", "id" => $out["data"][$i][14])) . '">' . $out["data"][$i][8] . " " . $lang->player . '</a>' . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->registered . $lang->close;
        } else {
            $out["data"][$i][8] = $out["data"][$i][8] . " " . $lang->player . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->registered . $lang->close;
        }
        // Runden mit Bestätigung/tl_ok
        // eingetragene Teilnehmer
        $query = 'SELECT COUNT(id)' . ' FROM #__clm_turniere_rnd_termine' . ' WHERE turnier = ' . $out["data"][$i][14] . ' AND tl_ok = \'1\'';
        // Durchläufe Anzeigen
        if (clm_core::$db->turniere->get($out["data"][$i][14])->dg > 1) {
            $out["data"][$i][7] = clm_core::$db->turniere->get($out["data"][$i][14])->dg . " x " . $out["data"][$i][7];
        }
        if (!($out["data"][$i][9] != $clmAccess->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $clmAccess->access('BE_tournament_edit_detail') === false)) {
            $out["data"][$i][7] = '<a href="' . clm_core::$load->gen_url(array("view" => "turrounds", "task" => "edit", "id" => $out["data"][$i][14])) . '">' . $out["data"][$i][7] . " " . $lang->rounds . '</a>' . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->confirmed . $lang->close;
        } else {
            $out["data"][$i][7] = $out["data"][$i][7] . " " . $lang->rounds . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->confirmed . $lang->close;
        }
        // Turnierleiter
        $query = 'SELECT name' . ' FROM #__clm_user' . ' WHERE jid = ' . $out["data"][$i][9] . ' AND sid = ' . $sid;
        $result = clm_core::$db->loadAssocList($query);
        if (count($result) == 1) {
            $out["data"][$i][9] = $result[0]["name"];
        } else {
            $out["data"][$i][9] = "-";
        }
        // DWZ berechnet
        $params = clm_core::$db->turniere->get($out["data"][$i][10])->params;
        $params = new clm_class_params($params);
        if ($params->get("inofDWZ", "0") == "1") {
            $out["data"][$i][10] = '<button class="clm_table_image" value=\'["db_tournament_delDWZ",[' . $out["data"][$i][14] . ',false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][10] = '<button class="clm_table_image" value=\'["db_tournament_genDWZ",[' . $out["data"][$i][14] . ',false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        // Runden freigegeben
        if ($out["data"][$i][11] == 1) {
            $out["data"][$i][11] = '<button class="clm_table_image clm_button_del_danger" value=\'["db_tournament_delRounds",[' . $out["data"][$i][14] . ',false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][11] = '<button class="clm_table_image" value=\'["db_tournament_genRounds",[' . $out["data"][$i][14] . ',false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        // Veröffentlicht
        if ($out["data"][$i][12] == 1) {
            $out["data"][$i][12] = '<button class="clm_table_image " value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',false,false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][12] = '<button class="clm_table_image" value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',true,false]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        $out["data"][$i][13] = '<input class="clm_table_orderingBox" onkeypress="return clm_isChangeNumber(event);" value="' . $out["data"][$i][13] . '" type="text">';
        $out["data"][$i][13] .= '<input class="clm_table_orderingId" value="' . $out["data"][$i][14] . '" type="hidden">';
    }
    return array(true, "m_tableSuccess", $out);
}
function clm_api_db_tournament_group()
{
    $table = '#__clm_liga';
    $primaryKey = 'id';
    $columns = array(array('db' => 'id', 'dt' => 0), array('db' => 'name', 'dt' => 1), array('db' => 'sid', 'dt' => 2), array('db' => 'runden_modus', 'dt' => 3), array('db' => 'runden', 'dt' => 4), array('db' => 'teil', 'dt' => 5), array('db' => 'stamm', 'dt' => 6), array('db' => 'sl', 'dt' => 7), array('db' => 'bemerkungen', 'dt' => 8), array('db' => 'mail', 'dt' => 9), array('db' => 'id', 'dt' => 10), array('db' => 'rnd', 'dt' => 11), array('db' => 'published', 'dt' => 12), array('db' => 'ordering', 'dt' => 13), array('db' => 'id', 'dt' => 14));
    // Erzwinge Filter bei unzureichenden Berechtigungen
    if (clm_core::$access->access('BE_league_general') == 1 && clm_core::$access->access('BE_teamtournament_general') == 0) {
        if (in_array('liga_mt', $_POST["names"])) {
            $_POST["values"][array_search("liga_mt", $_POST["names"])] = "0";
        } else {
            $_POST["names"][] = "liga_mt";
            $_POST["values"][] = "0";
        }
    } else {
        if (clm_core::$access->access('BE_league_general') == 0 && clm_core::$access->access('BE_teamtournament_general') == 1) {
            if (in_array('liga_mt', $_POST["names"])) {
                $_POST["values"][array_search("liga_mt", $_POST["names"])] = "1";
            } else {
                $_POST["names"][] = "liga_mt";
                $_POST["values"][] = "1";
            }
        }
    }
    $allowed = array("runden_modus" => "i", "published" => "i", "sid" => "i", "catidAlltime:catidEdition" => "i", "liga_mt" => "i");
    $out = clm_class_DataTables::simple($_POST, $table, $primaryKey, $columns, $allowed, clm_core::$db);
    $lang = clm_core::$lang->tournament_group;
    $clmAccess = clm_core::$access;
    for ($i = 0; $i < count($out["data"]); $i++) {
        if (clm_core::$db->liga->get($out["data"][$i][0])->liga_mt == 0) {
            $right = "league";
            $section = "ligen";
        } else {
            $right = "teamtournament";
            $section = "mturniere";
        }
        $out["data"][$i][0] = $i + 1;
        $out["data"][$i][1] = clm_class_category::name($out["data"][$i][14], true);
        if (!($out["data"][$i][7] != $clmAccess->getJid() and $clmAccess->access('BE_' . $right . '_edit_detail') !== true or $clmAccess->access('BE_' . $right . '_edit_detail') === false)) {
            //$out["data"][$i][1] = '<a href="'.clm_core::$load->gen_url(array("section"=>"ligen","task"=>"edit","cid[]"=>$out["data"][$i][14]),array("view")).'">'.$out["data"][$i][1].'</a>';
            $out["data"][$i][1] = '<a href="' . clm_core::$load->gen_url(array("section" => $section, "task" => "edit", "cid[]" => $out["data"][$i][14]), array("view")) . '">' . $out["data"][$i][1] . '</a>';
        }
        // Saisonname statt sid Anzeigen
        $sid = intval($out["data"][$i][2]);
        $out["data"][$i][2] = clm_core::$db->saison->get($sid)->name;
        // Modus ID in Name umsetzen
        $out["data"][$i][3] = clm_core::$load->mode_to_name(intval($out["data"][$i][3]), true);
        // Runden mit Bestätigung/sl_ok
        // eingetragene Teilnehmer
        $query = 'SELECT COUNT(id)' . ' FROM #__clm_runden_termine' . ' WHERE liga = ' . $out["data"][$i][14] . ' AND sl_ok = \'1\'';
        // Durchläufe Anzeigen
        if (clm_core::$db->liga->get($out["data"][$i][14])->durchgang > 1) {
            $out["data"][$i][4] = clm_core::$db->liga->get($out["data"][$i][14])->durchgang . " x " . $out["data"][$i][4];
        }
        if (!($out["data"][$i][7] != $clmAccess->getJid() and $clmAccess->access('BE_' . $right . '_edit_detail') !== true or $clmAccess->access('BE_' . $right . '_edit_detail') === false) and $out["data"][$i][11] == 1) {
            $out["data"][$i][4] = '<a href="' . clm_core::$load->gen_url(array("section" => "runden", "liga" => $out["data"][$i][14]), array("view")) . '">' . $out["data"][$i][4] . " " . $lang->rounds . '</a>' . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->confirmed . $lang->close;
        } else {
            $out["data"][$i][4] = $out["data"][$i][4] . " " . $lang->rounds . "<br/>" . $lang->open . clm_core::$db->count($query) . " " . $lang->confirmed . $lang->close;
        }
        // Stammspieler + Ersatzspieler
        $out["data"][$i][6] = $out["data"][$i][6] . " " . $lang->open . $lang->plus . " " . clm_core::$db->liga->get($out["data"][$i][14])->ersatz . $lang->close;
        // Turnierleiter
        $query = 'SELECT name' . ' FROM #__clm_user' . ' WHERE jid = ' . $out["data"][$i][7] . ' AND sid = ' . $sid;
        $result = clm_core::$db->loadAssocList($query);
        if (count($result) == 1) {
            $out["data"][$i][7] = $result[0]["name"];
        } else {
            $out["data"][$i][7] = "-";
        }
        if ($out["data"][$i][8] == "") {
            $out["data"][$i][8] = $lang->column9_no;
        } else {
            $out["data"][$i][8] = '<a href="javascript:void(0);" onclick=\'clm_modal_display("' . htmlspecialchars($out["data"][$i][8], ENT_QUOTES, "UTF-8") . '")\' href="javascript:;" >' . $lang->column9_yes . '</a>';
        }
        // Mail
        if ($out["data"][$i][9] == 1) {
            $out["data"][$i][9] = '<button class="clm_table_image " value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',false,true,"mail"]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][9] = '<button class="clm_table_image" value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',true,true,"mail"]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        // DWZ berechnet
        $params = clm_core::$db->liga->get($out["data"][$i][10])->params;
        $params = new clm_class_params($params);
        if ($params->get("inofDWZ", "0") == "1") {
            $out["data"][$i][10] = '<button class="clm_table_image" value=\'["db_tournament_delDWZ",[' . $out["data"][$i][14] . ',true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][10] = '<button class="clm_table_image" value=\'["db_tournament_genDWZ",[' . $out["data"][$i][14] . ',true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        // Runden
        if ($out["data"][$i][11] == 1) {
            $out["data"][$i][11] = '<button class="clm_table_image " value=\'["db_tournament_delRounds",[' . $out["data"][$i][14] . ',true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][11] = '<button class="clm_table_image" value=\'["db_tournament_genRounds",[' . $out["data"][$i][14] . ',true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        // Veröffentlicht
        if ($out["data"][$i][12] == 1) {
            $out["data"][$i][12] = '<button class="clm_table_image " value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',false,true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/apply") . '" /></button>';
        } else {
            $out["data"][$i][12] = '<button class="clm_table_image" value=\'["db_tournament_publish",[' . $out["data"][$i][14] . ',true,true]]\'><img width="16" height="16" src="' . clm_core::$load->gen_image_url("table/cancel") . '" /></button>';
        }
        $out["data"][$i][13] = '<input class="clm_table_orderingBox" onkeypress="return clm_isChangeNumber(event);" value="' . $out["data"][$i][13] . '" type="text">';
        $out["data"][$i][13] .= '<input class="clm_table_orderingId" value="' . $out["data"][$i][14] . '" type="hidden">';
    }
    return array(true, "m_tableSuccess", $out);
}
Exemplo n.º 5
0
 private static function gen()
 {
     $query = "SELECT id, name, parentid FROM #__clm_categories";
     $parentList = clm_core::$db->loadObjectList($query);
     $new = array();
     for ($i = 0; $i < count($parentList); $i++) {
         $new[$parentList[$i]->id] = $parentList[$i];
     }
     $parentList = $new;
     // Array speichert alle Kategorien in der Tiefe ihrer Verschachtelung
     $parentArray = array();
     // Array speichert für alle Kategorien die spezielle einzelne parentID ab
     $parentID = array();
     // Array speichert für alle Kategorien die Keys aller vorhandenen Parents ab
     $parentKeys = array();
     // Array speichert für alle Kategorien die Childs ab
     $parentChilds = array();
     // aufheben für Bearbeitung in parentChilds
     $saved_parentList = $parentList;
     // erste Ebene der Parents
     $parentsExisting = array();
     // enthält alle IDs von Parents, die bereits ermittelt wurden
     foreach ($parentList as $key => $value) {
         if (!$value->parentid || $value->parentid == 0) {
             $parentArray[$key] = $value->name;
             // Name an ID binden
             $parentsExisting[] = $value->id;
             // ID als existierender Parent eintragen
             // Eintrag kann nun aus Liste gelöscht werden!
             unset($parentList[$key]);
         }
     }
     $continueLoop = 1;
     // Flag, ob Schleife weiterlaufen soll
     // noch Einträge vorhanden?
     while (count($parentList) > 0 and $continueLoop == 1) {
         $continueLoop = 0;
         // abschalten - erst wieder anschalten, wenn Eintrag gefunden
         // weitere Ebenen
         foreach ($parentList as $key => $value) {
             // checken, ob ParentID in Array der bereits ermittelten Parents vorhanden
             if (in_array($value->parentid, $parentsExisting)) {
                 $parentArray[$key] = $parentArray[$value->parentid] . ' / ' . $value->name;
                 // Parent
                 $parentID[$key] = $value->parentid;
                 // Key
                 $parentKeys[$key] = array($value->parentid);
                 // hatte Parent schon keys?
                 if (isset($parentKeys[$value->parentid])) {
                     $parentKeys[$key] = array_merge($parentKeys[$key], $parentKeys[$value->parentid]);
                 }
                 $parentsExisting[] = $value->id;
                 // Eintrag kann nun aus Liste gelöscht werden!
                 unset($parentList[$key]);
                 $continueLoop = 1;
                 // Flag, ob Schleife weiterlaufen soll
             }
         }
     }
     // alle Childs
     foreach ($saved_parentList as $key => $value) {
         // nur welche, die auch Kind sind, können Kindschaft den Parents anhängen
         if ($value->parentid > 0) {
             // allen Parents dieses Childs diesen Eintrag anhängen
             foreach ($parentKeys[$key] as $pvalue) {
                 $parentChilds[$pvalue][] = $key;
             }
         }
     }
     self::$parentArray = $parentArray;
     self::$parentKeys = $parentKeys;
     self::$parentChilds = $parentChilds;
     self::$gen = true;
 }