Example #1
0
 public static function insertArtist($name, $bio, $twitter_id, $facebook_id, $google_id, $url, $instagram_id, $tumblr_id, $img_url, $img_file_path, $area, $is_active)
 {
     if (!is_string($name) || strlen($name) <= 0) {
         return MyUtil::fnOk(false, "Name must be at least 1 character", null);
     }
     $stm = "INSERT INTO " . self::$table_name . "(is_active,name,bio,twitter_id,facebook_id,google_id,url," . "instagram_id,tumblr_id,img_url,img_file_path,updated_ts,updated_by, area) VALUES (" . "('{$is_active}' = '1'), " . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($name, "")) . "', ''), " . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($bio, "")) . "', ''), " . "nullIf('" . MyUtil::nvl($twitter_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($facebook_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($google_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($url, "") . "', ''), " . "nullIf('" . MyUtil::nvl($instagram_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($tumblr_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($img_url, "") . "', ''), " . "nullIf('" . MyUtil::nvl($img_file_path, "") . "', ''), " . "CURRENT_TIMESTAMP, " . "'" . $_SESSION['user'] . "', " . "nullIf('" . MyUtil::nvl($area, '') . "','') " . ")";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, "SQL Error", null);
     }
     return MyUtil::fnOk(true, "Artist Inserted", $result);
 }
Example #2
0
 public static function insertVideo($artist_id, $session_id, $name, $description, $youtube_id, $iframe_url, $votes, $upload_status_nbr, $video_status_nbr, $file, $is_active)
 {
     if (!is_string($name) || strlen($name) <= 0) {
         return MyUtil::fnOk(false, "Name must be at least 1 character", null);
     }
     $orig_artist_id = $artist_id;
     $artist_id = MyUtil::parseInt($artist_id);
     if ($artist_id == null) {
         return MyUtil::fnOk(false, "Must be a valid artist id: {$orig_artist_id}", null);
     }
     $orig_session_id = $session_id;
     $session_id = MyUtil::parseInt($session_id);
     if ($session_id == null) {
         return MyUtil::fnOk(false, "Must be a valid session id: {$orig_session_id}", null);
     }
     $stm = "INSERT INTO " . self::$table_name . "(artist_id,session_id,name,description,youtube_id,iframe_url," . "votes,upload_status_nbr,video_status_nbr,updated_ts,updated_by,file,is_active) VALUES ( " . "nullIf('" . MyUtil::nvl($artist_id, -1) . "', -1), " . "nullIf('" . MyUtil::nvl($session_id, -1) . "', -1), " . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($name, "")) . "', ''), " . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($description, "")) . "', ''), " . "nullIf('" . MyUtil::nvl($youtube_id, "") . "', ''), " . "nullIf('" . MyUtil::nvl($iframe_url, "") . "', ''), " . "nullIf('" . MyUtil::nvl(MyUtil::null_if($votes, ''), 0) . "', -1), " . "nullIf('" . MyUtil::nvl($upload_status_nbr, 0) . "', -1), " . "nullIf('" . MyUtil::nvl($video_status_nbr, 0) . "', -1), " . "CURRENT_TIMESTAMP, " . "'" . $_SESSION['user'] . "', " . "nullIf('" . MyUtil::nvl($file, "") . "', ''), " . "'" . MyUtil::nvl($is_active, "false") . "' " . ")";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, "SQL Error", null);
     }
     return MyUtil::fnOk(true, "Inserted Video", $result);
 }
Example #3
0
 public static function insertSession($name, $description, $start_ts, $end_ts, $winner_video_id, $area, $is_active, $img_url)
 {
     if (!is_string($name) || strlen($name) <= 0) {
         return MyUtil::fnOk(false, "Name must be at least 1 character", null);
     } else {
         if (!is_string($start_ts) || !MyUtil::isDateFormat($start_ts)) {
             return MyUtil::fnOk(false, "start_ts must be in yyyy-mm-dd format: {$start_ts}", null);
         } else {
             if (!is_string($end_ts) || !MyUtil::isDateFormat($end_ts)) {
                 return MyUtil::fnOk(false, "end_ts must be in yyyy-mm-dd format: {$end_ts}", null);
             }
         }
     }
     $stm = "INSERT INTO " . self::$table_name . "(name, description, start_ts, end_ts, area, updated_ts, updated_by, is_active, img_url) VALUES (" . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($name, "")) . "', ''), " . "nullIf('" . MyUtil::prepareSqlString(MyUtil::nvl($description, "")) . "', ''), " . "to_timestamp('{$start_ts}','yyyy-mm-dd'), " . "to_timestamp('{$end_ts}','yyyy-mm-dd'), " . "nullIf('" . MyUtil::nvl($area, '') . "',''), " . "CURRENT_TIMESTAMP, " . "'" . $_SESSION['user'] . "', " . "('{$is_active}' = '1'), " . "'{$img_url}'" . ")";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, "SQL Error", null);
     }
     return MyUtil::fnOk(true, "Session Inserted", $result);
 }