Example #1
0
 function getgrouplist($data, $printjson = true)
 {
     $ec = 1;
     $odata = 0;
     if ($printjson) {
         echo json_encode(array('ec' => $ec, 'data' => $odata)) . "\n";
     }
     $mymsggroup = Sqle::getA(gtable("mymsggroupdispordered", false), array("uid" => User::loginId()));
     load_view("template/msggroup.php", array("msggroup" => $mymsggroup));
 }
Example #2
0
 public static function autoscroll($query, $param, $key, $sort = '', $isloadold = true, $minl = null, $maxl = null)
 {
     setifnn($minl, $param["minl"]);
     setifnn($maxl, $param["maxl"]);
     if ($key != null) {
         if ($isloadold) {
             $querylimit = "select * from (" . gtable($query, false) . ") outpquery where ({$key}<{min} OR {min}=-1) " . ($param["minl"] == -1 ? '' : "limit {minl} ");
         } else {
             $querylimit = "select * from (" . gtable($query, false) . ") outpquery where {$key}>{max} " . ($param["maxl"] == -1 ? '' : "limit {maxl} ");
         }
     } else {
         //max,maxl must be +ve int
         $querylimit = "select * from (" . $query . ") outpquery limit {maxl} offset {max} ";
     }
     if ($key != null) {
         $querysort = "select * from (" . $querylimit . ") sortquery " . $sort;
     } else {
         $querysort = $querylimit;
     }
     $qresult = Sqle::getA($querysort, $param);
     $outp["qresult"] = $qresult;
     $outp["maxl"] = $maxl;
     $outp["minl"] = $minl;
     $outp["qresultlen"] = count($qresult);
     if ($key == null) {
         $outp["max"] = $param["max"] + $param["maxl"];
     } else {
         if (count($qresult) == 0) {
             $outp["min"] = $param["min"];
             $outp["max"] = $param["max"];
         } else {
             $e1 = $qresult[0][$key];
             $e2 = $qresult[count($qresult) - 1][$key];
             $s = new Special();
             $outp["min"] = $s->min($e1, $e2, $param["min"]);
             $outp["max"] = $s->max($e1, $e2, $param["max"]);
         }
     }
     return $outp;
 }
Example #3
0
function f_disp_action($req)
{
    if ($req["dispquery"] !== null) {
        $funcdata = map(Sqle::getA(gtable($req["dispquery"], false), $req["data"]), function ($inp) use($req) {
            return f_convertinp($inp, gget("convert", "todisp"), $req["dispconv"]);
        });
    } else {
        $funcdata = $req["data"];
    }
    if ($req["dispfuncs"] !== null) {
        $req["dispfuncs"] = giget("funcs", $req["dispfuncs"]);
        $funcdata = $req["dispfuncs"]($funcdata, $req["data"]);
    }
    load_view($req["view"], $funcdata);
}