本文整理汇总了PHP中group::getClassesFromName方法的典型用法代码示例。如果您正苦于以下问题:PHP group::getClassesFromName方法的具体用法?PHP group::getClassesFromName怎么用?PHP group::getClassesFromName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group
的用法示例。
在下文中一共展示了group::getClassesFromName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: timestamp2usdate
print "\n\t\t<tr>";
print "\n\t\t\t<td class='td{$color}' style='white-space: nowrap;'>";
print "\n\t\t\t\t<a href='viewlogs.php?{$sid}&site={$a['name']}' style='color: #000;'>";
//print "$yesterday";
if (strncmp($today, $a[editedtimestamp], 8) == 0 || strncmp($yesterday, $a[editedtimestamp], 8) == 0) {
print "<b>";
}
print timestamp2usdate($a[editedtimestamp], 1);
if (strncmp($today, $a[editedtimestamp], 8) == 0 || strncmp($yesterday, $a[editedtimestamp], 8) == 0) {
print "</b>";
}
print "</a>";
print "\n\t\t\t</td>";
print "\n\t\t\t<td class='td{$color}'>{$a['name']}</td>";
print "\n\t\t\t<td class='td{$color}' style='color: #" . ($a[active] ? "090'>active" : "900'>inactive") . "</td>";
print "\n\t\t\t<td class='td{$color}'>" . (group::getClassesFromName($a[name]) ? "group - " : "") . "{$a['type']}</td>";
print "\n\t\t\t<td class='td{$color}'>{$a['theme']}</td>";
print "\n\t\t\t<td class='td{$color}'>";
print "\n\t\t\t\t<a href='#' onclick='opener.window.location=\"index.php?{$sid}&action=site&site={$a['name']}\"'>";
print stripslashes($a[title]);
print "</a>";
print "\n\t\t\t</td>";
print "\n\t\t\t<td class='td{$color}'>";
print "{$a['addedbyfull']} ({$a['addedby']})";
print "</td>";
print "\n\t\t</tr>";
$color = 1 - $color;
}
} else {
print "\n\t\t<tr>\n\t\t\t<td colspan='7'>No sites found based on above criteria.</td>\n\t\t</tr>";
}
示例2: userlookup
* Lookup a student in userlookup
******************************************************************************/
if ($_REQUEST[n]) {
//include("config.inc.php");
//include("functions.inc.php");
$usernames = userlookup($_REQUEST[n], LDAP_BOTH, LDAP_WILD, LDAP_LASTNAME, 0);
}
/******************************************************************************
* Site Owner add student UI: get students in the class
******************************************************************************/
if (isset($_REQUEST[name])) {
//$ugroup_name = $_REQUEST[name];
$ugroup_id = db_get_value("ugroup", "ugroup_id", "ugroup_name = '" . addslashes($_REQUEST[name]) . "'");
// if the slot name has no group id then must be a grouped site
if (!isset($ugroup_id)) {
$classlist = group::getClassesFromName($_REQUEST[name]);
if (is_array($classlist)) {
$list = implode(", ", $classlist);
$ugroup_id = db_get_value("ugroup", "ugroup_id", "ugroup_name = '" . $classlist[0] . "'");
$class_id = $_REQUEST[name];
} else {
$ugroup_name = $_REQUEST[name];
$class_id = $ugroup_name;
}
} else {
$ugroup_name = $_REQUEST[name];
$class_id = $ugroup_name;
}
$_REQUEST[ugroup_id] = $ugroup_id;
$participants = getclassstudents($class_id);
/******************************************************************************
示例3: printSiteLine2
function printSiteLine2($siteInfo, $ed = 0, $isclass = 0, $atype = 'stud')
{
// The $ed parameter is a bunch of crap and makes assumptions about
// editor permissions that don't exist, such as profs of a class
// always being the owner. It should have no effect in this function.
global $color, $possible_themes;
global $sitesprinted;
global $_full_uri;
global $cfg;
$name = $siteInfo['slot_name'];
// printpre($siteInfo);
if (in_array($name, $sitesprinted)) {
return;
}
$sitesprinted[] = $name;
$exists = $siteInfo['site_exists'];
// printpre("exists:".$exists);
$namelink = $exists ? "{$PHP_SELF}?{$sid}&action=site&site={$name}" : "{$PHP_SELF}?{$sid}&action=add_site&sitename={$name}";
$namelink2 = $exists ? "{$PHP_SELF}?{$sid}&action=viewsite&site={$name}" : "{$PHP_SELF}?{$sid}&action=add_site&sitename={$name}";
printc("\n\t\t<tr>");
printc("\n\t\t\t<td class='td{$color}' colspan='2'>");
$status = $exists ? "Created" : "Not Created";
if ($exists) {
if ($siteInfo['site_active']) {
$active = "<span class='green'>active</span>";
} else {
$active = "<span class='red'>(inactive)</span>";
}
}
printc("\n\t\t\t\t<table width='100%' cellpadding='0' cellspacing='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='left'>");
if ($isclass && $_SESSION[atype] == 'prof' && (!$exists && (!$siteInfo['slot_owner'] || $_SESSION[auser] == $siteInfo['slot_owner']) || $exists && $_SESSION[auser] == $siteInfo['slot_owner'])) {
// if:
// isclass - is a class
// if it doesn't exist, either there is no owner or we are the owner.
// if it exists, the user the owner
printc("\n\t\t\t\t\t\t\t<input type='checkbox' name='group[]' value='{$name}' />");
}
printc("{$name} - ");
if ($exists) {
printc("\n\t\t\t\t\t\t\t<span style ='font-size:14px;'><a href='{$namelink}'>" . $siteInfo['site_title'] . "</a></span>");
} else {
if (!$siteInfo['slot_owner'] || $_SESSION[auser] == $siteInfo['slot_owner']) {
// if the slot doesn't have an owner or we are the owner.
if ($_SESSION[atype] == 'prof' && $isclass) {
//if ($isclass) {
printc("\n\t\t\t\t\t\t\t<span style ='font-size:10px;'>");
if ($cfg['disable_new_sites'] == TRUE && $_SESSION['ltype'] != 'admin') {
printc("Create: Site (disabled)");
} else {
printc("Create: <a href='{$namelink}'>Site</a> ");
}
printc("</span>");
} else {
if ($cfg['disable_new_sites'] == TRUE && $_SESSION['ltype'] != 'admin') {
printc("Create Site (disabled)");
} else {
printc("\n\t\t\t\t\t\t\t<span style ='font-size:10px;'><a href='{$namelink}'>Create Sites</a></span>");
}
}
} else {
// if the slot does have an owner that isn't us
printc("\n\t\t\t\t\t\t\t<span style ='font-size:10px;'>This site is owned by user \"" . $siteInfo['slot_owner'] . "\". Contact your system administrator if you feel you should own this site.</span>");
}
}
printc("\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td align='right'>");
printc($active ? "\n\t\t\t\t\t\t\t[{$active}]" : "");
printc("\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>");
//printc("<div style='padding-left: 20px;'>");
// Class Group printing
if ($siteInfo['is_classgroup']) {
$classlist = group::getClassesFromName($name);
$list = implode(", ", $classlist);
printc("\n\t\t\t\t<div style='padding-left: 20px; font-size: 10px;'>this is a group and contains the following classes: <b>{$list}</b><br />\n\t\t\t\t</div>");
$sitesprinted = array_merge($sitesprinted, $classlist);
}
if ($exists) {
$addedby = $siteInfo['site_addedby'];
/* $viewpermissions=$a[viewpermissions]; */
$added = timestamp2usdate($siteInfo['site_added_timestamp']);
$edited = $siteInfo['site_edited_timestamp'];
$editedby = $siteInfo['site_editedby'];
printc("\n\t\t\t\t<div style='padding-left: 20px; font-size: 10px;'>added by {$addedby} on {$added}" . ($editedby ? ", edited on " . timestamp2usdate($edited) : "") . "<br />\n\t\t\t\t</div>");
if (!ereg("^0000", $siteInfo['activatedate']) || !ereg("^0000", $siteInfo['deactivatedate'])) {
printc("\n\t\t\t\t<div style='padding-left: 20px; font-size: 10px;'>available: ");
printc(txtdaterange($siteInfo['activatedate'], $siteInfo['deactivatedate']));
printc("\n\t\t\t\t</div>");
}
printc("\n\t\t\t\t<div align='left'>");
$addr = "{$_full_uri}/sites/{$name}";
printc("\n\t\t\t\t\t<div style='padding-left: 20px; font-size: 12px;'>\n\t\t\t\t\t\tURL: <a href='{$addr}' target='_blank'>{$addr}</a><br />\n\t\t\t\t\t</div>\n\t\t\t\t</div>");
printc("\n\t\t\t\t<div align='right'>");
if ($_SESSION[auser] == $siteInfo['slot_owner'] || $siteInfo['hasPermissionDownA'] || $siteInfo['hasPermissionDownE'] || $siteInfo['hasPermissionDownD']) {
// if the user is an editor or the owner
printc("\n\t\t\t\t\t <a href='{$PHP_SELF}?{$sid}&action=viewsite&site={$name}'>edit</a> | ");
}
if ($_SESSION[auser] == $siteInfo['slot_owner'] || $siteInfo['hasSitePermissionA'] && $siteInfo['hasSitePermissionE'] && $siteInfo['hasSitePermissionD']) {
// if the user is the owner or a site-level editor...
printc("\n\t\t\t\t\t <a href='{$PHP_SELF}?{$sid}&action=edit_site&sitename={$name}'>settings</a> | ");
}
if ($_SESSION[auser] == $siteInfo['slot_owner']) {
//.........这里部分代码省略.........
示例4: foreach
if ($_REQUEST[viewpermissions] == "everyone") {
$_SESSION[siteObj]->setUserPermissionDown("view", "everyone", "1");
$_SESSION[siteObj]->addEditor("institute");
// $_SESSION[siteObj]->updatePermissionsDB();
$_SESSION[settings][viewpermissions] = "";
}
if ($_REQUEST[viewpermissions] == "institute") {
$_SESSION[siteObj]->setUserPermissionDown("view", "everyone", "0");
$_SESSION[siteObj]->setUserPermissionDown("view", "institute", "1");
// $_SESSION[siteObj]->updatePermissionsDB();
$_SESSION[settings][viewpermissions] = "";
}
if ($_REQUEST[viewpermissions] == "class") {
if (isgroup($_SESSION[settings][className])) {
// print "<br />".$_SESSION[siteObj]->getField("name")."is a classgroup";
$classes = group::getClassesFromName($_SESSION[settings][className]);
// print "<br />Classes contained:<pre>"; print_r($classes); print "</pre>";
foreach ($classes as $class) {
if (!$_SESSION[siteObj]->isEditor($class)) {
$_SESSION[siteObj]->addEditor($class);
// print "<br />Adding $class as editor";
}
$_SESSION[siteObj]->setUserPermissionDown("view", $class, "1");
// print "<br />Setting 1 view permission for $class";
}
} else {
if (!$_SESSION[siteObj]->isEditor($_SESSION[settings][className])) {
$_SESSION[siteObj]->addEditor($_SESSION[settings][className]);
}
$_SESSION[siteObj]->setUserPermissionDown("view", $_SESSION[settings][className], "1");
}
示例5: unset
$_SESSION[obj]->updateDB(1);
// print_r($_SESSION[obj]->editorsToDelete);
$_SESSION[obj]->deletePendingEditors();
// echo "<pre>";
// print_r($_SESSION[obj]);
unset($_SESSION[obj], $_SESSION[editors]);
Header("Location: close.php");
exit;
}
}
/******************************************************************************
* Editor Actions:
******************************************************************************/
if ($isOwner && $_REQUEST[edaction] == 'add') {
if (isgroup($_REQUEST[edname])) {
$classes = group::getClassesFromName($_REQUEST[edname]);
foreach ($classes as $class) {
$_SESSION[obj]->addEditor($class);
}
} else {
$_SESSION[obj]->addEditor($_REQUEST[edname]);
}
}
if ($isOwner && $_REQUEST[edaction] == 'del') {
$_SESSION[obj]->delEditor($_REQUEST[edname]);
}
/******************************************************************************
* switch between forms 1 and 2
******************************************************************************/
$step = $_REQUEST['step'];
if (!$isOwner && $isEditor) {
示例6: outputForm
function outputForm(&$o, $d = 0, $canAddEditors = true)
{
global $cfg;
$sitename = $o->owning_site;
if ($_SESSION[settings][edit] && !$o->builtPermissions) {
$o->buildPermissionsArray();
}
// ---- Editor actions ----
if ($_REQUEST[edaction] == 'add') {
if (isgroup($_REQUEST[edname])) {
$classes = group::getClassesFromName($_REQUEST[edname]);
foreach ($classes as $class) {
$o->addEditor($class);
}
} else {
$o->addEditor($_REQUEST[edname]);
}
}
if ($_REQUEST[edaction] == 'del') {
$o->delEditor($_REQUEST[edname]);
}
printc("\n<input type='hidden' name='edaction' value='' />");
printc("\n<input type='hidden' name='edname' value='' />");
if ($className = $sitename) {
print "<script type='text/javascript'>";
print "\n// <![CDATA[";
print "\nfunction addClassEditor() {";
print "\n\tf = document.addform;";
print "\n\tf.edaction.value='add';";
print "\n\tf.edname.value='{$className}';";
print "\n\tf.submit();";
print "\n}";
print "\n// ]]>";
print "\n</script>";
}
$a = array(0 => 4, 1 => 1);
printc("\n<style type='text/css'>th, .td0, .td1 {font-size: 10px;}</style>");
printc("\n<table width='100%' style='border: 1px solid gray'>");
printc("\n<tr><th width='50%'>name</th>\t<th colspan='" . $a[$d] . "' width='30%'>permissions</th>");
if ($canAddEditors) {
printc("<th>del</th>");
}
printc("</tr>");
printc("\n<tr><th> </th>" . ($d ? "<th>discuss</th>" : "<th>add</th><th>edit</th><th>delete</th><th>view</th>"));
if ($canAddEditors) {
printc("<th> </th>");
}
printc("</tr>");
if ($edlist = $o->getEditors()) {
$permissions = $o->getPermissions();
if (count($edlist)) {
$color = 0;
foreach ($edlist as $e) {
// :: hack ::
// this is needed until "anonymous" discussion is enabled. could be v 2.0
//if ($e == 'everyone') continue;
// :: /hack ::
printc("\n<tr><td class='td{$color}' align='left'>");
if ($e == "everyone") {
printc("Everyone (will override other entries)</td>");
} else {
if ($e == "institute") {
printc($cfg[inst_name] . " Users</td>");
} else {
printc(ldapfname($e) . " ({$e})</td>");
}
}
for ($i = 0; $i < 5; $i++) {
$skip = 0;
$nob = 0;
if ($d && $i < 4) {
$skip = 1;
}
if (!$d && $i == 4) {
$skip = 1;
}
if (!$d && (($e == 'everyone' || $e == 'institute') && $i != 3)) {
$nob = 1;
}
if (!$skip) {
printc("\n<td class='td{$color}' align='center'>");
if ($nob) {
printc(" ");
} else {
printc("\n<input type='checkbox' name='permissions[{$e}][{$i}]' value='1'" . ($permissions[$e][$i] ? " checked='checked'" : "") . " />");
}
printc("</td>");
}
if ($skip || $nob) {
printc("\n<input type='hidden' name='permissions[{$e}][{$i}]' value='" . $permissions[$e][$i] . "' />");
}
}
printc("</td>");
if ($canAddEditors) {
printc("\n<td class='td{$color}' align='center'>");
if ($e == 'everyone' || $e == 'institute') {
printc(" ");
} else {
printc("<a href='#' onclick='delEditor(\"{$e}\");'>remove</a>");
}
//.........这里部分代码省略.........
示例7: addslashes
$site = $_REQUEST[site];
$title = $_REQUEST[title];
}
if (!isset($order)) {
$order = "fname asc";
}
$order = addslashes($order);
$orderby = " order by {$order}";
$w = array();
//if ($type) $w[]="type='$type'";
//if ($site) $w[]="site='$name'";
if ($_REQUEST[user]) {
$w[] = "user2.user_uname like '%" . addslashes($user) . "%'";
}
if ($_REQUEST[site]) {
$isgroup = ($classlist = group::getClassesFromName($_REQUEST[site])) ? 1 : 0;
if ($isgroup) {
$class_terms = array();
foreach ($classlist as $code) {
$terms[] = "(" . generateTermsFromCode($code) . ")";
}
$arg = "(";
$arg .= implode(" OR ", $classlist);
$arg .= ")";
$w[] = $arg;
} else {
// $w[]="class_code like '%$site%'";
$w[] = generateTermsFromCode($site);
}
}
//if ($title) $w[]="title like '%$title%'";