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(); }
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(); }
/** * @return string */ public function run() { $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0); $this->assign('action', $action); $this->browse(); return parent::run(); }
function run() { $config =& CRM_Core_Config::singleton(); $ufAccessURL = CRM_Utils_System::url('admin/user/permissions'); $this->assign('ufAccessURL', $ufAccessURL); return parent::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(); } }
/** * 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(); }
/** * 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(); }
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(); }
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(); }
/** * 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(); }
/** * 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(); }
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(); }
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(); }
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(); }
/** * 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(); }
function run() { CRM_Utils_System::setTitle(ts('Bank Transaction Exporter')); // get the plugins $plugin_list = CRM_Banking_BAO_PluginInstance::listInstances('export'); $this->assign('plugin_list', $plugin_list); // get the IDs $txbatch2ids = CRM_Banking_PluginModel_Exporter::getIdLists($_REQUEST); $txcount = 0; foreach ($txbatch2ids as $txbatchid => $txbatchcontent) { $txcount += count($txbatchcontent); } $this->assign('txbatch_count', count($txbatch2ids)); $this->assign('tx_count', $txcount); if (!empty($_REQUEST['list'])) { $this->assign('list', $_REQUEST['list']); } if (!empty($_REQUEST['s_list'])) { $this->assign('s_list', $_REQUEST['s_list']); } // check for the page mode if (isset($_REQUEST['exporter-plugin'])) { // EXECUTE // get the plugin instance $plugin_id = $_REQUEST['exporter-plugin']; foreach ($plugin_list as $plugin) { if ($plugin->id == $plugin_id) { break; } } $plugin_instance = $plugin->getInstance(); // TODO: select WHICH mode (this is only file mode) // start exporting $file_data = $plugin_instance->export_file($txbatch2ids, $_REQUEST); // process result (redirect, ...) if (empty($file_data['is_error'])) { $mime_type = mime_content_type($file_data['path']); $buffer = file_get_contents($file_data['path']); CRM_Utils_System::download($file_data['file_name'], $file_data['mime_type'], $buffer, $file_data['file_extension']); } } else { // CONFIGURATION MODE: $plugin_capabilities = array(); foreach ($plugin_list as $plugin) { $capability = ''; $instance = $plugin->getInstance(); if ($instance->does_export_files()) { $capability .= 'F'; } if ($instance->does_export_stream()) { $capability .= 'S'; } $plugin_capabilities[$plugin->id] = $capability; } $this->assign('plugin_capabilities', $plugin_capabilities); } // URLs $this->assign('url_action', CRM_Utils_System::url('civicrm/banking/export')); parent::run(); }
/** * Run the page. * * This method is called after the page is created. */ public function run() { // get the emails for this contact $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name')); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $entityBlock = array('contact_id' => $contactId); $phones = CRM_Core_BAO_Phone::getValues($entityBlock); if (!empty($phones)) { foreach ($phones as $key => &$value) { $value['location_type'] = $locationTypes[$value['location_type_id']]; $value['phone_type'] = $phoneTypes[$value['phone_type_id']]; } } $contact = new CRM_Contact_BAO_Contact(); $contact->id = $contactId; $contact->find(TRUE); $privacy = array(); foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) { if (isset($contact->{$name})) { $privacy[$name] = $contact->{$name}; } } $this->assign('contactId', $contactId); $this->assign('phone', $phones); $this->assign('privacy', $privacy); // check logged in user permission CRM_Contact_Page_View::checkUserPermission($this, $contactId); // finally call parent parent::run(); }
/** * Run the page. * * This method is called after the page is created. * * @return void * @access public * */ function run() { // get the callback, module and activity id $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $dao = new CRM_Core_DAO_ActivityHistory(); $dao->activity_id = $id; $dao->activity_type = ts('SMS Sent'); if ($dao->find(TRUE)) { $cid = $dao->entity_id; } $dao = new CRM_SMS_DAO_History(); $dao->id = $id; if ($dao->find(TRUE)) { $this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name')); $this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')); $this->assign('sentDate', $dao->sent_date); $this->assign('message', $dao->message); // get the display name and images for the contact list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id); CRM_Utils_System::setTitle($contactImage . ' ' . $displayName); // also add the cid params to the Menu array CRM_Core_Menu::addParam('cid', $cid); } return parent::run(); }
function run() { // Prepares variables for being sent to Smarty //Only show countries with attached information $countries = null; $stats = civicrm_api3('Bic', 'stats'); foreach ($stats['values'] as $country => $count) { $countries[] = $country; } // Get country names $country_names = null; if ($countries) { $config = CRM_Core_Config::singleton(); $country_names = array(); $id2code = CRM_Core_PseudoConstant::countryIsoCode(); $default_country = $id2code[$config->defaultContactCountry]; $code2id = array_flip($id2code); $id2country = CRM_Core_PseudoConstant::country(false, false); foreach ($countries as $code) { $country_id = $code2id[$code]; $country_name = $id2country[$country_id]; $country_names[$code] = $country_name; } } // Sends variables to Smarty $this->assign('countries', $countries); $this->assign('country_names', $country_names); $this->assign('default_country', $default_country); $this->assign('show_message', true); parent::run(); }
function run() { $countries = CRM_Bic_Parser_Parser::getParserList(); $stats = civicrm_api3('Bic', 'stats'); $total_count = 0; foreach ($countries as $country) { if (isset($stats['values'][$country])) { $total_count += $stats['values'][$country]; } else { $stats['values'][$country] = 0; } } // gather the names $country_names = array(); $config = CRM_Core_Config::singleton(); $id2code = CRM_Core_PseudoConstant::countryIsoCode(); $default_country = $id2code[$config->defaultContactCountry]; $code2id = array_flip($id2code); $id2country = CRM_Core_PseudoConstant::country(FALSE, FALSE); foreach ($countries as $code) { $country_id = $code2id[$code]; $country_name = $id2country[$country_id]; $country_names[$code] = $country_name; } $this->assign('countries', $countries); $this->assign('country_names', $country_names); $this->assign('default_country', $default_country); $this->assign('stats', $stats['values']); $this->assign('total_count', $total_count); parent::run(); }
/** * Run dashboard * * @return void * @access public */ function run() { CRM_Utils_System::setTitle(ts('Dashlets')); $this->assign('admin', CRM_Core_Permission::check('administer CiviCRM')); // get all dashlets $allDashlets = CRM_Core_BAO_Dashboard::getDashlets(FALSE); // get dashlets for logged in contact $currentDashlets = CRM_Core_BAO_Dashboard::getContactDashlets(); $contactDashlets = $availableDashlets = array(); foreach ($currentDashlets as $columnNo => $values) { foreach ($values as $val => $isMinimized) { list($weight, $dashletID) = explode('-', $val); $key = "{$dashletID}-{$isMinimized}"; $contactDashlets[$columnNo][$key] = array('label' => $allDashlets[$dashletID]['label'], 'is_reserved' => $allDashlets[$dashletID]['is_reserved']); unset($allDashlets[$dashletID]); } } foreach ($allDashlets as $dashletID => $values) { $key = "{$dashletID}-0"; $availableDashlets[$key] = array('label' => $values['label'], 'is_reserved' => $values['is_reserved']); } $this->assign('contactDashlets', $contactDashlets); $this->assign('availableDashlets', $availableDashlets); return parent::run(); }
/** * Run the page. * * This method is called after the page is created. * * @return void * @access public * */ function run() { // get the callback, module and activity id $action = CRM_Utils_Request::retrieve('action', $this, false, 'browse'); $id = CRM_Utils_Request::retrieve('id', $this); $dao =& new CRM_Core_DAO_ActivityHistory(); $dao->activity_id = $id; $dao->activity_type = ts('SMS Sent'); if ($dao->find(true)) { $cid = $dao->entity_id; } require_once 'CRM/SMS/DAO/History.php'; $dao =& new CRM_SMS_DAO_History(); $dao->id = $id; if ($dao->find(true)) { $this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name')); $this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')); $this->assign('sentDate', $dao->sent_date); $this->assign('message', $dao->message); // get the display name and images for the contact list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id); CRM_Utils_System::setTitle($contactImage . ' ' . $displayName); require_once 'CRM/Utils/Menu.php'; // also add the cid params to the Menu array CRM_Utils_Menu::addParam('cid', $cid); // create menus .. $startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view'); $startWeight++; require_once 'CRM/Core/BAO/CustomGroup.php'; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight); } parent::run(); }
function run() { $smarty= CRM_Core_Smarty::singleton( ); $dummy = NULL; if (array_key_exists('id',$_GET)) {// special treatmenent, because it's often used $smarty->assign ('id',(int)$_GET['id']);// an id is always positive } $pos = strpos (implode (array_keys ($_GET)),'<') ; if ($pos !== false) { die ("SECURITY FATAL: one of the param names contains <"); } $param = array_map( 'htmlentities' , $_GET); //TODO: sql escape the params too unset($param['q']); $smarty->assign_by_ref("request", $param); CRM_Core_Resources::singleton() ->addScriptFile('eu.tttp.civisualize', 'js/d3.v3.js', 110, 'html-header', FALSE) ->addScriptFile('eu.tttp.civisualize', 'js/dc/dc.js', 110, 'html-header', FALSE) ->addScriptFile('eu.tttp.civisualize', 'js/dc/crossfilter.js', 110, 'html-header', FALSE) ->addStyleFile('eu.tttp.civisualize', 'js/dc/dc.css') ->addStyleFile('eu.tttp.civisualize', 'css/style.css'); require_once 'CRM/Core/Smarty/plugins/function.crmSQL.php'; $smarty->register_function("crmSQL", "smarty_function_crmSQL"); require_once 'CRM/Core/Smarty/plugins/function.crmRetrieve.php'; $smarty->register_function("crmRetrieve", "smarty_function_crmRetrieve"); require_once 'CRM/Core/Smarty/plugins/function.crmTitle.php'; $smarty->register_function("crmTitle", "smarty_function_crmTitle"); return parent::run(); }
/** * Run the page. * * This method is called after the page is created. */ public function run() { // get the emails for this contact $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); //custom groups Inline $entityType = CRM_Contact_BAO_Contact::getContactType($contactId); $entitySubType = CRM_Contact_BAO_Contact::getContactSubType($contactId); $groupTree =& CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId, $cgId, $entitySubType); $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $contactId); //get the fields of single custom group record if ($customRecId == 1) { $fields = reset($details[$cgId]); } else { $fields = CRM_Utils_Array::value($customRecId, $details[$cgId]); } $this->assign('cgcount', $cgcount); $this->assign('customRecId', $customRecId); $this->assign('contactId', $contactId); $this->assign('customGroupId', $cgId); $this->assign_by_ref('cd_edit', $fields); // check logged in user permission CRM_Contact_Page_View::checkUserPermission($this, $contactId); // finally call parent parent::run(); }
/** * List activities as dashlet * * @return none * * @access public */ function run() { $session = CRM_Core_Session::singleton(); $contactID = $session->get('userID'); // a user can always view their own activity // if they have access CiviCRM permission $permission = CRM_Core_Permission::VIEW; // make the permission edit if the user has edit permission on the contact require_once 'CRM/Contact/BAO/Contact/Permission.php'; if (CRM_Contact_BAO_Contact_Permission::allow($contactID, CRM_Core_Permission::EDIT)) { $permission = CRM_Core_Permission::EDIT; } $admin = CRM_Core_Permission::check('view all activities') || CRM_Core_Permission::check('administer CiviCRM'); require_once 'CRM/Core/Selector/Controller.php'; $output = CRM_Core_Selector_Controller::SESSION; require_once 'CRM/Activity/Selector/Activity.php'; $selector = new CRM_Activity_Selector_Activity($contactID, $permission, $admin, 'home'); $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, $output); $controller->setEmbedded(true); $controller->run(); $controller->moveFromSessionToTemplate(); return parent::run(); }
function run() { list($ext, $suite) = $this->getRequestExtAndSuite(); if (empty($ext) || empty($suite)) { throw new CRM_Core_Exception("FIXME: Not implemented: QUnit browser"); } if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+$/', $suite) || strpos($suite, '..') !== FALSE) { throw new CRM_Core_Exception("Malformed suite name"); } $path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath($ext); if (!is_dir("{$path}/tests/qunit/{$suite}")) { throw new CRM_Core_Exception("Failed to locate test suite"); } // Load the test suite -- including any PHP, TPL, or JS content if (file_exists("{$path}/tests/qunit/{$suite}/test.php")) { // e.g. load resources require_once "{$path}/tests/qunit/{$suite}/test.php"; } if (file_exists("{$path}/tests/qunit/{$suite}/test.tpl")) { // e.g. setup markup and/or load resources CRM_Core_Smarty::singleton()->addTemplateDir("{$path}/tests"); $this->assign('qunitTpl', "qunit/{$suite}/test.tpl"); } if (file_exists("{$path}/tests/qunit/{$suite}/test.js")) { CRM_Core_Resources::singleton()->addScriptFile($ext, "tests/qunit/{$suite}/test.js", 1000); } CRM_Utils_System::setTitle(ts('QUnit: %2 (%1)', array(1 => $ext, 2 => $suite))); CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/qunit/qunit.js')->addStyleFile('civicrm', 'packages/qunit/qunit.css'); parent::run(); }
/** * @return string */ public function run() { $config = CRM_Core_Config::singleton(); switch ($config->userFramework) { case 'Drupal': $this->assign('ufAccessURL', url('admin/people/permissions')); break; case 'Drupal6': $this->assign('ufAccessURL', url('admin/user/permissions')); break; case 'Joomla': //condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value if (version_compare(JVERSION, '3.0', 'lt')) { JHTML::_('behavior.modal'); $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component'; $jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"'; $this->assign('ufAccessURL', $url); $this->assign('jAccessParams', $jparams); } else { $uri = (string) JUri::getInstance(); $return = urlencode(base64_encode($uri)); $url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&return=' . $return; $this->assign('ufAccessURL', $url); $this->assign('jAccessParams', ''); } break; case 'WordPress': $this->assign('ufAccessURL', CRM_Utils_System::url('civicrm/admin/access/wp-permissions', 'reset=1')); break; } return parent::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($this); if ($this->_action & CRM_Core_Action::UPDATE) { $this->edit(); } 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 $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); // 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(); }
function run() { $session = CRM_Core_Session::singleton(); $apiURL = "https://graph.facebook.com/v2.3"; $redirect_uri = rawurldecode(CRM_Utils_System::url('civicrm/civisocial/facebookcallback', NULL, TRUE)); // Retreive client_id and client_secret from settings $is_enabled = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'enable_facebook')); if (!$is_enabled) { die("Backend not enabled."); } $client_secret = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'facebook_secret')); $client_id = civicrm_api3('setting', 'getvalue', array('group' => 'CiviSocial Account Credentials', 'name' => 'facebook_app_id')); // Facebook sends a code to the callback url, this is further used to acquire // access token from facebook, which is needed to get all the data from facebook if (array_key_exists('code', $_GET)) { $facebook_code = $_GET['code']; } else { die("FACEBOOK FATAL: the request returned without the code. Please try loging in again."); } // Get the access token from facebook for the user $access_token = ""; $access_token_response = $this->get_response($apiURL, "oauth/access_token", FALSE, array("client_id" => $client_id, "client_secret" => $client_secret, "code" => $facebook_code, "redirect_uri" => $redirect_uri)); if (array_key_exists("error", $access_token_response)) { die($access_token_response["error"]); $access_token = ""; } else { $access_token = $access_token_response["access_token"]; } $user_data_response = $this->get_response($apiURL, "me", FALSE, array("access_token" => $access_token)); $contact_id = CRM_Civisocial_BAO_CivisocialUser::handle_facebook_data($user_data_response); $this->assign('status', $contact_id); $session->set('userID', $contact_id); parent::run(); }
function run() { $rows = self::getAllRows(); $this->assign('rows', $rows); CRM_Core_Resources::singleton()->addScriptFile('com.giantrabbit.civimailchimp', 'js/sync_log.js'); parent::run(); }