Example #1
0
        $xml = simplexml_load_string($api_response);
        $this->responsetype = 'alert alert-success';
        $this->responsecode = -1;
        $this->response = 'Data was uploaded with id: ';
        if (property_exists($xml->children('oml', true), 'code')) {
            $this->responsetype = 'alert alert-danger';
            $this->responsecode = $xml->children('oml', true)->code;
            $this->response = 'Error ' . $this->responsecode . ': ' . $xml->children('oml', true)->message;
            if ($this->responsecode == '131') {
                $this->response .= ' Please fill in all required (red) fields, upload a file or give a URL (not both), and avoid spaces in the dataset name.';
            }
        } else {
            if ($xml->children('oml', true)->id) {
                $this->response = '<h2><i class="fa fa-thumbs-o-up"></i> Thanks!</h2>Data was uploaded successfully (ID = ' . $xml->children('oml', true)->id . ')<br> You can now <b><a href="d/' . $xml->children('oml', true)->id . '"> follow your dataset on OpenML</a></b>, complete its description, track its impact, create OpenML tasks, and see all ensuing results.<br><br>You can also continue to add datasets below.';
                sm($this->response);
                su('new/data');
            } else {
                print "Something went wrong. Server says:<br>";
                print $api_response;
            }
        }
    } else {
        $this->responsetype = 'alert alert-danger';
        $this->response = 'Could not upload data. Please fill in all required (red) fields.';
    }
} elseif ($this->subpage == 'study') {
    $user_id = $this->ion_auth->user()->row()->id;
    $name = $this->input->post('study_name');
    $description = $this->input->post('description');
    $this->Study->create($name, $description, $user_id);
}
Example #2
0
 unset($this->p['id']);
 $this->p['body']['_source'] = array("data_id", "version", "version_label");
 $this->p['body']['query']['term']['exact_name'] = $this->data['name'];
 $this->p['body']['sort'] = 'version';
 try {
     $this->versions = array_column($this->searchclient->search($this->p)['hits']['hits'], '_source');
 } catch (Exception $e) {
 }
 //$prev = $this->Dataset->getColumnFunctionWhere('max(did)', 'did < '.$this->id.' AND visibility="public"');
 //$this->prev_id = $prev[0];
 //$next = $this->Dataset->getColumnFunctionWhere('min(did)', 'did > '.$this->id.' AND visibility="public"');
 //$this->next_id = $next[0];
 $this->record = $this->Dataset->getWhere('did = "' . $this->id . '"');
 $this->record = $this->record[0];
 if (!$this->record->{'did'}) {
     su('d/' . $this->next_id);
 }
 // block unauthorized access
 $this->blocked = false;
 if ($this->record->visibility == 'private' and (!$this->ion_auth->logged_in() or $this->ion_auth->user()->row()->id != $this->record->uploader)) {
     $this->blocked = true;
 } else {
     if (($this->ion_auth->logged_in() and $this->ion_auth->user()->row()->id == $this->record->uploader) || $this->ion_auth->is_admin()) {
         $this->is_owner = true;
     }
     $author = $this->Author->getById($this->record->uploader);
     $this->record->{'uploader'} = $author->first_name . ' ' . $author->last_name;
     $this->uploader_id = $author->id;
     $this->displayName = $this->record->name;
     $this->tasks_all = array();
     $this->current_task = false;
Example #3
0
    //if data file didn't change, §insert the old url
    //if(!$this->input->post('url') && (!file_exists($_FILES['dataset']['tmp_name']) || !is_uploaded_file($_FILES['dataset']['tmp_name']))) {
    //	$post_data['url'] = = $this->record->{'url'};
    //}
    $url = BASE_URL . '/api/?f=openml.data.upload';
    // Send the request & save response to $resp
    $api_response = $this->curlhandler->post_multipart_helper($url, $post_data);
    if ($api_response !== false) {
        $xml = simplexml_load_string($api_response);
        $this->responsetype = 'alert alert-success';
        $this->responsecode = -1;
        $this->response = 'Data was uploaded with id: ';
        if (property_exists($xml->children('oml', true), 'code')) {
            $this->responsetype = 'alert alert-danger';
            $this->responsecode = $xml->children('oml', true)->code;
            $this->response = 'Error ' . $this->responsecode . ': ' . $xml->children('oml', true)->message . '. Please fill in all required (red) fields, upload a file or give a URL (not both), and avoid spaces in the dataset name.';
        } else {
            if ($xml->children('oml', true)->id) {
                $this->response = '<h2><i class="fa fa-thumbs-o-up"></i> Great!</h2>Your data set was updated successfully. OpenML is currently reanalyzing the data. Refresh the page in a few minutes.';
                sm($this->response);
                su('d/' . $this->id);
            } else {
                print "Something went wrong. Server says:<br>";
                print $api_response;
            }
        }
    } else {
        $this->responsetype = 'alert alert-danger';
        $this->response = 'Could not upload data. Please fill in all required (red) fields.';
    }
}
<?php

su();
Example #5
0
         sm('Please select at least one function. ');
         su('frontend/page/meta_dataset');
     }
     if (in_array($task_type, $legal_task_types) == false) {
         sm('Task type illegal. Please fill in the form correctly. ');
         su('frontend/page/meta_dataset');
     }
     $functions = '"' . implode('", "', $functions) . '"';
     // TODO: don't store evaluation stuff if type = qualities
     $md = array('request_date' => now(), 'type' => $type, 'task_type' => $task_type, 'datasets' => $dataset_ids ? implode(', ', $dataset_ids) : null, 'tasks' => $task_ids ? implode(', ', $task_ids) : null, 'flows' => $flow_ids ? implode(', ', $flow_ids) : null, 'setups' => $setup_ids ? implode(', ', $setup_ids) : null, 'functions' => $functions ? $functions : null, 'user_id' => $this->ion_auth->get_user_id());
     if ($type == 'qualities') {
         unset($md['functions']);
     }
     $res = $this->Meta_dataset->insert($md);
     sm('Meta dataset will be created. It can take several minutes to be generated.');
     su('frontend/page/meta_dataset#overview');
 } elseif ($this->check) {
     $this->runs_done = 0;
     $this->runs_total = 0;
     $sql_setups = 'SELECT `s`.`sid`, `i`.`dependencies`, `i`.`name`, `s`.`setup_string` ' . 'FROM `algorithm_setup` `s`, `implementation` `i` ' . 'WHERE `s`.`implementation_id` = `i`.`id` ' . ($setup_ids ? 'AND `s`.`sid` IN (' . implode(',', $setup_ids) . ') ' : '') . ($flow_ids ? 'AND `i`.`id` IN (' . implode(',', $flow_ids) . ') ' : '');
     $res_setups = $this->Algorithm_setup->query($sql_setups);
     $sql_tasks = 'SELECT `t`.*, d.name, tt.name AS task_type ' . 'FROM `task` `t`, `task_type` `tt`, `task_inputs` `i`, `dataset` `d` ' . 'WHERE `t`.`task_id` = `i`.`task_id` ' . 'AND `i`.`input` = "source_data" ' . 'AND `i`.`value` = `d`.`did` ' . 'AND `t`.`ttid` = `tt`.`ttid` ' . 'AND `t`.`ttid` = "' . $task_type . '" ' . ($dataset_ids ? 'AND `i`.`value` IN (' . implode(',', $dataset_ids) . ') ' : '') . ($task_ids ? 'AND `t`.`task_id` IN (' . implode(',', $task_ids) . ') ' : '');
     $res_tasks = $this->Task->query($sql_tasks);
     // TODO: implementations
     $sql_runs = 'SELECT `r`.`task_id`,`r`.`setup` ' . 'FROM `run` `r`, `task_inputs` `d`, `task` `t` ' . 'WHERE `r`.`task_id` = `d`.`task_id` ' . 'AND `d`.`input` = "source_data" ' . 'AND `t`.`task_id` = `r`.`task_id` ' . ($dataset_ids ? 'AND `d`.`value` IN (' . implode(',', $dataset_ids) . ') ' : '') . ($task_ids ? 'AND `r`.`task_id` IN (' . implode(',', $task_ids) . ') ' : '') . ($setup_ids ? 'AND `r`.`setup` IN (' . implode(',', $setup_ids) . ') ' : '') . 'AND `t`.`ttid` = "' . $task_type . '" ' . 'GROUP BY `r`.`task_id`, `r`.`setup`;';
     $res_runs = $this->Run->query($sql_runs);
     $this->data = array();
     $this->runs_total = count($res_tasks) * count($res_setups);
     $this->runs_done = count($res_runs);
     if ($res_runs == false || $res_tasks == false || $res_setups == false) {
     } else {
Example #6
0
function h()
{
    // save our data
    su();
    sw();
    // call it a night
    l("halt");
    die;
}