Ejemplo n.º 1
0
/**
 * 
 * @param type $items
 * @param type $opts
 */
function grid_layout($items, $opts=[]) {
  $defaults = [
    'num_columns' => 12,
    'items_per_row' => 3,
    'row_class' => '',
    'col_class' => '',#Additional column class
  ];
  $params = getParamsOrDefault($opts, $defaults);
  extract($params);
  if ($items instanceOf PartialSet) {
    $numitems = $items->sizeOf();
  } else {
    $numitems = count($items);
  }
  $item_width = $num_columns/$items_per_row;
  $numcols = count($items);
  $colclass = "col-xs-$item_width $col_class";
  $grout = new PkHtmlRenderer();
  $grout->rawdiv(RENDEROPEN,"row $row_class");
    foreach ($items as $i=>$item) {
      $grout->rawdiv($item,$colclass);
      if (($i+1 <$numitems) && !(($i+1) % $items_per_row) ) {
        $grout->RENDERCLOSE();
        $grout->rawdiv(RENDEROPEN,"row $row_class");
      }
    }
  $grout->RENDERCLOSE();
  return $grout;
}
$diagsf->append_atts('delete_button_wrap', 'col-xs-3');
#To put the Delete button in a row
$diagsf->append_atts('js_template', ['class' => 'tst-add-class-arr']);
$diagsf->subform_data = $diagrows;
$diagsf->hidden('id');
//$diagsf->text('diagnosiscode_id');
$diagsf->select('diagnosiscode_id', DiagnosisRef::getSelectList(true, true));
$out[] = PkForm::model($client);
$infoout->wrap(['value' => PkForm::text('fname', null, ['placeholder' => 'First Name']), 'raw' => true, 'label' => 'Client First Name', 'labelAttributes' => 'block tpm-label', 'valueAttributes' => 'block tpm-value', 'wrapperAttributes' => 'col-xs-4 tpm-wrapper']);
#Note arguement 'true' to ::getRefArr(true) - prepends null=>'None' to array
$infoout->wrap(['value' => PkForm::select('insurance_status_id', App\References\InsuranceStatusRef::getRefArr(true), null), 'raw' => true, 'label' => 'Insurance Status', 'labelAttributes' => 'block tpm-label', 'valueAttributes' => 'block tpm-value', 'wrapperAttributes' => 'col-xs-4 tpm-wrapper']);
$out[] = $infoout;
$out[] = $diagsf;
#Can put sections/containers together in a row
$out->div(RENDEROPEN, 'row');
$out->rawdiv($diagwrapper, 'col-sm-6');
$out->rawdiv($payout, 'col-sm-6');
$out->RENDERCLOSE();
$out[] = PkForm::button('Submit', ['type' => 'submit', 'name' => 'submit', 'value' => 'submit', 'class' => 'pkmvc-button block fullwidth', 'title' => "Save Changes"]);
$out[] = PkForm::close();
?>
@extends('app')
@section('content')
<div class='template type'>
  <h1>The Client Edit Template</h1>

  <?php 
echo $out;
?>