本文整理汇总了PHP中helpers\Url::assetPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::assetPath方法的具体用法?PHP Url::assetPath怎么用?PHP Url::assetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers\Url
的用法示例。
在下文中一共展示了Url::assetPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Edit Language
*/
public function edit($id)
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/languages_add.js');
$data['language'] = $this->model->getLanguage($id);
if (isset($_POST['update'])) {
$name = $_POST['name'];
$code = $_POST['code'];
$status = isset($_POST['status']) ? '1' : '0';
if ($name == '') {
$error[] = $this->language->get('name_required');
}
if ($code == '') {
$error[] = $this->language->get('code_required');
}
if (!$error) {
$data = array('name' => $name, 'code' => $code, 'status' => $status);
$where = array('id' => $id);
$this->model->updateLanguage($data, $where);
Session::set('success', $this->language->get('msg_language_edit'));
Log::notice('log_language_edit', 'id: ' . $id . ', name: ' . $name . ', code: ' . $code . ', status: ' . $status);
Url::redirect('languages');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('languages');
}
if (isset($_POST['delete'])) {
Url::redirect('languages/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('languages/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例2: index
/**
* Phone Book - default view
*/
public function index()
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/tables/datatables/datatables.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/responsive.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/buttons.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jszip/jszip.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/pdfmake/pdfmake.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/pdfmake/vfs_fonts.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/buttons.html5.min.js', Url::assetPath('js') . 'plugins/pickers/moment.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jquery.dataTables.yadcf.js', Url::assetPath('js') . 'pages/phonebook.js');
$data['users'] = $this->phonebook->getPhonebook();
View::renderTemplate('header', $data);
View::render('phonebook/index', $data, $error);
View::renderTemplate('footer', $data);
}
示例3: index
public function index()
{
if (!Auth::isLogged()) {
Url::redirect('login');
}
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/settings.js');
$settings = $this->setting->getSettings();
if (isset($settings)) {
foreach ($settings as $obj) {
$data[$obj->name] = $obj->value;
}
}
if (isset($_POST['update'])) {
$site_name = $_POST['site_name'];
$site_email = $_POST['site_email'];
$domains = $_POST['domains'];
if ($site_name == '') {
$error[] = $this->language->get('site_name_required');
}
if ($site_email == '') {
$error[] = $this->language->get('site_email_required');
}
if ($domains == '') {
$error[] = $this->language->get('domains_required');
}
if (!$error) {
foreach ($_POST as $key => $value) {
$data2 = array('value' => $value);
$where = array('name' => $key);
$log[$key] = $value;
if (!empty($value) && $data[$key] != $log[$key]) {
$this->setting->updateSettings($data2, $where);
Log::notice('log_settings_edit', json_encode(array($data2, $where)));
}
}
Session::set('success', $this->language->get('msg_settings_edit'));
Url::redirect('settings');
}
}
View::renderTemplate('header', $data);
View::render('settings/index', $data, $error);
View::renderTemplate('footer', $data);
}
示例4: edit
/**
* Edit Post
*/
public function edit($id)
{
if (!Auth::isLogged()) {
Url::redirect('login');
}
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/editors/summernote/summernote.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/forms/styling/uniform.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/blog_add.js');
$data['categories'] = $this->blog->getCategories();
$data['statuses'] = (object) array(0 => (object) array('id' => '0', 'name' => $this->language->get('draft')), 1 => (object) array('id' => '1', 'name' => $this->language->get('publish')));
$data['post'] = $this->blog->getPost($id);
if (isset($_POST['update'])) {
$title = $_POST['title'];
$status = $_POST['status'];
$content = $_POST['content'];
$category_id = $_POST['category'];
$user_id = $_SESSION['id'];
$schedule = isset($_POST['schedule']) ? '1' : '0';
if ($status == '1' && $schedule == '1') {
if (isset($_POST['published_at'])) {
$published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']);
} else {
$published_at = '';
}
} elseif ($status == '1' && $schedule == '0') {
$published_at = Date::convertLocalDateTimeToSQL($_POST['published_at'], $_SESSION['dateformat'] . ' ' . $_SESSION['timeformat']);
} else {
$published_at = '';
$schedule = '0';
}
if ($title == '') {
$error[] = $this->language->get('title_required');
}
if ($status == '') {
$error[] = $this->language->get('status_required');
}
if ($category_id == '') {
$error[] = $this->language->get('category_required');
}
if (!$error) {
$data = array('title' => $title, 'content' => $content, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL);
$where = array('id' => $id);
$data_log = array('id' => $id, 'title' => $title, 'status' => $status, 'category_id' => $category_id, 'user_id' => $user_id, 'schedule' => $schedule, 'published_at' => $published_at != '' ? $published_at : NULL);
$this->blog->updatePost($data, $where);
Session::set('success', $this->language->get('msg_blog_edit'));
Log::notice('log_blog_edit', $data_log);
Url::redirect('blog');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('blog');
}
View::renderTemplate('header', $data);
View::renderModule('Blog/views/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例5: assign
/**
* Assign Permissions
*/
public function assign($role_id)
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/forms/styling/switch.min.js', Url::assetPath('js') . 'plugins/extensions/quicksearch.js', Url::assetPath('js') . 'pages/roles_assign.js');
$data['role'] = $this->role->getRole($role_id);
$rolePermissions = $this->permission->getRolePermissions($role_id);
$data['permissions'] = $this->buildPermissionsTable($role_id, $rolePermissions);
if (isset($_POST['update'])) {
$permissions = $_POST['permission'];
$where = array('role_id' => $role_id);
$this->role->deletePermissionsForRole($where);
if (!empty($permissions)) {
foreach ($permissions as $permission) {
$permisions_ids .= $permission . ', ';
$data = array('permission_id' => $permission, 'role_id' => $role_id);
$this->role->insertPermissionsForRole($data);
}
}
$permisions_ids = substr($permisions_ids, 0, -2);
Session::set('success', $this->language->get('msg_role_assign'));
Log::notice('log_role_assign', 'role_id: ' . $role_id . ', permission_ids: ' . $permisions_ids);
Url::redirect('roles');
}
if (isset($_POST['cancel'])) {
Url::redirect('roles');
}
View::renderTemplate('header', $data);
View::render('roles/assign', $data, $error);
View::renderTemplate('footer', $data);
}
示例6: edit
/**
* Edit Office
*/
public function edit($id)
{
$data['title'] = $this->language->get('title_edit');
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/offices_add.js');
$data['office'] = $this->office->getOffice($id);
$data['offices'] = $this->office->getOffices();
$data['officesL18n'] = $this->office->getOfficeL18n($id);
$data['companies'] = $this->company->getCompanies();
if (isset($_POST['update'])) {
$name = $_POST['name'];
$address_1 = $_POST['address_1'];
$address_2 = $_POST['address_2'];
$city = $_POST['city'];
$country = $_POST['country'];
$post_code = $_POST['post_code'];
$state = $_POST['state'];
$company = $_POST['company'];
$status = isset($_POST['status']) ? '1' : '0';
if ($name == '') {
$error[] = $this->language->get('name_required');
}
if ($address_1 == '') {
$error[] = $this->language->get('address_1_required');
}
if ($city == '') {
$error[] = $this->language->get('city_required');
}
if ($country == '') {
$error[] = $this->language->get('country_required');
}
if ($company == '') {
$error[] = $this->language->get('company_required');
}
if (!$error) {
$data = array('status' => $status, 'company_id' => $company);
$where = array('id' => $id);
$this->office->updateOffice($data, $where);
$data_l18n = array('office_id' => $id, 'language_id' => Session::get('language_id'), 'name' => $name, 'address_1' => $address_1, 'address_2' => $address_2, 'city' => $city, 'post_code' => $post_code, 'country' => $country, 'state' => $state);
$this->office->updateOfficeL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$name_l18n = $_POST['name_' . $language->code];
$data_l18n = array('office_id' => $id, 'language_id' => $language->id, 'name' => $name, 'address_1' => $address_1, 'address_2' => $address_2, 'city' => $city, 'post_code' => $post_code, 'country' => $country, 'state' => $state);
$this->office->updateOfficeL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_office_edit'));
Log::notice('log_office_edit', 'id: ' . $office_id . ', address_1: ' . $address_1 . ', address_2: ' . $address_2 . ', city: ' . $city . ', post_code: ' . $post_code . ', country: ' . $country . ', state: ' . $state . ', status: ' . $status);
Url::redirect('offices');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('offices');
}
if (isset($_POST['delete'])) {
Url::redirect('offices/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('offices/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例7: edit
/**
* Edit Team
*/
public function edit($id)
{
$data['title'] = $this->language->get('title_edit');
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/teams_add.js');
$data['team'] = $this->team->getTeam($id);
$data['teams'] = $this->team->getTeams();
$data['teamsL18n'] = $this->team->getTeamL18n($id);
$data['departments'] = $this->department->getDepartments();
if (isset($_POST['update'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$department = $_POST['department'];
$status = isset($_POST['status']) ? '1' : '0';
if ($name == '') {
$error[] = $this->language->get('name_required');
}
if ($department == '') {
$error[] = $this->language->get('department_required');
}
if (!$error) {
$data = array('email' => $email, 'status' => $status, 'department_id' => $department);
$where = array('id' => $id);
$this->team->updateTeam($data, $where);
$data_l18n = array('team_id' => $id, 'language_id' => Session::get('language_id'), 'name' => $name);
$this->team->updateTeamL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$name_l18n = $_POST['name_' . $language->code];
$data_l18n = array('team_id' => $id, 'language_id' => $language->id, 'name' => $name_l18n);
$this->team->updateTeamL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_team_edit'));
Log::notice('log_team_edit', 'id: ' . $id . ', name: ' . $name . ', email: ' . $email . ', status: ' . $status);
Url::redirect('teams');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('teams');
}
if (isset($_POST['delete'])) {
Url::redirect('teams/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('teams/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例8: edit
/**
* Edit Company
*/
public function edit($id)
{
$data['title'] = $this->language->get('title_edit');
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/companies_add.js');
$data['company'] = $this->company->getCompany($id);
$data['companies'] = $this->company->getCompanies();
$data['companiesL18n'] = $this->company->getCompanyL18n($id);
if (isset($_POST['update'])) {
$description = $_POST['description'];
$name = $_POST['name'];
$status = isset($_POST['status']) ? '1' : '0';
if ($description == '') {
$error[] = $this->language->get('required');
}
if (!$error) {
$data = array('name' => $name, 'status' => $status);
$where = array('id' => $id);
$this->company->updateCompany($data, $where);
$data_l18n = array('company_id' => $id, 'language_id' => Session::get('language_id'), 'description' => $description);
$this->company->updateCompanyL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$description_l18n = $_POST['description_' . $language->code];
$data_l18n = array('company_id' => $id, 'language_id' => $language->id, 'description' => $description_l18n);
$this->company->updateCompanyL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_company_edit'));
Log::notice('log_company_edit', 'id: ' . $id . ', name: ' . $name . ', status: ' . $status);
Url::redirect('companies');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('companies');
}
if (isset($_POST['delete'])) {
Url::redirect('companies/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('companies/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例9: edit
/**
* Edit Navigation Item
*/
public function edit($menu_id, $id)
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/extensions/quicksearch.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/navigation_add.js');
$data['parent'] = $this->navigation->getNavigations();
$data['role'] = $this->role->getRoles();
$data['menu_id'] = $menu_id;
$data['navigation'] = $this->navigation->getNavigation($id);
$data['navigationL18n'] = $this->navigation->getNavigationL18n($id);
if (isset($_POST['save'])) {
$name = $_POST['name'];
$description = $_POST['description'];
$link = $_POST['link'];
$icon = $_POST['icon'];
if (empty($_POST['parent'])) {
$parent_id = $menu_id;
} else {
$parent_id = $_POST['parent'];
}
$role_id = $_POST['role'];
$status = isset($_POST['status']) ? '1' : '0';
if ($name == '') {
$error[] = $this->language->get('name_required');
}
if ($link == '') {
$error[] = $this->language->get('link_required');
}
if ($role_id == '') {
$error[] = $this->language->get('role_required');
}
if (!$error) {
$data = array('parent_id' => $parent_id, 'link' => $link, 'icon' => $icon, 'role_id' => $role_id, 'status' => $status);
$where = array('id' => $id);
$this->navigation->updateNavigation($data, $where);
$data_l18n = array('navigation_id' => $id, 'language_id' => Session::get('language_id'), 'name' => $name, 'description' => $description);
$this->navigation->updateNavigationL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$name_l18n = $_POST['name_' . $language->code];
$description_l18n = $_POST['description_' . $language->code];
$data_l18n = array('navigation_id' => $id, 'language_id' => $language->id, 'name' => $name_l18n, 'description' => $description_l18n);
$this->navigation->updateNavigationL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_navigation_item_edit'));
Log::notice('log_navigation_item_edit', 'id: ' . $id . ', name: ' . $name . ', parent_id: ' . $parent_id . ', link: ' . $link . ', icon: ' . $icon . ', role_id: ' . $role_id . ', status: ' . $status);
Url::redirect('navigation/' . $menu_id);
}
}
if (isset($_POST['cancel'])) {
Url::redirect('navigation/' . $menu_id . '');
}
if (isset($_POST['delete'])) {
Url::redirect('navigation/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('navigation/edit', $data, $error);
View::render('icons', $data);
View::renderTemplate('footer', $data);
}
示例10: activitylog
/**
* Activity Log
*/
public function activitylog()
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/tables/datatables/datatables.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/responsive.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/buttons.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jszip/jszip.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/datetime-moment.js ', Url::assetPath('js') . 'plugins/pickers/moment.min.js', Url::assetPath('js') . 'plugins/pickers/bootstrap-datetimepicker.min.js', Url::assetPath('js') . 'plugins/tables/datatables/extensions/jquery.dataTables.yadcf.js', Url::assetPath('js') . 'pages/activitylog.js');
$data['activity_log'] = $this->user->getActivityLog();
View::renderTemplate('header', $data);
View::render('users/activitylog', $data, $error);
View::renderTemplate('footer', $data);
}
示例11:
<div class="footer text-white">
© 2016 <a class="text-white" href="http://www.argosmultilingual.com"><?php
echo SITETITLE;
?>
</a>
</div>
<!-- /footer -->
</div>
<!-- /content area -->
</div>
<!-- /main content -->
</div>
<!-- /page content -->
</div>
<!-- /page container -->
<!-- JS -->
<?php
Assets::js(array(Url::assetPath('js') . 'plugins/loaders/pace.min.js', Url::assetPath('js') . 'core/libraries/jquery.min.js', Url::assetPath('js') . 'core/libraries/bootstrap.min.js', Url::assetPath('js') . 'plugins/loaders/blockui.min.js', Url::assetPath('js') . 'core/app.js'));
//hook for plugging in javascript
$hooks->run('js');
//hook for plugging in code into the footer
$hooks->run('footer');
?>
</body>
</html>
示例12: department
/**
* Organizational Chart - filter by department
*/
public function department($id, $parent_id)
{
$data['js'] = array(Url::assetPath('js') . 'pages/organization.js');
$data['users'] = $this->organization->getUsersByDep($id, $parent_id);
$data['departments'] = $this->organization->getDepartments();
$data['managers'] = $this->organization->getManagers($parent_id);
foreach ($data['managers'] as $manager) {
$data['employeetree'] .= $this->orgChartEmplTree($data['users'], $manager->manager_id);
}
$data['deptree'] = $this->orgChartDepTree($data['departments'], null);
View::renderTemplate('header', $data);
View::render('organization/index', $data, $error);
View::renderTemplate('footer', $data);
}
示例13: array
<?php
//CSS
$css_default = array('https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700,900', Url::assetPath('css') . 'icons/icomoon/styles.css', Url::assetPath('css') . 'icons/fontawesome/styles.min.css', Url::assetPath('css') . 'icons/flaticon/flaticon.css', Url::assetPath('css') . 'bootstrap.css', Url::assetPath('css') . 'core.css', Url::assetPath('css') . 'components.css', Url::assetPath('css') . 'colors.css');
if (isset($data['css'])) {
$all_css = array_merge($css_default, $data['css']);
} else {
$all_css = $css_default;
}
Assets::css($all_css);
//hook for plugging in css
$hooks->run('css');
if ($_SESSION['language_code'] != 'en') {
$moment = Url::assetPath('js') . 'plugins/moment/locale/' . $_SESSION['language_code'] . '.js';
}
//JS
$js_default = array(Url::assetPath('js') . 'plugins/loaders/pace.min.js', Url::assetPath('js') . 'core/libraries/jquery.min.js', Url::assetPath('js') . 'core/libraries/bootstrap.min.js', Url::assetPath('js') . 'plugins/loaders/blockui.min.js', Url::assetPath('js') . 'plugins/ui/nicescroll.min.js', Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/styling/switchery.min.js', Url::assetPath('js') . 'plugins/forms/styling/switch.min.js', Url::assetPath('js') . 'plugins/moment/moment.min.js', $moment, Url::assetPath('js') . 'core/app.js', Url::assetPath('js') . 'pages/layout_fixed_custom.js');
if (isset($data['js'])) {
$all_js = array_merge($js_default, $data['js']);
} else {
$all_js = $js_default;
}
Assets::js($all_js);
//hook for plugging in javascript
$hooks->run('js');
?>
<script type="text/javascript">
var dFormat = '<?php
echo Date::convertPHPToMomentFormat($_SESSION['dateformat']);
?>
';
示例14: edit
/**
* Edit Department
*/
public function edit($id)
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/pickers/color/spectrum.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/departments_add.js');
$data['department'] = $this->department->getDepartment($id);
$data['departments'] = $this->department->getDepartments();
$data['users'] = $this->department->getUsers();
$data['departmentsL18n'] = $this->department->getDepartmentL18n($id);
if (isset($_POST['update'])) {
$name = $_POST['name'];
$email = !empty($_POST['email']) ? $_POST['email'] : NULL;
$color = !empty($_POST['color']) ? $_POST['color'] : NULL;
$parent = !empty($_POST['parent']) ? $_POST['parent'] : NULL;
$supervisor = !empty($_POST['supervisor']) ? $_POST['supervisor'] : NULL;
$status = isset($_POST['status']) ? '1' : '0';
if ($name == '') {
$error[] = $this->language->get('required');
}
if (!$error) {
$data = array('parent_id' => $parent, 'user_id' => $supervisor, 'color' => $color, 'email' => $email, 'status' => $status);
$where = array('id' => $id);
$this->department->updateDepartment($data, $where);
$data_l18n = array('department_id' => $id, 'language_id' => Session::get('language_id'), 'name' => $name);
$this->department->updateDepartmentL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$name_l18n = $_POST['name_' . $language->code];
$data_l18n = array('department_id' => $id, 'language_id' => $language->id, 'name' => $name_l18n);
$this->department->updateDepartmentL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_department_edit'));
Log::notice('log_department_edit', json_encode(array($data, $data_l18n)));
Url::redirect('departments');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('departments');
}
if (isset($_POST['delete'])) {
Url::redirect('departments/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('departments/edit', $data, $error);
View::renderTemplate('footer', $data);
}
示例15: editGroup
/**
* Edit Permission
*/
public function editGroup($id)
{
$data['js'] = array(Url::assetPath('js') . 'plugins/forms/selects/select2.min.js', Url::assetPath('js') . 'plugins/forms/validation/validate.min.js', Url::assetPath('js') . 'plugins/notifications/bootbox.min.js', Url::assetPath('js') . 'pages/permissions_add.js');
$data['permission'] = $this->permission->getPermission($id);
$data['permissionsL18n'] = $this->permission->getPermissionL18n($id);
if (isset($_POST['update'])) {
$name = $_POST['name'];
$name = Url::generateSafeSlug($name, '-');
$display_name = mb_strtoupper($_POST['display_name']);
$description = $_POST['description'];
$unique = $this->permission->isNameUnique($name, $id);
if ($name == '') {
$error[] = $this->language->get('required');
}
if ($display_name == '') {
$error[] = $this->language->get('required');
}
if (!empty($unique)) {
$error[] = $this->language->get('unique_name_required');
}
if (!$error) {
$data = array('name' => $name);
$where = array('id' => $id);
$this->permission->updatePermission($data, $where);
$data_l18n = array('permission_id' => $id, 'language_id' => Session::get('language_id'), 'display_name' => $display_name, 'description' => $description);
$this->permission->updatePermissionL18n($data_l18n);
$languageL18n = L18n::getLanguagesForL18n();
if (!empty($languageL18n)) {
foreach ($languageL18n as $language) {
$display_name_l18n = $_POST['display_name_' . $language->code];
$description_l18n = $_POST['description_' . $language->code];
$data_l18n = array('permission_id' => $id, 'language_id' => $language->id, 'display_name' => $display_name_l18n, 'description' => $description_l18n);
$this->permission->updatePermissionL18n($data_l18n);
}
}
Session::set('success', $this->language->get('msg_permission_group_edit'));
Log::notice('log_permission_group_edit', 'id: ' . $id . ', name: ' . $name . ', display_name: ' . $display_name);
Url::redirect('permissions');
}
}
if (isset($_POST['cancel'])) {
Url::redirect('permissions');
}
if (isset($_POST['delete'])) {
Url::redirect('permissions/delete/' . $id . '');
}
View::renderTemplate('header', $data);
View::render('permissions/edit-group', $data, $error);
View::renderTemplate('footer', $data);
}