当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Report_Utils_Report::getValueFromUrl方法代码示例

本文整理汇总了PHP中CRM_Report_Utils_Report::getValueFromUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Report_Utils_Report::getValueFromUrl方法的具体用法?PHP CRM_Report_Utils_Report::getValueFromUrl怎么用?PHP CRM_Report_Utils_Report::getValueFromUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Report_Utils_Report的用法示例。


在下文中一共展示了CRM_Report_Utils_Report::getValueFromUrl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     if (!CRM_Core_Permission::check('administer Reports')) {
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
     }
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl();
     $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', FALSE);
     $extKey = strpos(CRM_Utils_Array::value('name', $templateInfo), '.');
     $reportClass = NULL;
     if ($extKey !== FALSE) {
         $ext = CRM_Extension_System::singleton()->getMapper();
         $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
         $templateInfo['name'] = $reportClass;
     }
     if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form') || !is_null($reportClass)) {
         CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template');
         $this->assign('reportTitle', $templateInfo['label']);
         $session = CRM_Core_Session::singleton();
         $session->set('reportDescription', $templateInfo['description']);
         $wrapper = new CRM_Utils_Wrapper();
         return $wrapper->run($templateInfo['name'], NULL, NULL);
     }
     if ($optionVal) {
         CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', 'reset=1'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:32,代码来源:Report.php

示例2: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('Your do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         CRM_Report_BAO_Instance::delete($instanceId);
         CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
     } else {
         require_once 'CRM/Core/OptionGroup.php';
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         if (strstr($templateInfo['name'], '_Form')) {
             $instanceInfo = array();
             CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper =& new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], null, null);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:38,代码来源:Instance.php

示例3: run

 /**
  * Run this page (figure out the action needed and perform it).
  */
 public function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     if (!$instanceId) {
         $instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
     }
     if (is_numeric($instanceId)) {
         $instanceURL = CRM_Utils_System::url("civicrm/report/instance/{$instanceId}", 'reset=1');
         CRM_Core_Session::singleton()->replaceUserContext($instanceURL);
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('You do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceId, 'navigation_id', 'id');
         CRM_Report_BAO_ReportInstance::del($instanceId);
         //delete navigation if exists
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
         CRM_Core_Session::setStatus(ts('Selected report has been deleted.'), ts('Deleted'), 'success');
     } else {
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         if (empty($templateInfo)) {
             CRM_Core_Error::statusBounce('You have tried to access a report that does not exist.');
         }
         $extKey = strpos($templateInfo['name'], '.');
         $reportClass = NULL;
         if ($extKey !== FALSE) {
             $ext = CRM_Extension_System::singleton()->getMapper();
             $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
             $templateInfo['name'] = $reportClass;
         }
         if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
             $instanceInfo = array();
             CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], NULL, NULL);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'), ts('Template Not Found'), 'error');
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:58,代码来源:Instance.php

示例4: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     $instanceId = CRM_Report_Utils_Report::getInstanceID();
     if (!$instanceId) {
         $instanceId = CRM_Report_Utils_Report::getInstanceIDForPath();
     }
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     $reportUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1");
     if ($action & CRM_Core_Action::DELETE) {
         if (!CRM_Core_Permission::check('administer Reports')) {
             $statusMessage = ts('Your do not have permission to Delete Report.');
             CRM_Core_Error::statusBounce($statusMessage, $reportUrl);
         }
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_Instance', $instanceId, 'navigation_id', 'id');
         CRM_Report_BAO_Instance::delete($instanceId);
         //delete navigation if exists
         if ($navId) {
             require_once 'CRM/Core/BAO/Navigation.php';
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
         CRM_Core_Session::setStatus(ts('Selected Instance has been deleted.'));
     } else {
         require_once 'CRM/Core/OptionGroup.php';
         $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value');
         $extKey = strpos($templateInfo['name'], '.');
         $reportClass = null;
         if ($extKey !== FALSE) {
             require_once 'CRM/Core/Extensions.php';
             $ext = new CRM_Core_Extensions();
             $reportClass = $ext->keyToClass($templateInfo['name'], 'report');
             $templateInfo['name'] = $reportClass;
         }
         if (strstr($templateInfo['name'], '_Form') || !is_null($reportClass)) {
             $instanceInfo = array();
             CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
             if (!empty($instanceInfo['title'])) {
                 CRM_Utils_System::setTitle($instanceInfo['title']);
                 $this->assign('reportTitle', $instanceInfo['title']);
             } else {
                 CRM_Utils_System::setTitle($templateInfo['label']);
                 $this->assign('reportTitle', $templateInfo['label']);
             }
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run($templateInfo['name'], null, null);
         }
         CRM_Core_Session::setStatus(ts('Could not find template for the instance.'));
     }
     return CRM_Utils_System::redirect($reportUrl);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:56,代码来源:Instance.php

示例5: civicrm_api3_nrm_processcounselor

/**
 * YoteUp ProcessCounselor API
 *
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_nrm_processcounselor($params)
{
    // Get list of counselors
    $counsellorCount = civicrm_api3('Contact', 'getCount', array('contact_sub_type' => 'Counselors'));
    $counselorParams = array('contact_sub_type' => 'Counselors', 'return.email' => 1, 'return.custom_' . TERRITORY_COUNSELOR => 1, 'rowCount' => $counsellorCount);
    $counselors = civicrm_api3('Contact', 'get', $counselorParams);
    $ind = array();
    $is_error = 0;
    $messages = array("Report Mail Triggered...");
    if ($counselors['count'] >= 1) {
        $counselors = $counselors['values'];
        foreach ($counselors as $key => $value) {
            if (!empty($value['custom_' . TERRITORY_COUNSELOR])) {
                $ind[$key]['contact_id'] = $value['contact_id'];
                $ind[$key]['email'] = $value['email'];
            }
        }
        // Now email
        $instanceId = CRM_Utils_Array::value('instanceId', $params);
        $_REQUEST['instanceId'] = $instanceId;
        $_REQUEST['sendmail'] = CRM_Utils_Array::value('sendmail', $params, 1);
        // if cron is run from terminal --output is reserved, and therefore we would provide another name 'format'
        $_REQUEST['output'] = CRM_Utils_Array::value('format', $params, CRM_Utils_Array::value('output', $params, 'pdf'));
        $_REQUEST['reset'] = CRM_Utils_Array::value('reset', $params, 1);
        $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
        $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', $optionVal, 'value');
        if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form')) {
            $obj = new CRM_Report_Page_Instance();
            $instanceInfo = array();
            CRM_Report_BAO_ReportInstance::retrieve(array('id' => $instanceId), $instanceInfo);
            if (!empty($instanceInfo['title'])) {
                $obj->assign('reportTitle', $instanceInfo['title']);
            } else {
                $obj->assign('reportTitle', $templateInfo['label']);
            }
            foreach ($ind as $key => $value) {
                $_REQUEST['email_to_send'] = $value['email'];
                $_GET['counsellor_id_value'] = $value['contact_id'];
                $wrapper = new CRM_Utils_Wrapper();
                $arguments = array('urlToSession' => array(array('urlVar' => 'instanceId', 'type' => 'Positive', 'sessionVar' => 'instanceId', 'default' => 'null')), 'ignoreKey' => TRUE);
                $messages[] = $wrapper->run($templateInfo['name'], NULL, $arguments);
            }
        }
    }
    if ($is_error == 0) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error($messages);
    }
}
开发者ID:JMAConsulting,项目名称:biz.jmaconsulting.nrm,代码行数:58,代码来源:Processcounselor.php

示例6: run

 /**
  * run this page (figure out the action needed and perform it).
  *
  * @return void
  */
 function run()
 {
     if (!CRM_Core_Permission::check('administer Reports')) {
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', "reset=1"));
     }
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl();
     require_once 'CRM/Core/OptionGroup.php';
     $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', "{$optionVal}", 'value', 'String', false);
     if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form')) {
         CRM_Utils_System::setTitle($templateInfo['label'] . ' - Template');
         $this->assign('reportTitle', $templateInfo['label']);
         $session =& CRM_Core_Session::singleton();
         $session->set('reportDescription', $templateInfo['description']);
         $wrapper =& new CRM_Utils_Wrapper();
         return $wrapper->run($templateInfo['name'], null, null);
     }
     if ($optionVal) {
         CRM_Core_Session::setStatus(ts('Could not find the report template. Make sure the report template is registered and / or url is correct.'));
     }
     return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/report/list', "reset=1"));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:26,代码来源:Report.php

示例7: processReport

 function processReport()
 {
     $sendmail = CRM_Utils_Request::retrieve('sendmail', 'Boolean', CRM_Core_DAO::$_nullObject, true, null, 'REQUEST');
     $instanceId = CRM_Utils_Request::retrieve('instanceId', 'Positive', CRM_Core_DAO::$_nullObject, true, null, 'REQUEST');
     $resetVal = CRM_Utils_Request::retrieve('reset', 'Positive', CRM_Core_DAO::$_nullObject, true, null, 'REQUEST');
     $optionVal = CRM_Report_Utils_Report::getValueFromUrl($instanceId);
     echo "Report Mail Triggered...<br />";
     require_once 'CRM/Core/OptionGroup.php';
     $templateInfo = CRM_Core_OptionGroup::getRowValues('report_template', $optionVal, 'value');
     $obj = new CRM_Report_Page_Instance();
     if (strstr($templateInfo['name'], '_Form')) {
         $instanceInfo = array();
         CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo);
         if (!empty($instanceInfo['title'])) {
             $obj->assign('reportTitle', $instanceInfo['title']);
         } else {
             $obj->assign('reportTitle', $templateInfo['label']);
         }
         $wrapper =& new CRM_Utils_Wrapper();
         $arguments['urlToSession'] = array(array('urlVar' => 'instanceId', 'type' => 'Positive', 'sessionVar' => 'instanceId', 'default' => 'null'));
         return $wrapper->run($templateInfo['name'], null, $arguments);
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:23,代码来源:CiviReportMail.php

示例8: add

 /**
  * Takes an associative array and creates an instance object.
  *
  * the function extract all the params it needs to initialize the create a
  * instance object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return CRM_Report_DAO_ReportInstance
  */
 public static function add(&$params)
 {
     $instance = new CRM_Report_DAO_ReportInstance();
     if (empty($params)) {
         return NULL;
     }
     $instanceID = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('instance_id', $params));
     // convert roles array to string
     if (isset($params['grouprole']) && is_array($params['grouprole'])) {
         $grouprole_array = array();
         foreach ($params['grouprole'] as $key => $value) {
             $grouprole_array[$value] = $value;
         }
         $params['grouprole'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($grouprole_array));
     }
     if (!$instanceID || !isset($params['id'])) {
         $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
         $params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
         // CRM-17256 set created_id on report creation.
         $params['created_id'] = isset($params['created_id']) ? $params['created_id'] : CRM_Core_Session::getLoggedInContactID();
     }
     if ($instanceID) {
         CRM_Utils_Hook::pre('edit', 'ReportInstance', $instanceID, $params);
     } else {
         CRM_Utils_Hook::pre('create', 'ReportInstance', NULL, $params);
     }
     $instance = new CRM_Report_DAO_ReportInstance();
     $instance->copyValues($params);
     if (CRM_Core_Config::singleton()->userFramework == 'Joomla') {
         $instance->permission = 'null';
     }
     // explicitly set to null if params value is empty
     if (!$instanceID && empty($params['grouprole'])) {
         $instance->grouprole = 'null';
     }
     if ($instanceID) {
         $instance->id = $instanceID;
     }
     if (!$instanceID) {
         if ($reportID = CRM_Utils_Array::value('report_id', $params)) {
             $instance->report_id = $reportID;
         } elseif ($instanceID) {
             $instance->report_id = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         } else {
             // just take it from current url
             $instance->report_id = CRM_Report_Utils_Report::getValueFromUrl();
         }
     }
     $instance->save();
     if ($instanceID) {
         CRM_Utils_Hook::pre('edit', 'ReportInstance', $instance->id, $instance);
     } else {
         CRM_Utils_Hook::pre('create', 'ReportInstance', $instance->id, $instance);
     }
     return $instance;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:68,代码来源:ReportInstance.php

示例9: postProcess

 /**
  * Post process function.
  *
  * @param CRM_Core_Form $form
  * @param bool $redirect
  */
 public static function postProcess(&$form, $redirect = TRUE)
 {
     $params = $form->getVar('_params');
     $instanceID = $form->getVar('_id');
     if ($isNew = $form->getVar('_createNew')) {
         // set the report_id since base template is going to be same, and we going to unset $instanceID
         // which will make it difficult later on, to compute report_id
         $params['report_id'] = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
         // Unset $instanceID so a new copy would be created.
         $instanceID = NULL;
     }
     $params['instance_id'] = $instanceID;
     if (!empty($params['is_navigation'])) {
         $params['navigation'] = $form->_navigation;
     } elseif ($instanceID) {
         // Delete navigation if exists.
         $navId = CRM_Core_DAO::getFieldValue('CRM_Report_DAO_ReportInstance', $instanceID, 'navigation_id', 'id');
         if ($navId) {
             CRM_Core_BAO_Navigation::processDelete($navId);
             CRM_Core_BAO_Navigation::resetNavigation();
         }
     }
     // make a copy of params
     $formValues = $params;
     // unset params from $formValues that doesn't match with DB columns of instance tables, and also not required in form-values for sure
     $unsetFields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', 'id', '_qf_default', 'report_header', 'report_footer', 'grouprole');
     foreach ($unsetFields as $field) {
         unset($formValues[$field]);
     }
     $view_mode = $formValues['view_mode'];
     // pass form_values as string
     $params['form_values'] = serialize($formValues);
     $instance = CRM_Report_BAO_ReportInstance::create($params);
     $form->set('id', $instance->id);
     if ($instanceID && !$isNew) {
         // updating existing instance
         $statusMsg = ts('"%1" report has been updated.', array(1 => $instance->title));
     } elseif ($form->getVar('_id') && $isNew) {
         $statusMsg = ts('Your report has been successfully copied as "%1". You are currently viewing the new copy.', array(1 => $instance->title));
     } else {
         $statusMsg = ts('"%1" report has been successfully created. You are currently viewing the new report instance.', array(1 => $instance->title));
     }
     CRM_Core_Session::setStatus($statusMsg);
     if ($redirect) {
         $urlParams = array('reset' => 1);
         if ($view_mode == 'view') {
             $urlParams['force'] = 1;
         } else {
             $urlParams['output'] = 'criteria';
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/report/instance/{$instance->id}", $urlParams));
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:59,代码来源:Instance.php

示例10: postProcess

 static function postProcess(&$form)
 {
     $params = $form->getVar('_params');
     $config = CRM_Core_Config::singleton();
     $params['header'] = $params['report_header'];
     $params['footer'] = $params['report_footer'];
     $params['domain_id'] = CRM_Core_Config::domainID();
     $form->_navigation['permission'] = array();
     $form->_navigation['label'] = $params['title'];
     $form->_navigation['name'] = $params['title'];
     //navigation parameters
     if (CRM_Utils_Array::value('is_navigation', $params)) {
         $permission = CRM_Utils_Array::value('permission', $params);
         $form->_navigation['current_parent_id'] = CRM_Utils_Array::value('parent_id', $form->_navigation);
         $form->_navigation['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
         $form->_navigation['is_active'] = 1;
         if ($permission) {
             $form->_navigation['permission'][] = $permission;
         }
         //unset the navigation related element,
         //not used in report form values
         unset($params['parent_id']);
         unset($params['is_navigation']);
     }
     // convert roles array to string
     if (isset($params['grouprole']) && is_array($params['grouprole'])) {
         $grouprole_array = array();
         foreach ($params['grouprole'] as $key => $value) {
             $grouprole_array[$value] = $value;
         }
         $params['grouprole'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($grouprole_array));
     }
     // add to dashboard
     $dashletParams = array();
     if (CRM_Utils_Array::value('addToDashboard', $params)) {
         $dashletParams = array('label' => $params['title'], 'is_active' => 1);
         $permission = CRM_Utils_Array::value('permission', $params);
         if ($permission) {
             $dashletParams['permission'][] = $permission;
         }
     }
     $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
     $dao = new CRM_Report_DAO_Instance();
     $dao->copyValues($params);
     if ($config->userFramework == 'Joomla') {
         $dao->permission = 'null';
     }
     // explicitly set to null if params value is empty
     if (empty($params['grouprole'])) {
         $dao->grouprole = 'null';
     }
     // unset all the params that we use
     $fields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', '_qf_default', 'report_header', 'report_footer', 'grouprole');
     foreach ($fields as $field) {
         unset($params[$field]);
     }
     $dao->form_values = serialize($params);
     $instanceID = $form->getVar('_id');
     $isNew = $form->getVar('_createNew');
     if ($instanceID && !$isNew) {
         $dao->id = $instanceID;
     }
     $dao->report_id = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
     $dao->save();
     $form->set('id', $dao->id);
     $reloadTemplate = FALSE;
     if ($dao->id) {
         if (!empty($form->_navigation)) {
             if ($isNew && CRM_Utils_Array::value('id', $form->_navigation)) {
                 unset($form->_navigation['id']);
             }
             $form->_navigation['url'] = "civicrm/report/instance/{$dao->id}&reset=1";
             $navigation = CRM_Core_BAO_Navigation::add($form->_navigation);
             if (CRM_Utils_Array::value('is_active', $form->_navigation)) {
                 //set the navigation id in report instance table
                 CRM_Core_DAO::setFieldValue('CRM_Report_DAO_Instance', $dao->id, 'navigation_id', $navigation->id);
             } else {
                 // has been removed from the navigation bar
                 CRM_Core_DAO::setFieldValue('CRM_Report_DAO_Instance', $dao->id, 'navigation_id', 'NULL');
             }
             //reset navigation
             CRM_Core_BAO_Navigation::resetNavigation();
             // in order to reflect change in navigation, template needs to be reloaded
             $reloadTemplate = TRUE;
         }
         // add to dashlet
         if (!empty($dashletParams)) {
             $section = 2;
             $chart = '';
             if (CRM_Utils_Array::value('charts', $params)) {
                 $section = 1;
                 $chart = "&charts=" . $params['charts'];
             }
             $dashletParams['url'] = "civicrm/report/instance/{$dao->id}&reset=1&section={$section}&snippet=5{$chart}&context=dashlet";
             $dashletParams['fullscreen_url'] = "civicrm/report/instance/{$dao->id}&reset=1&section={$section}&snippet=5{$chart}&context=dashletFullscreen";
             $dashletParams['instanceURL'] = "civicrm/report/instance/{$dao->id}";
             CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
         }
         $instanceParams = array('value' => $dao->report_id);
         $instanceDefaults = array();
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Instance.php

示例11: postProcess

 static function postProcess(&$form)
 {
     $params = $form->getVar('_params');
     $config = CRM_Core_Config::singleton();
     $params['header'] = $params['report_header'];
     $params['footer'] = $params['report_footer'];
     $params['domain_id'] = CRM_Core_Config::domainID();
     //navigation parameters
     if (CRM_Utils_Array::value('is_navigation', $params)) {
         $form->_navigation['permission'] = array();
         $permission = CRM_Utils_Array::value('permission', $params);
         $form->_navigation['current_parent_id'] = CRM_Utils_Array::value('parent_id', $form->_navigation);
         $form->_navigation['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
         $form->_navigation['label'] = $params['title'];
         $form->_navigation['name'] = $params['title'];
         $form->_navigation['is_active'] = 1;
         if ($permission) {
             $form->_navigation['permission'][] = $permission;
         }
         //unset the navigation related element,
         //not used in report form values
         unset($params['parent_id']);
         unset($params['is_navigation']);
     }
     // add to dashboard
     $dashletParams = array();
     if (CRM_Utils_Array::value('addToDashboard', $params)) {
         $dashletParams = array('label' => $params['title'], 'is_active' => 1, 'content' => 'NULL');
         $permission = CRM_Utils_Array::value('permission', $params);
         if ($permission) {
             $dashletParams['permission'][] = $permission;
         }
         unset($params['addToDashboard']);
     }
     require_once 'CRM/Report/DAO/Instance.php';
     $dao = new CRM_Report_DAO_Instance();
     $dao->copyValues($params);
     if ($config->userFramework == 'Joomla') {
         $dao->permission = NULL;
     }
     // unset all the params that we use
     $fields = array('title', 'to_emails', 'cc_emails', 'header', 'footer', 'qfKey', '_qf_default', 'report_header', 'report_footer');
     foreach ($fields as $field) {
         unset($params[$field]);
     }
     $dao->form_values = serialize($params);
     $instanceID = $form->getVar('_id');
     if ($instanceID) {
         $dao->id = $instanceID;
     }
     require_once 'CRM/Report/Utils/Report.php';
     $dao->report_id = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
     $dao->save();
     $form->set('id', $dao->id);
     $reloadTemplate = false;
     if ($dao->id) {
         if (!empty($form->_navigation)) {
             $form->_navigation['url'] = "civicrm/report/instance/{$dao->id}&reset=1";
             $navigation = CRM_Core_BAO_Navigation::add($form->_navigation);
             //set the navigation id in report instance table
             CRM_Core_DAO::setFieldValue('CRM_Report_DAO_Instance', $dao->id, 'navigation_id', $navigation->id);
             //reset navigation
             CRM_Core_BAO_Navigation::resetNavigation();
             // in order to reflect change in navigation, template needs to be reloaded
             $reloadTemplate = true;
         }
         // add to dashlet
         if (!empty($dashletParams)) {
             $section = 2;
             $chart = '';
             if (CRM_Utils_Array::value('charts', $params)) {
                 $section = 1;
                 $chart = "&charts=" . $params['charts'];
                 $dashletParams['is_fullscreen'] = 0;
             }
             $dashletParams['url'] = "civicrm/report/instance/{$dao->id}&reset=1&section={$section}&snippet=4{$chart}";
             $dashletParams['instanceURL'] = "civicrm/report/instance/{$dao->id}";
             require_once 'CRM/Core/BAO/Dashboard.php';
             CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
         }
         $instanceParams = array('value' => $dao->report_id);
         $instanceDefaults = array();
         $cmpName = "Contact";
         $statusMsg = "null";
         CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_OptionValue', $instanceParams, $instanceDefaults);
         if ($cmpID = CRM_Utils_Array::value('component_id', $instanceDefaults)) {
             $cmpName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Component', $cmpID, 'name', 'id');
             $cmpName = substr($cmpName, 4);
         }
         // Url to view this report and others created FROM this template
         $instanceUrl = CRM_Utils_System::url('civicrm/report/list', "reset=1&ovid={$instanceDefaults['id']}");
         $statusMsg = ts('Report "%1" has been created and is now available in the <a href="%3">report listings under "%2" Reports</a>.', array(1 => $dao->title, 2 => $cmpName, 3 => $instanceUrl));
         if ($instanceID) {
             $statusMsg = ts('Report "%1" has been updated.', array(1 => $dao->title));
         }
         CRM_Core_Session::setStatus($statusMsg);
     }
     if ($reloadTemplate) {
         // as there's been change in navigation, reload the template
         return CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'force=1'));
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Instance.php


注:本文中的CRM_Report_Utils_Report::getValueFromUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。