Ejemplo n.º 1
0
 /**
  * Browse all mail settings.
  */
 public function browse()
 {
     //get all mail settings.
     $allMailSettings = array();
     $mailSetting = new CRM_Core_DAO_MailSettings();
     $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
     //multi-domain support for mail settings. CRM-5244
     $mailSetting->domain_id = CRM_Core_Config::domainID();
     //find all mail settings.
     $mailSetting->find();
     while ($mailSetting->fetch()) {
         //replace protocol value with name
         $mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols);
         CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]);
         //form all action links
         $action = array_sum(array_keys($this->links()));
         // disallow the DELETE action for the default set of settings
         if ($mailSetting->is_default) {
             $action &= ~CRM_Core_Action::DELETE;
         }
         //add action links.
         $allMailSettings[$mailSetting->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $mailSetting->id), ts('more'), FALSE, 'mailSetting.manage.action', 'MailSetting', $mailSetting->id);
     }
     $this->assign('rows', $allMailSettings);
 }
Ejemplo n.º 2
0
 /**
  * Function to list memberships for the UF user
  * 
  * return null
  * @access public
  */
 function listMemberships()
 {
     $membership = array();
     require_once "CRM/Member/BAO/Membership.php";
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     $dao->find();
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         //get the membership status and type values.
         $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeVaues($dao->id);
         foreach (array('status', 'membership_type') as $fld) {
             $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
         }
         if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id])) {
             $membership[$dao->id]['active'] = true;
         }
         $membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id);
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
 }
 public function setDefaultValues()
 {
     $defaults = array();
     $dao = new CRM_PCP_DAO_PCP();
     if ($this->_pageId) {
         $dao->id = $this->_pageId;
         if ($dao->find(TRUE)) {
             CRM_Core_DAO::storeValues($dao, $defaults);
         }
         // fix the display of the monetary value, CRM-4038
         if (isset($defaults['goal_amount'])) {
             $defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a');
         }
         $defaults['pcp_title'] = CRM_Utils_Array::value('title', $defaults);
         $defaults['pcp_intro_text'] = CRM_Utils_Array::value('intro_text', $defaults);
     }
     if ($this->get('action') & CRM_Core_Action::ADD) {
         $defaults['is_active'] = 1;
         $defaults['is_honor_roll'] = 1;
         $defaults['is_thermometer'] = 1;
         $defaults['is_notify'] = 1;
     }
     $this->_contactID = CRM_Utils_Array::value('contact_id', $defaults);
     $this->_contriPageId = CRM_Utils_Array::value('page_id', $defaults);
     return $defaults;
 }
 function setDefaultValues()
 {
     $dafaults = array();
     $dao = new CRM_PCP_DAO_PCP();
     if ($this->_pageId) {
         $dao->id = $this->_pageId;
         if ($dao->find(TRUE)) {
             CRM_Core_DAO::storeValues($dao, $defaults);
         }
         // fix the display of the monetary value, CRM-4038
         if (isset($defaults['goal_amount'])) {
             $defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a');
         }
         $defaults['pcp_title'] = CRM_Utils_Array::value('title', $defaults);
         $defaults['pcp_intro_text'] = CRM_Utils_Array::value('intro_text', $defaults);
     }
     if ($this->get('action') & CRM_Core_Action::ADD) {
         $defaults['is_active'] = 1;
         $defaults['is_honor_roll'] = 1;
         $defaults['is_thermometer'] = 1;
     }
     $this->_contactID = CRM_Utils_Array::value('contact_id', $defaults);
     $this->_contriPageId = CRM_Utils_Array::value('page_id', $defaults);
     //MV: to set customData default values;
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $customDataDefaults = CRM_Custom_Form_CustomData::setDefaultValues($this);
         $defaults += $customDataDefaults;
     }
     //END
     return $defaults;
 }
Ejemplo n.º 5
0
 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  * @return void
  */
 function setDefaultValues()
 {
     //parent::setDefaultValues();
     $defaults = array();
     if (isset($this->_id)) {
         require_once 'CRM/Member/DAO/MembershipBlock.php';
         $dao =& new CRM_Member_DAO_MembershipBlock();
         $dao->entity_table = 'civicrm_contribution_page';
         $dao->entity_id = $this->_id;
         $dao->find(true);
         CRM_Core_DAO::storeValues($dao, $defaults);
     }
     // for membership_types
     if (isset($defaults['membership_types'])) {
         $membershipType = explode(',', $defaults['membership_types']);
         $newMembershipType = array();
         foreach ($membershipType as $k => $v) {
             $newMembershipType[$v] = 1;
         }
         $defaults['membership_type'] = $newMembershipType;
     }
     // Set Display Minimum Fee default to true if we are adding a new membership block
     if (!isset($defaults['id'])) {
         $defaults['display_min_fee'] = 1;
     } else {
         $this->assign('membershipBlockId', $defaults['id']);
     }
     return $defaults;
 }
Ejemplo n.º 6
0
 /**
  * Function to list memberships for the UF user
  *
  * return null
  * @access public
  */
 function listMemberships()
 {
     $membership = array();
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     $dao->find();
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         //get the membership status and type values.
         $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
         foreach (array('status', 'membership_type') as $fld) {
             $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
         }
         if (!empty($statusANDType[$dao->id]['is_current_member'])) {
             $membership[$dao->id]['active'] = TRUE;
         }
         $membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id);
         if (!$membership[$dao->id]['renewPageId']) {
             // Membership payment was not done via online contribution page or free membership. Check for default membership renewal page from CiviMember Settings
             $defaultRenewPageId = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME, 'default_renewal_contribution_page');
             if ($defaultRenewPageId) {
                 $membership[$dao->id]['renewPageId'] = $defaultRenewPageId;
             }
         }
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
 }
Ejemplo n.º 7
0
 /**
  * Browse all event templates.
  */
 public function browse()
 {
     //get all event templates.
     $allEventTemplates = array();
     $eventTemplate = new CRM_Event_DAO_Event();
     $eventTypes = CRM_Event_PseudoConstant::eventType();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $participantListings = CRM_Event_PseudoConstant::participantListing();
     //find all event templates.
     $eventTemplate->is_template = TRUE;
     $eventTemplate->find();
     while ($eventTemplate->fetch()) {
         CRM_Core_DAO::storeValues($eventTemplate, $allEventTemplates[$eventTemplate->id]);
         //get listing types.
         if ($eventTemplate->participant_listing_id) {
             $allEventTemplates[$eventTemplate->id]['participant_listing'] = $participantListings[$eventTemplate->participant_listing_id];
         }
         //get participant role
         if ($eventTemplate->default_role_id) {
             $allEventTemplates[$eventTemplate->id]['participant_role'] = $participantRoles[$eventTemplate->default_role_id];
         }
         //get event type.
         if (isset($eventTypes[$eventTemplate->event_type_id])) {
             $allEventTemplates[$eventTemplate->id]['event_type'] = $eventTypes[$eventTemplate->event_type_id];
         }
         //form all action links
         $action = array_sum(array_keys($this->links()));
         //add action links.
         $allEventTemplates[$eventTemplate->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $eventTemplate->id), ts('more'), FALSE, 'eventTemplate.manage.action', 'Event', $eventTemplate->id);
     }
     $this->assign('rows', $allEventTemplates);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
 }
Ejemplo n.º 8
0
 /**
  * Function to list memberships for the UF user
  * 
  * return null
  * @access public
  */
 function listMemberships()
 {
     $idList = array('membership_type' => 'MembershipType', 'status' => 'MembershipStatus');
     $membership = array();
     require_once "CRM/Member/BAO/Membership.php";
     $dao =& new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     $dao->find();
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         foreach ($idList as $name => $file) {
             if ($membership[$dao->id][$name . '_id']) {
                 $membership[$dao->id][$name] = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_{$file}", $membership[$dao->id][$name . '_id']);
             }
         }
         if ($dao->status_id) {
             $active = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $dao->status_id, 'is_current_member');
             if ($active) {
                 $membership[$dao->id]['active'] = $active;
             }
         }
         $membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id);
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
 }
Ejemplo n.º 9
0
 /**
  * Given the list of params in the params array, fetch the object
  * and store the values in the values array
  *
  * @param Object $block         typically a Phone|Email|IM object
  * @param string $blockName     name of the above object
  * @param array  $params        input parameters to find object
  * @param array  $values        output values of the object
  * @param array  $ids           the array that holds all the db ids
  * @param int    $blockCount    number of blocks to fetch
  *
  * @return array of $block objects.
  * @access public
  * @static
  */
 function &getValues(&$block, $blockName, &$params, &$values, &$ids, $blockCount = 0)
 {
     $block->copyValues($params);
     $flatten = false;
     if (empty($blockCount)) {
         $blockCount = 1;
         $flatten = true;
     } else {
         $values[$blockName] = array();
         $ids[$blockName] = array();
     }
     $blocks = array();
     // we first get the primary location due to the order by clause
     $block->orderBy('is_primary desc');
     $block->find();
     for ($i = 0; $i < $blockCount; $i++) {
         if ($block->fetch()) {
             if ($flatten) {
                 CRM_Core_DAO::storeValues($block, $values);
                 $ids[$blockName] = $block->id;
             } else {
                 $values[$blockName][$i + 1] = array();
                 CRM_Core_DAO::storeValues($block, $values[$blockName][$i + 1]);
                 $ids[$blockName][$i + 1] = $block->id;
             }
             $blocks[$i + 1] = clone $block;
         }
     }
     return $blocks;
 }
 function browse()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $statusTypes = array();
     $dao = new CRM_Event_DAO_ParticipantStatusType();
     $dao->orderBy('weight');
     $dao->find();
     $visibilities = CRM_Core_PseudoConstant::visibility();
     // these statuses are reserved, but disabled by default - so should be disablable after being enabled
     $disablable = array('On waitlist', 'Awaiting approval', 'Pending from waitlist', 'Pending from approval', 'Rejected');
     while ($dao->fetch()) {
         CRM_Core_DAO::storeValues($dao, $statusTypes[$dao->id]);
         $action = array_sum(array_keys($this->links()));
         if ($dao->is_reserved) {
             $action -= CRM_Core_Action::DELETE;
             if (!in_array($dao->name, $disablable)) {
                 $action -= CRM_Core_Action::DISABLE;
             }
         }
         $action -= $dao->is_active ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
         $statusTypes[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'participantStatusType.manage.action', 'ParticipantStatusType', $dao->id);
         $statusTypes[$dao->id]['visibility'] = $visibilities[$dao->visibility_id];
     }
     $this->assign('rows', $statusTypes);
 }
Ejemplo n.º 11
0
 /**
  * Trigger a rule for this trigger
  *
  * @param $op
  * @param $objectName
  * @param $objectId
  * @param $objectRef
  */
 public function triggerTrigger($op, $objectName, $objectId, $objectRef)
 {
     $t = $this->getTriggerDataFromPost($op, $objectName, $objectId, $objectRef);
     //trigger for each client
     $clients = CRM_Case_BAO_Case::getCaseClients($objectId);
     foreach ($clients as $client) {
         $triggerData = clone $t;
         $triggerData->setEntityData('Relationship', null);
         $triggerData->setContactId($client);
         CRM_Civirules_Engine::triggerRule($this, $triggerData);
     }
     //trigger for each case role
     $relatedContacts = CRM_Case_BAO_Case::getRelatedContacts($objectId);
     foreach ($relatedContacts as $contact) {
         $triggerData = clone $t;
         $relationshipData = null;
         $relationship = new CRM_Contact_BAO_Relationship();
         $relationship->contact_id_b = $contact['contact_id'];
         $relationship->case_id = $objectId;
         if ($relationship->find(true)) {
             CRM_Core_DAO::storeValues($relationship, $relationshipData);
         }
         $triggerData->setEntityData('Relationship', $relationshipData);
         $triggerData->setContactId($contact['contact_id']);
         CRM_Civirules_Engine::triggerRule($this, $triggerData);
     }
 }
Ejemplo n.º 12
0
 function buildQuickForm()
 {
     $this->add('text', 'title', ts('Title'), true, true)->setSize(45);
     // add form elements
     $this->add('select', 'widget', 'Widget', $this->getWidgets(), true);
     $this->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'next', 'name' => ts('Save & Preview'))));
     if (isset($this->_id)) {
         $query = "SELECT * FROM civicrm_wci_embed_code WHERE id= %1";
         $params = array(1 => array($this->_id, 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode');
         while ($dao->fetch()) {
             $emb_code[$dao->id] = array();
             CRM_Core_DAO::storeValues($dao, $emb_code[$dao->id]);
             $this->setDefaults(array('title' => $emb_code[$dao->id]['name']));
             $this->setDefaults(array('widget' => $emb_code[$dao->id]['widget_id']));
         }
         CRM_Utils_System::setTitle(ts('Edit embed code'));
         $this->assign('widget_id', $emb_code[$dao->id]['widget_id']);
     } else {
         CRM_Utils_System::setTitle(ts('New embed code'));
     }
     // export form elements
     $this->assign('elementNames', $this->getRenderableElementNames());
     parent::buildQuickForm();
 }
 /**
  * View details of a recurring contribution.
  */
 public function view()
 {
     $recur = new CRM_Contribute_DAO_ContributionRecur();
     $recur->id = $this->_id;
     if ($recur->find(TRUE)) {
         $values = array();
         CRM_Core_DAO::storeValues($recur, $values);
         // if there is a payment processor ID, get the name of the payment processor
         if (!empty($values['payment_processor_id'])) {
             $values['payment_processor'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', $values['payment_processor_id'], 'name');
         }
         $idFields = array('contribution_status_id', 'campaign_id');
         if (CRM_Contribute_BAO_ContributionRecur::supportsFinancialTypeChange($values['id'])) {
             $idFields[] = 'financial_type_id';
         }
         foreach ($idFields as $idField) {
             if (!empty($values[$idField])) {
                 $values[substr($idField, 0, -3)] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionRecur', $idField, $values[$idField]);
             }
         }
         // Get financial type name
         if (!empty($values['financial_type_id'])) {
             $values['financial_type_name'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'financial_type_id', $values['financial_type_id']);
         }
         // Get Paid By label
         if (!empty($values['payment_instrument_id'])) {
             $values['payment_instrument'] = CRM_Core_OptionGroup::getLabel('payment_instrument', $values['payment_instrument_id']);
         }
         $this->assign('recur', $values);
         $this->assign('customDataType', 'ContributionRecur');
         $groupTree = CRM_Core_BAO_CustomGroup::getTree('ContributionRecur', $this, $this->_id);
         CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     }
 }
Ejemplo n.º 14
0
 function preProcess()
 {
     $this->_id = $this->get('id');
     $config = CRM_Core_Config::singleton();
     $currencySymbols = "";
     if (!empty($config->currencySymbols)) {
         $currencySymbols = $config->currencySymbols;
     } else {
         $currencySymbols = $config->defaultCurrencySymbol;
     }
     $this->assign('currencySymbols', $currencySymbols);
     //Control the flexibility of time configuration for unlimited resource
     $bookingConfig = CRM_Booking_BAO_BookingConfig::getConfig();
     $this->assign('timeconfig', CRM_Utils_Array::value('unlimited_resource_time_config', $bookingConfig));
     $selectResourcePage = $this->controller->exportValues('SelectResource');
     $selectedResources = json_decode($selectResourcePage['resources'], true);
     $this->assign('resources', $selectedResources);
     foreach ($selectedResources as $key => $resource) {
         $this->_subTotal += $resource['price'];
         $this->_resourcesPrice[$key] = $resource['price'];
         $this->_discountAmount = 0;
     }
     $this->_total = $this->_subTotal;
     require_once 'CRM/Booking/Utils/DateTime.php';
     $this->assign('timeOptions', CRM_Booking_Utils_DateTime::getTimeRange());
     // get all custom groups sorted by weight
     $items = array();
     $bao = new CRM_Booking_BAO_AdhocChargesItem();
     $bao->orderBy('weight');
     $bao->is_active = 1;
     $bao->is_deleted = 0;
     $bao->find();
     while ($bao->fetch()) {
         $items[$bao->id] = array();
         CRM_Core_DAO::storeValues($bao, $items[$bao->id]);
         $items[$bao->id]['name'] = preg_replace('/[^\\p{L}\\p{N}\\s]/u', '_', $items[$bao->id]['name']);
     }
     //$days = CRM_Booking_Utils_DateTime::getDays();
     //$months = CRM_Utils_Date::getFullMonthNames();
     //$years = CRM_Booking_Utils_DateTime::getYears();
     $this->assign('items', $items);
     if ($this->_id && $this->_action == CRM_Core_Action::UPDATE) {
         $title = CRM_Core_DAO::getFieldValue('CRM_Booking_BAO_Booking', $this->_id, 'title', 'id');
         CRM_Utils_System::setTitle(ts('Edit Booking') . " - {$title}");
     } else {
         CRM_Utils_System::setTitle(ts('New Booking'));
     }
     /**
      * [dateformatDatetime] => %B %E%f, %Y %l:%M %P
      * [dateformatFull] => %B %E%f, %Y
      * [dateformatPartial] => %B %Y
      * [dateformatYear] => %Y
      * [dateformatTime] => %l:%M %P
      */
     $this->crmDateFormat = $config->dateformatDatetime;
     //retrieve crmDateFormat
     $this->assign('dateFormat', $this->crmDateFormat);
     self::registerScripts();
 }
 function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     if ($action & CRM_Core_Action::UPDATE) {
         $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_ProgressBar', 'Edit Progressbar', CRM_Core_Action::UPDATE);
         $controller->set('id', $id);
         $controller->process();
         return $controller->run();
     } elseif ($action & CRM_Core_Action::COPY) {
         try {
             $sql = "INSERT INTO civicrm_wci_progress_bar (name, starting_amount, goal_amount)\n        SELECT concat(name, '-', (SELECT MAX(id) FROM civicrm_wci_progress_bar)),\n        starting_amount, goal_amount FROM civicrm_wci_progress_bar\n        WHERE id=%1";
             CRM_Core_DAO::executeQuery($sql, array(1 => array($id, 'Integer')));
             $new_pb_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()');
             $sql = "INSERT INTO civicrm_wci_progress_bar_formula\n            (contribution_page_id, financial_type_id, progress_bar_id, start_date, end_date, percentage)\n            SELECT contribution_page_id, financial_type_id, %1, start_date,\n            end_date, percentage FROM civicrm_wci_progress_bar_formula WHERE progress_bar_id=%2";
             CRM_Core_DAO::executeQuery($sql, array(1 => array($new_pb_id, 'Integer'), 2 => array($id, 'Integer')));
         } catch (Exception $e) {
             CRM_Core_Session::setStatus(ts('Failed to create Progress bar. ') . $e->getMessage(), '', 'error');
             $transaction->rollback();
         }
     } elseif ($action & CRM_Core_Action::DELETE) {
         $errorScope = CRM_Core_TemporaryErrorScope::useException();
         try {
             $transaction = new CRM_Core_Transaction();
             $sql = "DELETE FROM civicrm_wci_progress_bar_formula where progress_bar_id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $sql = "DELETE FROM civicrm_wci_progress_bar where id = %1";
             $params = array(1 => array($id, 'Integer'));
             CRM_Core_DAO::executeQuery($sql, $params);
             $transaction->commit();
         } catch (Exception $e) {
             $errmgs = $e->getMessage() . ts('. Check whether progressbar is used by any widget or not');
             CRM_Core_Session::setStatus($errmgs, '', 'error');
             $transaction->rollback();
         }
     }
     // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
     CRM_Utils_System::setTitle(ts('Progress Bar List'));
     $query = "SELECT * FROM civicrm_wci_progress_bar";
     $params = array();
     $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_ProgressBar');
     while ($dao->fetch()) {
         $con_page[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $con_page[$dao->id]);
         $action = array_sum(array_keys($this->actionLinks()));
         //build the normal action links.
         $con_page[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
     }
     if (isset($con_page)) {
         $this->assign('rows', $con_page);
     }
     return parent::run();
 }
 /**
  * List memberships for the UF user.
  *
  */
 public function listMemberships()
 {
     $membership = array();
     $dao = new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     $dao->find();
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         //get the membership status and type values.
         $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
         foreach (array('status', 'membership_type') as $fld) {
             $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
         }
         if (!empty($statusANDType[$dao->id]['is_current_member'])) {
             $membership[$dao->id]['active'] = TRUE;
         }
         $membership[$dao->id]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($dao->id);
         if (!$membership[$dao->id]['renewPageId']) {
             // Membership payment was not done via online contribution page or free membership. Check for default membership renewal page from CiviMember Settings
             $defaultRenewPageId = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME, 'default_renewal_contribution_page');
             if ($defaultRenewPageId) {
                 //CRM-14831 - check if membership type is present in contrib page
                 $memBlock = CRM_Member_BAO_Membership::getMembershipBlock($defaultRenewPageId);
                 if (!empty($memBlock['membership_types'])) {
                     $memTypes = explode(',', $memBlock['membership_types']);
                     if (in_array($dao->membership_type_id, $memTypes)) {
                         $membership[$dao->id]['renewPageId'] = $defaultRenewPageId;
                     }
                 }
             } else {
                 switch ($membership[$dao->id]['membership_type_id']) {
                     case "1":
                     default:
                         $membership[$dao->id]['renewPageId'] = 2;
                         break;
                     case "10":
                         $membership[$dao->id]['renewPageId'] = 19;
                         break;
                     case "11":
                         $membership[$dao->id]['renewPageId'] = 23;
                         break;
                     case "5":
                     case "9":
                         $membership[$dao->id]['renewPageId'] = 22;
                         break;
                 }
             }
         }
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
 }
Ejemplo n.º 17
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Contribute_BAO_ContributionSoft object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
     $contributionSoft->copyValues($params);
     if ($contributionSoft->find(TRUE)) {
         CRM_Core_DAO::storeValues($contributionSoft, $defaults);
         return $contributionSoft;
     }
     return NULL;
 }
Ejemplo n.º 18
0
 /**
  * Retrieve DB object based on input parameters.
  *
  * It also stores all the retrieved values in the default array.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $defaults
  *   (reference ) an assoc array to hold the flattened values.
  *
  * @return CRM_Contact_BAO_SavedSearch
  */
 public static function retrieve(&$params, &$defaults)
 {
     $savedSearch = new CRM_Contact_DAO_SavedSearch();
     $savedSearch->copyValues($params);
     if ($savedSearch->find(TRUE)) {
         CRM_Core_DAO::storeValues($savedSearch, $defaults);
         return $savedSearch;
     }
     return NULL;
 }
Ejemplo n.º 19
0
 /**
  * Fetch object based on array of properties.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $defaults
  *   (reference ) an assoc array to hold the flattened values.
  *
  * @return CRM_Core_BAO_LocaationType
  */
 public static function retrieve(&$params, &$defaults)
 {
     $component = new CRM_Mailing_DAO_Component();
     $component->copyValues($params);
     if ($component->find(TRUE)) {
         CRM_Core_DAO::storeValues($component, $defaults);
         return $component;
     }
     return NULL;
 }
Ejemplo n.º 20
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Core_BAO_CustomOption object
  * @access public
  * @static
  */
 function retrieve(&$params, &$defaults)
 {
     $customOption =& new CRM_Core_DAO_CustomOption();
     $customOption->copyValues($params);
     if ($customOption->find(true)) {
         CRM_Core_DAO::storeValues($customOption, $defaults);
         return $customOption;
     }
     return null;
 }
Ejemplo n.º 21
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Core_BAO_CustomOption object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $customOption = new CRM_Core_DAO_OptionValue();
     $customOption->copyValues($params);
     if ($customOption->find(TRUE)) {
         CRM_Core_DAO::storeValues($customOption, $defaults);
         return $customOption;
     }
     return NULL;
 }
Ejemplo n.º 22
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * pledge id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Pledge_BAO_Pledge object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $pledge = new CRM_Pledge_DAO_Pledge();
     $pledge->copyValues($params);
     if ($pledge->find(TRUE)) {
         CRM_Core_DAO::storeValues($pledge, $defaults);
         return $pledge;
     }
     return NULL;
 }
Ejemplo n.º 23
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Event_BAO_ManageEvent object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $event = new CRM_Event_DAO_Event();
     $event->copyValues($params);
     if ($event->find(true)) {
         CRM_Core_DAO::storeValues($event, $defaults);
         return $event;
     }
     return null;
 }
Ejemplo n.º 24
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Contribute_BAO_ContributionType object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $financialType = new CRM_Financial_DAO_FinancialType();
     $financialType->copyValues($params);
     if ($financialType->find(true)) {
         CRM_Core_DAO::storeValues($financialType, $defaults);
         return $financialType;
     }
     return null;
 }
Ejemplo n.º 25
0
 /**
  * Fetch object based on array of properties.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $defaults
  *   (reference ) an assoc array to hold the flattened values.
  *
  * @return CRM_Contribute_BAO_FinancialItem
  */
 public static function retrieve(&$params, &$defaults)
 {
     $financialItem = new CRM_Financial_DAO_FinancialItem();
     $financialItem->copyValues($params);
     if ($financialItem->find(TRUE)) {
         CRM_Core_DAO::storeValues($financialItem, $defaults);
         return $financialItem;
     }
     return NULL;
 }
Ejemplo n.º 26
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * group_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Contact_BAO_Group object
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $group =& new CRM_Contact_DAO_Group();
     $group->copyValues($params);
     if ($group->find(true)) {
         CRM_Core_DAO::storeValues($group, $defaults);
         return $group;
     }
     return null;
 }
Ejemplo n.º 27
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Core_BAO_PreferencesDate object on success, null otherwise
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $dao =& new CRM_Core_DAO_PreferencesDate();
     $dao->copyValues($params);
     if ($dao->find(true)) {
         CRM_Core_DAO::storeValues($dao, $defaults);
         return $dao;
     }
     return null;
 }
Ejemplo n.º 28
0
 /**
  * Retrieve DB object based on input parameters.
  *
  * It also stores all the retrieved values in the default array.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  * @param array $defaults
  *   (reference ) an assoc array to hold the flattened values.
  *
  * @return CRM_Core_DAO_Job|null
  *   object on success, null otherwise
  */
 public static function retrieve(&$params, &$defaults)
 {
     $job = new CRM_Core_DAO_Job();
     $job->copyValues($params);
     if ($job->find(TRUE)) {
         CRM_Core_DAO::storeValues($job, $defaults);
         return $job;
     }
     return NULL;
 }
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Core_BAO_LocaationType object on success, null otherwise
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $paymentProcessorType = new CRM_Financial_DAO_PaymentProcessorType();
     $paymentProcessorType->copyValues($params);
     if ($paymentProcessorType->find(TRUE)) {
         CRM_Core_DAO::storeValues($paymentProcessorType, $defaults);
         return $paymentProcessorType;
     }
     return NULL;
 }
Ejemplo n.º 30
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  *
  * @return object CRM_Core_BAO_LocaationType object on success, null otherwise
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $locationType =& new CRM_Core_DAO_LocationType();
     $locationType->copyValues($params);
     if ($locationType->find(true)) {
         CRM_Core_DAO::storeValues($locationType, $defaults);
         return $locationType;
     }
     return null;
 }