Exemple #1
0
function Users_identifier_tool($options)
{
    $defaults = array('uri' => 'Users/identifier', 'omit' => array(), 'fields' => array(), 'title' => "Contact Info", 'collapsed' => false, 'toggle' => false, 'editing' => true, 'complete' => true, 'inProcess' => false, 'prompt' => "In order for things to work, we must be able to reach you.", 'button_content' => 'OK');
    extract(array_merge($defaults, $options));
    $default_fields = array('emailAddress' => array('type' => 'text', 'label' => 'Email'));
    $fields = array_merge($default_fields, $fields);
    $user = Users::loggedInUser(true);
    $email = null;
    if (isset($user->emailAddress)) {
        $fields['emailAddress']['value'] = $user->emailAddress;
    } else {
        if ($user->emailAddressPending) {
            $link = Q_Html::a('#resend', array('class' => 'Users_idenfitier_tool_resend'), "You can re-send the activation email");
            $email = new Users_Email();
            $email->address = $user->emailAddressPending;
            if ($email->retrieve()) {
                switch ($email->state) {
                    case 'active':
                        if ($email->userId == $user->id) {
                            $message = "Please confirm this email address.<br>{$link}";
                        } else {
                            $message = "This email seems to belong to another user";
                        }
                        break;
                    case 'suspended':
                        $message = "This address has been suspended.";
                        break;
                    case 'unsubscribed':
                        $message = "The owner of this address has unsubscribed";
                        break;
                    case 'unverified':
                    default:
                        $message = "Not verified yet.<br>{$link}";
                        break;
                }
                $fields['emailAddress']['value'] = $email->address;
                $fields['emailAddress']['message'] = $message;
            } else {
                // something went wrong, so we'll try to correct it
                $user->emailAddressPending = "";
                $user->save();
            }
        }
    }
    $onSuccess = Q_Request::special('onSuccess', Q_Request::url());
    $form = $static = compact('fields');
    return Q::tool('Q/panel', compact('uri', 'onSuccess', 'form', 'static', 'title', 'collapsed', 'toggle', 'complete', 'editing', 'inProcess', 'setSlots'));
}
	You should make own view for activation emails, and then set the
	"Users"/"transactional"/"activation"/"subject" and
	"Users"/"transactional"/"activation"/"body" config fields.
</p>

<p>
	We should remember to put a link so you can set a password and activate your account,
	<?php 
echo Q_Html::a($link, 'like this');
?>
</p>

<p style="margin-top: 100px;">
	And somewhere on the bottom, you'll probably want to place a link to:
	<?php 
echo Q_Html::a($unsubscribe, 'unsubscribe');
?>
</p>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "action": {
    "@type": "ViewAction",
    "url": "<?php 
echo $link;
?>
",
    "name": "Activate my account"
  },
Exemple #3
0
<p>
	Greetings from <?php 
echo Q_Html::text($communityName);
?>
.
</p>

<p>
	Is this really your email address, <?php 
echo Q_Html::text($user->displayName());
?>
?
	If so, click <?php 
echo Q_Html::a('Users/activate?code=' . urlencode($email->activationCode) . ' emailAddress=' . urlencode($email->address), 'here');
?>
 to attach it to your account.
</p>

<p>
	See you on <a href="<?php 
echo Q_Request::baseUrl();
?>
"><?php 
echo Q_Html::text($communityName);
?>
</a>!
</p>
Exemple #4
0
 static function termsLabel($for = 'register')
 {
     $terms_uri = Q_Config::get('Users', $for, 'terms', 'uri', null);
     $terms_label = Q_Config::get('Users', $for, 'terms', 'label', null);
     $terms_title = Q_Config::get('Users', $for, 'terms', 'title', null);
     if (!$terms_uri or !$terms_title or !$terms_label) {
         return null;
     }
     $terms_link = Q_Html::a(Q::interpolate($terms_uri, array('baseUrl' => Q_Request::baseUrl())), array('target' => '_blank'), $terms_title);
     return Q::interpolate($terms_label, array('link' => $terms_link));
 }
Exemple #5
0
	You should make own view for activation emails, and then set the
	"Users"/"transactional"/"activation"/"subject" and
	"Users"/"transactional"/"activation"/"body" config fields.
</p>

<p>
	We should remember to put a link so you can set a password and activate your account,
	<?php 
echo Q_Html::a('Users/activate?code=' . urlencode($email->activationCode) . '&e=' . urlencode($email->address), 'like this');
?>
</p>

<p style="margin-top: 100px;">
	And somewhere on the bottom, you'll probably want to place a link to:
	<?php 
echo Q_Html::a('Users/unsubscribe?code=' . urlencode($email->authCode) . '&e=' . urlencode($email->address), 'unsubscribe');
?>
</p>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "action": {
    "@type": "ViewAction",
    "url": "<?php 
echo $link;
?>
",
    "name": "Verify this address"
  },
<p>
	This is just to let you know
	<?php 
echo Q_Html::text($user->displayName());
?>
, has started their subscription
	to <?php 
echo Q_Html::text($plan->title);
?>
	with <?php 
echo Q_Html::text($publisher->displayName());
?>
	at <?php 
echo Q_Html::text("{$symbol}{$amount}");
?>
 for <?php 
echo $months;
?>
 months.
</p>

<p>
	See you on <?php 
echo Q_Html::a($link, Q_Html::text($communityName));
?>
!
</p>
Exemple #7
0
<p>
	This is just to let you know
	<?php 
echo Q_Html::text($user->displayName());
?>
	has been charged <?php 
Q_Html::text("{$symbol}{$amount}");
?>
	for <?php 
echo Q_Html::text($description);
?>
	by <?php 
echo Q_Html::text($publisher->displayName());
?>
</p>

<p>
	See all subscriptions for <?php 
echo Q_Html::a($link, Q_Html::text($publisher->displayName()));
?>
</p>
Exemple #8
0
	<tr>
		<td><?php 
    echo $rule->ordinal;
    ?>
</td>
		<td><?php 
    echo $rule->filter;
    ?>
</td>
		<td><?php 
    echo $rule->deliver;
    ?>
</td>
		<td><?php 
    echo $rule->readyTime;
    ?>
</td>
		<td><?php 
    echo Q_Html::a(Q_Request::url(array('rules' => true, 'ordinal' => $rule->ordinal)), array(), 'edit');
    ?>
</td>
		<td><?php 
    echo Q_Html::a(Q_Request::url(array('rules' => true, 'ordinal' => $rule->ordinal, 'delete' => true)), array(), 'delete');
    ?>
</td>
	</tr>
	<?php 
}
?>
</table>
Exemple #9
0
/**
 * This tool renders tabs which behave appropriately in many different environments
 * @class Q tabs
 * @constructor
 * @param {array} [$options] options to pass to the tool
 *  @param {array} [$options.tabs] An associative array of name: title pairs.
 *  @param {array} [$options.urls] An associative array of name: url pairs to override the default urls.
 *  @param {string} [$options.field='tab'] Uses this field when urls doesn't contain the tab name.
 *  @param {boolean} [options.checkQueryString=false] Whether the default getCurrentTab should check the querystring when determining the current tab
 *  @param {boolean} [$options.vertical=false] Stack the tabs vertically instead of horizontally
 *  @param {boolean} [$options.compact=false] Display the tabs interface in a compact space with a contextual menu
 *  @param {Object} [$options.overflow]
 *  @param {String} [$options.overflow.content] The html that is displayed when the tabs overflow. You can interpolate {{count}}, {{text}} or {{html}} in the string. 
 *  @param {String} [$options.overflow.glyph] Override the glyph that appears next to the overflow text. You can interpolate {{count}} here
 *  @param {String} [$options.overflow.defaultText] The text to interpolate {{text}} in the content when no tab is selected
 *  @param {String} [$options.overflow.defaultHtml] The text to interpolate {{text}} in the content when no tab is selected
 *  @param {string} [$options.defaultTabName] Here you can specify the name of the tab to show by default
 *  @param {string} [$options.selectors] Array of (slotName => selector) pairs, where the values are CSS style selectors indicating the element to update with javascript, and can be a parent of the tabs. Set to null to reload the page.
 *  @param {string} [$options.slot] The name of the slot to request when changing tabs with javascript.
 *  @param {string} [$options.classes] An associative array of the form name => classes, for adding classes to tabs
 *  @param {string} [$options.titleClasses]  An associative array for adding classes to tab titles
 *  @param {string} [$options.after] Name of an event that will return HTML to place after the generated HTML in the tabs tool element
 *  @param {string} [$options.loader] Name of a function which takes url, slot, callback. It should call the callback and pass it an object with the response info. Can be used to implement caching, etc. instead of the default HTTP request. This function shall be Q.batcher getter
 *  @param {string} [$options.onClick] Event when a tab was clicked, with arguments (name, element). Returning false cancels the tab switching.
 *  @param {string} [$options.beforeSwitch] Event when tab switching begins. Returning false cancels the switching.
 *  @param {string} [$options.beforeScripts] Name of the function to execute after tab is loaded but before its javascript is executed.
 *  @param {string} [$options.onCurrent] Name of the function to execute after a tab is shown to be selected.
 *  @param {string} [$options.onActivate] Name of the function to execute after a tab is activated.
 */
function Q_tabs_tool($options)
{
    $field = 'tab';
    $slot = 'content,title';
    $selectors = array('content' => '#content_slot');
    $urls = array();
    extract($options);
    if (!isset($tabs)) {
        return '';
    }
    if (isset($overflow) and is_string($overflow)) {
        $overflow = array('content' => $overflow);
    }
    /**
     * @var array $tabs
     * @var boolean $vertical
     * @var boolean $compact
     */
    $sel = isset($_REQUEST[$field]) ? $_REQUEST[$field] : null;
    $result = '';
    $i = 0;
    $selectedName = null;
    $uri_string = (string) Q_Dispatcher::uri();
    foreach ($tabs as $name => $title) {
        if ($name === $sel or $name === $uri_string or $urls[$name] === $uri_string or $urls[$name] === Q_Request::url()) {
            $selectedName = $name;
            break;
        }
    }
    foreach ($tabs as $name => $title) {
        if (isset($urls[$name])) {
            $urls[$name] = Q_Uri::url($urls[$name]);
        } else {
            $urls[$name] = Q_Uri::url(Q_Request::url(array($field => $name, "/Q\\.(.*)/" => null)));
        }
        $selected_class = $name === $selectedName ? ' Q_current' : '';
        $classes_string = " Q_tab_" . Q_Utils::normalize($name);
        if (isset($classes[$name])) {
            if (is_string($classes[$name])) {
                $classes_string .= ' ' . $classes[$name];
            } else {
                if (is_array($classes[$name])) {
                    $classes_string .= ' ' . implode(' ', $classes[$name]);
                }
            }
        }
        $titleClasses_string = '';
        if (isset($titleClasses[$name])) {
            if (is_string($titleClasses[$name])) {
                $titleClasses_string = $titleClasses[$name];
            } else {
                if (is_array($titleClasses[$name])) {
                    $titleClasses_string = implode(' ', $titleClasses[$name]);
                }
            }
        }
        $title_container = Q_Html::div(null, "Q_tabs_title {$titleClasses_string}", isset($title) ? $title : $name);
        $result .= Q_Html::tag('li', array('id' => 'tab_' . ++$i, 'class' => "Q_tabs_tab {$classes_string}{$selected_class}", 'data-name' => $name), Q_Html::a($urls[$name], $title_container));
    }
    Q_Response::setToolOptions(compact('selectors', 'slot', 'urls', 'defaultTabName', 'vertical', 'compact', 'overflow', 'field', 'loader', 'beforeSwitch', 'beforeScripts', 'onActivate'));
    Q_Response::addScript('plugins/Q/js/tools/tabs.js');
    Q_Response::addStylesheet('plugins/Q/css/tabs.css');
    $classes = empty($vertical) ? ' Q_tabs_horizontal' : ' Q_tabs_vertical';
    if (!empty($compact)) {
        $classes .= " Q_tabs_compact";
    }
    $after = isset($options['after']) ? Q::event($options['after'], $options) : '';
    return "<ul class='Q_tabs_tabs Q_clearfix{$classes}'>{$result}{$after}</ul>";
}
Exemple #10
0
<p>
	Hey <?php 
echo Q_Html::text($user->displayName(array('short' => true)));
?>
,
	this is just a quick confirmation that you've successfully paid
	<?php 
Q_Html::text("{$symbol}{$amount}");
?>
 to
	<?php 
echo Q_Html::a(Q_Request::baseUrl(), Q_Html::text($publisher->displayName()));
?>
	for <?php 
echo Q_Html::text($description);
?>
.
</p>
Exemple #11
0
<p>
	Thanks for visiting <?php 
echo Q_Html::text($communityName);
?>
, <?php 
echo Q_Html::text($user->displayName());
?>
.
</p>

<p>
	You are receiving this email because someone entered your email address
	and clicked "forgot passphrase". If it wasn't you, simply ignore this message.
	
 	To reset your passphrase, click <?php 
echo Q_Html::a($link, 'here');
?>
.
</p>

<p>
	See you on <a href="<?php 
echo Q_Request::baseUrl();
?>
"><?php 
echo $communityName;
?>
</a>!
</p>

<script type="application/ld+json">