本文整理汇总了PHP中Notifier::taskAssigned方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::taskAssigned方法的具体用法?PHP Notifier::taskAssigned怎么用?PHP Notifier::taskAssigned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifier
的用法示例。
在下文中一共展示了Notifier::taskAssigned方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_task
//.........这里部分代码省略.........
} else {
ProjectTaskDependencies::delete('task_id = ' . $task->getId());
}
}
// Add assigned user to the subscibers list
if ($task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())) {
if (!isset($_POST['subscribers'])) {
$_POST['subscribers'] = array();
}
$_POST['subscribers']['user_' . $task->getAssignedToContactId()] = 'checked';
}
$object_controller = new ObjectController();
$object_controller->add_to_members($task, $member_ids);
$object_controller->add_subscribers($task);
$object_controller->link_to_new_object($task);
$object_controller->add_custom_properties($task);
$object_controller->add_reminders($task);
// apply values to subtasks
$assigned_to = $task->getAssignedToContactId();
$subtasks = $task->getAllSubTasks();
$milestone_id = $task->getMilestoneId();
$apply_ms = array_var($task_data, 'apply_milestone_subtasks') == "checked";
$apply_at = array_var($task_data, 'apply_assignee_subtasks', '') == "checked";
foreach ($subtasks as $sub) {
$modified = false;
//if ($apply_at || !($sub->getAssignedToContactId() > 0)) {
if ($apply_at) {
$sub->setAssignedToContactId($assigned_to);
$modified = true;
}
if ($apply_ms) {
$sub->setMilestoneId($milestone_id);
$modified = true;
}
if ($modified) {
$sub->save();
}
}
$task->resetIsRead();
$log_info = '';
if ($send_edit == true) {
$log_info = $task->getAssignedToContactId();
} else {
if ($send_edit == false) {
$task->setAssignedBy(logged_user());
$task->save();
}
}
ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT, false, false, true, $log_info);
if (config_option('repeating_task') == 1) {
$opt_rep_day['saturday'] = false;
$opt_rep_day['sunday'] = false;
if (array_var($task_data, 'repeat_saturdays', false)) {
$opt_rep_day['saturday'] = true;
}
if (array_var($task_data, 'repeat_sundays', false)) {
$opt_rep_day['sunday'] = true;
}
$this->repetitive_task($task, $opt_rep_day);
}
if (isset($_POST['type_related'])) {
if ($_POST['type_related'] == "all" || $_POST['type_related'] == "news") {
$task_data['members'] = json_decode(array_var($_POST, 'members'));
unset($task_data['due_date']);
unset($task_data['use_due_time']);
unset($task_data['start_date']);
unset($task_data['use_start_time']);
$this->repetitive_tasks_related($task, "edit", $_POST['type_related'], $task_data);
}
}
if (config_option('multi_assignment') && Plugins::instance()->isActivePlugin('crpm')) {
if (array_var($task_data, 'multi_assignment_aplly_change') == 'subtask') {
$null = null;
Hook::fire('edit_subtasks', $task, $null);
}
}
DB::commit();
try {
if (array_var($task_data, 'send_notification') == 'checked' && $send_edit == false) {
$new_owner = $task->getAssignedTo();
if ($new_owner instanceof Contact) {
Notifier::taskAssigned($task);
}
// if
}
// if
} catch (Exception $e) {
}
// try
flash_success(lang('success edit task list', $task->getObjectName()));
ajx_current("back");
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
// try
}
// if
}
示例2: edit_task
//.........这里部分代码省略.........
if (!isset($task_data['parent_id'])) {
$task_data['parent_id'] = 0;
}
$was_template = $task->getIsTemplate();
$task->setFromAttributes($task_data);
$task->setIsTemplate($was_template);
// is_template value must not be changed from ui
// Set assigned to
$assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
$company_id = array_var($assigned_to, 0, 0);
$user_id = array_var($assigned_to, 1, 0);
$can_assign = can_assign_task_to_company_user(logged_user(), $task, $company_id, $user_id);
if ($can_assign !== true) {
flash_error($can_assign);
return;
}
$task->setAssignedToCompanyId($company_id);
$task->setAssignedToUserId($user_id);
if (!logged_user()->isMemberOfOwnerCompany()) {
$task->setIsPrivate($old_is_private);
}
$totalMinutes = array_var($task_data, 'time_estimate_hours') * 60 + array_var($task_data, 'time_estimate_minutes');
$task->setTimeEstimate($totalMinutes);
//Add handins
$handins = array();
for ($i = 0; $i < 4; $i++) {
if (isset($task_data["handin{$i}"]) && is_array($task_data["handin{$i}"]) && trim(array_var($task_data["handin{$i}"], 'title')) != '') {
$assigned_to = explode(':', array_var($task_data["handin{$i}"], 'assigned_to', ''));
$handins[] = array('title' => array_var($task_data["handin{$i}"], 'title'), 'responsible_company_id' => array_var($assigned_to, 0, 0), 'responsible_user_id' => array_var($assigned_to, 1, 0));
// array
}
// if
}
// for
if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
flash_error(lang('task child of child error'));
ajx_current("empty");
return;
}
DB::beginWork();
$task->save();
$task->setTagsFromCSV(array_var($task_data, 'tags'));
$object_controller = new ObjectController();
$object_controller->add_to_workspaces($task, !$task->getIsTemplate());
$object_controller->link_to_new_object($task);
$object_controller->add_subscribers($task);
$object_controller->add_custom_properties($task);
$object_controller->add_reminders($task);
// apply values to subtasks
$subtasks = $task->getAllSubTasks();
$project = $task->getProject();
$milestone_id = $task->getMilestoneId();
$apply_ws = array_var($task_data, 'apply_ws_subtasks') == "checked";
$apply_ms = array_var($task_data, 'apply_milestone_subtasks') == "checked";
$apply_at = array_var($task_data, 'apply_assignee_subtasks', '') == "checked";
foreach ($subtasks as $sub) {
$modified = false;
if ($apply_at || !$sub->getAssignedTo() instanceof ApplicationDataObject) {
$sub->setAssignedToCompanyId($company_id);
$sub->setAssignedToUserId($user_id);
$modified = true;
}
if ($apply_ws) {
$sub->setProject($project);
$modified = true;
}
if ($apply_ms) {
$sub->setMilestoneId($milestone_id);
$modified = true;
}
if ($modified) {
$sub->save();
}
}
$task->resetIsRead();
ApplicationLogs::createLog($task, $task->getWorkspaces(), ApplicationLogs::ACTION_EDIT);
DB::commit();
try {
if (array_var($task_data, 'send_notification') == 'checked') {
$new_owner = $task->getAssignedTo();
if ($new_owner instanceof User) {
Notifier::taskAssigned($task);
}
// if
}
// if
} catch (Exception $e) {
}
// try
flash_success(lang('success edit task list', $task->getTitle()));
ajx_current("back");
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
// try
}
// if
}
示例3: edit_task
/**
* Edit task
*
* @access public
* @param void
* @return null
*/
function edit_task()
{
$this->setTemplate('add_task');
$task = ProjectTasks::findById(get_id());
if (!$task instanceof ProjectTask) {
flash_error(lang('task dnx'));
$this->redirectTo('task');
}
// if
$task_list = $task->getTaskList();
if (!$task_list instanceof ProjectTaskList) {
flash_error('task list dnx');
$this->redirectTo('task');
}
// if
if (!$task->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectTo('task');
}
// if
$task_data = array_var($_POST, 'task');
if (!is_array($task_data)) {
$task_data = array('text' => $task->getText(), 'start_date' => $task->getStartDate(), 'due_date' => $task->getDueDate(), 'task_list_id' => $task->getTaskListId(), 'assigned_to' => $task->getAssignedToCompanyId() . ':' . $task->getAssignedToUserId(), 'send_notification' => config_option('send_notification_default', '0'));
// array
}
// if
tpl_assign('task', $task);
tpl_assign('task_list', $task_list);
tpl_assign('task_data', $task_data);
if (is_array(array_var($_POST, 'task'))) {
$old_owner = $task->getAssignedTo();
//$task_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_due_date_month', 1), array_var($_POST, 'task_due_date_day', 1), array_var($_POST, 'task_due_date_year', 1970));
if (isset($_POST['task_start_date'])) {
$task_data['start_date'] = DateTimeValueLib::makeFromString($_POST['task_start_date']);
} else {
$task_data['start_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_start_date_month', 1), array_var($_POST, 'task_start_date_day', 1), array_var($_POST, 'task_start_date_year', 1970));
}
if (isset($_POST['task_due_date'])) {
$task_data['due_date'] = DateTimeValueLib::makeFromString($_POST['task_due_date']);
} else {
$task_data['due_date'] = DateTimeValueLib::make(0, 0, 0, array_var($_POST, 'task_due_date_month', 1), array_var($_POST, 'task_due_date_day', 1), array_var($_POST, 'task_due_date_year', 1970));
}
$task->setFromAttributes($task_data);
$task->setTaskListId($task_list->getId());
// keep old task list id
$assigned_to = explode(':', array_var($task_data, 'assigned_to', ''));
$task->setAssignedToCompanyId(array_var($assigned_to, 0, 0));
$task->setAssignedToUserId(array_var($assigned_to, 1, 0));
try {
DB::beginWork();
$task->save();
// Move?
$new_task_list_id = (int) array_var($task_data, 'task_list_id');
if ($new_task_list_id && $task->getTaskListId() != $new_task_list_id) {
// Move!
$new_task_list = ProjectTaskLists::findById($new_task_list_id);
if ($new_task_list instanceof ProjectTaskList) {
$task_list->detachTask($task, $new_task_list);
// detach from old and attach to new list
}
// if
}
// if
ApplicationLogs::createLog($task, active_project(), ApplicationLogs::ACTION_EDIT);
DB::commit();
trace(__FILE__, 'edit_task: notify user');
// notify user
if (array_var($task_data, 'send_notification') == 'checked') {
try {
if (Notifier::notifyNeeded($task->getAssignedTo(), $old_owner)) {
Notifier::taskAssigned($task);
}
} catch (Exception $e) {
Logger::log("Error: Notification failed, " . $e->getMessage(), Logger::ERROR);
}
// try
}
// if
flash_success(lang('success edit task'));
// Redirect to task list. Check if we have updated task list ID first
if (isset($new_task_list) && $new_task_list instanceof ProjectTaskList) {
$this->redirectToUrl($new_task_list->getViewUrl());
} else {
$this->redirectToUrl($task_list->getViewUrl());
}
// if
} catch (Exception $e) {
DB::rollback();
tpl_assign('error', $e);
}
// try
}
// if
//.........这里部分代码省略.........
示例4: edit_task
//.........这里部分代码省略.........
}
foreach ($sub_tasks_to_log['trash'] as $st_to_log) {
ApplicationLogs::createLog($st_to_log, ApplicationLogs::ACTION_TRASH);
}
//Send Template task to view
if ($task instanceof TemplateTask) {
$objectId = $task->getObjectId();
$id = $task->getId();
$objectTypeName = $task->getObjectTypeName();
$objectName = $task->getObjectName();
$manager = get_class($task->manager());
$milestoneId = $task instanceof TemplateTask ? $task->getMilestoneId() : '0';
$subTasks = $task->getSubTasks();
$parentId = $task->getParentId();
$ico = "ico-task";
$action = "edit";
$object = TemplateController::prepareObject($objectId, $id, $objectName, $objectTypeName, $manager, $action, $milestoneId, $subTasks, $parentId, $ico);
$template_task_data = array('object' => $object);
if (array_var($_REQUEST, 'additional_tt_params')) {
$additional_tt_params = json_decode(str_replace("'", '"', array_var($_REQUEST, 'additional_tt_params')), true);
foreach ($additional_tt_params as $k => $v) {
$template_task_data[$k] = $v;
}
}
if (!array_var($_REQUEST, 'modal')) {
evt_add("template object added", $template_task_data);
}
}
try {
// notify asignee
if (array_var($task_data, 'send_notification') && $task->getAssignedToContactId() != $task->getAssignedById()) {
$new_owner = $task->getAssignedTo();
if ($new_owner instanceof Contact) {
Notifier::taskAssigned($task);
}
// if
}
// if
if (array_var($task_data, 'send_notification')) {
foreach ($sub_tasks_to_log['assigned'] as $st_to_log) {
Notifier::taskAssigned($st_to_log);
}
}
} catch (Exception $e) {
}
// try
//notify subscribers
$isSilent = true;
if (array_var($task_data, 'send_notification_subscribers')) {
$isSilent = false;
}
ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT, false, false, true, $log_info);
//flash_success(lang('success edit task list', $task->getObjectName()));
if (array_var($_REQUEST, 'modal')) {
if (array_var($_REQUEST, 'reload')) {
evt_add("reload current panel");
} else {
ajx_current("empty");
$this->setLayout("json");
$this->setTemplate(get_template_path("empty"));
// reload task info because plugins may have updated some task info (for example: name prefix)
if ($is_template) {
$task = TemplateTasks::findById($task->getId());
} else {
$task = ProjectTasks::findById($task->getId());
}