本文整理汇总了PHP中Process::get_process_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::get_process_list方法的具体用法?PHP Process::get_process_list怎么用?PHP Process::get_process_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process::get_process_list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_controller
function process_controller()
{
//return array('content'=>"ok");
global $mysqli, $redis, $user, $session, $route, $feed_settings;
// There are no actions in the input module that can be performed with less than write privileges
if (!$session['write']) {
return array('content' => false);
}
$result = false;
require_once "Modules/feed/feed_model.php";
$feed = new Feed($mysqli, $redis, $feed_settings);
require_once "Modules/input/input_model.php";
$input = new Input($mysqli, $redis, $feed);
require_once "Modules/process/process_model.php";
$process = new Process($mysqli, $input, $feed, $user->get_timezone($session['userid']));
if ($route->format == 'html') {
if ($route->action == 'api') {
$result = view("Modules/process/Views/process_api.php", array());
}
} else {
if ($route->format == 'json') {
if ($route->action == "list") {
$result = $process->get_process_list();
}
}
}
return array('content' => $result);
}
示例2: input_controller
//.........这里部分代码省略.........
$datain = get('data');
}
if (isset($_POST['data'])) {
$datain = post('data');
}
if ($datain != "") {
$json = preg_replace('/[^\\w\\s-.:,]/', '', $datain);
$datapairs = explode(',', $json);
$csvi = 0;
for ($i = 0; $i < count($datapairs); $i++) {
$keyvalue = explode(':', $datapairs[$i]);
if (isset($keyvalue[1])) {
if ($keyvalue[0] == '') {
$valid = false;
$error = "Format error, json key missing or invalid character";
}
if (!is_numeric($keyvalue[1])) {
$valid = false;
$error = "Format error, json value is not numeric";
}
$data[$keyvalue[0]] = (double) $keyvalue[1];
} else {
if (!is_numeric($keyvalue[0])) {
$valid = false;
$error = "Format error: csv value is not numeric";
}
$data[$csvi + 1] = (double) $keyvalue[0];
$csvi++;
}
}
$userid = $session['userid'];
$dbinputs = $input->get_inputs($userid);
$tmp = array();
foreach ($data as $name => $value) {
if (!isset($dbinputs[$nodeid][$name])) {
$inputid = $input->create_input($userid, $nodeid, $name);
$dbinputs[$nodeid][$name] = true;
$dbinputs[$nodeid][$name] = array('id' => $inputid);
$input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
} else {
$inputid = $dbinputs[$nodeid][$name]['id'];
$input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
if ($dbinputs[$nodeid][$name]['processList']) {
$tmp[] = array('value' => $value, 'processList' => $dbinputs[$nodeid][$name]['processList']);
}
}
}
foreach ($tmp as $i) {
$process->input($time, $i['value'], $i['processList']);
}
} else {
$valid = false;
$error = "Request contains no data via csv, json or data tag";
}
if ($valid) {
$result = 'ok';
} else {
$result = "Error: {$error}\n";
}
}
if ($route->action == "clean") {
$result = $input->clean($session['userid']);
}
if ($route->action == "list") {
$result = $input->getlist($session['userid']);
}
if ($route->action == "getinputs") {
$result = $input->get_inputs($session['userid']);
}
if ($route->action == "getallprocesses") {
$result = $process->get_process_list();
}
if (isset($_GET['inputid']) && $input->belongs_to_user($session['userid'], get("inputid"))) {
if ($route->action == "delete") {
$result = $input->delete($session['userid'], get("inputid"));
}
if ($route->action == 'set') {
$result = $input->set_fields(get('inputid'), get('fields'));
}
if ($route->action == "process") {
if ($route->subaction == "add") {
$result = $input->add_process($process, $session['userid'], get('inputid'), get('processid'), get('arg'), get('newfeedname'), get('newfeedinterval'), get('engine'));
}
if ($route->subaction == "list") {
$result = $input->get_processlist(get("inputid"));
}
if ($route->subaction == "delete") {
$result = $input->delete_process(get("inputid"), get('processid'));
}
if ($route->subaction == "move") {
$result = $input->move_process(get("inputid"), get('processid'), get('moveby'));
}
if ($route->subaction == "reset") {
$result = $input->reset_process(get("inputid"));
}
}
}
}
return array('content' => $result);
}
示例3: convertTemplateProcessList
private function convertTemplateProcessList($feedArray, $inputArray, $processArray)
{
$resultProcesslist = array();
if (is_array($processArray)) {
require_once "Modules/process/process_model.php";
$process = new Process(null, null, null, null);
$process_list = $process->get_process_list();
// emoncms supported processes
// create each processlist
foreach ($processArray as $p) {
$proc_name = $p->process;
if (!isset($process_list[$proc_name])) {
$this->log->error("convertProcess() Process '{$proc_name}' not supported. Module missing?");
return array('success' => false, 'message' => "Process '{$proc_name}' not supported. Module missing?");
}
// Arguments
if (isset($p->arguments)) {
if (isset($p->arguments->type)) {
$type = @constant($p->arguments->type);
// ProcessArg::
$process_type = $process_list[$proc_name][1];
// get emoncms process ProcessArg
if ($process_type != $type) {
$this->log->error("convertProcess() Bad device template. Missmatch ProcessArg type. Got '{$type}' expected '{$process_type}'. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Missmatch ProcessArg type. Got '{$type}' expected '{$process_type}'. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
if (isset($p->arguments->value)) {
$value = $p->arguments->value;
} else {
$this->log->error("convertProcess() Bad device template. Undefined argument value. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Undefined argument value. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
if ($type === ProcessArg::VALUE) {
} else {
if ($type === ProcessArg::INPUTID) {
$temp = $this->searchArray($inputArray, 'name', $value);
// return input array that matches $inputArray[]['name']=$value
if ($temp->inputId > 0) {
$value = $temp->inputId;
} else {
$this->log->error("convertProcess() Bad device template. Input name '{$value}' was not found. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Input name '{$value}' was not found. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
} else {
if ($type === ProcessArg::FEEDID) {
$temp = $this->searchArray($feedArray, 'name', $value);
// return feed array that matches $feedArray[]['name']=$value
if ($temp->feedId > 0) {
$value = $temp->feedId;
} else {
$this->log->error("convertProcess() Bad device template. Feed name '{$value}' was not found. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Feed name '{$value}' was not found. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
} else {
if ($type === ProcessArg::NONE) {
$value = 0;
} else {
if ($type === ProcessArg::TEXT) {
// } else if ($type === ProcessArg::SCHEDULEID) { //not supporte for now
} else {
$this->log->error("convertProcess() Bad device template. Unsuported argument type. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Unsuported argument type. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
}
}
}
}
} else {
$this->log->error("convertProcess() Bad device template. Argument type is missing, set to NONE if not required. process='{$proc_name}' type='" . $p->arguments->type . "'");
return array('success' => false, 'message' => "Bad device template. Argument type is missing, set to NONE if not required. process='{$proc_name}' type='" . $p->arguments->type . "'");
}
$this->log->info("convertProcess() process process='{$proc_name}' type='" . $p->arguments->type . "' value='" . $value . "'");
$resultProcesslist[] = $proc_name . ":" . $value;
} else {
$this->log->error("convertProcess() Bad device template. Missing processlist arguments. process='{$proc_name}'");
return array('success' => false, 'message' => "Bad device template. Missing processlist arguments. process='{$proc_name}'");
}
}
}
return $resultProcesslist;
}