本文整理汇总了PHP中CRM_Core_Action类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Action类的具体用法?PHP CRM_Core_Action怎么用?PHP CRM_Core_Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
function browse()
{
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
$campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary();
if (!empty($campaigns)) {
$campaignType = CRM_Core_PseudoConstant::campaignType();
$campaignStatus = CRM_Core_PseudoConstant::campaignStatus();
foreach ($campaigns as $cmpid => $campaign) {
$campaigns[$cmpid]['campaign_id'] = $campaign['id'];
$campaigns[$cmpid]['title'] = $campaign['title'];
$campaigns[$cmpid]['name'] = $campaign['name'];
$campaigns[$cmpid]['description'] = $campaign['description'];
$campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']];
$campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']];
$action = array_sum(array_keys($this->actionLinks()));
if ($campaign['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id']), ts('more'), FALSE, 'campaign.selector.row', 'Campaign', $campaign['id']);
}
}
$this->assign('campaigns', $campaigns);
$this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
}
示例2: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
$setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0);
$mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
$reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id);
if ($reminderList && is_array($reminderList)) {
// Add action links to each of the reminders
foreach ($reminderList as &$format) {
$action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
if ($format['is_active']) {
$action += CRM_Core_Action::DISABLE;
} else {
$action += CRM_Core_Action::ENABLE;
}
$scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
$links = $scheduleReminder->links();
$links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
$links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
$format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $this->_id);
}
}
$this->assign('rows', $reminderList);
$this->assign('setTab', $setTab);
$this->assign('component', 'event');
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = is_array($reminderList) && count($reminderList) > 0;
$this->setPageTitle(ts('Scheduled Reminder'));
}
示例3: browse
function browse()
{
require_once 'CRM/Core/Permission.php';
$campaigns = CRM_Campaign_BAO_Campaign::getCampaign(true);
if (!empty($campaigns)) {
require_once 'CRM/Campaign/BAO/Campaign.php';
$campaignType = CRM_Core_PseudoConstant::campaignType();
$campaignStatus = CRM_Core_PseudoConstant::campaignStatus();
foreach ($campaigns as $cmpid => $campaign) {
$campaigns[$cmpid]['campaign_id'] = $campaign['id'];
$campaigns[$cmpid]['title'] = $campaign['title'];
$campaigns[$cmpid]['name'] = $campaign['name'];
$campaigns[$cmpid]['description'] = $campaign['description'];
$campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']];
$campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']];
$action = array_sum(array_keys($this->actionLinks()));
if ($campaign['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id']));
}
}
$this->assign('campaigns', $campaigns);
$this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
}
示例4: run
/**
* Basic page run function.
*/
public function run()
{
// Get link options for managing events.
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
$tabs = CRM_Event_Page_ManageEvent::tabs($enableCart);
foreach ($tabs as $tab => $tabInfo) {
$tabs[$tab]['name'] = $tabInfo['title'];
$tabs[$tab]['qs'] = $tab == 'reminder' ? 'reset=1&action=browse&setTab=1&id=%%id%%' : 'reset=1&action=update&id=%%id%%';
}
// Get link options for participant listings.
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
$participantLinks = array();
if (1 || !empty($statusTypes)) {
$participantLinks[2] = array('name' => implode(', ', array_values($statusTypes)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=true&event=%%id%%', 'title' => ts('Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
if (!empty($statusTypesPending)) {
$participantLinks[3] = array('name' => implode(', ', array_values($statusTypesPending)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=false&event=%%id%%', 'title' => ts('Not Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
$participantLinks[4] = array('name' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/participant', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')));
// Get link options for event links.
$eventLinks = array(array('name' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/participant/add', 'qs' => 'reset=1&action=add&context=standalone&eid=%%id%%', 'title' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/info', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&action=preview&id=%%id%%', 'title' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions'))));
$utils = new CRM_Eventpermissions_Utils();
$events = array();
foreach ($utils->myUpcomingEvents() as $id => $event) {
$events[] = array('title' => CRM_Utils_System::href($event['title'], 'civicrm/event/info', "id={$id}&reset=1"), 'links' => CRM_Core_Action::formLink($tabs, NULL, array('id' => $id), ts('Configure', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.configure', 'Event', $id), 'participantLinks' => CRM_Core_Action::formLink($participantLinks, $event['participant_listing_id'] ? 6 : 3, array('id' => $id), ts('Participants', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.participants', 'Event', $id), 'eventLinks' => CRM_Core_Action::formLink($eventLinks, NULL, array('id' => $id), ts('Event Links', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.links', 'Event', $id));
}
$this->assign('events', $events);
parent::run();
}
示例5: browse
function browse()
{
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
$statusTypes = array();
$dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->orderBy('weight');
$dao->find();
$visibilities = CRM_Core_PseudoConstant::visibility();
// these statuses are reserved, but disabled by default - so should be disablable after being enabled
$disablable = array('On waitlist', 'Awaiting approval', 'Pending from waitlist', 'Pending from approval', 'Rejected');
while ($dao->fetch()) {
CRM_Core_DAO::storeValues($dao, $statusTypes[$dao->id]);
$action = array_sum(array_keys($this->links()));
if ($dao->is_reserved) {
$action -= CRM_Core_Action::DELETE;
if (!in_array($dao->name, $disablable)) {
$action -= CRM_Core_Action::DISABLE;
}
}
$action -= $dao->is_active ? CRM_Core_Action::ENABLE : CRM_Core_Action::DISABLE;
$statusTypes[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'participantStatusType.manage.action', 'ParticipantStatusType', $dao->id);
$statusTypes[$dao->id]['visibility'] = $visibilities[$dao->visibility_id];
}
$this->assign('rows', $statusTypes);
}
示例6: browse
/**
* Browse all jobs.
*
* @param null $action
*
* @return void
*/
public function browse($action = NULL)
{
$qm = new CRM_Queryrunner_QueryManager();
// using Export action for Execute. Doh.
if ($this->_action & CRM_Core_Action::EXPORT) {
$qm->execute($this->_id, TRUE);
$name = $qm->getNameFromId($this->_id);
CRM_Core_Session::setStatus(ts("The {$name} query has been executed."), ts("Executed"), "success");
}
$freqs = CRM_Queryrunner_Query::getQueryFrequency();
$rows = array();
foreach ($qm->queries as $query) {
$action = array_sum(array_keys($this->links()));
if ($query->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$query->action = CRM_Core_Action::formLink(self::links(), $action, array('id' => $query->id), ts('more'), FALSE, 'query.manage.action', 'Query', $query->id);
$query->last_run = $query->last_run ? date('M j, Y, g:ia', $query->last_run) : 'never';
$query->scheduled_run = $query->scheduled_run ? date('M j, Y, g:ia', $query->scheduled_run) : '';
$query->run_frequency = $freqs[$query->run_frequency];
$query = get_object_vars($query);
$rows[] = $query;
if ($query['id'] == $this->_id) {
$this->assign('query', $query);
}
}
$this->assign('rows', $rows);
if ($this->_action & CRM_Core_Action::PREVIEW) {
$this->assign('server', isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));
$this->assign('doc_root', $_SERVER['DOCUMENT_ROOT']);
}
}
示例7: browse
function browse()
{
require_once 'CRM/Core/Permission.php';
$surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
if (!empty($surveys)) {
require_once 'CRM/Campaign/BAO/Campaign.php';
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$activityTypes = CRM_Core_OptionGroup::values('activity_type', false, false, false, false, 'name');
foreach ($surveys as $sid => $survey) {
$surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
$surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
$surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
$action = array_sum(array_keys($this->actionLinks()));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid));
}
}
$this->assign('surveys', $surveys);
$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
}
示例8: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
$newReminder = CRM_Utils_Request::retrieve('new', 'Boolean', $this, FALSE, FALSE);
if ($this->_action & CRM_Core_Action::UPDATE && !$newReminder) {
$field = 'civicrm_event';
if ($this->_isTemplate) {
$field = 'event_template';
}
$reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $field, $this->_id);
if ($reminderList && is_array($reminderList)) {
// Add action links to each of the reminders
foreach ($reminderList as &$format) {
$action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
if ($format['is_active']) {
$action += CRM_Core_Action::DISABLE;
} else {
$action += CRM_Core_Action::ENABLE;
}
$links = CRM_Admin_Page_ScheduleReminders::links();
$links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&eventId={$this->_id}";
$links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&eventId={$this->_id}";
$format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'event.reminder.list', 'Event', $this->_id);
}
} else {
$reminderList = TRUE;
}
$this->assign('rows', $reminderList);
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = !empty($reminderList) && is_array($reminderList);
}
}
示例9: run
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
if ($action & CRM_Core_Action::UPDATE) {
$controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_ProgressBar', 'Edit Progressbar', CRM_Core_Action::UPDATE);
$controller->set('id', $id);
$controller->process();
return $controller->run();
} elseif ($action & CRM_Core_Action::COPY) {
try {
$sql = "INSERT INTO civicrm_wci_progress_bar (name, starting_amount, goal_amount)\n SELECT concat(name, '-', (SELECT MAX(id) FROM civicrm_wci_progress_bar)),\n starting_amount, goal_amount FROM civicrm_wci_progress_bar\n WHERE id=%1";
CRM_Core_DAO::executeQuery($sql, array(1 => array($id, 'Integer')));
$new_pb_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()');
$sql = "INSERT INTO civicrm_wci_progress_bar_formula\n (contribution_page_id, financial_type_id, progress_bar_id, start_date, end_date, percentage)\n SELECT contribution_page_id, financial_type_id, %1, start_date,\n end_date, percentage FROM civicrm_wci_progress_bar_formula WHERE progress_bar_id=%2";
CRM_Core_DAO::executeQuery($sql, array(1 => array($new_pb_id, 'Integer'), 2 => array($id, 'Integer')));
} catch (Exception $e) {
CRM_Core_Session::setStatus(ts('Failed to create Progress bar. ') . $e->getMessage(), '', 'error');
$transaction->rollback();
}
} elseif ($action & CRM_Core_Action::DELETE) {
$errorScope = CRM_Core_TemporaryErrorScope::useException();
try {
$transaction = new CRM_Core_Transaction();
$sql = "DELETE FROM civicrm_wci_progress_bar_formula where progress_bar_id = %1";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($sql, $params);
$sql = "DELETE FROM civicrm_wci_progress_bar where id = %1";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($sql, $params);
$transaction->commit();
} catch (Exception $e) {
$errmgs = $e->getMessage() . ts('. Check whether progressbar is used by any widget or not');
CRM_Core_Session::setStatus($errmgs, '', 'error');
$transaction->rollback();
}
}
// Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
CRM_Utils_System::setTitle(ts('Progress Bar List'));
$query = "SELECT * FROM civicrm_wci_progress_bar";
$params = array();
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_ProgressBar');
while ($dao->fetch()) {
$con_page[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $con_page[$dao->id]);
$action = array_sum(array_keys($this->actionLinks()));
//build the normal action links.
$con_page[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
}
if (isset($con_page)) {
$this->assign('rows', $con_page);
}
return parent::run();
}
示例10: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$links =& CRM_Contact_Page_View_Relationship::links();
$mask = CRM_Core_Action::mask($this->_permission);
$currentRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_CURRENT, 0, 0, 0, $links, $mask);
$pastRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_PAST, 0, 0, 0, $links, $mask);
$disableRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_DISABLED, 0, 0, 0, $links, $mask);
$this->assign('currentRelationships', $currentRelationships);
$this->assign('pastRelationships', $pastRelationships);
$this->assign('disableRelationships', $disableRelationships);
}
示例11: run
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
if ($action & CRM_Core_Action::UPDATE) {
$controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_CreateWidget', 'Edit Widget', CRM_Core_Action::UPDATE);
$controller->set('id', $id);
$controller->process();
return $controller->run();
} elseif ($action & CRM_Core_Action::COPY) {
try {
$sql = "INSERT INTO civicrm_wci_widget (title, logo_image, image,\n button_title, button_link_to, progress_bar_id, description,\n email_signup_group_id, size_variant, color_title, color_title_bg,\n color_progress_bar, color_progress_bar_bg, color_widget_bg, color_description, color_border,\n color_button, color_button_bg, hide_title, hide_border, hide_pbcap,\n color_btn_newsletter, color_btn_newsletter_bg, newsletter_text,\n color_newsletter_text, style_rules, override, custom_template, show_pb_perc)\n SELECT concat(title, '-', (SELECT MAX(id) FROM civicrm_wci_widget)), logo_image, image,\n button_title, button_link_to, progress_bar_id, description,\n email_signup_group_id, size_variant, color_title, color_title_bg,\n color_progress_bar, color_progress_bar_bg, color_widget_bg, color_description, color_border,\n color_button, color_button_bg, hide_title, hide_border, hide_pbcap,\n color_btn_newsletter, color_btn_newsletter_bg, newsletter_text,\n color_newsletter_text, style_rules, override, custom_template, show_pb_perc FROM civicrm_wci_widget WHERE id=%1";
CRM_Core_DAO::executeQuery("SET foreign_key_checks = 0;");
CRM_Core_DAO::executeQuery($sql, array(1 => array($id, 'Integer')));
CRM_Core_DAO::executeQuery("SET foreign_key_checks = 1;");
} catch (Exception $e) {
CRM_Core_Session::setStatus(ts('Failed to create widget. ') . $e->getMessage(), '', 'error');
$transaction->rollback();
}
} elseif ($action & CRM_Core_Action::DELETE) {
try {
$transaction = new CRM_Core_Transaction();
$sql = "DELETE FROM civicrm_wci_widget where id = %1";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($sql, $params);
$transaction->commit();
} catch (Exception $e) {
CRM_Core_Session::setStatus(ts('Failed to delete widget. ') . $e->getMessage(), '', 'error');
$transaction->rollback();
}
}
CRM_Utils_System::setTitle(ts('Widget List'));
$query = "SELECT * FROM civicrm_wci_widget";
$params = array();
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_Widget');
while ($dao->fetch()) {
$wid_page[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $wid_page[$dao->id]);
$wid_page[$dao->id]['title'] = $wid_page[$dao->id]['title'];
$description = $wid_page[$dao->id]['description'];
$wid_page[$dao->id]['description'] = strip_tags($description);
$action = array_sum(array_keys($this->actionLinks()));
//build the normal action links.
$wid_page[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
}
if (isset($wid_page)) {
$this->assign('rows', $wid_page);
}
parent::run();
}
示例12: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$note =& new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
$values = array();
$links =& CRM_Profile_Page_Note::links();
$action = array_sum(CRM_Profile_Page_Note::links());
$note->find();
while ($note->fetch()) {
$values[$note->id] = array();
CRM_Core_DAO::storeValues($note, $values[$note->id]);
$values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
}
$this->assign('notes', $values);
}
示例13: run
function run()
{
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
if ($action & CRM_Core_Action::UPDATE) {
$controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_NewEmbedCode', 'Edit Embed Code', CRM_Core_Action::UPDATE);
$controller->set('id', $id);
$controller->process();
return $controller->run();
} elseif ($action & CRM_Core_Action::DELETE) {
try {
$transaction = new CRM_Core_Transaction();
$sql = "DELETE FROM civicrm_wci_embed_code where id = %1";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($sql, $params);
$transaction->commit();
} catch (Exception $e) {
CRM_Core_Session::setStatus(ts('Failed to delete embed code. ') . $e->getMessage(), '', 'error');
$transaction->rollback();
}
}
CRM_Utils_System::setTitle(ts('Embed Code List'));
$query = "SELECT * FROM civicrm_wci_embed_code";
$params = array();
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Wci_DAO_EmbedCode');
while ($dao->fetch()) {
$emb_code[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $emb_code[$dao->id]);
$emb_code[$dao->id]['id'] = $emb_code[$dao->id]['id'];
$emb_code[$dao->id]['name'] = $emb_code[$dao->id]['name'];
$action = array_sum(array_keys($this->actionLinks()));
//build the normal action links.
$emb_code[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
}
if (isset($emb_code)) {
$this->assign('rows', $emb_code);
}
parent::run();
}
示例14: browse
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function browse()
{
$note =& new CRM_Core_DAO_Note();
$note->entity_table = 'civicrm_contact';
$note->entity_id = $this->_contactId;
$note->orderBy('modified_date desc');
$values = array();
$links =& CRM_Contact_Page_View_Note::links();
$action = array_sum(array_keys($links)) & CRM_Core_Action::mask($this->_permission);
$note->find();
while ($note->fetch()) {
$values[$note->id] = array();
CRM_Core_DAO::storeValues($note, $values[$note->id]);
$values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $note->contact_id;
$contact->find();
$contact->fetch();
$values[$note->id]['createdBy'] = $contact->display_name;
}
$this->assign('notes', $values);
}
示例15: browse
public function browse()
{
$surveys = CRM_Campaign_BAO_Survey::getSurveySummary();
if (!empty($surveys)) {
$surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
$campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
$activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, FALSE, 'name');
foreach ($surveys as $sid => $survey) {
$surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
$surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
$surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
$action = array_sum(array_keys($this->actionLinks()));
if ($survey['is_active']) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid), ts('more'), FALSE, 'survey.selector.row', 'Survey', $sid);
}
}
$this->assign('surveys', $surveys);
$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
}