Ejemplo n.º 1
0
/**
 * 
 * @param type $sql
 * @param type $fieldname
 * @return type
 */
function list_ManyResult($sql, $fieldname) {
    // require hierarchy
    if ($fieldname == 'faculte') {
        require_once 'include/lib/hierarchy.class.php';
    }
    $resu = array();
    $res = Database::get()->queryArray($sql);
    foreach ($res as $resA) {
        if ($fieldname == 'faculte') {
            $name = hierarchy::unserializeLangField($resA->faculte);
        } else {
            $name = $resA->$fieldname;
        }
        $resu[$name] = $resA->nb;
    }
    return $resu;
}
Ejemplo n.º 2
0
            break;
        default:
            break;
    }
    // end of switch
} else {
    // show username as well (useful)
    $sql = Database::get()->queryArray("SELECT id, givenname, surname, username, faculty_id, date_open, comment, password FROM user_request\n                                WHERE (state = 1 AND status = {$list_status} {$depqryadd})");
    if (count($sql) > 0) {
        $tool_content .= "<div class='table-responsive'><table id='requests_table' class='table-default'>";
        $tool_content .= table_header();
        $tool_content .= "<tbody>";
        foreach ($sql as $req) {
            $tool_content .= "<td>" . q($req->givenname) . "&nbsp;" . q($req->surname) . "</td>";
            $tool_content .= "<td>" . q($req->username) . "</td>";
            $tool_content .= "<td>" . hierarchy::unserializeLangField(find_faculty_by_id($req->faculty_id)) . "</td>";
            $tool_content .= "<td align='center'>\n                                <small>" . nice_format(date('Y-m-d', strtotime($req->date_open))) . "</small></td>";
            $tool_content .= "<td class='option_btn_cell'>";
            switch ($req->password) {
                case 'pop3':
                    $link = "../auth/ldapnewprofadmin.php?id={$req->id}&amp;auth=2";
                    $authmethod = "({$langViaPop})";
                    break;
                case 'imap':
                    $link = "../auth/ldapnewprofadmin.php?id={$req->id}&amp;auth=3";
                    $authmethod = "({$langViaImap})";
                    break;
                case 'ldap':
                    $link = "auth/ldapnewprofadmin.php?id={$req->id}&amp;auth=4";
                    $authmethod = "({$langViaLdap})";
                    break;