public function coreMenu() { return ['admin' => ['label' => 'Администрирование', 'roles' => UserRole::ADMIN, 'items' => [['label' => 'Пользователи', 'url' => ["/{$this->id}/{$this->id}-admin/index"], 'urlRule' => 'admin/profiles']]], ['label' => 'Мой профиль', 'url' => ["/{$this->id}/{$this->id}/view", 'userUid' => MenuHelper::paramUser('uid')], 'urlRule' => 'profile', 'roles' => '@', 'items' => [['label' => 'Редактирование профиля', 'url' => ["/{$this->id}/{$this->id}-edit/index", 'userUid' => MenuHelper::paramUser('uid')], 'urlRule' => 'profile/edit', 'items' => [['label' => 'Основные', 'url' => ["/{$this->id}/{$this->id}-edit/index", 'userUid' => MenuHelper::paramUser('uid')], 'urlRule' => 'profile/edit'], ['label' => 'Пароль', 'url' => ["/{$this->id}/{$this->id}-edit/password", 'userUid' => MenuHelper::paramUser('uid')], 'urlRule' => 'profile/edit/password']]]]], ['label' => 'Профиль', 'url' => ["/{$this->id}/{$this->id}/view", 'userUid' => MenuHelper::paramGet('userUid')], 'urlRule' => 'profile/<userUid>', 'visible' => false, 'roles' => '@', 'items' => [['label' => 'Редактирование профиля', 'url' => ["/{$this->id}/{$this->id}-edit/index", 'userUid' => MenuHelper::paramGet('userUid')], 'urlRule' => 'profile/<userUid>/edit', 'items' => [['label' => 'Основные', 'url' => ["/{$this->id}/{$this->id}-edit/index", 'userUid' => MenuHelper::paramGet('userUid')], 'urlRule' => 'profile/<userUid>/edit']]]]]]; }
public static function coreMenuItem() { return ['label' => 'Страницы', 'urlRule' => '/', 'visible' => false, 'items' => [['label' => 'Просмотр', 'url' => ["/content/page/page-view", 'name' => MenuHelper::paramGet('name')]]]]; }
public static function coreMenuItem() { return ['label' => 'Страницы', 'url' => ["/content/page-admin/index"], 'items' => [['label' => 'Страницы', 'url' => ["/content/page-admin/index"], 'urlRule' => 'admin/pages'], ['label' => 'Добавление', 'url' => ["/content/page-admin/create"], 'urlRule' => 'admin/pages/update'], ['label' => 'Редактирование', 'url' => ["/content/page-admin/update", 'uid' => MenuHelper::paramGet('uid')], 'urlRule' => 'admin/pages/update/<uid>']]]; }
public static function coreMenuItem() { return ['label' => 'Тексты', 'url' => ["/content/text-section-admin/index"], 'items' => [['label' => 'Тексты', 'url' => ["/content/text-section-admin/index"], 'urlRule' => 'admin/content/texts'], ['label' => 'Добавление', 'url' => ["/content/text-section-admin/update"], 'urlRule' => 'admin/content/texts/add'], ['label' => 'Редактирование', 'url' => ["/content/text-section-admin/update", 'uid' => MenuHelper::paramGet('uid')], 'urlRule' => 'admin/content/texts/update/<uid>']]]; }
public static function coreMenuItem() { return array_map(function ($type) { return ['label' => ContentType::getLabel($type), 'url' => ["/content/article-admin/index", 'type' => $type], 'items' => [['label' => ContentType::getLabel($type), 'url' => ["/content/article-admin/index", 'type' => $type], 'urlRule' => "admin/{$type}"], ['label' => 'Добавление', 'url' => ["/content/article-admin/update", 'type' => $type], 'urlRule' => "admin/{$type}/add"], ['label' => 'Редактирование', 'url' => ["/content/article-admin/update", 'type' => $type, 'uid' => MenuHelper::paramGet('uid')], 'urlRule' => "admin/{$type}/update/<uid>"]]]; }, ContentType::getKeys()); }
public static function coreMenuItem() { return array_map(function ($type) { return ['label' => ContentType::getLabel($type), 'url' => ["/content/article/index", 'type' => $type], 'urlRule' => $type, 'items' => [['label' => 'Просмотр', 'url' => ["/content/article/view", 'type' => $type, 'uid' => MenuHelper::paramGet('uid')], 'urlRule' => "{$type}/<uid>"]]]; }, ContentType::getKeys()); }
public function coreMenu() { return [['label' => \Yii::t('app', 'Регистрация'), 'url' => ["/{$this->id}/auth/registration"], 'urlRule' => 'registration', 'roles' => '?', 'items' => [['label' => \Yii::t('app', 'Пользовательское соглашение'), 'url' => ["/{$this->id}/auth/agreement"], 'urlRule' => 'registration/agreement']], 'order' => 95], ['label' => \Yii::t('app', 'Вход'), 'url' => ["/{$this->id}/auth/login"], 'urlRule' => 'login', 'roles' => '?', 'items' => [['label' => \Yii::t('app', 'Восстановление пароля'), 'url' => ["/{$this->id}/recovery/index"], 'urlRule' => 'login/recovery', 'items' => [['url' => ["/{$this->id}/recovery/captcha"], 'urlRule' => 'login/recovery/captcha'], ['label' => \Yii::t('app', 'Проверочный код'), 'url' => ["/{$this->id}/recovery/code"], 'urlRule' => 'login/recovery/<code>']]]], 'order' => 100], ['label' => \Yii::t('app', 'Выход ({name})', ['name' => MenuHelper::paramUser('name')]), 'url' => ["/{$this->id}/auth/logout"], 'urlRule' => 'logout', 'linkOptions' => ['data-method' => 'post'], 'roles' => '@', 'order' => 100]]; }
/** * @param string|array|MegaMenuItem $url1 * @param string|array $url2 * @return bool */ public function isUrlEquals($url1, $url2) { if ($url1 instanceof MegaMenuItem) { $url1 = $url1->url; } if ($url2 instanceof MegaMenuItem) { $url2 = $url2->url; } // Is routes if ($this->isRoute($url1) && $this->isRoute($url2)) { if (MenuHelper::normalizeRoute($url1[0]) !== MenuHelper::normalizeRoute($url2[0])) { return false; } // Compare routes' parameters by checking if keys are identical if (count(array_diff_key($url1, $url2)) || count(array_diff_key($url2, $url1))) { return false; } foreach ($url1 as $key => $value) { if (is_string($key) && $key !== '#') { if (!array_key_exists($key, $url2)) { return false; } if ($value !== null && $url2[$key] !== null && $url2[$key] !== $value) { return false; } } } return true; } // Is urls if (is_string($url1) && is_string($url2)) { return $url1 === $url2; } return false; }