<?php
	// For help on using hooks, please refer to https://bigprof.com/appgini/help/working-with-generated-web-database-application/hooks

	function reunions_init(&$options, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_header($contentType, $memberInfo, &$args) {
		$header='';

		switch($contentType) {
			case 'tableview':
				$header='';
				break;

			case 'detailview':
				$header='';
				break;

			case 'tableview+detailview':
				$header='';
				break;

			case 'print-tableview':
				$header='';
				break;

			case 'print-detailview':
				$header='';
				break;

			case 'filters':
				$header='';
				break;
		}

		return $header;
	}

	function reunions_footer($contentType, $memberInfo, &$args) {
		$footer='';

		switch($contentType) {
			case 'tableview':
				$footer='';
				break;

			case 'detailview':
				$footer='';
				break;

			case 'tableview+detailview':
				$footer='';
				break;

			case 'print-tableview':
				$footer='';
				break;

			case 'print-detailview':
				$footer='';
				break;

			case 'filters':
				$footer='';
				break;
		}

		return $footer;
	}

	function reunions_before_insert(&$data, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_after_insert($data, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_before_update(&$data, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_after_update($data, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_before_delete($selectedID, &$skipChecks, $memberInfo, &$args) {

		return TRUE;
	}

	function reunions_after_delete($selectedID, $memberInfo, &$args) {

	}

	function reunions_dv($selectedID, $memberInfo, &$html, &$args) {
		/* if this is the print preview, don't modify the detail view */
		if(isset($_REQUEST['dvprint_x'])) return;
		
		ob_start(); ?>

<script>
    $j(function() {
        <?php if($selectedID){ ?>
        $j('#reunions_dv_action_buttons .btn-toolbar').append(
            '<div class="btn-group-vertical btn-group-lg" style="width: 100%;">' +
			
            '<button type="button" class="btn btn-default btn-lg" onclick="print_reunion()">' +
            '<i class="glyphicon glyphicon-print"></i> IMPRIMER</button>' +
			
            '</div>'
        );
        <?php } ?>
    });

    function print_reunion() {
        var selectedID = '<?php echo urlencode($selectedID); ?>';
        window.location = 'reunion_invoice.php?idreunion=' + selectedID;
    }

</script>

<?php
		$form_code = ob_get_contents();
		ob_end_clean();
		
		$html .= $form_code;
	}

	function reunions_csv($query, $memberInfo, &$args) {

		return $query;
	}
	function reunions_batch_actions(&$args) {

		return array();
	}
