コード例 #1
0
ファイル: functions.php プロジェクト: Michaeldgeek/NacossUnn
function getStudentsList_contactGroups(Admin $admin, $is_temp = 0, $gender = 'all')
{
    $user_id = $admin->getField('username');
    $level = $admin->getField('level');
    $students = getStudentsList($level, $gender, 'regno');
    $groups = array();
    $query = "select * from messenger_contacts_groups where username='******' and is_temp={$is_temp}";
    $link = AdminUtility::getDefaultDBConnection();
    $result = mysqli_query($link, $query);
    if ($result) {
        while ($row = mysqli_fetch_array($result)) {
            $group = array();
            $group['group_id'] = $row['id'];
            $group_members = array();
            $group_members_ids = explode(',', $row['group_members']);
            foreach ($group_members_ids as $menber_id) {
                $group_members[] = $students[$menber_id];
            }
            sortStudentsList($group_members, SORT_STUDENTS_TYPE_FIRSTNAME, ORDER_STUDENTS_ASC);
            $group = array_merge($group, $row);
            $group['group_members'] = $group_members;
            $groups[] = $group;
        }
        //end while
    }
    //Log error
    AdminUtility::logMySQLError($link);
    return $groups;
}
コード例 #2
0
<?php

//Initializing variables with default values
$defaultPage = "index.php?p=1";
$level = $admin->getField('level');
$groups = getStudentsList_contactGroups($admin, 0);
$students = getStudentsList($level);
$link = AdminUtility::getDefaultDBConnection();
$responce = "";
require_once '../class.SMS.php';
//require_once('class.Email.php');
if (isset($array['type']) and (isset($array['next']) or isset($array['send']))) {
    $type = $array['type'];
    if ($type == 'sms') {
        $sender_id = $array['sender_id'];
        $message_body = $array['message_body'];
        $num_of_sms_pages = $array['pages'];
    } elseif ($type == 'email') {
        $senders_name = $array['senders_name'];
        $reply_to = $array['reply_to'];
        $subject = $array['subject'];
        $message_body = $array['message_body'];
    }
    if (isset($array['send'])) {
        isset($array['groups']) ? $r_groups = $array['groups'] : ($r_groups = array());
        isset($array['contacts']) ? $r_contacts = $array['contacts'] : ($r_contacts = array());
        $contacts_ids = array();
        $contacts_ids = array_merge($r_contacts);
        //compile regno's
        foreach ($r_groups as $g) {
            $c = getByCol('messenger_contacts_groups', 'id', $g);