/** * 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; }