• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_BAO_ActionSchedule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0);
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
     $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id);
     if ($reminderList && is_array($reminderList)) {
         // Add action links to each of the reminders
         foreach ($reminderList as &$format) {
             $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
             if ($format['is_active']) {
                 $action += CRM_Core_Action::DISABLE;
             } else {
                 $action += CRM_Core_Action::ENABLE;
             }
             $scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
             $links = $scheduleReminder->links();
             $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
             $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
             $format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $this->_id);
         }
     }
     $this->assign('rows', $reminderList);
     $this->assign('setTab', $setTab);
     $this->assign('component', 'event');
     // Update tab "disabled" css class
     $this->ajaxResponse['tabValid'] = is_array($reminderList) && count($reminderList) > 0;
     $this->setPageTitle(ts('Scheduled Reminder'));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:34,代码来源:ScheduleReminders.php


示例2: civicrm_api3_action_schedule_create

/**
 * Create a new Action Schedule
 *
 * @param array $params
 *
 * @return array
 *
 * {@getfields action_schedule_create}
 */
function civicrm_api3_action_schedule_create($params)
{
    if (empty($params['id'])) {
        // an update does not require any mandatory parameters
        civicrm_api3_verify_one_mandatory($params, NULL, array('title', 'mapping_id', 'entity_status', 'entity_value'));
    }
    $ids = array();
    if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
        return civicrm_api3_create_error('Invalid value for ID');
    }
    if (!array_key_exists('name', $params) && !array_key_exists('id', $params)) {
        $params['name'] = CRM_Utils_String::munge($params['title']);
    }
    $actionSchedule = new CRM_Core_BAO_ActionSchedule();
    $actionSchedule = CRM_Core_BAO_ActionSchedule::add($params, $ids);
    $actSchedule = array();
    _civicrm_api3_object_to_array($actionSchedule, $actSchedule[$actionSchedule->id]);
    return civicrm_api3_create_success($actSchedule, $params, 'action_schedule', 'create', $actionSchedule);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:28,代码来源:ActionSchedule.php


示例3: mappingList1

 function mappingList1()
 {
     $params = array('mappingID');
     foreach ($params as $param) {
         ${$param} = CRM_Utils_Array::value($param, $_POST);
     }
     if (!$mappingID) {
         CRM_Utils_JSON::output(array('error_msg' => 'required params missing.'));
     }
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($mappingID);
     extract($selectionOptions);
     $elements = array();
     foreach ($sel5 as $id => $name) {
         $elements['sel5'][] = array('name' => $name, 'value' => $id);
     }
     $elements['recipientMapping'] = $recipientMapping;
     CRM_Utils_JSON::output($elements);
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:18,代码来源:AJAX.php


示例4: postProcess

 /**
  * Process the form submission.
  *
  * @param array $params
  * @param string $type
  * @param array $linkedEntities
  *
  * @throws \CiviCRM_API3_Exception
  */
 public static function postProcess($params = array(), $type, $linkedEntities = array())
 {
     //Check entity_id not present in params take it from class variable
     if (empty($params['entity_id'])) {
         $params['entity_id'] = self::$_entityId;
     }
     //Process this function only when you get this variable
     if ($params['allowRepeatConfigToSubmit'] == 1) {
         if (!empty($params['entity_table']) && !empty($params['entity_id']) && $type) {
             $params['used_for'] = $type;
             if (empty($params['parent_entity_id'])) {
                 $params['parent_entity_id'] = self::$_parentEntityId;
             }
             if (!empty($params['schedule_reminder_id'])) {
                 $params['id'] = $params['schedule_reminder_id'];
             } else {
                 $params['id'] = self::$_scheduleReminderID;
             }
             //Save post params to the schedule reminder table
             $recurobj = new CRM_Core_BAO_RecurringEntity();
             $dbParams = $recurobj->mapFormValuesToDB($params);
             //Delete repeat configuration and rebuild
             if (!empty($params['id'])) {
                 CRM_Core_BAO_ActionSchedule::del($params['id']);
                 unset($params['id']);
             }
             $actionScheduleObj = CRM_Core_BAO_ActionSchedule::add($dbParams);
             //exclude dates
             $excludeDateList = array();
             if (CRM_Utils_Array::value('exclude_date_list', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) {
                 //Since we get comma separated values lets get them in array
                 $excludeDates = explode(",", $params['exclude_date_list']);
                 //Check if there exists any values for this option group
                 $optionGroupIdExists = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $type . '_repeat_exclude_dates_' . $params['parent_entity_id'], 'id', 'name');
                 if ($optionGroupIdExists) {
                     CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);
                 }
                 $optionGroupParams = array('name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value, 'title' => $type . ' recursion', 'is_reserved' => 0, 'is_active' => 1);
                 $opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams);
                 if ($opGroup->id) {
                     $oldWeight = 0;
                     $fieldValues = array('option_group_id' => $opGroup->id);
                     foreach ($excludeDates as $val) {
                         $optionGroupValue = array('option_group_id' => $opGroup->id, 'label' => CRM_Utils_Date::processDate($val), 'value' => CRM_Utils_Date::processDate($val), 'name' => $opGroup->name, 'description' => 'Used for recurring ' . $type, 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues), 'is_active' => 1);
                         $excludeDateList[] = $optionGroupValue['value'];
                         CRM_Core_BAO_OptionValue::create($optionGroupValue);
                     }
                 }
             }
             //Set type for API
             $apiEntityType = explode("_", $type);
             if (!empty($apiEntityType[1])) {
                 $apiType = $apiEntityType[1];
             }
             //Delete relations if any from recurring entity tables before inserting new relations for this entity id
             if ($params['entity_id']) {
                 //If entity has any pre delete function, consider that first
                 if (CRM_Utils_Array::value('pre_delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) && CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
                     $preDeleteResult = call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], array($params['entity_id']));
                     if (!empty($preDeleteResult)) {
                         call_user_func(array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'], $preDeleteResult));
                     }
                 }
                 //Ready to execute delete on entities if it has delete function set
                 if (CRM_Utils_Array::value('delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) && CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
                     //Check if pre delete function has some ids to be deleted
                     if (!empty(CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted)) {
                         foreach (CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted as $eid) {
                             $result = civicrm_api3(ucfirst(strtolower($apiType)), CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'], array('sequential' => 1, 'id' => $eid));
                             if ($result['error']) {
                                 CRM_Core_Error::statusBounce('Error creating recurring list');
                             }
                         }
                     } else {
                         $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table'], FALSE);
                         foreach ($getRelatedEntities as $key => $value) {
                             $result = civicrm_api3(ucfirst(strtolower($apiType)), CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'], array('sequential' => 1, 'id' => $value['id']));
                             if ($result['error']) {
                                 CRM_Core_Error::statusBounce('Error creating recurring list');
                             }
                         }
                     }
                 }
                 // find all entities from the recurring set. At this point we 'll get entities which were not deleted
                 // for e.g due to participants being present. We need to delete them from recurring tables anyway.
                 $pRepeatingEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table']);
                 foreach ($pRepeatingEntities as $val) {
                     CRM_Core_BAO_RecurringEntity::delEntity($val['id'], $val['table'], TRUE);
                 }
             }
             $recursion = new CRM_Core_BAO_RecurringEntity();
//.........这里部分代码省略.........
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:101,代码来源:RecurringEntity.php


示例5: civicrm_api3_job_send_reminder

/**
 * Send the scheduled reminders for all contacts (either for activities or events)
 *
 * @param  array       $params (reference ) input parameters
 *                        now - the time to use, in YmdHis format
 *                            - makes testing a bit simpler since we can simulate past/future time
 *
 * @return boolean        true if success, else false
 * @static void
 * @access public
 *
 */
function civicrm_api3_job_send_reminder($params)
{
    $lock = new CRM_Core_Lock('civimail.job.EmailProcessor');
    if (!$lock->isAcquired()) {
        return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
    }
    $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params), $params);
    $lock->release();
    if ($result['is_error'] == 0) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error($result['messages']);
    }
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:26,代码来源:Job.php


示例6: browse

 /**
  * Browse all Scheduled Reminders settings.
  *
  * @param null $action
  *
  * @return void
  */
 public function browse($action = NULL)
 {
     // Get list of configured reminders
     $reminderList = CRM_Core_BAO_ActionSchedule::getList();
     if (is_array($reminderList)) {
         // Add action links to each of the reminders
         foreach ($reminderList as &$format) {
             $action = array_sum(array_keys($this->links()));
             if ($format['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $format['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $format['id']);
         }
     }
     $this->assign('rows', $reminderList);
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:25,代码来源:ScheduleReminders.php


示例7: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         // delete reminder
         CRM_Core_BAO_ActionSchedule::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Reminder has been deleted.'), ts('Record Deleted'), 'success');
         if ($this->_context == 'event' && $this->_compId) {
             $url = CRM_Utils_System::url('civicrm/event/manage/reminder', "reset=1&action=browse&id={$this->_compId}&component={$this->_context}&setTab=1");
             $session = CRM_Core_Session::singleton();
             $session->pushUserContext($url);
         }
         return;
     }
     $values = $this->controller->exportValues($this->getName());
     $bao = $this->parseActionSchedule($values)->save();
     // we need to set this on the form so that hooks can identify the created entity
     $this->set('id', $bao->id);
     $bao->free();
     $status = ts("Your new Reminder titled %1 has been saved.", array(1 => "<strong>{$values['title']}</strong>"));
     if ($this->_action) {
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $status = ts("Your Reminder titled %1 has been updated.", array(1 => "<strong>{$values['title']}</strong>"));
         }
         if ($this->_context == 'event' && $this->_compId) {
             $url = CRM_Utils_System::url('civicrm/event/manage/reminder', "reset=1&action=browse&id={$this->_compId}&component={$this->_context}&setTab=1");
             $session = CRM_Core_Session::singleton();
             $session->pushUserContext($url);
         }
     }
     CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:34,代码来源:ScheduleReminders.php


示例8: browse

 /**
  * Browse all Scheduled Reminders settings.
  *
  * @param null $action
  *
  * @return void
  */
 public function browse($action = NULL)
 {
     //CRM-16777: Do not permit access to user, for page 'Administer->Communication->Schedule Reminder',
     //when do not have 'administer CiviCRM' permission.
     if (!CRM_Core_Permission::check('administer CiviCRM')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
     // Get list of configured reminders
     $reminderList = CRM_Core_BAO_ActionSchedule::getList();
     if (is_array($reminderList)) {
         // Add action links to each of the reminders
         foreach ($reminderList as &$format) {
             $action = array_sum(array_keys($this->links()));
             if ($format['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $format['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $format['id']);
         }
     }
     $this->assign('rows', $reminderList);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:30,代码来源:ScheduleReminders.php


示例9: run

 public function run($now = NULL)
 {
     require_once 'CRM/Core/BAO/ActionSchedule.php';
     CRM_Core_BAO_ActionSchedule::processQueue($now);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:5,代码来源:action.cronjob.php


示例10: civicrm_api3_job_send_reminder

/**
 * Send the scheduled reminders for all contacts (either for activities or events).
 *
 * @param array $params
 *   (reference ) input parameters.
 *                        now - the time to use, in YmdHis format
 *                            - makes testing a bit simpler since we can simulate past/future time
 *
 * @return array
 */
function civicrm_api3_job_send_reminder($params)
{
    //note that $params['rowCount' can be overridden by one of the preferred syntaxes ($options['limit'] = x
    //It's not clear whether than syntax can be passed in via the UI config - but this keeps the pre 4.4.4 behaviour
    // in that case (ie. makes it non-configurable via the UI). Another approach would be to set a default of 0
    // in the _spec function - but since that is a deprecated value it seems more contentious than this approach
    $params['rowCount'] = 0;
    $lock = Civi::lockManager()->acquire('worker.core.ActionSchedule');
    if (!$lock->isAcquired()) {
        return civicrm_api3_create_error('Could not acquire lock, another ActionSchedule process is running');
    }
    $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params), $params);
    $lock->release();
    if ($result['is_error'] == 0) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error($result['messages']);
    }
}
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:29,代码来源:Job.php


示例11: getRecipientListing

 /**
  * @param int $mappingID
  * @param $recipientType
  *
  * @return array
  */
 public static function getRecipientListing($mappingID, $recipientType)
 {
     if (!$mappingID) {
         return array();
     }
     /** @var \Civi\ActionSchedule\Mapping $mapping */
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $mappingID)));
     return $mapping->getRecipientListing($recipientType);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:15,代码来源:ActionSchedule.php


示例12: civicrm_api3_job_send_reminder

/**
 * Send the scheduled reminders for all contacts (either for activities or events)
 *
 * @param  array   	  $params (reference ) input parameters
 *                        now - the time to use, in YmdHis format
 *                            - makes testing a bit simpler since we can simulate past/future time
 *
 * @return boolean        true if success, else false
 * @static void
 * @access public
 *
 */
function civicrm_api3_job_send_reminder($params)
{
    require_once 'CRM/Core/BAO/ActionSchedule.php';
    $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params));
    if ($result['is_error'] == 0) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error($result['messages']);
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:22,代码来源:Job.php


示例13: process

 /**
  * @param CRM_Event_Form_ManageEvent $form
  *
  * @return array
  * @throws Exception
  */
 public static function process(&$form)
 {
     if ($form->getVar('_id') <= 0) {
         return NULL;
     }
     $default = array('link' => NULL, 'valid' => TRUE, 'active' => TRUE, 'current' => FALSE, 'class' => 'ajaxForm');
     $tabs = array();
     $tabs['settings'] = array('title' => ts('Info and Settings'), 'class' => 'ajaxForm livePage') + $default;
     $tabs['location'] = array('title' => ts('Event Location')) + $default;
     $tabs['fee'] = array('title' => ts('Fees')) + $default;
     $tabs['registration'] = array('title' => ts('Online Registration')) + $default;
     if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
         $tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
     }
     $tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
     $tabs['friend'] = array('title' => ts('Tell a Friend')) + $default;
     $tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
     $tabs['repeat'] = array('title' => ts('Repeat')) + $default;
     // Repeat tab must refresh page when switching repeat mode so js & vars will get set-up
     if (!$form->_isRepeatingEvent) {
         unset($tabs['repeat']['class']);
     }
     // check if we're in shopping cart mode for events
     $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
     if (!$enableCart) {
         unset($tabs['conference']);
     }
     $eventID = $form->getVar('_id');
     if ($eventID) {
         // disable tabs based on their configuration status
         $eventNameMapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
         $sql = "\nSELECT     e.loc_block_id as is_location, e.is_online_registration, e.is_monetary, taf.is_active, pcp.is_active as is_pcp, sch.id as is_reminder, re.id as is_repeating_event\nFROM       civicrm_event e\nLEFT JOIN  civicrm_tell_friend taf ON ( taf.entity_table = 'civicrm_event' AND taf.entity_id = e.id )\nLEFT JOIN  civicrm_pcp_block pcp   ON ( pcp.entity_table = 'civicrm_event' AND pcp.entity_id = e.id )\nLEFT JOIN  civicrm_action_schedule sch ON ( sch.mapping_id = %2 AND sch.entity_value = %1 )\nLEFT JOIN  civicrm_recurring_entity re ON ( e.id = re.entity_id AND re.entity_table = 'civicrm_event' )\nWHERE      e.id = %1\n";
         //Check if repeat is configured
         $eventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($eventID, 'civicrm_event');
         $params = array(1 => array($eventID, 'Integer'), 2 => array($eventNameMapping->getId(), 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($sql, $params);
         if (!$dao->fetch()) {
             CRM_Core_Error::fatal();
         }
         if (!$dao->is_location) {
             $tabs['location']['valid'] = FALSE;
         }
         if (!$dao->is_online_registration) {
             $tabs['registration']['valid'] = FALSE;
         }
         if (!$dao->is_monetary) {
             $tabs['fee']['valid'] = FALSE;
         }
         if (!$dao->is_active) {
             $tabs['friend']['valid'] = FALSE;
         }
         if (!$dao->is_pcp) {
             $tabs['pcp']['valid'] = FALSE;
         }
         if (!$dao->is_reminder) {
             $tabs['reminder']['valid'] = FALSE;
         }
         if (!$dao->is_repeating_event) {
             $tabs['repeat']['valid'] = FALSE;
         }
     }
     // see if any other modules want to add any tabs
     // note: status of 'valid' flag of any injected tab, needs to be taken care in the hook implementation.
     CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs, array('event_id' => $eventID));
     $fullName = $form->getVar('_name');
     $className = CRM_Utils_String::getClassName($fullName);
     $new = '';
     // hack for special cases.
     switch ($className) {
         case 'Event':
             $attributes = $form->getVar('_attributes');
             $class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
             break;
         case 'EventInfo':
             $class = 'settings';
             break;
         case 'ScheduleReminders':
             $class = 'reminder';
             break;
         default:
             $class = strtolower($className);
             break;
     }
     if (array_key_exists($class, $tabs)) {
         $tabs[$class]['current'] = TRUE;
         $qfKey = $form->get('qfKey');
         if ($qfKey) {
             $tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
         }
     }
     if ($eventID) {
         $reset = !empty($_GET['reset']) ? 'reset=1&' : '';
         foreach ($tabs as $key => $value) {
             if (!isset($tabs[$key]['qfKey'])) {
//.........这里部分代码省略.........
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:101,代码来源:TabHeader.php


示例14: recipientListing

 /**
  * (Scheduled Reminders) Get the list of possible recipient filters.
  *
  * Ex: GET /civicrm/ajax/recipientListing?mappingID=contribpage&recipientType=
  */
 public static function recipientListing()
 {
     $mappingID = filter_input(INPUT_GET, 'mappingID', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^[a-zA-Z0-9_\\-]+$/')));
     $recipientType = filter_input(INPUT_GET, 'recipientType', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^[a-zA-Z0-9_\\-]+$/')));
     CRM_Utils_JSON::output(array('recipients' => CRM_Utils_Array::toKeyValueRows(CRM_Core_BAO_ActionSchedule::getRecipientListing($mappingID, $recipientType))));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:AJAX.php


示例15: browse

 /**
  * Browse all events.
  *
  * @return void
  */
 public function browse()
 {
     Civi::resources()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     $createdId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
     if (strtolower($this->_sortByCharacter) == 'all' || !empty($_POST)) {
         $this->_sortByCharacter = '';
         $this->set('sortByCharacter', '');
     }
     $this->_force = $this->_searchResult = NULL;
     $this->search();
     $params = array();
     $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
     $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
     $whereClause = $this->whereClause($params, FALSE, $this->_force);
     $this->pagerAToZ($whereClause, $params);
     $params = array();
     $whereClause = $this->whereClause($params, TRUE, $this->_force);
     // because is_template != 1 would be to simple
     $whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
     $this->pager($whereClause, $params);
     list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
     // get all custom groups sorted by weight
     $manageEvent = array();
     $query = "\n  SELECT *\n    FROM civicrm_event\n   WHERE {$whereClause}\nORDER BY start_date desc\n   LIMIT {$offset}, {$rowCount}";
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
     $permissions = CRM_Event_BAO_Event::checkPermission();
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     // get the list of active event pcps
     $eventPCPS = array();
     $pcpDao = new CRM_PCP_DAO_PCPBlock();
     $pcpDao->entity_table = 'civicrm_event';
     $pcpDao->find();
     while ($pcpDao->fetch()) {
         $eventPCPS[$pcpDao->entity_id] = $pcpDao->entity_id;
     }
     // check if we're in shopping cart mode for events
     $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
     $this->assign('eventCartEnabled', $enableCart);
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
     $eventType = CRM_Core_OptionGroup::values('event_type');
     while ($dao->fetch()) {
         if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
             $manageEvent[$dao->id] = array();
             $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($dao->id, 'civicrm_event');
             $manageEvent[$dao->id]['repeat'] = '';
             if ($repeat) {
                 $manageEvent[$dao->id]['repeat'] = ts('Repeating (%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
             }
             CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
             // form all action links
             $action = array_sum(array_keys($this->links()));
             if ($dao->is_active) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             if (!in_array($dao->id, $permissions[CRM_Core_Permission::DELETE])) {
                 $action -= CRM_Core_Action::DELETE;
             }
             if (!in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
                 $action -= CRM_Core_Action::UPDATE;
             }
             $manageEvent[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), TRUE, 'event.manage.list', 'Event', $dao->id);
             $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event', 'is_active' => 1);
             $defaults['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
             $manageEvent[$dao->id]['friend'] = CRM_Friend_BAO_Friend::getValues($params);
             if (isset($defaults['location']['address'][1]['city'])) {
                 $manageEvent[$dao->id]['city'] = $defaults['location']['address'][1]['city'];
             }
             if (isset($defaults['location']['address'][1]['state_province_id'])) {
                 $manageEvent[$dao->id]['state_province'] = CRM_Core_PseudoConstant::stateProvince($defaults['location']['address'][1]['state_province_id']);
             }
             //show campaigns on selector.
             $manageEvent[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
             $manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->getId());
             $manageEvent[$dao->id]['is_pcp_enabled'] = CRM_Utils_Array::value($dao->id, $eventPCPS);
             $manageEvent[$dao->id]['event_type'] = CRM_Utils_Array::value($manageEvent[$dao->id]['event_type_id'], $eventType);
             $manageEvent[$dao->id]['is_repeating_event'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_RecurringEntity', $dao->id, 'parent_id', 'entity_id');
             // allow hooks to set 'field' value which allows configuration pop-up to show a tab as enabled/disabled
             CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, array('event_id' => $dao->id));
         }
     }
     $manageEvent['tab'] = self::tabs($enableCart);
     $this->assign('rows', $manageEvent);
     $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
     $statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
     $findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
     $findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
     $this->assign('findParticipants', $findParticipants);
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:97,代码来源:ManageEvent.php


示例16: postProcess

 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         // delete reminder
         CRM_Core_BAO_ActionSchedule::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Reminder has been deleted.'), ts('Record Deleted'), 'success');
         if ($this->_context == 'event' && $this->_compId) {
             $url = CRM_Utils_System::url('civicrm/event/manage/reminder', "reset=1&action=browse&id={$this->_compId}&component={$this->_context}&setTab=1");
             $session = CRM_Core_Session::singleton();
             $session->pushUserContext($url);
         }
         return;
     }
     $values = $this->controller->exportValues($this->getName());
     $keys = array('title', 'subject', 'absolute_date', 'group_id', 'record_activity', 'limit_to', 'mode', 'sms_provider_id', 'from_name', 'from_email');
     foreach ($keys as $key) {
         $params[$key] = CRM_Utils_Array::value($key, $values);
     }
     $params['is_repeat'] = CRM_Utils_Array::value('is_repeat', $values, 0);
     $moreKeys = array('start_action_offset', 'start_action_unit', 'start_action_condition', 'start_action_date', 'repetition_frequency_unit', 'repetition_frequency_interval', 'end_frequency_unit', 'end_frequency_interval', 'end_action', 'end_date');
     if ($absoluteDate = CRM_Utils_Array::value('absolute_date', $params)) {
         $params['absolute_date'] = CRM_Utils_Date::processDate($absoluteDate);
         $params['is_repeat'] = 0;
         foreach ($moreKeys as $mkey) {
             $params[$mkey] = 'null';
         }
     } else {
         $params['absolute_date'] = 'null';
         foreach ($moreKeys as $mkey) {
             $params[$mkey] = CRM_Utils_Array::value($mkey, $values);
         }
     }
     $params['body_text'] = CRM_Utils_Array::value('text_message', $values);
     $params['sms_body_text'] = CRM_Utils_Array::value('sms_text_message', $values);
     $params['body_html'] = CRM_Utils_Array::value('html_message', $values);
     if (CRM_Utils_Array::value('recipient', $values) == 'manual') {
         $params['recipient_manual'] = CRM_Utils_Array::value('recipient_manual_id', $values);
         $params['group_id'] = $params['recipient'] = $params['recipient_listing'] = 'null';
     } elseif (CRM_Utils_Array::value('recipient', $values) == 'group') {
         $params['group_id'] = $values['group_id'];
         $params['recipient_manual'] = $params['recipient'] = $params['recipient_listing'] = 'null';
     } elseif (!CRM_Utils_System::isNull($values['recipient_listing']) && !CRM_Utils_System::isNull($values['limit_to'])) {
         $params['recipient'] = CRM_Utils_Array::value('recipient', $values);
         $params['recipient_listing'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('recipient_listing', $values));
         $params['group_id'] = $params['recipient_manual'] = 'null';
     } else {
         $params['recipient'] = CRM_Utils_Array::value('recipient', $values);
         $params['group_id'] = $params['recipient_manual'] = $params['recipient_listing'] = 'null';
     }
     if (!empty($this->_mappingID) && !empty($this->_compId)) {
         $params['mapping_id'] = $this->_mappingID;
         $params['entity_value'] = $this->_compId;
         $params['entity_status'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $values['entity']);
     } else {
         $params['mapping_id'] = $values['entity'][0];
         $entity_value = $values['entity'][1];
         $entity_status = $values['entity'][2];
         if ($params['mapping_id'] == 1) {
             $params['limit_to'] = 1;
         }
         foreach (array('entity_value', 'entity_status') as $key) {
             $params[$key] = implode(CRM_Core_DAO::VALUE_SEPARATOR, ${$key});
         }
     }
     $params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0);
     if (CRM_Utils_Array::value('is_repeat', $values) == 0) {
         $params['repetition_frequency_unit'] = 'null';
         $params['repetition_frequency_interval'] = 'null';
         $params['end_frequency_unit'] = 'null';
         $params['end_frequency_interval'] = 'null';
         $params['end_action'] = 'null';
         $params['end_date'] = 'null';
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $params['id'] = $this->_id;
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         // we do this only once, so name never changes
         $params['name'] = CRM_Utils_String::munge($params['title'], '_', 64);
     }
     $modePrefixes = array('Mail' => NULL, 'SMS' => 'SMS');
     if ($params['mode'] == 'Email' || empty($params['sms_provider_id'])) {
         unset($modePrefixes['SMS']);
     } elseif ($params['mode'] == 'SMS') {
         unset($modePrefixes['Mail']);
     }
     //TODO: handle postprocessing of SMS and/or Email info based on $modePrefixes
     $composeFields = array('template', 'saveTemplate', 'updateTemplate', 'saveTemplateName');
     $msgTemplate = NULL;
     //mail template is composed
     foreach ($modePrefixes as $prefix) {
         $composeParams = array();
         foreach ($composeFields as $key) {
             $key = $prefix . $key;
             if (!empty($values[$key])) {
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:ScheduleReminders.php


示例17: testRepetitionFrequencyUnit

 /**
  * Test that the various repetition units work correctly.
  * CRM-17028
  */
 public function testRepetitionFrequencyUnit()
 {
     $membershipTypeParams = array('duration_interval' => '1', 'duration_unit' => 'year', 'is_active' => 1, 'period_type' => 'rolling');
     $membershipType = $this->createTestObject('CRM_Member_DAO_MembershipType', $membershipTypeParams);
     $interval_units = array('hour', 'day', 'week', 'month', 'year');
     foreach ($interval_units as $interval_unit) {
         $membershipEndDate = DateTime::createFromFormat('Y-m-d H:i:s', "2013-03-15 00:00:00");
         $contactParams = array('contact_type' => 'Individual', 'first_name' => 'Test', 'last_name' => "Interval {$interval_unit}", 'is_deceased' => 0);
         $contact = $this->createTestObject('CRM_Contact_DAO_Contact', $contactParams);
         $this->assertTrue(is_numeric($contact->id));
         $emailParams = array('contact_id' => $contact->id, 'email' => "test-member-{$interval_unit}@example.com", 'location_type_id' => 1);
         $email = $this->createTestObject('CRM_Core_DAO_Email', $emailParams);
         $this->assertTrue(is_numeric($email->id));
         $membershipParams = array('membership_type_id' => $membershipType->id, 'contact_id' => $contact->id, 'join_date' => '20120315', 'start_date' => '20120315', 'end_date' => '20130315', 'is_override' => 0, 'status_id' => 2);
         $membershipParams['status-id'] = 1;
         $membership = $this->createTestObject('CRM_Member_DAO_Membership', $membershipParams);
         $actionScheduleParams = $this->fixtures['sched_on_membership_end_date_repeat_interval'];
         $actionScheduleParams['entity_value'] = $membershipType->id;
         $actionScheduleParams['repetition_frequency_unit'] = $interval_unit;
         $actionScheduleParams['repetition_frequency_interval'] = 2;
         $actionSchedule = CRM_Core_BAO_ActionSchedule::add($actionScheduleParams);
         $this->assertTrue(is_numeric($actionSchedule->id));
         $beforeEndDate = $this->createModifiedDateTime($membershipEndDate, '-1 day');
         $beforeFirstUnit = $this->createModifiedDateTime($membershipEndDate, "+1 {$interval_unit}");
         $afterFirstUnit = $this->createModifiedDateTime($membershipEndDate, "+2 {$interval_unit}");
         $cronRuns = array(array('time' => $beforeEndDate->format('Y-m-d H:i:s'), 'recipients' => array()), array('time' => $membershipEndDate->format('Y-m-d H:i:s'), 'recipients' => array(array("test-member-{$interval_unit}@example.com"))), array('time' => $beforeFirstUnit->format('Y-m-d H:i:s'), 'recipients' => array()), array('time' => $afterFirstUnit->format('Y-m-d H:i:s'), 'recipients' => array(array("test-member-{$interval_unit}@example.com"))));
         $this->assertCronRuns($cronRuns);
         $actionSchedule->delete();
         $membership->delete();
     }
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:35,代码来源:ActionScheduleTest.php


示例18: mappingList

 function mappingList()
 {
     if (empty($_GET['mappingID'])) {
         CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.'));
     }
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($_GET['mappingID']);
     $output = array('sel4' => array(), 'sel5' => array(), 'recipientMapping' => $selectionOptions['recipientMapping']);
     foreach (array(4, 5) as $sel) {
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_BAO_Address类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_Action类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap