Ejemplo n.º 1
0
 /**
  * Test function associated with Script
  *
  * @return void
  * @test
  */
 public function testScriptViewFunctions()
 {
     $this->assertInstanceOf(Zbase\Models\View\Script::class, zbase_view_script_add('script', 'function(){ console.log(var); }', true, null, []));
     $links = ['scriptOne' => ['id' => 'script', 'script' => 'function(){ console.log(var); }', 'onLoad' => true], 'scriptTwo' => ['id' => 'script', 'script' => 'function(){ console.log(var); }', 'onLoad' => true], 'scriptThree' => ['id' => 'script', 'script' => 'function(){ console.log(var); }', 'onLoad' => true], 'scriptFour' => ['id' => 'script', 'script' => 'function(){ console.log(var); }', 'onLoad' => true]];
     $this->assertEquals(5, count(zbase_view_scripts_set($links)));
     $this->assertInstanceOf(Zbase\Models\View\Script::class, zbase_view_script('scriptThree'));
     $this->assertNotInstanceOf(Zbase\Models\View\Script::class, zbase_view_script('scriptFive'));
     $this->assertTrue(zbase_view_script_has('scriptThree'));
     $this->assertFalse(zbase_view_script_has('scriptFive'));
     $this->assertEquals(5, count(zbase_view_scripts($links)));
 }
Ejemplo n.º 2
0
 * @version 0.0.0.1
 * @since Sep 6, 2016 7:31:49 PM
 * @file files.blade.php
 * @project Zbase
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
$files = $entity->postFiles();
ob_start();
?>
<script type="text/javascript">
	<?php 
echo $entity->postFileScript('delete');
?>
</script>
<?php 
zbase_view_script_add($entity->postHtmlId() . 'Filesscript', ob_get_clean());
?>
<div class="files_wrapper" id="<?php 
echo $entity->postHtmlId();
?>
FilesWrapper">
	<?php 
if (!empty($files)) {
    ?>
		<?php 
    foreach ($files as $file) {
        ?>
			<?php 
        $file = (object) $file;
        ?>
			<?php 
Ejemplo n.º 3
0
}
if ($positionable) {
    $jsTreePlugins[] = 'dnd';
    $jsTreePlugins[] = 'state';
    $jsTreePlugins[] = 'unique';
}
$pluginOptions = ['plugins' => $jsTreePlugins, 'core' => ['data' => $treeData, 'themes' => ['responsive' => true]]];
if (empty($multiple)) {
    $pluginOptions['core']['multiple'] = false;
}
if (empty($selectable)) {
    zbase_view_style_add('jstreeSelectable', '.jstree-icon.jstree-checkbox{display: none;}');
}
$script = ['jQuery(\'#' . $uiId . 'TreeView\').jstree(' . zbase_collection($pluginOptions)->toJson() . ')'];
$script[] = 'on(\'changed.jstree\', nodeCategoryJstreeOnClicked)';
zbase_view_script_add($uiId . 'TreeView', implode('.', $script) . ';', true);
$dataConfig = [];
$dataConfig['url'] = zbase_url_from_route('admin.node_' . $entity::$nodeNamePrefix . '_category', ['action' => 'ACTION', 'id' => 'ID']);
$dataConfig['node'] = str_replace('-', '_', $treeOptions['nodeWidgetId']);
$dataConfig['infopane'] = '#' . $uiId . 'TreeViewInfoPane';
?>

<div class="col-md-12">
	<div class="col-md-3 col-xs-12">
		<div class="slimScrollDiv" id="<?php 
echo $uiId;
?>
TreeView" data-id="<?php 
echo $uiId;
?>
" data-config='<?php 
Ejemplo n.º 4
0
', {}, function (e) {
					if (e.telegramHooked !== undefined)
					{
						window.location = '<?php 
    echo zbase_url_from_current();
    ?>
';
					}
				}, {});
			}, 5000);
			window.open(jQuery(this).attr('href'));
		});
	</script>
	<?php 
    $script = ob_get_clean();
    zbase_view_script_add('telegramEnabler', $script, true);
    ?>

<?php 
} else {
    ?>
	<div class="alert alert-success">You are currently receiving notifications via Telegram</div>
	<br />
	<br />
	<a class="btn btn-warning" href="<?php 
    echo zbase_url_from_route('admin.account', ['action' => 'telegram-disable']);
    ?>
">Disable Telegram notifications</a>
<?php 
}
?>
Ejemplo n.º 5
0
				jQuery('#<?php 
        echo $ui->getHtmlId();
        ?>
Uploader').closest('form').find('[type="submit"]').attr('id','<?php 
        echo $ui->getHtmlId();
        ?>
UploaderSubmitButton');
			<?php 
    }
    ?>
		</script>
		<?php 
    if (zbase_request_is_ajax()) {
        zbase()->json()->setVariable('_html_script', [ob_get_clean()], true);
    } else {
        zbase_view_script_add('fileupload' . $formId, ob_get_clean(), true);
    }
    ?>
		<script id="template-upload" type="text/x-tmpl">
			{% for (var i=0, file; file=o.files[i]; i++) { %}
				<tr class="template-upload fade">
					<td>
						<span class="preview"></span>
					</td>
					<td>
						<p class="name">{%=file.name%}</p>
						{% if (file.error) { %}
							<div><span class="label label-danger">Error</span> {%=file.error%}</div>
						{% } %}
					</td>
					<td>
Ejemplo n.º 6
0
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Apr 1, 2016 3:31:09 PM
 * @file list.blade.php
 * @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
$msg = $ui->entity();
$page = ['title' => 'Read Message', 'subTitle' => '', 'headTitle' => 'Read Message'];
zbase_view_page_details(['page' => $page]);
$js = zbase_view_render(zbase_view_file_contents('modules.messages.js'), ['msg' => $msg]);
zbase_view_script_add('messages', $js, false);
?>
<div class="col-md-2">
	<a href="#">
		<img class="media-object" style="width: 80px;" src="<?php 
echo $msg->senderAvatarUrl();
?>
" alt="<?php 
echo $msg->senderName();
?>
" />
	</a>
	<a href="#">
		<?php 
echo $msg->senderName();
?>
Ejemplo n.º 7
0
if ($form instanceof \Zbase\Widgets\Type\FormInterface) {
    $treeViewOptions[] = 'showCheckbox: false';
    if (!$ui->isDatatable()) {
        $treeViewOptions[] = 'onNodeUnselected: function(event, node) {var nodeId = \'' . $uiId . 'Category\'+node.id;jQuery(\'#\' + nodeId).remove();}';
        $treeViewOptions[] = 'onNodeSelected: function(event, node) {var nodeId = \'' . $uiId . 'Category\'+node.id;jQuery(\'#' . $uiId . 'TreeView\').parent().append(\'<input type="hidden" value="\'+node.id+\'" id="\'+nodeId+\'" name="category[]">\');}';
    }
}
$treeOptions = $ui->getAttribute('treeOptions');
$label = $ui->getAttribute('label');
if (!empty($treeOptions)) {
    foreach ($treeOptions as $oK => $oV) {
        $treeViewOptions[] = $oK . ': ' . (!empty($oV) ? 'true' : 'false');
    }
}
$script = 'jQuery(\'#' . $uiId . 'TreeView\').treeview({' . implode(',', $treeViewOptions) . '});';
zbase_view_script_add($uiId . 'TreeView', $script, true);
if ($form instanceof \Zbase\Widgets\Type\FormInterface) {
    ?>
	<div class="form-group">
		<label><?php 
    echo $label;
    ?>
</label>
		<div <?php 
    echo $wrapperAttributes;
    ?>
>
			<div id="<?php 
    echo $uiId;
    ?>
TreeView"></div>
Ejemplo n.º 8
0
 *
 */
return ['id' => 'notifications', 'enable' => true, 'access' => 'users', 'class' => null, 'backend' => true, 'frontend' => false, 'url' => ['backend' => 'notifications/{action?}/{id?}/{task?}'], 'notification' => ['back' => [['enable' => true, 'id' => 'notifications', 'order' => 9999, 'route' => ['name' => 'admin.notifications'], 'icon' => 'fa fa-warning', 'label' => 'Notifications', 'title' => 'Notifications', 'viewAllText' => 'See all notifications', 'badgeCount' => function () {
    $notifications = count(zbase_auth_user()->notificationsNotNotified());
    if (!empty($notifications)) {
        return $notifications;
    }
    return null;
}, 'defaultMessage' => function () {
    $notifications = count(zbase_auth_user()->notificationsNotNotified());
    if (!empty($notifications)) {
        return 'You have ' . $notifications . ' new notifications.';
    }
    return 'No new notifications.';
}, 'height' => '250px', 'defaultContent' => function () {
    zbase_view_script_add('mnotifications-script', zbase_view_render(zbase_view_file_module('notifications.views.js', 'notifications', 'zbase')), true);
    $notifications = zbase_auth_user()->notificationsLatest();
    if (!empty($notifications)) {
        $string = '';
        foreach ($notifications as $notification) {
            $string .= '<li data-id="' . $notification->id() . '" id="notifications-list-' . $notification->id() . '">
								<a href="' . $notification->url() . '">
									<span class="label label-sm label-icon label-' . $notification->displayColor() . '">
										<i class="fa ' . $notification->displayIcon() . '"></i>
									</span>
									 ' . $notification->displayMessage() . '
									<span class="time">
										 ' . $notification->displayTime() . '
									</span>
								</a>
							</li>';
Ejemplo n.º 9
0
query').on('keypress', function (event) {
			 if(event.which === 13){
				<?php 
echo $prefix;
?>
GoSearch();
				jQuery(this).closest('form').submit(function(e){e.preventDefault();});
			 }
	   });
	}
</script>
<?php 
$script = ob_get_contents();
ob_end_clean();
zbase_view_script_add($prefix . 'search', $script, false);
zbase_view_script_add($prefix . 'searchinit', $prefix . 'init();', true);
if (!empty($isSearchable) && !empty($searchableInputs)) {
    ?>
	<div id="<?php 
    echo $prefix;
    ?>
SearchWrapper">
		<div class="form-group">
			<input id="<?php 
    echo $prefix;
    ?>
query" type="text" class="form-control datatable-search-query" name="<?php 
    echo $prefix;
    ?>
Query" value="" placeholder="<?php 
    echo $ui->searchTextPlaceholder();