コード例 #1
0
function bp_gtm_done_item()
{
    global $bp, $wpdb;
    if ($_GET['doneAction'] == 'done') {
        if ($_GET['doneType'] == 'projects') {
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_projects . " SET `done` = '1' WHERE `id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_tasks . " SET `done` = '1' WHERE `project_id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $project = BP_GTM_Projects::get_project_by_id($_GET['doneID']);
            $resps = explode(' ', $project['0']->resp_id);
            foreach ($resps as $resp) {
                if ($resp != '') {
                    $resp_id = bp_core_get_userid($resp);
                    if ($resp_id != $bp->loggedin_user->id) {
                        bp_core_add_notification($_GET['doneID'], $resp_id, $bp->gtm->slug, 'project_done', $bp->groups->current_group->id);
                    }
                }
            }
        } elseif ($_GET['doneType'] == 'tasks') {
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_tasks . " SET `done` = '1' WHERE `id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_tasks . " SET `done` = '1' WHERE `parent_id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $task = BP_GTM_Tasks::get_task_by_id($_GET['doneID']);
            $resps = explode(' ', $task['0']->resp_id);
            foreach ($resps as $resp) {
                if ($resp != '') {
                    $resp_id = bp_core_get_userid($resp);
                    if ($resp_id != $bp->loggedin_user->id) {
                        bp_core_add_notification($_GET['doneID'], $resp_id, $bp->gtm->slug, 'task_done', $bp->groups->current_group->id);
                    }
                }
            }
        }
    } elseif ($_GET['doneAction'] == 'undone') {
        if ($_GET['doneType'] == 'projects') {
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_projects . " SET `done` = '0' WHERE `id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            //         $wpdb->query( $wpdb->prepare("UPDATE ".$bp->gtm->table_tasks." SET `done` = '0' WHERE `project_id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $project = BP_GTM_Projects::get_project_by_id($_GET['doneID']);
            $resps = explode(' ', $project['0']->resp_id);
            foreach ($resps as $resp) {
                if ($resp != '') {
                    $resp_id = bp_core_get_userid($resp);
                    if ($resp_id != $bp->loggedin_user->id) {
                        bp_core_add_notification($_GET['doneID'], $resp_id, $bp->gtm->slug, 'project_undone', $bp->groups->current_group->id);
                    }
                }
            }
        } elseif ($_GET['doneType'] == 'tasks') {
            $wpdb->query($wpdb->prepare("UPDATE " . $bp->gtm->table_tasks . " SET `done` = '0' WHERE `id` = %d AND `group_id` = %d", $_GET['doneID'], $bp->groups->current_group->id));
            $task = BP_GTM_Tasks::get_task_by_id($_GET['doneID']);
            $resps = explode(' ', $task['0']->resp_id);
            foreach ($resps as $resp) {
                if ($resp != '') {
                    $resp_id = bp_core_get_userid($resp);
                    if ($resp_id != $bp->loggedin_user->id) {
                        bp_core_add_notification($_GET['doneID'], $resp_id, $bp->gtm->slug, 'task_undone', $bp->groups->current_group->id);
                    }
                }
            }
        }
    }
    return true;
}
コード例 #2
0
ファイル: task_create.php プロジェクト: adisonc/MaineLearning
<?php

$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$parent_task = parse_url($url, PHP_URL_QUERY);
if (is_numeric(parse_url($url, PHP_URL_QUERY)) && parse_url($url, PHP_URL_QUERY) > 0) {
    $parent_task = parse_url($url, PHP_URL_QUERY);
    $parent_task = BP_GTM_Tasks::get_task_by_id($parent_task);
    $h4_title = __('Create New SubTask for', 'bp_gtm') . ' ' . bp_gtm_get_parent_task_link($parent_task, $gtm_link) . '';
} else {
    $parent_task = 0;
    $h4_title = __('Create New Task', 'bp_gtm');
}
?>

<h4><?php 
echo $h4_title;
?>
</h4>

<?php 
do_action('bp_before_gtm_task_create');
?>

<p>
    <label for="task_name"><?php 
_e('Task name', 'bp_gtm');
?>
<span class="required">*</span></label>
    <input type="text" name="task_name" id="task_name" value="" />
</p>
コード例 #3
0
function bp_gtm_task_list_settings($bp_gtm_group_settings)
{
    $limit['per_page'] = $option['per_page'] = $bp_gtm_group_settings['tasks_pp'];
    // how many to show
    $limit['miss'] = $option['miss'] = 0;
    // from the very first one - need to be on the 1st page
    $option['filter'] = !empty($_GET['filter']) ? $_GET['filter'] : '';
    $option['action'] = !empty($_GET['action']) ? $_GET['action'] : 'task_view';
    if (empty($_GET['project'])) {
        $option['project_id'] = false;
        if ($option['filter'] == 'done') {
            $option['page_h4'] = __('All Completed Tasks', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'done', false, $limit);
            $option['done_style'] = 'class="grey"';
        } elseif ($option['filter'] == 'alpha') {
            $option['page_h4'] = __('Tasks by A/Z', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'alpha', false, $limit);
            $option['alpha_style'] = 'class="grey"';
        } elseif ($option['filter'] == 'deadline') {
            $option['page_h4'] = __('Tasks by Deadline', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'deadline', false, $limit);
            $option['deadline_style'] = 'class="grey"';
        } elseif ($option['filter'] == 'without') {
            $option['page_h4'] = __('Tasks whithout Project', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'], false, $limit);
            $option['by_proj_style'] = 'class="grey"';
        } else {
            $option['page_h4'] = __('Tasks by Deadline', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'deadline', false, $limit);
            $option['deadline_style'] = 'class="grey"';
        }
    } elseif (!empty($_GET['project']) && !empty($option['filter'])) {
        if ($option['filter'] == 'done') {
            $option['project_id'] = $_GET['project'];
            $option['page_h4'] = __('Completed Tasks in Project', 'bp_gtm') . ' "' . bp_gtm_get_el_name_by_id($_GET['project'], 'project') . '"';
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'done', $_GET['project'], $limit);
            $option['by_proj_style'] = 'class="grey"';
        }
    } elseif (!empty($_GET['project']) && empty($option['filter'])) {
        if ($_GET['project'] == 'without') {
            $option['page_h4'] = __('Tasks whithout Project', 'bp_gtm');
            $option['tasks'] = BP_GTM_Tasks::get_task_whithout_project(bp_get_current_group_id());
            $option['by_proj_style'] = 'class="grey"';
        } else {
            $option['page_h4'] = __('Tasks by Deadline', 'bp_gtm');
            $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'inproject', $_GET['project'], $limit);
            $option['deadline_style'] = 'class="grey"';
        }
    } else {
        $option['project_id'] = false;
        $option['page_h4'] = __('Pending Tasks in Project', 'bp_gtm') . ' "' . bp_gtm_get_el_name_by_id($_GET['project'], 'project') . '"';
        $option['tasks'] = bp_gtm_get_tasks(bp_get_current_group_id(), $option['filter'] = 'project', $_GET['project'], $limit);
        $option['view_project'] = '<a href="' . $gtm_link . 'projects/view/' . $_GET['project'] . '" class="button" title="' . __('Go to project\'s page', 'bp_gtm') . '">' . __('View Project', 'bp_gtm') . '</a>';
        $option['filter'] = $_GET['project'];
        $option['by_proj_style'] = 'class="grey"';
    }
    return $option;
}
コード例 #4
0
ファイル: tasks.php プロジェクト: adisonc/MaineLearning
function bp_gtm_do_task_actions()
{
    global $bp, $wpdb;
    if ($_GET['action_type'] == 'complete') {
        $wpdb->query($wpdb->prepare("\n         UPDATE {$bp->gtm->table_tasks}\n         SET `done` = 1\n         WHERE `id` = {$_GET['task_id']} OR `parent_id` = {$_GET['task_id']}"));
        $task = BP_GTM_Tasks::get_task_by_id($_GET['task_id']);
        $resps = explode(' ', $task['0']->resp_id);
        foreach ($resps as $resp) {
            if ($resp != '') {
                $resp_id = bp_core_get_userid($resp);
                if ($resp_id != $bp->loggedin_user->id) {
                    bp_core_add_notification($_GET['task_id'], $resp_id, $bp->gtm->slug, 'task_done', $bp->groups->current_group->id);
                }
            }
        }
        echo 'completed';
    } elseif ($_GET['action_type'] == 'delete') {
        $wpdb->query($wpdb->prepare("DELETE FROM {$bp->gtm->table_tasks} WHERE `id` = %d AND `group_id` = %d", $_GET['task_id'], $bp->groups->current_group->id));
        $wpdb->query($wpdb->prepare("DELETE FROM {$bp->gtm->table_taxon} WHERE `task_id` = %d AND `group_id` = %d", $_GET['task_id'], $bp->groups->current_group->id));
        $wpdb->query($wpdb->prepare("DELETE FROM {$bp->gtm->table_resps} WHERE `task_id` = %d AND `group_id` = %d", $_GET['task_id'], $bp->groups->current_group->id));
        $wpdb->query($wpdb->prepare("DELETE FROM {$bp->gtm->table_discuss} WHERE `task_id` = %d AND `group_id` = %d", $_GET['task_id'], $bp->groups->current_group->id));
        $wpdb->query($wpdb->prepare("DELETE FROM {$bp->core->table_name_notifications} WHERE `item_id` = %d AND `secondary_item_id` = %d AND `component_name` = {$bp->gtm->slug} AND `component_action` LIKE `task_%%`", $_GET['task_id'], $bp->groups->current_group->id));
        $task = BP_GTM_Tasks::get_task_by_id($_GET['task_id']);
        $resps = explode(' ', $task['0']->resp_id);
        foreach ($resps as $resp) {
            if ($resp != '') {
                $resp_id = bp_core_get_userid($resp);
                if ($resp_id != $bp->loggedin_user->id) {
                    bp_core_add_notification($_GET['task_id'], $resp_id, $bp->gtm->slug, 'task_deleted', $bp->groups->current_group->id);
                }
            }
        }
        echo 'deleted';
    }
    die;
}
コード例 #5
0
ファイル: task_view.php プロジェクト: adisonc/MaineLearning
<?php

$task = BP_GTM_Tasks::get_task_by_id($bp->action_variables[2]);
if (count($task) == 0) {
    echo '<h4>' . __('Error - 404', 'bp_gtm') . '</h4>';
    echo '<p>' . __('There is no task in the database with such ID. Please go to the main tasks list.', 'bp_gtm') . '</p>';
    bp_gtm_view_list_button($gtm_link, 'tasks');
} else {
    if ($task['0']->done == 1) {
        $task_status = '<span id="task_status" style="color:green;font-size:14px">&rarr; ' . __('completed', 'bp_gtm') . '</span>';
    } else {
        $task_status = '<span id="task_status" style="display:none;font-size:14px"></span>';
    }
    ?>
    <div id="message" class="error"></div>
    <div id="topic-meta">
        <h3>#T<?php 
    echo $task['0']->id;
    ?>
 &rarr; <a href="<?php 
    echo $gtm_link . 'tasks/view/' . $task['0']->id;
    ?>
"><?php 
    echo $task['0']->name;
    ?>
</a> <?php 
    echo $task_status;
    ?>
</h3>
        <?php 
    bp_gtm_view_list_button($gtm_link, 'tasks');