+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
- */
-
-/**
- * Customize the output to meet our specific requirements.
- */
-class CRM_Admin_Form_Persistent extends CRM_Core_Form {
-
- /**
- * Pre-process form.
- */
- public function preProcess() {
- $this->_indexID = CRM_Utils_Request::retrieve('id', 'Integer', $this, FALSE);
- $this->_config = CRM_Utils_Request::retrieve('config', 'Integer', $this, 0);
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
-
- $session = CRM_Core_Session::singleton();
- $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/tplstrings', 'reset=1'));
- CRM_Utils_System::setTitle(ts('DB Template Strings'));
- parent::preProcess();
- }
-
- /**
- * Set default values.
- *
- * @return array
- */
- public function setDefaultValues() {
- $defaults = [];
-
- if ($this->_indexID && ($this->_action & (CRM_Core_Action::UPDATE))) {
- $params = ['id' => $this->_indexID];
- CRM_Core_BAO_Persistent::retrieve($params, $defaults);
- if (CRM_Utils_Array::value('is_config', $defaults) == 1) {
- $defaults['data'] = implode(',', $defaults['data']);
- }
- }
- return $defaults;
- }
-
- public function buildQuickForm() {
- $this->add('text', 'context', ts('Context:'), NULL, TRUE);
- $this->add('text', 'name', ts('Name:'), NULL, TRUE);
- $this->add('textarea', 'data', ts('Data:'), ['rows' => 4, 'cols' => 50], TRUE);
- $this->addButtons([
- [
- 'type' => 'submit',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ],
- [
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ],
- ]);
- }
-
- public function postProcess() {
- $params = $ids = [];
- $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"));
- }
-
-}
+++ /dev/null
-<?php
-/*
-+--------------------------------------------------------------------+
-| CiviCRM version 5 |
-+--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2019 |
-+--------------------------------------------------------------------+
-| This file is a part of CiviCRM. |
-| |
-| CiviCRM is free software; you can copy, modify, and distribute it |
-| under the terms of the GNU Affero General Public License |
-| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
-| |
-| CiviCRM is distributed in the hope that it will be useful, but |
-| WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
-| See the GNU Affero General Public License for more details. |
-| |
-| You should have received a copy of the GNU Affero General Public |
-| License and the CiviCRM Licensing Exception along |
-| with this program; if not, contact CiviCRM LLC |
-| at info[AT]civicrm[DOT]org. If you have questions about the |
-| GNU Affero General Public License or the licensing of CiviCRM, |
-| see the CiviCRM license FAQ at http://civicrm.org/licensing |
-+--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
- */
-
-/**
- * Page for displaying Parent Information Section tabs
- */
-class CRM_Admin_Page_Persistent extends CRM_Core_Page {
-
- /**
- * The action links that we need to display for the browse screen.
- *
- * @var array
- */
- private static $_stringActionLinks;
- private static $_customizeActionLinks;
-
- /**
- * Get action Links.
- *
- * @return array
- * (reference) of action links
- */
- public function &stringActionLinks() {
- // check if variable _actionsLinks is populated
- if (!isset(self::$_stringActionLinks)) {
-
- self::$_stringActionLinks = [
- CRM_Core_Action::UPDATE => [
- 'name' => ts('Edit'),
- 'url' => 'civicrm/admin/tplstrings/add',
- 'qs' => 'reset=1&action=update&id=%%id%%',
- 'title' => ts('Configure'),
- ],
- ];
- }
- return self::$_stringActionLinks;
- }
-
- /**
- * @return array
- */
- public function &customizeActionLinks() {
- // check if variable _actionsLinks is populated
- if (!isset(self::$_customizeActionLinks)) {
-
- self::$_customizeActionLinks = [
- CRM_Core_Action::UPDATE => [
- 'name' => ts('Edit'),
- 'url' => 'civicrm/admin/tplstrings/add',
- 'qs' => 'reset=1&action=update&id=%%id%%&config=1',
- 'title' => ts('Configure'),
- ],
- ];
- }
- return self::$_customizeActionLinks;
- }
-
- /**
- * Run the basic page (run essentially starts execution for that page).
- */
- public function run() {
- CRM_Utils_System::setTitle(ts('DB Template Strings'));
- $this->browse();
- return parent::run();
- }
-
- /**
- * Browse all options.
- */
- public function browse() {
- $permission = FALSE;
- $this->assign('editClass', FALSE);
- if (CRM_Core_Permission::check('access CiviCRM')) {
- $this->assign('editClass', TRUE);
- $permission = TRUE;
- }
-
- $daoResult = new CRM_Core_DAO_Persistent();
- $daoResult->find();
- $schoolValues = [];
- while ($daoResult->fetch()) {
- $values[$daoResult->id] = [];
- CRM_Core_DAO::storeValues($daoResult, $values[$daoResult->id]);
- if ($daoResult->is_config == 1) {
- $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::customizeActionLinks(),
- NULL,
- ['id' => $daoResult->id],
- ts('more'),
- FALSE,
- 'persistent.config.actions',
- 'Persistent',
- $daoResult->id
- );
- $values[$daoResult->id]['data'] = implode(',', unserialize($daoResult->data));
- $configCustomization[$daoResult->id] = $values[$daoResult->id];
- }
- if ($daoResult->is_config == 0) {
- $values[$daoResult->id]['action'] = CRM_Core_Action::formLink(self::stringActionLinks(),
- NULL,
- ['id' => $daoResult->id],
- ts('more'),
- FALSE,
- 'persistent.row.actions',
- 'Persistent',
- $daoResult->id
- );
- $configStrings[$daoResult->id] = $values[$daoResult->id];
- }
- }
- $rows = [
- 'configTemplates' => $configStrings,
- 'customizeTemplates' => $configCustomization,
- ];
- $this->assign('rows', $rows);
- }
-
-}
<title>Price Field Options</title>
<page_callback>CRM_Price_Page_Option</page_callback>
</item>
- <item>
- <path>civicrm/admin/tplstrings/add</path>
- <page_callback>CRM_Admin_Form_Persistent</page_callback>
- <access_arguments>administer CiviCRM,access CiviCRM</access_arguments>
- </item>
- <item>
- <path>civicrm/admin/tplstrings</path>
- <page_callback>CRM_Admin_Page_Persistent</page_callback>
- <access_arguments>administer CiviCRM,access CiviCRM</access_arguments>
- </item>
<item>
<path>civicrm/ajax/mapping</path>
<page_callback>CRM_Admin_Page_AJAX::mappingList</page_callback>
+++ /dev/null
-<div class="form-item">
-<legend>DB Template Strings Information</legend>
-<div class="crm-block crm-form-block crm-admin-options-form-block">
-<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
-<table class="form-layout-compressed">
- <tr>
- <td class="label ">{$form.context.label}</td>
- <td>{$form.context.html|crmAddClass:huge}</dd>
- </tr>
- <tr>
- <td class="label ">{$form.name.label}</td>
- <td>{$form.name.html|crmAddClass:huge}</dd>
- </tr>
- <tr>
- <td class="label ">{$form.data.label}</td>
- <td>{$form.data.html}</dd>
- </tr>
-</table>
-<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-</div>
+++ /dev/null
-{foreach from=$rows item=template_row key=type}
-{if $type eq 'configTemplates'}
- <table class="report-layout">
- <div class="action-link">
- {crmButton p='civicrm/admin/tplstrings/add' q='reset=1&action=add' icon="plus-circle"}{ts}Add New String{/ts}{/crmButton}
- </div>
- {if !empty( $template_row) }
- <tr>
- <th>Context</th>
- <th>Name</th>
- <th>Data</th>
- {if $editClass}
- <th style="width: 10%"></th>
- {/if}
- </tr>
- {foreach from=$template_row item=values}
- <tr class="{cycle values="odd-row,even-row"}">
- <td>{$values.context}</td>
- <td>{$values.name}</td>
- <td>{$values.data}</td>
- {if $editClass}
- <td>{$values.action}</td>
- {/if}
- </tr>
- {/foreach}
- {/if}
- </table>
-{/if}
-{if $type eq 'customizeTemplates'}
- <table class="report-layout">
- <head>
- <h1>Config String</h1>
- </head>
- <br/>
- <div class="action-link">
- {crmButton p='civicrm/admin/tplstrings/add' q='reset=1&action=add&config=1' icon="plus-circle"}{ts}Add New Config{/ts}{/crmButton}
- </div>
- <br/>
- {if !empty( $template_row) }
- <tr>
- <th>Context</th>
- <th>Name</th>
- <th>Data</th>
- {if $editClass}
- <th style="width: 10%"></th>
- {/if}
- </tr>
- {foreach from=$template_row item=values}
- <tr class="{cycle values="odd-row,even-row"}">
- <td>{$values.context}</td>
- <td>{$values.name}</td>
- <td>{$values.data}</td>
- {if $editClass}
- <td>{$values.action}</td>
- {/if}
- </tr>
- {/foreach}
- {/if}
- </table>
-{/if}
-{/foreach}