本文整理汇总了PHP中CRM_Core_Page类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page类的具体用法?PHP CRM_Core_Page怎么用?PHP CRM_Core_Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Page类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
// 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'));
parent::run();
}
示例2: run
function run()
{
$date_ranges = array('thisMonth' => '', 'lastMonth' => '- INTERVAL 1 MONTH', 'twoMonths' => '- INTERVAL 2 MONTH', 'threeMonths' => '- INTERVAL 3 MONTH', 'fourMonths' => '- INTERVAL 4 MONTH', 'fiveMonths' => '- INTERVAL 5 MONTH', 'sixMonths' => '- INTERVAL 6 MONTH');
$createdArray = array();
foreach ($date_ranges as $name => $date_range) {
// $sql = "SELECT count(id) as createdtotal, DATE_FORMAT(MONTH(CURRENT_DATE ".$date_range."), '%M') as month FROM civicrm_contact WHERE MONTH(created_date) = MONTH(CURRENT_DATE ".$date_range.") AND YEAR(created_date) = YEAR(CURRENT_DATE ".$date_range.");";
$sql = "SELECT count(id) as createdtotal FROM civicrm_contact WHERE MONTH(created_date) = MONTH(CURRENT_DATE " . $date_range . ") AND YEAR(created_date) = YEAR(CURRENT_DATE " . $date_range . ");";
$dao = CRM_Core_DAO::executeQuery($sql);
if ($dao->fetch()) {
$createdArray[$name] = $dao->createdtotal;
}
}
$createdAgg = array();
$createdTotal = array_sum($createdArray);
foreach ($createdArray as $name => $created) {
if ($createdTotal < 50) {
$createdAgg[$name] = $created;
} elseif ($createdTotal < 300 && $createdTotal >= 50) {
$createdAgg[$name] = $created / 10;
} elseif ($createdTotal < 1000 && $createdTotal >= 300) {
$createdAgg[$name] = $created / 100;
} else {
$createdAgg[$name] = $created / 1000;
}
}
$this->assign('createdArray', $createdArray);
$this->assign('createdAgg', $createdAgg);
parent::run();
}
示例3: run
/**
* @return string
*/
public function run()
{
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
$this->assign('action', $action);
$this->browse();
return parent::run();
}
示例4: run
function run()
{
$config =& CRM_Core_Config::singleton();
$ufAccessURL = CRM_Utils_System::url('admin/user/permissions');
$this->assign('ufAccessURL', $ufAccessURL);
return parent::run();
}
示例5: run
function run()
{
$sql = "SELECT * FROM civicrm_metrics_server ORDER BY site_name, timestamp";
$dao =& CRM_Core_DAO::executeQuery($sql);
$rows = array();
while ($dao->fetch()) {
$row = array();
$row['id'] = $dao->id;
$row['site_name'] = $dao->site_name;
$row['site_url'] = $dao->site_url;
$row['timestamp'] = $dao->timestamp;
$row['type'] = $dao->type;
$row['data'] = $dao->data;
$rows[] = $row;
}
if (array_key_exists("export", $_REQUEST) && $_REQUEST['export'] == 'csv') {
header('Content-type: text/csv');
header('Content-disposition: attachment;filename=metrics_data_' . date("Ymd_HiO") . '.csv');
$output = fopen('php://output', 'w');
$headers = array("Id", "Site Name", "Site URL", "Timestamp", "Metric Type", "Metric Data");
fputcsv($output, $headers);
foreach ($rows as $row) {
fputcsv($output, $row);
}
fclose($output);
die;
} else {
CRM_Utils_System::setTitle(ts('Metrics Report'));
$this->assign('data', $rows);
$this->assign('headers', array_keys($rows[0]));
parent::run();
}
}
示例6: run
/**
* This function is the main function that is called when the page loads, it decides the which action has to be taken for the page.
*
* return null
* @access public
*/
function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
CRM_Pledge_Page_Tab::setContext();
if ($this->_action & CRM_Core_Action::UPDATE) {
$this->edit();
// set page title
CRM_Contact_Page_View::setTitle($this->_contactId);
} else {
$pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this);
$paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId);
$this->assign('rows', $paymentDetails);
$this->assign('pledgeId', $pledgeId);
$this->assign('contactId', $this->_contactId);
// check if we can process credit card contribs
$processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
if (count($processors) > 0) {
$this->assign('newCredit', TRUE);
} else {
$this->assign('newCredit', FALSE);
}
// check is the user has view/edit signer permission
$permission = 'view';
if (CRM_Core_Permission::check('edit pledges')) {
$permission = 'edit';
}
$this->assign('permission', $permission);
}
return parent::run();
}
示例7: run
/**
* List blog articles as dashlet.
*/
public function run()
{
$context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'dashlet');
$this->assign('context', $context);
$this->assign('blog', $this->_getBlog());
return parent::run();
}
示例8: run
function run()
{
// Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
CRM_Utils_System::setTitle(ts('JobsTab'));
self::registerScripts();
parent::run();
}
示例9: run
function run()
{
// title
CRM_Utils_System::setTitle(ts('WindowSill'));
// config
// https://github.com/kreynen/civicrm-min/blob/master/CRM/Core/Extensions.php
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Drupal') {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Not a Drupal installation</div>";
} else {
$error = "<div class='messages status no-popup'><div class='icon inform-icon'></div>Drupal installation</div>";
}
// error
$this->assign('error', $error);
// on form action update settings
if (isset($_REQUEST['settings'])) {
// set
CRM_Core_BAO_Setting::setItem($_REQUEST['settings'], 'windowsill', 'settings');
// notice
CRM_Core_Session::setStatus(ts('Windowsill settings changed'), ts('Saved'), 'success');
}
// url
$url = CRM_Utils_System::url() . "civicrm/ctrl/windowsill";
$this->assign('url', $url);
// render
parent::run();
}
示例10: run
/**
* run this page (figure out the action needed and perform it).
*
* @return void
*/
function run()
{
$selector =& new CRM_Mailing_Selector_Event(CRM_Utils_Request::retrieve('event', 'String', $this), CRM_Utils_Request::retrieve('distinct', 'Boolean', $this), CRM_Utils_Request::retrieve('mid', 'Positive', $this), CRM_Utils_Request::retrieve('jid', 'Positive', $this), CRM_Utils_Request::retrieve('uid', 'Positive', $this));
$mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
//assign backurl
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
if ($context == 'activitySelector') {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
$backUrlTitle = ts('Back to Activities');
} elseif ($context == 'mailing') {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
$backUrlTitle = ts('Back to Mailing');
} else {
$backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}");
$backUrlTitle = ts('Back to Report');
}
$this->assign('backUrl', $backUrl);
$this->assign('backUrlTitle', $backUrlTitle);
CRM_Utils_System::setTitle($selector->getTitle());
$this->assign('title', $selector->getTitle());
$this->assign('mailing_id', $mailing_id);
$sortID = NULL;
if ($this->get(CRM_Utils_Sort::SORT_ID)) {
$sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION));
}
$controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TEMPLATE);
$controller->setEmbedded(TRUE);
$controller->run();
return parent::run();
}
示例11: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
// set breadcrumb to append to 2nd layer pages
$breadCrumb = array(array('title' => ts('Manage Items'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')));
// what action to take ?
if ($action & CRM_Core_Action::ADD) {
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
// For logged in user directly go to add/update item page.
$controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item', 'New Item', $action);
$controller->set('donorID', $session->get('userID'));
} else {
// For anonymous user go via account creation wizard.
require_once 'CRM/Auction/Controller/Item.php';
$controller = new CRM_Auction_Controller_Item('New Item', $action);
}
return $controller->run();
} elseif ($action & CRM_Core_Action::UPDATE) {
$session = CRM_Core_Session::singleton();
if ($session->get('userID')) {
$controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item', 'Update Item', $action);
$controller->set('donorID', $session->get('userID'));
return $controller->run();
}
}
// parent run
parent::run();
}
示例12: run
function run()
{
if (CRM_Utils_System::authenticateKey()) {
$request_type = CRM_Utils_Request::retrieve('type', 'String');
$request_data = CRM_Utils_Request::retrieve('data', 'String');
$config = CRM_Core_Config::singleton();
if ($config->debug) {
$request_data_log = print_r($request_data, TRUE);
CRM_Core_Error::debug_log_message("Mailchimp Webhook Request [{$request_type}]: \n{$request_data_log}");
}
$function_name = 'self::mailchimpWebhook' . ucwords($request_type);
if (is_callable($function_name)) {
// Set a canary to prevent CiviMailchimp hooks from firing, which
// would trigger updates back to Mailchimp, resulting in an endless
// loop.
civimailchimp_static('mailchimp_do_not_run_hooks', TRUE);
try {
call_user_func($function_name, $request_data);
} catch (Exception $e) {
$error = array('code' => get_class($e), 'message' => $e->getMessage(), 'exception' => $e);
$message = "Mailchimp Webhook Request [{$request_type}]: {$error['code']}: {$error['message']}";
CRM_CiviMailchimp_BAO_SyncLog::saveMessage('error', 'mailchimp_to_civicrm', $message, $request_data);
CRM_Core_Error::debug_var('Fatal Error Details', $error);
CRM_Core_Error::backtrace('backTrace', TRUE);
throw $e;
}
}
}
parent::run();
}
示例13: run
function run()
{
$apiURL = "https://www.googleapis.com/oauth2/v3";
CRM_Utils_System::setTitle(ts('GoogleCallback'));
$redirect_uri = rawurldecode(CRM_Utils_System::url('civicrm/civisocial/googlepluscallback', NULL, TRUE));
$client_secret = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'google_plus_secret'));
$client_id = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'google_plus_key'));
// Facebook sends a code to thge
if (array_key_exists('code', $_GET)) {
$google_code = $_GET['code'];
} else {
if (array_key_exists('error', $_GET)) {
die("GOOGLE FATAL: the request returned without the code. Please try loging in again.");
}
}
// Getting Access Token
$access_token = "";
$access_token_response = $this->get_response($apiURL, "token", TRUE, array("client_id" => $client_id, "client_secret" => $client_secret, "code" => $google_code, "redirect_uri" => $redirect_uri, "grant_type" => "authorization_code"));
if (array_key_exists("error", $access_token_response)) {
die($access_token_response["error"]);
} else {
$access_token = $access_token_response["access_token"];
}
// Get the user data
$user_data_response = $this->get_response($apiURL, "userinfo", FALSE, array("access_token" => $access_token, "alt" => "json"));
$this->assign('status', $user_data_response);
$this->assign('currentTime', $user_data_response);
parent::run();
}
示例14: run
public function run()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, 0);
$config = CRM_Chapters_AutomatchConfig::singelton();
$sql = "SELECT id, `" . $config->getMatchTypeField('column_name') . "` AS `type`, `" . $config->getCountryField('column_name') . "` AS `country`, `" . $config->getZipCodeRangeFromField('column_name') . "` AS `zipcode_from`, `" . $config->getZipCodeRangeToField('column_name') . "` AS `zipcode_to` FROM `" . $config->getCustomGroup('table_name') . "` WHERE entity_id = %1";
$params[1] = array($cid, 'Integer');
$rows = array();
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$types = CRM_Core_OptionGroup::values('chapter_match_type');
$countries = CRM_Core_OptionGroup::values('chapter_match_country');
while ($dao->fetch()) {
$country = '';
if (!empty($countries[$dao->country])) {
$country = $countries[$dao->country];
}
$row = array();
$row['type'] = $types[$dao->type];
$row['type_value'] = $dao->type;
$row['country'] = $country;
$row['zipcode_from'] = $dao->zipcode_from;
$row['zipcode_to'] = $dao->zipcode_to;
$row['id'] = $dao->id;
$rows[] = $row;
}
$this->assign('rows', $rows);
$this->assign('cid', $cid);
parent::run();
}
示例15: run
/**
* Run dashboard.
*
* @return void
*/
public function run()
{
// Add dashboard js and css
$resources = CRM_Core_Resources::singleton();
$resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE);
$resources->addStyleFile('civicrm', 'css/dashboard.css');
$resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject);
CRM_Utils_System::setTitle(ts('CiviCRM Home'));
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($resetCache) {
CRM_Core_BAO_Dashboard::resetDashletCache($contactID);
}
// call hook to get html from other modules
// ignored but needed to prevent warnings
$contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
$html = CRM_Utils_Hook::dashboard($contactID, $contentPlacement);
if (is_array($html)) {
$this->assign_by_ref('hookContent', $html);
$this->assign('hookContentPlacement', $contentPlacement);
}
$communityMessages = CRM_Core_CommunityMessages::create();
if ($communityMessages->isEnabled()) {
$message = $communityMessages->pick();
if ($message) {
$this->assign('communityMessages', $communityMessages->evalMarkup($message['markup']));
}
}
return parent::run();
}