Class luya\admin\aws\FlowActiveWindow

Inheritanceluya\admin\aws\FlowActiveWindow » luya\admin\ngrest\base\ActiveWindow » luya\admin\ngrest\base\BaseActiveResponse » yii\base\BaseObject
Implementsluya\admin\ngrest\NgRestButtonConditionInterface, luya\admin\ngrest\NgRestPermissionLevelInterface, luya\admin\ngrest\base\ActiveWindowInterface, yii\base\Configurable, yii\base\ViewContextInterface
Available since version1.0.0

Flow Uploader ActiveWindow enables multi image upload with chunck ability.

The Flow ActiveWindow will not store any data in the filemanager as its thought to be used in large image upload scenarios like galleries. The image are chuncked into parts in order to enable large image uploads.

Example use:

public function ngRestActiveWindows()
{
  return [
      ['class' => \luya\admin\aws\FlowActiveWindow::class, 'label' => 'My Gallery'],
  ];
}

The attached model class must implement the interface {{\luya\admin\aws\FlowActiveWindowInterface}} in order to interact with thw Activ Window.

There is also a helper Trait {{\luya\admin\aws\FlowActiveWindowTrait}} you can include in order to work with a relation table.

Public Properties

Hide inherited properties

Property Type Description Defined By
$activeWindowHash string luya\admin\ngrest\base\ActiveWindow
$condition luya\admin\ngrest\base\ActiveWindow
$configHash string luya\admin\ngrest\base\ActiveWindow
$hashName string Get an unique hased Active Window config name luya\admin\ngrest\base\ActiveWindow
$icon string Returns the material icon name as string. luya\admin\ngrest\base\ActiveWindow
$isCompositeItem \luya\admin\ngrest\base\Whether The current item is a composite key or not. luya\admin\ngrest\base\ActiveWindow
$itemId integer The Id of the item luya\admin\ngrest\base\ActiveWindow
$itemIds array luya\admin\ngrest\base\ActiveWindow
$label string Returns the label of the active window, keep in mind this value has not model context. luya\admin\ngrest\base\ActiveWindow
$model luya\admin\ngrest\base\NgRestModel The model evaluated by the findOne of the called ng rest model ActiveRecord. luya\admin\ngrest\base\ActiveWindow
$module string The name of the module where the ActiveWindow is located in order to find the view path. luya\admin\aws\FlowActiveWindow
$name string Get the current Active Window Name luya\admin\ngrest\base\ActiveWindow
$ngRestModelClass string The class name of the called class where the actice window is bound to. luya\admin\ngrest\base\ActiveWindow
$permissionLevel luya\admin\ngrest\base\ActiveWindow
$title string Returns the title string which can have model context. luya\admin\ngrest\base\ActiveWindow
$view luya\admin\ngrest\base\ActiveWindowView The view object luya\admin\ngrest\base\ActiveWindow
$viewFolderName string luya\admin\ngrest\base\ActiveWindow
$viewPath luya\admin\ngrest\base\ActiveWindow

Protected Properties

Hide inherited properties

Property Type Description Defined By
$suffix string The suffix to use for all classes luya\admin\ngrest\base\ActiveWindow

Public Methods

Hide inherited methods

Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
callbackList() Returns a list of uploaded images. luya\admin\aws\FlowActiveWindow
callbackRemove() Remove a given image from the collection. luya\admin\aws\FlowActiveWindow
callbackUpload() Flow Uploader Upload. luya\admin\aws\FlowActiveWindow
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
createCallbackUrl() Create an absolute link to a callback. luya\admin\ngrest\base\ActiveWindow
createDownloadableFileUrl() MIME: https://wiki.selfhtml.org/wiki/Referenz:MIME-Typen luya\admin\ngrest\base\ActiveWindow
defaultIcon() If no extenion is set, this value is used. luya\admin\aws\FlowActiveWindow
defaultLabel() If no label value is provided via getter/setter, this value is used. luya\admin\aws\FlowActiveWindow
getActiveWindowHash() Get the active window hash from the setter method. luya\admin\ngrest\base\ActiveWindow
getCondition() Get the button condition or empty of not set luya\admin\ngrest\base\ActiveWindow
getConfigHash() Return the config hash name from the setter method. luya\admin\ngrest\base\ActiveWindow
getHashName() Get a unique identifier hash based on the name and config values like icon and label. luya\admin\ngrest\base\ActiveWindow
getIcon() Return the current icon defined for this Active Window. luya\admin\ngrest\base\ActiveWindow
getIsCompositeItem() luya\admin\ngrest\base\ActiveWindow
getItemId() Get the item id of the current ActiveWindow context item id. luya\admin\ngrest\base\ActiveWindow
getItemIds() Returns an array with all items if its a composite key. luya\admin\ngrest\base\ActiveWindow
getLabel() Return the current label defined for this Active Window. luya\admin\ngrest\base\ActiveWindow
getModel() Get the model object from where the Active Window is attached to. luya\admin\aws\FlowActiveWindow
getName() Get the ActiveWindow name based on its class short name. luya\admin\ngrest\base\ActiveWindow
getPermissionLevel() Get the button displaying permission level or empty of not set luya\admin\ngrest\base\ActiveWindow
getTitle() By default the title just returns the {{getLabel()}} value if not overriden. luya\admin\ngrest\base\ActiveWindow
getView() Get the view object to render templates. luya\admin\ngrest\base\ActiveWindow
getViewFolderName() Get the folder name where the views for this ActiveWindow should be stored. luya\admin\ngrest\base\ActiveWindow
getViewPath() Return the view path for view context. luya\admin\ngrest\base\ActiveWindow
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
index() The default action which is going to be requested when clicking the active window. luya\admin\aws\FlowActiveWindow
init() Initializes the object. luya\admin\ngrest\base\ActiveWindow
render() Render a template with its name and params based on the view folder path. luya\admin\ngrest\base\ActiveWindow
sendError() Send an error message as response. luya\admin\ngrest\base\BaseActiveResponse
sendReloadEvent() Send a CRUD reload event. luya\admin\ngrest\base\BaseActiveResponse
sendSuccess() Send a success message. luya\admin\ngrest\base\BaseActiveResponse
setActiveWindowHash() Set the hash of the current active window which is calculated by the ActiveWindow. luya\admin\ngrest\base\ActiveWindow
setCondition() Setter method for the button ng-show condition luya\admin\ngrest\base\ActiveWindow
setConfigHash() Set the current configratuion hash name to the ActiveWindow. luya\admin\ngrest\base\ActiveWindow
setIcon() Setter method for the icon luya\admin\ngrest\base\ActiveWindow
setItemId() Set the value of the item Id in where the active window context is initialized. luya\admin\ngrest\base\ActiveWindow
setLabel() Setter method for the Label. luya\admin\ngrest\base\ActiveWindow
setPermissionLevel() Setter method for the ActiveWindow button displaying permission level luya\admin\ngrest\base\ActiveWindow

Constants

Hide inherited constants

Constant Value Description Defined By
EVENT_RELOAD_LIST 'loadList' luya\admin\ngrest\base\BaseActiveResponse

Property Details

Hide inherited properties

$module public property

The name of the module where the ActiveWindow is located in order to find the view path.

public string $module '@admin'

Method Details

Hide inherited methods

__call() public method

Defined in: yii\base\BaseObject::__call()

Calls the named method which is not a class method.

Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.

public mixed __call ( $name, $params )
$name string

The method name

$params array

Method parameters

return mixed

The method return value

throws yii\base\UnknownMethodException

when calling unknown method

                public function __call($name, $params)
{
    throw new UnknownMethodException('Calling unknown method: ' . get_class($this) . "::$name()");
}

            
__construct() public method

Defined in: yii\base\BaseObject::__construct()

Constructor.

The default implementation does two things:

  • Initializes the object with the given configuration $config.
  • Call init().

If this method is overridden in a child class, it is recommended that

  • the last parameter of the constructor is a configuration array, like $config here.
  • call the parent implementation at the end of the constructor.
public void __construct ( $config = [] )
$config array

Name-value pairs that will be used to initialize the object properties

                public function __construct($config = [])
{
    if (!empty($config)) {
        Yii::configure($this, $config);
    }
    $this->init();
}

            
__get() public method

Defined in: yii\base\BaseObject::__get()

Returns the value of an object property.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.

See also __set().

public mixed __get ( $name )
$name string

The property name

return mixed

The property value

throws yii\base\UnknownPropertyException

if the property is not defined

throws yii\base\InvalidCallException

if the property is write-only

                public function __get($name)
{
    $getter = 'get' . $name;
    if (method_exists($this, $getter)) {
        return $this->$getter();
    } elseif (method_exists($this, 'set' . $name)) {
        throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
    }
    throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}

            
__isset() public method

Defined in: yii\base\BaseObject::__isset()

Checks if a property is set, i.e. defined and not null.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing isset($object->property).

Note that if the property is not defined, false will be returned.

See also https://www.php.net/manual/en/function.isset.php.

public boolean __isset ( $name )
$name string

The property name or the event name

return boolean

Whether the named property is set (not null).

                public function __isset($name)
{
    $getter = 'get' . $name;
    if (method_exists($this, $getter)) {
        return $this->$getter() !== null;
    }
    return false;
}

            
__set() public method

Defined in: yii\base\BaseObject::__set()

Sets value of an object property.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $object->property = $value;.

See also __get().

public void __set ( $name, $value )
$name string

The property name or the event name

$value mixed

The property value

throws yii\base\UnknownPropertyException

if the property is not defined

throws yii\base\InvalidCallException

if the property is read-only

                public function __set($name, $value)
{
    $setter = 'set' . $name;
    if (method_exists($this, $setter)) {
        $this->$setter($value);
    } elseif (method_exists($this, 'get' . $name)) {
        throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
    } else {
        throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
    }
}

            
__unset() public method

Defined in: yii\base\BaseObject::__unset()

Sets an object property to null.

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing unset($object->property).

Note that if the property is not defined, this method will do nothing. If the property is read-only, it will throw an exception.

See also https://www.php.net/manual/en/function.unset.php.

public void __unset ( $name )
$name string

The property name

throws yii\base\InvalidCallException

if the property is read only.

                public function __unset($name)
{
    $setter = 'set' . $name;
    if (method_exists($this, $setter)) {
        $this->$setter(null);
    } elseif (method_exists($this, 'get' . $name)) {
        throw new InvalidCallException('Unsetting read-only property: ' . get_class($this) . '::' . $name);
    }
}

            
callbackList() public method

Returns a list of uploaded images.

public array callbackList ( )

                public function callbackList()
{
    $data = $this->model->flowListImages();
    $images = [];
    foreach (Yii::$app->storage->findImages(['in', 'id', $data]) as $item) {
        $images[$item->id] = $item->applyFilter('small-crop')->toArray();
    }
    return $this->sendSuccess('list loaded', [
        'images' => $images,
    ]);
}

            
callbackRemove() public method

Remove a given image from the collection.

public array callbackRemove ( $imageId )
$imageId integer

                public function callbackRemove($imageId)
{
    $image = Yii::$app->storage->getImage($imageId);
    if ($image) {
        $this->model->flowDeleteImage($image);
        if (Storage::removeImage($image->id, true)) {
            return $this->sendSuccess('image has been removed');
        }
    }
    return $this->sendError('Unable to remove this image');
}

            
callbackUpload() public method

Flow Uploader Upload.

public void callbackUpload ( )

                public function callbackUpload()
{
    $config = new Config();
    $config->setTempDir($this->getTempFolder());
    $file = new File($config);
    $request = new Request();
    if ($_SERVER['REQUEST_METHOD'] === 'GET') {
        if ($file->checkChunk()) {
            header("HTTP/1.1 200 Ok");
        } else {
            header("HTTP/1.1 204 No Content");
            exit;
        }
    } else {
        if ($file->validateChunk()) {
            $file->saveChunk();
        } else {
            // error, invalid chunk upload request, retry
            header("HTTP/1.1 400 Bad Request");
            exit;
        }
    }
    if ($file->validateFile() && $file->save($this->getUploadFolder() . '/'.$request->getFileName())) {
        // File upload was completed
        $file = Yii::$app->storage->addFile($this->getUploadFolder() . '/'.$request->getFileName(), $request->getFileName(), 0, true);
        if ($file) {
            @unlink($this->getUploadFolder() . '/'.$request->getFileName());
            $image = Yii::$app->storage->addImage($file->id);
            if ($image) {
                $image->applyFilter('small-crop');
                $this->model->flowSaveImage($image);
                return 'done';
            }
        }
    } else {
        // This is not a final chunk, continue to upload
    }
}

            
canGetProperty() public method

Defined in: yii\base\BaseObject::canGetProperty()

Returns a value indicating whether a property can be read.

A property is readable if:

  • the class has a getter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);

See also canSetProperty().

public boolean canGetProperty ( $name, $checkVars true )
$name string

The property name

$checkVars boolean

Whether to treat member variables as properties

return boolean

Whether the property can be read

                public function canGetProperty($name, $checkVars = true)
{
    return method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name);
}

            
canSetProperty() public method

Defined in: yii\base\BaseObject::canSetProperty()

Returns a value indicating whether a property can be set.

A property is writable if:

  • the class has a setter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);

See also canGetProperty().

public boolean canSetProperty ( $name, $checkVars true )
$name string

The property name

$checkVars boolean

Whether to treat member variables as properties

return boolean

Whether the property can be written

                public function canSetProperty($name, $checkVars = true)
{
    return method_exists($this, 'set' . $name) || $checkVars && property_exists($this, $name);
}

            
className() public static method
Deprecated since 2.0.14. On PHP >=5.5, use ::class instead.

Defined in: yii\base\BaseObject::className()

Returns the fully qualified name of this class.

public static string className ( )
return string

The fully qualified name of this class.

                public static function className()
{
    return get_called_class();
}

            
createCallbackUrl() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::createCallbackUrl()

Create an absolute link to a callback.

This method is commonly used when returing data directly to the browser, there for the abolute url to a callback is required. Only logged in users can view the callback url, but there is no other security about callbacks.

public string createCallbackUrl ( $callback )
$callback string

The name of the callback without the callback prefix exmaple createPdf if the callback is callbackCreatePdf().

return string

The absolute url to the callback.

                public function createCallbackUrl($callback)
{
    return Url::to([
        '/admin/'.$this->model->ngRestApiEndpoint().'/active-window-callback',
        'activeWindowCallback' => Inflector::camel2id($callback),
        'ngrestConfigHash' => $this->getConfigHash(),
        'activeWindowHash' => $this->getActiveWindowHash(),
    ], true);
}

            
createDownloadableFileUrl() public method
public string createDownloadableFileUrl ( $fileName, $mimeType, $content )
$fileName string
$mimeType string
$content string

                public function createDownloadableFileUrl($fileName, $mimeType, $content)
{
    $key = uniqid(microtime().Inflector::slug($fileName), true);
    $store = FileHelper::writeFile('@runtime/'.$key.'.tmp', $content);
    $menu = Yii::$app->adminmenu->getApiDetail($this->model->ngRestApiEndpoint());
    $route = $menu['route'];
    $route = str_replace("/index", "/export-download", $route);
    if ($store) {
        Yii::$app->session->set('tempNgRestFileName', $fileName);
        Yii::$app->session->set('tempNgRestFileKey', $key);
        Yii::$app->session->set('tempNgRestFileMime', $mimeType);
        $url = Url::toRoute(['/'.$route], true);
        $param = http_build_query(['key' => base64_encode($key), 'time' => time()]);
        if (StringHelper::contains('?', $url)) {
            return $url . "&" . $param;
        } else {
            return $url . "?" . $param;
        }
    }
    return false;
}

            
defaultIcon() public method

If no extenion is set, this value is used.

You can override this method in order to provide a default icon for your Active Window.

public string defaultIcon ( )

                public function defaultIcon()
{
    return 'cloud_upload';
}

            
defaultLabel() public method

If no label value is provided via getter/setter, this value is used.

You can override this method in order to provide a default label for your Active Window.

public boolean|string defaultLabel ( )

                public function defaultLabel()
{
    return 'Flow Uploader';
}

            
getActiveWindowHash() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getActiveWindowHash()

Get the active window hash from the setter method.

public string getActiveWindowHash ( )

                public function getActiveWindowHash()
{
    return $this->_activeWindowHash;
}

            
getCondition() public method (available since version 4.0.0)

Defined in: luya\admin\ngrest\base\ActiveWindow::getCondition()

Get the button condition or empty of not set

public void getCondition ( )

                public function getCondition()
{
    return empty($this->_condition) ? '' : $this->_condition;
}

            
getConfigHash() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getConfigHash()

Return the config hash name from the setter method.

public string getConfigHash ( )

                public function getConfigHash()
{
    return $this->_configHash;
}

            
getHashName() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getHashName()

Get a unique identifier hash based on the name and config values like icon and label.

public string getHashName ( )

                public function getHashName()
{
    if ($this->_hashName === null) {
        $this->_hashName = sha1(static::class);
    }
    return $this->_hashName;
}

            
getIcon() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getIcon()

Return the current icon defined for this Active Window.

public string getIcon ( )
return string

Returns the material icon name as string.

                public function getIcon()
{
    return empty($this->_icon) ? $this->defaultIcon() : $this->_icon;
}

            
getIsCompositeItem() public method
public \luya\admin\ngrest\base\Whether getIsCompositeItem ( )
return \luya\admin\ngrest\base\Whether

The current item is a composite key or not.

                public function getIsCompositeItem()
{
    return count($this->getItemIds()) > 1 ? true : false;
}

            
getItemId() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getItemId()

Get the item id of the current ActiveWindow context item id.

public integer|array getItemId ( )
return integer|array

If its a composite key an array is returned, otherwise the integer number for the PK.

                public function getItemId()
{
    return $this->getIsCompositeItem() ? $this->getItemIds() : $this->getItemIds()[0];
}

            
getItemIds() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getItemIds()

Returns an array with all items if its a composite key.

public array getItemIds ( )

                public function getItemIds()
{
    if (empty($this->_itemId)) {
        throw new InvalidCallException("Unable to determine the active window item id.");
    }
    return explode(",", $this->_itemId);
}

            
getLabel() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getLabel()

Return the current label defined for this Active Window.

public string getLabel ( )
return string

Returns the label of the active window, keep in mind this value has not model context.

                public function getLabel()
{
    return empty($this->_label) ? $this->defaultLabel() : $this->_label;
}

            
getModel() public method

Get the model object from where the Active Window is attached to.

public luya\admin\ngrest\base\NgRestModel getModel ( )
return luya\admin\ngrest\base\NgRestModel

Get the model of the called ngrest model ActiveRecord by it's itemId.

                public function getModel()
{
    $model = parent::getModel();
    if (!$model instanceof FlowActiveWindowInterface) {
        throw new InvalidConfigException("The model ".$this->model->className()."which attaches the FlowActiveWindow must be an instance of luya\admin\aws\FlowActiveWindowInterface.");
    }
    return $model;
}

            
getName() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getName()

Get the ActiveWindow name based on its class short name.

public string getName ( )

                public function getName()
{
    if ($this->_name === null) {
        $this->_name = ((new \ReflectionClass($this))->getShortName());
    }
    return $this->_name;
}

            
getPermissionLevel() public method (available since version 4.0.0)

Defined in: luya\admin\ngrest\base\ActiveWindow::getPermissionLevel()

Get the button displaying permission level or empty of not set

public void getPermissionLevel ( )

                public function getPermissionLevel()
{
    return $this->_permissionLevel;
}

            
getTempFolder() protected method

protected void getTempFolder ( )

                protected function getTempFolder()
{
    $folder = Yii::getAlias('@runtime/flow-cache');
    if (!file_exists($folder)) {
        FileHelper::createDirectory($folder, 0777);
    }
    return $folder;
}

            
getTitle() public method (available since version 1.2.2)

Defined in: luya\admin\ngrest\base\ActiveWindow::getTitle()

By default the title just returns the {{getLabel()}} value if not overriden.

In getTitle() its allowed to access the model context, which is not allowed in {{getLabel()}}.

Display the username as title could look like this:

public function getTitle()
{
    return $this->model->username;
}
public string getTitle ( )
return string

Returns the title string which can have model context.

                public function getTitle()
{
    return $this->getLabel();
}

            
getUploadFolder() protected method

protected void getUploadFolder ( )

                protected function getUploadFolder()
{
    $folder = Yii::getAlias('@runtime/flow-upload');
    if (!file_exists($folder)) {
        FileHelper::createDirectory($folder, 0777);
    }
    return $folder;
}

            
getView() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getView()

Get the view object to render templates.

public luya\admin\ngrest\base\ActiveWindowView getView ( )

                public function getView()
{
    if ($this->_view === null) {
        $this->_view = new ActiveWindowView();
    }
    return $this->_view;
}

            
getViewFolderName() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getViewFolderName()

Get the folder name where the views for this ActiveWindow should be stored.

public string getViewFolderName ( )

                public function getViewFolderName()
{
    if ($this->_viewFolderName === null) {
        $name = $this->getName();
        if (StringHelper::endsWith($name, $this->suffix, false)) {
            $name = substr($name, 0, -(strlen($this->suffix)));
        }
        $this->_viewFolderName = strtolower($name);
    }
    return $this->_viewFolderName;
}

            
getViewPath() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::getViewPath()

Return the view path for view context.

{@inheritDoc}

See also yii\base\ViewContextInterface::getViewPath().

public void getViewPath ( )

                public function getViewPath()
{
    $module = $this->module;
    if (substr($module, 0, 1) !== '@') {
        $module = '@'.$module;
    }
    return implode(DIRECTORY_SEPARATOR, [Yii::getAlias($module), 'views', 'aws', $this->getViewFolderName()]);
}

            
hasMethod() public method

Defined in: yii\base\BaseObject::hasMethod()

Returns a value indicating whether a method is defined.

The default implementation is a call to php function method_exists(). You may override this method when you implemented the php magic method __call().

public boolean hasMethod ( $name )
$name string

The method name

return boolean

Whether the method is defined

                public function hasMethod($name)
{
    return method_exists($this, $name);
}

            
hasProperty() public method

Defined in: yii\base\BaseObject::hasProperty()

Returns a value indicating whether a property is defined.

A property is defined if:

  • the class has a getter or setter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);

See also:

public boolean hasProperty ( $name, $checkVars true )
$name string

The property name

$checkVars boolean

Whether to treat member variables as properties

return boolean

Whether the property is defined

                public function hasProperty($name, $checkVars = true)
{
    return $this->canGetProperty($name, $checkVars) || $this->canSetProperty($name, false);
}

            
index() public method

The default action which is going to be requested when clicking the active window.

public string index ( )
return string

The response string, render and displayed trough the angular ajax request.

                public function index()
{
    return $this->render('index');
}

            
init() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::init()

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

public void init ( )

                public function init()
{
    parent::init();
    if ($this->module === null) {
        throw new Exception('The ActiveWindow property \'module\' of '.static::class.' can not be null. You have to defined the module in where the ActiveWindow is defined. For example `public $module = \'@admin\';`');
    }
}

            
render() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::render()

Render a template with its name and params based on the view folder path.

public string render ( $name, array $params = [] )
$name string

The view file to render

$params array

Optional params to assign into the view

                public function render($name, array $params = [])
{
    return $this->getView()->render($name, $params, $this);
}

            
sendError() public method

Defined in: luya\admin\ngrest\base\BaseActiveResponse::sendError()

Send an error message as response.

Events are only triggered on success messages {{sendSuccess()}}.

public array sendError ( $message, array $additionalResponseData = [] )
$message string

The error message.

$additionalResponseData array

Data which should be added to the xhr response.

return array

An array with success, error, message, responseData and events.

                public function sendError($message, array $additionalResponseData = [])
{
    Yii::$app->response->setStatusCode(422, 'Data Validation Failed.');
    return [
        'success' => false,
        'error' => true,
        'message' => $message,
        'responseData' => $additionalResponseData,
        'events' => $this->_events,
    ];
}

            
sendReloadEvent() public method

Defined in: luya\admin\ngrest\base\BaseActiveResponse::sendReloadEvent()

Send a CRUD reload event.

public void sendReloadEvent ( )

                public function sendReloadEvent()
{
    $this->_events[] = self::EVENT_RELOAD_LIST;
}

            
sendSuccess() public method

Defined in: luya\admin\ngrest\base\BaseActiveResponse::sendSuccess()

Send a success message.

public array sendSuccess ( $message, array $additionalResponseData = [] )
$message string

The sucess message.

$additionalResponseData array

Data which should be added to the xhr response.

return array

An array with success, error, message, responseData and events.

                public function sendSuccess($message, array $additionalResponseData = [])
{
    return [
        'success' => true,
        'error' => false,
        'message' => $message,
        'responseData' => $additionalResponseData,
        'events' => $this->_events,
    ];
}

            
setActiveWindowHash() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::setActiveWindowHash()

Set the hash of the current active window which is calculated by the ActiveWindow.

Setting the hash happens in the {{luya\admin\ngrest\render\RenderActiveWindow::render}} method.

public void setActiveWindowHash ( $hash )
$hash string

                public function setActiveWindowHash($hash)
{
    $this->_activeWindowHash = $hash;
}

            
setCondition() public method (available since version 4.0.0)

Defined in: luya\admin\ngrest\base\ActiveWindow::setCondition()

Setter method for the button ng-show condition

public void setCondition ( $condition )
$condition string

                public function setCondition($condition)
{
    $this->_condition = $condition;
}

            
setConfigHash() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::setConfigHash()

Set the current configratuion hash name to the ActiveWindow.

Setting the hash happens in the {{luya\admin\ngrest\render\RenderActiveWindow::render}} method.

public void setConfigHash ( $hash )
$hash string

The hash name of the current active config.

                public function setConfigHash($hash)
{
    $this->_configHash = $hash;
}

            
setIcon() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::setIcon()

Setter method for the icon

public void setIcon ( $icon )
$icon string

                public function setIcon($icon)
{
    $this->_icon = $icon;
}

            
setItemId() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::setItemId()

Set the value of the item Id in where the active window context is initialized.

public void setItemId ( $id )
$id integer

The item id context

                public function setItemId($id)
{
    $this->_itemId = $id;
}

            
setLabel() public method

Defined in: luya\admin\ngrest\base\ActiveWindow::setLabel()

Setter method for the Label.

public void setLabel ( $label )
$label string

The active window label.

                public function setLabel($label)
{
    $this->_label = $label;
}

            
setPermissionLevel() public method (available since version 4.0.0)

Defined in: luya\admin\ngrest\base\ActiveWindow::setPermissionLevel()

Setter method for the ActiveWindow button displaying permission level

public void setPermissionLevel ( $permissionLevel )
$permissionLevel integer

                public function setPermissionLevel($permissionLevel)
{
    $this->_permissionLevel = (int) $permissionLevel;
}