public function getGroupAndTagInfos()
 {
     global $user;
     $a = array();
     if (user_access("view alldata", "churchdb")) {
         $a["groups"] = getAllGroups();
     } else {
         $a["groups"] = churchdb_getMyGroups($user->id, false, true);
     }
     $a["tags"] = getAllTags();
     return $a;
 }
 /**
  * get master data
  * @see CTModuleInterface::getMasterData()
  *
  * @return array
  */
 public function getMasterData()
 {
     global $user, $base_url, $files_dir, $config;
     $res = churchdb_getMasterDataTables();
     $res["feldtyp"] = churchcore_getTableData("cdb_feldtyp");
     $res["fields"] = getAllFields();
     $res["groups"] = getAllGroups();
     $res["tags"] = getAllTags();
     $res["FUNachfolgeDomains"] = array("0" => array("id" => "0", "bezeichnung" => "Kein"), "1" => array("id" => "1", "bezeichnung" => $res["fields"]["f_group"]["fields"]["gruppentyp_id"]["text"]), "2" => array("id" => "2", "bezeichnung" => $res["fields"]["f_group"]["fields"]["distrikt_id"]["text"]), "3" => array("id" => "3", "bezeichnung" => t("group")));
     $res["groupMemberTypes"] = getGroupMemberTypes();
     $res["groupFilterTypes"] = churchdb_getGroupFilterTypes();
     // master data information for maintain masterdata and statistics
     if (user_access("edit masterdata", "churchdb") || user_access("view statistics", "churchdb")) {
         $res["masterDataTables"] = churchdb_getMasterDataTablenames();
     }
     $res["user_pid"] = $user->id;
     $res["userid"] = $user->vorname . " " . $user->cmsuserid . " [" . $user->id . "]";
     $res["auth"] = churchdb_getAuthForAjax();
     $res["site_name"] = getConf('site_name');
     $res["modulespath"] = churchdb_getModulesPath();
     $res["files_url"] = $base_url . $files_dir;
     $res["modulename"] = "churchdb";
     $res["max_uploadfile_size_kb"] = getConf('max_uploadfile_size_kb');
     $res["adminemail"] = getConf('site_mail', '');
     $res["max_exporter"] = getConf('churchdb_maxexporter', '150');
     $res["groupnotchoosable"] = getConf('churchdb_groupnotchoosable', 30);
     $res["home_lat"] = getConf('churchdb_home_lat', '53.568537');
     $res["home_lng"] = getConf('churchdb_home_lng', '10.03656');
     $res["settings"] = churchdb_getUserSettings($user->id);
     $res["last_log_id"] = churchdb_getLastLogId();
     $res["mailchimp"] = getConf('churchdb_mailchimp_apikey') != "";
     $res["views"] = array("ArchiveView" => array("filename" => "cdb_archiveview"), "MapView" => array("filename" => "cdb_mapview"), "StatisticView" => array("filename" => "cdb_statisticview"), "SettingsView" => array("filename" => "cdb_settingsview"), "MaintainView" => array("filename" => "cdb_maintainview"), "WeekView" => array("filename" => "../churchresource/cr_weekview"));
     if (user_access("administer persons", "churchcore")) {
         $res["auth_table"] = churchdb_getAuthTable();
     }
     if (isset($res["auth"]["edit newsletter"])) {
         $nl = churchdb_getTableData("cdb_newsletter");
         $newsletter = array();
         foreach ($res["auth"]["edit newsletter"] as $n) {
             $newsletter = $nl[$n];
         }
         $res["newsletter"] = $newsletter;
     }
     return $res;
 }
Exemplo n.º 3
0
<?php

/**
 * Script to edit / add / delete groups
 *************************************************/
/* verify that user is admin */
checkAdmin();
/**
 * First print table of existing groups with edit / delete links!
 */
$groups = getAllGroups();
/* get all settings */
$settings = getallSettings();
?>

<!-- display existing groups -->
<h4><?php 
print _('Group management');
?>
</h4>
<hr><br>

<!-- Add new -->
<button class='btn btn-sm btn-default editGroup' style="margin-bottom:10px;" data-action='add'><i class='fa fa-plus'></i> <?php 
print _('Create group');
?>
</button>


<!-- table -->
<table id="userPrint" class="table table-striped table-top table-auto">
Exemplo n.º 4
0
if (isset($_GET['type'])) {
    $is_gp = $_GET['type'];
} else {
    $is_gp = 0;
}
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filter' => $_GET["filter"]);
if (isset($_GET['favourite'])) {
    $params['canShow'] = true;
    $params['localSidebar'] = true;
}
if ($is_gp == 1) {
    # Profile
    $list = getAllProfiles($params);
    $count = countAllProfiles($params);
} else {
    $list = getAllGroups($params);
    $count = countAllGroups($params);
}
$filter = $_GET["filter"];
$ids = array();
$name = array();
$type = array();
$show = array();
$action_delete = array();
if ($is_gp != 1) {
    // Simple Group
    $delete = new ActionPopupItem(_T("Delete this group", 'dyngroup'), "delete_group", "delete", "id", "base", "computers");
} else {
    // Imaging group
    $delete = new ActionPopupItem(_T("Delete this imaging group", 'dyngroup'), "delete_group", "delete", "id", "imaging", "manage");
}
Exemplo n.º 5
0
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
$paramArray = array('id' => isset($_GET['id']) ? $_GET['id'] : $_GET['gid'], 'gid' => isset($_GET['gid']) ? $_GET['gid'] : "", 'groupname' => isset($_GET['groupname']) ? $_GET['groupname'] : "", 'type' => isset($_GET['type']) ? $_GET['type'] : "");
$actions = array();
if (isset($_GET['type'])) {
    $is_gp = $_GET['type'] == 'group' ? 1 : $_GET['type'];
} else {
    $is_gp = 0;
}
if ($is_gp && $is_gp == 1) {
    # Profile
    $list = getAllProfiles(array());
} else {
    $list = getAllGroups(array());
}
if ($is_gp != 1) {
    $delete = new ActionPopupItem(_T("Delete this group", 'dyngroup'), "delete_group", "delete", "id", "base", "computers");
} else {
    $delete = new ActionPopupItem(_T("Delete this profile", 'dyngroup'), "delete_group", "delete", "id", "base", "computers");
}
if ($is_gp != 1) {
    // Simple group
    $actions['displayGroup'] = new ActionItem(_T("Display this group's content", 'dyngroup'), "display", "display", "id", "base", "computers");
    if (in_array("inventory", $_SESSION["supportModList"])) {
        $actions['inventory'] = new ActionItem(_T("Inventory on this group", "dyngroup"), "groupinvtabs", "inventory", "inventory", "base", "computers");
    } else {
        # TODO implement the glpi inventory on groups
        #    $n->addActionItem(new ActionItem(_T("Inventory on this group", "dyngroup"),"groupglpitabs","inventory","inventory", "base", "computers"));
    }
Exemplo n.º 6
0
function queryByAction($obj)
{
    global $wpdb;
    $table_name = $wpdb->prefix . "vlib_templates";
    $action = htmlspecialchars(trim($obj['action']));
    switch ($action) {
        /* ************************** */
        /* PLOTS */
        case 'save':
            $name = $obj['name'];
            $descr = $obj['description'];
            $graph = $obj['sceneGraph'];
            $placeholders = $obj['placeholders'];
            $thumbnail = $obj['thumbnail'];
            $tId = createTemplateQuery($name, $descr, $graph, $thumbnail);
            foreach ($placeholders as $pattern) {
                $pId = createPlaceholderQuery($pattern);
                createTemplateHasPlaceholderQuery($tId, $pId);
            }
            echo $tId;
            break;
        case 'update_t':
            $tId = $obj['id'];
            $name = $obj['name'];
            $descr = $obj['description'];
            $graph = $obj['sceneGraph'];
            $placeholders = $obj['placeholders'];
            $thumbnail = $obj['thumbnail'];
            /* delete patterns */
            $patterns = getPlaceholdersByPlotIdQuery($tId);
            if ($patterns) {
                foreach ($patterns as $pattern) {
                    deletePlaceholderByIdQuery($pattern->id);
                }
                /* delete plot-pattern mappings */
                deleteTemplateHasPlaceholderQuery($tId);
            }
            foreach ($placeholders as $pattern) {
                $pId = createPlaceholderQuery($pattern);
                createTemplateHasPlaceholderQuery($tId, $pId);
            }
            updateTemplateQuery($tId, $name, $descr, $graph, $thumbnail);
            print "Template <b>{$name}</b> has been updated.";
            break;
        case 'delete_t':
            $name = $obj['name'];
            $tId = $obj["id"];
            /* delete patterns */
            $patterns = getPlaceholdersByPlotIdQuery($tId);
            if ($patterns) {
                foreach ($patterns as $pattern) {
                    deletePlaceholderByIdQuery($pattern->id);
                }
                /* delete plot-pattern mappings */
                deleteTemplateHasPlaceholderQuery($tId);
            }
            /* delete plot*/
            $results = deleteTemplateByIdQuery($tId);
            if ($results === 1) {
                print $results;
            } else {
                print "There has been an error deleting the template!";
            }
            break;
        case 'get_t':
            $results = getTemplatesQuery();
            if (count($results) > 0) {
                print json_encode($results);
            }
            break;
        case 'get_t_id':
            $id = $obj['id'];
            $results = getTemplateByIdQuery($id);
            if (count($results) > 0) {
                print json_encode($results);
            }
            break;
            /* ************************** */
            /* GROUPS */
        /* ************************** */
        /* GROUPS */
        case 'save-group':
            $name = $obj['group']['config']['name'];
            $descr = $obj['group']['config']['description'];
            $group = $obj['group'];
            print createGroupQuery($name, $descr, $group);
            break;
        case 'load-group':
            $id = $obj['id'];
            $result = getGroupByIdQuery($id);
            $response = array(id => $result[0]->id, name => $result[0]->name, description => $result[0]->description, group => json_decode($result[0]->group_json));
            print json_encode($response);
            break;
        case 'load-all-groups':
            $result = getAllGroups();
            print json_encode($result);
            break;
        case 'load-all-group-definitions':
            $result = getAllGroupDefinitions();
            print json_encode($result);
            break;
        case 'delete-group':
            $id = $obj["id"];
            return deleteGroupQuery($id);
            break;
        case 'update-group':
            $id = $obj["id"];
            $name = $obj['group']['config']['name'];
            $description = $obj['group']['config']['description'];
            $group = $obj['group'];
            return updateGroupQuery($id, $name, $description, $group);
            break;
            /* ************************** */
            /* FILES */
        /* ************************** */
        /* FILES */
        case 'get_file_by_id':
            $id = $obj['id'];
            $results = getFileByIdQuery($id);
            echo json_encode($results);
            break;
        case 'get_files':
            $results = getFilesQuery();
            echo json_encode($results);
            break;
        case 'update-file-visibility':
            $id = $obj["id"];
            $isVisible = $obj['isVisible'];
            echo updateFileVisibilityQuery($id, $isVisible);
            break;
        case 'get_visible_files':
            $results = getVisibleFilesQuery();
            if (count($results) > 0) {
                print json_encode($results);
            }
            break;
        case 'delete_files':
            $files_ids = implode(",", $obj['files']);
            $dataFolder = "data/";
            /* unlink */
            foreach ($obj['files'] as $fileId) {
                $file = getFileByIdQuery($fileId);
                echo "try to unlink " . $dataFolder . $file[0]->file_path;
                if ($file[0]->file_path !== "") {
                    echo "try to unlink " . $dataFolder . $file[0]->file_path;
                    if (!unlink($dataFolder . $file[0]->file_path)) {
                        echo "unlink( " . $file[0]->file_path . " ) failed.";
                    } else {
                        echo "unlink " . $dataFolder . $file[0]->file_path;
                    }
                }
            }
            $results = deleteFilesQuery($files_ids);
            if (count($results) > 0) {
                print $results;
            } else {
                print "There has been an error deleting the file! ";
            }
            break;
        default:
    }
}
Exemplo n.º 7
0
        
        <!-- Google Fonts -->
        <link href='https://fonts.googleapis.com/css?family=Marcellus' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Josefin+Sans&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
        
    </head>
    <body>
        <?php 
require_once '../includes/session-start.req-inc.php';
require_once '../includes/access-required.html.php';
include_once '../functions/dbconnect.php';
include_once '../functions/util.php';
include_once '../functions/user_functions.php';
include_once '../functions/address_functions.php';
include_once '../functions/image_upload.php';
$address_groups = getAllGroups();
$user_id = $_SESSION['user_id'];
$address_group_id = '';
$fullname = '';
$email = '';
$address = '';
$phone = '';
$website = '';
$birthday = '';
if (isPostRequest()) {
    $address_group_id = filter_input(INPUT_POST, 'address_group_id');
    $fullname = filter_input(INPUT_POST, 'fullname');
    $email = filter_input(INPUT_POST, 'email');
    $address = filter_input(INPUT_POST, 'address');
    $phone = filter_input(INPUT_POST, 'phone');
    $website = filter_input(INPUT_POST, 'website');
Exemplo n.º 8
0
<?php

header('Content-Type: application/json');
require_once 'index.php';
require_once 'classes/group.php';
$value = array("error" => "Missing argument");
if (isset($_GET["action"])) {
    switch ($_GET["action"]) {
        case "getGroup":
            if (isset($_GET["id"])) {
                //Get player by id
                $value = getGroup($_GET["id"]);
                if ($value == false) {
                    $value = array("error" => "No group");
                }
            } else {
                $value = array("error" => "Missing argument");
            }
            break;
        case "getAllGroups":
            $value = getAllGroups(null);
            if ($value == false) {
                $value = array("error" => "No groups");
            }
            break;
    }
}
exit(json_encode($value));
Exemplo n.º 9
0
/**
 * Write new changelog
 */
function writeChangelog($ctype, $action, $result, $old, $new)
{
    /* set query, open db connection and fetch results */
    global $database;
    # get settings
    $settings = getAllSettings();
    if ($settings['enableChangelog'] == 1) {
        # get user details
        $cuser = getActiveUserDetails();
        # unset unneeded values and format
        if ($ctype == "ip_addr") {
            unset($new['action'], $new['subnet'], $new['type']);
        } elseif ($ctype == "subnet") {
            $new['id'] = $new['subnetId'];
            unset($new['action'], $new['subnetId'], $new['location'], $new['vrfIdOld'], $new['permissions']);
            # if section does not change
            if ($new['sectionId'] == $new['sectionIdNew']) {
                unset($new['sectionIdNew']);
                unset($new['sectionId']);
                unset($old['sectionId']);
            } else {
                $old['sectionIdNew'] = $old['sectionId'];
            }
            //transform subnet
            if (strlen($new['subnet']) > 0) {
                $new['subnet'] = Transform2decimal(substr($new['subnet'], 0, strpos($new['subnet'], "/")));
            }
        } elseif ($ctype == "section") {
            unset($new['action']);
        }
        # calculate diff
        if ($action == "edit") {
            //old - checkboxes
            foreach ($old as $k => $v) {
                if (!isset($new[$k]) && $v == 1) {
                    $new[$k] = 0;
                }
            }
            foreach ($new as $k => $v) {
                //change
                if ($old[$k] != $v && $old[$k] != str_replace("\\'", "'", $v)) {
                    //empty
                    if (strlen(@$old[$k]) == 0) {
                        $old[$k] = "NULL";
                    }
                    if (strlen(@$v) == 0) {
                        $v = "NULL";
                    }
                    //state
                    if ($k == 'state') {
                        $old[$k] = reformatIPStateText($old[$k]);
                        $v = reformatIPStateText($v);
                    } elseif ($k == 'sectionIdNew') {
                        //get old and new device
                        if ($old[$k] != "NULL") {
                            $dev = getSectionDetailsById($old[$k]);
                            $old[$k] = $dev['name'];
                        }
                        if ($v != "NULL") {
                            $dev = getSectionDetailsById($v);
                            $v = $dev['name'];
                        }
                    } elseif ($k == "masterSubnetId") {
                        if ($old[$k] == 0) {
                            $old[$k] = "Root";
                        } else {
                            $dev = getSubnetDetailsById($old[$k]);
                            $old[$k] = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
                        }
                        if ($v == 0) {
                            $v = "Root";
                        } else {
                            $dev = getSubnetDetailsById($v);
                            $v = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
                        }
                    } elseif ($k == 'switch') {
                        if ($old[$k] == 0) {
                            $old[$k] = "None";
                        } elseif ($old[$k] != "NULL") {
                            $dev = getDeviceDetailsById($old[$k]);
                            $old[$k] = $dev['hostname'];
                        }
                        if ($v == 0) {
                            $v = "None";
                        }
                        if ($v != "NULL") {
                            $dev = getDeviceDetailsById($v);
                            $v = $dev['hostname'];
                        }
                    } elseif ($k == 'vlanId') {
                        //get old and new device
                        if ($old[$k] == 0) {
                            $old[$k] = "None";
                        } elseif ($old[$k] != "NULL") {
                            $dev = getVLANById($old[$k]);
                            $old[$k] = $dev['name'] . " [{$dev['number']}]";
                        }
                        if ($v == 0) {
                            $v = "None";
                        } elseif ($v != "NULL") {
                            $dev = getVLANById($v);
                            $v = $dev['name'] . " [{$dev['number']}]";
                        }
                    } elseif ($k == 'vrfId') {
                        //get old and new device
                        if ($old[$k] == 0) {
                            $old[$k] = "None";
                        } elseif ($old[$k] != "NULL") {
                            $dev = getVRFDetailsById($old[$k]);
                            $old[$k] = $dev['name'] . " [{$dev['description']}]";
                        }
                        if ($v == 0) {
                            $v = "None";
                        } elseif ($v != "NULL") {
                            $dev = getVRFDetailsById($v);
                            $v = $dev['name'] . " [{$dev['description']}]";
                        }
                    } elseif ($k == 'masterSection') {
                        if ($old[$k] == 0) {
                            $old[$k] = "Root";
                        } else {
                            $dev = getSectionDetailsById($old[$k]);
                            $old[$k] = "{$dev['name']}";
                        }
                        if ($v == 0) {
                            $v = "Root";
                        } else {
                            $dev = getSectionDetailsById($v);
                            $v = "{$dev['name']}";
                        }
                    } elseif ($k == "permissions") {
                        # get old and compare
                        $new['permissions'] = str_replace("\\", "", $new['permissions']);
                        //Remove /
                        # Get all groups:
                        $groups = getAllGroups();
                        $groups = rekeyGroups($groups);
                        # reformat:
                        $newp = json_decode($new['permissions']);
                        $v = '';
                        foreach ($newp as $ke => $p) {
                            $v .= "<br>" . $groups[$ke]['g_name'] . " : " . parsePermissions($p);
                        }
                        $old[$k] = "";
                    }
                    $log["[{$k}]"] = "{$old[$k]} => {$v}";
                }
            }
        } elseif ($action == "add") {
            $log['[create]'] = "{$ctype} created";
        } elseif ($action == "delete") {
            $log['[delete]'] = "{$ctype} deleted";
            $new['id'] = $old['id'];
        } elseif ($action == "truncate") {
            $log['[truncate]'] = "Subnet truncated";
        } elseif ($action == "resize") {
            $log['[resize]'] = "Subnet Resized";
            $log['[New mask]'] = "/" . $new['mask'];
        } elseif ($action == "perm_change") {
            # get old and compare
            $new['permissions_change'] = str_replace("\\", "", $new['permissions_change']);
            //Remove /
            # Get all groups:
            $groups = getAllGroups();
            $groups = rekeyGroups($groups);
            # reformat
            if ($new['permissions_change'] != "null") {
                $newp = json_decode($new['permissions_change']);
                foreach ($newp as $k => $p) {
                    $log['[Permissions]'] .= "<br>" . $groups[$k]['g_name'] . " : " . parsePermissions($p);
                }
            }
        }
        //if change happened write it!
        if (isset($log)) {
            # format change
            foreach (@$log as $k => $l) {
                $changelog .= "{$k} {$l}\n";
            }
            $changelog = $database->real_escape_string(trim($changelog));
            # set insert query
            $query = "insert into `changelog` (`ctype`,`coid`,`cuser`,`caction`,`cresult`,`cdate`,`cdiff`) values ('{$ctype}', '{$new['id']}', '{$cuser['id']}', '{$action}', '{$result}', NOW(), '{$changelog}');";
            # execute
            try {
                $database->executeQuery($query);
            } catch (Exception $e) {
                $error = $e->getMessage();
                return true;
            }
            # mail it!
            # all good
            return true;
        }
    } else {
        return true;
    }
}
Exemplo n.º 10
0
 * $Id$
 *
 * This file is part of Mandriva Management Console (MMC).
 *
 * MMC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
/* Add new sidemenu item */
require_once "modules/dyngroup/includes/includes.php";
require_once "modules/pulse2/includes/profiles_xmlrpc.inc.php";
$sidemenu->addSideMenuItem(new SideMenuItem(_T("All groups", "dyngroup"), "base", "computers", "list", "img/machines/icn_allGroups_active.gif", "img/machines/icn_allGroups_ro.gif"));
$sidemenu->addSideMenuItem(new SideMenuItem(_T("Add a group", "dyngroup"), "base", "computers", "computersgroupcreator", "img/machines/icn_addGroup_active.gif", "img/machines/icn_addGroup_ro.gif"));
$items = array();
$groups = getAllGroups(array('canShow' => true, 'localSidebar' => true));
foreach ($groups as $group) {
    $isA = $group->isDyn() ? !$group->isRequest() ? _T('Static group:', 'dyngroup') : _T('Dynamic group:', 'dyngroup') : _T('Static group:', 'dyngroup');
    $s = new SideMenuItemNoAclCheck(sprintf("%s<br />%s", $isA, $group->getName()), "base", "computers", "display&gid=" . $group->id . "&groupname=" . $group->name);
    $s->setCssId("displayid" . $group->id);
    $items[$group->id] = $s;
    $sidemenu->addSideMenuItem($items[$group->id]);
}
Exemplo n.º 11
0
/**
 * get group data from all groups i have permission for
 * (all with right view alldetails, else my groups only
 *
 * @return array with group(object?)s
 */
function churchdb_getAllowedGroups()
{
    global $user;
    if (user_access("administer groups", "churchdb") || user_access("view alldetails", "churchdb")) {
        return getAllGroups();
    } else {
        return churchdb_GetMyGroups($user->id);
    }
}
Exemplo n.º 12
0
function displayEmail($template = "")
{
    global $sourceFolder, $urlRequestRoot;
    $newSelected = "";
    if ($template == "" || $template == "new") {
        $newSelected = " selected";
        $content = "";
    }
    $emailTemplates = "<select id='emailtemplates' name='emailtemplates'><option value='new'{$newSelected}>Create New Template</option>";
    $dir = "{$sourceFolder}/languages/" . LANGUAGE . "/email/templates/";
    $handle = opendir($dir);
    $subject = "";
    $content = "";
    while ($file = readdir($handle)) {
        if (substr($file, -4, 4) == ".txt") {
            $name = substr($file, 0, -4);
            if ($name == $template) {
                $emailTemplates .= "<option value='{$name}' selected> {$name} </option>";
                $content = fread(fopen($dir . $file, 'r'), filesize($dir . $file));
                $subject = $name;
            } else {
                $emailTemplates .= "<option value='{$name}'> {$name} </option>";
            }
        }
    }
    $emailTemplates .= "</select>";
    global $ICONS;
    $groups = getAllGroups();
    $users = getAllUsers();
    $ret = smarttable::render(array('rcpttable'), null);
    $ret .= <<<RET
\t<script type='text/javascript'>
\tvar grouplist = { {$groups} };
\tvar userlist = { {$users} };
\tfunction fetchEmail() {
\t\twindow.location = './+admin&subaction=openemail&name=' + document.getElementById('emailtemplates').value;
\t}
\t
\tfunction saveEmail(e) {
\t\tvar name = prompt("enter name for template", document.getElementById('subject').value);
\t\tif(name != '') {
\t\t\te.form.action += 'save&name=';
\t\t\te.form.action += name;
\t\t\te.form.submit();
\t\t}
\t}
\t
\tfunction renderCheckList(arr,class) {
\t\tvar ret = '<table name="rcptlisttable" id="rcpttable" class="userlisttable display"><thead><tr><th>Select Recipients</th></thead><tbody>';
\t\tfor(var key in arr)
\t\t\tret += "<tr><td><INPUT type=checkbox class=" + class + " value='" + key + "'>&nbsp;&nbsp;&nbsp;" + arr[key] + "</td></tr>";
\t\tret += "</tbody></table>";
\t\treturn ret;
\t}
\t
\tfunction selectAll() {
\t\tdocument.getElementById('recipient').innerHTML = 'All';
\t\tdocument.getElementById('list').innerHTML = 'All users selected';
\t}
\t
\tfunction selectGroups() {
\t\tdocument.getElementById('recipient').innerHTML = 'Selected Groups';
\t\tdocument.getElementById('list').innerHTML = "Group List:<br>" + renderCheckList(grouplist,'grouplist');
\t\tinitSmartTable();
\t}
\t
\tfunction selectUsers() {
\t\tdocument.getElementById('recipient').innerHTML = 'Selected Users';
\t\tdocument.getElementById('list').innerHTML = "User List:<br>" + renderCheckList(userlist,'userlist');
\t\tinitSmartTable();
\t}
\t
\tfunction getList(class) {
\t\tvar listarr = new Array();
\t\tvar list = document.getElementsByClassName(class);
\t\tvar l = list.length;
\t\tfor(var i = 0; i<l; i++)
\t\t\tif(list[i].checked)
\t\t\t\tlistarr.push(list[i].value);
\t\treturn listarr;
\t}
\t
\tfunction renderRecipient(arr) {
\t\tvar ret = '';
\t\tfor(var ele in arr)
\t\t\tret += arr[ele] + ', '
\t\tvar l = ret.length;
\t\tif(l>0)
\t\t\tret = ret.substring(0,l-2);
\t\treturn ret;
\t}
\t
\tfunction sendMail(e) {
\t\tvar recipient = document.getElementById('recipient').innerHTML;
\t\tvar recipients = 'all';
\t\tif(recipient == 'Selected Groups')
\t\t\trecipients = 'groups:' + renderRecipient(getList('grouplist'));
\t\telse if(recipient == 'Selected Users')
\t\t\trecipients = 'users:' + renderRecipient(getList('userlist'));
\t\tdocument.getElementById('recipients').value = recipients;
\t\te.form.action += 'send';
\t\te.form.submit();
\t}
\t</script>
\t<fieldset>
\t<legend>{$ICONS['Email Registrants']['small']}Email Registrants</legend>
\t<form name=emailcontent action='./+admin&subaction=email' method=POST>
\t<input type='hidden' id='recipients' name='recipients' value='all'>
\t<table border=0 margin=0 width=100%>
\t<tr><td>
\tSubject: <input type=text value='{$subject}' id=subject name=subject>
\t</td></tr>
\t<tr><td>
\tContent:
\t{$emailTemplates} <input type=button value=Open onClick='fetchEmail()'> <input type=button id=btnSave value=Save onClick='saveEmail(this);'>
\t<textarea cols=60 rows=15 name=templateContent>{$content}</textarea>
\t</td></tr>
\t</table>
\t<table border=0 margin=0 width=100%>
\t<tr><td style="text-align:center">
\tRecipients: <span id='recipient'>All</span><br/>
\t<input type=button value=All onClick='selectAll()'> <input type=button value='Select Groups' onClick='selectGroups()'> <input type=button value='Select Users' onClick='selectUsers()'></td>
\t</td></tr>
\t<tr><td>
\t<span id='list'>
\tAll users selected
\t</span>
\t</td>
\t</tr>
\t</table>
\t<input type=button value='Send Email' onClick='sendMail(this);'>
\t</form>
\t</fieldset>
RET;
    return $ret;
}
Exemplo n.º 13
0
	Script para manejar cualquier request para obtener datos de la base de datos
*/
require_once 'functions.php';
if (isset($_POST['id']) and isset($_POST['getData'])) {
    switch ($_POST['getData']) {
        case 0:
            echo json_encode(getUserGroups($_POST['id']));
            break;
        case 1:
            echo json_encode(getTeacherUserGroups($_POST['id']));
            break;
        case 2:
            echo json_encode(getTeachers());
            break;
        case 3:
            echo json_encode(getAllGroups());
            break;
        case 4:
            echo json_encode(getTasksFromClass($_POST['group']));
            break;
        case 5:
            echo json_encode(getStudentsFromClass($_POST['group']));
            break;
        case 6:
            echo json_encode(getAllGroupsReport());
            break;
        case 7:
            echo json_encode(getTeacherUserGroupsReport($_POST['id']));
            break;
        case 8:
            echo json_encode(getAllStudents());
Exemplo n.º 14
0
// Empty logger
logger("#############");
logger("");
// Empty logger
if (!isset($function) || $function == '') {
    logger("No function to call");
}
$rptuser = mysql_real_escape_string($rptuser);
if ($function == 'getUsers') {
    logger("Getting Users");
    getAllUsers();
    sendResponse($finalResult['UserInfo'], 'user');
} else {
    if ($function == 'getGroups') {
        logger("Getting Groups");
        getAllGroups();
        sendResponse($finalResult['GroupInfo'], 'group');
    } else {
        if ($function == 'getActions') {
            logger("Getting Actions");
            getAllActions();
            sendResponse($finalResult['ActionInfo'], 'action');
        } else {
            if ($function == 'getHosts') {
                logger("Getting Hosts");
                getAllHosts();
                sendResponse($finalResult['HostInfo'], 'host');
            } else {
                if ($function == 'getVolumes') {
                    logger("Getting Volumes");
                    getAllVolumes();
Exemplo n.º 15
0
if (count($results) > 0) {
    foreach ($results as $result) {
        echo '<tr class=""><td><a href="feed.php?gid=' . $result['idClass'] . '&tid=' . $result['id'] . '">' . $result['name'] . '</a></td></tr>';
    }
} else {
    echo '<tr class=""><td>No hay actividades recientes</td></tr>';
}
?>
        </tbody>
      </table>
      <legend>Mis Grupos</legend>
      <table class="table striped bordered hovered">
        <tbody>
          <?php 
if ($_SESSION['type'] == 0) {
    $results = getAllGroups();
} else {
    if ($_SESSION['type'] == 1) {
        $results = getTeacherUserGroups($_SESSION['id']);
    } else {
        $results = getUserGroups($_SESSION['id']);
    }
}
if (count($results) > 0) {
    foreach ($results as $result) {
        echo '<tr class=""><td><a href="groupSelection.php?id=' . $result['id'] . '">' . $result['name'] . '</a></td></tr>';
    }
} else {
    echo '<tr class=""><td>El usuario no está involucrado en ningún grupo</td></tr>';
}
?>