示例#1
0
 public function mark_content_as_accurate($json_encoded_parameters)
 {
     //Instanciate the workflow
     $workflow = new \Swiftriver\Core\Workflows\ContentServices\MarkContentAsAcurate();
     //run the workflow
     $json = $workflow->RunWorkflow($json_encoded_parameters, $this->apiKey);
     //return the json
     return $json;
 }
 /**
  * Communicates with the Swiftriver_Core API to mark the
  * source of a piece of content as acurate.
  * 
  * @param string $contentId
  * @param string $markerId 
  */
 public function markasaccurate($contentId, $markerId)
 {
     $coreFolder = DOCROOT . "/../Core/";
     $coreSetupFile = $coreFolder . "Setup.php";
     include_once $coreSetupFile;
     $workflowData = json_encode(array("id" => $contentId, "markerId" => $markerId));
     $workflow = new Swiftriver\Core\Workflows\ContentServices\MarkContentAsAcurate();
     $workflow->RunWorkflow($workflowData, "swiftriver_apala");
     //MG TODO: Change this to persist category and other nav choices
     //MG It'll do for now though :-)
     url::redirect(url::base());
 }
示例#3
0
 /**
 		change the weight of the feed source.
 */
 public function increment_source_rating($feedid, $sourceid)
 {
     $coreFolder = DOCROOT . "/../Core/";
     $coreSetupFile = $coreFolder . "Setup.php";
     include_once $coreSetupFile;
     $workflowData = json_encode(array("id" => $feedid, "markerId" => "swiftriver_apala_marker"));
     $workflow = new Swiftriver\Core\Workflows\ContentServices\MarkContentAsAcurate();
     $workflow->RunWorkflow($workflowData, "swiftriver_apala");
 }
<?php

namespace Swiftriver\Core\ServiceAPI\ChannelProcessingJobServices;

header('Content-type: application/json');
//Check for the existance of the unique Swift instance Key
if (!isset($_POST["key"])) {
    //If not found then return a JSON error
    echo '{"error":"The request to this service did not contain the required post data \'key\'"}';
    die;
} elseif (!isset($_POST["data"])) {
    //if not present then return a JSON error
    echo '{"error":"The request to this service did not contain the required post data \'data\'"}';
    die;
} else {
    //include the setup file
    include_once dirname(__FILE__) . "/../../Setup.php";
    //create a new workflow instance
    $workflow = new \Swiftriver\Core\Workflows\ContentServices\MarkContentAsAcurate();
    //Check that the key supplied works with this core instance
    if (!$workflow->CheckKey($_POST["key"])) {
        //If not then return an error in JSON
        echo '{"error":"The key you supplied is not registered with this instance of the Swiftriver Core"}';
        die;
    }
    //If all the key is ok, then run the workflow
    $json = $workflow->RunWorkflow($_POST["data"], $_POST["key"]);
    //Return the JSON result
    echo $json;
    die;
}