예제 #1
0
function addClassObject($class_name, $object_name)
{
    $class_id = addClass($class_name);
    $object = SQLSelectOne("SELECT ID FROM objects WHERE TITLE LIKE '" . DBSafe($object_name) . "'");
    if ($object['ID']) {
        return $object['ID'];
    } else {
        $object = array();
        $object['TITLE'] = $object_name;
        $object['CLASS_ID'] = $class_id;
        $object['ID'] = SQLInsert('objects', $object);
    }
}
 function install($data = '')
 {
     parent::install();
     subscribeToEvent($this->name, 'SAY');
     addClass('IRCBots');
     addClassProperty('IRCBots', 'message', 5);
     addClassProperty('IRCBots', 'pushMessage');
     //addClassProperty('IRCBots', 'alive');
     addClassProperty('IRCBots', 'updated');
     addClassProperty('IRCBots', 'updatedTime');
     addClassMethod('IRCBots', 'onNewMessage', '$this->setProperty("updated", time());' . "\n" . '$this->setProperty("updatedTime", date("H:i"));' . "\n" . '$this->setProperty("message", $params["message"]);');
     addClassObject('IRCBots', 'IRCBot1');
 }
예제 #3
0
파일: className.php 프로젝트: piiskop/pstk
     */
    public function setClassName($className)
    {
        $this->className = $className;
    }
}
$newObject = new obj();
/**
 * function for adding class name
 * @author Eleri<*****@*****.**>
 * @param obj $elem element 
 * @param string $cls new probably additional class name
 */
function addClass($elem, $cls)
{
    $a = explode(" ", $elem->getClassName());
    //mixed array_search ( $needle , array $haystack [, bool $strict = false ] )
    if (array_search($cls, $a, true) === false) {
        $a[] = $cls;
    }
    $elem->setClassName(implode(" ", $a));
}
addClass($newObject, 'new');
// obj.className='open menu new'
addClass($newObject, 'open');
// no changes (class already exists)
addClass($newObject, 'me');
// obj.className='open menu new me'
echo "<pre>";
echo $newObject->getClassName($newObject);
echo "</pre>";
예제 #4
0
파일: admin.php 프로젝트: sensenChen/Studyr
function tools()
{
    // does a second check to ensure you still are an admin and got to this page some how.
    if (checkadmin()) {
        //add admin
        if (isset($_POST['addAdmin'])) {
            // if the add admin button is selected do the add admin function
            addAdmin();
        }
        //add location
        if (isset($_POST['addLocation'])) {
            // same thing as the add admin but for locations
            addLocation();
        }
        //add professor
        if (isset($_POST['addProfessor'])) {
            // now for professors
            addProfessor();
        }
        //add class
        if (isset($_POST['addClass'])) {
            // finally for classes
            addClass();
        }
    } else {
        header("Location:../index.php");
        // if you fail the check go back to index.php and does give the user an error.
    }
}
예제 #5
0
    $ch = curl_init();
    $url = "http://connect.svuca.edu/services/registration/classes/drop_class.php";
    $postData = "studentID=" . $GLOBALS['student'] . "&token=" . $token . "&classID=" . $classId . "&yearterm=" . $GLOBALS['yearterm'];
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}
if (isset($_GET["action"])) {
    switch ($_GET["action"]) {
        case "addClass":
            $value = addClass($_GET["token"], $_GET["classId"], $_GET["fee"]);
            exit($value);
            break;
        case "dropClass":
            $value = dropClass($_GET["token"], $_GET["classId"]);
            exit($value);
            break;
        case "getStudentRecord":
            $value = getStudentRecord($_GET["token"]);
            break;
        case "getStudentClass":
            $value = geStudentClass($_GET["token"]);
            exit($value);
            break;
    }
}
예제 #6
0
            $days_array = $_GET['days_array'];
            $classes_array = $_GET['classes_array'];
            $css_top_array = $_GET['css_top_array'];
            $css_left_array = $_GET['css_left_array'];
            $css_bg_array = $_GET['css_bg_array'];
            $css_fore_array = $_GET['css_fore_array'];
            $css_width_array = $_GET['css_width_array'];
            // handle connection
            $connection = (include 'connection.php');
            if ($connection == null) {
                fwrite($fh, date("m/d/Y h:i:s a", time()) . "...ERROR Line#35 (store_classes.php): Can't get classes: " . PHP_EOL);
            } else {
                // emptyDB($fh, $connection);
                // store classes
                emptyTable($fh, $connection, 'classes');
                for ($i = 0; $i < count($classes_array); $i++) {
                    // add class
                    $class = $classes_array[$i];
                    $css_top = $css_top_array[$i];
                    $css_left = $css_left_array[$i];
                    $css_bg = $css_bg_array[$i];
                    $css_fore = $css_fore_array[$i];
                    $css_width = $css_width_array[$i];
                    $dayID = getClassDayID($fh, $connection, $days_array[$i]);
                    $class_id = addClass($fh, $connection, $class, $css_top, $css_left, $css_bg, $css_fore, $css_width, $dayID);
                }
            }
            fclose($fh);
        }
    }
}
예제 #7
0
<?php

include 'functions.php';
if (!empty($_POST)) {
    if (!empty($_POST['submit'])) {
        $submit = $_POST['submit'];
        if ($submit == 'add') {
            if (!empty($_POST['className']) && !empty($_POST['selectedDepartmentId']) && !empty($_POST['selectedProfessorId']) && !empty($_POST['selectedCourseId'])) {
                $departmentId = $_POST['selectedDepartmentId'];
                $className = $_POST['className'];
                $professorId = $_POST['selectedProfessorId'];
                $courseId = $_POST['selectedCourseId'];
                $isExecutedSuccessful = addClass($className, $departmentId, $professorId, $courseId);
            }
        } else {
            if ($submit == 'rename') {
                if (!empty($_POST['selectedClassId'])) {
                    $classId = $_POST['selectedClassId'];
                    if (!empty($_POST['className'])) {
                        $className = $_POST['className'];
                        $isExecutedSuccessful = renameClass($className, $classId);
                    }
                }
            } else {
                if ($submit == 'remove') {
                    if (!empty($_POST['selectedClassId'])) {
                        $classId = $_POST['selectedClassId'];
                        $isExecutedSuccessful = removeClass($classId);
                    }
                }
            }
<?php

$token = $_POST['token'];
require_once 'functions.php';
checkEmptyToken($token);
// Instantiate a connection
require_once 'connect.php';
global $conn;
checkExpiredToken($conn, $token);
$UID = getUserByToken($conn, $token);
// Get class name entered
$class = $_POST['class'];
$SID = getSchoolID($conn, $UID);
$course = addClass($conn, $SID, $UID, $class);
$conn->close();
echo json_encode($course);
die;