本文整理汇总了PHP中group::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP group::exists方法的具体用法?PHP group::exists怎么用?PHP group::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group
的用法示例。
在下文中一共展示了group::exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group
<?php
/******************************************************************************
* handle group adding backend here
******************************************************************************/
if (count($_REQUEST[group]) && ($_REQUEST[newgroup] || $_REQUEST[groupname])) {
// they chose a group
if (!$_REQUEST[newgroup]) {
$_REQUEST[newgroup] = $_REQUEST[groupname];
}
if (ereg("^[a-zA-Z0-9_-]{1,20}\$", $_REQUEST[newgroup])) {
$groupObj = new group($_REQUEST[newgroup], $_SESSION[auser]);
if (group::exists($_REQUEST[newgroup])) {
// already exists
if ($groupObj->fetchFromDB()) {
$groupObj->addClasses($_REQUEST[group]);
$groupObj->updateDB();
$list = implode(",", $groupObj->classes);
log_entry("classgroups", "{$_SESSION['auser']} updated {$_REQUEST['newgroup']} to be {$list}", "NULL", $groupObj->id, "classgroup");
} else {
$groupAddError = "Somebody has already created a class group with that name. Please try another name.";
}
} else {
// new group
$groupObj->addClasses($_REQUEST[group]);
$groupObj->updateDB();
log_entry("classgroups", "{$_SESSION['auser']} added {$_REQUEST['newgroup']} with " . implode(",", $groupObj->classes), "NULL", $groupObj->id, "classgroup");
}
} else {
$groupAddError = "Your group name is invalid. It may only contain alphanumeric characters, '_', '-', and be under 21 characters. No spaces, punctuation, etc.";
}
示例2: getClassesFromName
function getClassesFromName($name)
{
if (group::exists($name)) {
$query = "SELECT class_id FROM class INNER JOIN classgroup ON FK_classgroup = classgroup_id AND classgroup_name='" . addslashes($name) . "'";
// echo $query."<br />";
$r = db_query($query);
$classes = array();
while ($a = db_fetch_assoc($r)) {
$classes[] = generateCourseCode($a[class_id]);
}
return $classes;
}
return false;
}