aimeos /
ai-admin-jqadm
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
||
| 5 | * @copyright Aimeos (aimeos.org), 2016-2025 |
||
| 6 | */ |
||
| 7 | |||
| 8 | $enc = $this->encoder(); |
||
| 9 | |||
| 10 | |||
| 11 | /** admin/jsonadm/url/options/target |
||
| 12 | * Destination of the URL where the controller specified in the URL is known |
||
| 13 | * |
||
| 14 | * The destination can be a page ID like in a content management system or the |
||
| 15 | * module of a software development framework. This "target" must contain or know |
||
| 16 | * the controller that should be called by the generated URL. |
||
| 17 | * |
||
| 18 | * @param string Destination of the URL |
||
| 19 | * @since 2016.04 |
||
| 20 | * @see admin/jsonadm/url/options/controller |
||
| 21 | * @see admin/jsonadm/url/options/action |
||
| 22 | * @see admin/jsonadm/url/options/config |
||
| 23 | */ |
||
| 24 | |||
| 25 | /** admin/jsonadm/url/options/controller |
||
| 26 | * Name of the controller whose action should be called |
||
| 27 | * |
||
| 28 | * In Model-View-Controller (MVC) applications, the controller contains the methods |
||
| 29 | * that create parts of the output displayed in the generated HTML page. Controller |
||
| 30 | * names are usually alpha-numeric. |
||
| 31 | * |
||
| 32 | * @param string Name of the controller |
||
| 33 | * @since 2016.04 |
||
| 34 | * @see admin/jsonadm/url/options/target |
||
| 35 | * @see admin/jsonadm/url/options/action |
||
| 36 | * @see admin/jsonadm/url/options/config |
||
| 37 | */ |
||
| 38 | |||
| 39 | /** admin/jsonadm/url/options/action |
||
| 40 | * Name of the action that should create the output |
||
| 41 | * |
||
| 42 | * In Model-View-Controller (MVC) applications, actions are the methods of a |
||
| 43 | * controller that create parts of the output displayed in the generated HTML page. |
||
| 44 | * Action names are usually alpha-numeric. |
||
| 45 | * |
||
| 46 | * @param string Name of the action |
||
| 47 | * @since 2016.04 |
||
| 48 | * @see admin/jsonadm/url/options/target |
||
| 49 | * @see admin/jsonadm/url/options/controller |
||
| 50 | * @see admin/jsonadm/url/options/config |
||
| 51 | */ |
||
| 52 | |||
| 53 | /** admin/jsonadm/url/options/config |
||
| 54 | * Associative list of configuration options used for generating the URL |
||
| 55 | * |
||
| 56 | * You can specify additional options as key/value pairs used when generating |
||
| 57 | * the URLs, like |
||
| 58 | * |
||
| 59 | * admin/jsonadm/url/options/config = array( 'absoluteUri' => true ) |
||
| 60 | * |
||
| 61 | * The available key/value pairs depend on the application that embeds the e-commerce |
||
| 62 | * framework. This is because the infrastructure of the application is used for |
||
| 63 | * generating the URLs. The full list of available config options is referenced |
||
| 64 | * in the "see also" section of this page. |
||
| 65 | * |
||
| 66 | * @param string Associative list of configuration options |
||
| 67 | * @since 2016.04 |
||
| 68 | * @see admin/jsonadm/url/options/target |
||
| 69 | * @see admin/jsonadm/url/options/controller |
||
| 70 | * @see admin/jsonadm/url/options/action |
||
| 71 | */ |
||
| 72 | |||
| 73 | |||
| 74 | /** admin/jqadm/navbar |
||
| 75 | * List of JQAdm client names shown in the navigation bar of the admin interface |
||
| 76 | * |
||
| 77 | * You can add, remove or reorder the links in the navigation bar by |
||
| 78 | * setting a new list of client resource names. |
||
| 79 | * In the configuration files of extensions, you should only add entries using |
||
| 80 | * one of these lines: |
||
| 81 | * |
||
| 82 | * 'myclient' => 'myclient', |
||
| 83 | * 'myclient-subclient' => 'myclient/subclient', |
||
| 84 | * |
||
| 85 | * The key of the new client must be unique in the extension configuration so |
||
| 86 | * it's not overwritten by other extensions. Don't use slashes in keys (/) |
||
| 87 | * because they are interpreted as keys of sub-arrays in the configuration. |
||
| 88 | * |
||
| 89 | * @param array List of resource client names |
||
| 90 | * @since 2017.10 |
||
| 91 | * @see admin/jqadm/navbar-limit |
||
| 92 | */ |
||
| 93 | $navlist = map( $this->config( 'admin/jqadm/navbar', [] ) )->ksort(); |
||
| 94 | |||
| 95 | foreach( $navlist as $key => $navitem ) |
||
| 96 | { |
||
| 97 | $name = is_array( $navitem ) ? ( $navitem['_'] ?? current( $navitem ) ) : $navitem; |
||
| 98 | |||
| 99 | if( !$this->access( $this->config( 'admin/jqadm/resource/' . $name . '/groups', [] ) ) ) { |
||
| 100 | $navlist->remove( $key ); |
||
| 101 | } |
||
| 102 | } |
||
| 103 | |||
| 104 | |||
| 105 | $resource = $this->param( 'resource', 'dashboard' ); |
||
| 106 | $site = $this->param( 'site', 'default' ); |
||
| 107 | $lang = $this->param( 'locale' ); |
||
| 108 | |||
| 109 | $params = ['resource' => $resource, 'site' => $site]; |
||
| 110 | $extParams = ['site' => $site]; |
||
| 111 | |||
| 112 | if( $lang ) { |
||
| 113 | $params['locale'] = $extParams['locale'] = $lang; |
||
| 114 | } |
||
| 115 | |||
| 116 | |||
| 117 | $pos = $navlist->pos( function( $item, $key ) use ( $resource ) { |
||
| 118 | return is_array( $item ) ? in_array( $resource, $item ) : !strncmp( $resource, $item, strlen( $item ) ); |
||
| 119 | } ); |
||
| 120 | $before = $pos > 0 ? $navlist->slice( $pos - 1, 1 )->first() : null; |
||
| 121 | $before = is_array( $before ) ? $before['_'] ?? reset( $before ) : $before; |
||
| 122 | $after = $pos < count( $navlist ) ? $navlist->slice( $pos + 1, 1 )->first() : null; |
||
| 123 | $after = is_array( $after ) ? $after['_'] ?? reset( $after ) : $after; |
||
| 124 | |||
| 125 | |||
| 126 | ?> |
||
| 127 | <div class="aimeos" lang="<?= $this->param( 'locale' ) ?>" |
||
| 128 | data-graphql="<?= $enc->attr( $this->link( 'admin/graphql/url', ['site' => $site, $this->csrf()->name() => $this->csrf()->value()] ) ) ?>" |
||
| 129 | data-url="<?= $enc->attr( $this->link( 'admin/jsonadm/url/options', array( 'site' => $site ) ) ) ?>" |
||
| 130 | data-user-siteid="<?= $enc->attr( $this->get( 'pageUserSiteid' ) ) ?>"> |
||
| 131 | |||
| 132 | <nav class="main-sidebar"> |
||
| 133 | <div class="sidebar-wrapper"> |
||
| 134 | |||
| 135 | <a class="logo" target="_blank" href="https://aimeos.org/update/?type=<?= $this->get( 'aimeosType' ) ?>&version=<?= $this->get( 'aimeosVersion' ) ?>"> |
||
| 136 | <img src="https://aimeos.org/check/?type=<?= $this->get( 'aimeosType' ) ?>&version=<?= $this->get( 'aimeosVersion' ) ?>&extensions=<?= $this->get( 'aimeosExtensions' ) ?>" alt="Aimeos update" title="Aimeos update"> |
||
| 137 | </a> |
||
| 138 | |||
| 139 | <ul class="sidebar-menu"> |
||
| 140 | |||
| 141 | <?php if( $this->access( $this->config( 'admin/jqadm/resource/site/groups', [] ) ) ) : ?> |
||
| 142 | |||
| 143 | <li class="none"></li> |
||
| 144 | <li class="treeview menuitem-site <?= $before === null ? 'before' : '' ?>"> |
||
| 145 | <a class="item-group" href="#"> |
||
| 146 | <i class="icon"></i> |
||
| 147 | <span class="title"><?= $enc->html( $this->site()->label() ) ?></span> |
||
| 148 | </a> |
||
| 149 | <div class="tree-menu-wrapper"> |
||
| 150 | <div class="menu-header"> |
||
| 151 | <a href="#"><?= $enc->html( $this->translate( 'admin', 'Site' ) ) ?></a> |
||
| 152 | <span class="close"></span> |
||
| 153 | </div> |
||
| 154 | <div class="menu-body vue"> |
||
| 155 | <tree |
||
| 156 | domain="locale/site" |
||
| 157 | placeholder="<?= $enc->attr( $this->translate( 'admin', 'Find site' ) ) ?>" |
||
| 158 | url="<?= $enc->attr( $this->link( 'admin/jqadm/url/search', ['site' => '_code_'] + $params ) ) ?>" |
||
| 159 | :readonly="true" |
||
| 160 | :rtl="rtl" |
||
| 161 | ></tree> |
||
| 162 | </div> |
||
| 163 | </div> |
||
| 164 | </li> |
||
| 165 | |||
| 166 | <?php else : ?> |
||
| 167 | |||
| 168 | <li class="none <?= $before === null ? 'before' : '' ?>"></li> |
||
| 169 | |||
| 170 | <?php endif ?> |
||
| 171 | |||
| 172 | <?php foreach( $navlist as $nav => $navitem ) : ?> |
||
| 173 | <?php if( is_array( $navitem ) ) : $nav = $navitem['_'] ?? current( $navitem ) ?> |
||
| 174 | |||
| 175 | <li class="treeview menuitem-<?= $enc->attr( $nav ) ?> <?= $nav === $before ? 'before' : '' ?> <?= in_array( $resource, $navitem ) !== false ? 'active' : '' ?> <?= $nav === $after ? 'after' : '' ?>"> |
||
| 176 | <span class="item-group"> |
||
| 177 | <i class="icon"></i> |
||
| 178 | <span class="title"><?= $enc->attr( $this->translate( 'admin', $nav ) ) ?></span> |
||
| 179 | </span> |
||
| 180 | <div class="tree-menu-wrapper"> |
||
| 181 | <div class="menu-header"> |
||
| 182 | <a href="#"><?= $enc->html( $this->translate( 'admin', $nav ) ) ?></a> |
||
| 183 | <span class="close"></span> |
||
| 184 | </div> |
||
| 185 | <ul class="tree-menu"> |
||
| 186 | |||
| 187 | <?php foreach( map( $navitem )->remove( '_' )->ksort() as $subresource ) : ?> |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 188 | <?php if( $this->access( $this->config( 'admin/jqadm/resource/' . $subresource . '/groups', [] ) ) ) : ?> |
||
| 189 | <?php $key = $this->config( 'admin/jqadm/resource/' . $subresource . '/key', '' ) ?> |
||
| 190 | |||
| 191 | <li class="menuitem-<?= str_replace( '/', '-', $subresource ) ?> <?= $subresource === $resource ? 'active' : '' ?>"> |
||
| 192 | <a class="item-group" href="<?= $enc->attr( $this->link( 'admin/jqadm/url/search', ['resource' => $subresource] + $params ) ) ?>" |
||
| 193 | title="<?= $enc->attr( sprintf( $this->translate( 'admin', '%1$s (Ctrl+Alt+%2$s)' ), $this->translate( 'admin', $subresource ), $key ) ) ?>" |
||
| 194 | data-ctrlkey="<?= $enc->attr( strtolower( $key ) ) ?>"> |
||
| 195 | <i class="icon"></i> |
||
| 196 | <span class="name"><?= $enc->html( $this->translate( 'admin', $subresource ) ) ?></span> |
||
| 197 | </a> |
||
| 198 | </li> |
||
| 199 | |||
| 200 | <?php endif ?> |
||
| 201 | <?php endforeach ?> |
||
| 202 | </ul> |
||
| 203 | </div> |
||
| 204 | </li> |
||
| 205 | |||
| 206 | <?php else : ?> |
||
| 207 | <?php $key = $this->config( 'admin/jqadm/resource/' . $navitem . '/key', '' ) ?> |
||
| 208 | |||
| 209 | <li class="menuitem-<?= $enc->attr( $navitem ) ?> <?= $navitem === $before ? 'before' : '' ?> <?= !strncmp( $resource, $navitem, strlen( $navitem ) ) ? 'active' : '' ?> <?= $navitem === $after ? 'after' : '' ?>"> |
||
| 210 | <a class="item-group" href="<?= $enc->attr( $this->link( 'admin/jqadm/url/search', ['resource' => $navitem] + $params ) ) ?>" |
||
| 211 | title="<?= $enc->attr( sprintf( $this->translate( 'admin', '%1$s (Ctrl+Alt+%2$s)' ), $this->translate( 'admin', $navitem ), $key ) ) ?>" |
||
| 212 | data-ctrlkey="<?= $enc->attr( strtolower( $key ) ) ?>"> |
||
| 213 | <i class="icon"></i> |
||
| 214 | <span class="title"><?= $enc->html( $this->translate( 'admin', $navitem ) ) ?></span> |
||
| 215 | </a> |
||
| 216 | </li> |
||
| 217 | |||
| 218 | <?php endif ?> |
||
| 219 | <?php endforeach ?> |
||
| 220 | |||
| 221 | <?php if( $this->access( $this->config( 'admin/jqadm/resource/language/groups', [] ) ) ) : ?> |
||
| 222 | |||
| 223 | <li class="treeview menuitem-language <?= $after === null ? 'after' : '' ?>"> |
||
| 224 | <span class="item-group"> |
||
| 225 | <i class="icon"></i> |
||
| 226 | <span class="title"><?= $enc->attr( $this->translate( 'language', $this->param( 'locale', $this->translate( 'admin', 'Language' ) ) ) ) ?></span> |
||
| 227 | </span> |
||
| 228 | <div class="tree-menu-wrapper"> |
||
| 229 | <div class="menu-header"> |
||
| 230 | <a href="#"><?= $enc->html( $this->translate( 'admin', 'Language' ) ) ?></a> |
||
| 231 | <span class="close"></span> |
||
| 232 | </div> |
||
| 233 | <ul class="tree-menu"> |
||
| 234 | <?php foreach( $this->get( 'pageI18nList', [] ) as $langid ) : ?> |
||
| 235 | <li class="menuitem-language-<?= $enc->attr( $langid ) ?>"> |
||
| 236 | <a href="<?= $enc->attr( $this->link( 'admin/jqadm/url/search', ['locale' => $langid] + $params ) ) ?>"> |
||
| 237 | <span class="name"><?= $enc->html( $this->translate( 'language', $langid ) ) ?> (<?= $langid ?>)</span> |
||
| 238 | </a> |
||
| 239 | </li> |
||
| 240 | <?php endforeach ?> |
||
| 241 | </ul> |
||
| 242 | </div> |
||
| 243 | </li> |
||
| 244 | |||
| 245 | <?php endif ?> |
||
| 246 | |||
| 247 | <li class="none"></li> |
||
| 248 | </ul> |
||
| 249 | |||
| 250 | </div> |
||
| 251 | </nav> |
||
| 252 | |||
| 253 | <main class="main-content"> |
||
| 254 | <?= $this->partial( $this->config( 'admin/jqadm/partial/info', 'info' ), [ |
||
| 255 | 'info' => array_merge( $this->get( 'pageInfo', [] ), $this->get( 'info', [] ) ), |
||
| 256 | 'error' => $this->get( 'errors', [] ) |
||
| 257 | ] ) ?> |
||
| 258 | |||
| 259 | <?= $this->block()->get( 'jqadm_content' ) ?> |
||
| 260 | </main> |
||
| 261 | |||
| 262 | <footer class="main-footer"> |
||
| 263 | <a href="https://github.com/aimeos/ai-admin-jqadm/issues" target="_blank"> |
||
| 264 | <?= $enc->html( $this->translate( 'admin', 'Bug or suggestion?' ) ) ?> |
||
| 265 | </a> |
||
| 266 | </footer> |
||
| 267 | |||
| 268 | <?= $this->partial( $this->config( 'admin/jqadm/partial/confirm', 'confirm' ) ) ?> |
||
| 269 | <?= $this->partial( $this->config( 'admin/jqadm/partial/problem', 'problem' ) ) ?> |
||
| 270 | |||
| 271 | </div> |
||
| 272 |