<tr id="rorder-<?=$model_list_item->id?>" style="height:45px;">
	<?php

	if ( in_array("Order", $model_list_action_columns) && MODEL_ORDER_COLUMN ) {
		echo '<td>&nbsp;<i class="fa fa-ellipsis-v"></i></td>';
	}

	foreach ($model_list_columns as $key => $model_list_column) {

		if ( is_array($model_list_column) ) {
			if ( $model_list_column['type'] == 'options' || $model_list_column['type'] == 'checkbox' ) {

				if ( $model_list_column['type'] == 'checkbox' && !isset($model_list_column['options']) ) {
					$model_list_column['options'] = array(0=>'No',1=>'Yes');
				}

				if ( is_array($model_list_column['options']) ) {
					$value = $model_list_column['options'][$model_list_item->{$key}];
				} else {
					// tries to fetch name
					$value = $model_list_column['options']::find($model_list_item->{$key})->name;
					// if name is null
					if ( $value === null ) {
						// fetches title
						$value = $model_list_column['options']::find($model_list_item->{$key})->title;
					}
				}
			} elseif ( $model_list_column['type'] == 'image' ) {
				$value = "";
				if ( !empty($model_list_item->{$key}) ) {

					$image_path = "/" . $image_folders['cms_images']['small']['path'] . "/";

					if ( isset($model_list_column['path']) ) {
						$image_path = $model_list_column['path'];
					}

					$value = "<img
						src ='".$image_path.$model_list_item->{$key}."'
						alt=''
					/>
					";

				}
			} elseif ( $model_list_column['type'] == 'datetime' ) {
				$value = "";
				if ( !empty($model_list_item->{$key}) ) {
                    $datetime = date_create_from_format('Y-m-d H:i:s', $model_list_item->{$key});
                    $value = $datetime->format('d/m/Y H:i:s');
                }
			} else {
				$value = $model_list_item->{$key};
			}
		} else {
			$value = $model_list_item->{$key};
		}

		echo '<td>';
			if ( isset($model_list_column['link']) ) {
				$link = $model_list_column['link'];
				$link = str_replace("{id}", $model_list_item->id, $link);
				$link = str_replace("{value}", $value, $link);
				echo '<a href="'.$link.'" title="">';
			}
			echo $value;
			if ( isset($model_list_column['link']) ) {
				echo '</a>';
			}
		echo '</td>';
	}
	foreach ($model_list_action_columns as $key => $value) {
		$action = $value;
		if ( is_array($value) ) {}
		if ( $action == "Edit" ) {
			?>
			<td class="center">
				<a href="edit.php?id=<?=$model_list_item->id?>" class="edit picto" title="Edit <?=ucwords(MODEL_SINGULAR)?>">
					<i class="fa fa-pencil"></i>
				</a>
			</td>
			<?php
		} elseif ( $action == "Delete" ) {
			?>
			<td class="center">
				<a href="<?=SimpleModuleModelBuilder::generateNondestructiveUrl(array('action'=>'delete','delete_id'=>$model_list_item->id))?>" class="alert error" title="Are you sure you want to delete this?">
					<i class="fa fa-times-circle"></i>
				</a>
			</td>
			<?php
		} elseif ( $action == "Order" && MODEL_ORDER_COLUMN ) {
			?>
			<td class="center">
				<a href="<?=SimpleModuleModelBuilder::generateNondestructiveUrl(array('action'=>'order','direction'=>'up','item_id'=>$model_list_item->id))?>" class="" title="Move up.">
					<i class="fa fa-arrow-up"></i>
				</a>
				<a href="<?=SimpleModuleModelBuilder::generateNondestructiveUrl(array('action'=>'order','direction'=>'down','item_id'=>$model_list_item->id))?>" class="" title="Move down.">
					<i class="fa fa-arrow-down"></i>
				</a>
			</td>
			<?php
		}
	}
	?>
</tr>
