コード例 #1
0
ファイル: Tracker.class.php プロジェクト: nterray/tuleap
 /**
  * Get a recipients list for (global) notifications.
  *
  * @return array
  */
 public function getRecipients()
 {
     $recipients = array();
     $nm = new Tracker_NotificationsManager($this);
     $notifs = $nm->getGlobalNotifications();
     foreach ($notifs as $id => $notif) {
         $recipients[$id] = array('recipients' => $notif->getAddresses(true), 'on_updates' => $notif->isAllUpdates(), 'check_permissions' => $notif->isCheckPermissions());
     }
     return $recipients;
 }
コード例 #2
0
 function updateArtifact($row, $data, $aid, &$errors, $notify = false)
 {
     global $Language;
     $ah = new Tracker_Html($this->ath, $aid);
     if (!$ah || !is_object($ah)) {
         exit_error($Language->getText('global', 'error'), $Language->getText('plugin_tracker_index', 'not_create_art'));
     } else {
         if ($ah->isError()) {
             exit_error($Language->getText('global', 'error'), $ah->getErrorMessage());
         } else {
             // Check if users can update anonymously
             if (!user_isloggedin() && !$this->ath->allowsAnon()) {
                 exit_not_logged_in();
             }
             if (!$ah->Tracker->userIsAdmin()) {
                 exit_permission_denied();
                 return;
             }
             $vfl = $this->prepareVfl($data, $artifact_depend_id, $add_cc, $cc_comment, $comments);
             //data control layer
             if (!$ah->handleUpdate($artifact_depend_id, 100, $changes, false, $vfl, true)) {
                 exit_error($Language->getText('global', 'error'), '');
             }
             if ($add_cc) {
                 if (!$ah->updateCC($add_cc, $cc_comment)) {
                     $errors .= $Language->getText('plugin_tracker_import_utils', 'problem_add_cc', $ah->getID()) . " ";
                 }
             }
             $comments_ok = false;
             if ($comments) {
                 if ($this->parseFollowUpComments($comments, $parsed_comments, $aid) && $parsed_comments && !empty($parsed_comments)) {
                     $comments_ok = true;
                     if (!$ah->addFollowUpComments($parsed_comments)) {
                         $errors .= $Language->getText('plugin_tracker_import_utils', 'problem_insert_followup', $ah->getID()) . " ";
                         $comments_ok = false;
                         return false;
                     }
                 } else {
                     return false;
                 }
             }
             if ($notify && (count($changes) > 0 || $add_cc || $comments_ok)) {
                 $agnf = new Tracker_NotificationsManager($this->ath);
                 $ah->mailFollowupWithPermissions($agnf->getAllAddresses($this->ath->getID(), $update = true), $changes);
             }
             if (count($changes) > 0 || $add_cc || $comments_ok) {
                 // Update the 'last_update_date' artifact field
                 $res_last_up = $ah->update_last_update_date();
             }
         }
     }
     return true;
 }