'.$m->mailerName.'
- ';
diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php
index 4deb6e08b..75cfd4d2e 100644
--- a/e107_handlers/mailout_class.php
+++ b/e107_handlers/mailout_class.php
@@ -9,8 +9,8 @@
* Mailout handling - selector for 'core' users
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $
- * $Revision: 1.9 $
- * $Date: 2010-01-10 11:01:29 $
+ * $Revision: 1.10 $
+ * $Date: 2010-01-11 21:09:28 $
* $Author: e107steved $
*
*/
@@ -20,7 +20,9 @@
*
* @package e107
* @subpackage e107_handlers
- * @version $Id: mailout_class.php,v 1.9 2010-01-10 11:01:29 e107steved Exp $;
+ * @version $Id: mailout_class.php,v 1.10 2010-01-11 21:09:28 e107steved Exp $;
+ *
+ * @todo last visit date needs XHTML calendar on display, and needs to accept varying input formats
*/
if (!defined('e107_INIT')) { exit; }
@@ -39,10 +41,6 @@ In general each class object must be self-contained, and use internal variables
The class may use the global $e107->sql object for database access - it will effectively have exclusive use of this during the email address search phase
It is the responsibility of each class to manager permission restrictions where required.
-
-TODO:
- 1. accept varying date formats for last visit
- 2. Use XHTML calendar for last visit
*/
// These variables determine the circumstances under which this class is loaded (only used during loading, and may be overwritten later)
@@ -54,10 +52,9 @@ class core_mailout
protected $mailCount = 0;
protected $mailRead = 0;
// protected $e107;
- public $mailerSource = 'core'; // Plugin name (core mailer is special case) Must be directory for this file
+ //public $mailerSource = 'core'; // Plugin name (core mailer is special case) Must be directory for this file
public $mailerName = LAN_MAILOUT_68; // Text to identify the source of selector (displayed on left of admin page)
public $mailerEnabled = TRUE; // Mandatory - set to FALSE to disable this plugin (e.g. due to permissions restrictions)
- // protected $adminHandler = NULL; // Filled in with the name of the admin handler on creation
// List of fields used by selectors
private $selectFields = array('email_to',
@@ -79,16 +76,18 @@ class core_mailout
/**
* Return data representing the user's selection criteria as entered in the $_POST array.
*
- * This is stored in the DB with a saved email. (Just return an empty string or array if this is undesirable)
+ * The value returned can be as simple as an array of chosen fields from the $_POST array, or it may be processed to make it more
+ * convenient to use later. (In general, at least basic sanitising should be performed)
+ * Conflicting selection criteria can also be resolved here.
+ * The returned data is stored in the DB with a saved email. (Just return an empty string or array if this is undesirable)
* The returned value is passed back to selectInit() and showSelect when needed.
*
- * @return Selection data - may be string, array or whatever suits
+ * @return mixed Selection data - may be string, array or whatever suits
*/
public function returnSelectors()
{
$tp = e107::getParser();
-
$res = array();
foreach ($this->selectFields as $k)
{
@@ -106,15 +105,14 @@ class core_mailout
* Needs to save any queries or other information into internal variables, do initial DB queries as appropriate.
* Could in principle read all addresses and buffer them for later routines, if this is more convenient
*
- * @param $selectVals - array of selection criteria as returned by returnSelectors()
+ * @param mixed $selectVals - selection criteria as returned by returnSelectors() (so format is whatever is chosen by the coder)
*
- * @return Return number of records available (or 1 if unknown) on success, FALSE on failure
+ * @return int|boolean number of records available (or 1 if unknown) on success, FALSE on failure
*/
public function selectInit($selectVals = FALSE)
{
$sql = e107::getDb();
-
-
+
$where = array();
$incExtended = array();
if ($selectVals === FALSE)
@@ -215,9 +213,9 @@ class core_mailout
/**
- * Return an email address to add to the recipients list. Return FALSE if no more addresses to add
+ * Return one email address to add to the recipients list. Return FALSE if no more addresses to add
*
- * @return FALSE if no more addresses available; else an array:
+ * @return boolean|array FALSE if no more addresses available; else an array:
* 'mail_recipient_id' - non-zero if a registered user, zero if a non-registered user. (Always non-zero from this class)
* 'mail_recipient_name' - user name
* 'mail_recipient_email' - email address to use
@@ -245,16 +243,17 @@ class core_mailout
}
- // Called once all email addresses read, to do any housekeeping needed
+ /**
+ * Called once all email addresses read, to do any housekeeping needed
+ *
+ * @return none
+ */
public function select_close()
{
// Nothing to do here
}
- // Called to show current selection criteria, and optionally allow edit
- //
- //
/**
* Called to show current selection criteria, and optionally allow edit
*
@@ -272,10 +271,6 @@ class core_mailout
$var = array();
$var[0]['caption'] = LAN_MAILOUT_03; // User class select
- $var[1]['caption'] = LAN_MAILOUT_46; // User Search Field.
- $var[2]['caption'] = LAN_MAILOUT_56; // User last visit
- $var[3]['caption'] = LAN_MAILOUT_46; // Extended user field
- $var[4]['caption'] = LAN_MAILOUT_46; // Extended user field
if ($allow_edit)
{
@@ -283,40 +278,58 @@ class core_mailout
$var[0]['html'] = $admin->userClassesTotals('email_to', varset($selectVals['email_to'], ''));
$var[1]['html'] = $frm->selectbox('user_search_name', $u_array, varset($selectVals['user_search_name'], ''),'',TRUE)." ".LAN_MAILOUT_47." ".$frm->text('user_search_value', varset($selectVals['user_search_value'], ''));
- $var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], ''))." ".$frm->text('last_visit_date', varset($selectVals['last_visit_date'], 0));
+ $var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], ''))." ".$frm->text('last_visit_date', varset($selectVals['last_visit_date'], 0)); // FIXME: Should include date selector
$var[3]['html'] = $admin->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE).LAN_MAILOUT_48." ".$frm->text('extended_1_value',varset($selectVals['extended_1_value'], ''));
$var[4]['html'] = $admin->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE).LAN_MAILOUT_48." ".$frm->text('extended_2_value',varset($selectVals['extended_2_value'],''));
-
+
+ $var[1]['caption'] = LAN_MAILOUT_46; // User Search Field.
+ $var[2]['caption'] = LAN_MAILOUT_56; // User last visit
+ $var[3]['caption'] = LAN_MAILOUT_46; // Extended user field
+ $var[4]['caption'] = LAN_MAILOUT_46; // Extended user field
}
else // Display existing values
{
- if(!vartrue($selectVals['email_to']))
+ if (!vartrue($selectVals['email_to']))
{
return;
}
- if(is_numeric($selectVals['email_to']))
+ if (is_numeric($selectVals['email_to']))
{
- $sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to']));
- $row = $sql->db_Fetch();
- $_to = LAN_MAILOUT_23.$row['userclass_name'];
+ $_to = LAN_MAILOUT_23.e107::getUserClass()->uc_get_classname(intval($selectVals['email_to']));
}
else
{
$_to = $selectVals['email_to'];
}
- $var_0 = $_to." ";
- if($selectVals['email_to'] == "self")
+ $var_0 = $_to.' ';
+ if ($selectVals['email_to'] == 'self')
{
- $var_0 .= "<".USEREMAIL.">";
+ $var_0 .= '<'.USEREMAIL.'>';
}
$var[0]['html'] = $var_0;
- $var[1]['html'] = vartrue($selectVals['user_search_name'])." ". vartrue($selectVals['user_search_value']);
- $var[2]['html'] = vartrue($selectVals['last_visit_match']).' '.gmstrftime("%D-%M-%Y",vartrue($selectVals['last_visit_date'])); //FIXME use e107 date function.
- $var[3]['html'] = vartrue($selectVals['extended_1_name']).' '.vartrue($selectVals['extended_1_value']);
- $var[4]['html'] = vartrue($selectVals['extended_2_name']).' '.vartrue($selectVals['extended_2_value']);
+ if (vartrue($selectVals['user_search_name']) && vartrue($selectVals['user_search_value']))
+ {
+ $var[1]['html'] = $selectVals['user_search_name'].' '.$selectVals['user_search_value'];
+ $var[1]['caption'] = LAN_MAILOUT_46; // User Search Field.
+ }
+ if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date']))
+ {
+ $var[2]['html'] = $selectVals['last_visit_match'].' '.gmstrftime("%D-%M-%Y",$selectVals['last_visit_date']); //FIXME use e107 date function.
+ $var[2]['caption'] = LAN_MAILOUT_56; // User last visit
+ }
+ if (vartrue($selectVals['extended_1_name']) && vartrue($selectVals['extended_1_value']))
+ {
+ $var[3]['html'] = $selectVals['extended_1_name'].' '.$selectVals['extended_1_value'];
+ $var[3]['caption'] = LAN_MAILOUT_46; // Extended user field
+ }
+ if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value']))
+ {
+ $var[4]['html'] = $selectVals['extended_2_name'].' '.$selectVals['extended_2_value'];
+ $var[4]['caption'] = LAN_MAILOUT_46; // Extended user field
+ }
}
diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php
index f2bdb605f..0cdbc97b8 100644
--- a/e107_handlers/userclass_class.php
+++ b/e107_handlers/userclass_class.php
@@ -2,21 +2,26 @@
/*
* e107 website system
*
- * Copyright (C) 2008-2009 e107 Inc (e107.org)
+ * Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
- *
+ * User class functions
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $
- * $Revision: 1.47 $
- * $Date: 2009-12-07 20:43:37 $
+ * $Revision: 1.48 $
+ * $Date: 2010-01-11 21:09:31 $
* $Author: e107steved $
*/
-/*
-This class handles everything a user needs. Admin functions inherit from it.
-*/
+/**
+ *
+ * @package e107
+ * @subpackage e107_handlers
+ * @version $Id: userclass_class.php,v 1.48 2010-01-11 21:09:31 e107steved Exp $;
+ *
+ * This class handles all user-related user class functions. Admin functions inherit from it.
+ */
if (!defined('e107_INIT')) { exit; }
@@ -90,11 +95,12 @@ class user_class
/**
- Ensure the tree of userclass data is stored in our object ($this->class_tree).
- Only read if its either not present, or the $force flag is set.
- Data is cached if enabled
- @param boolean $force - set to TRUE to force a re-read of the info regardless.
- @return none
+ * Ensure the tree of userclass data is stored in our object ($this->class_tree).
+ * Only read if its either not present, or the $force flag is set.
+ * Data is cached if enabled
+ *
+ * @param boolean $force - set to TRUE to force a re-read of the info regardless.
+ * @return none
*/
protected function readTree($force = FALSE)
{
@@ -232,7 +238,8 @@ class user_class
- /** Combines the selected editable classes into the main class list for a user.
+ /**
+ * Combines the selected editable classes into the main class list for a user.
* @param array|string $combined - the complete list of current class memberships
* @param array|string $possible - the classes which are being edited
* @param array|string $actual - the actual membership of the editable classes
@@ -399,7 +406,9 @@ class user_class
- /** Generate an ordered array classid=>classname - used for dropdown and check box lists
+ /**
+ * Generate an ordered array classid=>classname - used for dropdown and check box lists
+ *
* @param string $optlist - comma-separated list of classes/class types to include (see uc_dropdown for details)
* @param boolean $just_ids - if TRUE, each returned array value is '1'; otherwise it is the class name
* @return array of user classes; ky is numeric class id, value is '1' or class name according to $just_ids
@@ -483,11 +492,13 @@ class user_class
/**
* Very similar to self::uc_dropdown, but returns a list of check boxes. Doesn't encapsulate it.
+ *
* @param string $fieldname is the name for the array of checkboxes
* @param string $curval is a comma separated list of class IDs for boxes which are checked.
* @param string $optlist as for uc_dropdown
* @param boolean $showdescription - if TRUE, appends the class description in brackets
* @param boolean $asArray - if TRUE, result returned as array; otherwise result returned as string
+ *
* return string|array according to $asArray
*/
public function uc_checkboxes($fieldname, $curval='', $optlist = '', $showdescription = FALSE, $asArray = FALSE)
@@ -513,7 +524,7 @@ class user_class
/**
- * Used by @see vetted_tree() to generate lower levels of tree
+ * Used by @see{vetted_tree()} to generate lower levels of tree
*/
protected function vetted_sub_tree($treename, $callback,$listnum,$nest_level,$current_value, $perms, $opt_options)
{
diff --git a/e107_plugins/calendar_menu/e_mailout.php b/e107_plugins/calendar_menu/e_mailout.php
index c95dc139f..c9bad705c 100644
--- a/e107_plugins/calendar_menu/e_mailout.php
+++ b/e107_plugins/calendar_menu/e_mailout.php
@@ -2,16 +2,16 @@
/*
* e107 website system
*
- * Copyright (C) 2008-2009 e107 Inc (e107.org)
+ * Copyright (C) 2008-2010 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
- * Administration - Site Maintenance
+ * Event calendar - mailout function
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $
- * $Revision: 1.10 $
- * $Date: 2010-01-10 06:20:43 $
- * $Author: e107coders $
+ * $Revision: 1.11 $
+ * $Date: 2010-01-11 21:09:35 $
+ * $Author: e107steved $
*
*/
@@ -20,7 +20,7 @@
*
* @package e107_plugins
* @subpackage event_calendar
- * @version $Id: e_mailout.php,v 1.10 2010-01-10 06:20:43 e107coders Exp $;
+ * @version $Id: e_mailout.php,v 1.11 2010-01-11 21:09:35 e107steved Exp $;
*/
if (!defined('e107_INIT')) { exit(); }
@@ -41,7 +41,7 @@ class calendar_menu_mailout
{
protected $mailCount = 0;
protected $mailRead = 0;
- public $mailerSource = 'calendar_menu'; //FIXME should be auto-detected // Plugin name (core mailer is special case) Must be directory for this file
+ //public $mailerSource = 'calendar_menu'; //FIXME should be auto-detected // Plugin name (core mailer is special case) Must be directory for this file
public $mailerName = LAN_EC_MAIL_01; // Text to identify the source of selector (displayed on left of admin page)
public $mailerEnabled = TRUE; // Mandatory - set to FALSE to disable this plugin (e.g. due to permissions restrictions)
private $selectorActive = FALSE; // Set TRUE if we've got a valid selector to start returning entries
@@ -139,16 +139,19 @@ class calendar_menu_mailout
}
- // Called once all email addresses read, to do any housekeeping needed
+
+ /**
+ * Called once all email addresses read, to do any housekeeping needed
+ *
+ * @return none
+ */
public function select_close()
{
// Nothing to do here
}
+
- // Called to show current selection criteria, and optionally allow edit
- //
- //
/**
* Called to show current selection criteria, and optionally allow edit
*
@@ -181,8 +184,8 @@ class calendar_menu_mailout
}
elseif($checked)
{
- $var[$c]['caption'] = $row['event_cat_name'];
- $var[$c]['html'] = LAN_EC_MAIL_03;
+ $var[$c]['html'] = $row['event_cat_name'];
+ $var[$c]['caption'] = LAN_EC_MAIL_03;
/*$ret .= "