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


PHP CRM_Core_DAO::storeValues方法代码示例

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


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

示例1: browse

 /**
  * 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);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:28,代码来源:MailSettings.php

示例2: listMemberships

 /**
  * 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);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:32,代码来源:UserDashboard.php

示例3: setDefaultValues

 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;
 }
开发者ID:aydun,项目名称:uk.co.vedaconsulting.quickdonate,代码行数:26,代码来源:Campaign.php

示例4: setDefaultValues

 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;
 }
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:31,代码来源:Campaign.php

示例5: setDefaultValues

 /**
  * 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;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:36,代码来源:MembershipBlock.php

示例6: listMemberships

 /**
  * 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);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:38,代码来源:UserDashboard.php

示例7: browse

 /**
  * 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'));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:37,代码来源:EventTemplate.php

示例8: listMemberships

 /**
  * 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);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:36,代码来源:UserDashboard.php

示例9: array

 /**
  * 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;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:45,代码来源:Block.php

示例10: browse

 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);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:25,代码来源:ParticipantStatus.php

示例11: triggerTrigger

 /**
  * 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);
     }
 }
开发者ID:alejandro-ixiam,项目名称:org.civicoop.civirules,代码行数:35,代码来源:Case.php

示例12: buildQuickForm

 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();
 }
开发者ID:Jagadees-zyxware,项目名称:civicrm-wci,代码行数:25,代码来源:NewEmbedCode.php

示例13: view

 /**
  * 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);
     }
 }
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.offlinerecurringcontributions,代码行数:37,代码来源:ContributionRecur.php

示例14: preProcess

 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();
 }
开发者ID:sushantpaste,项目名称:civibooking,代码行数:59,代码来源:AddSubResource.php

示例15: run

 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();
 }
开发者ID:Jagadees-zyxware,项目名称:civicrm-wci,代码行数:57,代码来源:ProgressBarList.php


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