本文整理匯總了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');
}
}
}
示例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);
//.........這裏部分代碼省略.........