/** * Extract validation * validations.type = configuration * validations.required = configuration * * validations.required * validations.required.message */ protected function _validation($action = null) { $section = zbase_section(); if (empty($action)) { $action = zbase_route_input('action'); } $validations = $this->_v('validations.' . $action . '.' . $section, $this->_v('validations.' . $action, $this->_v('validations', []))); $this->_fixValidation = true; if (!empty($validations)) { foreach ($validations as $type => $config) { $enable = zbase_data_get($config, 'enable'); // $enable = $enable ? true : false; if (!empty($enable)) { if (!empty($config['text'])) { $this->_validationRules[] = zbase_data_get($config, 'text'); } else { if (!in_array($type, $this->_validationRules)) { $this->_validationRules[] = $type; } } if (!empty($config['message'])) { $this->_validationMessages[$this->name() . '.' . $type] = zbase_data_get($config, 'message'); } } } } }
/** * Check if we are in the backend * @return boolean */ function zbase_is_back() { return zbase_section() == 'back'; }
</a> </li> <?php $modules = zbase()->modules(); $navs = []; foreach ($modules as $module) { if ($module->hasNavigation(zbase_section())) { $navs[] = $module; } } $navs = zbase_collection($navs)->sortByDesc(function ($itm) { return $itm->getNavigationOrder(); })->toArray(); if (!empty($navs)) { foreach ($navs as $navigation) { echo $navigation->getNavigation(zbase_section()); } } ?> </ul> </div> <?php } ?> <!-- BEGIN TOP NAVIGATION MENU --> <ul class="nav navbar-nav pull-right"> <?php echo zbase_view_render(zbase_view_file('partial.notification-bar'));
/** * Widget entity interface. * Data should be validated first before passing it here * @param string $method post|get * @param string $action the controller action * @param array $data validated; assoc array * @param Zbase\Widgets\Widget $widget */ public function widgetController($method, $action, $data, \Zbase\Widgets\Widget $widget) { if (preg_match('/-update/', $action)) { $action = 'update'; } if (preg_match('/-create/', $action)) { $action = 'create'; } if (preg_match('/-delete/', $action)) { $action = 'delete'; } if ($action == 'update' && strtolower($method) == 'post' || $action == 'create' && strtolower($method) == 'post') { $this->nodeAttributes($data); } zbase_db_transaction_start(); try { $parent = !empty($data['category']) ? $data['category'] : null; $parentNodes = []; if (!empty($parent)) { $currentParent = $this->ancestors()->first(); if (is_array($parent)) { foreach ($parent as $p) { if ($parent instanceof Interfaces\EntityInterface) { $parentCategoryNode = $p; } else { $parentCategoryNode = $this->repository()->byAlphaId($p); } if ($parentCategoryNode instanceof Interfaces\EntityInterface) { if ($currentParent->id() != $parentCategoryNode->id()) { $parentNodes[] = $parentCategoryNode; } } else { zbase_alert('error', _zt('There was a problem performing your request.')); return false; } } } } if (empty($parentNodes)) { $parentNodes[] = self::root(); } if ($action == 'create' && strtolower($method) == 'post') { $this->save(); $this->_setParentNodes($parentNodes); $this->uploadNodeFile(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); zbase_alert('success', _zt('Created "%title%"!', ['%title%' => $this->title, '%id%' => $this->id()])); return true; } if ($action == 'update' && strtolower($method) == 'post') { $this->save(); $this->_setParentNodes($parentNodes); $this->uploadNodeFile(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); zbase_alert('success', _zt('Saved "%title%"!', ['%title%' => $this->title, '%id%' => $this->id()])); return true; } if ($action == 'delete' && strtolower($method) == 'post') { $this->delete(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $undoText = ''; if (!empty($this->hasSoftDelete())) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Undo Delete" class="undodelete">Undo</a>.'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; } zbase_alert('success', _zt('Deleted "%title%"! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText])); return true; } } catch (\Zbase\Exceptions\RuntimeException $e) { zbase_db_transaction_rollback(); } if ($action == 'index') { return; } if ($action == 'update') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; zbase_alert('warning', _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText])); return false; } } if ($action == 'delete') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; zbase_alert('warning', _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText])); return false; } } try { if ($action == 'move') { } if ($action == 'restore') { if ($this->trashed()) { $this->restore(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Row "%title%" was restored!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } zbase_alert('error', _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()])); return false; } if ($action == 'ddelete') { if ($this->trashed()) { $this->forceDelete(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); zbase_alert('success', _zt('Row "%title%" was removed from database!', ['%title%' => $this->title, '%id%' => $this->id()])); return true; } zbase_alert('error', _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()])); return false; } } catch (\Zbase\Exceptions\RuntimeException $e) { zbase_alert('error', _zt('There was a problem performing the request for "%title%".', ['%title%' => $this->title, '%id%' => $this->id()])); zbase_db_transaction_rollback(); } return false; }
zbase_view_page_details(['page' => $page]); $breadcrumbs = [['label' => 'Users', 'route' => ['name' => 'admin.users']], ['label' => '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->displayName() . '</span>', 'link' => '#', 'title' => $selectedUser->displayName()]]; zbase_view_breadcrumb($breadcrumbs); } else { $selectedUser = zbase_auth_user(); } $accountTabs = []; $accountContents = []; $accountContents[] = ['position' => 10, 'groupId' => 'information', 'content' => function () use($selectedUser) { return zbase_view_render(zbase_view_file_module('account.views.information', 'account', 'zbase'), ['user' => $selectedUser]); }]; $accountContents[] = ['position' => 10, 'groupId' => 'notification', 'content' => function () use($selectedUser) { return zbase_view_render(zbase_view_file_module('account.views.notifications', 'account', 'zbase'), ['user' => $selectedUser]); }]; $accountContents = zbase_module_widget_contents('account', 'account', zbase_section(), $adminView, null, $accountContents); $accountTabs = zbase_module_widget_contents('account', 'account', zbase_section(), $adminView, 'tabs'); $widgetConfig = ['config' => ['entity' => ['entity' => $selectedUser]]]; ?> <div class="zbase-ui-wrapper zbase-ui-tabs" id="zbase-ui-tabs-accounttabs"> <ul class="nav nav-tabs"> <li class=""><a data-toggle="tab" href="#accounttabsaccountInformation">Account Information</a></li> <?php if (!empty($accountTabs)) { ?> <?php foreach ($accountTabs as $accountTab) { ?> <?php $accountTabId = !empty($accountTab['id']) ? $accountTab['id'] : null; ?> <?php
/** * Widget entity interface. * Data should be validated first before passing it here * @param string $method post|get * @param string $action the controller action * @param array $data validated; assoc array * @param Zbase\Widgets\Widget $widget * @return boolean */ public function nodeWidgetController($method, $action, $data, \Zbase\Widgets\Widget $widget) { zbase_db_transaction_start(); try { if ($action == 'create' && strtolower($method) == 'post') { $this->createNode($data); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Created "%title%"!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } if ($action == 'update' && strtolower($method) == 'post') { $this->updateNode($data); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Saved "%title%"!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } } catch (\Zbase\Exceptions\RuntimeException $e) { zbase_db_transaction_rollback(); } if ($action == 'index') { return; } if ($action == 'update') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->alphaId()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->alphaId()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; $this->_actionMessages[$action]['warning'][] = _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return false; } } if ($action == 'delete') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->alphaId()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->alphaId()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; $this->_actionMessages[$action]['warning'][] = _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return false; } } try { if (strtolower($method) == 'post') { if ($action == 'delete') { if ($this->hasSoftDelete()) { $this->deleted_at = zbase_date_now(); $this->save(); } else { $this->delete(); } $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $undoText = ''; if (!empty($this->hasSoftDelete())) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->alphaId()]) . '" title="Undo Delete" class="undodelete">Undo</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->alphaId()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; } $this->_actionMessages[$action]['success'][] = _zt('Deleted "%title%"! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return true; } } if ($action == 'restore') { if ($this->trashed()) { $this->restore(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Row "%title%" was restored!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } $this->_actionMessages[$action]['error'][] = _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()]); return false; } if ($action == 'ddelete') { if ($this->trashed()) { $this->forceDelete(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Row "%title%" forever deleted!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } $this->_actionMessages[$action]['error'][] = _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()]); return false; } } catch (\Zbase\Exceptions\RuntimeException $e) { $this->_actionMessages[$action]['error'][] = _zt('There was a problem performing the request for "%title%".', ['%title%' => $this->title, '%id%' => $this->id()]); zbase_db_transaction_rollback(); } return false; }
/** * Event after Action * @param string $action * @param string $url The Default URL to redirect */ protected function _postEvent($action) { if ($this->isPublic() && $this->isNode() && $this->isCreating()) { return zbase_redirect()->to($this->entity()->alphaUrl()); } $isAjax = zbase_request_is_ajax(); $requestMethod = strtolower(zbase_request_method()); if ($isAjax) { if ($requestMethod == 'post') { $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json.post', $this->_v('event.' . $action . '.post-json')); } else { $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json', $this->_v('event.' . zbase_section() . '.' . $action . '.post')); } } else { if ($requestMethod == 'post') { $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post.post', $this->_v('event.' . $action . '.post.post', null)); } else { $e = $this->_v('event.' . zbase_section() . '.' . $action . '.post', $this->_v('event.' . $action . '.post', null)); } } if (is_null($e)) { if (zbase_is_back()) { if ($this->isCreating()) { $action = 'update'; } $byAlphaId = $this->_v('entity.repo.byAlphaId.route', false); if ($this->entityIsPostInterface($this->entity())) { if (!empty($byAlphaId)) { $params = ['action' => $action, 'id' => $this->entity()->postAlphaId()]; } else { $params = ['action' => $action, 'id' => $this->entity()->postId()]; } } else { if (!empty($byAlphaId)) { $params = ['action' => $action, 'id' => $this->entity()->alphaId()]; } else { $params = ['action' => $action, 'id' => $this->entity()->id()]; } } } else { $params = ['action' => $action, 'id' => $this->entity()->alphaId()]; } if ($action == 'delete') { $params = []; } $url = $this->getModule()->url(zbase_section(), $params); if ($action == 'restore' || $action == 'ddelete') { $url = zbase_url_previous(); } } if (!empty($e)) { if (!empty($e['data'])) { if ($isAjax) { zbase()->json()->addVariables($e['data']); } } if (!empty($e['route'])) { $params = zbase_route_inputs(); if (!empty($e['route']['params'])) { $params = array_merge($params, $e['route']['params']); } if (zbase_is_back()) { $byAlphaId = $this->_v('entity.repo.byAlphaId.route', false); if (!empty($byAlphaId)) { $params['id'] = $this->entity()->alphaId(); } else { $params['id'] = $this->entity()->id(); } } if ($action == 'ddelete') { if (isset($params['id']) && isset($params['action'])) { unset($params['id']); unset($params['action']); } } $e['route']['params'] = $params; $url = zbase_url_from_config($e); } $toUrl = zbase_value_get($e, 'url', false); if (!empty($toUrl)) { $url = $toUrl; } } $enableRedirect = $this->_v('event.' . zbase_section() . '.' . $action . '.post.redirect.enable', $this->_v('event.' . $action . '.post.redirect.enable', true)); if (!empty($url) && !empty($enableRedirect)) { return zbase_redirect()->to($url); } return true; }
* @license proprietary * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx * @version 0.0.0.1 * @since Aug 23, 2016 4:12:15 PM * @file accountinfo.blade.php * @project ZbaseAgse * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php. */ $addressCoverage = null; $roleTitle = $user->roleTitle(); $isAdmin = zbase_auth_user()->isAdmin(); $contents = []; $contents[] = ['position' => 10, 'content' => function () use($user) { return zbase_view_render(zbase_view_file_module('account.views.accountInformation', 'account', 'zbase'), ['user' => $user]); }]; $contents = zbase_module_widget_contents('account', 'account', zbase_section(), $isAdmin, 'informationInner', $contents); ?> <div class="row"> <div class="col-md-2"> <img class="img-responsive thumbnail" src="<?php echo $user->avatarUrl(); ?> " alt="<?php echo $user->displayName(); ?> "> </div> <div class="col-md-10"> <?php echo zbase_module_widget_render_contents($contents); ?>
/** * Set Page Property * @param string $action The Controller Action * @param array $param some assoc array that can be replace to the string * @return void */ public function pageProperties($action) { $section = zbase_section(); if (zbase_request_is_post()) { $action = str_replace('post-', null, $action); } $title = $this->_v('controller.' . $section . '.action.' . $action . '.page.title', null); $headTitle = $this->_v('controller.' . $section . '.action.' . $action . '.page.headTitle', $title); $subTitle = $this->_v('controller.' . $section . '.action.' . $action . '.page.subTitle', null); $breadcrumbs = $this->_v('controller.' . $section . '.action.' . $action . '.page.breadcrumbs', $this->_v('controller.' . $section . '.action.index.page.breadcrumbs', [])); zbase_view_pagetitle_set($headTitle, $title, $subTitle); if (!empty($breadcrumbs)) { zbase_view_breadcrumb($breadcrumbs); } return $this; }
/** * SCripts when this content/view is displayed on innerContent via Ajax * * @param boolean $load Data is Loading else we are leaving the page, going back * @return void */ public function postPageOnInnerContentScript($tag = null) { if (!empty(zbase_request_input('_innercontent'))) { if (method_exists($this, 'pageOnInnerContentScript')) { $this->pageOnInnerContentScript($tag); } $postHtmlId = $this->postHtmlId(); $away = zbase_request_input('_innercontentaway', false); $tableRowId = zbase_request_input('_datatableRow', false); $innerContentId = zbase_request_input('_innerContentId', false); /** * Currently viewing the data */ $innerContentView = zbase_request_input('_innerContentView', false); if (empty($away)) { if (!empty($innerContentView)) { zbase()->json()->setVariable('_html_selector_replace', ['h3.page-title span.' . $this->postHtmlCommonId() => '<span class="' . $this->postHtmlCommonId() . '">' . zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small></span>'], true); } else { if (!empty($tableRowId) && !empty($innerContentId)) { zbase()->json()->setVariable('_html_selector_remove', ['.' . $this->postHtmlCommonId() => ''], true); zbase()->json()->setVariable('_html_selector_append', ['.page-breadcrumb.breadcrumb' => '<li class="' . $this->postHtmlCommonId() . '"><i class="fa fa-angle-right"></i><a title="' . $this->postDisplayText() . '" href="#">' . $this->postDisplayText() . '</a></li>'], true); zbase()->json()->setVariable('_html_selector_append', ['h3.page-title' => '<span class="' . $this->postHtmlCommonId() . '">' . zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small></span>'], true); zbase()->json()->setVariable('_html_selector_hide', ['.zbase-page-title' => ''], true); $script = 'jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').hide();jQuery(\'.breadcrumb li\').eq(2).find(\'a\').click(function(e){ e.preventDefault(); window.history.pushState(\'\',\'' . zbase()->view()->title() . '\',\'' . zbase_url_previous() . '\'); jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').show(); jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').siblings().remove(); jQuery(\'h3.page-title span.' . $this->postHtmlCommonId() . '\').remove(); jQuery(\'h3.page-title span.zbase-page-title\').show(); jQuery(\'.breadcrumb li.' . $this->postHtmlCommonId() . '\').remove(); })'; zbase()->json()->setVariable('_html_script', [$script], true); } } } else { $script = 'jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').show(); jQuery(\'#' . $innerContentId . '\').closest(\'.zbase-widget-wrapper-datatable\').siblings().remove(); jQuery(\'h3.page-title span.' . $this->postHtmlCommonId() . '\').remove(); jQuery(\'h3.page-title span.zbase-page-title\').show(); jQuery(\'.breadcrumb li.' . $this->postHtmlCommonId() . '\').remove();'; zbase()->json()->setVariable('_html_script', [$script], true); } } else { zbase()->json()->setVariable('_html_selector_replace', ['.page-breadcrumb.breadcrumb' => zbase_view_render(zbase_view_file('partial.breadcrumb', zbase_section()))], true); zbase()->json()->setVariable('_html_selector_html', ['.page-title' => zbase()->view()->title() . '<small>' . zbase()->view()->subTitle() . '</small>'], true); } }
/** * Widget entity interface. * Data should be validated first before passing it here * @param string $method post|get * @param string $action the controller action * @param array $data validated; assoc array * @param Zbase\Widgets\Widget $widget * @return boolean */ public function nodeWidgetController($method, $action, $data, \Zbase\Widgets\Widget $widget) { zbase_db_transaction_start(); try { if (strtolower($method) == 'post') { if ($action == 'file-update') { $action = 'update'; } if ($action == 'file-delete') { $action = 'delete'; } } if (strtolower($method) == 'post' && zbase_request_is_upload()) { $parentObject = $widget->parentEntityObject(); if (empty($parentObject)) { return false; } $this->receiveFile($parentObject); $action = 'create'; } if (strtolower($method) == 'post') { if (!empty($data)) { $newData = $data; $data = []; foreach ($newData as $dK => $dV) { $data[str_replace('nodefile', '', $dK)] = $dV; } } } if ($action == 'create' && strtolower($method) == 'post') { if (isset($data['title'])) { $this->title = $data['title']; } if (isset($data['excerpt'])) { $this->excerpt = $data['excerpt']; } $this->save(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('File Uploaded!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } if ($action == 'update' && strtolower($method) == 'post') { foreach ($data as $k => $v) { unset($data[$k]); $data[str_replace('nodefile', '', $k)] = $v; } if (!empty($data['status'])) { $this->status = 2; unset($data['status']); } else { $this->status = 0; } if (isset($data['title'])) { $this->title = $data['title']; } if (isset($data['excerpt'])) { $this->excerpt = $data['excerpt']; } if (isset($data['primary']) && !empty($data['primary'])) { $this->updatePrimary($data['primary']); $this->parentObject()->image = $this->alphaId(); } else { $this->parentObject()->image = null; } $this->parentObject()->save(); $this->save(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Saved', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } if ($action == 'primary' && strtolower($method) == 'post') { $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Saved', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } } catch (\Zbase\Exceptions\RuntimeException $e) { zbase_db_transaction_rollback(); } if ($action == 'index') { return; } if ($action == 'update') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; $this->_actionMessages[$action]['warning'][] = _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return false; } } if ($action == 'delete') { if ($this->hasSoftDelete() && $this->trashed()) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Restore" class="undodelete">Restore</a>'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; $this->_actionMessages[$action]['warning'][] = _zt('Row "%title%" was trashed! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return false; } } try { if ($action == 'delete') { if ($this->hasSoftDelete()) { $this->deleted_at = zbase_date_now(); $this->save(); } else { $this->_deleteFile(); $this->delete(); } $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $undoText = ''; if (!empty($this->hasSoftDelete())) { $undoText = '<a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'restore', 'id' => $this->id()]) . '" title="Undo Delete" class="undodelete">Undo</a>.'; $undoText .= ' | <a href="' . $widget->getModule()->url(zbase_section(), ['action' => 'ddelete', 'id' => $this->id()]) . '" title="Delete Forever " class="ddeleteforever">Delete Forever</a>'; } $this->_actionMessages[$action]['success'][] = _zt('File Deleted! %undo%', ['%title%' => $this->title, '%id%' => $this->id(), '%undo%' => $undoText]); return true; } if ($action == 'restore') { if ($this->trashed()) { $this->restore(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Row "%title%" was restored!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } $this->_actionMessages[$action]['error'][] = _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()]); return false; } if ($action == 'ddelete') { if ($this->trashed()) { $this->forceDelete(); $this->_deleteFile(); $this->log($action); zbase_db_transaction_commit(); zbase_cache_flush([$this->getTable()]); $this->_actionMessages[$action]['success'][] = _zt('Row "%title%" was removed from database!', ['%title%' => $this->title, '%id%' => $this->id()]); return true; } $this->_actionMessages[$action]['error'][] = _zt('Error restoring "%title%". Row was not trashed.!', ['%title%' => $this->title, '%id%' => $this->id()]); return false; } } catch (\Zbase\Exceptions\RuntimeException $e) { $this->_actionMessages[$action]['error'][] = _zt('There was a problem performing the request for "%title%".', ['%title%' => $this->title, '%id%' => $this->id()]); zbase_db_transaction_rollback(); } return false; }
/** * Return the Main Template Layout * * The main template configuration: * view.templates.front.package = The package to use * view.templates.front.theme = The theme to use * view.templates.$tag.front.package = Tag a package to use * view.templates.$tag.front.theme = Tag a package to use * * @param string $tag * @param string $tpl The template file to use * @return string */ function zbase_view_template_layout($tag = null, $tpl = 'layout', $section = null) { $section = is_null($section) ? zbase_section() : $section; $package = zbase_view_template_package($tag); $theme = zbase_view_template_theme($tag); $viewFile = $package . '::templates.' . $section . '.' . $theme . '.' . $tpl; // dd('Section: ' . $section, 'Package: ' . $package, 'Theme: ' . $theme); if (\View::exists($viewFile)) { return $viewFile; } return zbase_tag() . '::templates.' . $section . '.default.' . $tpl; }
/** * Set template defaults * */ protected function _setDefaults() { $this->setPageTitle(zbase_config_get('view.default.title.title', null)); zbase_view_meta_description(zbase_config_get('view.default.description', 'Zbase - aims to provide an effortless module to the world, regardless of the framework!')); zbase_view_meta_keywords(zbase_config_get('view.default.keywords', 'laravel, zend framework, php, framework, module')); $this->placeholders['body_class'][zbase_tag()] = zbase_tag(); $navMain = zbase_config_get('nav.' . zbase_section()); if (!empty($navMain)) { foreach ($navMain as $group => $navs) { if (!empty($navs)) { $counter = 0; foreach ($navs as $id => $nav) { if (empty($nav['id'])) { $nav['id'] = $id; } if (!isset($nav['position'])) { $nav['position'] = $counter++; } $this->add(self::NAVIGATION, $nav, $group); } } } } }
<h1 class="scrollable-header app-name"><?php echo zbase_config_get('page.site.name', 'Zbase'); ?> <!--<small>1.2</small>--></h1> <div class="scrollable-content"> <div class="list-group" ui-turn-off='uiSidebarLeft'> <a class="list-group-item" href="#/"> <i class="fa fa-home"></i> Dashboard </a> <?php $modules = zbase()->modules(); foreach ($modules as $module) { if ($module->isEnable()) { if ($module->hasNavigation(zbase_section())) { $navigation = $module->getNavigation(zbase_section()); $navigation->isAngular(true); $navigation->setAttribute('format', '<a class="list-group-item {CLASS_ISACTIVE}" href="{URL}">{LABEL}</a>'); echo $navigation; } } } ?> <?php if (zbase_auth_has()) { ?> <a class="list-group-item" href="<?php echo zbase_angular_url('admin.account', []); ?> "> <i class="fa fa-user"></i>