/** * main action */ public function mainAction() { $data = array(); $data['customer_id'] = (int) $_SESSION['client']['customer']['id']; // mandatory $data['node_id'] = $this->GET['node_id']; // mandatory if (!empty($this->GET['action_id'])) { $data['action_id'] = $this->GET['action_id']; } if (!empty($this->GET['network'])) { $data['network'] = $this->GET['network']; } $data['action_name'] = $this->GET['action_name']; // mandatory if (!empty($this->GET['object_name'])) { $data['object_name'] = $this->GET['object_name']; } $ClientAction = new client_action(); if ($ClientAction->insertAction($data)) { msg("Action inserted to the database", "ok", 1); } else { msg("Unable to insert action to database, missing parameters " . print_r($data, true), "error", 1); } return true; }
/** * saveClientAction */ public function saveClientAction($node_id, $network) { if (!is_numeric($node_id)) { return false; } require_once 'models/client/client_action.php'; $ClientAction = new client_action(); $data = array(); $data['customer_id'] = (int) $_SESSION['client']['customer']['id']; $data['node_id'] = $node_id; if ($network) { $data['network'] = $network; } $data['action_name'] = 'share_intention'; if ($inserted_id = $ClientAction->insertAction($data)) { return $inserted_id; } else { msg("Cannot save share action initiated from share_counter", 'error', 1); } }