コード例 #1
0
 /**
  * Get all dashabord items for a given node.
  *
  * @param integer $nodeId The id of the node to find all items from.
  * @return array
  */
 public function actionDashboard($nodeId)
 {
     $data = Yii::$app->adminmenu->getNodeData($nodeId);
     $accessList = [];
     // verify if no permissions has ben seet for this know or no groups are available trough permissions issues.
     if (!isset($data['groups'])) {
         return [];
     }
     foreach ($data['groups'] as $groupkey => $groupvalue) {
         foreach ($groupvalue['items'] as $row) {
             if ($row['permissionIsApi']) {
                 try {
                     $row['alias'] = Yii::t($data['moduleId'], $row['alias'], [], Yii::$app->luyaLanguage);
                 } catch (\Exception $e) {
                 }
                 // @todo check if the user can access this api, otherwise hide this log informations?
                 $accessList[] = $row;
             }
         }
     }
     $log = [];
     foreach ($accessList as $access) {
         $data = (new \yii\db\Query())->select(['timestamp_create', 'user_id', 'admin_ngrest_log.id', 'is_update', 'is_insert', 'admin_user.firstname', 'admin_user.lastname'])->from('admin_ngrest_log')->leftJoin('admin_user', 'admin_ngrest_log.user_id = admin_user.id')->orderBy('timestamp_create DESC')->limit(30)->where('api=:api and user_id!=0', [':api' => $access['permssionApiEndpoint']])->all();
         foreach ($data as $row) {
             $date = mktime(0, 0, 0, date('n', $row['timestamp_create']), date('j', $row['timestamp_create']), date('Y', $row['timestamp_create']));
             $log[$date][] = ['name' => $row['firstname'] . ' ' . $row['lastname'], 'is_update' => $row['is_update'], 'is_insert' => $row['is_insert'], 'timestamp' => $row['timestamp_create'], 'alias' => $access['alias'], 'message' => $row['is_update'] ? Module::t('dashboard_log_message_edit', ['container' => $access['alias']]) : Module::t('dashboard_log_message_add', ['container' => $access['alias']]), 'icon' => $access['icon']];
         }
     }
     $array = [];
     krsort($log, SORT_NUMERIC);
     foreach ($log as $day => $values) {
         $array[] = ['day' => $day, 'items' => $values];
     }
     return $array;
 }
コード例 #2
0
 public function colorizeValue($value, $displayValue = false)
 {
     $text = $displayValue ? $value : Module::t('debug_state_on');
     if ($value) {
         return '<span style="color:green;">' . $text . '</span>';
     }
     return '<span style="color:red;">' . Module::t('debug_state_off') . '</span>';
 }
コード例 #3
0
ファイル: Group.php プロジェクト: luyadev/luya-module-admin
 public function ngRestConfig($config)
 {
     // load active window to config
     $config->aw->load(['class' => GroupAuth::className(), 'alias' => Module::t('model_group_btn_aws_groupauth')]);
     // define config
     $this->ngRestConfigDefine($config, 'list', ['name', 'text']);
     $this->ngRestConfigDefine($config, 'create', ['name', 'text', 'users']);
     $this->ngRestConfigDefine($config, 'update', ['name', 'text', 'users']);
     // add ability to delete items
     $config->delete = true;
     return $config;
 }
コード例 #4
0
 /**
  * The method which is going to change the password on the current model.
  *
  * The implementation of this must make sure if the $newPassword and $newPasswordRepetition are equals!
  *
  * @param string $newPassword The new password which must be set.
  * @param string $newPasswordRepetition The repeation in order to check whether does inputs are equal or not.
  * @throws \luya\Exception
  */
 public function callbackSave($newpass, $newpasswd)
 {
     if (!$this->model || !$this->model instanceof ChangePasswordInterface) {
         throw new Exception("Unable to find related model object or the model does not implemented the \\luya\\admin\\aws\\ChangePasswordInterface.");
     }
     if (strlen($newpass) < $this->minCharLength) {
         return $this->sendError(Module::t('aws_changeapssword_minchar', ['min' => $this->minCharLength]));
     }
     if ($newpass !== $newpasswd) {
         return $this->sendError(Module::t('aws_changepassword_notequal'));
     }
     if ($this->model->changePassword($newpass, $newpasswd)) {
         return $this->sendSuccess(Module::t('aws_changepassword_succes'));
     }
     return $this->sendError(current($this->model->getFirstError()));
 }
コード例 #5
0
 public function actionAsyncToken()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $model = new LoginForm();
     // see if values are sent via post
     if (Yii::$app->request->post('secure_token', false)) {
         $user = $model->validateSecureToken(Yii::$app->request->post('secure_token'), Yii::$app->session->get('secureId'));
         if ($user) {
             if (Yii::$app->adminuser->login($user)) {
                 Yii::$app->session->remove('secureId');
                 return ['refresh' => true, 'message' => 'top!'];
             } else {
                 // misc error while login ?!
             }
         } else {
             return ['errors' => Module::t('login_async_token_error'), 'refresh' => false];
         }
     }
     return ['errors' => Module::t('login_async_token_globalerror'), 'refresh' => false];
 }
コード例 #6
0
ファイル: crud.php プロジェクト: luyadev/luya-module-admin
                    <!-- /MODAL CONTENT -->

                    <!-- MODAL FOOTER -->
                    <div class="modal__footer">
                        <div class="row">
                            <div class="col s12">
                                <div class="right">
                                    <button class="btn waves-effect waves-light" type="submit" ng-disabled="updateForm.$invalid">
                                        <?php 
    echo Module::t('button_save');
    ?>
 <i class="material-icons right">check</i>
                                    </button>
                                    <button class="btn waves-effect waves-light red" type="button" ng-click="closeUpdate()">
                                        <i class="material-icons left">cancel</i> <?php 
    echo Module::t('button_abort');
    ?>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /MODAL FOOTER -->
                </form>
            <?php 
}
?>
        </div>

    </div>
    
コード例 #7
0
 /**
  * Upload a new file from $_FILES array.
  *
  * @return array An array with upload and message key.
  */
 public function actionFilesUpload()
 {
     foreach ($_FILES as $k => $file) {
         if ($file['error'] !== UPLOAD_ERR_OK) {
             return ['upload' => false, 'message' => Storage::getUploadErrorMessage($file['error'])];
         }
         try {
             $response = Yii::$app->storage->addFile($file['tmp_name'], $file['name'], Yii::$app->request->post('folderId', 0));
             if ($response) {
                 return ['upload' => true, 'message' => Module::t('api_storage_file_upload_succes')];
             } else {
                 return ['upload' => false, 'message', 'Error while storing your image in the storage component.'];
             }
         } catch (Exception $err) {
             return ['upload' => false, 'message' => Module::t('api_sotrage_file_upload_error', ['error' => $err->getMessage()])];
         }
     }
     return ['upload' => false, 'message' => Module::t('api_sotrage_file_upload_empty_error')];
 }
コード例 #8
0
 public function sendSecureLogin()
 {
     $token = $this->getUser()->getAndStoreToken();
     Yii::$app->mail->compose(Module::t('login_securetoken_mail_subject'), Module::t('login_securetoken_mail', ['url' => Url::base(true), 'token' => $token]))->address($this->getUser()->email)->send();
     return true;
 }
コード例 #9
0
ファイル: update.php プロジェクト: luyadev/luya-module-cms
                                            </div>

                                            <div class="modal__footer">
                                                <div class="row">
                                                    <div class="col s12">
                                                        <div class="right">
                                                            <button class="btn" type="submit" ng-click="createNewVersionSubmit(create)">
                                                                <?php 
echo Module::t('button_create_version');
?>
 <i class="material-icons right">check</i>
                                                            </button>
                                                            <button class="btn red" type="button" ng-click="closeCreateModal()">
                                                                <i class="material-icons left">cancel</i> <?php 
echo \luya\admin\Module::t('button_abort');
?>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                        </modal>
                                        <!-- /Add version modal -->

                                    </div>
                                    <!-- /Versions -->

                                    <div ng-show="container.length == 0" class="page__no-version-warning alert alert--warning alert--icon-no-margin">
コード例 #10
0
ファイル: index.php プロジェクト: luyadev/luya-module-cms
?>
</p>
            <menu-dropdown class="menu-dropdown" nav-id="data.redirect_type_value" />
        </div>

        <div class="col s12" ng-show="data.redirect_type==2">

            <div class="input input--text col s12">
                <label class="input__label"><?php 
echo \luya\admin\Module::t('view_index_redirect_external_link');
?>
</label>
                <div class="input__field-wrapper">
                    <input name="text" type="text" class="input__field" ng-model="data.redirect_type_value" placeholder="http://" />
                    <small><?php 
echo \luya\admin\Module::t('view_index_redirect_external_link_help');
?>
</small>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col s12">
            <br />
            <button type="button" class="btn" ng-click="save()"><?php 
echo \luya\cms\admin\Module::t('view_index_page_btn_save');
?>
</button>
        </div>
コード例 #11
0
ファイル: index.php プロジェクト: luyadev/luya-module-admin
                <div class="input input--text">
                    <label class="input__label" for="searchString"><?php 
echo Module::t('aws_tag_search');
?>
:</label>
                    <div class="input__field-wrapper">
                        <input id="searchString" maxlength="255" ng-model="searchString" type="text" class="input__field" />
                    </div>
                </div>

                <br />

                <div class="input input--multiple-checkboxes">
                    <label class="input__label"><?php 
echo Module::t('aws_tag_list');
?>
:</label>
                    <div class="input__field-wrapper input--column">
                        <div ng-repeat="tag in tags | filter:searchString | orderBy:'name'" class="checkbox-column-fix">
                            <input type="checkbox" ng-model="relation[tag.id]" ng-checked="relation[tag.id] == 1" ng-true-value="1" ng-false-value="0">
                            <label ng-click="saveRelation(tag, relation[tag.id])">{{tag.name}}</label>
                        </div>
                    </div>
                </div>


                <br />
            </div>
        </div>
    </div>
コード例 #12
0
ファイル: index.php プロジェクト: luyadev/luya-module-admin
?>
</th>
                    <th><?php 
echo Module::t('aws_groupauth_th_add');
?>
</th>
                    <th><?php 
echo Module::t('aws_groupauth_th_edit');
?>
</th>
                    <th><?php 
echo Module::t('aws_groupauth_th_remove');
?>
</th>
                </tr>
            </thead>
            <tr ng-repeat="a in auths">
                <td><span ng-show="a.is_head==1">{{ a.group_alias }}</span></td>
                <td><input id="{{a.id}}_base" type="checkbox" ng-model="rights[a.id].base" ng-true-value="1" ng-false-value="0" /><label for="{{a.id}}_base">{{ a.alias_name}}</label></td>
                <td ng-show="a.is_crud==1"><input id="{{a.id}}_create" type="checkbox" ng-model="rights[a.id].create" ng-true-value="1" ng-false-value="0" /><label for="{{a.id}}_create"></label></td>
                <td ng-show="a.is_crud==1"><input id="{{a.id}}_update" type="checkbox" ng-model="rights[a.id].update" ng-true-value="1" ng-false-value="0" /><label for="{{a.id}}_update"></label></td>
                <td ng-show="a.is_crud==1"><input id="{{a.id}}_delete" type="checkbox" ng-model="rights[a.id].delete" ng-true-value="1" ng-false-value="0" /><label for="{{a.id}}_delete"></label></td>
            </tr>
        </table>
    </form>
    
    <button type="button" ng-click="save(rights)" class="btn btn-flat"><?php 
echo Module::t('button_save');
?>
</button>
</div>
コード例 #13
0
ファイル: index.php プロジェクト: luyadev/luya-module-admin
<?php

use luya\admin\Module;
use luya\admin\ngrest\aw\CallbackFormWidget;
/**
 * @var $this \luya\admin\ngrest\base\ActiveWindowView
 * @var $form luya\admin\ngrest\aw\CallbackFormWidget
 */
?>
<div>
    <p><?php 
echo Module::t('aws_changepassword_info');
?>
</p>

    <?php 
$form = CallbackFormWidget::begin(['callback' => 'save', 'buttonValue' => Module::t('button_save')]);
?>
    
    <?php 
echo $form->field('newpass', Module::t('aws_changepassword_new_pass'))->passwordInput();
?>
    <?php 
echo $form->field('newpasswd', Module::t('aws_changepassword_new_pass_retry'))->passwordInput();
?>
    
    <?php 
$form::end();
?>
</div>
コード例 #14
0
ファイル: User.php プロジェクト: luyadev/luya-module-admin
 public function attributeLabels()
 {
     return ['title' => Module::t('mode_user_title'), 'firstname' => Module::t('mode_user_firstname'), 'lastname' => Module::t('mode_user_lastname'), 'email' => Module::t('mode_user_email'), 'password' => Module::t('mode_user_password')];
 }
コード例 #15
0
ファイル: index.php プロジェクト: luyadev/luya-module-admin
<?php

use luya\admin\Module;
?>
<div ng-controller="ActiveWindowGalleryController">
    <div class="col s8">
    	<storage-file-manager selection="true" only-images="true" />
    </div>
    <div class="col s4" style="background-color:#F0F0F0;">
        <div style="padding:10px;">
            <h5><?php 
echo Module::t('aws_gallery_images');
?>
</h5>
            <div ng-show="isEmptyObject(files)">
                <p><?php 
echo Module::t('aws_gallery_empty');
?>
</p>
            </div>
            <div class="col s3" ng-repeat="file in files">
                <div class="aws-gallery__image-wrapper">
                    <div class="aws-gallery__image-index">{{ $index+1 }}</div>
                    <img class="aws-gallery__image" ng-src="{{file.source}}" height="auto" width="100%" />
                    <button class="aws-gallery__image-btn" type="button" ng-click="remove(file)"><i class="material-icons">delete</i></button>
                </div>
            </div>
        </div>
    </div>
</div>
コード例 #16
0
ファイル: main.php プロジェクト: luyadev/luya-module-admin
    echo $name;
    ?>
<a class="secondary-content"><i class="material-icons">content_paste</i></a></div>
                        </li>
                    <?php 
}
?>
                    </ul>
                  </div>
                </li>
                <li>
                  <div class="collapsible-header" ng-click="supportOpen=!supportOpen"><i class="material-icons">whatshot</i><?php 
echo Admin::t('right_panel_support_support_title');
?>
</div>
                  <div class="collapsible-body" ng-show="supportOpen" style="display:block;"><p><?php 
echo Admin::t('right_panel_support_support_text');
?>
</p></div>
                </li>
             </ul>
        </div>
    </div>
</div> <!-- /.luya-container -->
<?php 
$this->endBody();
?>
</body>
</html>
<?php 
$this->endPage();
コード例 #17
0
<div style="padding:50px; margin:50px; text-align:center; background-color:#F0F0F0;">
	<h1><?php 
echo \luya\admin\Module::t('dashboard_title');
?>
</h1>
    <p><?php 
echo \luya\admin\Module::t('dashboard_text');
?>
</p>
</div>