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


PHP CRM_Core_Resources类代码示例

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


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

示例1: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
     // get categories for the contact id
     $entityTag = CRM_Core_BAO_EntityTag::getTag($this->_entityID, $this->_entityTable);
     $this->assign('tagged', $entityTag);
     // get the list of all the categories
     $allTag = CRM_Core_BAO_Tag::getTagsUsedFor($this->_entityTable);
     // need to append the array with the " checked " if contact is tagged with the tag
     foreach ($allTag as $tagID => $varValue) {
         if (in_array($tagID, $entityTag)) {
             $tagAttribute = array('checked' => 'checked', 'id' => "tag_{$tagID}");
         } else {
             $tagAttribute = array('id' => "tag_{$tagID}");
         }
         $tagChk[$tagID] = $this->createElement('checkbox', $tagID, '', '', $tagAttribute);
     }
     $this->addGroup($tagChk, 'tagList', NULL, NULL, TRUE);
     $tags = new CRM_Core_BAO_Tag();
     $tree = $tags->getTree($this->_entityTable, TRUE);
     $this->assign('tree', $tree);
     $this->assign('tag', $allTag);
     //build tag widget
     $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
     CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, $this->_entityTable, $this->_entityID);
     if ($this->_action & CRM_Core_Action::BROWSE) {
         $this->freeze();
     } else {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Update Tags'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:Tag.php

示例2: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     $this->addFormRule(array('CRM_Mailchimp_Form_Setting', 'formRule'), $this);
     CRM_Core_Resources::singleton()->addStyleFile('uk.co.vedaconsulting.mailchimp', 'css/mailchimp.css');
     $webhook_url = CRM_Utils_System::url('civicrm/mailchimp/webhook', 'reset=1', TRUE, NULL, FALSE, TRUE);
     $this->assign('webhook_url', 'Webhook URL - ' . $webhook_url);
     // Add the API Key Element
     $this->addElement('text', 'api_key', ts('API Key'), array('size' => 48));
     // Add the User Security Key Element
     $this->addElement('text', 'security_key', ts('Security Key'), array('size' => 24));
     // Add Enable or Disable Debugging
     $enableOptions = array(1 => ts('Yes'), 0 => ts('No'));
     $this->addRadio('enable_debugging', ts('Enable Debugging'), $enableOptions, NULL);
     // Create the Submit Button.
     $buttons = array(array('type' => 'submit', 'name' => ts('Save & Test')));
     $groups = CRM_Mailchimp_Utils::getGroupsToSync(array(), null, $membership_only = TRUE);
     foreach ($groups as $group_id => $details) {
         $list = new Mailchimp_Lists(CRM_Mailchimp_Utils::mailchimp());
         $webhookoutput = $list->webhooks($details['list_id']);
         if ($webhookoutput[0]['sources']['api'] == 1) {
             CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Form_Setting - API is set in Webhook setting for listID', $details['list_id']);
             $listID = $details['list_id'];
             CRM_Core_Session::setStatus(ts('API is set in Webhook setting for listID %1', array(1 => $listID)), ts('Error'), 'error');
             break;
         }
     }
     // Add the Buttons.
     $this->addButtons($buttons);
 }
开发者ID:stevekessler,项目名称:uk.co.vedaconsulting.mailchimp,代码行数:35,代码来源:Setting.php

示例3: getAngularModules

 /**
  * @inheritDoc
  */
 public function getAngularModules()
 {
     $result = array();
     $result['crmCaseType'] = array('ext' => 'civicrm', 'js' => array('ang/crmCaseType.js'), 'css' => array('ang/crmCaseType.css'), 'partials' => array('ang/crmCaseType'));
     CRM_Core_Resources::singleton()->addSetting(array('crmCaseType' => array('REL_TYPE_CNAME' => CRM_Case_XMLProcessor::REL_TYPE_CNAME)));
     return $result;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:10,代码来源:Info.php

示例4: normalise_civicrm_buildForm

function normalise_civicrm_buildForm($formName, &$form)
{
    $names = array("CRM_Profile_Form_Edit", "CRM_Contact_Form_Contact", "CRM_Event_Form_Registration_Register", "CRM_Contribute_Form_Contribution_Main");
    if (in_array($formName, $names)) {
        CRM_Core_Resources::singleton()->addScript(file_get_contents(dirname(__FILE__) . "/js/normalise.js"));
    }
}
开发者ID:joannechester,项目名称:civicrm-normalise,代码行数:7,代码来源:normalise.php

示例5: browse

 function browse()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary();
     if (!empty($campaigns)) {
         $campaignType = CRM_Core_PseudoConstant::campaignType();
         $campaignStatus = CRM_Core_PseudoConstant::campaignStatus();
         foreach ($campaigns as $cmpid => $campaign) {
             $campaigns[$cmpid]['campaign_id'] = $campaign['id'];
             $campaigns[$cmpid]['title'] = $campaign['title'];
             $campaigns[$cmpid]['name'] = $campaign['name'];
             $campaigns[$cmpid]['description'] = $campaign['description'];
             $campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']];
             $campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']];
             $action = array_sum(array_keys($this->actionLinks()));
             if ($campaign['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id']), ts('more'), FALSE, 'campaign.selector.row', 'Campaign', $campaign['id']);
         }
     }
     $this->assign('campaigns', $campaigns);
     $this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:26,代码来源:Campaign.php

示例6: setDefaultValues

 /**
  * Set default values for the form
  *
  * @return void
  */
 public function setDefaultValues()
 {
     $defaults = array();
     $defaults['web_tracking_report_id'] = civicrm_api3('setting', 'getValue', array('group' => 'Web Tracking', 'name' => 'web_tracking_report_id'));
     CRM_Core_Resources::singleton()->addVars('WebTracking', array('web_tracking_report_id' => $defaults['web_tracking_report_id']));
     return $defaults;
 }
开发者ID:VishalAgarwal,项目名称:org.civicrm.webtracking,代码行数:12,代码来源:Report.php

示例7: run

 function run()
 {
     $rows = self::getAllRows();
     $this->assign('rows', $rows);
     CRM_Core_Resources::singleton()->addScriptFile('com.giantrabbit.civimailchimp', 'js/sync_log.js');
     parent::run();
 }
开发者ID:jaapjansma,项目名称:com.giantrabbit.civimailchimp,代码行数:7,代码来源:SyncLog.php

示例8: run

 /**
  * @return string
  */
 function run()
 {
     CRM_Utils_System::setTitle(ts('API explorer and generator'));
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Admin/Page/APIExplorer.js')->addScriptUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js', 99)->addStyleUrl('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css', 99);
     $this->assign('operators', CRM_Core_DAO::acceptedSQLOperators());
     return parent::run();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:10,代码来源:APIExplorer.php

示例9: buildForm

 function buildForm(&$form)
 {
     // Change the label on the "name" fields, and make mandatory
     // (they are mandatory for CC transactions, but not shown as such in the form by default
     // because of the 'pay later' option)
     $fields = array('billing_first_name' => ts('First Name'), 'billing_last_name' => ts('Last Name'), 'billing_individual_prefix' => ts('Title'));
     foreach ($fields as $field => $title) {
         if ($form->elementExists($field)) {
             $e =& $form->getElement($field);
             $e->setLabel($title);
             $form->addRule($field, ts('%1 is a required field.', array(1 => $title)), 'required');
         }
     }
     $fields = array('billing_street_address-5', 'billing_city-5', 'billing_country_id-5', 'billing_state_province_id-5', 'billing_postal_code-5');
     foreach ($fields as $field) {
         if ($form->elementExists($field)) {
             $e =& $form->getElement($field);
             $title = $e->getLabel();
             $form->addRule($field, ts('%1 is a required field.', array(1 => $title)), 'required');
         }
     }
     CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.validate.tpl'));
     // Preview & demo sites should encourage to use a test CC number
     // otherwise users do not know what CC to use, and sometimes use their own.
     if (CRM_Utils_Array::value('action', $_REQUEST) == 'preview' || !empty($GLOBALS['symbioticux_demo']) || CRM_Utils_Array::value('name', $form->_paymentProcessors[1]) == 'Dummy') {
         CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.billing-explain.tpl'));
         $js = "cj('#credit_card_number').click(function(event) {\n               if (! cj(this).val()) {\n                 cj(this).val('4111111111111111').trigger('change');\n                 cj('#cvv2').val('123').trigger('change');\n                 cj('#credit_card_exp_date_m').val('5').trigger('change');\n                 cj('#credit_card_exp_date_Y').val('2018').trigger('change');\n\n                 cj('.symbioticux-billing-explain-cc').prependTo('.credit_card_info-section').slideDown();\n               }\n             });";
         CRM_Core_Resources::singleton()->addScript($js);
     }
     CRM_Core_Region::instance('page-body')->add(array('template' => 'CRM/Symbioticux/Contribute/Form/Contribution/Main.hide-other-amount.tpl'));
     // Remove some CSS classes on the 'submit' button.
     $js = "cj('.crm-submit-buttons .crm-form-submit').addClass('btn btn-primary').removeClass('crm-form-submit').parent().removeClass('crm-button');";
     CRM_Core_Resources::singleton()->addScript($js);
 }
开发者ID:coopsymbiotic,项目名称:coop.symbiotic.symbioticux,代码行数:34,代码来源:Main.php

示例10: run

 public function run()
 {
     /**
      * @var \Civi\Angular\Manager $angular
      */
     //Use our manager instead of the one provided by core
     $angular = new Civi\Angular\VolunteerManager(\CRM_Core_Resources::singleton());
     $moduleNames = $this->parseModuleNames(\CRM_Utils_Request::retrieve('modules', 'String'), $angular);
     switch (\CRM_Utils_Request::retrieve('format', 'String')) {
         case 'json':
         case '':
             $this->send('application/javascript', json_encode($this->getMetadata($moduleNames, $angular)));
             break;
         case 'js':
             $digest = $this->digestJs($angular->getResources($moduleNames, 'js', 'path'));
             //Tell crmResource to use our ajax end-point
             $digest = str_replace("ajax/angular-modules", "ajax/volunteer-angular-modules", $digest);
             $this->send('application/javascript', $digest);
             break;
         case 'css':
             $this->send('text/css', \CRM_Utils_File::concat($angular->getResources($moduleNames, 'css', 'path'), "\n"));
             break;
         default:
             \CRM_Core_Error::fatal("Unrecognized format");
     }
     \CRM_Utils_System::civiExit();
 }
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:27,代码来源:Modules.php

示例11: browse

 /**
  * Browse all CiviCRM Profile group fields.
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $ufField = array();
     $ufFieldBAO = new CRM_Core_BAO_UFField();
     // fkey is gid
     $ufFieldBAO->uf_group_id = $this->_gid;
     $ufFieldBAO->orderBy('weight', 'field_name');
     $ufFieldBAO->find();
     $otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_gid);
     $this->assign('otherModules', $otherModules);
     $isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved');
     $this->assign('isGroupReserved', $isGroupReserved);
     $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
     if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') {
         $this->assign('skipCreate', TRUE);
     }
     $locationType = array();
     $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE);
     $fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
     $select = array();
     foreach ($fields as $name => $field) {
         if ($name) {
             $select[$name] = $field['title'];
         }
     }
     $select['group'] = ts('Group(s)');
     $select['tag'] = ts('Tag(s)');
     $visibility = CRM_Core_SelectValues::ufVisibility();
     while ($ufFieldBAO->fetch()) {
         $ufField[$ufFieldBAO->id] = array();
         $phoneType = $locType = '';
         CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
         $ufField[$ufFieldBAO->id]['visibility_display'] = $visibility[$ufFieldBAO->visibility];
         $ufField[$ufFieldBAO->id]['label'] = $ufFieldBAO->label;
         $action = array_sum(array_keys($this->actionLinks()));
         if ($ufFieldBAO->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         if ($ufFieldBAO->is_reserved) {
             $action -= CRM_Core_Action::UPDATE;
             $action -= CRM_Core_Action::DISABLE;
             $action -= CRM_Core_Action::DELETE;
         }
         $ufField[$ufFieldBAO->id]['order'] = $ufField[$ufFieldBAO->id]['weight'];
         $ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid), ts('more'), FALSE, 'ufField.row.actions', 'UFField', $ufFieldBAO->id);
     }
     $returnURL = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
     $filter = "uf_group_id = {$this->_gid}";
     CRM_Utils_Weight::addOrder($ufField, 'CRM_Core_DAO_UFField', 'id', $returnURL, $filter);
     $this->assign('ufField', $ufField);
     // retrieve showBestResult from session
     $session = CRM_Core_Session::singleton();
     $showBestResult = $session->get('showBestResult');
     $this->assign('showBestResult', $showBestResult);
     $session->set('showBestResult', 0);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:67,代码来源:Field.php

示例12: bootstrapvisualize_civicrm_pageRun

function bootstrapvisualize_civicrm_pageRun(&$page)
{
    $pageName = $page->getVar('_name');
    if ($pageName == 'CRM_Civisualize_Page_Main') {
        CRM_Core_Resources::singleton()->addStyleFile('eu.tttp.bootstrapvisualize', 'css/bootstrap.min.css');
    }
}
开发者ID:TechToThePeople,项目名称:bootstrapvisualize,代码行数:7,代码来源:bootstrapvisualize.php

示例13: addResources

 /**
  * Load needed JS, CSS and settings for the backend Volunteer Management UI
  */
 public static function addResources($entity_id, $entity_table)
 {
     static $loaded = FALSE;
     if ($loaded) {
         return;
     }
     $loaded = TRUE;
     $config = CRM_Core_Config::singleton();
     $ccr = CRM_Core_Resources::singleton();
     // Vendor libraries
     $ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header');
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
     // Our stylesheet
     $ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
     // Add all scripts for our js app
     $weight = 0;
     $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
     // This glob pattern will recurse the js directory up to 4 levels deep
     foreach (glob($baseDir . 'js/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
         $fileName = substr($file, strlen($baseDir));
         $ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
     }
     // Add our template
     CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
     CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
     // Fetch event so we can set the default start time for needs
     // FIXME: Not the greatest for supporting non-events
     $entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
     // Static variables
     $ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat)));
     // Check for problems
     _volunteer_civicrm_check_resource_url();
 }
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:37,代码来源:Manage.php

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

示例15: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_vid = CRM_Utils_Request::retrieve('vid', 'Positive', $this, TRUE);
     if (!CRM_Volunteer_Permission::checkProjectPerms(CRM_Core_Action::UPDATE, $this->_vid)) {
         CRM_Utils_System::permissionDenied();
     }
     $this->_batchInfo['item_count'] = 50;
     $params = array('project_id' => $this->_vid);
     $this->_volunteerData = CRM_Volunteer_BAO_Assignment::retrieve($params);
     $projects = CRM_Volunteer_BAO_Project::retrieve(array('id' => $this->_vid));
     $project = $projects[$this->_vid];
     $this->_entityID = $project->entity_id;
     $this->_entityTable = $project->entity_table;
     $this->_title = $project->title;
     $this->_title .= ' ( ' . CRM_Utils_Date::customFormat($project->start_date);
     $this->_start_date = $project->start_date;
     if ($project->end_date) {
         $this->_title .= ' - ' . CRM_Utils_Date::customFormat($project->end_date) . ' )';
     } else {
         $this->_title .= ' )';
     }
     /*
      * Because CiviCRM's asset management framework isn't mature yet (e.g., adding
      * assets to forms rendered in pop-ups using CRM_Core_Resources doesn't work),
      * we pass a URL fragment to the template and include them via HTML.
      */
     $this->assign('extResourceURL', CRM_Core_Resources::singleton()->getUrl('org.civicrm.volunteer'));
     $this->assign('vid', $this->_vid);
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:35,代码来源:Log.php


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