当前位置: 首页>>代码示例>>PHP>>正文


PHP group::exists方法代码示例

本文整理汇总了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.";
    }
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:31,代码来源:default.inc.php

示例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;
 }
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:14,代码来源:group.inc.php


注:本文中的group::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。