Exemplo n.º 1
0
 /**
  * Notify people that listen to the status of the event
  */
 public function notify()
 {
     $dao = new SystemEventsFollowersDao(CodendiDataAccess::instance());
     $listeners = array();
     foreach ($dao->searchByType($this->getStatus()) as $row) {
         $listeners = array_merge($listeners, explode(',', $row['emails']));
     }
     if (count($listeners)) {
         $listeners = array_unique($listeners);
         $m = new Mail();
         $m->setFrom($GLOBALS['sys_noreply']);
         $m->setTo(implode(',', $listeners));
         $m->setSubject('[' . $this->getstatus() . '] ' . $this->getType());
         $m->setBody("\nEvent:        #{$this->getId()}\nType:         {$this->getType()}\nParameters:   {$this->verbalizeParameters(false)}\nPriority:     {$this->getPriority()}\nStatus:       {$this->getStatus()}\nLog:          {$this->getLog()}\nCreate Date:  {$this->getCreateDate()}\nProcess Date: {$this->getProcessDate()}\nEnd Date:     {$this->getEndDate()}\n---------------\n<" . get_server_url() . "/admin/system_events/>\n");
         $m->send();
     }
 }
Exemplo n.º 2
0
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Codendi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'pre.php';
require_once 'common/dao/SystemEventsFollowersDao.class.php';
require_once 'common/include/Toggler.class.php';
session_require(array('group' => '1', 'admin_flags' => 'A'));
$sefdao = new SystemEventsFollowersDao(CodendiDataAccess::instance());
$default_new_followers_email = 'Type logins, emails or mailing lists. Multiple values separated by coma.';
if ($new_followers = $request->get('new_followers')) {
    if (isset($new_followers['emails']) && $new_followers['emails'] && $new_followers['emails'] != $default_new_followers_email) {
        if (count($new_followers['types'])) {
            $sefdao->create($new_followers['emails'], implode(',', $new_followers['types']));
            $GLOBALS['Response']->redirect('/admin/system_events/');
        }
    }
}
if ($request->get('delete')) {
    $sefdao->delete($request->get('delete'));
    $GLOBALS['Response']->redirect('/admin/system_events/');
}
if ($request->get('cancel')) {
    $GLOBALS['Response']->redirect('/admin/system_events/');