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


PHP CRM_Utils_System::getModuleSetting方法代码示例

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


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

示例1: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::PREVIEW) {
         return;
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contribute_BAO_ManagePremiums::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Premium Product type has been deleted.'), ts('Deleted'), 'info');
     } else {
         $params = $this->controller->exportValues($this->_name);
         $imageFile = CRM_Utils_Array::value('uploadFile', $params);
         $imageFile = $imageFile['name'];
         $config = CRM_Core_Config::singleton();
         $ids = array();
         $error = FALSE;
         // store the submitted values in an array
         // FIX ME
         if (CRM_Utils_Array::value('imageOption', $params, FALSE)) {
             $value = CRM_Utils_Array::value('imageOption', $params, FALSE);
             if ($value == 'image') {
                 // to check wether GD is installed or not
                 $gdSupport = CRM_Utils_System::getModuleSetting('gd', 'GD Support');
                 if ($gdSupport) {
                     if ($imageFile) {
                         $error = FALSE;
                         $params['image'] = $this->_resizeImage($imageFile, "_full", 200, 200);
                         $params['thumbnail'] = $this->_resizeImage($imageFile, "_thumb", 50, 50);
                     }
                 } else {
                     $error = TRUE;
                     $params['image'] = $config->resourceBase . 'i/contribute/default_premium.jpg';
                     $params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg';
                 }
             } elseif ($value == 'thumbnail') {
                 $params['image'] = $params['imageUrl'];
                 $params['thumbnail'] = $params['thumbnailUrl'];
             } elseif ($value == 'default_image') {
                 $url = parse_url($config->userFrameworkBaseURL);
                 $params['image'] = $config->resourceBase . 'i/contribute/default_premium.jpg';
                 $params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg';
             } else {
                 $params['image'] = "";
                 $params['thumbnail'] = "";
             }
         }
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['premium'] = $this->_id;
         }
         // fix the money fields
         foreach (array('cost', 'price', 'min_contribution') as $f) {
             $params[$f] = CRM_Utils_Rule::cleanMoney($params[$f]);
         }
         $premium = CRM_Contribute_BAO_ManagePremiums::add($params, $ids);
         if ($error) {
             CRM_Core_Session::setStatus(ts('No thumbnail of your image was created because the GD image library is not currently compiled in your PHP installation. Product is currently configured to use default thumbnail image. If you have a local thumbnail image you can upload it separately and input the thumbnail URL by editing this premium.'), ts('Notice'), 'alert');
         } else {
             CRM_Core_Session::setStatus(ts("The Premium '%1' has been saved.", array(1 => $premium->name)), ts('Saved'), 'success');
         }
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:63,代码来源:ManagePremiums.php

示例2: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     require_once 'CRM/Contribute/BAO/ManagePremiums.php';
     if ($this->_action & CRM_Core_Action::PREVIEW) {
         return;
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contribute_BAO_ManagePremiums::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Premium Product type has been deleted.'));
     } else {
         $params = $this->controller->exportValues($this->_name);
         $imageFile = CRM_Utils_Array::value('uploadFile', $params);
         $imageFile = $imageFile['name'];
         $config =& CRM_Core_Config::singleton();
         $ids = array();
         $error = false;
         // store the submitted values in an array
         // FIX ME
         if (CRM_Utils_Array::value('imageOption', $params, false)) {
             $value = CRM_Utils_Array::value('imageOption', $params, false);
             if ($value == 'image') {
                 if ($imageFile) {
                     $fileName = basename($imageFile);
                     $params['image'] = $config->imageUploadURL . $fileName;
                     // to check wether GD is installed or not
                     require_once 'CRM/Utils/System.php';
                     $gdSupport = CRM_Utils_System::getModuleSetting('gd', 'GD Support');
                     $jpgSupport = CRM_Utils_System::getModuleSetting('gd', 'JPG Support');
                     $gifSupport = CRM_Utils_System::getModuleSetting('gd', 'GIF Read Support');
                     $pngSupport = CRM_Utils_System::getModuleSetting('gd', 'PNG Support');
                     $error = false;
                     if ($gdSupport == 'enabled' && $jpgSupport == 'enabled' && $gifSupport == 'enabled' && $pngSupport == 'enabled') {
                         list($width_orig, $height_orig) = getimagesize($imageFile);
                         $imageInfo = getimagesize($imageFile);
                         $width_orig . "<br>";
                         $height_orig . "<br>";
                         $path = explode('/', $imageFile);
                         $thumbFileName = $path[count($path) - 1];
                         $info = pathinfo($thumbFileName);
                         $basename = substr($info['basename'], 0, -(strlen($info['extension']) + ($info['extension'] == '' ? 0 : 1)));
                         $thumbFileName = $basename . "_thumb." . $info['extension'];
                         $path[count($path) - 1] = $thumbFileName;
                         $path = implode('/', $path);
                         $width = $height = 100;
                         $thumb = imagecreate($width, $height);
                         if ($imageInfo['mime'] == 'image/gif') {
                             $source = imagecreatefromgif($imageFile);
                         } else {
                             if ($imageInfo['mime'] == 'image/png') {
                                 $source = imagecreatefrompng($imageFile);
                             } else {
                                 $source = imagecreatefromjpeg($imageFile);
                             }
                         }
                         imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
                         $fp = fopen($path, 'w+');
                         ob_start();
                         ImageJPEG($thumb);
                         $image_buffer = ob_get_contents();
                         ob_end_clean();
                         ImageDestroy($thumb);
                         fwrite($fp, $image_buffer);
                         rewind($fp);
                         fclose($fp);
                         $params['thumbnail'] = $config->imageUploadURL . $thumbFileName;
                     } else {
                         $error = true;
                         $params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg';
                     }
                 }
             } else {
                 if ($value == 'thumbnail') {
                     $params['image'] = $params['imageUrl'];
                     $params['thumbnail'] = $params['thumbnailUrl'];
                 } else {
                     if ($value == 'default_image') {
                         $url = parse_url($config->userFrameworkBaseURL);
                         $params['image'] = $config->resourceBase . 'i/contribute/default_premium.jpg';
                         $params['thumbnail'] = $config->resourceBase . 'i/contribute/default_premium_thumb.jpg';
                     } else {
                         $params['image'] = "";
                         $params['thumbnail'] = "";
                     }
                 }
             }
         }
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['premium'] = $this->_id;
         }
         // fix the money fields
         foreach (array('cost', 'price', 'min_contribution') as $f) {
             $params[$f] = CRM_Utils_Rule::cleanMoney($params[$f]);
         }
         $premium = CRM_Contribute_BAO_ManagePremiums::add($params, $ids);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:ManagePremiums.php


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