/** * shows the frontend edit screen called by the [pdb_record] shortcode * * * the ID of the record to show for editing can be provided one of three ways: * $_GET['pid'] (private link) or in the POST array (actively editing a record) * $atts['id'](deprecated) or $atts['record_id'] (in the sortcode), or * self::$session->get('pdbid') (directly from the signup form) * * * @param array $atts array of attributes drawn from the shortcode * @return string the HTML of the record edit form */ public static function print_record_edit_form($atts) { $record_id = false; // get the pid from the get string if given (for backwards compatibility) $get_pid = filter_input(INPUT_GET, 'pid', FILTER_SANITIZE_STRING); if (empty($get_pid)) { $get_pid = filter_input(INPUT_POST, 'pid', FILTER_SANITIZE_STRING); } if (!empty($get_pid)) { $record_id = self::get_participant_id($get_pid); } // get the id from the SESSION array if ($record_id === false && self::$session->get('pdbid')) { $record_id = self::get_record_id_by_term('id', self::$session->get('pdbid')); } if ($record_id === false && (isset($atts['id']) || isset($atts['record_id']))) { if (isset($atts['id']) & !isset($atts['record_id'])) { $atts['record_id'] = $atts['id']; unset($atts['id']); } $record_id = self::get_record_id_by_term('id', $atts['record_id']); } $atts['record_id'] = $record_id; return PDb_Record::print_form($atts); }
/** * shows the frontend edit screen called by the [pdb_record] shortcode * * * the ID of the record to show for editing can be provided one of three ways: * $_GET['pid'] (private link), * $atts['id'](deprecated) or $atts['record_id'] (in the sortcode), or * self::$session->get('pdbid') (directly from the signup form) * * * @param array $atts array of attributes drawn from the shortcode * @return string the HTML of the record edit form */ public static function print_record_edit_form($atts) { $record_id = false; // get the pid from the get string if given (for backwards compatibility) if (isset($_GET['pid'])) { $record_id = self::get_participant_id($_GET['pid']); } // get the id from the SESSION array; this overrides the GET string if (self::$session->get('pdbid')) { $record_id = self::get_record_id_by_term('id', self::$session->get('pdbid')); } if ($record_id === false && (isset($atts['id']) || isset($atts['record_id']))) { if (isset($atts['id']) & !isset($atts['record_id'])) { $atts['record_id'] = $atts['id']; unset($atts['id']); } $record_id = self::get_record_id_by_term('id', $atts['record_id']); } $atts['record_id'] = $record_id; return PDb_Record::print_form($atts); }