Beispiel #1
0
 public function GetEntityView($param)
 {
     $db = new Database();
     $filters = isset($param["filter"]) ? $param["filter"] : '';
     $result = $db->RunSP($param["entityViewID"], $filters);
     $ret = JSONHelper::GetJSON($result, 'records');
     return $ret;
 }
Beispiel #2
0
 public function GetEntityView($param, $table)
 {
     $db = new Database();
     $result = $db->RunSP($param["entityViewID"], $param["filters"]);
     if ($table) {
         $tables = array('records', 'row');
         $tablesValues = array($result);
         array_push($tablesValues, $table);
         $ret = JSONHelper::GetJsonFromTables($tablesValues, $tables);
     } else {
         $ret = JSONHelper::GetJSON($result, 'records');
     }
     return $ret;
 }
Beispiel #3
0
 public function SaveCustomFields($customFields)
 {
     $fields = "Name,TableName,Description,Type,Config";
     $sql = "";
     for ($i = 0; $i < count($customFields); $i++) {
         $field = $customFields[$i];
         if ($field["sysrowstate"] == "0") {
             $values = SqlHelper::GetValues(explode(",", $fields), $field);
             $sql .= 'ALTER TABLE ' . $field["TableName"] . ' ADD CF_' . $field["Name"] . ' VARCHAR( 255 );';
             $sql .= 'INSERT INTO CustomField(' . $fields . ') VALUES(' . $values . ');';
         } elseif ($field["sysrowstate"] == "1") {
             $sql .= 'UPDATE CustomField SET Description = "' . $field["Description"] . '",Config = "' . $field["Config"] . '" WHERE CFId = ' . $field["CFId"] . ';';
         } elseif ($field["sysrowstate"] == "2") {
             $sql .= 'UPDATE CustomField SET Archive = 1 WHERE CFId = ' . $field["CFId"] . ';';
         }
         //$sql = str_replace("#".$i, $param, $sql);
     }
     $db = new Database();
     $result = $db->ExecuteSQL($sql);
     return JSONHelper::GetJSON(array(), 'records');
 }
Beispiel #4
0
 public function UpdateDNFCode($bo)
 {
     $sql = 'SELECT rb.raceboatid, bs.formula as formula, rb.divisionid FROM raceboat rb INNER JOIN boatstatus bs ON bs.boatstatusid = rb.boatstatusid WHERE length(rb.boatstatusid) > 0 AND raceid = "' . $bo . '"';
     $db = new Database();
     $result = $db->RunSQL($sql);
     foreach ($result as $boat) {
         if (strpos($boat['formula'], 'CountS') !== false) {
             $sql = 'SELECT COUNT(*) as c FROM raceboat WHERE signondate is not null AND raceid = "' . $bo . '" and divisionid = "' . $boat['divisionid'] . '"';
             $result2 = $db->RunSQL($sql);
             $f = str_replace("CountS", $result2[0]['c'], $boat['formula']);
             $sql2 = 'UPDATE raceresult SET score = ' . $f . ' where raceboatid = "' . $boat['raceboatid'] . '"';
             $result2 = $db->RunSQL($sql2);
         }
         if (strpos($boat['formula'], 'CountR') !== false) {
             $sql = 'SELECT COUNT(*) as c FROM raceboat WHERE signondate is not null AND raceid = "' . $bo . '" and divisionid = "' . $boat['divisionid'] . '"';
             $result2 = $db->RunSQL($sql);
             $f = str_replace("CountR", $result2[0]['c'], $boat['formula']);
             $sql2 = 'UPDATE raceresult SET score = ' . $f . ' where raceboatid = "' . $boat['raceboatid'] . '"';
             $result2 = $db->RunSQL($sql2);
         }
         if (strpos($boat['formula'], 'CountFEx') !== false) {
             $sql = 'SELECT COUNT(*) as c FROM raceboat WHERE signondate is not null AND raceid = "' . $bo . '" and divisionid = "' . $boat['divisionid'] . '"';
             $result2 = $db->RunSQL($sql);
             $f = str_replace("CountFex", $result2[0]['c'], $boat['formula']);
             $sql2 = 'UPDATE raceresult SET score = ' . $f . ' where raceboatid = "' . $boat['raceboatid'] . '"';
             $result2 = $db->RunSQL($sql2);
         }
         if (strpos($boat['formula'], 'CountFInc') !== false) {
             $sql = 'SELECT COUNT(*) as c FROM raceboat WHERE signondate is not null AND raceid = "' . $bo . '" and divisionid = "' . $boat['divisionid'] . '"';
             $result2 = $db->RunSQL($sql);
             $f = str_replace("CountFInc", $result2[0]['c'], $boat['formula']);
             $sql2 = 'UPDATE raceresult SET score = ' . $f . ' where raceboatid = "' . $boat['raceboatid'] . '"';
             $result2 = $db->RunSQL($sql2);
         }
     }
     $ret = JSONHelper::GetJSON($result, 'records');
     return $ret;
 }
Beispiel #5
0
        //Validate extension
        $isValidExtension = $ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'gif';
        if (!$isValidExtension) {
            $response->success = false;
            $response->message = '';
        } else {
            //Move file to app
            $uid = uniqid("", true) . "." . $ext;
            if (move_uploaded_file($temp_file_name, "..//common//images//uploaded//" . $uid)) {
                //create thumb
                $filename = "..//common//images//uploaded//" . $uid;
                $thumb = "..//common//images//uploaded//thumb_" . $uid;
                list($width, $height) = getimagesize($filename);
                $new_width = $width > 60 ? 60 : $width;
                $new_height = $height > 50 ? 50 : $height;
                $image_p = imagecreatetruecolor($new_width, $new_height);
                $image = imagecreatefromjpeg($filename);
                imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
                imagejpeg($image_p, $thumb, 100);
                //end thumb
                $response->success = true;
                $response->uid = $uid;
            } else {
                $response->success = false;
                $response->message = '';
            }
        }
    }
}
echo JSONHelper::GetJSON($response, 'results');
Beispiel #6
0
 public function deleteDivision($bo)
 {
     $sql .= 'DELETE FROM division' . ' WHERE divisionid = "' . $bo['divisionid'] . '"';
     $db = new Database();
     $db->ExecuteSQL($sql);
     return JSONHelper::GetJSON($id, 'result');
 }