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


PHP CRM_Event_BAO_Event::checkPermission方法代码示例

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


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

示例1: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     if ($this->_isTemplate) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'template_title');
     } else {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
     }
     if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
 }
开发者ID:agloa,项目名称:tournament,代码行数:17,代码来源:Delete.php

示例2: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $this->assign('currentEventId', $this->_id);
     $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
     //If this ID has parent, send parent id
     if ($checkParentExistsForThisId) {
         /**
          * Get connected event information list
          */
         //Get all connected event ids
         $allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
         $allEventIds = array();
         if (!empty($allEventIdsArray)) {
             foreach ($allEventIdsArray as $key => $val) {
                 $allEventIds[] = $val['id'];
             }
             if (!empty($allEventIds)) {
                 $params = array();
                 $query = "\n            SELECT *\n            FROM civicrm_event\n            WHERE id IN (" . implode(",", $allEventIds) . ")\n            ORDER BY start_date asc\n             ";
                 $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
                 $permissions = CRM_Event_BAO_Event::checkPermission();
                 while ($dao->fetch()) {
                     if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
                         $manageEvent[$dao->id] = array();
                         CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
                     }
                 }
             }
             $this->assign('rows', $manageEvent);
         }
     }
     $parentEventParams = array('id' => $this->_id);
     $parentEventValues = array();
     $parentEventReturnProperties = array('start_date', 'end_date');
     $parentEventAttributes = CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $parentEventParams, $parentEventValues, $parentEventReturnProperties);
     $this->_parentEventStartDate = $parentEventAttributes->start_date;
     $this->_parentEventEndDate = $parentEventAttributes->end_date;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:39,代码来源:Repeat.php

示例3: 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
         $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_mapping  map ON ( map.entity_value = 'civicrm_event' )\nLEFT JOIN  civicrm_action_schedule sch ON ( sch.mapping_id = map.id 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'));
         $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'])) {
                 $tabs[$key]['qfKey'] = NULL;
//.........这里部分代码省略.........
开发者ID:agloa,项目名称:tournament,代码行数:101,代码来源:TabHeader.php

示例4: getEventSummary

 /**
  * Function to get events Summary
  *
  * @static
  * @return array Array of event summary values
  */
 static function getEventSummary()
 {
     $eventSummary = $eventIds = array();
     require_once 'CRM/Core/Config.php';
     $config = CRM_Core_Config::singleton();
     // We're fetching recent and upcoming events (where start date is 7 days ago OR later)
     $query = "SELECT count(id) as total_events\n                  FROM   civicrm_event e\n                  WHERE  e.is_active=1 AND\n                        ( e.is_template IS NULL OR e.is_template = 0) AND\n                        e.start_date >= DATE_SUB( NOW(), INTERVAL 7 day );";
     $dao =& CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     if ($dao->fetch()) {
         $eventSummary['total_events'] = $dao->total_events;
     }
     if (empty($eventSummary) || $dao->total_events == 0) {
         return $eventSummary;
     }
     // Get the Id of Option Group for Event Types
     require_once 'CRM/Core/DAO/OptionGroup.php';
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = null;
     if ($optionGroupDAO->find(true)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     $query = "\nSELECT     civicrm_event.id as id, civicrm_event.title as event_title, civicrm_event.is_public as is_public,\n           civicrm_event.max_participants as max_participants, civicrm_event.start_date as start_date,\n           civicrm_event.end_date as end_date, civicrm_event.is_online_registration, civicrm_event.is_monetary, civicrm_event.is_show_location,civicrm_event.is_map as is_map, civicrm_option_value.label as event_type, civicrm_tell_friend.is_active as is_friend_active,\n           civicrm_event.summary as summary\nFROM       civicrm_event\nLEFT JOIN  civicrm_option_value ON (\n           civicrm_event.event_type_id = civicrm_option_value.value AND\n           civicrm_option_value.option_group_id = %1 )\nLEFT JOIN  civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_event.id  AND civicrm_tell_friend.entity_table = 'civicrm_event' )\nWHERE      civicrm_event.is_active = 1 AND\n           ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND\n           civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day )\nGROUP BY   civicrm_event.id\nORDER BY   civicrm_event.start_date ASC\nLIMIT      0, 10\n";
     $eventParticipant = array();
     $eventParticipant['participants'] = self::getParticipantCount();
     $eventParticipant['notCountedParticipants'] = self::getParticipantCount(true, false, true, false);
     $eventParticipant['notCountedDueToRole'] = self::getParticipantCount(false, false, true, false);
     $eventParticipant['notCountedDueToStatus'] = self::getParticipantCount(true, false, false, false);
     $properties = array('eventTitle' => 'event_title', 'isPublic' => 'is_public', 'maxParticipants' => 'max_participants', 'startDate' => 'start_date', 'endDate' => 'end_date', 'eventType' => 'event_type', 'isMap' => 'is_map', 'participants' => 'participants', 'notCountedDueToRole' => 'notCountedDueToRole', 'notCountedDueToStatus' => 'notCountedDueToStatus', 'notCountedParticipants' => 'notCountedParticipants');
     $permissions = CRM_Event_BAO_Event::checkPermission();
     $params = array(1 => array($optionGroupId, 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($query, $params);
     while ($dao->fetch()) {
         if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
             foreach ($properties as $property => $name) {
                 $set = null;
                 switch ($name) {
                     case 'is_public':
                         if ($dao->{$name}) {
                             $set = 'Yes';
                         } else {
                             $set = 'No';
                         }
                         $eventSummary['events'][$dao->id][$property] = $set;
                         break;
                     case 'is_map':
                         if ($dao->{$name} && $config->mapAPIKey) {
                             $params = array();
                             $values = array();
                             $ids = array();
                             $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
                             require_once 'CRM/Core/BAO/Location.php';
                             $values['location'] = CRM_Core_BAO_Location::getValues($params, true);
                             if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || $config->mapGeoCoding && $values['location']['address'][1]['city'] && $values['location']['address'][1]['state_province_id']) {
                                 $set = CRM_Utils_System::url('civicrm/contact/map/event', "reset=1&eid={$dao->id}");
                             }
                         }
                         $eventSummary['events'][$dao->id][$property] = $set;
                         if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
                             $eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url("civicrm/admin/event", "action=update&id={$dao->id}&reset=1");
                         }
                         break;
                     case 'end_date':
                     case 'start_date':
                         $eventSummary['events'][$dao->id][$property] = CRM_Utils_Date::customFormat($dao->{$name}, null, array('d'));
                         break;
                     case 'participants':
                     case 'notCountedDueToRole':
                     case 'notCountedDueToStatus':
                     case 'notCountedParticipants':
                         $propertyCnt = 0;
                         if (CRM_Utils_Array::value($dao->id, $eventParticipant[$name])) {
                             $propertyCnt = $eventParticipant[$name][$dao->id];
                             if ($name == 'participants') {
                                 $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=true&role=true");
                             } else {
                                 if ($name == 'notCountedParticipants') {
                                     // FIXME : selector fail to search w/ OR operator.
                                     // $set = CRM_Utils_System::url( 'civicrm/event/search',
                                     // "reset=1&force=1&event=$dao->id&status=false&role=false" );
                                 } else {
                                     if ($name == 'notCountedDueToStatus') {
                                         $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&status=false");
                                     } else {
                                         $set = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$dao->id}&role=false");
                                     }
                                 }
                             }
                         }
                         $eventSummary['events'][$dao->id][$property] = $propertyCnt;
                         $eventSummary['events'][$dao->id][$name . '_url'] = $set;
                         break;
                     default:
                         $eventSummary['events'][$dao->id][$property] = $dao->{$name};
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Event.php

示例5: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_mappingID = $mappingID = NULL;
     $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     //CRM-16777: Don't provide access to administer schedule reminder page, with user that does not have 'administer CiviCRM' permission
     if (empty($this->_context) && !CRM_Core_Permission::check('administer CiviCRM')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     } else {
         $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         if (!CRM_Event_BAO_Event::checkPermission($this->_compId, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         }
         $this->assign('reminderName', $reminderName);
         return;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         }
     } elseif (!empty($this->_context)) {
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
             $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_compId, 'is_template');
             $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
             if ($mapping) {
                 $this->_mappingID = $mapping->getId();
             } else {
                 CRM_Core_Error::fatal('Could not find mapping for event scheduled reminders.');
             }
         }
     }
     if (!empty($_POST) && !empty($_POST['entity']) && empty($this->_context)) {
         $mappingID = $_POST['entity'][0];
     } elseif ($this->_mappingID) {
         $mappingID = $this->_mappingID;
     }
     $this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'title'), TRUE);
     $mappings = CRM_Core_BAO_ActionSchedule::getMappings();
     $selectedMapping = $mappings[$mappingID ? $mappingID : 1];
     $entityRecipientLabels = $selectedMapping->getRecipientTypes() + CRM_Core_BAO_ActionSchedule::getAdditionalRecipients();
     $this->assign('entityMapping', json_encode(CRM_Utils_Array::collectMethod('getEntity', $mappings)));
     $this->assign('recipientMapping', json_encode(array_combine(array_keys($entityRecipientLabels), array_keys($entityRecipientLabels))));
     if (empty($this->_context)) {
         $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'));
         $sel->setOptions(array(CRM_Utils_Array::collectMethod('getLabel', $mappings), CRM_Core_BAO_ActionSchedule::getAllEntityValueLabels(), CRM_Core_BAO_ActionSchedule::getAllEntityStatusLabels()));
         if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
             // make second selector a multi-select -
             $sel->_elements[1]->setMultiple(TRUE);
             $sel->_elements[1]->setSize(5);
         }
         if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
             // make third selector a multi-select -
             $sel->_elements[2]->setMultiple(TRUE);
             $sel->_elements[2]->setSize(5);
         }
     } else {
         // Dig deeper - this code is sublimely stupid.
         $allEntityStatusLabels = CRM_Core_BAO_ActionSchedule::getAllEntityStatusLabels();
         $options = $allEntityStatusLabels[$this->_mappingID][0];
         $attributes = array('multiple' => 'multiple', 'class' => 'crm-select2 huge', 'placeholder' => $options[0]);
         unset($options[0]);
         $this->add('select', 'entity', ts('Recipient(s)'), $options, TRUE, $attributes);
         $this->assign('context', $this->_context);
     }
     //get the frequency units.
     $this->_freqUnits = CRM_Core_SelectValues::getRecurringFrequencyUnits();
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     $isActive = ts('Send email');
     $recordActivity = ts('Record activity for automated email');
     if ($providersCount) {
         $this->assign('sms', $providersCount);
         $isActive = ts('Send email or SMS');
         $recordActivity = ts('Record activity for automated email or SMS');
         $options = CRM_Core_OptionGroup::values('msg_mode');
         $this->add('select', 'mode', ts('Send as'), $options);
         $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc');
         $providerSelect = array();
         foreach ($providers as $provider) {
             $providerSelect[$provider['id']] = $provider['title'];
         }
         $this->add('select', 'sms_provider_id', ts('SMS Provider'), $providerSelect, TRUE);
     }
     foreach ($this->_freqUnits as $val => $label) {
         $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label));
     }
     $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing'));
     //reminder_frequency
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:ScheduleReminders.php

示例6: getEventSummary

 /**
  * Function to get events Summary
  *
  * @static
  *
  * @return array Array of event summary values
  */
 static function getEventSummary()
 {
     $eventSummary = $eventIds = array();
     $config = CRM_Core_Config::singleton();
     // get permission and include them here
     // does not scale, but rearranging code for now
     // FIXME in a future release
     $permissions = CRM_Event_BAO_Event::checkPermission();
     $validEventIDs = '';
     if (empty($permissions[CRM_Core_Permission::VIEW])) {
         $eventSummary['total_events'] = 0;
         return $eventSummary;
     } else {
         $validEventIDs = " AND civicrm_event.id IN ( " . implode(',', array_values($permissions[CRM_Core_Permission::VIEW])) . " ) ";
     }
     // We're fetching recent and upcoming events (where start date is 7 days ago OR later)
     $query = "\nSELECT     count(id) as total_events\nFROM       civicrm_event\nWHERE      civicrm_event.is_active = 1 AND\n           ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND\n           civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day )\n           {$validEventIDs}";
     $dao = CRM_Core_DAO::executeQuery($query);
     if ($dao->fetch()) {
         $eventSummary['total_events'] = $dao->total_events;
     }
     if (empty($eventSummary) || $dao->total_events == 0) {
         return $eventSummary;
     }
     //get the participant status type values.
     $cpstObject = new CRM_Event_DAO_ParticipantStatusType();
     $cpst = $cpstObject->getTableName();
     $query = "SELECT id, name, label, class FROM {$cpst}";
     $status = CRM_Core_DAO::executeQuery($query);
     $statusValues = array();
     while ($status->fetch()) {
         $statusValues[$status->id]['id'] = $status->id;
         $statusValues[$status->id]['name'] = $status->name;
         $statusValues[$status->id]['label'] = $status->label;
         $statusValues[$status->id]['class'] = $status->class;
     }
     // Get the Id of Option Group for Event Types
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = NULL;
     if ($optionGroupDAO->find(TRUE)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     // Get the event summary display preferences
     $show_max_events = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'show_events');
     // default to 10 if no option is set
     if (is_null($show_max_events)) {
         $show_max_events = 10;
     }
     // show all events if show_events is set to a negative value
     if ($show_max_events >= 0) {
         $event_summary_limit = "LIMIT      0, {$show_max_events}";
     } else {
         $event_summary_limit = "";
     }
     $query = "\nSELECT     civicrm_event.id as id, civicrm_event.title as event_title, civicrm_event.is_public as is_public,\n           civicrm_event.max_participants as max_participants, civicrm_event.start_date as start_date,\n           civicrm_event.end_date as end_date, civicrm_event.is_online_registration, civicrm_event.is_monetary, civicrm_event.is_show_location,civicrm_event.is_map as is_map, civicrm_option_value.label as event_type, civicrm_tell_friend.is_active as is_friend_active,\n           civicrm_event.slot_label_id,\n           civicrm_event.summary as summary,\n           civicrm_pcp_block.id as is_pcp_enabled\nFROM       civicrm_event\nLEFT JOIN  civicrm_option_value ON (\n           civicrm_event.event_type_id = civicrm_option_value.value AND\n           civicrm_option_value.option_group_id = %1 )\nLEFT JOIN  civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_event.id  AND civicrm_tell_friend.entity_table = 'civicrm_event' )\nLEFT JOIN  civicrm_pcp_block ON ( civicrm_pcp_block.entity_id = civicrm_event.id AND civicrm_pcp_block.entity_table = 'civicrm_event')\nWHERE      civicrm_event.is_active = 1 AND\n           ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND\n           civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day )\n           {$validEventIDs}\nGROUP BY   civicrm_event.id\nORDER BY   civicrm_event.start_date ASC\n{$event_summary_limit}\n";
     $eventParticipant = array();
     $properties = array('id' => 'id', 'eventTitle' => 'event_title', 'isPublic' => 'is_public', 'maxParticipants' => 'max_participants', 'startDate' => 'start_date', 'endDate' => 'end_date', 'eventType' => 'event_type', 'isMap' => 'is_map', 'participants' => 'participants', 'notCountedDueToRole' => 'notCountedDueToRole', 'notCountedDueToStatus' => 'notCountedDueToStatus', 'notCountedParticipants' => 'notCountedParticipants');
     $params = array(1 => array($optionGroupId, 'Integer'));
     $mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'civicrm_event', 'id', 'entity_value');
     $dao = CRM_Core_DAO::executeQuery($query, $params);
     while ($dao->fetch()) {
         foreach ($properties as $property => $name) {
             $set = NULL;
             switch ($name) {
                 case 'is_public':
                     if ($dao->{$name}) {
                         $set = 'Yes';
                     } else {
                         $set = 'No';
                     }
                     $eventSummary['events'][$dao->id][$property] = $set;
                     break;
                 case 'is_map':
                     if ($dao->{$name} && $config->mapAPIKey) {
                         $values = array();
                         $ids = array();
                         $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
                         $values['location'] = CRM_Core_BAO_Location::getValues($params, TRUE);
                         if (is_numeric(CRM_Utils_Array::value('geo_code_1', $values['location']['address'][1])) || $config->mapGeoCoding && !empty($values['location']['address'][1]['city']) && !empty($values['location']['address'][1]['state_province_id'])) {
                             $set = CRM_Utils_System::url('civicrm/contact/map/event', "reset=1&eid={$dao->id}");
                         }
                     }
                     $eventSummary['events'][$dao->id][$property] = $set;
                     if (in_array($dao->id, $permissions[CRM_Core_Permission::EDIT])) {
                         $eventSummary['events'][$dao->id]['configure'] = CRM_Utils_System::url('civicrm/admin/event', "action=update&id={$dao->id}&reset=1");
                     }
                     break;
                 case 'end_date':
                 case 'start_date':
                     $eventSummary['events'][$dao->id][$property] = CRM_Utils_Date::customFormat($dao->{$name}, NULL, array('d'));
                     break;
                 case 'participants':
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Event.php

示例7: browse

 /**
  * browse all events
  * 
  * @return void
  */
 function browse()
 {
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     if ($this->_sortByCharacter == 1 || !empty($_POST)) {
         $this->_sortByCharacter = '';
         $this->set('sortByCharacter', '');
     }
     $this->_force = null;
     $this->_searchResult = null;
     $this->search();
     $config =& CRM_Core_Config::singleton();
     $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);
     $whereClause .= ' AND (is_template = 0 OR is_template IS NULL)';
     // because is_template != 1 would be to simple
     $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();
     while ($dao->fetch()) {
         if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
             $manageEvent[$dao->id] = array();
             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));
             $params = array('entity_id' => $dao->id, 'entity_table' => 'civicrm_event');
             require_once 'CRM/Core/BAO/Location.php';
             $defaults['location'] = CRM_Core_BAO_Location::getValues($params, true);
             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']);
             }
         }
     }
     $this->assign('rows', $manageEvent);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:63,代码来源:ManageEvent.php

示例8: 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

示例9: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->_mappingID = $mappingID = NULL;
     $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     //CRM-16777: Don't provide access to administer schedule reminder page, with user that does not have 'administer CiviCRM' permission
     if (empty($this->_context) && !CRM_Core_Permission::check('administer CiviCRM')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     } else {
         $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         if (!CRM_Event_BAO_Event::checkPermission($this->_compId, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         $reminderName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'title');
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         }
         $this->assign('reminderName', $reminderName);
         return;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
         }
     } elseif (!empty($this->_context)) {
         if ($this->_context == 'event') {
             $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
             $field = 'civicrm_event';
             $isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_compId, 'is_template');
             if ($isTemplate) {
                 $field = 'event_template';
             }
             $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value');
             if (!$this->_mappingID) {
                 CRM_Core_Error::fatal('Could not find mapping for event scheduled reminders.');
             }
         }
     }
     if (!empty($_POST) && !empty($_POST['entity']) && empty($this->_context)) {
         $mappingID = $_POST['entity'][0];
     } elseif ($this->_mappingID) {
         $mappingID = $this->_mappingID;
     }
     $this->add('text', 'title', ts('Title'), array('size' => 45, 'maxlength' => 128), TRUE);
     $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($mappingID);
     extract($selectionOptions);
     $this->assign('entityMapping', json_encode($entityMapping));
     $this->assign('recipientMapping', json_encode($recipientMapping));
     if (empty($this->_context)) {
         if (empty($sel1)) {
             CRM_Core_Error::fatal('Could not find mapping for scheduled reminders.');
         }
         $sel =& $this->add('hierselect', 'entity', ts('Entity'), array('name' => 'entity[0]', 'style' => 'vertical-align: top;'));
         $sel->setOptions(array($sel1, $sel2, $sel3));
         if (is_a($sel->_elements[1], 'HTML_QuickForm_select')) {
             // make second selector a multi-select -
             $sel->_elements[1]->setMultiple(TRUE);
             $sel->_elements[1]->setSize(5);
         }
         if (is_a($sel->_elements[2], 'HTML_QuickForm_select')) {
             // make third selector a multi-select -
             $sel->_elements[2]->setMultiple(TRUE);
             $sel->_elements[2]->setSize(5);
         }
     } else {
         $options = $sel3[$this->_mappingID][0];
         $attributes = array('multiple' => 'multiple', 'class' => 'crm-select2 huge', 'placeholder' => $options[0]);
         unset($options[0]);
         $this->add('select', 'entity', ts('Recipient(s)'), $options, TRUE, $attributes);
         $this->assign('context', $this->_context);
     }
     //get the frequency units.
     $this->_freqUnits = CRM_Core_SelectValues::getRecurringFrequencyUnits();
     //pass the mapping ID in UPDATE mode
     $mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
     $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
     //reminder_interval
     $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
     $isActive = ts('Send email');
     $recordActivity = ts('Record activity for automated email');
     if ($providersCount) {
         $this->assign('sms', $providersCount);
         $isActive = ts('Send email or SMS');
         $recordActivity = ts('Record activity for automated email or SMS');
         $options = CRM_Core_OptionGroup::values('msg_mode');
         $this->add('select', 'mode', ts('Send as'), $options);
         $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc');
         $providerSelect = array();
         foreach ($providers as $provider) {
             $providerSelect[$provider['id']] = $provider['title'];
         }
         $this->add('select', 'sms_provider_id', ts('SMS Provider'), $providerSelect, TRUE);
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:ScheduleReminders.php

示例10: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $config = CRM_Core_Config::singleton();
     if (in_array('CiviEvent', $config->enableComponents)) {
         $this->assign('CiviEvent', TRUE);
     }
     CRM_Core_Form_RecurringEntity::preProcess('civicrm_event');
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
     $this->assign('action', $this->_action);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'GET');
     if ($this->_id) {
         $this->_isRepeatingEvent = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
         $this->assign('eventId', $this->_id);
         if (!empty($this->_addBlockName) && empty($this->_addProfileBottom) && empty($this->_addProfileBottomAdd)) {
             $this->add('hidden', 'id', $this->_id);
         }
         $this->_single = TRUE;
         $params = array('id' => $this->_id);
         CRM_Event_BAO_Event::retrieve($params, $eventInfo);
         // its an update mode, do a permission check
         if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
         }
         $participantListingID = CRM_Utils_Array::value('participant_listing_id', $eventInfo);
         //CRM_Core_DAO::getFieldValue( 'CRM_Event_DAO_Event', $this->_id, 'participant_listing_id' );
         if ($participantListingID) {
             $participantListingURL = CRM_Utils_System::url('civicrm/event/participant', "reset=1&id={$this->_id}", TRUE, NULL, TRUE, TRUE);
             $this->assign('participantListingURL', $participantListingURL);
         }
         $this->assign('isOnlineRegistration', CRM_Utils_Array::value('is_online_registration', $eventInfo));
         $this->assign('id', $this->_id);
     }
     // figure out whether we’re handling an event or an event template
     if ($this->_id) {
         $this->_isTemplate = CRM_Utils_Array::value('is_template', $eventInfo);
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         $this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
     }
     $this->assign('isTemplate', $this->_isTemplate);
     if ($this->_id) {
         if ($this->_isTemplate) {
             $title = CRM_Utils_Array::value('template_title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Edit Event Template') . " - {$title}");
         } else {
             $configureText = ts('Configure Event');
             $title = CRM_Utils_Array::value('title', $eventInfo);
             //If it is a repeating event change title
             if ($this->_isRepeatingEvent) {
                 $configureText = 'Configure Repeating Event';
             }
             CRM_Utils_System::setTitle($configureText . " - {$title}");
         }
         $this->assign('title', $title);
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         if ($this->_isTemplate) {
             $title = ts('New Event Template');
             CRM_Utils_System::setTitle($title);
         } else {
             $title = ts('New Event');
             CRM_Utils_System::setTitle($title);
         }
         $this->assign('title', $title);
     }
     if (CRM_Core_Permission::check('view event participants') && CRM_Core_Permission::check('view all contacts')) {
         $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1', 'label');
         $statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0', 'label');
         $findParticipants['statusCounted'] = implode(', ', array_values($statusTypes));
         $findParticipants['statusNotCounted'] = implode(', ', array_values($statusTypesPending));
         $this->assign('findParticipants', $findParticipants);
     }
     $this->_templateId = (int) CRM_Utils_Request::retrieve('template_id', 'Integer', $this);
     //Is a repeating event
     if ($this->_isRepeatingEvent) {
         $isRepeatingEntity = TRUE;
         $this->assign('isRepeatingEntity', $isRepeatingEntity);
     }
     // CRM-16776 - show edit/copy/create buttons for Profiles if user has required permission.
     $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
     $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups);
     $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups);
     $checkPermission = array(array('administer CiviCRM', 'manage event profiles'));
     if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) {
         $this->assign('perm', TRUE);
     }
     // also set up tabs
     CRM_Event_Form_ManageEvent_TabHeader::build($this);
     // Set Done button URL and breadcrumb. Templates go back to Manage Templates,
     // otherwise go to Manage Event for new event or ManageEventEdit if event if exists.
     $breadCrumb = array();
     if (!$this->_isTemplate) {
         if ($this->_id) {
             $this->_doneUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "action=update&reset=1&id={$this->_id}");
         } else {
             $this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage', 'reset=1');
             $breadCrumb = array(array('title' => ts('Manage Events'), 'url' => $this->_doneUrl));
//.........这里部分代码省略.........
开发者ID:agloa,项目名称:tournament,代码行数:101,代码来源:ManageEvent.php

示例11: run

 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the  
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
     // default to 'browse'
     $config =& CRM_Core_Config::singleton();
     if (in_array("CiviEvent", $config->enableComponents)) {
         $this->assign('CiviEvent', true);
     }
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
     if ($this->_id) {
         $params = array('id' => $this->_id);
         require_once 'CRM/Event/BAO/Event.php';
         CRM_Event_BAO_Event::retrieve($params, $eventInfo);
         // its an update mode, do a permission check
         require_once 'CRM/Event/BAO/Event.php';
         if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
     }
     // figure out whether we’re handling an event or an event template
     if ($this->_id) {
         $this->_isTemplate = CRM_Utils_Array::value('is_template', $eventInfo);
     } elseif ($action & CRM_Core_Action::ADD) {
         $this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
     }
     // assign vars to templates
     $this->assign('action', $action);
     $this->assign('id', $this->_id);
     $this->assign('isTemplate', $this->_isTemplate);
     $this->assign('isOnlineRegistration', CRM_Utils_Array::value('is_online_registration', $eventInfo));
     $subPage = CRM_Utils_Request::retrieve('subPage', 'String', $this);
     if (!$subPage && $action & CRM_Core_Action::ADD) {
         $subPage = 'EventInfo';
     }
     if ($this->_id) {
         if ($this->_isTemplate) {
             $title = CRM_Utils_Array::value('template_title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Edit Event Template') . " - {$title}");
         } else {
             $title = CRM_Utils_Array::value('title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Configure Event') . " - {$title}");
         }
         $this->assign('title', $title);
     } else {
         if ($action & CRM_Core_Action::ADD) {
             if ($this->_isTemplate) {
                 $title = ts('New Event Template');
                 CRM_Utils_System::setTitle($title);
             } else {
                 $title = ts('New Event');
                 CRM_Utils_System::setTitle($title);
             }
             $this->assign('title', $title);
         }
     }
     require_once 'CRM/Event/PseudoConstant.php';
     $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));
     $findParticipants['urlCounted'] = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$this->_id}&status=true");
     $findParticipants['urlNotCounted'] = CRM_Utils_System::url('civicrm/event/search', "reset=1&force=1&event={$this->_id}&status=false");
     $this->assign('findParticipants', $findParticipants);
     if ($this->_id) {
         $participantListingID = CRM_Utils_Array::value('participant_listing_id', $eventInfo);
         if ($participantListingID) {
             $participantListingURL = CRM_Utils_System::url('civicrm/event/participant', "reset=1&id={$this->_id}", true, null, true, true);
             $this->assign('participantListingURL', $participantListingURL);
         }
     }
     $form = null;
     switch ($subPage) {
         case 'EventInfo':
             $form = 'CRM_Event_Form_ManageEvent_EventInfo';
             break;
         case 'Location':
             $form = 'CRM_Event_Form_ManageEvent_Location';
             break;
         case 'Fee':
             $form = 'CRM_Event_Form_ManageEvent_Fee';
             break;
         case 'Registration':
             $form = 'CRM_Event_Form_ManageEvent_Registration';
             break;
         case 'Friend':
             $form = 'CRM_Friend_Form_Event';
             break;
     }
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:ManageEventEdit.php

示例12: preProcess

 /** 
  * Function to set variables up before form is built 
  *                                                           
  * @return void 
  * @access public 
  */
 function preProcess()
 {
     $config = CRM_Core_Config::singleton();
     if (in_array("CiviEvent", $config->enableComponents)) {
         $this->assign('CiviEvent', true);
     }
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add', 'REQUEST');
     $this->assign('action', $this->_action);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
     if ($this->_id) {
         $this->assign('eventId', $this->_id);
         $this->add('hidden', 'id', $this->_id);
         $this->_single = true;
         $params = array('id' => $this->_id);
         require_once 'CRM/Event/BAO/Event.php';
         CRM_Event_BAO_Event::retrieve($params, $eventInfo);
         // its an update mode, do a permission check
         require_once 'CRM/Event/BAO/Event.php';
         if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
         }
         $participantListingID = CRM_Utils_Array::value('participant_listing_id', $eventInfo);
         //CRM_Core_DAO::getFieldValue( 'CRM_Event_DAO_Event', $this->_id, 'participant_listing_id' );
         if ($participantListingID) {
             $participantListingURL = CRM_Utils_System::url('civicrm/event/participant', "reset=1&id={$this->_id}", true, null, true, true);
             $this->assign('participantListingURL', $participantListingURL);
         }
         $this->assign('isOnlineRegistration', CRM_Utils_Array::value('is_online_registration', $eventInfo));
         $this->assign('id', $this->_id);
     }
     // figure out whether we’re handling an event or an event template
     if ($this->_id) {
         $this->_isTemplate = CRM_Utils_Array::value('is_template', $eventInfo);
     } elseif ($this->_action & CRM_Core_Action::ADD) {
         $this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
     }
     $this->assign('isTemplate', $this->_isTemplate);
     if ($this->_id) {
         if ($this->_isTemplate) {
             $title = CRM_Utils_Array::value('template_title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Edit Event Template') . " - {$title}");
         } else {
             $title = CRM_Utils_Array::value('title', $eventInfo);
             CRM_Utils_System::setTitle(ts('Configure Event') . " - {$title}");
         }
         $this->assign('title', $title);
     } else {
         if ($this->_action & CRM_Core_Action::ADD) {
             if ($this->_isTemplate) {
                 $title = ts('New Event Template');
                 CRM_Utils_System::setTitle($title);
             } else {
                 $title = ts('New Event');
                 CRM_Utils_System::setTitle($title);
             }
             $this->assign('title', $title);
         }
     }
     require_once 'CRM/Event/PseudoConstant.php';
     $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);
     $this->_templateId = (int) CRM_Utils_Request::retrieve('template_id', 'Integer', $this);
     // also set up tabs
     require_once 'CRM/Event/Form/ManageEvent/TabHeader.php';
     CRM_Event_Form_ManageEvent_TabHeader::build($this);
     // Set Done button URL and breadcrumb. Templates go back to Manage Templates,
     // otherwise go to Manage Event for new event or ManageEventEdit if event if exists.
     $breadCrumb = array();
     if (!$this->_isTemplate) {
         if ($this->_id) {
             $this->_doneUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "action=update&reset=1&id={$this->_id}");
         } else {
             $this->_doneUrl = CRM_Utils_System::url('civicrm/event/manage', 'reset=1');
             $breadCrumb = array(array('title' => ts('Manage Events'), 'url' => $this->_doneUrl));
         }
     } else {
         $this->_doneUrl = CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1');
         $breadCrumb = array(array('title' => ts('Manage Event Templates'), 'url' => $this->_doneUrl));
     }
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:90,代码来源:ManageEvent.php


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