public function Send($users, $data = false, $templatetype = false, $subject = false, $message = false)
 {
     $nt = NotifyTemplate::getInstance();
     //$ntdata = $nt->FetchData($templateid);
     $us = UserSettings::getInstance();
     $setting = Settings::getInstance();
     $nm = NotificationModule::getInstance();
     $user = User::getInstance();
     $lang = Lang::getInstance();
     for ($i = 0; $i < count($users); $i++) {
         $usersettings = $us->Get($users[$i]['id']);
         if (@$usersettings[$templatetype] != "0") {
             if (is_numeric($usersettings['language'])) {
                 $langdata = $lang->FetchData($usersettings['language']);
                 $langcode = $langdata['code'];
             } else {
                 $langcode = $setting->Get('system.lang.default');
             }
             if (strlen($langcode) != 2) {
                 throw new Exception("Lang code not found or in wrong format");
             }
             if (is_array($data) && $templatetype != '' && $templatetype != false) {
                 if (!is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = '" . $langcode . "'")) && !is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = 'en'"))) {
                     throw new Exception("Notify Template not found with type " . $templatetype . " and language " . $langcode);
                 }
                 $ntdata = $nt->FetchData($templateid);
                 if (!is_array($ntdata)) {
                     continue;
                 }
                 $message = $this->prepare_template($ntdata['text'], $data);
             } elseif (is_string($subject) && is_string($message)) {
                 $ntdata['subject'] = $subject;
             } else {
                 throw new Exception("Wrong parameters specified");
             }
             if (is_numeric($usersettings['notifymodule']) && is_string($usersettings['notifyaddress'])) {
                 $moduleid = $usersettings['notifymodule'];
                 $address = $usersettings['notifyaddress'];
             } else {
                 $userdata = $user->FetchData($users[$i]['id']);
                 $moduleid = $setting->Get('system.notifymodule.default');
                 $address = $userdata['email'];
             }
             if (strlen($address) < 2 || !is_numeric($moduleid)) {
                 continue;
             }
             if ($nm->Send($moduleid, $address, $ntdata['subject'], $message)) {
                 $status = 'Done';
             } else {
                 $status = 'Fail';
             }
             $this->Create(array('userid' => $users[$i]['id'], 'moduleid' => $moduleid, 'subject' => $ntdata['subject'], 'text' => $message, 'address' => $address, 'status' => $status));
         } else {
             return true;
         }
     }
     return true;
 }
Exemplo n.º 2
0
<?php

$this->beginContent('application.modules_core.notification.views.notificationLayoutMail', array('notification' => $notification, 'showSpace' => true));
?>

<?php 
echo Yii::t('CommentModule.views_notifications_alsoCommented', "%displayName% also commented your %contentTitle%.", array('%displayName%' => '<strong>' . $creator->displayName . '</strong>', '%contentTitle%' => $targetObject->getContentTitle()));
?>

<br/>

<em>"<?php 
echo NotificationModule::formatOutput($sourceObject->message);
?>
"</em>

<?php 
$this->endContent();
?>











Exemplo n.º 3
0
<?php

$this->beginContent('application.modules_core.notification.views.notificationLayoutMail', array('notification' => $notification, 'showSpace' => true));
echo Yii::t('UserModule.views_notifications_Mentioned', '{userName} mentioned you in {contentTitle}.', array('{userName}' => '<strong>' . CHtml::encode($creator->displayName) . '</strong>', '{contentTitle}' => NotificationModule::formatOutput($targetObject->getContentTitle())));
$this->endContent();
Exemplo n.º 4
0
            <!-- show user image -->
            <img class="media-object img-rounded pull-left"
                 data-src="holder.js/32x32" alt="32x32"
                 style="width: 32px; height: 32px;"
                 src="<?php 
echo $notification->creator->getProfileImage()->getUrl();
?>
">

            <!-- show content -->
            <div class="media-body">
                <div class="row">
                    <div class="col-md-9">
                        <?php 
echo '<strong>' . CHtml::encode($creator->displayName) . '</strong> created new album ';
echo NotificationModule::formatOutput($targetObject->getContentTitle());
?>
                        <br>
                        <span class="time"
                          title="<?php 
echo $notification->created_at;
?>
"><?php 
echo $notification->created_at;
?>
</span>
                        <?php 
if (!$notification->seen) {
    ?>
 
                            <span class="label label-danger"><?php 
Exemplo n.º 5
0
 public static function UserPersonalSettings()
 {
     $xtpl = self::$xtpl;
     $nm = NotificationModule::getInstance();
     $lang = Lang::getInstance();
     $setting = Settings::getInstance();
     $usrstg = UserSettings::getInstance();
     $curr = Currency::getInstance();
     $xtpl->assign('SETCURR', 'current');
     $xtpl->assign('SYSTEMCURRSETT', 'current');
     $nms = $nm->GetButch();
     $langs = $lang->GetButch();
     $currs = $curr->GetButch();
     if ($usersettings = $usrstg->Get(self::$userid)) {
         $xtpl->assign('NOTIFYADDRESS', $usersettings['notifyaddress']);
         if ($usersettings['usernewinvoice'] == "1") {
             $xtpl->assign('NEWINVSEL', 'checked="checked"');
         }
         if ($usersettings['userneworder'] == "1") {
             $xtpl->assign('NEWORDSEL', 'checked="checked"');
         }
         if ($usersettings['usernewticket'] == "1") {
             $xtpl->assign('NEWTCSEL', 'checked="checked"');
         }
         if ($usersettings['usernewticketreply'] == "1") {
             $xtpl->assign('NEWTRSEL', 'checked="checked"');
         }
     }
     for ($i = 0; $i < count($nms); $i++) {
         if ($nms[$i]['id'] == @$usersettings['notifymodule'] || $nms[$i]['id'] == $setting->Get('system.notifymodule.default')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         $xtpl->assign('NM', $nms[$i]);
         $xtpl->parse('main.personalsettings.ntlist');
     }
     for ($i = 0; $i < count($langs); $i++) {
         if ($langs[$i]['code'] == @$usersettings['language'] || $langs[$i]['code'] == $setting->Get('system.lang.default')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         //var_dump($langs[$i]);
         $xtpl->assign('LNG', $langs[$i]);
         $xtpl->parse('main.personalsettings.langlist');
     }
     for ($i = 0; $i < count($currs); $i++) {
         if ($currs[$i]['name'] == @$usersettings['currency'] || $currs[$i]['name'] == $setting->Get('system.currency')) {
             $xtpl->assign('DEFAULT', 'selected="selected"');
         } else {
             $xtpl->assign('DEFAULT', '');
         }
         $xtpl->assign('CURR', $currs[$i]);
         $xtpl->parse('main.personalsettings.currlist');
     }
     $xtpl->parse('main.personalsettings');
     $xtpl->parse('main');
     $xtpl->out('main');
 }
Exemplo n.º 6
0
<?php

$this->beginContent('application.modules_core.notification.views.notificationLayout', array('notification' => $notification));
?>

<?php 
echo Yii::t('LikeModule.views_notifications_newLike', "%displayName% has interest in %contentTitle%.", array('%displayName%' => '<strong>' . CHtml::encode($creator->displayName) . '</strong>', '%contentTitle%' => NotificationModule::formatOutput($targetObject->getContentTitle())));
$this->endContent();
Exemplo n.º 7
0
     if (!class_exists($name)) {
         throw new Exception("Module doesnt exists");
     }
     $module = $name::getInstance();
     $moduleinfo = $module->Info();
     $nm->Create(array('name' => $_POST['modulename'], 'shortname' => $moduleinfo['shortname']));
     Page::ManageNotifyModules();
     break;
 case 'delntmodule':
     $nm = NotificationModule::getInstance();
     $nm->Delete($_REQUEST['moduleid']);
     Page::ManageNotifyModules();
     break;
 case 'updatentmodule':
     $ntd = NotifyModuleData::getInstance();
     $nm = NotificationModule::getInstance();
     if (!$nm->FetchData($_POST['moduleid'])) {
         throw new Exception("Module doesnt exists with id: " . $_POST['moduleid']);
     }
     $name = $nm->FetchData($_POST['moduleid']);
     $name = $name['name'] . 'notifymodule';
     if (!class_exists($name)) {
         throw new Exception("Module " . $name . " doesnt exists!");
     }
     $module = $name::getInstance();
     $reqs = $module->OperateRequirements();
     for ($i = 0; $i < count($reqs); $i++) {
         $row_id = $ntd->GetID($_POST['moduleid'], 'moduleid', "`name` = '" . $reqs[$i]['name'] . "'");
         if ($row_id) {
             $ntd->Update('value', $_POST[$reqs[$i]['name']], $row_id);
         } else {
<?php

$this->beginContent('application.modules_core.notification.views.notificationLayoutMail', array('notification' => $notification, 'showSpace' => false));
?>

<?php 
echo '<strong>' . CHtml::encode($creator->displayName) . '</strong> created new album ' . NotificationModule::formatOutput($targetObject->getContentTitle());
$this->endContent();