%h1='User Tracking'

%hr

- if(isset($dataProvider) && count($dataProvider->data)>0)
  - $userTrakings = $dataProvider->data
- else
  - $userTrakings = array()

-if(user()->checkAccess('user_tracking_archive_view'))
  %a.color-blue(href="#{url('debug/usertrackingarchiveview')}")='View Archive'

-if(user()->checkAccess('user_tracking_archive'))
  %a.color-red(href="#{url('debug/usertrackingarchive')}" onclick="return confirm('Archive all entries?');")='Archive All User Action'

-if(true)
  %form(method="GET")
    -if(user()->checkAccess('user_tracking_view'))
      %input(type="submit" name="submit_action" value="Search")
    -if(user()->checkAccess('user_tracking_export'))
      %input(type="submit" name="submit_action" value="Export")
    
    ='Sorting:'
    !=CHtml::dropDownList('sorting', $sorting, $sortingOptions)
    
    %a(href="#{url('debug/UserTrackingIndex')}")
      ='[ RESET FILTERS ]'
    
    =t('Total item count: ').$dataProvider->totalItemcount
    
    %table.table.table-condensed
      %thead
        %tr
          %th
          %th=t('Action')
          %th=t('User')
          %th=t('Table')
          %th=t('Primary Key')
          %th=t('Controller')
          %th=t('Epoch')
          %th
        %tr
          %td
          %td
            %input.span1(type="text" name="action" value="#{$_REQUEST['action']}")
          %td
            %input.span2(type="text" name="username" value="#{$_REQUEST['username']}")
          %td
            %input.span2(type="text" name="table_name" value="#{$_REQUEST['table_name']}")
          %td
            %input.span2(type="text" name="primary_key" value="#{$_REQUEST['primary_key']}")
          %td
            %input.span2(type="text" name="controller" value="#{$_REQUEST['controller']}")
          %td
            %input.span2(type="text" name="epoch" value="#{$_REQUEST['epoch']}")
      %tbody
        -if( count($userTrakings) > 0 )
          -foreach($userTrakings as $ut)
            %tr
              %td
                !=@$this->getUserTrakingObjectLink($ut)
              %td=$ut->action
              %td!=SystemInfoHelper::getUserCoolName($ut->id_user)
              %td=$ut->table_name
              %td=$ut->primary_key
              %td=$ut->controller
              %td=$ut->epoch
              %td
                %a(href="#{url('debug/usertrackingview', array('id'=>$ut->id))}")
                  .icon-eye-open
                -if(user()->checkAccess('user_tracking_delete'))
                  %a(href="#{url('debug/usertrackingdelete', array('id'=>$ut->id, 'returnUrl'=>$this->getPageLink()))}" onclick="return confirm('Confirm?')")
                    .icon-trash
        - else
          %tr
            %td(colspan="8")
              %center
                %b
                  %i=t('No data')
          %tr
            %td(colspan="8")
          
  -if( count($userTrakings) > 0 )
    - if (isset($dataProvider->pagination))
      .pagination
        - $this->widget('bootstrap.widgets.TbPager', array('pages' => $dataProvider->pagination))
      