Example #1
0
 /**
  * Activate user account.
  *
  * @access     public
  * @return     View
  * @since      1.0.0
  * @version    1.1.0, 2015-02-12
  */
 public function actionActivation()
 {
     // if user is logged, redirect to main page
     if (UserModel::isLogged()) {
         Route::factory('home')->redirectTo();
     }
     // set page title
     $this->setTitle(__('Activate your new account'));
     // get code from URL
     $sCode = Router::getParam('code');
     $bActivated = FALSE;
     // get activation code from DB
     $oResult = DB::query("SELECT c FROM \\Model\\User\\ActivationCode c WHERE c.code = :code")->param('code', $sCode)->single();
     /* @var $oResult ActivationCodeModel */
     // activate user
     if ($oResult instanceof ActivationCodeModel) {
         // Set user as activated
         $bActivated = TRUE;
         $oUser = $oResult->getUser();
         $oUser->setActivation(TRUE);
         DB::flush();
         // Remove activation code from DB
         DB::remove($oResult);
         DB::flush();
     }
     // view
     return View::factory("user/frontend/register/activation")->bind('bActivated', $bActivated);
 }
Example #2
0
 /**
  * @access	public
  * @since	1.0.0-dev, 2015-04-19
  * @version	1.0.0-dev, 2015-04-19
  */
 public function actionDefault()
 {
     $this->setTitle(__('Sitemap'));
     $this->addBreadCrumb(__('Sitemap'));
     $aItems = [];
     $aItems[] = ['/', __('Front page')];
     $aPages = \Plethora\DB::query("SELECT p FROM \\Model\\Page p WHERE p.published = 1")->execute();
     foreach ($aPages as $oPage) {
         /* @var $oPage \Model\Page */
         $aItems[] = [Route::factory('page')->path(['rewrite' => $oPage->getRewrite()]), $oPage->getTitle()];
     }
     \Sitemap\SitemapGenerator::generate($aItems);
     return View::factory('sitemap/frontend/sitemap')->bind('aItems', $aItems);
 }
Example #3
0
 /**
  * Costructor.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function __construct()
 {
     // initialize theme
     Theme::initFrontend();
     // parent consturctor
     parent::__construct();
     // add CSS & JS files for all subpages
     $this->addCssByTheme('/packages/bootstrap/css/bootstrap.css', '_common');
     $this->addJsByTheme('/js/jquery-2.1.3.min.js', '_common');
     $this->addJsByTheme('/js/jquery-ui.min.js', '_common');
     $this->addJsByTheme('/packages/bootstrap/js/bootstrap.min.js', '_common');
     // add first breadcrumb
     $frontPageURL = Route::factory('home')->url();
     $this->addBreadCrumb(__('Front page'), $frontPageURL);
 }
Example #4
0
 /**
  * Action used to do multileveled sort on model entities.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionSortList()
 {
     // check access
     if (!\UserPermissions::hasPerm('backend_ajax_sort_list')) {
         Route::factory('home')->redirectTo();
     }
     // @TODO: check permissions
     $sObjects = filter_input(INPUT_POST, 'objects');
     $sModel = filter_input(INPUT_POST, 'model');
     $aObjectsTmp = [];
     $aOrderNumber = [];
     // if list of objects is empty
     if (empty($sObjects)) {
         $this->setStatus('error');
         return __('List of objects is empty.');
     }
     // parse objects array from query string
     parse_str($sObjects, $aObjectsTmp);
     $aObjects = $aObjectsTmp['object'];
     // rewrite each object
     foreach ($aObjects as $iID => $sParentID) {
         if ($sParentID === 'null') {
             $sParentID = 0;
         }
         $iParentID = (int) $sParentID;
         if (!isset($aOrderNumber[$iParentID])) {
             $aOrderNumber[$iParentID] = 0;
         }
         $aObjects[$iID] = ['order_parent' => $iParentID, 'order' => $aOrderNumber[$iParentID]];
         $aOrderNumber[$iParentID]++;
     }
     // check if particular model has `order` property
     if (!property_exists($sModel, 'order_number')) {
         $this->setStatus('error');
         return __('Wrong node type.');
     }
     // get all model instances
     $aEntities = DB::query('SELECT t FROM ' . $sModel . ' t WHERE t.id IN (:list)')->param('list', array_keys($aObjects))->execute();
     foreach ($aEntities as $oEntity) {
         /* @var $oEntity ModelCore|ModelCore\Traits\Sortable */
         $aObjData = $aObjects[$oEntity->getId()];
         $oEntity->setOrderNumber($aObjData['order']);
         $oEntity->setOrderParent($aObjData['order_parent']);
         $oEntity->save();
         DB::flush();
     }
     return 'saved';
 }
Example #5
0
 /**
  * Main action to run cron jobs.
  *
  * @access   public
  * @since    2.33.0-dev, 2015-06-07
  * @version  2.39.0-dev
  */
 public function actionDefault()
 {
     if (!class_exists('\\Cron\\CronExpression')) {
         throw new Exception\Fatal('Cannot run Cron jobs without proper Cron library.');
     }
     $sTokenFromURL = Router::getParam('token');
     $sTokenFromConfig = Config::get('base.cron_token');
     $iCronJobsCompleted = 0;
     // check Cron token
     if ($sTokenFromURL !== $sTokenFromConfig) {
         throw new Exception\Code404();
     }
     // get all Cron jobs
     $aAllJobs = CronJobsHelper::getCronJobs();
     // count amount of all CRON jobs
     $iCronJobs = count($aAllJobs);
     // run a single CRON job
     foreach ($aAllJobs as $aJobData) {
         $sModule = $aJobData['module'];
         $sJobKey = base64_encode($aJobData[1] . '.' . $aJobData[2]);
         $aCache = Cache::get($sModule . '.' . $sJobKey, 'cron');
         $iRunDate = isset($aCache['time']) ? $aCache['time'] : NULL;
         $oCron = CronExpression::factory($aJobData[0]);
         if ($iRunDate === NULL || $iRunDate < time()) {
             switch ($aJobData[1]) {
                 case 'route':
                     $sURL = Route::factory($aJobData[2])->url();
                     file_get_contents($sURL);
                     break;
                 case 'file':
                 case 'url':
                     file_get_contents($aJobData[2]);
                     break;
                 case 'function':
                     call_user_func($aJobData[2]);
                     break;
             }
             $iNextRun = $oCron->getNextRunDate()->format('U');
             $aCacheToSave = ['time' => $iNextRun, 'last_execution_time' => time(), 'type' => $aJobData[1], 'param' => $aJobData[2]];
             Cache::set($aCacheToSave, $sModule . '.' . $sJobKey, 'cron', 0);
         }
     }
     // log that cron jobs turning on action was completed
     Log::insert('Cron jobs (in amount of ' . $iCronJobs . ') were checked and ' . $iCronJobsCompleted . ' of them were turned on.');
     // end of functionality
     exit;
 }
Example #6
0
 /**
  * ACTION - User login.
  *
  * @access   public
  * @return   View
  * @since    1.0.2, 2013-12-07
  * @version  1.0.7-dev, 2015-05-04
  */
 public function actionLogin()
 {
     $this->setTitle(Core::getAppName() . ' - ' . __('Login form'));
     $this->addBreadCrumb(__('Login form'));
     $oLoggedUser = Model\User::getLoggedUser();
     if ($oLoggedUser instanceof Model\User) {
         Route::factory('user_profile')->redirectTo(['id' => $oLoggedUser->getId()]);
     }
     $failedLogins = \User\LoginFail::getCachedData();
     if ($failedLogins > 4) {
         return View::factory('base/alert')->set('sType', 'danger')->set('sMsg', __('to.many.incorrect.logins'));
     }
     $oLoginForm = Form::factory('login');
     $oLoginForm->addField(Form\Field\Text::factory('login', $oLoginForm));
     $oLoginForm->addField(Form\Field\Password::factory('password', $oLoginForm));
     if ($oLoginForm->isSubmittedAndValid()) {
         $sUsername = $oLoginForm->get('login');
         $sPassword = $oLoginForm->get('password');
         $sEncryptedPassword = Helper\Encrypter::factory()->encrypt($sUsername, $sPassword);
         $oUser = DB::query("SELECT u FROM \\Model\\User u WHERE u.login = :login AND u.password = :pass")->param('login', $sUsername)->param('pass', $sEncryptedPassword)->single();
         if ($oUser instanceof Model\User) {
             Session::set('username', $sUsername);
             Session::set('uid', (int) $oUser->getId());
             $oUser->setLoginDateNOW();
             DB::flush();
             # Get role permissions for particular user and set them in session
             \UserPermissions::reset();
             Route::factory(Router::getCurrentRouteName())->redirectTo();
         } else {
             $currentUrl = Router::currentUrl();
             $alert = __('You have entered wrong username or password. Try again.');
             \User\LoginFail::addLoginFail();
             Session::flash($currentUrl, $alert, 'danger');
         }
     }
     $oLoginForm->addToSuffix(View::factory('user/frontend/login_links')->render());
     return View::factory('base/form')->bind('oForm', $oLoginForm);
 }
Example #7
0
 /**
  * Constructor.
  *
  * @access   public
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function __construct()
 {
     # initialize theme
     Theme::initBackend();
     # call parent
     parent::__construct();
     if ($this->sModel !== NULL) {
         $this->setModel(new $this->sModel());
     }
     if (!User::isLogged() || !\UserPermissions::hasPerm(static::PERM_ADMIN_ACCESS)) {
         Route::factory('home')->redirectTo();
     }
     // set body classes
     $this->addBodyClass('skin-red');
     // add main breadcrumbs and title
     $this->alterBreadcrumbsTitleMain();
     // reset JavaScripts and CSS
     $this->resetCss();
     $this->resetJs();
     // add CSS and JavaScript files
     $this->addCss('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext');
     $this->addCss('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
     $this->addCss('https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css');
     $this->addCssByTheme('/bootstrap/css/bootstrap.min.css');
     $this->addCssByTheme('/css/backend.css');
     $this->addJsByTheme('/plugins/jQuery/jQuery-2.1.4.min.js');
     $this->addJsByTheme('/plugins/jQueryUI/jquery-ui.min.js');
     $this->addJsByTheme('/bootstrap/js/bootstrap.min.js');
     $this->addJsByTheme('/js/backend.js');
     $this->addJsByTheme('/js/jquery.mjs.nestedSortable.js');
     $this->addJsByTheme('/js/app.min.js');
     $this->addJsByTheme('/js/backend_after_theme_load.js');
     # add viewport
     $this->addMetaTagRegular('viewport', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
     // generate menu
     $menuView = $this->generateMenu();
     $this->oViewBody->bind('menu', $menuView);
 }
Example #8
0
<?php

defined('PATH_ROOT') or die('No direct script access.');
return array('pages_add' => array('parent' => 'contents', 'url' => \Plethora\Route::backendUrl('pages', 'add'), 'priority' => 1), 'pages_list' => array('parent' => 'contents', 'url' => \Plethora\Route::backendUrl('pages', 'list'), 'priority' => 1));
Example #9
0
 /**
  * Format value.
  *
  * @access   public
  * @param    string $value
  * @return   string
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function format($value)
 {
     $oLink = Helper\Link::factory();
     // set title attribute
     $sTitle = '';
     $sURL = '';
     $oModel = $this->getField()->getEntity()->getModel();
     $oLocales = $oModel->getLocales();
     if ($oModel->hasField($this->getConfigTitle())) {
         $sTitle = $oModel->{$this->getConfigTitle()};
     } elseif ($oLocales !== NULL && $oLocales->hasField($this->getConfigTitle())) {
         $sTitle = $oLocales->{$this->getConfigTitle()};
     }
     $sTitle = $this->titlePrefix . $sTitle . $this->titleSuffix;
     if (!empty($sTitle)) {
         $oLink->setTitle($sTitle);
     }
     // set URL of the link
     if ($this->bValueAsURL) {
         $sURL = $value;
     } elseif (!empty($this->valueFromField)) {
         $sURL = $this->getField()->getEntity()->getModel()->getValue($this->valueFromField);
     } elseif ($this->getUrl() !== NULL) {
         $sURL = $this->getUrl();
     } elseif ($this->getRouteName() !== NULL) {
         $aArgs = $this->getRouteAttributes();
         foreach ($aArgs as $sAttrKey => $sField) {
             $sAttrValue = NULL;
             if ($oModel->hasField($sField)) {
                 $sAttrValue = $oModel->{$sField};
             } elseif ($oLocales !== NULL && $oLocales->hasField($sField)) {
                 $sAttrValue = $oLocales->{$sField};
             }
             $aArgs[$sAttrKey] = Helper\String::prepareToURL($sAttrValue);
         }
         $sURL = Route::factory($this->getRouteName())->url($aArgs);
     }
     // return newly generated link code
     return $this->sPrefix . $oLink->code($value, $sURL) . $this->sSuffix;
 }
Example #10
0
<script type="text/javascript">
	$(function() {
		$('#run_cron').click(function() {
			var $this = $(this);
			var oldLabel = $this.text();

			$('div#cron_result').html('');
			$this.text('<?php 
echo __('loading...');
?>
');

			$.ajax({
				url: '<?php 
echo \Plethora\Route::factory('cron')->url(['token' => \Plethora\Config::get('base.cron_token')]);
?>
'
			}).done(function(output) {
				$this.text(oldLabel);

				console.log(output);

				if(output === '') {
					output = 'All cron jobs have been executed.';
				}

				$('div#cron_result').html(output);
			});
		});
	});
Example #11
0
 /**
  * Action to set new password after e-mail validation.
  *
  * @access   public
  * @return   View
  * @since    1.0.0, 2015-02-17
  * @version  2.1.0-dev
  */
 public function actionNewPassword()
 {
     // fill up breadcrumbs title and other
     $this->addBreadCrumb(__('New password'));
     // get code from $_GET
     $sCode = Router::getParam('code');
     // get recovery code from DB
     $oRecoveryCode = DB::query("SELECT c FROM \\Model\\User\\RecoveryCode c WHERE c.code = :code")->param('code', $sCode)->single();
     /* @var $oResult User\RecoveryCode */
     // check if code exists
     if ($oRecoveryCode instanceof User\RecoveryCode) {
         $this->addToTitle(' - ' . __('New password'));
         // get user
         $oUser = $oRecoveryCode->getUser();
         // generate form for account access recovery
         $oConfig = ModelCore\ModelFormConfig::factory()->noReload()->setFieldsRestriction(['password'])->setMessage(__('Your password has been successfully changed to the new one.'))->setAction(Route::factory('password_recovery')->url());
         // get form
         $oModelForm = $oUser->form('new_password', $oConfig);
         $oForm = $oModelForm->generate();
         // check if form is valid
         if ($oForm->isSubmittedAndValid()) {
             $oRecoveryCode->remove();
             Session::flash(Route::factory('password_recovery')->url(), __('Password has been changed successfully.'));
         }
         $oForm->addToPrefix(View::factory('user/frontend/recovery/new_pass_prefix')->render());
         // return view
         return View::factory('base/form')->bind('oForm', $oForm);
     } else {
         $this->addToTitle(' - ' . __('Error occured'));
         return View::factory('user/frontend/recovery/wrong_code');
     }
 }
Example #12
0
<?php

return array('i18n_list' => array('parent' => 'system', 'url' => \Plethora\Route::backendUrl('i18n', 'index'), 'priority' => 1));
Example #13
0
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <p class="navbar-text"><?php 
echo __('Hello :user', ['user' => $userAnchor]);
?>
</p>
                </li>

                <?php 
if ($oUser instanceof Model\User) {
    ?>
                    <li>
                        <a
                            href="<?php 
    echo Route::factory('logout')->url();
    ?>
"
                            title="<?php 
    echo __('Logout');
    ?>
"><?php 
    echo __('Logout');
    ?>
</a>
                    </li>
                <?php 
}
?>
            </ul>
        </div>
Example #14
0
<?php

/**
 * @author     Krzysztof Trzos <*****@*****.**>
 * @package    user
 * @subpackage views
 * @since      2.1.0-dev
 * @version    2.1.0-dev
 */
?>

<div class="login_links">
	<p><?php 
echo \Plethora\Helper\Html::a(\Plethora\Route::factory('password_recovery')->url(), __('I forgot password'));
?>
</p>
	<p><?php 
echo \Plethora\Helper\Html::a(\Plethora\Route::factory('register')->url(), __('I want to register an account'));
?>
</p>
</div>
Example #15
0
 /**
  * ACTION - Backend add action.
  *
  * @access   public
  * @return   void
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionAdd()
 {
     $url = Route::factoryBackendURL('files', 'list');
     Router::relocate($url);
 }
Example #16
0
<?php

/**
 * @author		Krzysztof Trzos
 * @package		user
 * @subpackage	views\frontend
 * @since		2.25.0, 2015-02-18
 * @version		1.0.0, 2015-02-18
 */
?>

<?php 
$sAnchor = \Plethora\Helper\Html::a(\Plethora\Route::factory('contact')->url(), __('contact'));
?>

<p class="act_txt"><?php 
echo __('An error occurred while recovering access to your account. The reason may be one of the following points');
?>
</p>
<ul class="func_list">
	<li><?php 
echo __('recovery operation has already been made under this link;');
?>
</li>
	<li><?php 
echo __('link from the e-mail was not fully copied into your browser\'s address field.');
?>
</li>
</ul>
<p class="act_txt"><?php 
echo __('If none of the above reasons does not solve the problem, please contact us via the :contact section.', array('contact' => $sAnchor));
Example #17
0
 /**
  * This method generates actions in each row of the entity list. By default,
  * there are two actions: "edit" and "delete".
  *
  * @access   protected
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 protected function alterListActions()
 {
     $sControllerParam = Router::getParam('controller');
     $this->addListOption(Route::backendUrl($sControllerParam, 'edit', '{id}'), __('edit'), 'pencil');
     $this->addListOption(Route::backendUrl($sControllerParam, 'delete', '{id}'), __('delete'), 'trash');
 }
Example #18
0
 /**
  * Method used to generate code redirecting to main subpage of this
  * module.
  *
  * @access   private
  * @throws   Exception\Router
  * @since    1.2.0-dev
  * @version  1.2.0-dev
  */
 private static function reloadToIndex()
 {
     Route::factory('backend')->redirectTo(['controller' => 'i18n', 'action' => 'index']);
 }
Example #19
0
 * @version        2.1.0-dev
 */
use Plethora\Core;
use Plethora\Helper;
use Plethora\Route;
$siteName = Core::getAppName();
$contactUrl = Helper\Html::a(Route::factory('contact')->url(), __('CONTACT'));
?>

<?php 
/* @var $sRecoveryCode string */
/* @var $sLogin string */
?>

<?php 
$passRecoveryLink = Route::factory('password_recovery_code')->url(['code' => $sRecoveryCode]);
?>

<p><?php 
echo __('Hello :login', ['login' => $sLogin]);
?>
,</p>
<p><?php 
echo __('We were asked to change password on your account ' . 'registered on :site_name site. To do this, click on ' . 'the link below:', ['site_name' => $siteName]);
?>
</p>
<p style="text-align: center;">
    <a href="<?php 
echo $passRecoveryLink;
?>
" title="<?php 
Example #20
0
 /**
  * ACTION - Contents list.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionList()
 {
     Route::factory('backend')->redirectTo();
 }
Example #21
0
if (\Model\User::isLogged()) {
    ?>
        <p><?php 
    echo __('You are logged! Go and see whats in your management panel ;).');
    ?>
</p>
        <p>
            <?php 
    $backend = Helper\Link::factory();
    $backend->getAttributes()->addToAttribute('class', 'btn btn-danger btn-lg');
    echo $backend->code(__('go to management panel'), Route::factory('backend')->url());
    ?>
            <?php 
    echo $loginLink->code(__('logout'), Route::factory('logout')->url());
    ?>
        </p>
    <?php 
} else {
    ?>
        <p><?php 
    echo __('Click the button below to login and start managing. Enjoy!');
    ?>
</p>
        <p><?php 
    echo $loginLink->code(__('login page'), Route::factory('login')->url());
    ?>
</p>
    <?php 
}
?>
</div>
Example #22
0
 /**
  * Find active route in particular menu.
  *
  * @access	private
  * @param	array    $aRoutes
  * @param	integer  $iParentKey
  * @param	array    $aParent
  * @since	1.2.0-dev
  * @version	1.2.0-dev
  */
 private function findActiveRoute(array &$aRoutes, $iParentKey = NULL, array $aParent = [])
 {
     foreach ($aRoutes as $i => &$aRoute) {
         /* @var $aRoute array */
         $oItem = $aRoute['object'];
         /* @var $oItem \Model\Menu\Item */
         $sRouteName = $oItem->getRoute();
         /* @var $sRouteName string */
         $aRouteParams = $oItem->getRouteParams() !== NULL ? $oItem->getRouteParams() : [];
         /* @var $aRouteParams array */
         $aActiveRoutes = $oItem->getActiveRoutes() !== NULL ? $oItem->getActiveRoutes() : [];
         /* @var $aRouteParams array */
         $sPath = Route::factory($sRouteName)->path($aRouteParams);
         $sCurrentPath = Router::getCurrentUrl();
         if (in_array(Router::getCurrentRouteName(), $aActiveRoutes)) {
             $aRoute['classes'] = 'current active_trail';
         } elseif (!isset($aRoute['classes'])) {
             $aRoute['classes'] = NULL;
         }
         if ($iParentKey !== NULL) {
             $aRoute['parent_key'] = $iParentKey;
             $aRoute['parent'] = $aParent;
         }
         if ($sPath === $sCurrentPath) {
             $this->goBackAndSetActive($aRoute);
         }
         if (isset($aRoute['siblings']) && !empty($aRoute['siblings'])) {
             $this->findActiveRoute($aRoute['siblings'], $i, $aRoutes);
             /* @var $oChildren View */
         }
     }
 }
Example #23
0
<?php 
# get logged user
$user = Model\User::getLoggedUser();
# register date
$registerDate = $user->getRegisterDate()->format('Y-m-d');
# avatar
$userImage = $user->getImageStyled();
# logout anchor
$logoutHelper = \Plethora\Helper\Link::factory();
$logoutHelper->getAttributes()->addToAttribute('class', 'btn btn-default btn-flat');
$logout = $logoutHelper->code(__('Logout'), Route::factory('logout')->url());
?>

<a href="<?php 
echo Route::backendUrl();
?>
" class="logo">
    <span class="logo-mini"><b>Pl</b></span>
    <span class="logo-lg"><b>Plethora</b></span>
</a>

<nav class="navbar navbar-static-top" role="navigation">
    <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only"><?php 
echo __('Toggle navigation');
?>
</span>
    </a>

    <div class="navbar-custom-menu">
Example #24
0
 * @since      1.0.0
 * @version    2.1.0-dev
 */
?>

<?php 
/* @var $bActivated boolean */
?>

<?php 
if ($bActivated) {
    ?>
	<p class="correct_activation">Gratulacje! Twoje konto zostało w pełni aktywowane!</p>
	<p class="act_txt">Możesz się teraz zalogować.</p>
<?php 
} else {
    ?>
	<p class="incorrect_activation">Błąd!</p>
	<p class="act_txt">Konto nie zostało aktywowane. Powodem tego może być jeden z poniższych punktów:</p>
	<ul class="func_list">
		<li>konto zostało już wcześniej aktywowane;</li>
		<li>link aktywacyjny nie został w całości przekopiowany do pola adresu przeglądarki;</li>
	</ul>
	<p class="act_txt">Jeżeli żaden z powyższych powodów nie rozwiązuje problemu aktywacji konta, skontaktuj się z nami poprzez dział
		<a href="<?php 
    echo \Plethora\Route::factory('contact')->url();
    ?>
" title="Dział kontakt">KONTAKT</a>.
	</p>
<?php 
}
Example #25
0
<?php

/* @version 1.0.1, 2014-11-27 */
/* @var $oUser \Model\User */
?>

<?php 
if (\Plethora\Router::getParam('id') == \Plethora\Session::get('uid')) {
    ?>
    <p style="text-align: center;">
        <a href="<?php 
    echo \Plethora\Route::factory('user_profile_edit')->url();
    ?>
" title="<?php 
    echo __('Edit profile');
    ?>
">
            [ <?php 
    echo __('Edit profile');
    ?>
 ]
        </a>
    </p>
<?php 
}
?>

<div class="user_profile">
    <table>
        <tbody>
        <tr>
Example #26
0
 /**
  *
  * @access   protected
  * @since    1.1.3-dev, 2015-08-20
  * @version  1.1.3-dev, 2015-08-20
  */
 protected function alterBreadcrumbsTitleMain()
 {
     parent::alterBreadcrumbsTitleMain();
     $this->removeBreadcrumb();
     $this->addBreadCrumb(__('Menu list'), Route::backendUrl('menu', 'list'));
 }
Example #27
0
<?php

defined('PATH_ROOT') or die('No direct script access.');
return array('users' => array('parent' => 'system', 'url' => \Plethora\Route::backendUrl('user', 'list'), 'priority' => 1), 'roles_list' => array('parent' => 'system', 'url' => \Plethora\Route::backendUrl('user\\role', 'list'), 'priority' => 2), 'permission_list' => array('parent' => 'system', 'url' => \Plethora\Route::backendUrl('user\\permission', 'list'), 'priority' => 2));
/**
 * CHANGELOG:
 * 2015-01-10: Dodanie listy ról i uprawnień.
 */
Example #28
0
<?php

defined('PATH_ROOT') or die('No direct script access.');
return array('dbupdate' => array('parent' => 'system', 'url' => \Plethora\Route::backendUrl('dbupdate'), 'priority' => 2));
Example #29
0
 /**
  * Remove all data of this Model from database.
  *
  * @access   public
  * @return   boolean
  * @since    2.1.2-dev
  * @version  2.1.2-dev
  */
 public function remove()
 {
     if ((int) $this->id === 1) {
         Route::factory('home')->redirectTo();
     }
     parent::remove();
 }
Example #30
0
 /**
  * Find active route in particular menu.
  *
  * @access   private
  * @param    array   $routes
  * @param    integer $parentKey
  * @param    array   $parent
  * @since    1.0.0-dev
  * @version  1.3.0-dev
  */
 private function findActiveRoute(array &$routes, $parentKey = NULL, array $parent = [])
 {
     foreach ($routes as $i => &$route) {
         /* @var $route array */
         /* @var $routeName string */
         /* @var $routeParams array */
         /* @var $activeRoutes array */
         if (!isset($route['classes'])) {
             $route['classes'] = [];
         }
         $routeName = Helper\Arrays::get($route, 'route_name', NULL);
         $url = Helper\Arrays::get($route, 'url', NULL);
         $routeParams = Helper\Arrays::get($route, 'route_parameters', []);
         $activeRoutes = Helper\Arrays::get($route, 'active_routes', []);
         //            $path        = $url === NULL ? Route::factory($routeName)->path($routeParams) : $url;
         if ($routeName !== NULL) {
             $path = Route::factory($routeName)->path($routeParams);
         } else {
             $path = $url;
         }
         $path = str_replace(Router::getBase(), '', $path);
         $currentPath = Router::getCurrentUrl();
         if (in_array(Router::getCurrentRouteName(), $activeRoutes)) {
             $route['classes'][] = ['current ' . $this->activeTrailClass];
         }
         if ($parentKey !== NULL) {
             $route['parent_key'] = $parentKey;
             $route['parent'] = $parent;
         }
         if ($path === $currentPath) {
             $this->goBackAndSetActive($route);
         }
         if (isset($route['children']) && !empty($route['children'])) {
             $this->findActiveRoute($route['children'], $i, $routes);
             /* @var $oChildren View */
         }
     }
 }