valid() 공개 메소드

public valid ( )
예제 #1
0
<?php

if (subsite_manager_on_subsite()) {
    register_error(elgg_echo("subsite_manager:action:error:on_subsite"));
    forward(REFERER);
}
// this could take a while
set_time_limit(0);
$subsite_options = array("type" => "site", "subtype" => Subsite::SUBTYPE, "limit" => false, "joins" => array("JOIN " . get_config("dbprefix") . "sites_entity se ON se.guid = e.guid"), "order_by" => "se.name ASC");
$batch = new ElggBatch("elgg_get_entities", $subsite_options);
$batch->rewind();
if ($batch->valid()) {
    // create a temp file for storage
    $fh = tmpfile();
    $headers = array("name", "url", "site time created (unix)", "site time created (YYYY-MM-DD HH:MM:SS)", "member count", "last activity (unix)", "last activity (YYYY-MM-DD HH:MM:SS)", "admin name", "admin email", "admin profile");
    fwrite($fh, "\"" . implode("\";\"", $headers) . "\"" . PHP_EOL);
    foreach ($batch as $subsite) {
        $member_count = $subsite->getMembers(array("count" => true));
        $last_activity = subsite_manager_get_subsite_last_activity($subsite->getGUID());
        $last_activity_readable = date("Y-m-d G:i:s", $last_activity);
        $admin_guids = $subsite->getAdminGuids();
        $output = array($subsite->name, $subsite->url, $subsite->time_created, date("Y-m-d G:i:s", $subsite->time_created), $member_count, $last_activity, $last_activity_readable);
        if (!empty($admin_guids)) {
            foreach ($admin_guids as $admin_guid) {
                $admin = get_user($admin_guid);
                if (!empty($admin)) {
                    $admin_output = $output;
                    $admin_output[] = $admin->name;
                    $admin_output[] = $admin->email;
                    $admin_output[] = $admin->getURL();
                    // write to file
예제 #2
0
    echo $filter_selector;
    echo '</div>';
    return;
}
//the user of the widget
$owner = $widget->getOwnerEntity();
// get all groups
$options = ['type' => 'group', 'limit' => false, 'joins' => ['JOIN ' . elgg_get_config('dbprefix') . 'groups_entity ge ON e.guid = ge.guid'], 'order_by' => 'ge.name ASC'];
if ($owner instanceof ElggUser) {
    $options['relationship'] = 'member';
    $options['relationship_guid'] = $owner->getGUID();
}
$batch = new ElggBatch('elgg_get_entities_from_relationship', $options);
$batch->rewind();
// needed so the next call succeeds
if (!$batch->valid()) {
    echo elgg_echo('widgets:group_river_widget:edit:no_groups');
    return;
}
// get groups
$group_options_values = [];
foreach ($batch as $group) {
    $group_options_values[$group->name] = $group->getGUID();
}
// make options
echo '<div>';
echo elgg_echo('widgets:group_river_widget:edit:num_display');
echo elgg_view('input/select', ['options' => range(5, 25, 5), 'value' => $num_display, 'name' => 'params[num_display]', 'class' => 'mls']);
echo '</div>';
echo '<div>';
echo elgg_echo('filter') . '<br />';