Пример #1
0
 /**
  * load data needed for board's javascript
  * @param  string $template the passed in template path
  * @return string           the same template path
  */
 static function send_page_data_to_template($template)
 {
     if (!isset(Kanban_Template::get_instance()->slug) || Kanban_Template::get_instance()->slug != self::$slug) {
         return $template;
     }
     global $wp_query;
     $wp_query->query_vars['kanban'] = (object) array();
     $wp_query->query_vars['kanban']->board = (object) array();
     // // get all data for the javascript
     $wp_query->query_vars['kanban']->board->allowed_users = Kanban_User::get_allowed_users();
     $wp_query->query_vars['kanban']->board->estimates = Kanban_Terms::terms_in_order('task', 'estimate');
     $wp_query->query_vars['kanban']->board->status_tax_key = Kanban_Utils::format_key('task', 'status');
     $wp_query->query_vars['kanban']->board->status_color_field_name = sprintf('%s_colors', $wp_query->query_vars['kanban']->board->status_tax_key);
     $wp_query->query_vars['kanban']->board->status_colors = Kanban_Settings::get_option($wp_query->query_vars['kanban']->board->status_color_field_name, null, array());
     $wp_query->query_vars['kanban']->board->statuses = Kanban_Terms::terms_in_order('task', 'status');
     foreach ($wp_query->query_vars['kanban']->board->statuses as $status) {
         if (!isset($wp_query->query_vars['kanban']->board->status_colors[$status->term_id])) {
             continue;
         }
         $status->color = $wp_query->query_vars['kanban']->board->status_colors[$status->term_id];
     }
     $wp_query->query_vars['kanban']->board->projects = Kanban_Project::get_all();
     $wp_query->query_vars['kanban']->board->tasks = Kanban_Task::get_all();
     $current_user_id = get_current_user_id();
     $wp_query->query_vars['kanban']->board->current_user = get_user_by('id', $current_user_id);
     unset($wp_query->query_vars['kanban']->board->current_user->data->user_pass);
     $wp_query->query_vars['kanban']->board->current_user->data->long_name_email = Kanban_User::format_user_name($wp_query->query_vars['kanban']->board->current_user);
     $wp_query->query_vars['kanban']->board->current_user->data->short_name = Kanban_User::format_user_name($wp_query->query_vars['kanban']->board->current_user, TRUE);
     $wp_query->query_vars['kanban']->board->current_user->data->initials = Kanban_User::get_initials($wp_query->query_vars['kanban']->board->current_user);
     $wp_query->query_vars['kanban']->board->col_percent_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / count($wp_query->query_vars['kanban']->board->statuses) : 100;
     $wp_query->query_vars['kanban']->board->sidebar_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / (count($wp_query->query_vars['kanban']->board->statuses) - 2) : 0;
     return $template;
 }
Пример #2
0
    /**
     * load data needed for board's javascript
     * @param  string $template the passed in template path
     * @return string           the same template path
     */
    static function send_page_data_to_template($template)
    {
        // make sure we're looking at the board
        if (!isset(Kanban_Template::get_instance()->slug) || Kanban_Template::get_instance()->slug != self::$slug) {
            return $template;
        }
        // make sure they don't need to upgrade
        if (Kanban::get_instance()->settings->records_to_move > 0) {
            ?>
			<p>
			<?php 
            echo sprintf(__('We\'ve found %s kanban records that need to be migrated for the latest version of Kanban for WordPress!', 'kanban'), Kanban::get_instance()->settings->records_to_move);
            ?>
			</p>
			<p>
			<?php 
            echo sprintf(__('Please visit the <a href="%s">Kanban welcome page</a> to migrate your data.', 'kanban'), add_query_arg('page', 'kanban_welcome', admin_url('admin.php')));
            ?>
			<?php 
            exit;
        }
        // get the template data
        global $wp_query;
        // attach our object to the template data
        $wp_query->query_vars['kanban'] = (object) array();
        $wp_query->query_vars['kanban']->board = (object) array();
        // add default filters
        $wp_query->query_vars['kanban']->board->filters = array('user' => (object) array(), 'project' => (object) array());
        // add passed alert
        $wp_query->query_vars['kanban']->board->alert = !empty($_GET['alert']) ? stripcslashes($_GET['alert']) : '';
        // get all data for the javascript
        $wp_query->query_vars['kanban']->board->settings = Kanban_Option::get_all();
        $wp_query->query_vars['kanban']->board->allowed_users = Kanban_User::get_allowed_users();
        $wp_query->query_vars['kanban']->board->estimates = Kanban_Estimate::get_all();
        $wp_query->query_vars['kanban']->board->statuses = Kanban_Status::get_all();
        $wp_query->query_vars['kanban']->board->projects = Kanban_Project::get_all();
        $wp_query->query_vars['kanban']->board->tasks = Kanban_Task::get_all();
        // get the current user from the allowed users
        $current_user_id = get_current_user_id();
        $wp_query->query_vars['kanban']->board->current_user = $wp_query->query_vars['kanban']->board->allowed_users[$current_user_id];
        // figure out percentages here (easier, quicker than in js)
        $wp_query->query_vars['kanban']->board->col_percent_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / count($wp_query->query_vars['kanban']->board->statuses) : 100;
        $wp_query->query_vars['kanban']->board->sidebar_w = count($wp_query->query_vars['kanban']->board->statuses) > 0 ? 100 / (count($wp_query->query_vars['kanban']->board->statuses) - 2) : 0;
        apply_filters('kanban_board_query_vars', $wp_query->query_vars['kanban']->board);
        return $template;
    }
Пример #3
0
 /**
  * get the instance of this class
  * @return	object	the instance
  */
 public static function get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #4
0
?>
%;
}
</style>



<?php 
// Automatically load router files
$js_templates = glob(Kanban::$instance->settings->path . '/templates/inc/t-*.php');
foreach ($js_templates as $js_template) {
    ?>
<script type="text/html" id="<?php 
    echo basename($js_template, '.php');
    ?>
">

<?php 
    include $js_template;
    ?>

</script>
<?php 
}
?>



<?php 
include Kanban_Template::find_template('inc/footer');
Пример #5
0
 static function settings_page()
 {
     $settings = Kanban_Option::get_all();
     if (is_serialized($settings['allowed_users'])) {
         $settings['allowed_users'] = unserialize($settings['allowed_users']);
     }
     $all_users = get_users();
     $all_users_arr = array();
     foreach ($all_users as $user) {
         $all_users_arr[$user->ID] = Kanban_User::get_username_long($user);
     }
     $statuses = Kanban_Status::get_all();
     $statuses = Kanban_Utils::order_array_of_objects_by_property($statuses, 'position', 'int');
     $estimates = Kanban_Estimate::get_all();
     $estimates = Kanban_Utils::order_array_of_objects_by_property($estimates, 'position', 'int');
     $template = Kanban_Template::find_template('admin/settings');
     include_once $template;
 }
Пример #6
0
 /**
  * render the welcome page
  */
 static function welcome_page()
 {
     $template = Kanban_Template::find_template('admin/welcome');
     include_once $template;
 }
Пример #7
0
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title><?php 
echo __('Kanban for WordPress', Kanban::$instance->settings->file);
?>
</title>


	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

	<!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
		<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<![endif]-->

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

	<?php 
Kanban_Template::add_style();
?>
</head>
<body>
Пример #8
0
			<?php 
submit_button(__('Save your Settings', 'kanban'), 'primary', 'submit');
?>
		</div><!-- tab-statuses -->



		<div class="tab" id="tab-estimates" style="display: none;">

			<ol id="list-estimates" class="sortable">
<?php 
foreach ($estimates as $estimate_id => $estimate) {
    ?>
				<?php 
    echo Kanban_Template::render_template('admin/t-estimate', (array) $estimate);
}
?>
			</ol><!-- sortable -->
			<p>
				<button type="button" class="button" id="add-estimate">
					<?php 
echo __('Add another estimate', 'kanban');
?>
				</button>
			</p>


			<table class="form-table">
				<tbody>
					<tr>
Пример #9
0
<?php

Kanban_Template::add_script();
?>

<?php 
// wp_footer();
?>

</body>
</html>