public function updateArtifacts(PFUser $user, Codendi_Request $request)
 {
     if ($this->tracker->userIsAdmin($user)) {
         $masschange_aids = $request->get('masschange_aids');
         if (empty($masschange_aids)) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_masschange_detail', 'no_items_selected'));
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
         }
         $unsubscribe = $request->get('masschange-unsubscribe-option');
         if ($unsubscribe) {
             $this->unsubscribeUserFromEachArtifactNotification($user, $request, $masschange_aids);
         }
         $send_notifications = $this->getSendNotificationsFromRequest($request);
         $masschange_data = $request->get('artifact');
         if (!$unsubscribe && empty($masschange_data)) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_masschange_detail', 'no_items_selected'));
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
         }
         $comment = $request->get('artifact_masschange_followup_comment');
         $masschange_values_extractor = new Tracker_MasschangeDataValueExtractor();
         $new_fields_data = $masschange_values_extractor->getNewValues($masschange_data);
         if (count($new_fields_data) > 0 || $comment !== '') {
             $comment_format = $request->get('comment_formatmass_change');
             $this->tracker->updateArtifactsMasschange($user, $masschange_aids, $new_fields_data, $comment, $send_notifications, $comment_format);
         }
         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
     } else {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker_report->getId());
     }
 }
Пример #2
0
 public function fetch()
 {
     $report_can_be_modified = false;
     $html = '';
     $html .= $this->report->fetchDisplayQuery($this->criteria, $report_can_be_modified);
     $html .= $this->fetchResults();
     return $html;
 }
Пример #3
0
 protected function getReport(PFUser $user, Project $project)
 {
     $name = $GLOBALS['Language']->getText('plugin_tracker_homenav', 'search');
     $is_query_displayed = Toggler::shouldBeDisplayed($user, 'tracker_report_query_0', true);
     $report_id = $description = $current_renderer_id = $parent_report_id = $user_id = $is_default = $tracker_id = $updated_by = $updated_at = 0;
     $report = new Tracker_Report($report_id, $name, $description, $current_renderer_id, $parent_report_id, $user_id, $is_default, $tracker_id, $is_query_displayed, $updated_by, $updated_at);
     $report->setProjectId($project->getID());
     return $report;
 }
Пример #4
0
 /**
  * @return \Tracker_Report
  */
 public function build()
 {
     $tracker_id = $description = $current_renderer_id = $parent_report_id = $user_id = $is_default = $is_query_displayed = $updated_by = $updated_at = null;
     $report = new Tracker_Report($this->id, $this->name, $description, $current_renderer_id, $parent_report_id, $user_id, $is_default, $tracker_id, $is_query_displayed, $updated_by, $updated_at);
     if ($this->tracker) {
         $report->setTracker($this->tracker);
     }
     return $report;
 }
Пример #5
0
 public function fetch()
 {
     $report_can_be_modified = false;
     $additional_criteria = array();
     $html = '';
     $html .= $this->report->fetchDisplayQuery($this->criteria, $additional_criteria, $report_can_be_modified, $this->user);
     $html .= $this->fetchResults();
     return $html;
 }
Пример #6
0
 public function itExportsToSoap()
 {
     $report_id = 1;
     $name = 'the report';
     $description = 'the description';
     $current_renderer_id = null;
     $parent_report_id = null;
     $user_id = null;
     $is_default = true;
     $tracker_id = 115;
     $is_query_displayed = true;
     $updated_by = null;
     $updated_at = null;
     $report = new Tracker_Report($report_id, $name, $description, $current_renderer_id, $parent_report_id, $user_id, $is_default, $tracker_id, $is_query_displayed, $updated_by, $updated_at);
     $this->assertEqual($report->exportToSoap(), array('id' => $report_id, 'name' => $name, 'description' => $description, 'user_id' => $user_id, 'is_default' => $is_default));
 }
 public function __construct(PFUser $current_user, Tracker $tracker, PermissionsManager $permissions_manager, Tracker_ReportDao $dao, Tracker_FormElementFactory $formelement_factory)
 {
     $id = $name = $description = $current_renderer_id = $parent_report_id = $user_id = $is_default = $tracker_id = $is_query_displayed = $updated_by = $updated_at = 0;
     parent::__construct($id, $name, $description, $current_renderer_id, $parent_report_id, $user_id, $is_default, $tracker_id, $is_query_displayed, $updated_by, $updated_at);
     $this->current_user = $current_user;
     $this->tracker = $tracker;
     $this->permissions_manager = $permissions_manager;
     $this->dao = $dao;
     $this->formelement_factory = $formelement_factory;
     $this->criteria = array();
 }
 /**
  * @param array the row identifing a report
  * @return Tracker_Report
  */
 protected function getInstanceFromRow($row, $store_in_session = true)
 {
     $r = new Tracker_Report($row['id'], $row['name'], $row['description'], $row['current_renderer_id'], $row['parent_report_id'], $row['user_id'], $row['is_default'], $row['tracker_id'], $row['is_query_displayed'], $row['updated_by'], $row['updated_at']);
     if ($store_in_session) {
         $r->registerInSession();
     }
     return $r;
 }
Пример #9
0
 public function itHasATableRenderer()
 {
     $renderers = $this->tasks_report->getRenderers();
     $this->assertCount($renderers, 1);
     $renderer = array_shift($renderers);
     $this->assertIsA($renderer, 'Tracker_Report_Renderer_Table');
     $columns = $renderer->getTableColumns(false, true, false);
     $this->thereAreColumnsForFields($columns, array('Artifact ID', 'Assigned to (multiple)', 'Subproject', 'Effort', 'Status', 'Start Date', 'Summary'));
 }
 private function getAugmentedFieldValue($artifact_id, Tracker_Report $report)
 {
     $result = '';
     EventManager::instance()->processEvent(TRACKER_EVENT_FIELD_AUGMENT_DATA_FOR_REPORT, array('additional_criteria' => $report->getAdditionalCriteria(), 'result' => &$result, 'artifact_id' => $artifact_id, 'field' => $this));
     return $result;
 }
 private function displayHeaderInArtifactLinkModal(Tracker_IFetchTrackerSwitcher $layout, Codendi_Request $request, PFUser $current_user, Tracker_Report $report, array $reports, $link_artifact_id)
 {
     $project = null;
     $artifact = Tracker_ArtifactFactory::instance()->getArtifactByid($link_artifact_id);
     if ($artifact) {
         $project = $artifact->getTracker()->getProject();
     }
     $this->renderer->renderToPage('header_in_artifact_link_modal', new Tracker_Report_HeaderInArtifactLinkModalPresenter($GLOBALS['Language']->getText('plugin_tracker_report', 'current_report'), $layout->fetchTrackerSwitcher($current_user, '<br />', $project, $report->getTracker()), $this->getSelectReportUrl($request, $report), $this->getReportSelector($report, $reports)));
 }