/**
 * Function to load a context. If name is asked for only name data is returned. 
 * And if name is not provided whole context is returned.
 *
 */
function smarty_function_crmDBTpl($params, &$smarty)
{
    // $vars = array( 'context', 'name', 'assign' ); out of which name is optional
    require_once 'CRM/Core/BAO/Persistent.php';
    $contextNameData = CRM_Core_BAO_Persistent::getContext($params['context'], CRM_Utils_Array::value('name', $params));
    $smarty->assign($params['var'], $contextNameData);
}
Exemplo n.º 2
0
 public function postProcess()
 {
     $params = $ids = array();
     $params = $this->controller->exportValues($this->_name);
     $params['is_config'] = $this->_config;
     if ($this->_action & CRM_Core_Action::ADD) {
         CRM_Core_Session::setStatus(ts('DB Template has been added successfully.'), ts("Saved"), "success");
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $ids['persistent'] = $this->_indexID;
         CRM_Core_Session::setStatus(ts('DB Template has been updated successfully.'), ts("Saved"), "success");
     }
     CRM_Core_BAO_Persistent::add($params, $ids);
     CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/tplstrings', "reset=1"));
 }