当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::manageModalAttachments方法代码示例

本文整理汇总了PHP中Ubirimi\Util::manageModalAttachments方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::manageModalAttachments方法的具体用法?PHP Util::manageModalAttachments怎么用?PHP Util::manageModalAttachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ubirimi\Util的用法示例。


在下文中一共展示了Util::manageModalAttachments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $loggedInUserId = $session->get('user/id');
     $issueId = $request->request->get('issue_id');
     $attachIdsToBeKept = $request->request->get('attach_ids');
     $comment = Util::cleanRegularInputField($request->request->get('comment'));
     if (!is_array($attachIdsToBeKept)) {
         $attachIdsToBeKept = array();
     }
     Util::manageModalAttachments($issueId, $session->get('user/id'), $attachIdsToBeKept);
     if (!empty($comment)) {
         $currentDate = Util::getServerCurrentDateTime();
         $this->getRepository(IssueComment::class)->add($issueId, $session->get('user/id'), $comment, $currentDate);
     }
     // send email notification
     $issueQueryParameters = array('issue_id' => $issueId);
     $issue = $this->getRepository(Issue::class)->getByParameters($issueQueryParameters, $loggedInUserId);
     $project = $this->getRepository(YongoProject::class)->getById($issue['issue_project_id']);
     $issueEventData = array('user_id' => $loggedInUserId, 'attachmentIds' => UbirimiContainer::get()['session']->get('added_attachments_in_screen'), 'comment' => $comment);
     $issueEvent = new IssueEvent($issue, $project, IssueEvent::STATUS_UPDATE, $issueEventData);
     UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_ADD_ATTACHMENT, $issueEvent);
     UbirimiContainer::get()['session']->remove('added_attachments_in_screen');
     return new Response('');
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:25,代码来源:SaveController.php

示例2: save

 public function save($project, $issueSystemFieldsData, $issueId, $timeTrackingDefaultUnit, $projectId, $issueCustomFieldsData, $attachIdsToBeKept, $clientSettings, $loggedInUserId, $clientId)
 {
     $currentDate = Util::getServerCurrentDateTime();
     $issueReturnValues = UbirimiContainer::get()['repository']->get(Issue::class)->add($project, $currentDate, $issueSystemFieldsData, $loggedInUserId, $issueId, $timeTrackingDefaultUnit);
     $newIssueId = $issueReturnValues[0];
     $newIssueNumber = $issueReturnValues[1];
     // update last issue number for this project
     UbirimiContainer::get()['repository']->get(YongoProject::class)->updateLastIssueNumber($projectId, $newIssueNumber);
     // if a parent is set check if the parent issue id is part of a sprint. if yes also add the child
     if ($issueId) {
         $sprints = UbirimiContainer::get()['repository']->get(Sprint::class)->getByIssueId($clientId, $issueId);
         while ($sprints && ($sprint = $sprints->fetch_array(MYSQLI_ASSOC))) {
             UbirimiContainer::get()['repository']->get(Sprint::class)->addIssues($sprint['id'], array($newIssueId), $loggedInUserId);
         }
     }
     // check if on the modal there is a comment field
     if (array_key_exists(Field::FIELD_COMMENT_CODE, $issueSystemFieldsData)) {
         $comment = Util::cleanRegularInputField($issueSystemFieldsData[Field::FIELD_COMMENT_CODE]);
         if (!empty($comment)) {
             UbirimiContainer::get()['repository']->get(IssueComment::class)->add($newIssueId, $loggedInUserId, $comment, $currentDate);
         }
     }
     // save custom fields
     if (count($issueCustomFieldsData)) {
         UbirimiContainer::get()['repository']->get(CustomField::class)->saveCustomFieldsData($newIssueId, $issueCustomFieldsData, $currentDate);
     }
     if (isset($issueSystemFieldsData['component'])) {
         UbirimiContainer::get()['repository']->get(Issue::class)->addComponentVersion($newIssueId, $issueSystemFieldsData['component'], 'issue_component');
     }
     if (isset($issueSystemFieldsData['affects_version'])) {
         UbirimiContainer::get()['repository']->get(Issue::class)->addComponentVersion($newIssueId, $issueSystemFieldsData['affects_version'], 'issue_version', Issue::ISSUE_AFFECTED_VERSION_FLAG);
     }
     if (isset($issueSystemFieldsData['fix_version'])) {
         UbirimiContainer::get()['repository']->get(Issue::class)->addComponentVersion($newIssueId, $issueSystemFieldsData['fix_version'], 'issue_version', Issue::ISSUE_FIX_VERSION_FLAG);
     }
     Util::manageModalAttachments($newIssueId, $loggedInUserId, $attachIdsToBeKept);
     UbirimiContainer::get()['session']->remove('added_attachments_in_screen');
     $issue = UbirimiContainer::get()['repository']->get(Issue::class)->getById($newIssueId);
     // add the current logged in user to the list of watchers
     UbirimiContainer::get()['repository']->get(Watcher::class)->add($newIssueId, $loggedInUserId, $currentDate);
     // add sla information for this issue
     UbirimiContainer::get()['repository']->get(Issue::class)->addPlainSLAData($newIssueId, $projectId);
     return $issue;
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:44,代码来源:IssueService.php

示例3: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $issueId = $request->get('issue_id');
     $fieldTypes = $request->get('field_types');
     $fieldValues = $request->get('field_values');
     $loggedInUserId = $session->get('user/id');
     $fieldTypesCustom = $request->get('field_types_custom');
     $fieldValuesCustom = $request->get('field_values_custom');
     // todo: de ce este aceasta variabila nefolosita
     $attachIds = $request->get('attach_ids');
     $attachIdsToBeKept = $request->get('attach_ids');
     if (!is_array($attachIdsToBeKept)) {
         $attachIdsToBeKept = array();
     }
     $oldIssueData = $this->getRepository(Issue::class)->getByParameters(array('issue_id' => $issueId), $loggedInUserId);
     $newIssueData = array();
     $newIssueData['issue_project_id'] = $oldIssueData['issue_project_id'];
     $newIssueCustomFieldsData = array();
     for ($i = 0; $i < count($fieldTypes); $i++) {
         if ($fieldValues[$i] != 'null' && $fieldValues[$i] != '') {
             if ($fieldTypes[$i] == Field::FIELD_DUE_DATE_CODE) {
                 $fieldValues[$i] = \DateTime::createFromFormat('Y-m-d', $fieldValues[$i])->format('Y-m-d');
             }
             $newIssueData[$fieldTypes[$i]] = $fieldValues[$i];
         } else {
             $newIssueData[$fieldTypes[$i]] = null;
         }
     }
     if ($fieldTypesCustom) {
         for ($i = 0; $i < count($fieldTypesCustom); $i++) {
             if ($fieldValuesCustom[$i] != 'null' && $fieldValuesCustom[$i] != '') {
                 $newIssueCustomFieldsData[$fieldTypesCustom[$i]] = $fieldValuesCustom[$i];
             } else {
                 $newIssueCustomFieldsData[$fieldTypesCustom[$i]] = null;
             }
         }
     }
     if (array_key_exists(Field::FIELD_ASSIGNEE_CODE, $newIssueData)) {
         // assignee field is placed on screen
         if ($newIssueData[Field::FIELD_ASSIGNEE_CODE] == -1) {
             $newIssueData[Field::FIELD_ASSIGNEE_CODE] = null;
         }
     }
     if (!isset($newIssueData[Field::FIELD_STATUS_CODE])) {
         $newIssueData[Field::FIELD_STATUS_CODE] = $oldIssueData[Field::FIELD_STATUS_CODE];
     }
     $currentDate = Util::getServerCurrentDateTime();
     $this->getRepository(Issue::class)->updateById($issueId, $newIssueData, $currentDate);
     $oldIssueCustomFieldsData = array();
     foreach ($newIssueCustomFieldsData as $key => $value) {
         $keyData = explode("_", $key);
         $oldIssueCustomFieldsData[$keyData[0]] = $this->getRepository(CustomField::class)->getCustomFieldsDataByFieldId($issueId, $key);
         unset($newIssueCustomFieldsData[$key]);
         $newIssueCustomFieldsData[$keyData[0]] = $value;
     }
     $fieldChanges = $this->getRepository(Issue::class)->computeDifference($oldIssueData, $newIssueData, $oldIssueCustomFieldsData, $newIssueCustomFieldsData);
     $this->getRepository(Issue::class)->updateHistory($issueId, $loggedInUserId, $fieldChanges, $currentDate);
     // check if on the modal there is a comment field
     if (array_key_exists(Field::FIELD_COMMENT_CODE, $newIssueData) && !empty($newIssueData[Field::FIELD_COMMENT_CODE])) {
         $this->getRepository(IssueComment::class)->add($issueId, $loggedInUserId, $newIssueData[Field::FIELD_COMMENT_CODE], $currentDate);
     }
     // update the custom fields value
     if ($fieldTypesCustom) {
         $this->getRepository(CustomField::class)->updateCustomFieldsData($issueId, $newIssueCustomFieldsData, $currentDate);
     }
     Util::manageModalAttachments($issueId, $loggedInUserId, $attachIdsToBeKept);
     UbirimiContainer::get()['session']->remove('added_attachments_in_screen');
     $issueEvent = new IssueEvent(null, null, IssueEvent::STATUS_UPDATE, array('oldIssueData' => $oldIssueData, 'fieldChanges' => $fieldChanges));
     $this->getLogger()->addInfo('UPDATE Yongo issue ' . $oldIssueData['project_code'] . '-' . $oldIssueData['nr'], $this->getLoggerContext());
     UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_EMAIL, $issueEvent);
     return new Response('');
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:73,代码来源:EditController.php


注:本文中的Ubirimi\Util::manageModalAttachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。