Example #1
0
  public function form() {
    MPV::incl("field-sets");
    MasterPress::$model->shared = true;

    $mpv_field_sets = new MPV_FieldSets();
    $mpv_field_sets->form();

  } // end form()
Example #2
0
  public function grid($id = null) {

    MPV::incl("field-sets");
    MPV::incl("fields");
    MPV::incl("taxonomies");
    MPC::incl("taxonomies");
    
    $post_types = MPM_PostType::find("orderby=disabled,name ASC");
    
    $has_actions = MasterPress::current_user_can("edit_post_types,delete_post_types,manage_post_type_field_sets");
    $can_edit = MasterPress::current_user_can("edit_post_types");
    $can_delete = MasterPress::current_user_can("delete_post_types");
    $can_create = MasterPress::current_user_can("create_post_types");
    $can_manage_field_sets = MasterPress::current_user_can("manage_post_type_field_sets");

    $less = $can_create ? 1 : 0;
    $colspan = ( $has_actions ? 8 : 7 ) - $less;


  ?>

  <?php MPV::messages(); ?>
  
  <?php 
  foreach ($post_types as $post_type) {
    if (MPC::is_deleting($post_type->id)) {
      self::confirm_delete($post_type);
    }
  }
  
  ?>
  
  <table cellspacing="0" class="grid grid-post-types">
    <thead>
    <tr>
      <th class="first menu-icon"><i class="menu-icon" title="<?php _e("Menu Icon", MASTERPRESS_DOMAIN) ?>"></i><span class="ac"><?php _e("Menu Icon", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="menu-label"><i class="label-string"></i><span><?php _e("Label", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="post-type-name"><i class="script-php"></i><span><?php _e("Name", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="hierarchical"><i class="hierarchy"></i><span class="ac" title="<?php _e("Hierarchical?", MASTERPRESS_DOMAIN) ?>"><?php _e("Hierarchical?", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="field-sets"><i class="metaboxes"></i><span><?php _e("Field Sets", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="shared-field-sets"><i class="med share-metaboxes"></i><span><?php _e("Shared Field Sets", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="taxonomies <?php echo $has_actions ? "" : "last" ?>"><i class="tags"></i><span><?php _e("Taxonomies", MASTERPRESS_DOMAIN) ?></span></th>
      <?php if ($has_actions) : ?>
      <th class="actions last"><i class="buttons"></i><span><?php _e("Actions", MASTERPRESS_DOMAIN) ?></span></th>
      <?php endif; ?>
    </tr>
    </thead>
    <tbody>
    
    
    <?php $count = 0; ?>
    
    <?php foreach ($post_types as $post_type) : $disabled = ( $post_type->disabled ) ? "disabled" : "";  $title = $post_type->disabled ? ' title="'.__("this post type is disabled", MASTERPRESS_DOMAIN).'" ' : ""; 
    
    if (!$post_type->in_current_site()) {
      $disabled = "disabled";
      $title = ' title="'.__("this post type is not currently available in this site (multi-site setting)", MASTERPRESS_DOMAIN).'" ';
    }

    
    ?>
    
    <?php if ($post_type->still_registered()) : $count++; $first = $count == 1 ? 'first' : ''; ?>
      
    <?php 
    
    $deleting_class = MPC::is_deleting($post_type->id, "delete") ? 'deleting' : ''; 
    $editable_class = $can_edit ? " editable " : "";
    $meta = $can_edit ? "{ href: '".MasterPress::admin_url("post-types", "edit", "id=".$post_type->id)."' }" : "";
    
    ?>
    

    <tr <?php echo $title ?> class="<?php echo $first ?> <?php echo $editable_class.$deleting_class ?> <?php echo $disabled ?> <?php echo MPV::updated_class("edit,create", $post_type->id) ?> <?php echo $count % 2 == 0 ? "even" : "" ?> sub <?php echo $meta ?>">
      <td class="first menu-icon icon"><span class="mp-icon-post-type mp-icon-post-type-<?php echo $post_type->name ?>"></span></td>
      <td class="menu-label"><strong><?php echo $post_type->labels["menu_name"] ?></strong></td>
      <td class="post-type-name"><span class="tt"><?php echo $post_type->name ?></span></td>
      <td class="hierarchical"><?php echo $post_type->hierarchical ? '<i class="tick-small"></i><span class="ac" title="'.__("this post type is hierarchical", MASTERPRESS_DOMAIN).'">yes</span>' : '<span class="note" title="'.__("this post type is not hierarchical", MASTERPRESS_DOMAIN).'">&ndash;</span>' ?></td>

      <?php $field_sets = $post_type->field_sets("name ASC"); ?>

      <?php if ($post_type->show_ui) : ?>
        
      <td class="field-sets <?php echo $can_manage_field_sets ? "manage { href: '".MasterPress::admin_url( "post-types", "manage-field-sets", "parent=".$post_type->id)."' }" : "" ?>">
        <?php if ($can_manage_field_sets) : ?>
        <a href="<?php echo MasterPress::admin_url( "post-types", "manage-field-sets", "parent=".$post_type->id)?>" title="<?php echo strip_tags(self::__manage( MPV_FieldSets::__p() )) ?>">
		<i class="go"></i>
        <?php endif; ?>

        <?php 
        
        $field_set_display = MPV::note_none();
        
        if (count($field_sets)) {
          $field_set_links = array();
          
          foreach ($field_sets as $field_set) {
            if (!$field_set->is_shared()) {
              $field_set_links[] =  $field_set->display_label();
            }
          }

          if (count($field_set_links)) {
            $field_set_display = implode($field_set_links, ", ");
          }
        
        }
        
        echo $field_set_display;
        ?>
        <?php if ($can_manage_field_sets) : ?>
        </a>
        <?php endif; ?>
      </td>
      <?php else: ?>
      <td class="field-sets">
      <span title="<?php _e("This post type does not support field sets as the 'show ui' parameter is off", MASTERPRESS_DOMAIN); ?>"><i class="na"></i><?php _e("N/A", MASTERPRESS_DOMAIN); ?></span>  
      </td>
      <?php endif; ?>

      <?php if ($post_type->show_ui) : ?>
    
      <td class="shared-field-sets">
        
        <?php 
        
        $field_set_display = MPV::note_none();
      
        if (count($field_sets)) {
          $field_set_links = array();
          
          foreach ($field_sets as $field_set) {
            if ($field_set->is_shared()) {
              $field_set_links[] = $field_set->display_label(); 
            }
          }

          if (count($field_set_links)) {
            $field_set_display = implode($field_set_links, ", ");
          }
        
        }
        
        echo $field_set_display;
        ?>
        
      </td>
      
      <?php else: ?>
      <td class="shared-field-sets">
      <span title="<?php _e("This post type does not support shared field sets as the 'show ui' parameter is off", MASTERPRESS_DOMAIN); ?>"><i class="na"></i><?php _e("N/A", MASTERPRESS_DOMAIN); ?></span>  
      </td>
      <?php endif; ?>


      <td class="taxonomies <?php echo $has_actions ? "" : "last" ?>">
        <?php 
        $taxonomies = $post_type->taxonomies(); 
        
        $tax_display = MPV::note_none();
        
        if (count($taxonomies)) {
          $tax_links = array();
          
          foreach ($taxonomies as $tax) {
            $tax_links[] = $tax->labels["name"]; 
          }

          $tax_display = implode($tax_links, ", ");
        }
        
        echo $tax_display;
        ?>
      </td>      

      <?php if ($has_actions) : ?>

      <td class="actions last">
      <div>
        <?php if (MPC::is_deleting($post_type->id)) : ?>
        
        <span class="confirm-action"><?php _e("Please Confirm Delete Action", MASTERPRESS_DOMAIN) ?></span>
        
        <?php else: ?>

          <?php if ($can_manage_field_sets) : ?>

            <?php if ($post_type->show_ui) :  ?>
            <?php echo MPV::action_button("post-types", "manage-field-sets", self::__manage( MPV_FieldSets::__p_short() ), "parent=".$post_type->id, array("class" => "button button-manage")); ?>
            <?php else: ?>
            <?php echo MPV::action_button("post-types", "manage-field-sets", self::__manage( MPV_FieldSets::__p_short() ), "parent=".$post_type->id, array("title" => "This post type does not support field sets as the 'show ui' parameter is off", "disabled" => "disabled", "class" => "button button-manage")); ?>
            <?php endif; ?>
      
          <?php endif; ?>
        
          <?php if ($can_edit) : ?>
            <?php echo MPV::action_button("post-types", "edit", self::__edit( "" ), "id=".$post_type->id, array( "class" => "button primary button-edit" )); ?>
          <?php endif; ?>

          <?php if ($can_delete) : ?>
            <?php if ($post_type->_builtin) : ?>
            <span class="note" title="<?php _e("This post type cannot be deleted as it is built-in to WordPress", MASTERPRESS_DOMAIN) ?>"><?php _e("( Built-in )", MASTERPRESS_DOMAIN) ?></span>
            <?php elseif ($post_type->_external) : ?>
            <span class="note" title="<?php _e("This post type cannot be deleted as it was not created by MasterPress", MASTERPRESS_DOMAIN) ?>"><?php _e("( External )", MASTERPRESS_DOMAIN) ?></span>
            <?php else: ?>
        
            <?php echo MPV::action_button("post-types", "delete", self::__delete( "" ), "id=".$post_type->id, array( "class" => "button button-delete", "title" => "Delete - Requires Confirmation" )); ?>
            <?php endif; ?>
          <?php endif; ?>
      
        <?php endif; // has_actions ?>
      </div>
      </td>
      
      <?php endif; ?>
      
    </tr>
  
    <?php endif; ?>

    <?php endforeach; ?>

    <tr class="summary <?php echo $can_create ? "editable" : "" ?>">
      <td colspan="<?php echo $colspan ?>" class="first <?php echo $can_create ? "" : "last" ?>"><?php _e(  MPU::__items( $count, __("<strong>%d</strong> Post Type", MASTERPRESS_DOMAIN), __("%d Post Types", MASTERPRESS_DOMAIN)   ) ) ?></td>
      <?php if ($can_create) : ?>
      <td class="last">
      <?php echo MPV::action_button("post-types", "create", self::__create(MPV_PostTypes::__s()), "", array( "class" => "button button-create" ) ); ?>
      </td>
      <?php endif; ?>
    </tr>
    

    </tbody>
    </table>


    
    <?php
    


  } // end grid()
Example #3
0
  public function grid() {
    
    
    MPC::incl("post-types");
    MPV::incl("fields");
    MPV::incl("post-types");
    
    $info = MasterPress::$view;
    
    $parent = $info->parent;

    $has_actions = MasterPress::current_user_can("edit_post_type_field_sets,delete_post_type_field_sets,edit_post_type_fields,delete_post_type_fields");
    $can_edit = MasterPress::current_user_can("edit_post_type_field_sets");
    $can_delete = MasterPress::current_user_can("delete_post_type_field_sets");
    $can_create = MasterPress::current_user_can("create_post_type_field_sets");

    $can_create_fields = MasterPress::current_user_can("create_post_type_fields");
    $can_edit_fields = MasterPress::current_user_can("edit_post_type_fields");
    $can_delete_fields = MasterPress::current_user_can("delete_post_type_fields");

    $less = ($can_create_fields) ? 1 : 0;

    $colspan = ( $has_actions ? 4 : 3 ) - $less;
    
    ?>
    
    <div class="title-info-panel">
      <div class="title-info-panel-lt">
        <?php if (get_class($parent) == "MPM_PostType") : ?>
        <h3 class="post-type"><i class="mp-icon mp-icon-post-type mp-icon-post-type-<?php echo $parent->name ?>"></i><span class="label"><?php echo MPV_PostTypes::__s() ?>:</span><span class="value"> <?php echo $parent->display_label() ?></span></h3> 
        <input id="post_type_name" type="hidden" value="<?php echo $parent->name ?>" />
        <?php endif; ?>
      </div>
    </div>

    
    
    <?php MPV::messages(); ?>

    <?php $field_sets = MPM_FieldSet::find_by_post_type($parent, "name ASC"); ?>
    
    <?php MPV::field_set_icon_styles($field_sets); ?>
    
    <?php
    
    foreach ($field_sets as $field_set) {

      if (MPC::is_deleting($field_set->id, "delete-field-set")) {
        
        $this->confirm_delete($field_set);
        
      } else {
        
        foreach ($field_set->fields() as $field) {
          
          if (MPC::is_deleting($field->id, "delete-field")) {
            $this->confirm_delete_field($field);
          }
          
        }
        
      }
      
    }
    
    ?>
    
    
    
    <?php if (count($field_sets)) : ?>
      
    <table cellspacing="0" class="grid grid-field-sets">

    <thead>
    <tr>
      <th class="first type"><i class="types"></i><span><?php _e("Type", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="label"><i class="label-string"></i><span><?php _e("Label", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="front-end-name <?php echo $has_actions ? "" : "last" ?>"><i class="script-php"></i><span><?php _e("Front End Name", MASTERPRESS_DOMAIN) ?></span></th>
      <?php if ($has_actions) : ?>
      <th class="actions last"><i class="buttons"></i><span><?php _e("Actions", MASTERPRESS_DOMAIN) ?></span></th>
      <?php endif; ?>
    </tr>
    </thead>
   
    <tbody>
    
    

    <?php $fg_count = 0; ?>
    <?php foreach ($field_sets as $field_set) : $fg_count++; ?>  
      
    <?php $display = $field_set->display_label(); ?>

    <?php
    
      $display_td = $display;
      
      if ($field_set->icon != "") {
        $display_td = WOOF_HTML::tag("span", array("class" => "with-icon field-set-".$field_set->id), $display);
      }

    ?>
    
    <?php 
    
    $deleting_class = MPC::is_deleting($field_set->id, "delete-field-set") ? 'deleting' : ''; 
    $editable_class = $can_edit ? " editable " : "";
    $meta = $can_edit ? "{ href: '".MasterPress::admin_url("post-types", "edit-field-set", array("id" => $field_set->id, "parent" => MasterPress::$parent) )."' }" : "";
    
    ?>
    
    <?php $disabled = $field_set->disabled ? "disabled" : ""; $title = $field_set->disabled ? ' title="'.__("this field set is disabled", MASTERPRESS_DOMAIN).'" ' : ""; ?>
    
    <?php
    if (!$field_set->in_current_site()) {
      $disabled = "disabled";
      $title = ' title="'.__("field set is not currently available in this site (multi-site setting)", MASTERPRESS_DOMAIN).'" ';
    }
    ?>
    
    <tr <?php echo $title ?> class="<?php echo $disabled ?> <?php echo $editable_class.$deleting_class ?> <?php echo MPV::updated_class("edit-field-set,create-field-set", $field_set->id) ?> <?php echo $meta ?>">
      <?php if ($field_set->allow_multiple) : ?>
      <th class="first type icon"><i class="metabox-add-remove-large" title="<?php _e("Field Set (Multiple Items)", MASTERPRESS_DOMAIN) ?>"></i></th>
      <?php else : ?>
      <th class="first type icon"><i class="metabox-large" title="<?php _e("Field Set", MASTERPRESS_DOMAIN) ?>"></i></th>
      <?php endif; ?>
      <th class="label"><strong><?php echo $display_td ?></strong></th>
      <th class="front-end-name <?php echo $has_actions ? "" : "last" ?>"><span class="tt"><?php echo $field_set->display_name() ?></span></th>

      <?php if ($has_actions) : ?>

      <th class="actions last">
      <div>
      <?php if (MPC::is_deleting($field_set->id, "delete-field-set")) : ?>
        <span class="confirm-action">&nbsp;</span>
      <?php else: ?>
        <?php if ($can_edit) : ?>
          <?php echo MPV::action_button("post-types", "edit-field-set", self::__edit(), array("id" => $field_set->id, "parent" => MasterPress::$parent), array("class" => "button button-edit") ); ?>
        <?php endif; ?>

        <?php if ($can_delete) : ?>
          <?php echo MPV::action_button("post-types", "delete-field-set", self::__delete(), array("id" => $field_set->id, "parent" => MasterPress::$parent), array("class" => "button button-delete") ); ?>
        <?php endif; ?>
      <?php endif; ?>
      </div>
      </th>

      <?php endif; // has_actions ?>

    </tr>  
    
        
    <?php 

    $count = 0; 
    $fields = $field_set->fields();
    
    ?>
    
    <?php foreach ($fields as $field) : $count++; $first = $count == 1 ? 'first' : ''; $disabled = $field_set->disabled || $field->disabled ? "disabled" : ""; $title = ($field_set->disabled || $field->disabled) ? ' title="'.__("this field is disabled", MASTERPRESS_DOMAIN).'" ' : ""; ?>
    
    <?php
    if (!$field_set->in_current_site() || !$field->in_current_site()) {
      $disabled = "disabled";
      $title = ' title="'.__("field is not currently available in this site (multi-site setting)", MASTERPRESS_DOMAIN).'" ';
    }
    ?>
    
    <?php 
    
    $deleting_class = MPC::is_deleting($field_set->id, "delete-field-set") || MPC::is_deleting($field->id, "delete-field") ? 'deleting' : ''; 
    $editable_class = $can_edit_fields ? " editable " : "";
    $meta = $can_edit ? "{ href: '".MasterPress::admin_url("post-types", "edit-field", array("id" => $field->id, "gparent" => $_GET["parent"], "parent" => $field_set->id) )."' }" : "";

    
    ?>

  
    <?php
    
    if ($type_class = MPFT::type_class($field->type)) : ?>
    

    <tr <?php echo $title ?> class="sub <?php echo $editable_class.$deleting_class ?> <?php echo $disabled ?> <?php echo $first ?> <?php echo $count % 2 == 0 ? "even" : "" ?> <?php echo MPV::updated_class("edit-field,create-field", $field->id) ?> <?php echo $meta ?>">
      <td class="type icon first" title="<?php echo call_user_func( array($type_class, "__s") ) ?>"><span class="mp-icon mp-icon-field-type-<?php echo $field->type ?>"></span></td>
      <td class="label"><strong><?php echo $field->display_label() ?></strong></td>
      <td class="front-end-name <?php echo $has_actions ? "" : "last" ?>"><span class="tt"><span class="arrow">-&gt;&nbsp;</span><?php echo $field->display_name() ?></span></td>

      <?php if ($has_actions) : ?>

      <td class="actions last">
      <div>
      <?php if (MPC::is_deleting($field->id, "delete-field")) : ?>
        <span class="confirm-action">&nbsp;</span>
      <?php else: ?>
        <?php if ($can_edit_fields) : ?>
          <?php echo MPV::action_button("post-types", "edit-field", self::__edit(), array("id" => $field->id, "gparent" => $_GET["parent"], "parent" => $field_set->id), array("class" => "button button-edit") ); ?>
        <?php endif; ?>

        <?php if ($can_delete_fields) : ?>
          <?php echo MPV::action_button("post-types", "delete-field", self::__delete(), array("id" => $field->id, "gparent" => $_GET["parent"], "parent" => $parent->id), array("class" => "button button-delete") ); ?>
        <?php endif; ?>
      <?php endif; ?>
      </div>
      </td>

      <?php endif; // has_actions ?>
      
    </tr>
   
    <?php else: ?>
    <!-- TODO - TYPE CLASS DOESN'T EXIST -->
    
    <?php endif; ?>
  
    <?php endforeach; ?>
  
    <tr class="summary <?php echo $can_create_fields ? "editable" : "" ?>">
      <?php if (count($fields)) : ?>
      <td colspan="<?php echo $colspan ?>" class="first <?php echo $can_create_fields ? "" : "last" ?>"><?php printf( __( "%s contains %s", MASTERPRESS_DOMAIN ), $display, MPU::__items( $field_set->field_count(), __("%d custom field", MASTERPRESS_DOMAIN), __("%d custom fields", MASTERPRESS_DOMAIN) )  ) ?></td>
      <?php else: ?>
      <td colspan="<?php echo $colspan ?>" class="hl first last"><span><?php printf( __( "<strong>%s</strong> is not yet active as it contains <em>no custom fields</em>. Click here to create one", MASTERPRESS_DOMAIN ), $display ); ?></span></td>
      <?php endif; ?>

      <?php if ($can_create_fields) : ?>
      <td class="last actions <?php echo count($fields) ? "" : "hl" ?>">
      <?php echo MPV::action_button("post-types", "create-field", self::__create(MPV_Fields::__s()), array("gparent" => $_GET["parent"], "parent" => $field_set->id), array("class" => "button create-field") ); ?>
      </td>
      <?php endif; // can_create_fields ?>

    </tr>
    <tr class="gap <?php if ($fg_count == count($field_sets)) { echo "gap-last"; } ?>">
    <td colspan="4">&nbsp;</td>  
    </tr>
    
  
    <?php endforeach; ?>

    </tbody>
  
    </table>

    <?php if ($can_create) : ?>
    <div class="grid-foot-controls">
    <?php echo MPV::action_button("post-types", "create-field-set", MPV::__create( MPV_FieldSets::__s() ), array("parent" => $parent->id ) ); ?>
    </div>
    <?php endif; ?>
    
    <?php else: ?>
  
    <?php if ($can_create) : ?>
    <a href="<?php echo MasterPress::admin_url("post-types", "create-field-set", array("parent" => MasterPress::$parent)) ?>" class="no-items-create">
    <i class="plus-circle"></i>
	<span><?php printf( __( "The <strong>%s</strong> post type currently has <em>no field sets</em>. Click here to create one.", MASTERPRESS_DOMAIN ), $parent->display_label() );  ?></span>
    </a>
    <?php endif; ?>
    
    <?php endif; ?>
  
    <?php
     
  } // end grid()
Example #4
0
  public function manage_field_sets() {
    
    if (!MasterPress::current_user_can("manage_post_type_field_sets")) {
      wp_die(__("Sorry, you do not have the required capability to manage post type field sets.", MASTERPRESS_DOMAIN));
    }
    
    MPV::incl("field-sets");
    
    $actions = array();
    
    if (MasterPress::current_user_can("create_post_type_field_sets")) {
      $actions = array( MPV::action_button( $this->key(), "create-field-set", MPV::__create( "" ), array("parent" => MasterPress::$parent), array('class' => 'add-new-h2') ) );
    }
    
    $this->setup_view( array(
        "view" => "field-sets",
        "method" => "grid",
        "title_args" => array( 
          "actions" => $actions, 
          "info_panel" => true,
          "text" => MPV_FieldSets::__p() 
        )
      )
    );

  }
Example #5
0
  public function grid($id = null) {

    MPV::incl("field-sets");
    MPV::incl("fields");
    MPV::incl("taxonomies");
    MPC::incl("taxonomies");
    

    $has_actions = MasterPress::current_user_can("edit_templates,delete_templates,manage_template_field_sets");
    $can_edit = MasterPress::current_user_can("edit_templates");
    $can_delete = MasterPress::current_user_can("delete_templates");
    $can_create = MasterPress::current_user_can("create_templates");
    $can_manage_field_sets = MasterPress::current_user_can("manage_template_field_sets");

    $colspan = $has_actions ? 8 : 7;

    
  ?>


  <?php MPV::messages(); ?>
  
  <table cellspacing="0" class="grid grid-post-types">
    <thead>
    <tr>
      <th class="first file-name front-end-name"><i class="script-php"></i><span><?php _e("File Name", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="name"><i class="template"></i><span><?php _e("Template Name", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="field-sets"><i class="metaboxes"></i><span><?php _e("Field Sets", MASTERPRESS_DOMAIN) ?></span></th>
      <th class="post-types <?php echo $has_actions ? "" : "last" ?>"><i class="pins"></i><span><?php _e("Post Types", MASTERPRESS_DOMAIN) ?></span></th>
      <?php if ($has_actions) : ?>
      <th class="actions last"><i class="buttons"></i><span><?php _e("Actions", MASTERPRESS_DOMAIN) ?></span></th>
      <?php endif; ?>
    </tr>
    </thead>
    <tbody>
     
    <?php $count = 0; $disabled = ""; ?>
    
    <?php $templates = get_page_templates();  ?>
    
    <?php foreach ($templates as $template => $file) : $count++; $first = $count == 1 ? 'first' : ''; $model = MPM_Template::find_by_id($file);
    
    
    $editable_class = $can_edit ? " editable " : "";
    $meta = $can_edit ? "{ href: '".MasterPress::admin_url("templates", "edit", "id=".$file)."' }" : "";


    ?>
    
    <tr class="<?php echo $first ?> <?php echo $editable_class.$disabled ?> <?php echo MPV::updated_class("edit,create", $file) ?> <?php echo $count % 2 == 0 ? "even" : "" ?> sub <?php echo $meta ?>">
      <td class="first file-name"><strong><span class="tt"><?php echo $file ?></span></strong></td>
      <td class="name"><?php echo $template ?></td>
      <td class="field-sets <?php echo $can_manage_field_sets ? "manage" : "" ?>">
        <?php if ($can_manage_field_sets) : ?>
        <a href="<?php echo MasterPress::admin_url( "templates", "manage-field-sets", "parent=".$file)?>">
		<i class="go"></i>
        <?php endif; ?>
        
        <?php 
        
        $field_sets = MPM_TemplateFieldSet::find_by_template( $file ); 

        $field_set_display = MPV::note_none();
        
        if (count($field_sets)) {
          $field_set_links = array();
          
          foreach ($field_sets as $field_set) {
            if (!$field_set->is_shared()) {
              $field_set_links[] =  $field_set->display_label();
            }
          }

          if (count($field_set_links)) {
            $field_set_display = implode($field_set_links, ", ");
          }
        
        }
        
        echo $field_set_display;
        ?>
        <?php if ($can_manage_field_sets) : ?>
        </a>
        <?php endif; ?>

      </td>
      
      <td class="post-types <?php echo $has_actions ? "" : "last" ?>">
        
        <?php 
        
        $vis = $model->visibility;
        
        $vis_post_types = "";

        if (isset($vis["post_types"])) {
          $vis_post_types = $vis["post_types"];
        }
        
        if ($vis_post_types == "*") {

          $post_type_display = '<span class="inherit">( '.__("All", MASTERPRESS_DOMAIN).' )</span>';

        } else {
          
          if (is_null($vis_post_types) || $vis_post_types == "") {
          
            $post_type_display = __("( none )");
          
          } else {
            $post_types = $model->post_types(); 
          
            $post_type_display = MPV::note_none();
        
            if (count($post_types)) {
              $post_type_links = array();
          
              foreach ($post_types as $post_type) {
                $post_type_links[] = $post_type->labels["name"];
              }

              $post_type_display = implode($post_type_links, ", ");
            }
          }
        }
        
        echo $post_type_display;
          
        ?>
        
      </td>

      <?php if ($has_actions) : ?>

      <td class="actions last">
      <div>
        <?php if ($can_edit) : ?>
          <?php echo MPV::action_button("templates", "edit", self::__edit( ), "id=".$file, array("class" => "button button-edit")); ?>
        <?php endif; ?>

        <?php if ($can_manage_field_sets) : ?>
          <?php echo MPV::action_button("templates", "manage-field-sets", self::__manage( MPV_FieldSets::__p_short() ), "parent=".$file, array("class" => "button button-manage")); ?>
        <?php endif; ?>  
      </div>
      </td>

      <?php endif; // has_actions ?>

    </tr>
    
    <?php endforeach; ?>

    </tbody>
    </table>
    
    <?php
    
  } // end grid()