Exemplo n.º 1
0
function _p2p_load_admin()
{
    P2P_Autoload::register('P2P_', dirname(__FILE__) . '/admin');
    P2P_Mustache::init();
    new P2P_Box_Factory();
    new P2P_Column_Factory();
    new P2P_Dropdown_Factory();
    new P2P_Tools_Page();
}
Exemplo n.º 2
0
 public static function init()
 {
     if (!class_exists('Mustache')) {
         require dirname(__FILE__) . '/../mustache/Mustache.php';
     }
     if (!class_exists('MustacheLoader')) {
         require dirname(__FILE__) . '/../mustache/MustacheLoader.php';
     }
     self::$loader = new MustacheLoader(dirname(__FILE__) . '/templates', 'html');
     self::$mustache = new Mustache(null, null, self::$loader);
 }
Exemplo n.º 3
0
 private function get_dropdown($p2p_type)
 {
     $data = array('old_p2p_type' => $p2p_type, 'options' => array_keys(P2P_Connection_Type_Factory::get_all_instances()), 'button_text' => __('Go', P2P_TEXTDOMAIN));
     return P2P_Mustache::render('connection-types-form', $data);
 }
Exemplo n.º 4
0
 function render($p2p_id, $user_id)
 {
     $user = get_user_by('id', $user_id);
     $data = array('title-attr' => '', 'title' => $user->display_name, 'url' => $this->get_edit_url($user_id));
     return P2P_Mustache::render('column-title', $data);
 }
Exemplo n.º 5
0
 function render($p2p_id, $item)
 {
     $data = array_merge($this->get_data($item), array('title' => $item->title, 'url' => $item->get_editlink()));
     return P2P_Mustache::render('column-title', $data);
 }
Exemplo n.º 6
0
 public static function init()
 {
     $loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/templates', array('extension' => 'html'));
     self::$mustache = new Mustache_Engine(array('loader' => $loader, 'partials_loader' => $loader));
 }
Exemplo n.º 7
0
 protected function candidate_row($item)
 {
     $title = apply_filters('p2p_candidate_title', $item->get_title(), $item->get_object(), $this->ctype);
     $title_data = array_merge($this->columns['title']->get_data($item), array('title' => $title, 'item-id' => $item->get_id()));
     $data = array();
     $data['columns'][] = array('column' => 'create', 'content' => P2P_Mustache::render('column-create', $title_data));
     return $data;
 }
Exemplo n.º 8
0
 protected function post_rows($current_post_id, $page = 1, $search = '')
 {
     $extra_qv = array_merge(self::$admin_box_qv, array('p2p:search' => $search, 'p2p:page' => $page, 'p2p:per_page' => 5));
     $candidate = $this->ctype->get_connectable($current_post_id, $extra_qv, 'abstract');
     if (empty($candidate->items)) {
         return html('div class="p2p-notice"', $this->labels->not_found);
     }
     $data = array();
     $columns = array('create' => new P2P_Field_Create($this->columns['title']));
     foreach ($candidate->items as $item) {
         $data['rows'][] = $this->table_row($columns, 0, $item);
     }
     if ($candidate->total_pages > 1) {
         $data['navigation'] = array('current-page' => number_format_i18n($candidate->current_page), 'total-pages' => number_format_i18n($candidate->total_pages), 'current-page-raw' => $candidate->current_page, 'total-pages-raw' => $candidate->total_pages, 'prev-inactive' => 1 == $candidate->current_page ? 'inactive' : '', 'next-inactive' => $candidate->total_pages == $candidate->current_page ? 'inactive' : '', 'prev-label' => __('previous', P2P_TEXTDOMAIN), 'next-label' => __('next', P2P_TEXTDOMAIN), 'of-label' => __('of', P2P_TEXTDOMAIN));
     }
     return P2P_Mustache::render('tab-list', $data);
 }
Exemplo n.º 9
0
 protected function post_rows($current_post_id, $page = 1, $search = '')
 {
     $candidate = $this->ctype->get_connectable($current_post_id, $page, $search);
     if (empty($candidate->items)) {
         return false;
     }
     $data = array();
     $columns = array('create' => new P2P_Field_Create(), 'title' => $this->columns['title']);
     foreach ($candidate->items as $item) {
         $data['rows'][] = $this->table_row($columns, 0, $item->ID);
     }
     if ($candidate->total_pages > 1) {
         $data['navigation'] = array('current-page' => number_format_i18n($candidate->current_page), 'total-pages' => number_format_i18n($candidate->total_pages), 'current-page-raw' => $candidate->current_page, 'total-pages-raw' => $candidate->total_pages, 'prev-inactive' => 1 == $candidate->current_page ? 'inactive' : '', 'next-inactive' => $candidate->total_pages == $candidate->current_page ? 'inactive' : '', 'prev-label' => __('previous', P2P_TEXTDOMAIN), 'next-label' => __('next', P2P_TEXTDOMAIN), 'of-label' => __('of', P2P_TEXTDOMAIN));
     }
     return P2P_Mustache::render('tab-list', $data);
 }
Exemplo n.º 10
0
 function render($p2p_id, $_)
 {
     $data = array('p2p_id' => $p2p_id, 'title' => __('Delete connection', P2P_TEXTDOMAIN));
     return P2P_Mustache::render('column-delete', $data);
 }