Esempio n. 1
0
/**
 * Helper functions for mapping_db.php
 */
function getSubClasses($class_id, $level = null)
{
    $result = mysqlQuery("SELECT id FROM class where parent_id = '{$class_id}'");
    $classes = array();
    $classes[] = $class_id;
    if (mysql_num_rows($result) > 0) {
        while ($row = mysql_fetch_row($result)) {
            $sub_class_id = $row[0];
            $classes = array_merge($classes, getSubClasses($sub_class_id));
        }
    }
    return $classes;
}
Esempio n. 2
0
/**
 * return subClass of a given class
 *
 * @param unknown_type $class_id
 * @return unknown
 *
 * @since 1.8.0
 */
function getSubClasses($class_id)
{
    $tbl = claro_sql_get_main_tbl();
    $sub_classes_list = array();
    $sql = "SELECT `id`\n            FROM `" . $tbl['class'] . "`\n            WHERE `class_parent_id`=" . (int) $class_id;
    $query_result = claro_sql_query($sql);
    while ($this_sub_class = mysql_fetch_array($query_result)) {
        // add this subclass id to array
        $sub_classes_list[] = $this_sub_class['id'];
        // add children of this subclass id to array
        $this_sub_classes_list = getSubClasses($this_sub_class['id']);
        $sub_classes_list = array_merge($this_sub_classes_list, $sub_classes_list);
    }
    return $sub_classes_list;
}
Esempio n. 3
0
function createTableDefinition($superClass, $class)
{
    # Erzeuge Create Table Statement
    $sql = "CREATE TABLE IF NOT EXISTS " . strtolower($class['name']) . " (";
    if ($superClass == null) {
        $sql .= "\n  gml_id uuid NOT NULL DEFAULT uuid_generate_v5(uuid_ns_url(), 'http://xplan-raumordnung.org'),";
    }
    # lade Attribute
    $attributes = getAttributes($class);
    # für jedes Attribut erzeuge Attributzeilen
    foreach ($attributes as $i => $attribute) {
        $sql .= '
  ';
        $sql .= createAttributeDefinition($attribute);
    }
    $sql .= '
  CONSTRAINT ' . strtolower($class['name']) . '_pkey PRIMARY KEY (gml_id)
)';
    if ($superClass != null) {
        # leite von superClass ab
        $sql .= '
INHERITS (' . strtolower($superClass['name']) . ')';
    }
    $sql .= ';';
    # für jedes Attribut erzeuge Kommentar, wenn der type ein
    # Datentyp ist
    foreach ($attributes as $i => $attribute) {
        if ($attribute['classifier'] != '') {
            $sql .= createAttributeComment($class['name'], $attribute['name'], $attribute['classifier'], $attribute['classifier_stereotype']);
        }
    }
    $sql .= '

';
    output($sql);
    # lade abgeleitete Klassen
    $subClasses = getSubClasses($class);
    # Für alle abgeleiteten Klassen
    foreach ($subClasses as $subClass) {
        output('<br><b>SubKlasse: ' . $subClass['name'] . '</b> (' . $subClass['xmi_id'] . ')');
        $sql .= createTableDefinition($class, $subClass);
    }
    return $sql;
}
Esempio n. 4
0
    print get_text('CrackError');
    exit;
}
$tourId = StrSafe_DB($_SESSION['TourId']);
$error = 0;
$flags = array(array('', '', ''), array(0, '', 'x-icon-ok'), array(1, '', 'x-icon-canshoot'), array(5, '', 'x-icon-unknownshoot'), array(6, '', 'x-icon-gohome'), array(7, '', 'x-icon-notaccredited'), array(8, '', 'x-icon-couldshoot'), array(9, '', 'x-icon-noshoot'));
$sessions = array('0' => '--');
$divisions = array('--' => '--');
$classes = array('--' => array('val' => '--', 'valid' => '--'));
$subClasses = array('00' => '--');
$archers = array('' => '', '0' => get_text('No'), '1' => get_text('Yes'));
$genders = array();
$athletes = array();
$sessions = getSessions_();
$divisions = getDivisions();
$subClasses = getSubClasses();
$classes = getClasses();
$genders = getGenders();
$athletes = getAthletes();
/****** End Controlloer ******/
/****** Output ******/
$xmlDoc = new DOMDocument('1.0', 'UTF-8');
$xmlRoot = $xmlDoc->createElement('response');
$xmlDoc->appendChild($xmlRoot);
// Sezione header
$xmlHeader = $xmlDoc->createElement('header');
$xmlRoot->appendChild($xmlHeader);
$node = $xmlDoc->createElement('error', $error);
$xmlHeader->appendChild($node);
// Sezione combos
$xmlCombos = $xmlDoc->createElement('combos');
Esempio n. 5
0
//commande
$acceptedCmdList = array('exSendMessage');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
    if ($_REQUEST['cmd'] == 'exSendMessage') {
        /*
         * Explode the values of incorreo in groups and users
         */
        $userIdList = array();
        $groupIdList = array();
        $classIdList = array();
        foreach ($_REQUEST['incorreo'] as $thisIncorreo) {
            list($type, $elmtId) = explode(':', $thisIncorreo);
            switch ($type) {
                case 'CLASS':
                    $classIdList[] = $elmtId;
                    $classIdList = array_merge($classIdList, getSubClasses($elmtId));
                    break;
                case 'GROUP':
                    $groupIdList[] = $elmtId;
                    break;
                case 'USER':
                    $userIdList[] = $elmtId;
                    break;
            }
        }
        // end foreach
        /*
         * Select the students of the different groups
         */
        if (!empty($classIdList)) {
            $userIdList = array_merge($userIdList, get_class_list_user_id_list($classIdList));
Esempio n. 6
0
             require_once dirname(__FILE__) . '/../user/lib/export.lib.php';
             $csv = export_user_list_for_class($class_id);
             if (!empty($csv)) {
                 claro_send_stream($csv, $classinfo['name'] . '.csv');
                 exit;
             }
         }
         break;
     default:
         // No command
 }
 //----------------------------------
 // Build query and find info in db
 //----------------------------------
 // find this class current content
 $classes_list = getSubClasses($class_id);
 $classes_list[] = $class_id;
 $sql = "SELECT distinct U.user_id      AS user_id,\n                            U.nom          AS nom,\n                            U.prenom       AS prenom,\n                            U.nom          AS lastname,\n                            U.prenom       AS firstname,\n                            U.email        AS email,\n                            U.officialCode AS officialCode\n            FROM `" . $tbl_user . "` AS U\n            LEFT JOIN `" . $tbl_class_user . "` AS CU\n                ON U.`user_id`= CU.`user_id`\n            WHERE `CU`.`class_id`\n                in (" . implode($classes_list, ",") . ")";
 // if user search exist
 if (isset($search)) {
     $escapedSearchTerm = claro_sql_escape($search);
     $sql .= " AND (U.nom LIKE '%" . $escapedSearchTerm . "%'\n                  OR U.prenom LIKE '%" . $escapedSearchTerm . "%'\n                  OR U.email LIKE '%" . $escapedSearchTerm . "%'\n                  OR U.username LIKE '" . $escapedSearchTerm . "%'\n                  OR U.officialCode = '" . $escapedSearchTerm . "')";
 }
 // deal with session variables for search criteria
 if (isset($_REQUEST['dir'])) {
     $_SESSION['admin_user_class_dir'] = $_REQUEST['dir'] == 'DESC' ? 'DESC' : 'ASC';
 }
 // first see if direction must be changed
 if (isset($_REQUEST['chdir']) && $_REQUEST['chdir'] == 'yes') {
     if ($_SESSION['admin_user_class_dir'] == 'ASC') {
         $_SESSION['admin_user_class_dir'] = 'DESC';