public function action_render() { $availableChannelTypesJson = API::channel_api()->list_available_channel_types(); $availableChannelTypes = json_decode($availableChannelTypesJson); $channelTypesArray = $availableChannelTypes->data->channelTypes; $channelsJson = API::channel_api()->get_all_channels(); $channels = json_decode($channelsJson); $channelsArray = $channels->data->channels; $return; $return->channelTypes = array(); foreach ($channelTypesArray as $channelType) { $t->type = $channelType->type; $t->subTypes = array(); foreach ($channelType->subTypes as $subType) { $st->type = $subType; $st->sources = array(); foreach ($channelsArray as $source) { if ($source->type != $t->type || $source->subType != $st->type) { continue; } $c->name = $source->name; $c->id = $source->id; $st->sources[] = $c; unset($c); } $t->subTypes[] = $st; unset($st); } $return->channelTypes[] = $t; unset($t); } $this->template->channels = $return; }
public function action_add() { $data->parameters = array(); foreach ($_POST as $key => $value) { if ($key == "name" || $key == "type" || $key == "subType" || $key == "updatePeriod") { $data->{$key} = $value; } else { $data->parameters[$key] = $value; } } $json_encoded_parameters = json_encode($data); $json = API::channel_api()->add_channel($json_encoded_parameters); }
public function action_getterms($withcontrols) { $json = API::channel_api()->get_all_channels(); $widget = View::factory("parts/termstomonitorwidget")->set('json', $json); $loggedinstatus = RiverId::is_logged_in(); $loggedinstatus = $loggedinstatus["IsLoggedIn"]; if ($withcontrols == "true") { $widget->set('withcontrols', true); } else { $widget->set('withcontrols', false); } $widget->set('isloggedin', $loggedinstatus); // Render the widget $this->request->response = $widget; }
public function action_index($type, $subType) { $this->template->title = "Add a new channel - {$type} / {$subType}"; $this->template->content = new View("parts/addchannel"); $this->template->content->type = $type; $this->template->content->subType = $subType; $json = API::channel_api()->list_available_channel_types(); $channelTypesContainer = json_decode($json); $channelTypes = $channelTypesContainer->data->channelTypes; foreach ($channelTypes as $channelType) { if ($channelType->type == $type) { $this->template->content->channel = $channelType; } } }
public function action_deactivate() { $object->id = $_POST["id"]; $json_encoded_parameters = json_encode($object); $json = API::channel_api()->desctivate_channel($json_encoded_parameters); }
public function action_getall() { $json = API::channel_api()->get_all_channels(); //return the json $this->request->response = $json; }