public function updateContentMetadata($request) { $json = json_encode($request->parameters); $contents = new Contents(); $jsonObj = json_decode($json); $jsonMessage = $contents->validateJsonForUpdateInfo($jsonObj); if ($jsonMessage != Message::SUCCESS) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage); $this->outputError($response); return; } if (!$contents->setValuesFromJsonObj($jsonObj)) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_INVAID_REQUEST_BODY); $this->outputError($response); return; } if (trim($contents->cm_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CMD_ID); $this->outputError($response); return; } if (trim($contents->cm_state) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_STATE); $this->outputError($response); return; } /*if (trim( $contents->cm_streaming_url ) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CF_BASE_URL ); $this->outputError($response); return; } if (trim( $contents->cm_downloading_url ) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CF_URL ); $this->outputError($response); return; }*/ $contents = $contents->updateContentMetadata($contents); if (!empty($contents)) { $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'contents' => $contents); $this->outputSuccess($response); return; } else { $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'msgs' => 'No data updated !.'); $this->outputError($response); return; } }
public function isContentFileExist($request) { $json = json_encode($request->parameters); $contents = new Contents(); $jsonObj = json_decode($json); $jsonMessage = $contents->validateJsonForUpdateInfo($jsonObj); if ($jsonMessage != Message::SUCCESS) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage); $this->outputError($response); return; } if (!$contents->setValuesFromJsonObj($jsonObj)) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_INVAID_REQUEST_BODY); $this->outputError($response); return; } if (trim($contents->cf_cm_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CMD_ID); $this->outputError($response); return; } if (trim($contents->cf_template_id) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CF_TEMPLATE_ID); $this->outputError($response); return; } if (trim($contents->cf_name) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CF_USER_NAME); $this->outputError($response); return; } $isContentFileExist = $contents->isContentFileExist($contents); if (!empty($isContentFileExist)) { $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'isContentFileExist' => $isContentFileExist); $this->outputSuccess($response); return; } else { $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'msgs' => 'No upload files available !.'); $this->outputError($response); return; } }