public function init_attributes()
 {
     global $rtbiz_rt_attributes;
     $rtbiz_rt_attributes = new RT_Attributes(RTBIZ_TEXT_DOMAIN);
     $editor_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'editor');
     $author_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'author');
     $terms_caps = array('manage_terms' => $editor_cap, 'edit_terms' => $editor_cap, 'delete_terms' => $editor_cap, 'assign_terms' => $author_cap);
     $rtbiz_rt_attributes->add_attributes_page(self::$page_slug, Rtbiz_Dashboard::$page_slug, '', $editor_cap, $terms_caps, $render_type = false, $storage_type = false, $orderby = false);
 }
Exemplo n.º 2
0
 /**
  * Register Team
  */
 function register_taxonomy_team()
 {
     $editor_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'editor');
     $caps = array('manage_terms' => $editor_cap, 'edit_terms' => $editor_cap, 'delete_terms' => $editor_cap, 'assign_terms' => $editor_cap);
     $arg = array('public' => false, 'show_ui' => true, 'labels' => $this->labels, 'rewrite' => false, 'capabilities' => $caps, 'hierarchical' => true, 'show_admin_column' => true);
     $supported_posttypes = array();
     $supported_posttypes = apply_filters('rtbiz_team_support', $supported_posttypes);
     $supported_posttypes = array_unique($supported_posttypes);
     register_taxonomy(self::$slug, $supported_posttypes, $arg);
 }
Exemplo n.º 3
0
 /**
  * up[date metabox order
  */
 public function metabox_rearrange()
 {
     global $wp_meta_boxes;
     $custom_order['submitdiv'] = $wp_meta_boxes[$this->post_type]['side']['core']['submitdiv'];
     $custom_order['p2p-from-' . $this->post_type . '_to_user'] = $wp_meta_boxes[$this->post_type]['side']['default']['p2p-from-' . $this->post_type . '_to_user'];
     $admin_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'admin');
     if (current_user_can($admin_cap)) {
         $custom_order['rt-biz-acl-details'] = $wp_meta_boxes[$this->post_type]['side']['default']['rt-biz-acl-details'];
     }
     $custom_order['productdiv'] = $wp_meta_boxes[$this->post_type]['side']['core']['productdiv'];
     if (isset($wp_meta_boxes[$this->post_type]['side']['core']['rt-teamdiv'])) {
         $custom_order['teamdiv'] = $wp_meta_boxes[$this->post_type]['side']['core']['teamdiv'];
     }
     $wp_meta_boxes[$this->post_type]['side']['core'] = $custom_order;
     unset($wp_meta_boxes[$this->post_type]['side']['default']['rt-biz-acl-details']);
     unset($wp_meta_boxes[$this->post_type]['side']['default']['p2p-from-' . $this->post_type . '_to_user']);
 }
Exemplo n.º 4
0
 /**
  *
  * All the possible arguments for Redux.
  * For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
  * */
 public function rtbiz_set_arguments()
 {
     //$theme = wp_get_theme(); // For use with some settings. Not necessary.
     $editor_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'editor');
     $this->args = array('opt_name' => self::$biz_opt, 'display_name' => __('Settings'), 'display_version' => RTBIZ_VERSION, 'menu_type' => 'submenu', 'allow_sub_menu' => false, 'menu_title' => __('Settings'), 'page_title' => __('Settings'), 'google_api_key' => '', 'async_typography' => true, 'admin_bar' => false, 'global_variable' => '', 'dev_mode' => false, 'customizer' => false, 'page_priority' => null, 'page_parent' => Rtbiz_Dashboard::$page_slug, 'page_permissions' => $editor_cap, 'page_slug' => self::$page_slug, 'save_defaults' => true, 'default_show' => true, 'default_mark' => '', 'show_import_export' => true, 'transient_time' => 60 * MINUTE_IN_SECONDS, 'output' => true, 'output_tag' => true, 'database' => '', 'system_info' => false, 'hints' => array('icon' => 'icon-question-sign', 'icon_position' => 'right', 'icon_color' => 'lightgray', 'icon_size' => 'normal', 'tip_style' => array('color' => 'light', 'shadow' => true, 'rounded' => false, 'style' => ''), 'tip_position' => array('my' => 'top left', 'at' => 'bottom right'), 'tip_effect' => array('show' => array('effect' => 'slide', 'duration' => '500', 'event' => 'mouseover'), 'hide' => array('effect' => 'slide', 'duration' => '500', 'event' => 'click mouseleave'))));
     return true;
 }
Exemplo n.º 5
0
        public function rtbiz_welcome_panel()
        {
            $admin_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'admin');
            $editor_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'editor');
            $welcome_label = __('rtBiz');
            $contact_labels = rtbiz_get_contact_labels();
            $company_labels = rtbiz_get_company_labels();
            //$contact_group_labels = rtbiz_get_contact_group_labels();
            ?>
			<div class="welcome-panel-content">
				<h3><?php 
            _e('Welcome to ' . $welcome_label);
            ?>
</h3>

				<p class="about-description"><?php 
            _e('We&#8217;ve assembled some links to get you started:');
            ?>
</p>

				<div class="welcome-panel-column-container">
					<div class="welcome-panel-column">
						<?php 
            if (current_user_can($editor_cap)) {
                ?>
							<h4><?php 
                _e('Get Started');
                ?>
</h4>
							<a id="rtbiz-customize-biz" class="button button-primary button-hero"
							   href="<?php 
                echo admin_url('admin.php?page=' . Rtbiz_Setting::$page_slug);
                ?>
"><?php 
                echo $welcome_label . ' ' . __('Settings');
                ?>
</a>
						<?php 
            }
            ?>
						<?php 
            do_action('rtbiz_welcome_panel_addon_link');
            ?>
					</div>
					<div class="welcome-panel-column">
						<h4><?php 
            _e('Next Steps');
            ?>
</h4>
						<ul><?php 
            if (current_user_can($editor_cap)) {
                $rtbiz_setting_url = admin_url('admin.php?page=rt-biz-settings');
                echo '<li>';
                echo '<a class="welcome-icon welcome-admin-users" href="' . $rtbiz_setting_url . '" style="display: inline-block;" >' . __('Import') . ' ' . strtolower($contact_labels['name']) . '</a>';
                echo '</li>';
            }
            if (current_user_can($editor_cap)) {
                ?>
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-universal-access-alt">' . __('Add new Team & assign them to') . ' ' . strtolower($contact_labels['singular_name']) . '</a>', admin_url('edit-tags.php?taxonomy=' . Rtbiz_Teams::$slug . '&post_type=' . rtbiz_get_contact_post_type()));
                ?>
</li>
							<?php 
            }
            if (current_user_can($admin_cap)) {
                ?>
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-lock">' . __('Define your Access Control for') . ' ' . $welcome_label . '</a>', admin_url('admin.php?page=' . Rtbiz_Access_Control::$page_slug));
                ?>
</li>
							<?php 
            }
            ?>
						</ul>
					</div>

					<div class="welcome-panel-column welcome-panel-last">
						<h4><?php 
            _e('Quick Actions');
            ?>
</h4>
						<ul>
							<?php 
            if (current_user_can($editor_cap)) {
                ?>
								<li><?php 
                printf('<a id="rtiz-add-contact" href="%s" class="welcome-icon welcome-admin-users">' . __('Add new') . ' ' . $contact_labels['singular_name'] . '</a>', admin_url('post-new.php?post_type=' . rtbiz_get_contact_post_type()));
                ?>
</li>
								<!--<li><?php 
                /*printf( '<a href="%s" class="welcome-icon welcome-groups">' . __( 'Setup' ) . ' ' . $contact_group_labels['name'] . '</a>', admin_url( 'edit-tags.php?taxonomy=' . Rtbiz_Contact::$user_category_taxonomy . '&post_type=' . rtbiz_get_contact_post_type() ) ); */
                ?>
</li>-->
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-admin-home">' . __('Add new') . ' ' . $company_labels['singular_name'] . '</a>', admin_url('post-new.php?post_type=' . rtbiz_get_company_post_type()));
                ?>
</li>
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-networking">' . __('Setup Attributes') . '</a>', admin_url('admin.php?page=' . Rtbiz_Attributes::$page_slug));
                ?>
</li>
							<?php 
            } else {
                ?>
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-groups">' . __('View your') . ' ' . $contact_labels['name'] . '</a>', admin_url('edit.php?post_type=' . rtbiz_get_contact_post_type()));
                ?>
</li>
								<li><?php 
                printf('<a href="%s" class="welcome-icon welcome-admin-home">' . __('View your') . ' ' . $company_labels['name'] . '</a>', admin_url('edit.php?post_type=' . rtbiz_get_company_post_type()));
                ?>
</li>
							<?php 
            }
            ?>
							<li><?php 
            printf('<a href="%s" class="welcome-icon welcome-learn-more">' . __('Learn more about getting started') . '</a>', 'http://docs.rtcamp.com/rtbiz/');
            ?>
</li>
						</ul>
					</div>
				</div>
			</div> <?php 
        }
Exemplo n.º 6
0
function rtbiz_is_our_employee($value, $module)
{
    global $rtbiz_contact;
    if (is_numeric($value)) {
        $value = get_user_by('id', $value);
    } elseif (is_string($value)) {
        $value = get_user_by('email', $value);
    } elseif (!is_object($value)) {
        return false;
    }
    $isEmployee = p2p_connection_exists($rtbiz_contact->post_type . '_to_user', array('to' => $value->ID));
    return $isEmployee && !empty($value) && user_can($value, rtbiz_get_access_role_cap($module, 'author')) ? true : false;
}
        public static function ui($post)
        {
            if (rtbiz_get_contact_post_type() == $post->post_type) {
                $meta_fields = rtbiz_get_contact_meta_fields();
            } elseif (rtbiz_get_company_post_type() == $post->post_type) {
                $meta_fields = rtbiz_get_company_meta_fields();
            }
            do_action('rtbiz_before_render_meta_fields', $meta_fields);
            if (empty($meta_fields)) {
                return false;
            }
            ?>
			<div id="rtbiz-additional-detail-meta-box"> <?php 
            $category = array_unique(wp_list_pluck($meta_fields, 'category'));
            $cathtml = array();
            foreach ($category as $key => $value) {
                $cathtml[$value]['title'] = '<div><h3 class="rtbiz-category-title">' . __($value) . __(' information:') . ' </h3> </div>';
            }
            $cathtml['other']['title'] = '<div><h3 class="rtbiz-category-title">' . __('Other information:') . '</h3></div>';
            $other_flag = false;
            $is_our_team_mate = false;
            $postid = $post;
            if (is_object($post)) {
                $postid = $post->ID;
            }
            $wp_user = rtbiz_get_wp_user_for_contact($postid);
            //get wp user
            $cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'author');
            if (!empty($wp_user[0])) {
                $is_our_team_mate = user_can($wp_user[0], $cap);
            }
            foreach ($meta_fields as $field) {
                ob_start();
                $field = apply_filters('rtbiz_entity_fields_loop_single_field', $field);
                if (!$is_our_team_mate) {
                    if (isset($field['hide_for_client']) && $field['hide_for_client']) {
                        continue;
                    }
                }
                if (isset($field['is_datepicker']) && $field['is_datepicker']) {
                    $values = Rtbiz_Entity::get_meta($post->ID, $field['key'], true);
                    ?>
						<script>
							jQuery(document).ready(function ($) {
								$(document).on('focus', ".datepicker", function () {
									$(this).datepicker({
										'dateFormat': 'dd/mm/yy',
										changeMonth: true,
										changeYear: true
									});
								});
							});
						</script>
						<p class="rtbiz-form-group"><?php 
                    if (isset($field['label'])) {
                        ?>
							<label for="<?php 
                        echo isset($field['id']) ? '' . $field['id'] . '' : '';
                        ?>
">
								<?php 
                        echo $field['label'];
                        ?>
								</label><?php 
                    }
                    ?>
							<input type="text" <?php 
                    echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                    echo isset($field['id']) ? 'id="' . $field['id'] . '"' : '';
                    ?>
							       value='<?php 
                    echo $values;
                    ?>
' <?php 
                    echo isset($field['class']) ? 'class="datepicker ' . $field['class'] . '"' : 'class="datepicker"';
                    ?>
 >
							<br/><span></span>
						</p> <?php 
                } else {
                    if (isset($field['is_multiple']) && $field['is_multiple']) {
                        $values = Rtbiz_Entity::get_meta($post->ID, $field['key']);
                        ?>
						<p class="rtbiz-form-group"><?php 
                        if (isset($field['label'])) {
                            ?>
							<label for="<?php 
                            echo isset($field['id']) ? '' . $field['id'] . '' : '';
                            ?>
">
								<?php 
                            echo $field['label'];
                            ?>
								</label><?php 
                        }
                        ?>
							<input <?php 
                        echo isset($field['type']) ? 'type="' . $field['type'] . '"' : '';
                        ?>
								<?php 
                        echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                        ?>
								<?php 
                        echo isset($field['class']) ? 'class="' . $field['class'] . '"' : '';
                        ?>
 >

							<button data-type='<?php 
                        echo $field['type'];
                        ?>
' type='button'
							        class='button button-primary add-multiple'> +
							</button>

							<br/><span></span><?php 
                        foreach ($values as $value) {
                            ?>
								<input <?php 
                            echo isset($field['type']) ? 'type="' . $field['type'] . '"' : '';
                            echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                            ?>
									value='<?php 
                            echo $value;
                            ?>
' <?php 
                            echo isset($field['class']) ? 'class="second-multiple-input ' . $field['class'] . '"' : 'class="second-multiple-input"';
                            ?>
 >
								<button type='button' class='button delete-multiple'> -</button><?php 
                        }
                        ?>
						</p> <?php 
                    } else {
                        if (isset($field['type']) && 'textarea' == $field['type']) {
                            $values = Rtbiz_Entity::get_meta($post->ID, $field['key'], true);
                            ?>
						<p class="rtbiz-form-group"><?php 
                            if (isset($field['label'])) {
                                ?>
								<label
									for="<?php 
                                echo isset($field['id']) ? '' . $field['id'] . '' : '';
                                ?>
"><?php 
                                echo $field['label'];
                                ?>
								</label> <?php 
                            }
                            ?>
							<textarea <?php 
                            echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                            echo isset($field['id']) ? 'id="' . $field['id'] . '"' : '';
                            echo isset($field['class']) ? 'class="' . $field['class'] . '"' : '';
                            ?>
 > <?php 
                            echo $values;
                            ?>
 </textarea>
							<br/><span></span>
						</p> <?php 
                        } else {
                            if (isset($field['type']) && 'user_group' == $field['type']) {
                                $user_id = Rtbiz_Entity::get_meta($post->ID, $field['key'], true);
                                if (empty($user_id)) {
                                    continue;
                                }
                                ?>
					<p class="rtbiz-form-group"><?php 
                                call_user_func($field['data_source'], new WP_User($user_id));
                                ?>
					</p><?php 
                            } else {
                                if (isset($field['type']) && 'checkbox' == $field['type']) {
                                    $values = Rtbiz_Entity::get_meta($post->ID, $field['key'], true);
                                    ?>
						<p class="rtbiz-form-group rtbiz-form-checkbox">
							<label for="<?php 
                                    echo isset($field['id']) ? '' . $field['id'] . '' : '';
                                    ?>
">
								<input value='yes' <?php 
                                    echo 'yes' == $values ? 'checked' : '';
                                    ?>
								       type='checkbox' <?php 
                                    echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                                    echo isset($field['id']) ? 'id="' . $field['id'] . '"' : '';
                                    echo isset($field['class']) ? 'class="' . $field['class'] . '"' : '';
                                    ?>
 /><?php 
                                    echo $field['text'];
                                    ?>
</label>
							<br/><span></span>
						</p> <?php 
                                } else {
                                    $values = Rtbiz_Entity::get_meta($post->ID, $field['key'], true);
                                    ?>
						<p class="rtbiz-form-group"><?php 
                                    if (isset($field['label'])) {
                                        ?>
								<label for="<?php 
                                        echo isset($field['id']) ? '' . $field['id'] . '' : '';
                                        ?>
"><?php 
                                        echo $field['label'];
                                        ?>
								</label><?php 
                                    }
                                    ?>

							<input <?php 
                                    echo isset($field['type']) ? 'type="' . $field['type'] . '"' : '';
                                    echo isset($field['name']) ? 'name="' . $field['name'] . '"' : '';
                                    echo isset($field['id']) ? 'id="' . $field['id'] . '"' : '';
                                    ?>
								value='<?php 
                                    echo $values;
                                    ?>
' <?php 
                                    echo isset($field['class']) ? 'class="' . $field['class'] . '"' : '';
                                    ?>
 >
							<br/><span></span>
						</p> <?php 
                                }
                            }
                        }
                    }
                }
                $tmphtml = ob_get_clean();
                if (!isset($cathtml[$field['category']]['fields'])) {
                    $cathtml[$field['category']]['fields'] = '';
                }
                if (isset($field['category'])) {
                    $cathtml[$field['category']]['fields'] .= $tmphtml;
                } else {
                    $cathtml['other']['fields'] .= $tmphtml;
                    $other_flag = true;
                }
            }
            $printimpload = array();
            if (isset($cathtml['Contact'])) {
                $printimpload[] = $cathtml['Contact'];
                unset($cathtml['Contact']);
            }
            if (isset($cathtml['Social'])) {
                $printimpload[] = $cathtml['Social'];
                unset($cathtml['Social']);
            }
            if (isset($cathtml['HR'])) {
                if ($is_our_team_mate) {
                    $printimpload[] = $cathtml['HR'];
                }
                unset($cathtml['HR']);
            }
            foreach ($cathtml as $key => $value) {
                if ('other' == $key) {
                    if (true == $other_flag) {
                        $printimpload[] = $value;
                    }
                } else {
                    $printimpload[] = $value;
                }
            }
            $filter = function ($category) {
                return $category['title'] . '<div class="rtbiz-category-group">' . $category['fields'] . '</div>';
            };
            $printimpload = array_map($filter, $printimpload);
            echo implode('<div class="add-gap-div"><hr></div>', $printimpload);
            ?>

			</div> <?php 
            do_action('rtbiz_after_render_meta_fields', $post, $post->post_type);
            wp_nonce_field('rtbiz_additional_details_metabox', 'rtbiz_additional_details_metabox_nonce');
            if (rtbiz_get_contact_post_type() == $post->post_type) {
                /*  @var $rtbiz_contact Rtbiz_Contact */
                global $rtbiz_contact;
                $rtbiz_contact->print_metabox_js($post);
            } elseif (rtbiz_get_company_post_type() == $post->post_type) {
                /*  @var $rtbiz_company Rtbiz_Company */
                global $rtbiz_company;
                $rtbiz_company->print_metabox_js($post);
            }
            do_action('print_metabox_js', $post, $post->post_type);
        }
Exemplo n.º 8
0
 public function init_product()
 {
     global $rtbiz_products;
     $editor_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'editor');
     $terms_caps = array('manage_terms' => $editor_cap, 'edit_terms' => $editor_cap, 'delete_terms' => $editor_cap, 'assign_terms' => $editor_cap);
     $settings = rtbiz_get_product_selection_setting();
     $product_plugin = !empty($settings) ? $settings : array();
     $to_register_posttype = array();
     foreach (Rtbiz_Access_Control::$modules as $key => $value) {
         if (!empty($value['product_support'])) {
             $to_register_posttype = array_merge($to_register_posttype, $value['product_support']);
         }
     }
     $rtbiz_products = new Rt_Products($product_plugin, $terms_caps, $to_register_posttype);
 }
Exemplo n.º 9
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$settings = rtbiz_get_redux_settings();
$menu_label = __('rtBiz');
$author_cap = rtbiz_get_access_role_cap(RTBIZ_TEXT_DOMAIN, 'author');
?>
<div class="wrap">

	<?php 
screen_icon();
?>

	<h2><?php 
echo $menu_label . ' ' . __('Dashboard');
?>
</h2>

	<?php 
if (current_user_can($author_cap)) {
    $classes = 'welcome-panel';
    $option = get_user_meta(get_current_user_id(), 'rtbiz_show_welcome_panel', true);
    // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
    $hide = 0 == $option || 2 == $option && wp_get_current_user()->user_email != get_option('admin_email');
    if ($hide) {
        $classes .= ' hidden';
    }