示例#1
0
 if (is_array($attachment) && count($attachment) > 0) {
     $attachment_count = 0;
     foreach ($attachment as $attachment) {
         $attachment_count++;
         $do_project_discuss->addNew();
         $do_project_discuss->idproject_task = $do_project_task->idproject_task;
         $do_project_discuss->iduser = $do_user->iduser;
         //if($attachment_count == 1)
         $do_project_discuss->discuss = $parse_content;
         //else
         //  $do_project_discuss->discuss = 'Attachment';
         $do_project_discuss->document = $attachment['filename'];
         $do_project_discuss->date_added = date("Y-m-d");
         $do_project_discuss->hours_work = 0.0;
         $do_project_discuss->add();
         $idproject_discuss = $do_project_discuss->getPrimaryKeyValue();
         $do_workfeed = new WorkFeedProjectDiscuss();
         $do_workfeed->AddProjectDiscussFeedFromDropBox($do_project_task->idproject_task, $parse_content, $do_user->iduser, $idproject_discuss, $do_project_task->idproject);
     }
 } else {
     $do_project_discuss->addNew();
     $do_project_discuss->idproject_task = $do_project_task->idproject_task;
     $do_project_discuss->iduser = $do_user->iduser;
     $do_project_discuss->discuss = $parse_content;
     $do_project_discuss->hours_work = 0.0;
     $do_project_discuss->date_added = date("Y-m-d");
     $do_project_discuss->add();
     $idproject_discuss = $do_project_discuss->getPrimaryKeyValue();
     $do_workfeed = new WorkFeedProjectDiscuss();
     $do_workfeed->AddProjectDiscussFeedFromDropBox($do_project_task->idproject_task, $parse_content, $do_user->iduser, $idproject_discuss, $do_project_task->idproject);
     //$do_workfeed->free();
 /**
  * This method adds the Block/Unblock Reason (from Kanban Plugin) as Task Discussion note.
  * @param object : EventControler
  */
 public function eventAddReasonAsTaskNote(EventControler $evtcl)
 {
     $prefix_note = $evtcl->block_unblock_flag == "Block" ? "<b>Task Block </b>" : "<b>Task Unblock </b>";
     $do_pd = new ProjectDiscuss();
     $do_pd->idproject_task = $evtcl->ofuz_idprojecttask;
     $do_pd->discuss = $prefix_note . $evtcl->block_unblock_reason;
     $do_pd->date_added = date("Y-m-d");
     $do_pd->document = "";
     $do_pd->hours_work = "0.00";
     $do_pd->iduser = $_SESSION['do_User']->iduser;
     $do_pd->discuss_edit_access = 'user';
     $do_pd->type = 'Note';
     $do_pd->add();
     $evtcl->idproject_discuss = $do_pd->getPrimaryKeyValue();
     // Generating fields array for EventControler because the existing method ProjectDiscuss->eventSendDiscussMessageByEmail
     // uses it.
     $fields = array();
     $fields['document'] = "";
     $fields['discuss'] = $prefix_note . $evtcl->block_unblock_reason;
     $evtcl->fields = $fields;
 }