<commit_before><?php

if(!defined('ENMDIR')) define('ENMDIR', EXTENSIONS . "/email_newsletter_manager");
if(!defined('ENVIEWS')) define('ENVIEWS', ENMDIR . "/content/templates");

if(!class_exists('ExtensionPage')){
	require_once(ENMDIR . '/lib/class.extensionpage.php');
}

require_once(TOOLKIT . '/class.xsltprocess.php');
require_once(ENMDIR . '/lib/class.recipientgroupmanager.php');

Class contentExtensionemail_newsletter_managerrecipientgroups extends ExtensionPage{

	function __construct(){
		$this->_XSLTProc = new XsltProcess();
		$this->_XML = new XMLElement("data");
		$this->viewDir = ENVIEWS . '/recipientgroups';
		parent::__construct(Symphony::Engine());
	}

	function __viewIndex(){
		$this->setPageType('index');
		$this->setTitle(__("Symphony - Email Recipients"));
		$recipientgroupManager = new RecipientgroupManager($this);
		$groups = $recipientgroupManager->listAll();
		$senders = new XMLElement('recipientgroups');
		foreach($groups as $group){
			$entry = new XMLElement('entry');
			General::array_to_xml($entry, $group);
			$count = new XMLElement('count', $recipientgroupManager->create($group['handle'])->getCount());
			$entry->appendChild($count);
			$senders->appendChild($entry);
		}
		$this->_XML->appendChild($senders);
	}

	function __actionIndex(){
		if($_POST['with-selected'] == 'delete'){
			foreach((array)$_POST['items'] as $item=>$status){
				Symphony::Database()->query('DELETE FROM `tbl_email_newsletter_manager_recipientgroups` where `id` = "' . Symphony::Database()->cleanValue($item) . '" LIMIT 1');
			}
		}
	}

	function __viewEdit($new = false){
		$this->setPageType('form');
		$this->setTitle(sprintf(__("Symphony - Email Recipients - %s", Array(), false), ucfirst(Lang::createHandle($this->_context[1]))));
		$this->addScriptToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.recipientgroups.js', 140);
		$this->addStylesheetToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.recipientgroups.css', 'screen', 103);

		$errors = new XMLElement('errors');

		$context = new XMLElement('context');
		General::array_to_xml($context, $this->_context);
		$this->_XML->appendChild($context);

		$section_xml = new XMLElement('sections');
		$sectionManager = new SectionManager($this);
		$sections = $sectionManager->fetch();
		foreach($sections as $section){
			$entry = new XMLElement('entry');
			General::array_to_xml($entry, $section->get());
			foreach($section->fetchFields() as $field){<commit_msg>Using "Newsletter Recipient Groups" as page title (which is more consistent).<commit_after><?php

if(!defined('ENMDIR')) define('ENMDIR', EXTENSIONS . "/email_newsletter_manager");
if(!defined('ENVIEWS')) define('ENVIEWS', ENMDIR . "/content/templates");

if(!class_exists('ExtensionPage')){
	require_once(ENMDIR . '/lib/class.extensionpage.php');
}

require_once(TOOLKIT . '/class.xsltprocess.php');
require_once(ENMDIR . '/lib/class.recipientgroupmanager.php');

Class contentExtensionemail_newsletter_managerrecipientgroups extends ExtensionPage{

	function __construct(){
		$this->_XSLTProc = new XsltProcess();
		$this->_XML = new XMLElement("data");
		$this->viewDir = ENVIEWS . '/recipientgroups';
		parent::__construct(Symphony::Engine());
	}

	function __viewIndex(){
		$this->setPageType('index');
		$this->setTitle(__("Symphony - Newsletter Recipient Groups"));
		$recipientgroupManager = new RecipientgroupManager($this);
		$groups = $recipientgroupManager->listAll();
		$senders = new XMLElement('recipientgroups');
		foreach($groups as $group){
			$entry = new XMLElement('entry');
			General::array_to_xml($entry, $group);
			$count = new XMLElement('count', $recipientgroupManager->create($group['handle'])->getCount());
			$entry->appendChild($count);
			$senders->appendChild($entry);
		}
		$this->_XML->appendChild($senders);
	}

	function __actionIndex(){
		if($_POST['with-selected'] == 'delete'){
			foreach((array)$_POST['items'] as $item=>$status){
				Symphony::Database()->query('DELETE FROM `tbl_email_newsletter_manager_recipientgroups` where `id` = "' . Symphony::Database()->cleanValue($item) . '" LIMIT 1');
			}
		}
	}

	function __viewEdit($new = false){
		$this->setPageType('form');
		$this->setTitle(sprintf(__("Symphony - Newsletter Recipient Groups - %s", Array(), false), ucfirst(Lang::createHandle($this->_context[1]))));
		$this->addScriptToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.recipientgroups.js', 140);
		$this->addStylesheetToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.recipientgroups.css', 'screen', 103);

		$errors = new XMLElement('errors');

		$context = new XMLElement('context');
		General::array_to_xml($context, $this->_context);
		$this->_XML->appendChild($context);

		$section_xml = new XMLElement('sections');
		$sectionManager = new SectionManager($this);
		$sections = $sectionManager->fetch();
		foreach($sections as $section){
			$entry = new XMLElement('entry');
			General::array_to_xml($entry, $section->get());
			foreach($section->fetchFields() as $field){
{'fraction_non_alphanumeric': 0.17942210074189768, 'fraction_numerical': 0.0031237797735259665, 'mean_word_length': 6.578402366863905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3850073', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1615, 'n_words': 255}