Example #1
0
function Streams_player_Websites_article($options)
{
    $stream = $options['stream'];
    $emailSubject = Q::ifset($options, 'emailSubject', "Reaching out from your website");
    $result = Q::tool('Websites/article', array('publisherId' => $stream->publisherId, 'streamName' => $stream->name, 'html' => array('placeholder' => 'Start editing the article here. Select some text to use the HTML editor.', 'froala' => array('key' => Q_Config::get('Streams', 'froala', 'key', null), 'pasteImage' => true)), 'getintouch' => array('email' => true, 'emailSubject' => $emailSubject, 'sms' => 'Text', 'call' => 'Call', 'class' => 'Q_button clickable')));
    $result .= Q::tool("Websites/seo", array('skipIfNotAuthorized' => true, 'publisherId' => $stream->publisherId, 'streamName' => $stream->name));
    return $result;
}
Example #2
0
/**
 * This tool generates an inline editor to edit the content or attribute of a stream.
 * @class Streams inplace
 * @constructor
 * @param {array} $options Options for the tool
 *  An associative array of parameters, containing:
 * @param {string} [$options.inplaceType='textarea'] The type of the fieldInput. Can be "textarea" or "text"
 * @param {array} [$options.convert] The characters to convert to HTML. Pass an array containing zero or more of "\n", " "
 * @param {Streams_Stream} $options.stream A Streams_Stream object
 * @param {string} [$options.field] Optional, name of an field to change instead of the content of the stream
 * @param {string} [$options.attribute] Optional, name of an attribute to change instead of any field.
 * @param {string} [$options.beforeSave] Reference to a callback to call after a successful save. This callback can cancel the save by returning false.
 * @param {string} [$options.onSave] Reference to a callback or event to run after a successful save.
 * @param {string} [$options.onCancel] Reference to a callback or event to run after cancel.
 * @param {array} [$options.inplace=array()] Additional fields to pass to the child Q/inplace tool, if any
 * @uses Q inplace
 */
function Streams_inplace_tool($options)
{
    if (empty($options['stream'])) {
        if (empty($options['publisherId']) or empty($options['streamName'])) {
            throw new Q_Exception_RequiredField(array('field' => 'stream'));
        }
        $publisherId = $options['publisherId'];
        $streamName = $options['streamName'];
        $stream = Streams::fetchOne(null, $publisherId, $streamName);
        if (!$stream) {
            throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => "publisherId={$publisherId}, name={$streamName}"));
        }
    } else {
        $stream = $options['stream'];
    }
    $inplaceType = Q::ifset($options, 'inplaceType', 'textarea');
    $inplace = array('action' => $stream->actionUrl(), 'method' => 'PUT', 'type' => $inplaceType);
    if (isset($options['inplace'])) {
        $inplace = array_merge($options['inplace'], $inplace);
    }
    $convert = Q::ifset($options, 'convert', array("\n"));
    $inplace['hidden']['convert'] = json_encode($convert);
    if (!empty($options['attribute'])) {
        $field = 'attributes[' . urlencode($options['attribute']) . ']';
        $content = $stream->get($options['attribute'], '');
        $maxlength = $stream->maxSize_attributes - strlen($stream->maxSize_attributes) - 10;
    } else {
        $field = !empty($options['field']) ? $options['field'] : 'content';
        $content = $stream->{$field};
        $maxlength = $stream->maxSizeExtended($field);
    }
    switch ($inplaceType) {
        case 'text':
            $inplace['fieldInput'] = Q_Html::input($field, $content, array('placeholder' => Q::ifset($input, 'placeholder', null), 'maxlength' => $maxlength));
            $inplace['staticHtml'] = Q_Html::text($content);
            break;
        case 'textarea':
            $inplace['fieldInput'] = Q_Html::textarea($field, 5, 80, array('placeholder' => Q::ifset($inplace, 'placeholder', null), 'maxlength' => $maxlength), $content);
            $inplace['staticHtml'] = Q_Html::text($content, $convert);
            break;
        default:
            return "inplaceType must be 'textarea' or 'text'";
    }
    if (!$stream->testWriteLevel('suggest')) {
        if (!isset($options['classes'])) {
            $options['classes'] = '';
        }
        Q_Response::setToolOptions(array('publisherId' => $stream->publisherId, 'streamName' => $stream->name));
        $staticClass = $options['inplaceType'] === 'textarea' ? 'Q_inplace_tool_blockstatic' : 'Q_inplace_tool_static';
        return "<span class='Q_inplace_tool_container {$options['classes']}' style='position: relative;'>" . "<div class='{$staticClass}'>{$inplace['staticHtml']}</div></span>";
    }
    $toolOptions = array('publisherId' => $stream->publisherId, 'streamName' => $stream->name, 'inplaceType' => $options['inplaceType']);
    Q::take($options, array('attribute', 'field', 'convert'), $toolOptions);
    $toolOptions['inplace'] = $inplace;
    Q_Response::setToolOptions($toolOptions);
    return Q::tool("Q/inplace", $inplace);
}
Example #3
0
function Streams_publish_Broadcast_tool($options)
{
    extract($options);
    $publisherId = $stream->publisherId;
    $streamName = $stream->name;
    $type = 'Broadcast';
    $input = Q_Html::input('content', '');
    $button = Q_Html::tag('button', array(), 'Post');
    return Q_Html::form('Streams/stream', 'post', array(), Q_Html::formInfo(true) . Q_Html::hidden(compact('publisherId', 'streamName', 'type')) . Q::tool('Q/form', array('fields' => array('message' => array('type' => 'text', 'message' => 'this message will appear as if the user typed it before posting'), 'link' => array('type' => 'text', 'message' => 'the address of the webpage to share'), 'picture' => array('type' => 'text', 'message' => 'if you enter a picture url here, it will override the picture that is posted'), 'description' => array('type' => 'textarea', 'message' => 'if you enter something here, it will override the description that facebook would have automatically grabbed from that page'), '' => array('type' => 'button', 'value' => 'Post')), 'onSuccess' => 'Q.plugins.Broadcast.onBroadcastSuccess')));
}
Example #4
0
/**
 * This tool generates an interface used for publishing messages to streams
 * It basically renders the Streams/player/$type tool, where $type is the stream's type.
 *
 * @param array $options
 *  An associative array of parameters, containing:
 *  "publisherId" => required. The id of the publisher of the stream to which to post the message.
 *  "streamName" => required. The name of the stream to which to post the message.
 */
function Streams_player_tool($options)
{
    extract($options);
    if (empty($stream)) {
        throw new Q_Exception("Missing stream object");
    }
    if (!Q::canHandle('Streams/player/' . $stream->type . '/tool')) {
        throw new Q_Exception("No player tool has been implemented for streams of type {$stream->type}.");
    }
    return Q::tool('Streams/player/' . $stream->type, $options);
}
Example #5
0
 static function helperTool($template, $context, $args, $source)
 {
     if (empty($args[0])) {
         return "{{tool missing name}}";
     }
     $name = $args[0];
     $id = count($args) > 1 && is_string($args[1]) ? $args[1] : null;
     $options = Q::ifset($args, 'hash', array());
     $fields = $context->fields();
     $o = array_merge($options, Q::ifset($fields, $name, array()), Q::ifset($fields, "id:{$id}", array()));
     return Q::tool($name, $o, compact('id'));
 }
Example #6
0
function Streams_message_tool($options)
{
    extract($options);
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    if (empty($publisherId)) {
        $publisherId = Streams::requestedPublisherId();
    }
    if (empty($publisherId)) {
        $publisherId = $_REQUEST['publisherId'] = $user->id;
    }
    if (empty($name)) {
        $name = Streams::requestedName(true);
    }
    $stream = Streams::fetch($user->id, $publisherId, $name);
    $stream = !empty($stream) ? reset($stream) : null;
    if (!$stream) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
    }
    if (!$stream->testReadLevel('messages') || !$stream->testWriteLevel('post')) {
        throw new Users_Exception_NotAuthorized();
    }
    $hidden = array('publisherId' => $publisherId, 'streamName' => $name);
    $fields = array('stream' => array('label' => 'Stream', 'type' => 'static', 'value' => $stream->title));
    $type = Streams::requestedType();
    // check if stream has messages
    $types = Q_Config::get('Streams', 'messages', $stream->type, array());
    if (count($types) === 0) {
        throw new Q_Exception("Stream of type '{$stream->type}' does not support messages");
    }
    if (!empty($type) && !in_array($type, $types)) {
        throw new Q_Exception("Requested message type '{$type}' is not alowed for streams of type '{$stream->type}'");
    }
    if (!empty($type)) {
        $hidden['type'] = $type;
        $fields['type'] = array('label' => 'Message type', 'type' => 'static', 'value' => $type);
    } else {
        $fields['type'] = array('label' => 'Message type', 'type' => 'select', 'options' => array_merge(array('' => 'Select type'), array_combine($types, $types)), 'value' => '');
    }
    $fields['content'] = array('label' => 'Content', 'type' => 'textarea');
    $fields['submit'] = array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => 'Post'));
    return Q_Html::tag('h3', array(), 'Post a message') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/message', 'post', array(), Q_Html::hidden($hidden) . Q::tool('Q/form', array('fields' => $fields, 'onSuccess' => 'function (data) {
					if (data.errors) alert(data.errors);
					else {
						alert("Message posted");
						var message = Q.getObject(["slots", "form", "fields"], data);
						Q.handle(Q.info.baseUrl+"/plugins/Streams/message?publisherId="+message.publisherId+"&name="+message.streamName);
					}
				}')));
}
Example #7
0
/**
 * This tool generates a category selector.
 *
 * @param {array} $options An associative array of parameters, containing:
 * @param {string} [$options.publisherId=Streams::requestedPublisherId()] The publisherId of the stream to present. If "stream" parameter is empty
 * @param {string} [$options.streamName=Streams::requestedName()] The streamName of the stream to present. If "stream" parameter is empty
 * @param {string} [options.relationType=null] Filter the relation type.
 */
function Streams_category_tool($options)
{
    extract($options);
    if (!$publisherId) {
        $options['publisherId'] = $publisherId = Streams::requestedPublisherId(true);
    }
    if (!$streamName) {
        $options['streamName'] = $streamName = Streams::requestedName(true);
    }
    Q_Response::setToolOptions($options);
    $stream = Streams::fetchOne(null, $publisherId, $streamName, true);
    $userId = Users::loggedInUser(true)->id;
    return Q::tool('Streams/related', $options);
}
Example #8
0
function Users_account_tool($options)
{
    $uri = 'Users/account';
    $omit = array();
    $fields = array();
    $title = "Basic Info";
    $editing = true;
    $complete = true;
    $inProcess = false;
    $collapsed = false;
    $toggle = false;
    $omit = array();
    $setSlots = null;
    extract($options, EXTR_OVERWRITE);
    $default_fields = array('username' => array('type' => 'text', 'label' => 'Choose Username'), 'gender' => array('type' => 'select', 'label' => 'I am', 'options' => array('male' => 'a man', 'female' => 'a woman')), 'orientation' => array('type' => 'select', 'label' => 'Orientation', 'options' => array('straight' => 'straight', 'gay' => 'gay', 'bi' => 'bi')), 'relationship_status' => array('type' => 'select', 'label' => 'Status', 'options' => array('single' => "I'm single", 'open' => "I'm in an open relationship", 'relationship' => "I'm in a relationship", 'engaged' => "I'm engaged", 'married' => "I'm married", 'complicated' => "It's complicated", 'widowed' => "I'm widowed")), 'birthday' => array('type' => 'date', 'label' => 'My Birthday', 'options' => array('year_from' => '1920', 'year_to' => date('Y') - 16)), 'zipcode' => array('type' => 'text', 'label' => 'Zipcode', 'attributes' => array('maxlength' => 5)));
    $fields = array_merge($default_fields, $fields);
    $user = Users::loggedInUser(true);
    if (isset($user->gender)) {
        $fields['gender']['value'] = $user->gender;
    }
    if (isset($user->desired_gender)) {
        if ($user->desired_gender == 'either') {
            $fields['orientation']['value'] = 'bi';
        } else {
            if (isset($user->gender)) {
                $fields['orientation']['value'] = $user->gender != $user->desired_gender ? 'straight' : 'gay';
            }
        }
    }
    if (isset($user->relationship_status)) {
        $fields['relationship_status']['value'] = $user->relationship_status;
    }
    if (isset($user->birthday)) {
        $fields['birthday']['value'] = date("Y-m-d", Users::db()->fromDate($user->birthday));
    }
    if (isset($user->zipcode)) {
        $fields['zipcode']['value'] = $user->zipcode;
    }
    if (isset($user->username)) {
        $fields['username']['value'] = $user->username;
    }
    foreach ($omit as $v) {
        unset($fields[$v]);
    }
    $onSuccess = Q_Request::special('onSuccess', Q_Request::url());
    $form = $static = compact('fields');
    return Q::tool('Q/panel', compact('uri', 'title', 'form', 'static', 'onSuccess', 'complete', 'collapsed', 'toggle', 'editing', 'inProcess', 'static', 'setSlots'));
}
Example #9
0
function Streams_player_tool($options)
{
    extract($options);
    if (!isset($stream)) {
        throw new Q_Exception_MissingObject(array('name' => 'stream'));
    }
    if (!$stream->testReadLevel('content')) {
        $streamName_html = Q_Html::text($stream->name);
        return "<a href='#{$streamName_html}'>hidden</a>";
    }
    $options['streamName'] = $stream->name;
    $parts = explode('/', $stream->type);
    switch ($parts[0]) {
        case 'Streams/text/small':
        case 'Streams/text/medium':
        case 'Streams/text':
            return $stream->content;
        case 'Streams/date':
            // TODO: localize
            if (isset($parts[1]) and $parts[1] === 'birthday') {
                return date('M j', strtotime($stream->content));
            }
            return date('M j, Y', strtotime($stream->content));
        case 'Streams/number':
            if (isset($parts[1]) and $parts[1] === 'age') {
                if (!empty($streams['Streams/user/birthday']->content)) {
                    return Db::ageFromDateTime($streams['Streams/user/birthday']->content);
                }
                return null;
            }
            return $strem->content;
        case 'Streams/category':
            // TODO: implement
        // TODO: implement
        case 'Streams/chat':
            // TODO: implement
        // TODO: implement
        case 'Streams/community':
            // TODO: implement
        // TODO: implement
        default:
            $event = $stream->type . "/tool";
            if (Q::canHandle($event)) {
                return Q::tool($stream->type, $options);
            }
            return Q_Html::tag('div', array('class' => 'Streams_player_stream_content'), Q_Html::text($stream->content));
    }
}
Example #10
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'));
}
Example #11
0
function Streams_invite_response_content()
{
    $user = Users::loggedInUser(true);
    $publisherId = Streams::requestedPublisherId();
    if (empty($publisherId)) {
        $publisherId = $user->id;
    }
    $streamName = Streams::requestedName(true);
    $stream = new Streams_Stream();
    $stream->publisherId = $publisherId;
    $stream->name = $streamName;
    if (!$stream->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
    }
    return Q::tool('Streams/invite', compact('stream'));
}
Example #12
0
function Streams_access_response_content($options)
{
    $ajax = true;
    $user = Users::loggedInUser(true);
    $streamName = Streams::requestedName(true);
    $publisherId = Streams::requestedPublisherId();
    if (empty($publisherId)) {
        $publisherId = $user->id;
    }
    $stream = new Streams_Stream();
    $stream->publisherId = $publisherId;
    $stream->name = $streamName;
    if (!$stream->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'name');
    }
    $controls = !empty($options['controls']);
    Q_Response::setSlot('title', "Access to: " . $stream->title);
    return Q::tool('Streams/access', compact('publisherId', 'streamName', 'ajax', 'controls'), $controls ? array('tag' => null) : array());
}
Example #13
0
 static function helperTool($template, $context, $args, $source)
 {
     if (empty($args[0])) {
         return "{{tool missing name}}";
     }
     $name = $args[0];
     if (count($args) > 1 && (is_string($args[1]) || is_numeric($args[1]))) {
         $id = $args[1];
     }
     $o = Q::ifset($args, 'hash', array());
     $fields = $context->fields();
     if (isset($fields[$name])) {
         $o = array_merge($o, $fields[$name]);
     }
     if ($id && isset($fields["id:{$id}"])) {
         $o = array_merge($o, $fields["id:{$id}"]);
     }
     return Q::tool($name, $o, compact('id'));
 }
Example #14
0
function Streams_message_response_content()
{
    return Q::tool('Streams/message');
}
Example #15
0
<div id="content">
	<?php 
echo Q::tool('Shipping/shipment/details', compact("shipment"));
?>
	<?php 
echo Q::tool('Shipping/packages', array("shipment" => $shipment, "title" => "Packages details", "prefix" => "packages", "descPlaceHolder" => "Describe the package if it is in any way unusual", "requiredFields" => array("width", "length", "height", "weight")), "packages");
?>
	<?php 
echo Q::tool('Shipping/carriers', compact("shipment"));
?>
	<?php 
echo Q::tool('Shipping/invoice/options', compact("shipment"));
?>
	<?php 
echo Q::tool('Shipping/pickup', array("secondsBetween" => 3600, "shipment" => $shipment));
// some carriers need difference 3 hours
?>
	<?php 
echo Q::tool('Shipping/template', compact("shipment"));
?>
	<?php 
echo Q::tool('Shipping/shipment/submit', compact("shipment"));
?>
</div>

Example #16
0
<div id="content">
	<div class="Shipping_panel">
		<h2>Addresses</h2>
		<?php 
echo Q::tool("Streams/related", array("publisherId" => $env->userId, "streamName" => "Shipping/addresses", "relationType" => "origin"), "origins");
?>
		<?php 
echo Q::tool("Streams/related", array("publisherId" => $env->userId, "streamName" => "Shipping/addresses", "relationType" => "destination"), "destinations");
?>
		<?php 
echo Q::tool("Streams/related", array("publisherId" => $env->userId, "streamName" => "Shipping/addresses", "relationType" => "receiver"), "receivers");
?>
	</div>
</div>
Example #17
0
<div id='content'>
	<?php 
echo Users::loggedInUser() ? "<div>" : "<div class='Trump-carousel'>";
?>
		<div class="sky-carousel-wrapper">
			<?php 
echo Q::tool("Streams/related", array('publisherId' => 'Trump', 'streamName' => 'Streams/images/floorPlans', 'relationType' => 'images', 'tag' => 'li', 'editable' => true, 'creatable' => array('Streams/image' => array('title' => 'New Image')), '.Streams_preview_tool' => array("templates" => array("view" => array("name" => Users::loggedInUser() ? "Streams/image/preview/view" : "Trump/image/preview/view"), "create" => array("fields" => array("titleClass" => "sc-content")), "edit" => array("fields" => array("titleClass" => "sc-content"))), 'imagepicker' => array('saveSizeName' => array('x200' => 'x200', '80' => '80', '50' => '50', '40' => '40', 'x' => 'x'), 'showSize' => 'x200', 'fullSize' => 'x'))), array('tag' => 'ul', 'classes' => 'sky-carousel-container', 'id' => 'gallery'));
?>
		</div>
	</div>
</div>
Example #18
0
function Users_identifier_response_content()
{
    Q_Session::start();
    return Q::tool('Users/identifier');
}
Example #19
0
				<?php 
    echo Q_Html::img($stream->iconUrl('80.png'));
    ?>
			</div>
		<?php 
}
?>
		<div class='Streams_stream_title'>
			<?php 
echo Q_Html::text($stream->title);
?>
		</div>
		<div class='Streams_stream_player'>
			<?php 
echo Q::tool('Streams/player', compact('stream'));
?>
		</div>
	</div>
	<div class='Streams_stream_activity_pane'>
		<div class='Streams_participants'>
			<?php 
echo Q::tool('Streams/participants', compact('stream'));
?>
		</div>
		<div class='Streams_stream_activity'>
			<?php 
echo Q::tool('Streams/activity');
?>
		</div>
	</div>
</div>
Example #20
0
		</div>

		<?php 
if (count($labels) != 0) {
    ?>
			<div>
				Grant additional access to
				<select name="levelAddLabel" class="Streams_access_levelAddLabel">
					<?php 
    echo Q_Html::options($labels, '', null, true);
    ?>
				</select>
			</div>
			<table class="Streams_access_label_array"></table>
		<?php 
}
?>

		<div>Custom access for individual users:</div>
		<div class="Q_big_prompt">
			<?php 
echo Q::tool('Streams/userChooser');
?>
		</div>
		<table class="Streams_access_user_array"></table>
<?php 
if (!$controls) {
    ?>
	</div>
<?php 
}
Example #21
0
if ($user) {
    ?>
                    <?php 
    if (!$user->mobileNumber) {
        ?>
                        <li data-action="setIdentifier">set mobile number</li>
                    <?php 
    } elseif (!$user->emailAddress) {
        ?>
                        <li data-action="setIdentifier">set email address</li>
                    <?php 
    }
    ?>
                <?php 
}
?>
                <li data-action="logout">log out</li>
            </ul>
        </div>
    </div>

    <?php 
Q::tool('Q/tabs', array('vertical' => !Q_Request::isMobile(), 'overflow' => '{{html}}', 'compact' => true, 'tabs' => array('welcome' => 'Welcome', 'about' => 'About'), 'urls' => array('welcome' => 'First/welcome', 'about' => 'First/about')));
?>

    <?php 
echo Q::tool(array('Q/tabs' => array('vertical' => !Q_Request::isMobile(), 'overflow' => '{{html}}', 'compact' => true, 'tabs' => array('welcome' => 'Welcome', 'about' => 'About'), 'urls' => array('welcome' => 'First/welcome', 'about' => 'First/about')), 'Streams/related' => array('publisher' => 'First', 'streamName' => 'Websites/articles', 'relationType' => 'article', 'creatable' => array('Websites/article' => array('title' => 'New Page')), 'editable' => 'title', '.Websites_article_preview_tool' => array('inplace' => array('inplace' => array('maxWidth' => '.Streams_preview_container', 'editOnClick' => false)), 'icon' => false), 'tag' => 'li')), 'dashboard');
?>

</div>
Example #22
0
function Trump_welcome_response_dialog()
{
    return Q::tool('Q/expandable', array('title' => 'Expandable 1', 'content' => 'Some content<br>blablabla'), 'a') . Q::tool('Q/expandable', array('title' => 'Expandable 1', 'content' => 'Some content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablablaSome content<br>blablabla'), 'b');
}
Example #23
0
<?php

echo Q::tool('Shipping/invoice', compact('publisherId', 'streamName'));
Example #24
0
function Users_importContacts_response_content()
{
    return Q::tool('Users/importContacts', array('provider' => $_GET['provider']));
}
Example #25
0
<div id='content'>
	<h1>About First</h1>
	Here you can write something about this app or website.<br>
	Or if you want, you can remove this page...
</div>

<?php 
echo Q::tool("Places/location");
echo Q::tool("Streams/chat", array('publisherId' => 'First', 'streamName' => 'Streams/community/main'));
Example #26
0
echo Q_Html::img($byUser->iconUrl('80.png'), $byDisplayName, array('class' => 'item_icon'));
?>
				</td>
				<td>
					<h2><?php 
echo $byDisplayName;
?>
 invited you to:</h2>
					<div class='stream_title'><?php 
echo $stream->title;
?>
</div>
				</td>
			</tr>
		</table>
		<h3>Let your friends recognize you:</h3>
		<div class='Q_login Q_big_prompt'>
			<?php 
echo Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/basic', 'post');
?>
			<?php 
echo Q_Html::hidden(array('token' => $token, 'userId' => $user->id));
?>
			<?php 
echo Q::tool('Q/form', array('fields' => array('name' => array('placeholder' => "", 'label' => 'Enter your name:'), '' => array('type' => 'submit', 'value' => 'Get Started')), 'onSuccess' => Q_Request::baseUrl() . "/plugins/Streams/stream?publisherId={$stream->publisherId}&streamName={$stream->name}"), array('id' => 'Streams_Register'));
?>
			</form>
		</div>
	</div>
</div>
Example #27
0
 static function helperTool($template, $context, $args, $source)
 {
     $args = self::parseArgs($template, $context, $args);
     if (empty($args[0])) {
         return "{{tool missing name}}";
     }
     $name = $args[0];
     if (isset($args[1]) && (is_string($args[1]) || is_numeric($args[1]))) {
         $id = $args[1];
     }
     $o = array();
     foreach ($args as $k => $v) {
         if (!is_numeric($k)) {
             $o[$k] = $v;
         }
     }
     $fields = $context->fields();
     if (isset($fields[$name])) {
         $o = array_merge($args, $fields[$name]);
     }
     if ($id && isset($fields["id:{$id}"])) {
         $o = array_merge($o, $fields["id:{$id}"]);
     }
     return Q::tool($name, $o, compact('id'));
 }
Example #28
0
function Streams_subscription_response_content()
{
    return Q::tool('Streams/subscription');
}
Example #29
0
}
?>
		<div id="dashboard_user_contextual" class="Q_contextual" data-handler="MyApp.userContextual">
			<ul class="Q_listing">
				<?php 
if ($user) {
    ?>
					<?php 
    if (!$user->mobileNumber) {
        ?>
						<li data-action="setIdentifier">set mobile number</li>
					<?php 
    } elseif (!$user->emailAddress) {
        ?>
						<li data-action="setIdentifier">set email address</li>
					<?php 
    }
    ?>
				<?php 
}
?>
				<li data-action="logout">log out</li>
			</ul>
		</div>
	</div>
	
	<?php 
echo Q::tool('Q/tabs', array('vertical' => !Q_Request::isMobile(), 'overflow' => array('content' => '{{html}}'), 'compact' => true, 'tabs' => array('welcome' => 'Welcome', 'about' => 'About'), 'urls' => array('welcome' => 'MyApp/welcome', 'about' => 'MyApp/about')));
?>
</div>
Example #30
0
/**
 * This tool renders the participants in a stream
 * @class Streams participants
 * @constructor
 * @param {array} [options] Provide options for this tool
 *   @param {string} [options.publisherId] The id of the publisher
 *   @required
 *   @param {string} [options.streamName] The name of the stream
 *   @required
 *   @param {string} [options.stream] You can pass this instead of publisherId and streamName
 *   @param {integer} [options.max]
 *    The number, if any, to show in the denominator of the summary
 *   @optional
 *   @param {integer} [options.maxShow]
 *    The maximum number of participants to fetch for display
 *   @optional
 *   @default 10
 *   @param {Q.Event} [options.onRefresh] An event that occurs when the tool is refreshed
 *   @optional
 *   @param {boolean} [options.renderOnClient]
 *    If true, only the html container is rendered, so the client will do the rest.
 *   @optional
 */
function Streams_participants_tool($options)
{
    if (!empty($options['renderOnClient'])) {
        Q_Response::setToolOptions($options);
        return '';
    }
    $publisherId = Q::ifset($options, 'publisherId', null);
    $streamName = Q::ifset($options, 'streamName', null);
    if (!empty($options['stream'])) {
        $stream = $options['stream'];
        $publisherId = $stream->publisherId;
        $streamName = $stream->name;
        unset($options['stream']);
    }
    if (!isset($publisherId)) {
        $publisherId = Streams::requestedPublisherId(true);
    }
    if (!isset($streamName)) {
        $streamName = Streams::requestedName(true);
    }
    $options['publisherId'] = $publisherId;
    $options['streamName'] = $streamName;
    $max = Q_Config::get('Streams', 'participants', 'max', Q::ifset($options, 'max', 10));
    if (!$stream) {
        $stream = Streams::fetchOne(null, $publisherId, $streamName);
    }
    if (empty($stream)) {
        throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
    }
    if (!$stream->testReadLevel('participants')) {
        throw new Users_Exception_NotAuthorized();
    }
    $participants = $stream->getParticipants(compact('limit', 'offset', 'state'));
    Q_Response::addScript('plugins/Streams/js/Streams.js');
    Q_Response::addStylesheet('plugins/Streams/css/Streams.css');
    $options['rendered'] = true;
    Q_Response::setToolOptions($options);
    $stream->addPreloaded();
    $avatars = '';
    $c = 0;
    if ($participants) {
        $i = 0;
        foreach ($participants as $p) {
            if ($p->state !== 'participating') {
                continue;
            }
            ++$c;
            if (empty($options['maxShow']) or ++$i <= $options['maxShow']) {
                $avatars .= Q::tool("Users/avatar", array('userId' => $p->userId, 'icon' => true, 'short' => true), $p->userId);
            }
        }
    }
    $spans = "<span class='Streams_participants_avatars'>{$avatars}</span>" . "<span class='Streams_participants_blanks'></span>";
    $container = "<div class='Streams_participants_container'>{$spans}</div>";
    $count = "<span class='Streams_participants_count'>{$c}</span>";
    $m = isset($options['max']) ? '/' . $options['max'] : '';
    $max = "<span class='Streams_participants_max'>{$m}</span>";
    $img = Q_Html::img('plugins/Q/img/expand.png', 'expand', array('class' => 'Streams_participants_expand_img'));
    $control = "<div class='Streams_participants_expand'>{$img}<span class='Streams_participants_expand_text'>See All</span></div>";
    $summary = "<div class='Streams_participants_summary'><span>{$count}{$max}</span></div>";
    $controls = "<div class='Streams_participants_controls'>{$control}</div>";
    return $controls . $summary . $container;
}