本文整理汇总了PHP中Task::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getId方法的具体用法?PHP Task::getId怎么用?PHP Task::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(Task $task)
{
$events = $task->popEvents();
$this->eventStore->save($task->getId(), $events);
foreach ($events as $event) {
$this->eventDispatcher->dispatch(get_class($event), $event);
}
}
示例2: addTask
public function addTask()
{
$projectId = $this->request_stack["arguments"][0];
$task = new Task();
$taskId = $task->setProject(ProjectQuery::create()->findOneById($projectId))->setEmployee(EmployeeQuery::create()->findOneById((new Cookie())->get("employee_id")))->save();
$redirect = new Request();
$redirect->redirect("task", "edit", array("id" => $task->getId()));
}
示例3: buildDescription
protected function buildDescription()
{
$description = 'type: ' . $this->identity->type . ', job_id: ' . $this->identity->getId();
$params = $this->identity->getParams();
foreach ($params as $key => $value) {
$description .= ", {$key}: {$value}";
}
return $description;
}
示例4: Task
function test_getId()
{
//Arrange
$description = "Wash the dog";
$id = 1;
$test_Task = new Task($description, $id);
//Act
$result = $test_Task->getId();
//Assert
$this->assertEquals(1, $result);
}
示例5: Task
function test_find()
{
$description = "Wash the dog";
$description2 = "Water the lawn";
$test_Task = new Task($description);
$test_Task->save();
$test_Task2 = new Task($description2);
$test_Task2->save();
$id = $test_Task->getId();
$result = Task::find($id);
$this->assertEquals($test_Task, $result);
}
示例6: remove
/**
* @inheritdoc
*/
public function remove(Task $task)
{
$task->close();
$taskId = $task->getId();
$taskSocketId = $task->getSocketId();
if (isset($this->sockets2tasks[$taskSocketId])) {
unset($this->sockets2tasks[$taskSocketId]);
}
if (isset($this->tasksActive[$taskId])) {
unset($this->tasksActive[$taskId]);
}
if (isset($this->tasks[$taskId])) {
unset($this->tasks[$taskId]);
}
unset($task);
}
示例7: Category
function test_find()
{
//Arrange
$name = "Home stuff";
$id = null;
$test_category = new Category($name, $id);
$test_category->save();
$description = "Wash the dog";
$date_due = "9/25/1990";
$time_due = "9:00am";
$category_id = $test_category->getId();
$test_task = new Task($id, $description, $date_due, $time_due, $category_id);
$test_task->save();
$description2 = "Water the Lawn";
$date_due2 = "3/28/2000";
$time_due2 = "10:00am";
$test_task2 = new Task($id, $description2, $date_due2, $time_due2, $category_id);
$test_task2->save();
$result = Task::find($test_task->getId());
$this->assertEquals($test_task, $result);
}
示例8: edit
/**
* Update an existing comment
*
* @param void
* @return null
*/
function edit()
{
$this->wireframe->print_button = false;
if ($this->active_comment->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_comment->canEdit($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
$parent = $this->active_comment->getParent();
if (!instance_of($parent, 'ProjectObject')) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$parent->prepareProjectSectionBreadcrumb($this->wireframe);
$this->wireframe->addBreadCrumb($parent->getName(), $parent->getViewUrl());
$comment_data = $this->request->post('comment');
if (!is_array($comment_data)) {
$comment_data = array('body' => $this->active_comment->getBody());
}
// if
$this->smarty->assign('comment_data', $comment_data);
//BOF:task_1260
$active_object = ProjectObjects::findById($this->active_comment->getParentId());
$this->smarty->assign('subscribers', $active_object->getSubscribers());
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
//$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "'";
$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "'";
$request = mysql_query($query);
$fyi_users = array();
$action_request_users = array();
while ($entry = mysql_fetch_array($request)) {
//BOF:mod 20130429
/*
//EOF:mod 20130429
if ($entry['is_action_request']=='1'){
//BOF:mod 20130429
*/
if (!empty($entry['is_action_request'])) {
//EOF:mod 20130429
$action_request_users[] = $entry['user_id'];
}
//BOF:mod 20130429
/*
//EOF:mod 20130429
if ($entry['is_fyi']=='1'){
$fyi_users[] = $entry['user_id'];
}
//BOF:mod 20130429
*/
//EOF:mod 20130429
}
$this->smarty->assign('fyi_users', $fyi_users);
$this->smarty->assign('action_request_users', $action_request_users);
$this->smarty->assign('logged_user', $this->logged_user);
//EOF:task_1260
if ($this->request->isSubmitted()) {
$this->active_comment->setAttributes($comment_data);
$save = $this->active_comment->save();
if ($save && !is_error($save)) {
//BOF:task_1260
//$subscribers_to_notify = array_var($comment_data, 'subscribers_to_notify');
$action_request_user_id = array_var($comment_data, 'action_request');
//mysql_query("update healingcrystals_assignments_action_request set is_action_request='0', is_fyi='0' where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and is_action_request<>'-1' and is_fyi<>'-1'");
//mysql_query("update healingcrystals_assignments_action_request set is_action_request='0', is_fyi='0' where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and is_action_request<>'-1' and is_fyi<>'-1'");
/*if (!empty($subscribers_to_notify)){
foreach ($subscribers_to_notify as $id){
$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and user_id='" . $id . "'";
$result = mysql_query($query);
if (mysql_num_rows($result)){
$query = "update healingcrystals_assignments_action_request set is_fyi='1' where comment_id='" . $this->active_comment->getId() . "' and selected_by_user_id='" . $this->logged_user->getId() . "' and user_id='" . $id . "'";
mysql_query($query);
} else {
$query = "insert into healingcrystals_assignments_action_request (user_id, is_action_request, is_fyi, selected_by_user_id, comment_id, date_added) values ('" . $id . "', '0', '1', '" . $this->logged_user->getId() . "', '" . $this->active_comment->getId() . "', now())";
mysql_query($query);
}
}
}*/
$existing_ar_users = array();
$new_ar_users = array();
if (!empty($action_request_user_id)) {
foreach ($action_request_user_id as $id) {
$query = "select * from healingcrystals_assignments_action_request where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$info = mysql_fetch_assoc($result);
if ($info['is_action_request'] == '1') {
$existing_ar_users[] = $id;
} else {
$query = "update healingcrystals_assignments_action_request set is_action_request='1' where comment_id='" . $this->active_comment->getId() . "' and user_id='" . $id . "'";
mysql_query($query);
//.........这里部分代码省略.........
示例9: sendTaskToWorker
/**
* Send task over RPC to worker
* Mark task as in progress nad worker as busy
* @param Task $task
* @param Worker $worker
* @return void
* @author Andraz <andraz.krascek@gmail.com>
*/
public function sendTaskToWorker(Task $task, Worker $worker)
{
$client = $this->newRpcClient($worker->getHost(), $worker->getport());
$parameters = [$worker->getId(), $task->getId(), $task->getParameters()];
$task->setStatus('in_progress');
$this->storage->saveTask($task);
$worker->setStatus('busy');
$this->storage->saveWorker($worker);
$success = $client->notify('run', $parameters);
if ($success) {
}
return $success;
}
示例10: testFind
function testFind()
{
//arrange
$description = "Wash the dog";
$id = 1;
$test_task = new Task($description, $id);
$test_task->save();
$description2 = "Water the lawn";
$id2 = 2;
$test_task2 = new Task($description2, $id);
$test_task2->save();
//act
$result = Task::find($test_task->getId());
//assert
$this->assertEquals($test_task, $result);
}
示例11: Task
die;
}
try {
if ($_POST['action'] == "new_task") {
if (isset($_POST['task-desc'])) {
if (empty(trim($_POST['task-desc']))) {
echo json_encode(array('status' => 'validation', 'reason' => 'Your task description is empty!'));
} else {
if (strlen($_POST['task-desc']) > 80) {
echo json_encode(array('status' => 'validation', 'reason' => 'Your task description is too long!'));
} else {
$task = new Task();
$task->setDescription($_POST['task-desc']);
$task->setTaskListId($_POST['id']);
$task->save();
echo json_encode(array('status' => 'success', 'task-id' => $task->getId()));
}
}
} else {
echo json_encode(array('status' => 'error', 'reason' => 'Task description not supplied.'));
}
} else {
if ($_POST['action'] == "new_list") {
if (isset($_POST['name'])) {
if (empty(trim($_POST['name']))) {
echo json_encode(array('status' => 'validation', 'reason' => 'Your task list name is empty!'));
die;
}
/*if (strlen($_POST['name']) > 32)
{
echo json_encode(array('status'=>'validation', 'reason' => 'Your task list name is too long!'));
示例12: changeTaskOwner
/**
* Function to change the Task Owner
* @param Integer $idcoworker
* @param Integer $idtask
*/
function changeTaskOwner($idcoworker, $idtask)
{
$do_task = new Task();
$do_task->getId($idtask);
$do_task->iduser = $idcoworker;
$do_task->status = 'open';
$do_task->update();
$qobj = $this->getProjectTaskDetailsByTaskId($idtask);
$this->sendEmailOnTaskOwnershipChange($idcoworker, $qobj);
//sending ownership change alert
}
示例13: system_handle_on_hourly
/**
* Do hourly tasks
*
* @param void
* @return null
*/
function system_handle_on_hourly()
{
$cache =& Cache::instance();
if (instance_of($cache->backend, 'CacheBackend')) {
$cache->backend->cleanup();
}
// if
//BOF:mod
$time_current = $time_end = time() - 4 * 60 * 60;
$time_start = $time_end - 60 * 60;
$comment = 'Auto Reminder';
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
//BOF:mod 20120816
/*
//EOF:mod 20120816
$query = "select distinct a.object_id from
healingcrystals_project_object_misc a
inner join healingcrystals_project_objects b on a.object_id=b.id where
b.type='Task' and
b.state='" . STATE_VISIBLE . "' and
(b.completed_on is null or b.completed_on='') and
a.reminder_date is not null and
a.reminder_date<>'0000-00-00' and
a.auto_email_status='1' and
((a.reminder_date between '" . date('Y-m-d H:i:s', $time_start) . "' and '" . date('Y-m-d H:i:s', $time_end) . "')
or (a.recurring_period_type = 'D' and recurring_period = '1' and recurring_period_condition = 'after_due_date' and (recurring_end_date > '".date('Y-m-d')."' or recurring_end_date = '0000-00-00') and date_format(a.reminder_date,'%H:%i:%s') between '" . date('H:i:s', $time_start) . "' and '" . date('H:i:s', $time_end) . "'))";
mysql_query("insert into testing (date_added, content) values (now(), '" . mysql_real_escape_string($query) . "')");
//BOF:mod 20120816
*/
/*
$query = "select distinct a.object_id, a.reminder_date from
healingcrystals_project_object_misc a
inner join healingcrystals_project_objects b on a.object_id=b.id where
b.type='Task' and
b.state='" . STATE_VISIBLE . "' and
(b.completed_on is null or b.completed_on='') and
a.reminder_date is not null and
a.reminder_date<>'0000-00-00' and
a.auto_email_status='1' and
((a.reminder_date between '" . date('Y-m-d H:i:s', $time_start) . "' and '" . date('Y-m-d H:i:s', $time_end) . "')
or (a.recurring_period_type = 'D' and recurring_period = '1' and recurring_period_condition = 'after_due_date' and (recurring_end_date > '".date('Y-m-d')."' or recurring_end_date = '0000-00-00') and date_format(a.reminder_date,'%H:%i:%s') between '" . date('H:i:s', $time_start) . "' and '" . date('H:i:s', $time_end) . "'))";
*/
$query = "select distinct \n\t\t\t\ta.object_id, \n\t\t\t\tcast(if(a.email_reminder_unit='D', \n\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period day), ' ', a.email_reminder_time), \n\t\t\t\t\tif(a.email_reminder_unit='W', \n\t\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period week), ' ', a.email_reminder_time), \n\t\t\t\t\t\tif(a.email_reminder_unit='M', \n\t\t\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period month), ' ', a.email_reminder_time), \n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t) as datetime) as reminder \n\t\t\t from \n\t\t\t\thealingcrystals_project_object_misc a \n\t\t\t\tinner join healingcrystals_project_objects b on a.object_id=b.id \n\t\t\t where \n\t\t\t\tb.type='Task' and \n\t\t\t\tb.state='" . STATE_VISIBLE . "' and \n\t\t\t\t(b.completed_on is null or b.completed_on='') and \n\t\t\t\ta.auto_email_status='1' and \n\t\t\t\ta.email_reminder_unit is not null and \n\t\t\t\tb.due_on is not null and \n\t\t\t\t(a.snooze_datetime is null or a.snooze_datetime='0000-00-00 00:00:00' or a.snooze_datetime<'" . date('Y-m-d H:i:s', $time_current) . "') and \n\t\t\t\tcast(if(a.email_reminder_unit='D', \n\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period day), ' ', a.email_reminder_time), \n\t\t\t\t\tif(a.email_reminder_unit='W', \n\t\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period week), ' ', a.email_reminder_time), \n\t\t\t\t\t\tif(a.email_reminder_unit='M', \n\t\t\t\t\t\t\tconcat(DATE_SUB(b.due_on, interval a.email_reminder_period month), ' ', a.email_reminder_time), \n\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t) as datetime) between '" . date('Y-m-d H:i:s', $time_start) . "' and '" . date('Y-m-d H:i:s', $time_end) . "'\n\t\t\t ";
//EOF:mod 20120816
$result = mysql_query($query, $link);
while ($entry = mysql_fetch_assoc($result)) {
$task_obj = new Task($entry['object_id']);
$parent = $task_obj->getParent();
$project = $task_obj->getProject();
$assignees = $task_obj->getAssignees();
//BOF:mod 20120816
$priorities = array(PRIORITY_HIGHEST => lang('Highest'), PRIORITY_HIGH => lang('High'), PRIORITY_NORMAL => lang('Normal'), PRIORITY_LOW => lang('Low'), PRIORITY_LOWEST => lang('Lowest'), PRIORITY_ONGOING => lang('Ongoing'), PRIORITY_HOLD => lang('Hold'));
$due_date = $task_obj->getDueOn();
if (!empty($due_date) && $due_date != '0000-00-00') {
$due_date = date('m/d/Y', strtotime($due_date));
} else {
$due_date = '--';
}
$reminder_date = $entry['reminder'];
//$reminder_date = $entry['reminder_date'];
if (!empty($reminder_date) && $reminder_date != '0000-00-00 00:00:00') {
$reminder_date = date('m/d/Y H:i', strtotime($reminder_date));
} else {
$reminder_date = '--';
}
foreach ($assignees as $assignee) {
$assignees_string .= $assignee->getDisplayName() . ', ';
}
if (!empty($assignees_string)) {
$assignees_string = substr($assignees_string, 0, -2);
} else {
$assignees_string = '--';
}
//EOF:mod 20120816
$reminders_sent = array();
foreach ($assignees as $user) {
//if ($user->getEmail()=='anuj@focusindia.com'){
$reminder = new Reminder();
$reminder->setAttributes(array('user_id' => $user->getId(), 'object_id' => $task_obj->getId(), 'comment' => $comment));
//$reminder->setCreatedBy($this->logged_user);
$save = $reminder->save();
if ($save && !is_error($save)) {
$reminders_sent[] = $user->getDisplayName();
ApplicationMailer::send($user, 'system/reminder', array('reminded_by_name' => 'AutoReminder', 'reminded_by_url' => '', 'object_name' => $task_obj->getName(), 'object_url' => $task_obj->getViewUrl(), 'object_type' => strtolower($task_obj->getType()), 'comment_body' => $comment, 'project_name' => $project->getName(), 'project_url' => $project->getOverviewUrl(), 'ticket_name' => $parent->getName(), 'ticket_url' => $parent->getViewUrl(), 'object_priority' => $priorities[(string) $task_obj->getPriority()], 'object_due_date' => $due_date, 'object_reminder_date_n_time' => $reminder_date, 'object_assignees' => $assignees_string, 'task_mark_complete_url' => $task_obj->getCompleteUrl() . '&auto=1', 'display_status_for_complete_url' => ''), $task_obj);
}
// if
//}
}
// foreach
}
mysql_close($link);
//EOF:mod
}
示例14: eventAddTaskToBoard
/**
* Creates a new Card in the Kanban Board.
* This method has all the parameters specifying the board, lane and position where you want to add the new card.
The request body contains the JSON for a new card. You must specify a valid TypeId that matches one of the Card Types
for your board. See GetBoardIdentifiers for a listing of valid Card Type Ids and Class Of Service Ids for your board.
* @param Object : EventControler
* @see LeanKitKanban->addCard
*/
public function eventAddTaskToBoard(EventControler $evtcl)
{
$msg = "";
$this->getUserLoginCredentials();
if ($this->getNumRows()) {
$username = $this->username;
$password = $this->password;
if ($evtcl->board) {
//This is the default Type used for adding a Card.
$card_type_id = $this->getCardTypeId($evtcl->board, "Task");
//This is the default Board User for adding a Card.
$assigned_user_id = $this->getBoardUserId($evtcl->board, $username);
//This is the default Lane used for adding a Card.
$lane_id = $this->getCardLaneId($evtcl->board, "backlog");
$task = new Task();
$task->getId($evtcl->ofuz_task_id);
// check for the first note for task description , if not found and task title as description
$proj_discuss = new ProjectDiscuss();
$desc = $proj_discuss->getFirstNote($evtcl->ofuz_idprojecttask);
if ($desc == '') {
$desc = $task->task_description;
}
if ($task->due_date_dateformat == "" || $task->due_date_dateformat == "0000-00-00") {
$due_date = "";
} else {
$due_date = $this->convertMysqlDateToMMDDYYY($task->due_date_dateformat, "/");
}
$array_card = array("Title" => $task->task_description, "Description" => $desc, "TypeId" => $card_type_id, "Priority" => 1, "Size" => "", "IsBlocked" => false, "BlockReason" => "", "DueDate" => $due_date, "ExternalSystemName" => "http://www.ofuz.net/Task/" . $evtcl->ofuz_idprojecttask, "ExternalSystemUrl" => "http://www.ofuz.net/Task/" . $evtcl->ofuz_idprojecttask, "Tags" => "", "ClassOfServiceId" => "", "ExternalCardID" => $evtcl->ofuz_idprojecttask, "AssignedUserIds" => array($assigned_user_id));
$leankitkanban = new LeanKitKanban($username, $password);
$response = $leankitkanban->addCard($array_card, $evtcl->board, $lane_id, 1);
if ($response->ReplyCode == '201') {
$msg .= "The Card is added.";
} else {
$msg .= $response->ReplyText;
}
} else {
$msg .= "You must select a Kanban Board to add this Task.";
}
} else {
$msg .= "You have not set up your LeanKit Kanban Login Credentials.";
}
$_SESSION["ofuz_kanban_message"] = $msg;
}
示例15: Task
function test_find()
{
//Arrange
$due_date = "2015-10-12";
$description = "Wash the dog";
$test_task = new Task($description, $due_date, 1);
$test_task->save();
$description2 = "Water the lawn";
$test_task2 = new Task($description2, $due_date, 2);
$test_task2->save();
//Act
$result = Task::find($test_task->getId());
//Assert
$this->assertEquals($test_task, $result);
}