Beispiel #1
0
 function get_events()
 {
     $projects = CPM_Project::getInstance()->get_projects();
     unset($projects['total_projects']);
     if (cpm_get_option('task_start_field') == 'on') {
         $enable_start = true;
     } else {
         $enable_start = false;
     }
     $events = array();
     if ($projects) {
         foreach ($projects as $project) {
             $project_id = $project->ID;
             if (absint($_POST['project_id']) && $project_id != absint($_POST['project_id'])) {
                 continue;
             }
             //Get Milestones
             $milestones = CPM_Milestone::getInstance()->get_by_project($project_id);
             if ($milestones) {
                 foreach ($milestones as $milestone) {
                     //Milestone Event
                     $events[] = array('id' => $milestone->ID, 'title' => $milestone->post_title, 'start' => $milestone->due_date, 'url' => cpm_url_milestone_index($project_id), 'color' => '#32b1c8', 'className' => $milestone->completed == 1 ? 'milestone competed' : 'milestone');
                 }
             }
             //Get Tasks
             if (cpm_user_can_access($project_id, 'tdolist_view_private')) {
                 $task_lists = CPM_Task::getInstance()->get_task_lists($project_id, true);
             } else {
                 $task_lists = CPM_Task::getInstance()->get_task_lists($project_id);
             }
             if ($task_lists) {
                 foreach ($task_lists as $task_list) {
                     $tasks = CPM_Task::getInstance()->get_tasks_by_access_role($task_list->ID, $project_id);
                     foreach ($tasks as $task) {
                         $image = '';
                         if (is_array($task->assigned_to)) {
                             foreach ($task->assigned_to as $key => $user_id) {
                                 $image .= get_avatar($user_id, 16);
                             }
                         } else {
                             $image .= get_avatar($task->assigned_to, 16);
                         }
                         //Tasks Event
                         if ($enable_start) {
                             if (isset($task->start_date) && !empty($task->start_date)) {
                                 $start_date = $task->start_date;
                             } else {
                                 $start_date = $task->due_date;
                             }
                             $events[] = array('id' => $task->ID, 'img' => $task->assigned_to == -1 ? '' : $image, 'title' => $task->post_title, 'start' => $start_date, 'end' => $task->due_date, 'complete_status' => $task->completed == 1 ? 'yes' : 'no', 'url' => cpm_url_single_task($project_id, $task_list->ID, $task->ID), 'color' => 'transparent', 'textColor' => '#c86432', 'className' => date('Y-m-d', time()) < $task->due_date ? 'cpm-calender-todo cpm-task-running' : 'cpm-calender-todo cpm-expire-task');
                         } else {
                             $events[] = array('id' => $task->ID, 'img' => $task->assigned_to == -1 ? '' : $image, 'title' => $task->post_title, 'start' => $task->due_date, 'complete_status' => $task->completed == 1 ? 'yes' : 'no', 'url' => cpm_url_single_task($project_id, $task_list->ID, $task->ID), 'color' => 'transparent', 'textColor' => '#c86432', 'className' => date('Y-m-d', time()) < $task->due_date ? 'cpm-calender-todo cpm-task-running' : 'cpm-calender-todo cpm-expire-task');
                         }
                     }
                 }
             }
         }
     }
     return $events;
 }
Beispiel #2
0
<?php

$project_obj = CPM_Project::getInstance();
$projects = $project_obj->get_projects();
$total_projects = $projects['total_projects'];
$pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 1;
$db_limit = intval(cpm_get_option('pagination'));
$limit = $db_limit ? $db_limit : 10;
$status_class = isset($_GET['status']) ? $_GET['status'] : 'active';
$count = cpm_project_count();
$can_create_project = cpm_manage_capability('project_create_role');
$class = $can_create_project ? '' : ' cpm-no-nav';
unset($projects['total_projects']);
?>

<h2><?php 
_e('Project Manager', 'cpm');
?>
</h2>

<div class="cpm-projects<?php 
echo $class;
?>
">

    <div class="cpm-project-filter">
        <ul class="list-inline order-statuses-filter">
            <li<?php 
echo $status_class == 'all' ? ' class="active"' : '';
?>
>
Beispiel #3
0
 /**
  * Load all the plugin scripts and styles only for the
  * project area
  *
  * @since 0.1
  */
 static function admin_scripts()
 {
     $upload_size = intval(cpm_get_option('upload_limit')) * 1024 * 1024;
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-ui-autocomplete');
     wp_enqueue_script('jquery-ui-dialog');
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_script('jquery-ui-sortable');
     wp_enqueue_script('jquery-prettyPhoto', plugins_url('assets/js/jquery.prettyPhoto.js', __FILE__), array('jquery'), false, true);
     wp_enqueue_script('jquery-chosen', plugins_url('assets/js/chosen.jquery.min.js', __FILE__), array('jquery'), false, true);
     wp_enqueue_script('validate', plugins_url('assets/js/jquery.validate.min.js', __FILE__), array('jquery'), false, true);
     wp_enqueue_script('plupload-handlers');
     wp_enqueue_script('cpm_admin', plugins_url('assets/js/admin.js', __FILE__), array('jquery', 'jquery-prettyPhoto'), false, true);
     wp_enqueue_script('cpm_task', plugins_url('assets/js/task.js', __FILE__), array('jquery'), false, true);
     wp_enqueue_script('cpm_uploader', plugins_url('assets/js/upload.js', __FILE__), array('jquery', 'plupload-handlers'), false, true);
     wp_localize_script('cpm_admin', 'CPM_Vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('cpm_nonce'), 'is_admin' => is_admin() ? 'yes' : 'no', 'plupload' => array('browse_button' => 'cpm-upload-pickfiles', 'container' => 'cpm-upload-container', 'max_file_size' => $upload_size . 'b', 'url' => admin_url('admin-ajax.php') . '?action=cpm_ajax_upload&nonce=' . wp_create_nonce('cpm_ajax_upload'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'resize' => array('width' => (int) get_option('large_size_w'), 'height' => (int) get_option('large_size_h'), 'quality' => 100))));
     wp_enqueue_style('cpm_admin', plugins_url('assets/css/admin.css', __FILE__));
     wp_enqueue_style('cpm_prettyPhoto', plugins_url('assets/css/prettyPhoto.css', __FILE__));
     wp_enqueue_style('jquery-ui', plugins_url('assets/css/jquery-ui-1.9.1.custom.css', __FILE__));
     wp_enqueue_style('jquery-chosen', plugins_url('assets/css/chosen.css', __FILE__));
 }
Beispiel #4
0
<div class="icon32" id="icon-themes"><br></div>
<h2><?php 
_e('Calendar', 'cpm');
?>
</h2>

<?php 
if (cpm_get_option('task_start_field') == 'on') {
    $eventDurationEditable = 'true';
} else {
    $eventDurationEditable = 'false';
}
if (!is_admin()) {
    $fornt_instant = 'cpmf_url:' . json_encode(get_permalink());
} else {
    $fornt_instant = 'url:' . json_encode(admin_url());
}
$porjects = CPM_Project::getInstance()->get_projects();
unset($porjects['total_projects']);
if (isset($_POST['calender-project'])) {
    $project_id = isset($_POST['project_id']) ? absint($_POST['project_id']) : '0';
} else {
    $project_id = '0';
}
?>

<form action="" method="post">
    <?php 
$get_values = isset($_GET) ? $_GET : array();
foreach ($get_values as $name => $get_value) {
    ?>
Beispiel #5
0
 /**
  * Add a single task
  *
  * @param int $list_id task list id
  * @return int $task_id task id for update purpose
  */
 function add_task($list_id, $task_id = 0)
 {
     $postdata = $_POST;
     $files = isset($postdata['cpm_attachment']) ? $postdata['cpm_attachment'] : array();
     $task_privacy = isset($postdata['task_privacy']) ? $postdata['task_privacy'] : 'no';
     $is_update = $task_id ? true : false;
     $content = trim($postdata['task_text']);
     $assigned = isset($postdata['task_assign']) ? $postdata['task_assign'] : array('-1');
     $due = empty($postdata['task_due']) ? '' : cpm_date2mysql($postdata['task_due']);
     $start = empty($postdata['task_start']) ? '' : cpm_date2mysql($postdata['task_start']);
     $data = array('post_parent' => $list_id, 'post_title' => trim(substr($content, 0, 40)), 'post_content' => $content, 'post_type' => 'task', 'post_status' => 'publish');
     $data = apply_filters('cpm_task_params', $data);
     if ($task_id) {
         $data['ID'] = $task_id;
         $task_id = wp_update_post($data);
     } else {
         $task_id = wp_insert_post($data);
     }
     if ($task_id) {
         $this->assign_user($task_id, $assigned);
         update_post_meta($task_id, '_due', $due);
         if (cpm_get_option('task_start_field') == 'on') {
             update_post_meta($task_id, '_start', $start);
         } else {
             update_post_meta($task_id, '_start', '');
         }
         update_post_meta($task_id, '_task_privacy', $task_privacy);
         //initially mark as uncomplete
         if (!$is_update) {
             update_post_meta($task_id, '_completed', 0);
         }
         //if there is any file, update the object reference
         if (count($files) > 0) {
             $comment_obj = CPM_Comment::getInstance();
             foreach ($files as $file_id) {
                 $comment_obj->associate_file($file_id, $task_id);
             }
         }
         if ($is_update) {
             $this->new_task_project_item($list_id, $task_id, $assigned, $task_privacy, $is_update);
             do_action('cpm_task_update', $list_id, $task_id, $data);
         } else {
             $this->new_task_project_item($list_id, $task_id, $assigned, $task_privacy, $is_update);
             do_action('cpm_task_new', $list_id, $task_id, $data);
         }
     }
     return $task_id;
 }
Beispiel #6
0
    if (is_array($project_users) && count($project_users)) {
        foreach ($project_users as $user_id => $role_array) {
            if ($this->filter_email($user_id)) {
                $users[$user_id] = sprintf('%s', $role_array['email']);
                // $users[$user_id] = sprintf( '%s (%s)', $role_array['name'], $role_array['email'] );
            }
        }
    }
    //if any users left, get their mail addresses and send mail
    if ($users) {
        cpm_get_email_header();
        $new = CPM_URL . '/assets/images/new.png';
        $triangle = CPM_URL . '/assets/images/triangle.png';
        $template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => $data['post_title'], '%PROJECT_DETAILS%' => $data['post_content'], '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>');
        $subject = cpm_get_option('new_project_sub');
        $message = cpm_get_content(cpm_get_option('new_project_body'));
        // subject
        foreach ($template_vars as $key => $value) {
            $subject = str_replace($key, $value, $subject);
        }
        // message
        foreach ($template_vars as $key => $value) {
            $message = str_replace($key, $value, $message);
        }
    }
    ?>
        <table width="600" style="margin-top: 50px; background: #fff;">
	    	<tr>
	    		<td>
	    			<center><img src="<?php 
    echo $new;
$project_users = CPM_Project::getInstance()->get_users($project_id);
$users = array();
if (is_array($project_users) && count($project_users)) {
    foreach ($project_users as $user_id => $role_array) {
        if ($role_array['role'] == 'manager') {
            if ($this->filter_email($user_id)) {
                // $users[$user_id] = sprintf( '%s (%s)', $role_array['name'], $role_array['email'] );
                $users[$user_id] = sprintf('%s', $role_array['email']);
            }
        }
    }
}
if ($users) {
    $template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%TASKLIST_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_tasklist($project_id, $list_id) . '"">' . get_post_field('post_title', $list_id) . '</a>', '%TASK_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_task($project_id, $list_id, $task_id) . '">' . $data->post_content . '</a>', '%TASK%' => $data->post_content, '%IP%' => get_ipaddress());
    $subject = cpm_get_option('complete_task_sub');
    $message = cpm_get_content(cpm_get_option('completed_task_body'));
    // subject
    foreach ($template_vars as $key => $value) {
        $subject = str_replace($key, $value, $subject);
    }
    foreach ($template_vars as $key => $value) {
        $message = str_replace($key, $value, $message);
    }
}
?>
<table cellspacing="0" width="600">
	<!-- <tr>
		<td style="position: relative;"><img style="position: absolute; left: 48%; top: -8px;" src="<?php 
echo $triangle;
?>
"/></td>
Beispiel #8
0
/**
 * In the case of create use  is_cpm_user_can_access( $project_id, $section )
 *
 * In the case of view user  ! is_cpm_user_can_access( $project_id, $section )
 */
function cpm_user_can_access($project_id, $section = '')
{
    global $current_user;
    $login_user = apply_filters('cpm_current_user_access', $current_user, $project_id, $section);
    $project_user_role = cpm_project_user_role($project_id);
    $loggedin_user_role = reset($login_user->roles);
    $manage_capability = cpm_get_option('project_manage_role');
    // grant project manager all access
    // also if the user role has the ability to manage all projects from settings, allow him
    if ($project_user_role == 'manager' || array_key_exists($loggedin_user_role, $manage_capability)) {
        return true;
    }
    // Now, if the user is not manager, check if he can access from settings
    $settings_role = get_post_meta($project_id, '_settings', true);
    $can_access = isset($settings_role[$project_user_role][$section]) ? $settings_role[$project_user_role][$section] : '';
    if ($can_access == 'yes') {
        return true;
    } else {
        return false;
    }
}
Beispiel #9
0
/**
 * HTML form generator for new/update task form
 *
 * @param int $list_id
 * @param int $project_id
 * @param null|object $task
 */
function cpm_task_new_form($list_id, $project_id, $task = null, $single = false)
{
    $action = 'cpm_task_add';
    $task_content = $task_due = $task_start = '';
    $assigned_to = '-1';
    $submit_button = __('Add this to-do', 'cpm');
    //for update form
    if (!is_null($task)) {
        $action = 'cpm_task_update';
        $task_content = $task->post_content;
        $assigned_to = $task->assigned_to;
        $submit_button = __('Save Changes', 'cpm');
        if ($task->due_date != '') {
            $task_due = date('m/d/Y', strtotime($task->due_date));
        }
        if ($task->start_date != '') {
            $task_start = date('m/d/Y', strtotime($task->start_date));
        }
    }
    ?>

    <form action="" method="post" class="cpm-task-form">
        <input type="hidden" name="list_id" value="<?php 
    echo $list_id;
    ?>
">
        <input type="hidden" name="project_id" value="<?php 
    echo $project_id;
    ?>
">
        <input type="hidden" name="action" value="<?php 
    echo $action;
    ?>
">
        <input type="hidden" name="single" value="<?php 
    echo $single;
    ?>
">
        <?php 
    wp_nonce_field($action);
    ?>

        <?php 
    if ($task) {
        ?>
            <input type="hidden" name="task_id" value="<?php 
        echo $task->ID;
        ?>
">
        <?php 
    }
    ?>

        <div class="item content">
            <textarea name="task_text" class="todo_content" cols="40" placeholder="<?php 
    esc_attr_e('Add a new to-do', 'cpm');
    ?>
" rows="1"><?php 
    echo esc_textarea($task_content);
    ?>
</textarea>
        </div>

        <div class="item date">
            <?php 
    if (cpm_get_option('task_start_field') == 'on') {
        ?>
                <div class="cpm-task-start-field">
                    <label><?php 
        _e('Start date', 'cpm');
        ?>
</label>
                    <input  type="text" autocomplete="off" class="date_picker_from" placeholder="<?php 
        esc_attr_e('Start date', 'cpm');
        ?>
" value="<?php 
        echo esc_attr($task_start);
        ?>
" name="task_start" />
                </div>
            <?php 
    }
    ?>

            <div class="cpm-task-due-field">
                <label><?php 
    _e('Due date', 'cpm');
    ?>
</label>
                <input type="text" autocomplete="off" class="date_picker_to" placeholder="<?php 
    esc_attr_e('Due date', 'cpm');
    ?>
" value="<?php 
    echo esc_attr($task_due);
    ?>
" name="task_due" />
            </div>
        </div>

        <div class="item user">
            <?php 
    cpm_task_assign_dropdown($project_id, $assigned_to);
    ?>
        </div>


        <?php 
    do_action('cpm_task_new_form', $list_id, $project_id, $task);
    ?>

        <div class="item submit">
            <span class="cpm-new-task-spinner"></span>
            <input type="submit" class="button-primary" name="submit_todo" value="<?php 
    echo esc_attr($submit_button);
    ?>
">
            <a class="button todo-cancel" href="#"><?php 
    _e('Cancel', 'cpm');
    ?>
</a>
        </div>
    </form>
    <?php 
}
Beispiel #10
0
<?php

cpm_get_email_header();
$new = CPM_URL . '/assets/images/new.png';
$triangle = CPM_URL . '/assets/images/triangle.png';
$template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%AUTHOR%' => $user->display_name, '%AUTHOR_EMAIL%' => $user->user_email, '%TASKLIST_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_tasklist($project_id, $list_id) . '">' . get_post_field('post_title', $list_id) . '</a>', '%TASK_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_single_task($project_id, $list_id, $task_id) . '">' . get_post_field('post_title', $task_id) . '</a>', '%TASK%' => $data['post_content'], '%IP%' => get_ipaddress());
$subject = cpm_get_option('new_task_sub');
$message = cpm_get_content(cpm_get_option('new_task_body'));
// subject
foreach ($template_vars as $key => $value) {
    $subject = str_replace($key, $value, $subject);
}
// message
foreach ($template_vars as $key => $value) {
    $message = str_replace($key, $value, $message);
}
?>


    <table width="600" style="margin-top: 50px; background: #fff;">
    	<tr>
    		<td>
    			<center><img src="<?php 
echo $new;
?>
"/></center>
    		</td>
    	</tr> 
    	<tr>
    		<td>
    			<center><div style="font-size: 45px; padding-top: 38px;"><?php 
    if (is_array($project_users) && count($project_users)) {
        foreach ($project_users as $user_id => $role_array) {
            if ($this->filter_email($user_id)) {
                $users[$user_id] = sprintf('%s', $role_array['email']);
                // $users[$user_id] = sprintf( '%s (%s)', $role_array['name'], $role_array['email'] );
            }
        }
    }
    //if any users left, get their mail addresses and send mail
    if ($users) {
        cpm_get_email_header();
        $new = CPM_URL . '/assets/images/new.png';
        $triangle = CPM_URL . '/assets/images/triangle.png';
        $template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => $data['post_title'], '%PROJECT_DETAILS%' => $data['post_content'], '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>');
        $subject = cpm_get_option('update_project_sub');
        $message = cpm_get_content(cpm_get_option('update_project_body'));
        // subject
        foreach ($template_vars as $key => $value) {
            $subject = str_replace($key, $value, $subject);
        }
        // message
        foreach ($template_vars as $key => $value) {
            $message = str_replace($key, $value, $message);
        }
        ?>
            <table width="600" style="margin-top: 50px; background: #fff;">
		    	<tr>
		    		<td>
		    			<center><img src="<?php 
        echo $new;
        ?>
 function send($to, $subject, $message, $comment_post_id = 0)
 {
     $bcc_status = cpm_get_option('email_bcc_enable');
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $reply = 'no-reply@' . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME']));
     $content_type = 'Content-Type: text/html';
     $charset = 'Charset: UTF-8';
     $from_email = cpm_get_option('email_from');
     $from = "From: {$blogname} <{$from_email}>";
     $reply = apply_filters('cpm_reply_to', $to, $comment_post_id);
     $reply_to = "Reply-To: {$reply}";
     if ($bcc_status == 'on') {
         $bcc = 'Bcc: ' . $to;
         $headers = array($bcc, $reply_to, $content_type, $charset, $from);
         wp_mail($reply, $subject, $message, $headers);
     } else {
         $headers = array($reply_to, $content_type, $charset, $from);
         wp_mail($to, $subject, $message, $headers);
     }
 }
Beispiel #13
0
$author = wp_get_current_user();
$comment_url = '';
switch ($parent_post->post_type) {
    case 'message':
        $comment_url = cpm_url_single_message($project_id, $data['comment_post_ID']);
        break;
    case 'task_list':
        $comment_url = cpm_url_single_tasklist($project_id, $parent_post->ID);
        break;
    case 'task':
        $comment_url = cpm_url_single_task($project_id, $parent_post->post_parent, $parent_post->ID);
        break;
}
$template_vars = array('%SITE%' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), '%PROJECT_NAME%' => get_post_field('post_title', $project_id), '%PROJECT_URL%' => '<a style="text-decoration: none;" href="' . cpm_url_project_details($project_id) . '">' . get_post_field('post_title', $project_id) . '</a>', '%AUTHOR%' => $author->display_name, '%AUTHOR_EMAIL%' => $author->user_email, '%COMMENT_URL%' => '<a style="text-decoration: none;" href="' . $comment_url . '/#cpm-comment-' . $comment_id . '">' . __('comment link', 'cpm') . '</a>', '%COMMENT%' => $data['comment_content'], '%IP%' => get_ipaddress());
$subject = cpm_get_option('new_comment_sub');
$message = cpm_get_content(cpm_get_option('new_comment_body'));
// subject
foreach ($template_vars as $key => $value) {
    $subject = str_replace($key, $value, $subject);
}
// message
foreach ($template_vars as $key => $value) {
    $message = str_replace($key, $value, $message);
}
?>

  	<table width="600" style="margin-top: 50px; background: #fff;">
    	<tr>
    		<td>
    			<center><img src="<?php 
echo $new;
Beispiel #14
0
 function send($to, $subject, $message, $comment_post_id = 0)
 {
     $bcc_status = cpm_get_option('email_bcc_enable');
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $reply = 'no-reply@' . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME']));
     $content_type = 'Content-Type: ' . cpm_get_option('email_type');
     $charset = 'Charset: UTF-8';
     $from_email = cpm_get_option('email_from');
     $from = "From: {$from_email}";
     $header = dirname(__FILE__) . '/../views/emails/header.php';
     $header_template = apply_filters('cpm_email_header', $header, $to, $subject, $message);
     if ($bcc_status == 'on') {
         $bcc = 'Bcc: ' . $to;
         $reply = apply_filters('cpm_reply_to', $to, $comment_post_id);
         $reply_to = "Reply-To: {$reply}";
         $headers = array($bcc, $reply_to, $content_type, $charset, $from);
         wp_mail($reply, $subject, $message, $headers);
     } else {
         $to = explode(',', $to);
         foreach ($to as $key => $email) {
             $reply = apply_filters('cpm_reply_to', $email, $comment_post_id);
             $reply_to = "Reply-To: {$reply}";
             $headers = array($reply_to, $content_type, $charset, $from);
             wp_mail($email, $subject, $message, $headers);
         }
     }
 }
Beispiel #15
0
 /**
  * Check if a user has permission on a project
  *
  * Admins and editors can access all projects.
  *
  * @param object $project
  * @return bool
  */
 function has_permission($project)
 {
     global $current_user;
     $loggedin_user_role = reset($current_user->roles);
     $manage_capability = cpm_get_option('project_manage_role');
     $project_users_role = $this->get_users($project->ID);
     if (array_key_exists($current_user->ID, $project_users_role) || array_key_exists($loggedin_user_role, $manage_capability)) {
         return true;
     }
     return false;
 }
<?php

$logo_path = cpm_get_option('logo');
$date = cpm_date2mysql(current_time('mysql'));
$custom_date = date('l, d F Y', strtotime($date));
$calendar = CPM_URL . '/assets/images/calendar.png';
?>

<div style="background: #f5f5f5; padding-bottom: 30px;">
	<div style="width:600px; margin: 0 auto; background: #fff;">
		<table cellspacing="0" cellpadding="0">
		<tr>
		<td>

		<div style="height:9px; width: 100%; background: #858585;">&nbsp;</div>
		<div style="height: 83px; width: 100%; background: #ededed;">
			<div style="float: left; margin-left: 50px; margin-top: 21px;"><a href="<?php 
echo home_url();
?>
"><img src="<?php 
echo $logo_path;
?>
"></a></div>
			<div style="float: right; margin-right: 50px; margin-top: 33px;">
				<img style="float: left;" src="<?php 
echo $calendar;
?>
">
				<div style="float: right; margin: 3px 10px; font-family: arial; font-size: 13px;"><?php 
echo $custom_date;
?>
Beispiel #17
0
 function send($to, $subject, $message)
 {
     $mail_type = cpm_get_option('email_type');
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $wp_email = 'no-reply@' . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME']));
     $from = "From: \"{$blogname}\" <{$wp_email}>";
     $headers = "{$from}\nContent-Type: {$mail_type}; charset=\"" . get_option('blog_charset') . "\"\n";
     //TODO: add every users to BCC
     wp_mail($to, $subject, $message, $headers);
 }
Beispiel #18
0
 function milestone_index($url, $project_id)
 {
     $page_id = cpm_get_option('project');
     $url = add_query_arg(array('project_id' => $project_id, 'tab' => 'milestone', 'action' => 'index'), $this->get_permalink($page_id));
     return $url;
 }
 function update_task_time()
 {
     check_ajax_referer('cpm_nonce');
     if (cpm_get_option('task_start_field') == 'on') {
         $start_date = !empty($_POST['start_date']) ? date('Y-m-d H:i:s', strtotime($_POST['start_date'])) : '';
         update_post_meta($_POST['task_id'], '_start', $start_date);
     }
     $end_date = !empty($_POST['end_date']) ? date('Y-m-d H:i:s', strtotime($_POST['end_date'])) : date('Y-m-d H:i:s', strtotime($_POST['start_date']));
     update_post_meta($_POST['task_id'], '_due', $end_date);
 }
Beispiel #20
0
                                                        </a>
                                                    </span>
                                                <?php 
                }
                ?>
                                                <span class="cpm-assign-by">
                                                    <?php 
                echo $current_user->display_name;
                ?>
                                                </span>
                                                <?php 
                if ($start_date != '' || $task->due_date != '') {
                    ?>
                                                    <span class="cpm-due-date">
                                                        <?php 
                    if (cpm_get_option('task_start_field') == 'on' && $start_date != '') {
                        echo cpm_get_date($start_date);
                    }
                    if ($start_date != '' & $task->due_date != '') {
                        echo ' - ';
                    }
                    if ($task->due_date != '') {
                        echo cpm_get_date($task->due_date);
                    }
                    ?>
                                                    </span>

                                                <?php 
                }
                ?>