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


PHP System::getEmailConfiguration方法代码示例

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


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

示例1: AppDocument

     //require_once 'classes/model/AppDocument.php';
     $oAppDocument = new AppDocument();
     $oAppDocument->remove($_POST['DOC']);
     $oCase = new Cases();
     $oCase->getAllGeneratedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']);
     break;
     /* @Author Erik Amaru Ortiz <erik@colosa.com> */
 /* @Author Erik Amaru Ortiz <erik@colosa.com> */
 case 'resendMessage':
     //require_once 'classes/model/Configuration.php';
     G::LoadClass('spool');
     $oCase = new Cases();
     $data = $oCase->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID']);
     //print_r($data);
     G::LoadClass("system");
     $aSetup = System::getEmailConfiguration();
     $passwd = $aSetup['MESS_PASSWORD'];
     $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
     $auxPass = explode('hash:', $passwdDec);
     if (count($auxPass) > 1) {
         if (count($auxPass) == 2) {
             $passwd = $auxPass[1];
         } else {
             array_shift($auxPass);
             $passwd = implode('', $auxPass);
         }
     }
     $aSetup['MESS_PASSWORD'] = $passwd;
     if ($aSetup['MESS_RAUTH'] == false || is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false') {
         $aSetup['MESS_RAUTH'] = 0;
     } else {
开发者ID:bqevin,项目名称:processmaker,代码行数:31,代码来源:cases_Ajax.php

示例2: sendNotifications

    public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")

    {

        try {

            $applicationData = $this->loadCase($sApplicationUID);

            $aFields["APP_NUMBER"] = $applicationData["APP_NUMBER"];



            if (!class_exists('System')) {

                G::LoadClass('system');

            }

            $aConfiguration = System::getEmailConfiguration();



            $msgError = "";

            if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {

                $msgError = "The default configuration wasn't defined";

                $aConfiguration['MESS_ENGINE'] = '';

            }



            //Send derivation notification - Start

            $oTask = new Task();

            $aTaskInfo = $oTask->load($sCurrentTask);



            if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {

                return false;

            }



            $sFrom = G::buildFrom($aConfiguration, $sFrom);



            if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {

                $sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $aFields);

            } else {

                $sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');

            }



            //erik: new behaviour for messages

            G::loadClass('configuration');

            $oConf = new Configurations;

            $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');

            $conf = $oConf->aConfig;



            $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;

            $swtplDefault = 0;

            $sBody = null;



            if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) &&

                    isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) &&

                    $conf["TAS_DEF_MESSAGE_TYPE"] == "template" &&

                    $conf["TAS_DEF_MESSAGE_TEMPLATE"] != ""

            ) {

                if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {

                    $swtplDefault = 1;

//.........这里部分代码省略.........
开发者ID:nhenderson,项目名称:processmaker,代码行数:101,代码来源:class.case.php

示例3: sendMessage

    /**

     * send message

     *

     * @param string $caseId

     * @param string $sFrom

     * @param string $sTo

     * @param string $sCc

     * @param string $sBcc

     * @param string $sSubject

     * @param string $sTemplate

     * @param $appFields = null

     * @param $aAttachment = null

     * @param boolean $showMessage = true

     * @param int $delIndex = 0

     * @param $config = array

     * @return $result will return an object

     */

    public function sendMessage(

        $caseId,

        $sFrom,

        $sTo,

        $sCc,

        $sBcc,

        $sSubject,

        $sTemplate,

        $appFields = null,

        $aAttachment = null,

        $showMessage = true,

        $delIndex = 0,

        $config = array()

    ) {

        try {

            if (!class_exists('System')) {

                G::LoadClass('system');

            }



            /*----------------------------------********---------------------------------*/

                $aSetup = System::getEmailConfiguration();

            /*----------------------------------********---------------------------------*/



            $msgError = "";

            if(sizeof($aSetup) == 0){

               $msgError = "The default configuration wasn't defined";

            }



            $oSpool = new spoolRun();



            $oSpool->setConfig($aSetup);



            $oCase = new Cases();

//.........这里部分代码省略.........
开发者ID:nhenderson,项目名称:processmaker,代码行数:101,代码来源:class.wsBase.php

示例4: upgradeDatabase

    /**

     * Upgrade this workspace database to the latest system schema

     *

     * @param bool $checkOnly only check if the upgrade is needed if true

     * @return array bool upgradeSchema for more information

     */

    public function upgradeDatabase ($onedb = false, $checkOnly = false)

    {

        G::LoadClass("patch");

        $this->initPropel( true );

        p11835::$dbAdapter = $this->dbAdapter;

        p11835::isApplicable();

        $systemSchema = System::getSystemSchema($this->dbAdapter);

        $systemSchemaRbac = System::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema

        $this->upgradeSchema( $systemSchema );

        $this->upgradeSchema( $systemSchemaRbac, false, true, $onedb ); // perform Upgrade to Rbac

        $this->upgradeData();



        //There records in table "EMAIL_SERVER"

        $criteria = new Criteria("workflow");



        $criteria->addSelectColumn(EmailServerPeer::MESS_UID);

        $criteria->setOffset(0);

        $criteria->setLimit(1);



        $rsCriteria = EmailServerPeer::doSelectRS($criteria);



        if (!$rsCriteria->next()) {

            //Insert the first record

            $arrayData = array();



            $emailSever = new \ProcessMaker\BusinessModel\EmailServer();



            $emailConfiguration = System::getEmailConfiguration();



            if (!empty($emailConfiguration)) {

                $arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];



                switch ($emailConfiguration["MESS_ENGINE"]) {

                    case "PHPMAILER":

                        $arrayData["MESS_SERVER"]              = $emailConfiguration["MESS_SERVER"];

                        $arrayData["MESS_PORT"]                = (int)($emailConfiguration["MESS_PORT"]);

                        $arrayData["MESS_RAUTH"]               = (is_numeric($emailConfiguration["MESS_RAUTH"]))? (int)($emailConfiguration["MESS_RAUTH"]) : (($emailConfiguration["MESS_RAUTH"] . "" == "true")? 1 : 0);

                        $arrayData["MESS_ACCOUNT"]             = $emailConfiguration["MESS_ACCOUNT"];

                        $arrayData["MESS_PASSWORD"]            = $emailConfiguration["MESS_PASSWORD"];

                        $arrayData["MESS_FROM_MAIL"]           = (isset($emailConfiguration["MESS_FROM_MAIL"]))? $emailConfiguration["MESS_FROM_MAIL"] : "";

                        $arrayData["MESS_FROM_NAME"]           = (isset($emailConfiguration["MESS_FROM_NAME"]))? $emailConfiguration["MESS_FROM_NAME"] : "";

                        $arrayData["SMTPSECURE"]               = $emailConfiguration["SMTPSecure"];

                        $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (isset($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]) && ($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "true" || $emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "1"))? 1 : 0;

                        $arrayData["MAIL_TO"]                  = isset($emailConfiguration["MAIL_TO"]) ? $emailConfiguration["MAIL_TO"] : '';

//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:class.wsTools.php

示例5: resendEmails

    /**
     * try resend the emails from spool
     *
     * @param string $dateResend
     * @return none or exception
     */
    public function resendEmails ($dateResend = null, $cron = 0)
    {
        if (!class_exists('System')) {
            G::LoadClass('system');
        }
        $aConfiguration = System::getEmailConfiguration();

        if (!isset($aConfiguration["MESS_ENABLED"])) {
            $aConfiguration["MESS_ENABLED"] = '0';
        }

        if ($aConfiguration["MESS_ENABLED"] == "1") {
            require_once ("classes/model/AppMessage.php");

            $this->setConfig($aConfiguration);

            $criteria = new Criteria( "workflow" );
            $criteria->add( AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL );

            if ($dateResend != null) {
                $criteria->add( AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL );
            }

            $rsCriteria = AppMessagePeer::doSelectRS( $criteria );
            $rsCriteria->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            while ($rsCriteria->next()) {
                if ($cron == 1) {
                    $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
                    $arrayCron["processcTimeStart"] = time();
                    @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
                }

                $row = $rsCriteria->getRow();

                try {
                    $sFrom = G::buildFrom($aConfiguration, $row["APP_MSG_FROM"]);

                    $this->setData( $row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date( "Y-m-d H:i:s" ), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"] );

                    $this->sendMail();
                } catch (Exception $e) {
                    $strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage();

                    if ($e->getCode() == $this->ExceptionCode["WARNING"]) {
                        array_push( $this->aWarnings, $strAux );
                        continue;
                    } else {
                        throw $e;
                    }
                }
            }
        }
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:60,代码来源:class.spool.php

示例6: getEmailConfiguration

function getEmailConfiguration()
{
    G::loadClass('system');
    return System::getEmailConfiguration();
}
开发者ID:ralpheav,项目名称:processmaker,代码行数:5,代码来源:class.pmFunctions.php

示例7: sendMessage

 /**
  * send message
  *
  * @param string $caseId
  * @param string $sFrom
  * @param string $sTo
  * @param string $sCc
  * @param string $sBcc
  * @param string $sSubject
  * @param string $sTemplate
  * @param $appFields = null
  * @param $aAttachment = null
  * @param boolean $showMessage = true
  * @param int $delIndex = 0
  * @return $result will return an object
  */
 public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true, $delIndex = 0)
 {
     try {
         G::LoadClass("system");
         $aSetup = System::getEmailConfiguration();
         $passwd = $aSetup['MESS_PASSWORD'];
         $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
         $auxPass = explode('hash:', $passwdDec);
         if (count($auxPass) > 1) {
             if (count($auxPass) == 2) {
                 $passwd = $auxPass[1];
             } else {
                 array_shift($auxPass);
                 $passwd = implode('', $auxPass);
             }
         }
         $aSetup['MESS_PASSWORD'] = $passwd;
         if ($aSetup['MESS_RAUTH'] == false || is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false') {
             $aSetup['MESS_RAUTH'] = 0;
         } else {
             $aSetup['MESS_RAUTH'] = 1;
         }
         $oSpool = new spoolRun();
         $oSpool->setConfig(array('MESS_ENGINE' => $aSetup['MESS_ENGINE'], 'MESS_SERVER' => $aSetup['MESS_SERVER'], 'MESS_PORT' => $aSetup['MESS_PORT'], 'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'], 'SMTPSecure' => $aSetup['SMTPSecure'], 'SMTPAuth' => $aSetup['MESS_RAUTH']));
         $oCase = new Cases();
         $oldFields = $oCase->loadCase($caseId);
         $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
         $fileTemplate = $pathEmail . $sTemplate;
         G::mk_dir($pathEmail, 0777, true);
         if (!file_exists($fileTemplate)) {
             $data['FILE_TEMPLATE'] = $fileTemplate;
             $result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
             return $result;
         }
         if ($appFields == null) {
             $Fields = $oldFields['APP_DATA'];
         } else {
             $Fields = array_merge($oldFields['APP_DATA'], $appFields);
         }
         $sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields);
         $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
         if (!$hasEmailFrom || strpos($sFrom, $aSetup['MESS_ACCOUNT']) === false) {
             $sFrom = '"' . stripslashes($sFrom) . '" <' . $aSetup['MESS_ACCOUNT'] . ">";
         }
         $showMessage = $showMessage ? 1 : 0;
         $messageArray = array("msg_uid" => "", "app_uid" => $caseId, "del_index" => $delIndex, "app_msg_type" => "TRIGGER", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $sTo, "app_msg_body" => $sBody, "app_msg_cc" => $sCc, "app_msg_bcc" => $sBcc, "app_msg_attach" => $aAttachment, "app_msg_template" => "", "app_msg_status" => "pending", "app_msg_show_message" => $showMessage, "contentTypeIsHtml" => preg_match("/^.+\\.html?\$/i", $fileTemplate) ? true : false);
         $oSpool->create($messageArray);
         $oSpool->sendMail();
         if ($oSpool->status == 'sent') {
             $result = new wsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $sTo);
         } else {
             $result = new wsResponse(29, $oSpool->status . ' ' . $oSpool->error . print_r($aSetup, 1));
         }
         return $result;
     } catch (Exception $e) {
         return new wsResponse(100, $e->getMessage());
     }
 }
开发者ID:ralpheav,项目名称:processmaker,代码行数:74,代码来源:class.wsBase.php

示例8: sendNoteNotification

 public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
 {
     try {
         if (!class_exists('System')) {
             G::LoadClass('system');
         }
         $aConfiguration = System::getEmailConfiguration();
         if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
             return false;
         }
         $oUser = new Users();
         $aUser = $oUser->load($usrUid);
         $authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
         G::LoadClass('case');
         $oCase = new Cases();
         $aFields = $oCase->loadCase($appUid);
         $configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE ";
         $configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}";
         $sFrom = G::buildFrom($aConfiguration, $sFrom);
         $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields);
         $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields));
         G::LoadClass('spool');
         $oUser = new Users();
         $recipientsArray = explode(",", $noteRecipients);
         foreach ($recipientsArray as $recipientUid) {
             $aUser = $oUser->load($recipientUid);
             $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
             $oSpool = new spoolRun();
             $oSpool->setConfig($aConfiguration);
             $oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 0, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending'));
             if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') {
                 $oSpool->sendMail();
             }
         }
         //Send derivation notification - End
     } catch (Exception $oException) {
         throw $oException;
     }
 }
开发者ID:norahmollo,项目名称:processmaker,代码行数:39,代码来源:AppNotes.php

示例9: sendMessage

 /**
  * send message
  * @param string $caseId
  * @param string $sFrom
  * @param string $sTo
  * @param string $sCc
  * @param string $sBcc
  * @param string $sSubject
  * @param string $sTemplate
  * @param $appFields = null
  * @return $result will return an object
  */
 public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null)
 {
     try {
         G::loadClass('system');
         $aSetup = System::getEmailConfiguration();
         $passwd = $aSetup['MESS_PASSWORD'];
         $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
         if (strpos($passwdDec, 'hash:') !== false) {
             list($hash, $pass) = explode(":", $passwdDec);
             $arrayFrom['MESS_PASSWORD'] = $pass;
         }
         $oSpool = new spoolRun();
         $oSpool->setConfig(array('MESS_ENGINE' => $aSetup['MESS_ENGINE'], 'MESS_SERVER' => $aSetup['MESS_SERVER'], 'MESS_PORT' => $aSetup['MESS_PORT'], 'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'], 'SMTPAuth' => $aSetup['MESS_RAUTH']));
         $oCase = new Cases();
         $oldFields = $oCase->loadCase($caseId);
         $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
         $fileTemplate = $pathEmail . $sTemplate;
         G::mk_dir($pathEmail, 0777, true);
         if (!file_exists($fileTemplate)) {
             $data['FILE_TEMPLATE'] = $fileTemplate;
             $result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
             return $result;
         }
         if ($appFields == null) {
             $Fields = $oldFields['APP_DATA'];
         } else {
             $Fields = array_merge($oldFields['APP_DATA'], $appFields);
         }
         $templateContents = file_get_contents($fileTemplate);
         //$sContent    = G::unhtmlentities($sContent);
         $iAux = 0;
         $iOcurrences = preg_match_all('/\\@(?:([\\>])([a-zA-Z\\_]\\w*)|([a-zA-Z\\_][\\w\\-\\>\\:]*)\\(((?:[^\\\\\\)]*(?:[\\\\][\\w\\W])?)*)\\))((?:\\s*\\[[\'"]?\\w+[\'"]?\\])+)?/', $templateContents, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
         if ($iOcurrences) {
             for ($i = 0; $i < $iOcurrences; $i++) {
                 preg_match_all('/@>' . $aMatch[2][$i][0] . '([\\w\\W]*)' . '@<' . $aMatch[2][$i][0] . '/', $templateContents, $aMatch2, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
                 $sGridName = $aMatch[2][$i][0];
                 $sStringToRepeat = $aMatch2[1][0][0];
                 if (isset($Fields[$sGridName])) {
                     if (is_array($Fields[$sGridName])) {
                         $sAux = '';
                         foreach ($Fields[$sGridName] as $aRow) {
                             $sAux .= G::replaceDataField($sStringToRepeat, $aRow);
                         }
                     }
                 }
                 $templateContents = str_replace('@>' . $sGridName . $sStringToRepeat . '@<' . $sGridName, $sAux, $templateContents);
             }
         }
         $sBody = G::replaceDataField($templateContents, $Fields);
         $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
         if (!$hasEmailFrom) {
             $sFrom = $aSetup['MESS_ACCOUNT'];
         }
         $messageArray = array('msg_uid' => '', 'app_uid' => $caseId, 'del_index' => 0, 'app_msg_type' => 'TRIGGER', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => $sCc, 'app_msg_bcc' => $sBcc, 'app_msg_attach' => $aAttachment, 'app_msg_template' => '', 'app_msg_status' => 'pending');
         $oSpool->create($messageArray);
         $oSpool->sendMail();
         if ($oSpool->status == 'sent') {
             $result = new wsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $sTo);
         } else {
             $result = new wsResponse(29, $oSpool->status . ' ' . $oSpool->error . print_r($aSetup, 1));
         }
         return $result;
     } catch (Exception $e) {
         return new wsResponse(100, $e->getMessage());
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:78,代码来源:class.wsBase.php

示例10: sendNotifications

 public function sendNotifications($taskUid, $arrayTask, $arrayData, $applicationUid, $delIndex, $from = '')
 {
     try {
         $arrayApplicationData = $this->loadCase($applicationUid);
         $arrayData['APP_NUMBER'] = $arrayApplicationData['APP_NUMBER'];
         if (!class_exists('System')) {
             G::LoadClass('system');
         }
         $aConfiguration = System::getEmailConfiguration();
         $msgError = "";
         if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
             $msgError = "The default configuration wasn't defined";
             $aConfiguration['MESS_ENGINE'] = '';
         }
         //Send derivation notification - Start
         $oTask = new Task();
         $aTaskInfo = $oTask->load($taskUid);
         if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
             return false;
         }
         $from = G::buildFrom($aConfiguration, $from);
         if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
             $sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $arrayData);
         } else {
             $sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
         }
         //erik: new behaviour for messages
         G::loadClass('configuration');
         $oConf = new Configurations();
         $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
         $conf = $oConf->aConfig;
         $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;
         $swtplDefault = 0;
         $sBody = null;
         if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") {
             if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
                 $swtplDefault = 1;
             }
             $fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
             if (!file_exists($fileTemplate)) {
                 $tempale = PATH_CORE . "templates" . PATH_SEP . "mails" . PATH_SEP . "alert_message.html";
                 $copied = @copy($tempale, $fileTemplate);
                 if ($copied) {
                     $dataTemplate = array("prf_filename" => $conf["TAS_DEF_MESSAGE_TEMPLATE"], "prf_path" => $fileTemplate, "pro_uid" => $aTaskInfo["PRO_UID"], "usr_uid" => "00000000000000000000000000000001", "prf_uid" => G::generateUniqueID(), "prf_type" => "file", "prf_create_date" => date("Y-m-d H:i:s"));
                     $filesManager = new ProcessMaker\BusinessModel\FilesManager();
                     $filesManager->addProcessFilesManagerInDb($dataTemplate);
                 } else {
                     throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
                 }
             }
             $sBody = file_get_contents($fileTemplate);
         } else {
             $sBody = nl2br($aTaskInfo['TAS_DEF_MESSAGE']);
         }
         G::LoadClass("tasks");
         G::LoadClass("groups");
         G::LoadClass("spool");
         $task = new Tasks();
         $group = new Groups();
         $oUser = new Users();
         foreach ($arrayTask as $aTask) {
             $sTo = null;
             $sCc = null;
             if (isset($aTask['DEL_INDEX'])) {
                 $arrayData2 = $arrayData;
                 $appDelegation = AppDelegationPeer::retrieveByPK($applicationUid, $aTask['DEL_INDEX']);
                 if (!is_null($appDelegation)) {
                     $arrayData2['TAS_TITLE'] = Content::load('TAS_TITLE', '', $appDelegation->getTasUid(), SYS_LANG);
                     $arrayData2['DEL_TASK_DUE_DATE'] = $appDelegation->getDelTaskDueDate();
                 }
             } else {
                 $arrayData2 = $arrayData;
             }
             if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
                 $user = new \ProcessMaker\BusinessModel\User();
                 $arrayUserData = $user->getUser($aTask['USR_UID'], true);
                 $arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2, trim($arrayUserData['USR_TIME_ZONE']) != '' ? trim($arrayUserData['USR_TIME_ZONE']) : \ProcessMaker\Util\System::getTimeZone());
             } else {
                 $arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
             }
             $sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
             switch ($aTask["TAS_ASSIGN_TYPE"]) {
                 case "SELF_SERVICE":
                     if ($swtplDefault == 1) {
                         G::verifyPath($pathEmail, true);
                         //Create if it does not exist
                         $fileTemplate = $pathEmail . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
                         if (!file_exists($fileTemplate) && file_exists(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'))) {
                             @copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
                         }
                         $sBody2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
                     }
                     if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) {
                         $arrayTaskUser = array();
                         $arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1);
                         foreach ($arrayAux1 as $arrayGroup) {
                             $arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]);
                             foreach ($arrayAux2 as $arrayUser) {
                                 $arrayTaskUser[] = $arrayUser["USR_UID"];
                             }
//.........这里部分代码省略.........
开发者ID:emildev35,项目名称:processmaker,代码行数:101,代码来源:class.case.php


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