コード例 #1
0
ファイル: new.php プロジェクト: Glavnyuk/hd.rustem
<?php 
        /* $qstring = "SELECT fio as label, id as value FROM users where status='1' and login !='system' order by fio ASC;";
                       $result = mysql_query($qstring);//query the database for entries containing the term
        			while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){
        			*/
        $stmt = $dbConnection->prepare('SELECT fio as label, id as value FROM users where status=:n and login !=:system order by fio ASC');
        $stmt->execute(array(':n' => '1', ':system' => 'system'));
        $res1 = $stmt->fetchAll();
        foreach ($res1 as $row) {
            //echo($row['label']);
            $row['label'] = $row['label'];
            $row['value'] = (int) $row['value'];
            if (get_user_status_text($row['value']) == "online") {
                $s = "status-online-icon";
            } else {
                if (get_user_status_text($row['value']) == "offline") {
                    $s = "status-offline-icon";
                }
            }
            ?>
                    <option data-foo="<?php 
            echo $s;
            ?>
" value="<?php 
            echo $row['value'];
            ?>
"><?php 
            echo nameshort($row['label']);
            ?>
 </option>
コード例 #2
0
ファイル: actions.php プロジェクト: Joker1982/inv
     print json_encode($results);
 }
 if ($mode == "get_users_list") {
     $idzz = $_POST['unit'];
     $stmt = $dbConnection->prepare('SELECT fio, id, unit FROM users where id != 1 and status =1');
     $stmt->execute();
     $result = $stmt->fetchAll();
     foreach ($result as $row) {
         $un = $row['fio'];
         $ud = (int) $row['id'];
         $u = explode(",", $row['unit']);
         if (in_array($idzz, $u)) {
             if (get_user_status_text($ud) == "online") {
                 $s = "status-online-icon";
             } else {
                 if (get_user_status_text($ud) == "offline") {
                     $s = "status-offline-icon";
                 }
             }
             $results[] = array('name' => nameshort($un), 'stat' => $s, 'co' => $ud);
         }
     }
     print json_encode($results);
 }
 if ($mode == "edit_helper") {
     $hn = $_POST['hn'];
     $stmt = $dbConnection->prepare('select id, user_init_id, unit_to_id, dt, title, message, hashname from helper where hashname=:hn');
     $stmt->execute(array(':hn' => $hn));
     $fio = $stmt->fetch(PDO::FETCH_ASSOC);
     $u = $fio['unit_to_id'];
     ?>