static function putRecords($table, $records) { foreach ($records as $record) { DB::putRecord($table, $record); } }
/** * Inserts the record object, received as a parameter into the table of the * model * * @param Object $record * @return Boolean */ public static function create($record) { return DB::putRecord(self::table(), $record); }
private function incidence() { //check the current status $user_status = $this->status(null, true); if ($user_status->status != 'checkin') { //the user is not checkedin return API::response(array('timestamp' => NULL)); } //incidence $incidence = new stdClass(); $incidence->userid = $this->get_userid($this->_token); $incidence->action = 'incidence'; $incidence->timestamp = time(); $indicence->computed = 0; //store the incidence $in_status = DB::putRecord('presence_activity', $incidence); //checkout the user $checkout = clone $incidence; $checkout->action = 'checkout'; $ch_status = DB::putRecord('presence_activity', $checkout); if ($in_status && $ch_status) { return API::response(array('timestamp' => $checkout->timestamp)); } else { return API::response(array('timestamp' => NULL)); } }