本文整理汇总了PHP中CRM_Utils_String::getClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_String::getClassName方法的具体用法?PHP CRM_Utils_String::getClassName怎么用?PHP CRM_Utils_String::getClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_String
的用法示例。
在下文中一共展示了CRM_Utils_String::getClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* @param CRM_Core_Form $form
*
* @return array
*/
public static function process(&$form)
{
if ($form->getVar('_surveyId') <= 0) {
return NULL;
}
$tabs = array('main' => array('title' => ts('Main Information'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'questions' => array('title' => ts('Questions'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'results' => array('title' => ts('Results'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE));
$surveyID = $form->getVar('_surveyId');
$class = $form->getVar('_name');
$class = CRM_Utils_String::getClassName($class);
$class = strtolower($class);
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
$qfKey = $form->get('qfKey');
if ($qfKey) {
$tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
}
}
if ($surveyID) {
$reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$tabs[$key]['qfKey'] = NULL;
}
$tabs[$key]['link'] = CRM_Utils_System::url("civicrm/survey/configure/{$key}", "{$reset}action=update&id={$surveyID}{$tabs[$key]['qfKey']}");
$tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
}
}
return $tabs;
}
示例2: process
/**
* @param CRM_Core_Form $form
*
* @return array
*/
public static function process(&$form)
{
if ($form->getVar('_id') <= 0) {
return NULL;
}
$tabs = array('settings' => array('title' => ts('Title'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'amount' => array('title' => ts('Amounts'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'membership' => array('title' => ts('Memberships'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'thankyou' => array('title' => ts('Receipt'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'friend' => array('title' => ts('Tell a Friend'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'custom' => array('title' => ts('Profiles'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'premium' => array('title' => ts('Premiums'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'widget' => array('title' => ts('Widgets'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE), 'pcp' => array('title' => ts('Personal Campaigns'), 'link' => NULL, 'valid' => FALSE, 'active' => FALSE, 'current' => FALSE));
$contribPageId = $form->getVar('_id');
CRM_Utils_Hook::tabset('civicrm/admin/contribute', $tabs, array('contribution_page_id' => $contribPageId));
$fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
// Hack for special cases.
switch ($className) {
case 'Contribute':
$attributes = $form->getVar('_attributes');
$class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
break;
case 'MembershipBlock':
$class = 'membership';
break;
default:
$class = strtolower($className);
break;
}
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
$qfKey = $form->get('qfKey');
if ($qfKey) {
$tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
}
}
if ($contribPageId) {
$reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$tabs[$key]['qfKey'] = NULL;
}
$tabs[$key]['link'] = CRM_Utils_System::url("civicrm/admin/contribute/{$key}", "{$reset}action=update&id={$contribPageId}{$tabs[$key]['qfKey']}");
$tabs[$key]['active'] = $tabs[$key]['valid'] = TRUE;
}
//get all section info.
$contriPageInfo = CRM_Contribute_BAO_ContributionPage::getSectionInfo(array($contribPageId));
foreach ($contriPageInfo[$contribPageId] as $section => $info) {
if (!$info) {
$tabs[$section]['valid'] = FALSE;
}
}
}
return $tabs;
}
示例3: process
static function process(&$form)
{
if ($form->getVar('_id') <= 0) {
return null;
}
$tabs = array('eventInfo' => array('title' => ts('Info and Settings'), 'link' => null, 'valid' => false, 'active' => false, 'current' => false), 'location' => array('title' => ts('Event Location'), 'link' => null, 'valid' => false, 'active' => false, 'current' => false), 'fee' => array('title' => ts('Fees'), 'link' => null, 'valid' => false, 'active' => false, 'current' => false), 'registration' => array('title' => ts('Online Registration'), 'link' => null, 'valid' => false, 'active' => false, 'current' => false), 'friend' => array('title' => ts('Tell a Friend'), 'link' => null, 'valid' => false, 'active' => false, 'current' => false));
$eventID = $form->getVar('_id');
$fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
$class = strtolower($className);
// hack for tell a friend, since class name is different
if ($className == 'Event') {
$class = 'friend';
} elseif ($className == 'EventInfo') {
$class = 'eventInfo';
}
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = true;
}
if ($eventID) {
$reset = CRM_Utils_Array::value('reset', $_GET) ? 'reset=1&' : '';
//add qf key
$qfKey = $form->get('qfKey');
$form->assign('qfKey', $qfKey);
foreach ($tabs as $key => $value) {
$tabs[$key]['link'] = CRM_Utils_System::url("civicrm/event/manage/{$key}", "{$reset}action=update&snippet=4&id={$eventID}&qfKey={$qfKey}");
$tabs[$key]['active'] = $tabs[$key]['valid'] = true;
}
// retrieve info about paid event, tell a friend and online reg
$sql = "\nSELECT e.is_online_registration, e.is_monetary, taf.is_active\nFROM civicrm_event e\nLEFT JOIN civicrm_tell_friend taf ON ( taf.entity_table = 'civicrm_event' AND taf.entity_id = e.id )\nWHERE e.id = %1\n";
$params = array(1 => array($eventID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if (!$dao->fetch()) {
CRM_Core_Error::fatal();
}
if (!$dao->is_online_registration) {
$tabs['registration']['valid'] = false;
}
if (!$dao->is_monetary) {
$tabs['fee']['valid'] = false;
}
if (!$dao->is_active) {
$tabs['friend']['valid'] = false;
}
}
return $tabs;
}
示例4: getTemplateFileName
/**
* @return string
*/
public function getTemplateFileName()
{
if ($this->controller->getPrint() || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE || CRM_Utils_String::getClassName($this->_name) == 'AddProduct') {
return parent::getTemplateFileName();
} else {
// hack lets suppress the form rendering for now
self::$_template->assign('isForm', FALSE);
return 'CRM/Contribute/Form/ContributionPage/Tab.tpl';
}
}
示例5: endPostProcess
function endPostProcess()
{
// make submit buttons keep the current working tab opened.
if ($this->_action & CRM_Core_Action::UPDATE) {
$subPage = CRM_Utils_Request::retrieve('subPage', 'String', $this);
if ($subPage) {
$title = CRM_Event_Form_ManageEvent_TabHeader::getSubPageInfo($this, $subPage);
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $title)));
// we need to call the hook manually here since we redirect and never
// go back to CRM/Core/Form.php
// A better way might have been to setUserContext so the framework does the rediret
CRM_Utils_Hook::postProcess(get_class($this), $this);
$className = CRM_Utils_String::getClassName($this->_name);
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
CRM_Utils_System::redirect($this->_doneUrl);
} else {
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), "action=update&reset=1&id={$this->_id}&subPage={$subPage}"));
}
}
}
示例6: CRM_Core_Form
/**
* Constructor for the basic form page
*
* We should not use QuickForm directly. This class provides a lot
* of default convenient functions, rules and buttons
*
* @param object $state State associated with this form
* @param enum $action The mode the form is operating in (None/Create/View/Update/Delete)
*
* @return object
* @access public
*/
function CRM_Core_Form($state = null, $action = CRM_CORE_ACTION_NONE, $method = 'post')
{
$this->_name = CRM_Utils_String::getClassName(CRM_Utils_System::getClassName($this));
$this->HTML_QuickForm_Page($this->_name, $method);
$this->_state = $state;
$this->_action = $action;
$this->registerRules();
// let the constructor initialize this, should happen only once
if (!isset($GLOBALS['_CRM_CORE_FORM']['_template'])) {
$GLOBALS['_CRM_CORE_FORM']['_template'] =& CRM_Core_Smarty::singleton();
}
}
示例7: process
/**
* @param CRM_Event_Form_ManageEvent $form
*
* @return array
* @throws Exception
*/
public static function process(&$form)
{
if ($form->getVar('_id') <= 0) {
return NULL;
}
$default = array('link' => NULL, 'valid' => TRUE, 'active' => TRUE, 'current' => FALSE, 'class' => 'ajaxForm');
$tabs = array();
$tabs['settings'] = array('title' => ts('Info and Settings'), 'class' => 'ajaxForm livePage') + $default;
$tabs['location'] = array('title' => ts('Event Location')) + $default;
$tabs['fee'] = array('title' => ts('Fees')) + $default;
$tabs['registration'] = array('title' => ts('Online Registration')) + $default;
if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
$tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
}
$tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
$tabs['friend'] = array('title' => ts('Tell a Friend')) + $default;
$tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
$tabs['repeat'] = array('title' => ts('Repeat')) + $default;
// Repeat tab must refresh page when switching repeat mode so js & vars will get set-up
if (!$form->_isRepeatingEvent) {
unset($tabs['repeat']['class']);
}
// check if we're in shopping cart mode for events
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
if (!$enableCart) {
unset($tabs['conference']);
}
$eventID = $form->getVar('_id');
if ($eventID) {
// disable tabs based on their configuration status
$sql = "\nSELECT e.loc_block_id as is_location, e.is_online_registration, e.is_monetary, taf.is_active, pcp.is_active as is_pcp, sch.id as is_reminder, re.id as is_repeating_event\nFROM civicrm_event e\nLEFT JOIN civicrm_tell_friend taf ON ( taf.entity_table = 'civicrm_event' AND taf.entity_id = e.id )\nLEFT JOIN civicrm_pcp_block pcp ON ( pcp.entity_table = 'civicrm_event' AND pcp.entity_id = e.id )\nLEFT JOIN civicrm_action_mapping map ON ( map.entity_value = 'civicrm_event' )\nLEFT JOIN civicrm_action_schedule sch ON ( sch.mapping_id = map.id AND sch.entity_value = %1 )\nLEFT JOIN civicrm_recurring_entity re ON ( e.id = re.entity_id AND re.entity_table = 'civicrm_event' )\nWHERE e.id = %1\n";
//Check if repeat is configured
$eventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($eventID, 'civicrm_event');
$params = array(1 => array($eventID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if (!$dao->fetch()) {
CRM_Core_Error::fatal();
}
if (!$dao->is_location) {
$tabs['location']['valid'] = FALSE;
}
if (!$dao->is_online_registration) {
$tabs['registration']['valid'] = FALSE;
}
if (!$dao->is_monetary) {
$tabs['fee']['valid'] = FALSE;
}
if (!$dao->is_active) {
$tabs['friend']['valid'] = FALSE;
}
if (!$dao->is_pcp) {
$tabs['pcp']['valid'] = FALSE;
}
if (!$dao->is_reminder) {
$tabs['reminder']['valid'] = FALSE;
}
if (!$dao->is_repeating_event) {
$tabs['repeat']['valid'] = FALSE;
}
}
// see if any other modules want to add any tabs
// note: status of 'valid' flag of any injected tab, needs to be taken care in the hook implementation.
CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs, array('event_id' => $eventID));
$fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
$new = '';
// hack for special cases.
switch ($className) {
case 'Event':
$attributes = $form->getVar('_attributes');
$class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
break;
case 'EventInfo':
$class = 'settings';
break;
case 'ScheduleReminders':
$class = 'reminder';
break;
default:
$class = strtolower($className);
break;
}
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
$qfKey = $form->get('qfKey');
if ($qfKey) {
$tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
}
}
if ($eventID) {
$reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$tabs[$key]['qfKey'] = NULL;
//.........这里部分代码省略.........
示例8: __construct
/**
* Constructor for the basic form page.
*
* We should not use QuickForm directly. This class provides a lot
* of default convenient functions, rules and buttons
*
* @param object $state
* State associated with this form.
* @param \const|\enum|int $action The mode the form is operating in (None/Create/View/Update/Delete)
* @param string $method
* The type of http method used (GET/POST).
* @param string $name
* The name of the form if different from class name.
*
* @return \CRM_Core_Form
*/
public function __construct($state = NULL, $action = CRM_Core_Action::NONE, $method = 'post', $name = NULL)
{
if ($name) {
$this->_name = $name;
} else {
// CRM-15153 - FIXME this name translates to a DOM id and is not always unique!
$this->_name = CRM_Utils_String::getClassName(CRM_Utils_System::getClassName($this));
}
$this->HTML_QuickForm_Page($this->_name, $method);
$this->_state =& $state;
if ($this->_state) {
$this->_state->setName($this->_name);
}
$this->_action = (int) $action;
$this->registerRules();
// let the constructor initialize this, should happen only once
if (!isset(self::$_template)) {
self::$_template = CRM_Core_Smarty::singleton();
}
// Workaround for CRM-15153 - give each form a reasonably unique css class
$this->addClass(CRM_Utils_System::getClassName($this));
$this->assign('snippet', CRM_Utils_Array::value('snippet', $_GET));
}
示例9: addPages
/**
* add pages to the controller. Note that the controller does not really care
* the order in which the pages are added
*
* @param object $stateMachine the state machine object
* @param int $action the mode in which the state machine is operating
* typicaly this will be add/view/edit
*
* @return void
* @access public
*
*/
function addPages(&$stateMachine, $action = CRM_Core_Action::NONE)
{
$pages = $stateMachine->getPages();
foreach ($pages as $name => $value) {
$className = CRM_Utils_Array::value('className', $value, $name);
$title = CRM_Utils_Array::value('title', $value);
$options = CRM_Utils_Array::value('options', $value);
$stateName = CRM_Utils_String::getClassName($className);
if (CRM_Utils_Array::value('className', $value)) {
$formName = $name;
} else {
$formName = CRM_Utils_String::getClassName($name);
}
$ext = CRM_Extension_System::singleton()->getMapper();
if ($ext->isExtensionClass($className)) {
require_once $ext->classToPath($className);
} else {
require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
}
${$stateName} = new $className($stateMachine->find($className), $action, 'post', $formName);
if ($title) {
${$stateName}->setTitle($title);
}
if ($options) {
${$stateName}->setOptions($options);
}
$this->addPage(${$stateName});
$this->addAction($stateName, new HTML_QuickForm_Action_Direct());
//CRM-6342 -we need kill the reference here,
//as we have deprecated reference object creation.
unset(${$stateName});
}
}
示例10: addPages
/**
* add pages to the controller. Note that the controller does not really care
* the order in which the pages are added
*
* @param object $stateMachine the state machine object
* @param int $action the mode in which the state machine is operating
* typicaly this will be add/view/edit
*
* @return void
* @access public
*
*/
function addPages(&$stateMachine, $action = CRM_Core_Action::NONE)
{
$pages = $stateMachine->getPages();
foreach ($pages as $name => $value) {
$className = CRM_Utils_Array::value('className', $value, $name);
$title = CRM_Utils_Array::value('title', $value);
$options = CRM_Utils_Array::value('options', $value);
$stateName = CRM_Utils_String::getClassName($className);
if (CRM_Utils_Array::value('className', $value)) {
$formName = $name;
} else {
$formName = CRM_Utils_String::getClassName($name);
}
require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
${$stateName} =& new $className($stateMachine->find($className), $action, 'post', $formName);
if ($title) {
${$stateName}->setTitle($title);
}
if ($options) {
${$stateName}->setOptions($options);
}
$this->addPage(${$stateName});
$this->addAction($stateName, new HTML_QuickForm_Action_Direct());
}
}
示例11: addPages
/**
* add pages to the controller. Note that the controller does not really care
* the order in which the pages are added
*
* @param object $stateMachine the state machine object
* @param int $action the mode in which the state machine is operating
* typicaly this will be add/view/edit
*
* @return void
* @access public
*
*/
function addPages($stateMachine, $action = CRM_CORE_ACTION_NONE)
{
$pages = $stateMachine->getPages();
foreach ($pages as $classPath) {
$stateName = CRM_Utils_String::getClassName($classPath);
require_once str_replace('_', DIRECTORY_SEPARATOR, $classPath) . '.php';
${$stateName} =& new $classPath($stateMachine->find($classPath), $action);
$this->addPage(${$stateName});
$this->addAction($stateName, new HTML_QuickForm_Action_Direct());
}
}
示例12: addSequentialPages
/**
* addSequentialStates: meta level function to create a simple
* wizard for a state machine that is completely sequential.
*
* @access public
*
* @param array $states states is an array of arrays. Each element
* of the top level array describes a state. Each state description
* includes the name, the display name and the class name
*
* @param int $action mode of form operation.
*
* @return void
*/
function addSequentialPages(&$pages, $action)
{
$this->_pages =& $pages;
$numPages = count($pages);
for ($i = 0; $i < $numPages; $i++) {
$name = CRM_Utils_String::getClassName($pages[$i]);
$classPath = str_replace('_', '/', $pages[$i]) . '.php';
require_once $classPath;
$title = eval(sprintf("return %s::getTitle( );", $pages[$i]));
if ($numPages == 1) {
$prev = $next = null;
$type = CRM_CORE_STATE_START | CRM_CORE_STATE_FINISH;
} else {
if ($i == 0) {
// start state
$prev = null;
$next = CRM_Utils_String::getClassName($pages[$i + 1]);
$type = CRM_CORE_STATE_START;
} else {
if ($i == $numPages - 1) {
// finish state
$prev = CRM_Utils_String::getClassName($pages[$i - 1]);
$next = null;
$type = CRM_CORE_STATE_FINISH;
} else {
// in between simple state
$prev = CRM_Utils_String::getClassName($pages[$i - 1]);
$next = CRM_Utils_String::getClassName($pages[$i + 1]);
$type = CRM_CORE_STATE_SIMPLE;
}
}
}
$this->addState($name, $title, $type, $prev, $next);
}
}
示例13: __construct
/**
* Constructor for the basic form page
*
* We should not use QuickForm directly. This class provides a lot
* of default convenient functions, rules and buttons
*
* @param object $state State associated with this form
* @param enum $action The mode the form is operating in (None/Create/View/Update/Delete)
* @param string $method The type of http method used (GET/POST)
* @param string $name The name of the form if different from class name
*
* @return object
* @access public
*/
function __construct($state = null, $action = CRM_Core_Action::NONE, $method = 'post', $name = null)
{
if ($name) {
$this->_name = $name;
} else {
$this->_name = CRM_Utils_String::getClassName(CRM_Utils_System::getClassName($this));
}
$this->HTML_QuickForm_Page($this->_name, $method);
$this->_state = $state;
$this->_action = (int) $action;
$this->registerRules();
// let the constructor initialize this, should happen only once
if (!isset(self::$_template)) {
self::$_template = CRM_Core_Smarty::singleton();
}
}
示例14: getTemplateFileName
function getTemplateFileName()
{
if ($this->controller->getPrint() == CRM_Core_Smarty::PRINT_NOFORM || $this->getVar('_id') <= 0 || $this->_action & CRM_Core_Action::DELETE || CRM_Utils_String::getClassName($this->_name) == 'AddProduct') {
return parent::getTemplateFileName();
} else {
return 'CRM/Contribute/Form/ContributionPage/Tab.tpl';
}
}
示例15: __construct
/**
* Constructor for the basic form page
*
* We should not use QuickForm directly. This class provides a lot
* of default convenient functions, rules and buttons
*
* @param object $state State associated with this form
* @param enum $action The mode the form is operating in (None/Create/View/Update/Delete)
* @param string $method The type of http method used (GET/POST)
* @param string $name The name of the form if different from class name
*
* @return object
* @access public
*/
function __construct($state = NULL, $action = CRM_Core_Action::NONE, $method = 'post', $name = NULL)
{
if ($name) {
$this->_name = $name;
} else {
$this->_name = CRM_Utils_String::getClassName(CRM_Utils_System::getClassName($this));
}
$this->HTML_QuickForm_Page($this->_name, $method);
$this->_state =& $state;
if ($this->_state) {
$this->_state->setName($this->_name);
}
$this->_action = (int) $action;
$this->registerRules();
// let the constructor initialize this, should happen only once
if (!isset(self::$_template)) {
self::$_template = CRM_Core_Smarty::singleton();
}
$this->assign('snippet', (int) CRM_Utils_Array::value('snippet', $_REQUEST));
}