/**
  * @see OptionType::validate()
  */
 public function validate($optionData, $newValue)
 {
     // get all groups
     $groups = Group::getAllGroups();
     // get new value
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $selectedGroups = ArrayUtil::toIntegerArray($newValue);
     // check groups
     foreach ($selectedGroups as $groupID) {
         if (!isset($groups[$groupID])) {
             throw new UserInputException($optionData['optionName'], 'validationFailed');
         }
     }
 }
 /**
  * @see OptionType::getFormElement()
  */
 public function getFormElement(&$optionData)
 {
     $optionData['divClass'] = 'select';
     if (!isset($optionData['optionValue'])) {
         if (isset($optionData['defaultValue'])) {
             $optionData['optionValue'] = $optionData['defaultValue'];
         } else {
             $optionData['optionValue'] = false;
         }
     }
     $options = array();
     $groups = Group::getAllGroups();
     foreach ($groups as $groupID => $group) {
         $options[$groupID] = StringUtil::encodeHTML($group);
     }
     WCF::getTPL()->assign(array('optionData' => $optionData, 'options' => $options));
     return WCF::getTPL()->fetch('optionTypeSelect');
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     $this->readClosedCategories();
     $this->groups = Group::getAllGroups();
     $this->readBoardPermissions();
     $this->loadGlobalPermissions();
 }
Example #4
0
		<input type="radio" name="bestOfOption" value="0" checked>Gruppe
		<input type="radio" name="bestOfOption" value="1">KO-Runde
	</td></tr>
	<tr><td colspan="2"><input type="hidden" name="newGroup" value="1"><input type="submit" /></td></tr>
</table>
</form>



<?php 
if (!isset($group)) {
    include 'class_group.php';
    $group = new Group();
}
echo "Gruppen <br />";
$data = $group->getAllGroups();
echo "<table>";
echo "<tr><th>key</th><th>_Id</th><th>name</th><th>link</th><th>logoPath</th><th>qualifiers</th><th>teamCount</th><th>replays</th><th>state</th><th>bestOfOption</th><th>begin</th><th>end</th><th></th></tr>";
foreach ($data as $key => $value) {
    echo "<form id='login", $value['_Id'], "' method='post' action='group.php'>";
    echo "<tr><td>", $key, " =>  </td><td>", $value['_Id'], "</td><td>", $value['name'], "</td><td>", $value['link'], "</td><td>", $value['logoPath'], "</td><td>", $value['qualifiers'], "</td><td>", $value['teamCount'], "</td><td>", $value['replays'], "</td><td>", $value['state'], "</td><td>", $value['bestOfOption'], "</td><td>", $value['begin'], "</td><td>", $value['end'], "</td>";
    echo "<td><input type='hidden' name='tId' value='", $value['_Id'], "' />";
    ?>
		<a href="#" onclick="javascript:document.forms['login<?php 
    echo $value['_Id'];
    ?>
'].submit()">mehr...</a></td></tr>
		<?php 
    echo "</form>";
}
echo "</table>";
Example #5
0
 public static function getAllUsers($ACCESS_TOKEN, $refresh = false, $extPart = '')
 {
     $allusers = Cache::get('all_users');
     if (empty($allusers) || $refresh) {
         $allusers = [];
         $groups = Group::getAllGroups($ACCESS_TOKEN, $refresh);
         $groups = array_values($groups);
         $percent = 0;
         $threads = 6;
         global $key;
         if ($key == 'woldy' && in_array('pthreads', get_loaded_extensions())) {
             $g = [];
             //组织架构分组
             $f = [];
             //函数分组
             $t = [];
             //线程分组
             foreach ($groups as $idx => $group) {
                 if (!empty($extPart)) {
                     //排除的分组
                     if (strrpos($group['fullname'], $extPart)) {
                         continue;
                     }
                 }
                 if (!isset($g[$idx % $threads])) {
                     $g[$idx % $threads] = [];
                 }
                 array_push($g[$idx % $threads], $group);
             }
             for ($i = 0; $i < $threads; $i++) {
                 $f[$i] = function ($p) {
                     $partGroupUsers = [];
                     foreach ($p['g'] as $group) {
                         $users = Group::getGroupUsers($group['id'], $p['atk'], $p['refresh']);
                         foreach ($users as $user) {
                             array_push($partGroupUsers, json_decode(json_encode($user), true));
                         }
                         echo $p['i'] . ',';
                     }
                     return json_encode($partGroupUsers);
                 };
                 $p = ['g' => $g[$i], 'atk' => $ACCESS_TOKEN, 'refresh' => $refresh, 'i' => $i];
                 $t[$i] = new dThreads($f[$i], $p);
                 $t[$i]->start();
             }
             while (count($t) > 0) {
                 for ($i = 0; $i < $threads; $i++) {
                     if (isset($t[$i]) && !$t[$i]->runing) {
                         echo "\n------{$i}-------\n";
                         $res = json_decode($t[$i]->result, true);
                         $allusers = array_merge($allusers, $res);
                         echo '.';
                         //$t[$i]->kill();
                         unset($t[$i]);
                     }
                 }
             }
         } else {
             foreach ($groups as $idx => $group) {
                 if (intval($idx * 100 / count($groups)) > $percent) {
                     $percent = intval($idx * 100 / count($groups));
                     echo '.';
                     if ($percent % 33 == 0) {
                         echo "\n";
                     }
                 }
                 if (!empty($extPart)) {
                     if (strrpos($group['fullname'], $extPart)) {
                         continue;
                     }
                 }
                 $users = Group::getGroupUsers($group['id'], $ACCESS_TOKEN, $refresh);
                 foreach ($users as $user) {
                     array_push($allusers, json_decode(json_encode($user), true));
                 }
             }
         }
         Cache::put('all_users', $allusers, 1160);
     }
     return $allusers;
 }
 function showRecord()
 {
     global $wgOut;
     $groups =& Group::getAllGroups();
     $rec = serialize($groups);
     // Split it into lines
     $rec = explode("\r\n", chunk_split($rec));
     $s = '';
     foreach ($rec as $index => $line) {
         if (trim($line) != '') {
             if ($s) {
                 $s .= "' .\n\t'";
             }
             // Escape it for PHP
             $line = str_replace(array('\\', "'"), array('\\\\', "\\'"), $line);
             // Escape it for HTML
             $line = htmlspecialchars($line);
             // Add it to the string
             $s .= $line;
         }
     }
     $s .= "';";
     $s = "<p>Copy the following into LocalSettings.php:</p>\n" . "<textarea readonly rows=20>\n" . "\$wgStaticGroups = \n\t'{$s}\n" . "</textarea>";
     $wgOut->addHTML($s);
 }
$app->put('/groups', function ($request, $response, $args) {
    $put = json_decode($request->getBody());
    // make it a PHP associative array
    $putArray = get_object_vars($put);
    $members = array();
    $tmpMembers = $putArray['users'];
    foreach ($tmpMembers as $tmpmember) {
        $member = get_object_vars($tmpmember);
        $members[] = new User($member['mtklNr'], '', '', '');
    }
    $group = new Group(null, $putArray['name'], $putArray['owner'], $members, $putArray['groupImage']);
    $group->add();
    echo json_encode($group);
});
$app->get('/groups', function ($request, $response, $args) {
    $groups = Group::getAllGroups();
    echo json_encode($groups);
});
$app->get('/groups/{id}', function ($request, $response, $args) {
    $group = Group::getGroupById($args['id']);
    echo json_encode($group);
});
$app->get('/groups/{id}/meetings', function ($request, $response, $args) {
    $meetings = Group::getAllMeetingsOfGroup($args['id']);
    echo json_encode($meetings);
});
$app->post('/groups/{id}', function ($request, $response, $args) {
    $group = Group::getGroupById($args['id']);
    $server_params = $request->getServerParams();
    if (preg_match("/Basic\\s+(.*)\$/i", $server_params["REDIRECT_HTTP_AUTHORIZATION"], $matches)) {
        list($user, $password) = explode(":", base64_decode($matches[1]));
Example #8
0
<?php

include "../assets/_header_in.php";
include "../assets/_header_groups.php";
?>
<ul>
<?php 
require_once "../classes/group.php";
$all_groups = Group::getAllGroups();
for ($i = 0; $i < count($all_groups); $i++) {
    echo "<li><a href='index.php?id_group=" . $all_groups[$i]["id"] . "'>" . $all_groups[$i]["name"] . "</a></li>";
}
?>
</ul>
<a href="create_group.php">Create group</a>
<?php 
include "../assets/_footer.php";