コード例 #1
0
 /**
  * Form to edit an object
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     $this->view->notificationType = NotificationTypeQuery::create()->findByPK($id);
     $this->view->notificationTypeAccessRoles = NotificationTypeQuery::create()->innerJoinAccessRole()->whereAdd('NotificationType.' . NotificationType::ID_NOTIFICATION_TYPE, $id)->addColumn('AccessRole.' . AccessRole::ID_ACCESS_ROLE)->fetchCol();
     $this->view->contentTitle = $this->i18n->_('Edit Notification Type');
     $this->view->accessRoles = AccessRoleQuery::create()->find()->toCombo();
 }
コード例 #2
0
ファイル: EmailListener.php プロジェクト: Eximagen/sochi
 /**
  *
  * @param int $notificationTypeId
  * @param array $vars
  */
 private function createNotification($notificationTypeId, array $vars)
 {
     $notificationType = NotificationTypeQuery::create()->findByPK($notificationTypeId);
     $now = new \Zend_Date();
     if ($notificationType instanceof NotificationType) {
         $notification = NotificationFactory::createFromArray(array('id_notification_type' => $notificationType->getIdNotificationType(), 'created' => $now->get('yyyy-MM-dd HH:mm:ss'), 'dispatched' => 0, 'dispatch_date' => null, 'variables' => json_encode($vars)));
         $this->getNotificationCatalog()->create($notification);
     }
 }
コード例 #3
0
ファイル: CronNotification.php プロジェクト: Eximagen/sochi
 /**
  * 
  * @param NotificationType $notificationType
  * @return \Application\Model\Collection\FileCollection
  */
 private function getFiles(Notification $notification)
 {
     $notificationType = NotificationTypeQuery::create()->findByPK($notification->getIdNotificationType());
     $array = array();
     $files = new FileCollection($array);
     switch ($notificationType->getIdNotificationType()) {
         case NotificationType::$id['CLAIM_REPORT_NOTIFICATION']:
             $vars = json_decode($notification->getVariables(), true);
             $filename = sys_get_temp_dir() . '/claim_report.pdf';
             $claimReport = new ClaimReport();
             $claimReport->setDocumentName($filename);
             $claimReport->setFolio($vars['folio']);
             $claimReport->setPurchaseOrder($vars['purchaseOrder']);
             $claimReport->setPercentageOfAceptance($vars['percentageOfAcceptance']);
             $claimReport->setPercentageOfDefects($vars['percentageOfDefects']);
             $claimReport->setDescription($vars['description']);
             $claimReport->setIncreasableFreight($vars['increasableFreight']);
             $claimReport->setGood($vars['claimReport']['good']);
             $claimReport->setRejected($vars['claimReport']['rejected']);
             $claimReport->setMissing($vars['claimReport']['missing']);
             $claimReport->setEstimatedRecuperationCost($vars['ERCost']);
             $claimReport->setRefuseTotal($vars['refuseTotal']);
             $claimReport->setComments($vars['comments']);
             $claimReport->setOutputDestination(ClaimReport::$OutputDestination['SAVE_LOCAL_DESTINATION']);
             $claimReport->generateClaimReport();
             $files->append(FileFactory::createFromArray(array('content' => $filename)));
             break;
     }
     return $files;
 }