<?php
$page = basename($_SERVER["PHP_SELF"]);
$heder = "Artikli";
$mali = " > podaci o artiklima";
include('../../xcrud/xcrud.php');
Xcrud_config::$jquery_no_conflict = true; // jquery conflicts with SyntaxHighlighter
//odavde idu komnade ka xcrud-u
$xcrud = Xcrud::get_instance();
$xcrud->table('products');
$xcrud->columns('name,category_id,description,status');
$xcrud->fields('name,category_id,description,status');
$xcrud->label('category_id','Kategorija');
$xcrud->label('description,','MIS broj');

$xcrud->relation('category_id','category_products','category_id','name');
$xcrud->table_name('Artikli');
$xcrud->create_action('publish', 'publish_action'); // action callback, function publish_action() in functions.php
    $xcrud->create_action('unpublish', 'unpublish_action');
    $xcrud->button('#', 'unpublished', 'icon-close glyphicon glyphicon-remove', 'xcrud-action', 
        array(  // set action vars to the button
            'data-task' => 'action',
            'data-action' => 'publish',
            'data-primary' => '{id}'), 
        array(  // set condition ( when button must be shown)
            'status',
            '!=',
            '1')
    );
    $xcrud->button('#', 'published', 'icon-checkmark glyphicon glyphicon-ok', 'xcrud-action', array(
        'data-task' => 'action',
        'data-action' => 'unpublish',
        'data-primary' => '{id}'), array(
        'status',
        '=',
        '1'));
?>

<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<?php echo $heder;?><small><?php echo $mali;?></small>
</h3>
<div class="page-bar">
	<ul class="page-breadcrumb">
		<li>
			<i class="fa fa-home"></i>
			<a href="index.html">Home</a>
			<i class="fa fa-angle-right"></i>
		</li>
		<li>
			<a href="#"><?php echo $mali;?></a>
		</li>
	</ul>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
	<div class="col-md-12">
	<?php echo $xcrud->render(); ?>
	</div>
</div>
<!-- END PAGE CONTENT-->

