本文整理匯總了PHP中CRM_Activity_DAO_Activity::fetch方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Activity_DAO_Activity::fetch方法的具體用法?PHP CRM_Activity_DAO_Activity::fetch怎麽用?PHP CRM_Activity_DAO_Activity::fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Activity_DAO_Activity
的用法示例。
在下文中一共展示了CRM_Activity_DAO_Activity::fetch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cleanupActivity
/**
* This function delete activity record related to contact record,
* when there are no target and assignee record w/ other contact.
*
* @param int $contactId contactId
*
* @return true/null
* @access public
*/
public function cleanupActivity($contactId)
{
$result = null;
if (!$contactId) {
return $result;
}
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
// delete activity if there are no record in
// civicrm_activity_assignment or civicrm_activity_target
// pointing to any other contact record.
require_once 'CRM/Activity/DAO/ActivityTarget.php';
require_once 'CRM/Activity/DAO/ActivityAssignment.php';
$activity = new CRM_Activity_DAO_Activity();
$activity->source_contact_id = $contactId;
$activity->find();
while ($activity->fetch()) {
$noTarget = $noAssignee = true;
// check for target activity record.
$target = new CRM_Activity_DAO_ActivityTarget();
$target->activity_id = $activity->id;
$target->find();
while ($target->fetch()) {
if ($target->target_contact_id != $contactId) {
$noTarget = false;
break;
}
}
$target->free();
// check for assignee activity record.
$assignee = new CRM_Activity_DAO_ActivityAssignment();
$assignee->activity_id = $activity->id;
$assignee->find();
while ($assignee->fetch()) {
if ($assignee->assignee_contact_id != $contactId) {
$noAssignee = false;
break;
}
}
$assignee->free();
// finally delete activity.
if ($noTarget && $noAssignee) {
$activityParams = array('id' => $activity->id);
$result = self::deleteActivity($activityParams);
}
}
$activity->free();
$transaction->commit();
return $result;
}
示例2: updateRecords
/**
* Updates contacts affected by the option value passed.
*
* @param int $optionValueId
* The option value id.
* @param int $action
* The action describing whether prefix/suffix was UPDATED or DELETED.
*
* @return bool
*/
public static function updateRecords(&$optionValueId, $action)
{
//finding group name
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
$optionValue->find(TRUE);
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->id = $optionValue->option_group_id;
$optionGroup->find(TRUE);
// group name
$gName = $optionGroup->name;
// value
$value = $optionValue->value;
// get the proper group name & affected field name
// todo: this may no longer be needed for individuals - check inputs
$individuals = array('gender' => 'gender_id', 'individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'communication_style' => 'communication_style_id');
$contributions = array('payment_instrument' => 'payment_instrument_id');
$activities = array('activity_type' => 'activity_type_id');
$participant = array('participant_role' => 'role_id');
$eventType = array('event_type' => 'event_type_id');
$aclRole = array('acl_role' => 'acl_role_id');
$all = array_merge($individuals, $contributions, $activities, $participant, $eventType, $aclRole);
$fieldName = '';
foreach ($all as $name => $id) {
if ($gName == $name) {
$fieldName = $id;
}
}
if ($fieldName == '') {
return TRUE;
}
if (array_key_exists($gName, $individuals)) {
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->{$fieldName} = $value;
$contactDAO->find();
while ($contactDAO->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $contactDAO->id;
$contact->find(TRUE);
// make sure dates doesn't get reset
$contact->birth_date = CRM_Utils_Date::isoToMysql($contact->birth_date);
$contact->deceased_date = CRM_Utils_Date::isoToMysql($contact->deceased_date);
$contact->{$fieldName} = 'NULL';
$contact->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $contributions)) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->{$fieldName} = $value;
$contribution->find();
while ($contribution->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contribution->{$fieldName} = 'NULL';
$contribution->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $activities)) {
$activity = new CRM_Activity_DAO_Activity();
$activity->{$fieldName} = $value;
$activity->find();
while ($activity->fetch()) {
$activity->delete();
}
return TRUE;
}
//delete participant role, type and event type option value
if (array_key_exists($gName, $participant)) {
$participantValue = new CRM_Event_DAO_Participant();
$participantValue->{$fieldName} = $value;
if ($participantValue->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete event type option value
if (array_key_exists($gName, $eventType)) {
$event = new CRM_Event_DAO_Event();
$event->{$fieldName} = $value;
if ($event->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete acl_role option value
if (array_key_exists($gName, $aclRole)) {
//.........這裏部分代碼省略.........
示例3: browse
/**
* Browse all Public Holidays
*
*
* @return void
* @access public
* @static
*/
function browse()
{
$publicHoliday = array();
$dao = new CRM_Activity_DAO_Activity();
$dao->activity_type_id = civicrm_api3('OptionValue', 'getvalue', array('name' => 'Public Holiday', 'return' => 'value'));
$dao->find();
while ($dao->fetch()) {
$publicHoliday[$dao->id] = array();
$publicHoliday[$dao->id]['id'] = $dao->id;
$publicHoliday[$dao->id]['subject'] = $dao->subject;
if (array_search('Scheduled', CRM_Core_PseudoConstant::activityStatus()) == $dao->status_id) {
$publicHoliday[$dao->id]['status'] = 1;
} else {
$publicHoliday[$dao->id]['status'] = 0;
}
$publicHoliday[$dao->id]['date'] = $dao->activity_date_time;
// form all action links
$action = array_sum(array_keys($this->links()));
$publicHoliday[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
}
$this->assign('rows', $publicHoliday);
}