本文整理汇总了PHP中CRM_Core_Action类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Action类的具体用法?PHP CRM_Core_Action怎么用?PHP CRM_Core_Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Action类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:26,代码来源:Campaign.php
示例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'));
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:34,代码来源:ScheduleReminders.php
示例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'));
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:27,代码来源:Campaign.php
示例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();
}
开发者ID:aghstrategies,项目名称:com.aghstrategies.eventpermissions,代码行数:33,代码来源:MyEvents.php
示例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);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:25,代码来源:ParticipantStatus.php
示例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']);
}
}
开发者ID:imba-us,项目名称:com.imba.queryrunner,代码行数:41,代码来源:QueryRunner.php
示例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'));
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:25,代码来源:Survey.php
示例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);
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:38,代码来源:ScheduleReminders.php
示例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();
}
开发者ID:Jagadees-zyxware,项目名称:civicrm-wci,代码行数:57,代码来源:ProgressBarList.php
示例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);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:17,代码来源:Relationship.php
示例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();
}
开发者ID:Jagadees-zyxware,项目名称:civicrm-wci,代码行数:53,代码来源:WidgetList.php
示例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);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:23,代码来源:Note.php
示例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();
}
开发者ID:Jagadees-zyxware,项目名称:civicrm-wci,代码行数:42,代码来源:ManageEmbedCode.php
示例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);
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:28,代码来源:Note.php
示例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'));
}
开发者ID:kidaa30,项目名称:yes,代码行数:23,代码来源:Survey.php
示例16: 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) {
$reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, 'civicrm_event', $this->_id);
if (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']));
}
$this->assign('rows', $reminderList);
}
}
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:30,代码来源:ScheduleReminders.php
示例17: array
/**
* returns all the rows in the given offset and rowCount
*
* @param enum $action the action being performed
* @param int $offset the row number to start from
* @param int $rowCount the number of rows to return
* @param string $sort the sql string that describes the sort order
* @param enum $output what should the result set include (web/email/csv)
*
* @return int the total number of rows for this action
*/
function &getRows($action, $offset, $rowCount, $sort, $output = null)
{
$config =& CRM_Core_Config::singleton();
if (($output == CRM_CORE_SELECTOR_CONTROLLER_EXPORT || $output == CRM_CORE_SELECTOR_CONTROLLER_SCREEN) && $this->_formValues['radio_ts'] == 'ts_sel') {
$includeContactIds = true;
} else {
$includeContactIds = false;
}
// note the formvalues were given by CRM_Contact_Form_Search to us
// and contain the search criteria (parameters)
// note that the default action is basic
$result = $this->_query->searchQuery($offset, $rowCount, $sort, false, $includeContactIds);
// process the result of the query
$rows = array();
$mask = CRM_Core_Action::mask(CRM_Core_Permission::getPermission());
$mapMask = $mask & 4095;
// mask value to hide map link if there are not lat/long
$gc = CRM_Core_SelectValues::groupContactStatus();
/* Dirty session hack to get at the context */
$session =& CRM_Core_Session::singleton();
$context = $session->get('context', 'CRM_Contact_Controller_Search');
// CRM_Core_Error::debug( 'p', self::$_properties );
while ($result->fetch()) {
$row = array();
// the columns we are interested in
foreach ($GLOBALS['_CRM_CONTACT_SELECTOR']['_properties'] as $property) {
if ($property == 'status') {
continue;
}
$row[$property] = $result->{$property};
}
if (!empty($result->postal_code_suffix)) {
$row['postal_code'] .= "-" . $result->postal_code_suffix;
}
if ($output != CRM_CORE_SELECTOR_CONTROLLER_EXPORT || $context == 'smog') {
if (empty($result->status)) {
$row['status'] = ts('Smart');
} else {
$row['status'] = $gc[$result->status];
}
}
if ($output != CRM_CORE_SELECTOR_CONTROLLER_EXPORT && $output != CRM_CORE_SELECTOR_CONTROLLER_SCREEN) {
$row['checkbox'] = CRM_CORE_FORM_CB_PREFIX . $result->contact_id;
if (is_numeric(CRM_Utils_Array::value('geo_code_1', $row))) {
$row['action'] = CRM_Core_Action::formLink(CRM_Contact_Selector::links(), $mask, array('id' => $result->contact_id));
} else {
$row['action'] = CRM_Core_Action::formLink(CRM_Contact_Selector::links(), $mapMask, array('id' => $result->contact_id));
}
$contact_type = '<img src="' . $config->resourceBase . 'i/contact_';
switch ($result->contact_type) {
case 'Individual':
$contact_type .= 'ind.gif" alt="' . ts('Individual') . '" />';
break;
case 'Household':
$contact_type .= 'house.png" alt="' . ts('Household') . '" height="16" width="16" />';
break;
case 'Organization':
$contact_type .= 'org.gif" alt="' . ts('Organization') . '" height="16" width="18" />';
break;
}
$row['contact_type'] = $contact_type;
}
$rows[] = $row;
}
return $rows;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:77,代码来源:Selector.php
示例18: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
//load form for child blocks
if ($this->_addBlockName) {
$className = 'CRM_Contact_Form_Edit_' . $this->_addBlockName;
return $className::buildQuickForm($this);
}
if ($this->_action == CRM_Core_Action::UPDATE) {
$deleteExtra = json_encode(ts('Are you sure you want to delete contact image.'));
$deleteURL = array(CRM_Core_Action::DELETE => array('name' => ts('Delete Contact Image'), 'url' => 'civicrm/contact/image', 'qs' => 'reset=1&cid=%%id%%&action=delete', 'extra' => 'onclick = "' . htmlspecialchars("if (confirm({$deleteExtra})) this.href+='&confirmed=1'; else return false;") . '"'));
$deleteURL = CRM_Core_Action::formLink($deleteURL, CRM_Core_Action::DELETE, array('id' => $this->_contactId), ts('more'), FALSE, 'contact.image.delete', 'Contact', $this->_contactId);
$this->assign('deleteURL', $deleteURL);
}
//build contact type specific fields
$className = 'CRM_Contact_Form_Edit_' . $this->_contactType;
$className::buildQuickForm($this);
// build Custom data if Custom data present in edit option
$buildCustomData = 'noCustomDataPresent';
if (array_key_exists('CustomData', $this->_editOptions)) {
$buildCustomData = "customDataPresent";
}
// subtype is a common field. lets keep it here
$subtypes = CRM_Contact_BAO_Contact::buildOptions('contact_sub_type', 'create', array('contact_type' => $this->_contactType));
if (!empty($subtypes)) {
$this->addField('contact_sub_type', array('label' => ts('Contact Type'), 'options' => $subtypes, 'class' => $buildCustomData, 'multiple' => 'multiple', 'options-url' => FALSE));
}
// build edit blocks ( custom data, demographics, communication preference, notes, tags and groups )
foreach ($this->_editOptions as $name => $label) {
if ($name == 'Address') {
$this->_blocks['Address'] = $this->_editOptions['Address'];
continue;
}
if ($name == 'TagsAndGroups') {
continue;
}
$className = 'CRM_Contact_Form_Edit_' . $name;
$className::buildQuickForm($this);
}
// build tags and groups
CRM_Contact_Form_Edit_TagsAndGroups::buildQuickForm($this, 0, CRM_Contact_Form_Edit_TagsAndGroups::ALL, FALSE, NULL, 'Group(s)', 'Tag(s)', NULL, 'select');
// build location blocks.
CRM_Contact_Form_Edit_Lock::buildQuickForm($this);
CRM_Contact_Form_Location::buildQuickForm($this);
// add attachment
$this->addField('image_URL', array('maxlength' => '60', 'label' => ts('Browse/Upload Image')));
// add the dedupe button
$this->addElement('submit', $this->_dedupeButtonName, ts('Check for Matching Contact(s)'));
$this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
$this->addElement('submit', $this->getButtonName('next', 'sharedHouseholdDuplicate'), ts('Save With Duplicate Household'));
$buttons = array(array('type' => 'upload', 'name' => ts('Save'), 'subName' => 'view', 'isDefault' => TRUE));
if (CRM_Core_Permission::check('add contacts')) {
$buttons[] = array('type' => 'upload', 'name' => ts('Save and New'), 'spacing' => ' ', 'subName' => 'new');
}
$buttons[] = array('type' => 'cancel', 'name' => ts('Cancel'));
if (!empty($this->_values['contact_sub_type'])) {
$this->_oldSubtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($this->_values['contact_sub_type'], CRM_Core_DAO::VALUE_SEPARATOR));
}
$this->assign('oldSubtypes', json_encode($this->_oldSubtypes));
$this->addButtons($buttons);
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:63,代码来源:Contact.php
|
请发表评论