/** * This function contains the actions for arg[1] = contact * * @param $args array this array contains the arguments of the url * * @static * @access public */ function contact($args) { //code added for testing ajax if ($args[2] == 'test') { $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Contact_Form_Test', ts('Test Ajax Page'), $action); } $session =& CRM_Core_Session::singleton(); $breadCrumbPath = CRM_Utils_System::url('civicrm/contact/search/basic', 'force=1'); if ($session->get('isAdvanced')) { $breadCrumbPath = CRM_Utils_System::url('civicrm/contact/search/advanced', 'force=1'); } $additionalBreadCrumb = "<a href=\"{$breadCrumbPath}\">" . ts('Search Results') . '</a>'; if ($args[1] !== 'contact') { return; } if (substr($args[2], 0, 3) == 'add') { return CRM_Core_Invoke::form(CRM_CORE_ACTION_ADD); } if ($args[2] == 'domain') { $session =& CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/domain', 'action=view')); $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Contact_Form_Domain', ts('Domain Information Page'), null); } if ($args[2] == 'email') { // set the userContext stack $session =& CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/activity', 'action=browse')); $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Contact_Form_Task_Email', ts('Email a Contact'), null); } if ($args[2] == 'view') { CRM_Utils_System::appendBreadCrumb($additionalBreadCrumb); $thirdArg = CRM_Utils_Array::value(3, $args, ''); $fourthArg = CRM_Utils_Array::value(4, $args, 0); switch ($thirdArg) { case 'contribution': require_once 'CRM/Contact/Page/View/Contribution.php'; $view =& new CRM_Contact_Page_View_Contribution(); break; case 'note': require_once 'CRM/Contact/Page/View/Note.php'; $view =& new CRM_Contact_Page_View_Note(); break; case 'rel': require_once 'CRM/Contact/Page/View/Relationship.php'; $view =& new CRM_Contact_Page_View_Relationship(); break; case 'group': require_once 'CRM/Contact/Page/View/GroupContact.php'; $view =& new CRM_Contact_Page_View_GroupContact(); break; case 'tag': require_once 'CRM/Contact/Page/View/Tag.php'; $view =& new CRM_Contact_Page_View_Tag(); break; case 'cd': require_once 'CRM/Contact/Page/View/CustomData.php'; $view =& new CRM_Contact_Page_View_CustomData(); break; case 'activity': $activityId = CRM_Utils_Request::retrieve('activity_id', $form); $show = CRM_Utils_Request::retrieve('show', $form); $session =& CRM_Core_Session::singleton(); if (!$show) { if ($activityId) { $session->set('activityId', $activityId); } else { $activityId = $session->get('activityId'); } } if ($activityId == 1) { require_once 'CRM/Contact/Page/View/Meeting.php'; $view =& new CRM_Contact_Page_View_Meeting(); } elseif ($activityId == 2) { require_once 'CRM/Contact/Page/View/Phonecall.php'; $view =& new CRM_Contact_Page_View_Phonecall(); } elseif ($activityId == 3) { $details = CRM_Utils_Request::retrieve('details', $form); if ($details) { require_once 'CRM/Contact/Page/View/Email.php'; $view =& new CRM_Contact_Page_View_Email('View Email Details'); } else { $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/activity', 'action=browse')); $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Contact_Form_Task_Email', ts('Email a Contact'), null); } } elseif ($activityId == 4) { require_once 'CRM/Contact/Page/View/SMS.php'; $view =& new CRM_Contact_Page_View_SMS(); } elseif ($activityId > 3) { require_once 'CRM/Contact/Page/View/OtherActivity.php'; $view =& new CRM_Contact_Page_View_OtherActivity(); } else { require_once 'CRM/Contact/Page/View/Activity.php'; $view =& new CRM_Contact_Page_View_Activity(); } break; case 'vcard': require_once 'CRM/Contact/Page/View/Vcard.php'; $view =& new CRM_Contact_Page_View_Vcard(); break; case 'delete': $wrapper =& new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Contact_Form_Task_Delete', ts('Delete Contact'), null); default: require_once 'CRM/Contact/Page/View/Basic.php'; $view =& new CRM_Contact_Page_View_Basic(); break; } return $view->run(); } if ($args[2] == 'search') { return CRM_Core_Invoke::search($args); } return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/search/basic', 'reset=1', true)); }