Example #1
0
 /**
  * Return the HTML Attributes in string format
  *
  * @param array $htmlAttributes
  * @return array
  */
 public function renderHtmlAttributes($htmlAttributes = null)
 {
     if (is_null($htmlAttributes)) {
         $htmlAttributes = $this->getHtmlAttributes();
     }
     if (zbase_is_angular_template()) {
         if (!empty($htmlAttributes['angular'])) {
             $htmlAttributes = $htmlAttributes['angular'];
         }
     }
     if (!empty($htmlAttributes) && is_array($htmlAttributes)) {
         $attributes = [];
         foreach ($htmlAttributes as $key => $value) {
             if (is_array($value)) {
                 $valueAtt = '';
                 //					foreach ($value as $v => $vls)
                 //					{
                 //						if(is_array($vls))
                 //						{
                 //							$valueAtt .= implode(' ', $vls);
                 //						}
                 //						else
                 //						{
                 //							$valueAtt .= $vls;
                 //						}
                 //					}
                 //					$attributes[] = $key . '="' . $valueAtt . '"';
                 $attributes[] = $key . '="' . implode(' ', $value) . '"';
             } else {
                 if ($value === false) {
                     continue;
                 }
                 $attributes[] = $key . '="' . zbase_data_get($value) . '"';
             }
         }
         return implode(' ', $attributes);
     }
     return null;
 }
Example #2
0
 /**
  * Retrieves a value from the configuration
  * @param string $key
  * @param mixed $default
  * @return mixed
  */
 public function _v($key, $default = null)
 {
     if (zbase_is_angular_template()) {
         return zbase_data_get($this->getAttributes(), 'angular.' . $key, zbase_data_get($this->getAttributes(), $key, $default, $this), $this);
     }
     return zbase_data_get($this->getAttributes(), $key, $default, $this);
 }
Example #3
0
/**
 * Create a URL based from configuration
 *
 * url.route.name
 * url.route.name.params
 *
 * @param array $config
 * @param array $params Some parameters
 * @return string
 */
function zbase_url_from_config($config, $params = [], $relative = false)
{
    if (is_string($config)) {
        if (zbase_is_angular_template()) {
            return '#' . $config;
        }
        return $config;
    }
    if (is_array($config)) {
        if (!empty($config['route']) && !empty($config['route']['name'])) {
            $name = $config['route']['name'];
            $params = !empty($config['route']['params']) ? $config['route']['params'] : [];
            return zbase_url_from_route($name, $params, $relative);
        }
        if (!empty($config['link']) && is_string($config['link'])) {
            if (zbase_is_angular_template()) {
                return '#' . $config['link'];
            }
            return $config['link'];
        }
    }
}
Example #4
0
<?php

if (zbase_is_angular_template()) {
    ?>
	<form name="form" role="form" class="form-horizontal">
		<div ng-hide="loginPasswordToggle">
			<div class="form-group" ng-class="{'has-error': form.email.$dirty && form.email.$error.required }">
				<label class="col-md-4 control-label">E-Mail Address</label>

				<div class="col-md-6">
					<input ng-model="email" type="email" class="form-control" required name="email" value="" />
				</div>
			</div>

			<div class="form-group"  ng-class="{'has-error': form.password.$dirty && form.password.$error.required }">
				<label class="col-md-4 control-label">Password</label>

				<div class="col-md-6">
					<input type="password" ng-model="password" class="form-control" name="password" required>
				</div>
			</div>

			<div class="form-group">
				<div class="col-md-6 col-md-offset-4">
					<button class="btn btn-primary" ng-disabled="form.$invalid" ng-click="login()">
						<i class="fa fa-btn fa-sign-in"></i> Login
					</button>
					<a class="btn btn-link" ng-click="loginPasswordToggle = true">Forgot Your Password?</a>
				</div>
			</div>
		</div>
Example #5
0
 /**
  * Return the Input Attributes
  * @return array
  */
 public function inputAttributes()
 {
     $attr = $this->_v('html.attributes.input', []);
     $attr['type'] = $this->getType();
     $attr['id'] = $this->getHtmlId();
     $attr['name'] = $this->inputName();
     $attr['value'] = trim($this->getValue());
     $attr['class'][] = 'form-control';
     if (!isset($attr['placeholder'])) {
         $attr['placeholder'] = $this->getLabel();
     }
     if (zbase_is_angular_template()) {
         $ngModel = $this->_v('angular.ngModel', null);
         if (is_array($ngModel)) {
             if (!empty($ngModel['prefix'])) {
                 $ngModel = $ngModel['prefix'] . '.' . $this->name();
             }
             if (!empty($ngModel['ngModel'])) {
                 $ngModel = $ngModel['ngModel'];
             }
         }
         if (!empty($ngModel)) {
             $attr['ng-model'] = $ngModel;
         }
         if ($this->hasValidation('min')) {
             $minValidation = $this->getValidation('min');
             if (is_array($minValidation)) {
                 $attr['ng-minlength'] = $minValidation[1];
             }
         }
     }
     if ($this->hasValidations()) {
         if ($this->hasValidation('required')) {
             $attr['required'] = null;
         }
     }
     return $attr;
 }
Example #6
0
 /**
  * Form Start Tag
  * @return string
  */
 public function startTag()
 {
     $attributes = $this->_v('form.startTag.' . $this->_action . '.html.attributes', $this->_v('form.startTag.html.attributes', []));
     if (empty($attributes['name'])) {
         $attributes['name'] = $this->getHtmlId();
     }
     if (zbase_is_angular_template()) {
         /**
          * false is disabled
          */
         if (!isset($attributes['ng-submit'])) {
             $attributes['ng-submit'] = 'submit' . $this->getHtmlId() . '()';
         }
         return '<form role="form" ' . $this->renderHtmlAttributes($attributes) . '>';
     }
     return '<form action="' . $this->getFormAction() . '" method="POST" enctype="multipart/form-data" ' . $this->renderHtmlAttributes($attributes) . '>';
 }
Example #7
0
/**
 * Redirect
 * @return redirect
 */
function zbase_redirect($to = null, $status = 302, $headers = [], $secure = null)
{
    if (zbase_is_angular_template()) {
        zbase()->json()->setVariable('_redirect', $to);
        $response = new \Zbase\Exceptions\HttpException('Redirecting to ' . $to);
        $response->setStatusCode($status);
        return $response;
    } else {
        return redirect($to, $status, $headers, $secure);
    }
}
Example #8
0
zbase_view_plugin_load('nodes');
//zbase_view_plugin_load('nodes-upload-krajee');
/**
 * Dx
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 23, 2016 8:54:46 PM
 * @file images.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.
 */
$isAngularTemplate = zbase_is_angular_template();
if (empty($node) & !empty($ui)) {
    $node = $ui->form()->entity();
}
if (empty($node)) {
    $node = $ui->entity();
}
if (!empty($node)) {
    if ($node instanceof Zbase\Entity\Laravel\Node\Category) {
        $isNode = false;
        $isCategory = true;
    } elseif ($node instanceof Zbase\Entity\Laravel\User\User) {
        $isNode = false;
        $isUser = true;
    } else {
        $images = $node->childrenFiles();
Example #9
0
 /**
  * To String
  * @return string
  */
 public function __toString()
 {
     $content = parent::__toString();
     if (zbase_is_angular_template()) {
         $serviceName = zbase_angular_module_servicename($this->getModule(), $this);
         $scopeName = zbase_angular_module_scopename($this->getModule(), $this);
         $content = str_replace('ANGULAR_WIDGET_MODULE_SERVICENAME', $serviceName, $content);
         $content = str_replace('ANGULAR_WIDGET_MODULE_SCOPENAME', $scopeName, $content);
     }
     return $content;
 }