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


PHP CRM_Mailing_BAO_Mailing::getRows方法代码示例

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


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

示例1: ts

 /**
  * Returns all the rows in the given offset and rowCount.
  *
  * @param string $action
  *   The action being performed.
  * @param int $offset
  *   The row number to start from.
  * @param int $rowCount
  *   The number of rows to return.
  * @param string $sort
  *   The sql string that describes the sort order.
  * @param string $output
  *   What should the result set include (web/email/csv).
  *
  * @return int
  *   the total number of rows for this action
  */
 public function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     static $actionLinks = NULL;
     if (empty($actionLinks)) {
         $cancelExtra = ts('Are you sure you want to cancel this mailing?');
         $deleteExtra = ts('Are you sure you want to delete this mailing?');
         $archiveExtra = ts('Are you sure you want to archive this mailing?');
         $actionLinks = array(CRM_Core_Action::ENABLE => array('name' => ts('Approve/Reject'), 'url' => 'civicrm/mailing/approve', 'qs' => 'mid=%%mid%%&reset=1', 'title' => ts('Approve/Reject Mailing')), CRM_Core_Action::VIEW => array('name' => ts('Report'), 'url' => 'civicrm/mailing/report', 'qs' => 'mid=%%mid%%&reset=1', 'title' => ts('View Mailing Report')), CRM_Core_Action::UPDATE => array('name' => ts('Re-Use'), 'url' => 'civicrm/mailing/send', 'qs' => 'mid=%%mid%%&reset=1', 'title' => ts('Re-Send Mailing')), CRM_Core_Action::DISABLE => array('name' => ts('Cancel'), 'url' => 'civicrm/mailing/browse', 'qs' => 'action=disable&mid=%%mid%%&reset=1', 'extra' => 'onclick="if (confirm(\'' . $cancelExtra . '\')) this.href+=\'&confirmed=1\'; else return false;"', 'title' => ts('Cancel Mailing')), CRM_Core_Action::PREVIEW => array('name' => ts('Continue'), 'url' => 'civicrm/mailing/send', 'qs' => 'mid=%%mid%%&continue=true&reset=1', 'title' => ts('Continue Mailing')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/mailing/browse', 'qs' => 'action=delete&mid=%%mid%%&reset=1', 'extra' => 'onclick="if (confirm(\'' . $deleteExtra . '\')) this.href+=\'&confirmed=1\'; else return false;"', 'title' => ts('Delete Mailing')), CRM_Core_Action::RENEW => array('name' => ts('Archive'), 'url' => 'civicrm/mailing/browse/archived', 'qs' => 'action=renew&mid=%%mid%%&reset=1', 'extra' => 'onclick="if (confirm(\'' . $archiveExtra . '\')) this.href+=\'&confirmed=1\'; else return false;"', 'title' => ts('Archive Mailing')));
     }
     $allAccess = TRUE;
     $workFlow = $showApprovalLinks = $showScheduleLinks = $showCreateLinks = FALSE;
     if (CRM_Mailing_Info::workflowEnabled()) {
         $allAccess = FALSE;
         $workFlow = TRUE;
         //supercedes all permission
         if (CRM_Core_Permission::check('access CiviMail')) {
             $allAccess = TRUE;
         }
         if (CRM_Core_Permission::check('approve mailings')) {
             $showApprovalLinks = TRUE;
         }
         if (CRM_Core_Permission::check('create mailings')) {
             $showCreateLinks = TRUE;
         }
         if (CRM_Core_Permission::check('schedule mailings')) {
             $showScheduleLinks = TRUE;
         }
     }
     $mailing = new CRM_Mailing_BAO_Mailing();
     $params = array();
     $whereClause = ' AND ' . $this->whereClause($params);
     if (empty($params)) {
         $this->_parent->assign('isSearch', 0);
     } else {
         $this->_parent->assign('isSearch', 1);
     }
     $rows =& $mailing->getRows($offset, $rowCount, $sort, $whereClause, $params);
     //get the search base mailing Ids, CRM-3711.
     $searchMailings = $mailing->searchMailingIDs();
     //check for delete CRM-4418
     $allowToDelete = CRM_Core_Permission::check('delete in CiviMail');
     if ($output != CRM_Core_Selector_Controller::EXPORT) {
         //create the appropriate $op to use for hook_civicrm_links
         $pageTypes = array('view', 'mailing', 'browse');
         if ($this->_parent->_unscheduled) {
             $pageTypes[] = 'unscheduled';
         }
         if ($this->_parent->_scheduled) {
             $pageTypes[] = 'scheduled';
         }
         if ($this->_parent->_archived) {
             $pageTypes[] = 'archived';
         }
         $opString = implode('.', $pageTypes);
         foreach ($rows as $key => $row) {
             $actionMask = NULL;
             if ($row['sms_provider_id']) {
                 $actionLinks[CRM_Core_Action::PREVIEW]['url'] = 'civicrm/sms/send';
             }
             if (!($row['status'] == 'Not scheduled') && !$row['sms_provider_id']) {
                 if ($allAccess || $showCreateLinks) {
                     $actionMask = CRM_Core_Action::VIEW;
                 }
                 if (!in_array($row['id'], $searchMailings)) {
                     if ($allAccess || $showCreateLinks) {
                         $actionMask |= CRM_Core_Action::UPDATE;
                     }
                 }
             } else {
                 if ($allAccess || ($showCreateLinks || $showScheduleLinks)) {
                     $actionMask = CRM_Core_Action::PREVIEW;
                 }
             }
             if (in_array($row['status'], array('Scheduled', 'Running', 'Paused'))) {
                 if ($allAccess || $showApprovalLinks && $showCreateLinks && $showScheduleLinks) {
                     $actionMask |= CRM_Core_Action::DISABLE;
                 }
                 if ($row['status'] == 'Scheduled' && empty($row['approval_status_id'])) {
                     if ($workFlow && ($allAccess || $showApprovalLinks)) {
                         $actionMask |= CRM_Core_Action::ENABLE;
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:101,代码来源:Browse.php


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