public function getMaxMetaContentId($request) { $json = json_encode($request->parameters); $contents = new ContentFile(); $jsonObj = json_decode($json); $jsonMessage = $contents->validateJsonForContentMetadata($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; } $maxMCFID = $contents->getMaxMetaContentId($contents); if (!empty($maxMCFID)) { $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'maxMCFID' => $maxMCFID['maxChildId']); $this->outputSuccess($response); return; } else { $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'msgs' => 'No Content File available !.'); $this->outputError($response); return; } }
public function createNewPaths($request) { $json = json_encode($request->parameters); $contents = new ContentFile(); $jsonObj = json_decode($json); $this->config = new Config\Config(); $jsonMessage = $contents->validateJsonForFileType($jsonObj); if ($jsonMessage != Message::SUCCESS) { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage); $this->outputError($response); return; } if (trim($jsonObj->fileType) == '') { $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_CMD_ID); $this->outputError($response); return; } $fileType = $jsonObj->fileType; if ($fileType == 1) { //main files $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => 'Do not play with main files !'); $this->outputError($response); } else { $contentFiles = $contents->getContentFiles($fileType); } if (!empty($contentFiles)) { for ($i = 0; $i < count($contentFiles); $i++) { //$contentFiles[$i]['PreviewURL'] = self::createStreamingPath( $contentFiles[$i]['TuneName'] ); $contentFiles[$i]['DownloadingURL'] = self::createDownloadingPath($contentFiles[$i]['FileName'], $fileType); $updatePaths = $contents->updateContentFilePaths($contentFiles); } } if ($updatePaths) { $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'msg' => 'Records were updated'); $this->outputSuccess($response); return; } else { $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'msgs' => 'Records not updated'); $this->outputError($response); return; } }