Example #1
0
function getVisByTag($tag)
{
    global $db;
    $sql = "SELECT * FROM tagIndex, tagExperimentMap, experiments\n\t\t\tWHERE tagIndex.value = '{$tag}' \n\t\t\tAND tagIndex.tag_id = tagExperimentMap.tag_id \n\t\t\tAND experiments.experiment_id = tagExperimentMap.experiment_id \n\t\t\tAND tagIndex.weight = 1";
    $output = $db->query($sql);
    if ($db->numOfRows) {
        $results = array();
        foreach ($output as $out) {
            $vises = getVisByExperiment($out['experiment_id']);
            if ($vises) {
                foreach ($vises as $v) {
                    array_push($results, $v);
                }
            }
        }
        return $results;
    }
    return false;
}
Example #2
0
     }
     break;
 case "getExperimentFields":
     if (isset($_REQUEST['experiment'])) {
         $id = safeString($_REQUEST['experiment']);
         $dataset = getFields($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
     break;
 case "getExperimentVisualizations":
     if (isset($_REQUEST['experiment'])) {
         $id = safeString($_REQUEST['experiment']);
         $dataset = getVisByExperiment($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
     break;
 case "getExperimentTags":
     if (isset($_REQUEST['experiment'])) {
         $id = safeString($_REQUEST['experiment']);
         $dataset = getTagsForExperiment($id);
         if ($dataset) {
             $data = $dataset;
             $status = 200;
         }
     }
Example #3
0
 // Make calls to pull data from db
 $fields = array();
 $vises = array();
 $tags = array();
 $videos = array();
 $images = array();
 $sessions = array();
 $collabs = array();
 if ($is_activity) {
     $fields = getFields($meta['activity_for']);
     $tags = getTagsForExperiment($meta['activity_for']);
     $sessions = getSessionsForExperiment($id);
     $vises = getResponsesForActivity($id);
 } else {
     $fields = getFields($id);
     $vises = getVisByExperiment($id);
     $tags = getTagsForExperiment($id);
     $videos = getVideosForExperiment($id);
     $images = getImagesForExperiment($id);
     $collabs = getExperimentCollaborators($ownerid, $id);
     $sessions = getSessionsForExperiment($id);
 }
 // Process the images for display
 $image_urls = array();
 if ($images) {
     foreach ($images as $img) {
         array_push($image_urls, array('source' => $img['provider_url'], 'set_url' => $img['provider_url']));
     }
 }
 // Push data to smarty template
 $smarty->assign('meta', $meta);