예제 #1
0
 /**
  * Default action for the dashboard.
  *
  * @access   public
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionDefault()
 {
     $this->addToTitle('Dashboard');
     $this->addCssByTheme('/packages/gridster/jquery.gridster.css', '_common');
     $this->addJsByTheme('/packages/gridster/jquery.gridster.min.js', '_common');
     return View::factory('base/backend/dashboard');
 }
예제 #2
0
 /**
  * ACTION - Profile of particular news.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionDefault()
 {
     $this->setTitle(__('Page not found!') . ' [404]');
     $oContent = View::factory('base/error_pages/404');
     $this->oView->bind('oContent', $oContent);
     return $oContent;
 }
예제 #3
0
파일: Base.php 프로젝트: ktrzos/plethora
 /**
  * Return the whole body of the changelog.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionChangelog()
 {
     $this->addToTitle('Plethora Changelog');
     $this->addBreadCrumb('Plethora Changelog');
     $sPathToChangelog = PATH_ROOT . 'framework' . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'Plethora' . DIRECTORY_SEPARATOR . 'changelog.html';
     $sChangelogHtmlPage = file_get_contents($sPathToChangelog);
     $sChangelogBody = str_replace('&', '&', $sChangelogHtmlPage);
     return View::factory('base/content')->bind('sContent', $sChangelogBody);
 }
예제 #4
0
파일: User.php 프로젝트: ktrzos/plethora
 /**
  * ACTION - Backend delete action.
  *
  * @access   public
  * @return   View
  * @since    2.1.2-dev
  * @version  2.1.2-dev
  */
 public function actionDelete()
 {
     // check if someone want to remove admin account
     if ((int) Router::getParam('id') === 1) {
         return View::factory('base/alert')->set('sType', 'danger')->set('sMsg', __('Admin account cannot be removed!'));
     }
     // return View
     return parent::actionDelete();
 }
예제 #5
0
파일: Fatal.php 프로젝트: ktrzos/plethora
 /**
  * Fatal error handler.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function handler()
 {
     if (Core::getAppMode() == Core::MODE_DEVELOPMENT) {
         throw $this;
     } else {
         header('HTTP/1.0 ' . $this->sHeaderContent);
         echo View::factory('base/error_pages/500')->render();
         die;
     }
 }
예제 #6
0
파일: Sitemap.php 프로젝트: ktrzos/plethora
 /**
  * @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);
 }
예제 #7
0
 /**
  * Make formatting on an array value.
  *
  * @access   public
  * @param    array $values
  * @return   mixed
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function formatArray(array $values)
 {
     $oView = View::factory('base/view/field_formatter/list')->bind('aList', $values);
     return $this->sPrefix . $oView->render() . $this->sSuffix;
 }
예제 #8
0
파일: Toolbar.php 프로젝트: ktrzos/plethora
 /**
  * Render toolbar.
  *
  * @access     public
  * @return    string
  * @since      1.0.0-dev, 2015-06-08
  * @version    1.1.0-dev
  */
 public function render()
 {
     $oSqlLogger = DB::getEntityManager()->getConnection()->getConfiguration()->getSQLLogger();
     //* @var $oSqlLogger \Doctrine\DBAL\Logging\DebugStack */
     $aRoutesList = Router::getRoutes();
     $aModules = Router::getModules();
     $aBenchmarkMarks = Benchmark::getAllMarks();
     $aCustoms = static::getCustoms();
     $cronJobs = CronJobsHelper::getCronJobs();
     return View::factory('dev_toolbar/toolbar')->bind('oSqlLogger', $oSqlLogger)->bind('aRoutesList', $aRoutesList)->bind('aModules', $aModules)->bind('aCustoms', $aCustoms)->bind('aBenchmarkMarks', $aBenchmarkMarks)->bind('cronJobs', $cronJobs)->render();
 }
예제 #9
0
echo $sPrefix;
?>

<?php 
if (!empty($aList)) {
    ?>
    <div class="entities_list entities_list_<?php 
    echo $sHtmlClass;
    ?>
 table table-striped">
        <?php 
    foreach ($aList as $oEntity) {
        /* @var $oEntity \Plethora\View\ViewEntity */
        ?>
            <?php 
        echo \Plethora\View::factory($sViewPathSingleRow)->bind('oEntity', $oEntity)->render();
        ?>
        <?php 
    }
    ?>
    </div>
<?php 
} else {
    ?>
    <div>
        <p><?php 
    echo __('List is empty.');
    ?>
</p>
    </div>
<?php 
예제 #10
0
파일: Cron.php 프로젝트: ktrzos/plethora
 /**
  * Main action to run cron jobs manually.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionRunCron()
 {
     $this->addToTitle(__('Run Cron jobs manually'));
     return View::factory('base/backend/run_cron');
 }
예제 #11
0
 /**
  * Returns rendered field
  *
  * @access   public
  * @return   string
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function render()
 {
     $sContent = View::factory($this->getViewPath() . '::php')->render(['oField' => $this]);
     return View::factory('form/separator::php')->render(['sContent' => $sContent, 'oField' => $this]);
 }
예제 #12
0
 /**
  * Get field View.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function getView()
 {
     $sFieldViewPath = $this->getEntity()->getViewFieldPath();
     $sFieldViewPath1 = $sFieldViewPath . '__' . $this->getEntity()->getHtmlClass();
     $sFieldViewPath2 = $sFieldViewPath1 . '__' . $this->getTypeOfModel();
     $sFieldViewPath3 = $sFieldViewPath1 . '__' . $this->getName();
     if (View::viewExists($sFieldViewPath1)) {
         $sFinalPath = $sFieldViewPath1;
     } elseif (View::viewExists($sFieldViewPath2)) {
         $sFinalPath = $sFieldViewPath2;
     } elseif (View::viewExists($sFieldViewPath3)) {
         $sFinalPath = $sFieldViewPath3;
     } else {
         $sFinalPath = $sFieldViewPath;
     }
     return View::factory($sFinalPath)->bind('oField', $this)->bind('sPrefix', $this->sPrefix)->bind('sSuffix', $this->sSuffix);
 }
예제 #13
0
 /**
  * Render only one value of the field.
  *
  * @access   protected
  * @return   string
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 protected function renderSingleValuePattern()
 {
     return View::factory($this->getView())->set('sLang', 'LANGUAGE')->set('iValueNumber', 'NUMBER')->set('oField', $this)->set('oCurrentFile', NULL)->set('oTmpFile', NULL)->render();
 }
예제 #14
0
파일: default.php 프로젝트: ktrzos/plethora
<?php

/**
 * View used for showing default subpage of the password recovery functionality.
 * 
 * @author		Krzysztof Trzos
 * @package		user
 * @subpackage	views/recovery
 * @since		1.0.3-dev, 2015-03-04
 * @version		2.1.0-dev
 */
?>

<?php 
/* @var $oForm \Plethora\Form */
?>

<p><?php 
echo __('Enter Your e-mail address to recover access to Your account.');
?>
</p>
<div>
	<?php 
echo \Plethora\View::factory('base/form')->bind('oForm', $oForm)->render();
?>
</div>
예제 #15
0
 /**
  * Update database.
  *
  * @static
  * @access   public
  * @return   View
  * @since    1.2.0-dev
  * @version  1.2.0-dev
  */
 private static function makeUpdateNoExec()
 {
     $entityManager = DB::getEntityManager();
     $tool = new ORM\Tools\SchemaTool($entityManager);
     $classes = [];
     // get list of Model classes
     foreach (DB::getModelsNames() as $sClass) {
         $classes[] = $entityManager->getClassMetadata($sClass);
     }
     // make schemas update
     try {
         $sql = $tool->getUpdateSchemaSql($classes);
         /* @var $sql array */
         $tool->updateSchema($classes);
         $output = View::factory('db_update/backend/update_output')->bind('aSQL', $sql)->renderAndMinify();
     } catch (\Exception $e) {
         $output = __('Error') . ': ' . $e->getMessage();
     }
     // return output
     return $output;
 }
예제 #16
0
파일: Cron.php 프로젝트: ktrzos/plethora
 /**
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function actionRunCron()
 {
     return View::factory('base/run_cron');
 }
예제 #17
0
파일: Pager.php 프로젝트: ktrzos/plethora
 /**
  * Return View of this pager.
  *
  * @access     public
  * @return     View
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function getView()
 {
     return View::factory('base/list/pages')->bind('oPager', $this);
 }
예제 #18
0
파일: Backend.php 프로젝트: ktrzos/plethora
 /**
  * ACTION - Backend delete action.
  *
  * @access     public
  * @return    View
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionDelete()
 {
     try {
         $this->loadModelForActions();
     } catch (Exception $oExc) {
         $this->addToTitle(__('Error'));
         $this->addSystemMessage('XXX', 'error');
         die('TODO');
     }
     // check permissions
     $this->checkPermissions('delete');
     // add title ad breadcrumb
     $this->alterBreadcrumbsTitleDelete();
     // confirm message
     $sMessage = __('Are you sure that want to remove item <b>:name</b> with ' . 'id <b>:id</b> from <b>:section</b> section?', ['name' => $this->getModel()->getEntityTitle(), 'id' => $this->getModel()->getId(), 'section' => __(strtolower(Router::getControllerName()))]);
     $this->addSystemMessage($sMessage, 'danger');
     // delete form
     $oForm = new Form('delete_form');
     $oForm->setSubmitValue(__('delete'));
     // if form submitted
     if ($oForm->isSubmittedAndValid()) {
         $this->alterDeleteUpdateSort();
         $this->alterDelete();
     }
     // return View
     return View::factory($this->sViewForm)->bind('oForm', $oForm)->set('sTitle', $this->getTitle());
 }
예제 #19
0
 /**
  * Return field imitation View.
  *
  * @access   public
  * @return   View
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function getView()
 {
     $sParentClass = get_class();
     $sCalledClass = get_called_class();
     $sClass = str_replace([$sParentClass, '\\'], ['', ''], $sCalledClass);
     return View::factory($this->sBaseViewPath)->bind('sLabel', $this->sLabel)->set('oContent', $this->getContentView())->set('sClass', strtolower($sClass));
 }
예제 #20
0
 /**
  * Create next level of menu.
  *
  * @access	private
  * @param	array  $aRoutes
  * @return	View
  * @since	1.2.0-dev
  * @version	1.2.0-dev
  */
 private function createNextLevel(array $aRoutes)
 {
     $aEntries = [];
     $this->iLevel++;
     foreach ($aRoutes as $aRoute) {
         /* @var $aRoute array */
         $oItem = $aRoute['object'];
         /* @var $oItem \Model\Menu\Item */
         $oItemLocales = $oItem->getLocales();
         /* @var $oItemLocales \Model\Menu\Item\Locales */
         $sRouteTitle = $oItemLocales->getName();
         /* @var $sRouteTitle string */
         $sRouteName = $oItem->getRoute();
         /* @var $sRouteName string */
         $aRouteParams = $oItem->getRouteParams() !== NULL ? $oItem->getRouteParams() : [];
         /* @var $aRouteParams array */
         $aAttributes = Arrays::get($aRoute, 'parameters', []);
         /* @var $aSiblings array */
         $aSiblings = Arrays::get($aRoute, 'siblings', []);
         /* @var $aSiblings array */
         $sClasses = $oItem->getClasses();
         /* @var $sClasses string */
         $oSiblings = NULL;
         $oRoute = Route::factory($sRouteName);
         $aParamsTypes = array_keys($oRoute->getParameterTypes());
         $aParams = array_combine($aParamsTypes, $aRouteParams);
         $sPath = $oRoute->path($aParams);
         if (!isset($aAttributes['class'])) {
             $aAttributes['class'] = '';
         }
         $aAttributes['class'] = trim($sClasses . ' ' . $aAttributes['class'] . ' ' . Arrays::get($aRoute, 'classes', ''));
         $oSingleLevel = View::factory('menu/model/single_level')->set('sRouteTitle', $sRouteTitle)->set('sRouteName', $sRouteName)->set('sPath', $sPath)->set('aRouteParams', $aRouteParams)->set('aParameters', $aAttributes);
         if ($aSiblings !== []) {
             $oSiblings = $this->createNextLevel($aSiblings);
             /* @var $oSiblings View */
         }
         $oSingleLevel->set('oSiblings', $oSiblings);
         $aEntries[] = $oSingleLevel;
     }
     return View::factory('menu/menu')->set('iLevel', $this->iLevel)->set('aEntries', $aEntries);
 }
예제 #21
0
파일: content.php 프로젝트: ktrzos/plethora
/* @var $oContent View */
/* @var $oController Controller */
?>

<div class="main_content container">
    <?php 
echo $oBreadcrumbs->render();
?>
    <?php 
echo Router\LocalActions::generateActions()->render();
?>
    <?php 
echo $oSystemMessages->render();
?>
    <?php 
echo View::factory('base/flash')->render();
?>

    <?php 
if ($oController->getTitle() != '') {
    ?>
        <h1><?php 
    echo $oController->getTitleForH1();
    ?>
</h1>
    <?php 
}
?>

    <?php 
echo $oContent->render();
예제 #22
0
 /**
  * Send user account activation code.
  *
  * @access     public
  * @param      string    $sPassword
  * @param      UserModel $oUser
  * @return     bool
  * @throws     \Plethora\Exception
  * @throws     \Plethora\Exception\Fatal
  * @since      1.0.0
  * @version    2.1.0-dev
  */
 private function sendActivationCode($sPassword, UserModel $oUser)
 {
     $sUserAgent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
     $sActivationCode1 = mb_strlen($sPassword) * time() . $sUserAgent . $oUser->getLogin();
     $sActivationCode2 = sha1($sActivationCode1);
     $sActivationCode = base64_encode($sActivationCode2);
     $oActivationCode = new ActivationCodeModel();
     $oActivationCode->setUser($oUser);
     $oActivationCode->setCode($sActivationCode);
     DB::persist($oActivationCode);
     DB::flush();
     $sSubject = __(':appname - Activation link', ['appname' => Plethora\Core::getAppName()]);
     $mailContent = View::factory("user/frontend/register/message")->render(['sLogin' => $oUser->getLogin(), 'sActivationCode' => $sActivationCode]);
     $mailView = View::factory('base/email');
     $mailView->bind('sContent', $mailContent);
     $mailView->set('sTitle', $sSubject);
     $mail = $mailView->render();
     $oMessage = new Mail();
     $oMessage->setSubject($sSubject);
     $oMessage->setFrom(Config::get('base.email'));
     $oMessage->setTo($oUser->getEmail());
     $oMessage->setBody($mail, 'text/html');
     return Mailer::factory()->send($oMessage);
 }
예제 #23
0
 /**
  * Send user account recovery code.
  *
  * @access   public
  * @param    User $oUser
  * @since    1.0.0, 2015-02-17
  * @version  2.1.0-dev
  * @return   bool
  */
 private function sendRecoveryCode(User $oUser)
 {
     $sUserAgent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
     $sCodeToEncode = mb_strlen(uniqid()) * time() . $sUserAgent . $oUser->getLogin();
     $sCode2 = sha1($sCodeToEncode);
     $sRecoveryCode = base64_encode($sCode2);
     DB::query('DELETE FROM \\Model\\User\\RecoveryCode r WHERE r.user = :user')->param('user', $oUser->getId())->execute(TRUE);
     $oRecoveryCode = new User\RecoveryCode();
     $oRecoveryCode->setUser($oUser);
     $oRecoveryCode->setCode($sRecoveryCode);
     DB::persist($oRecoveryCode);
     DB::flush();
     $sSubject = __('Account activation on :app', ['app' => Core::getAppName()]);
     $mailContent = View::factory("user/frontend/recovery/message")->render(['sLogin' => $oUser->getLogin(), 'sRecoveryCode' => $sRecoveryCode]);
     $mailView = View::factory('base/email');
     $mailView->bind('sContent', $mailContent);
     $mailView->set('sTitle', $sSubject);
     return $oUser->sendEmail($sSubject, $mailView->render());
 }
예제 #24
0
 */
?>

<?php 
/* @var $aList array */
/* @var $oModel \Plethora\ModelCore */
/* @var $sColumn string */
?>


<?php 
if (!empty($aList)) {
    ?>
    <div id="sorted_list">
        <?php 
    echo \Plethora\View::factory('base/backend/list_sort_group')->bind('aList', $aList)->bind('oModel', $oModel)->bind('sColumn', $sColumn)->render();
    ?>
    </div>
<?php 
}
?>

<form action="/">
    <input type="hidden" name="model" value="<?php 
echo $oModel->getClass();
?>
" id="model_name"/>
    <button class="btn btn-primary" id="sort_save_conf"><?php 
echo __('Save configuration');
?>
</button>
예제 #25
0
 /**
  * Default constructor action.
  *
  * @access     public
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function actionDefault()
 {
     return View::factory('base/front_page');
 }
예제 #26
0
                                <span class="glyphicon glyphicon-hand-right"></span>
                                <span class="content"><?php 
            echo $error;
            ?>
</span>
                            </li>
                        <?php 
        }
        ?>
                    </ul>
                </div>
            <?php 
    }
    ?>
            <?php 
    echo \Plethora\View::factory('base/form/field_single_value')->bind('sLang', $sLang)->bind('sOneValueNumber', $i)->bind('sOneValueContent', $oneValue)->bind('oField', $oField)->render();
    ?>
        <?php 
}
?>
    </div>
    <?php 
if ($maxQuantity === 0 || $maxQuantity > 1) {
    ?>
        <div class="new_value" <?php 
    if ($maxQuantity !== 0 && $maxQuantity <= $i + 1) {
        ?>
style="display: none"<?php 
    }
    ?>
>
예제 #27
0
파일: content.php 프로젝트: ktrzos/plethora
    echo $oController->getTitleForH1();
    ?>
</span>
                <?php 
    /*<small>Control panel</small>*/
    ?>
            </h1>
        <?php 
}
?>
        <?php 
echo $oBreadcrumbs->render();
?>
    </section>

    <section class="content body">
        <?php 
echo \Plethora\Router\LocalActions::generateActions()->render();
?>
        <?php 
echo $oSystemMessages->render();
?>
        <?php 
echo \Plethora\View::factory('base/flash')->render();
?>

        <?php 
echo $oContent->render();
?>
    </section>
</div>
예제 #28
0
파일: Menu.php 프로젝트: ktrzos/plethora
 /**
  * Create next level of menu.
  *
  * @access   private
  * @param    array   $routes
  * @param    integer $level
  * @return   View
  * @throws   Exception\Router
  * @since    1.0.0-dev
  * @version  1.3.0-dev
  */
 private function createNextLevel(array $routes, $level)
 {
     $entries = [];
     $level++;
     foreach ($routes as $route) {
         /* @var $route array */
         /* @var $routeTitle string */
         /* @var $routeName string */
         /* @var $routeParams array */
         /* @var $children array */
         $routeTitle = $route['title'];
         $routeName = Helper\Arrays::get($route, 'route_name', NULL);
         $routeParams = Helper\Arrays::get($route, 'route_parameters', []);
         $url = Helper\Arrays::get($route, 'url', NULL);
         $children = Helper\Arrays::get($route, 'children', []);
         if ($routeName !== NULL) {
             $path = Route::factory($routeName)->path($routeParams);
         } else {
             $path = $url;
         }
         $singleLevel = View::factory('menu/single_level');
         $singleLevel->set('route', $route);
         $singleLevel->set('routeTitle', $routeTitle);
         $singleLevel->set('routeName', $routeName);
         $singleLevel->set('path', $path);
         $singleLevel->set('routeParams', $routeParams);
         $singleLevel->set('classes', $route['classes']);
         if ($children !== []) {
             $children = $this->createNextLevel($children, $level);
             /* @var $children View */
         }
         $singleLevel->set('children', $children);
         $entries[] = $singleLevel;
     }
     if ($level > 1) {
         return View::factory('menu/submenu')->set('submenuClasses', $this->submenuClasses)->set('level', $level)->set('entries', $entries);
     } else {
         $this->attributes->addToAttribute('class', 'menu_level_1');
         return View::factory('menu/menu')->set('attributes', $this->attributes)->set('entries', $entries);
     }
 }
예제 #29
0
 /**
  * Make formatting on an array value.
  *
  * @access   public
  * @param    array $values
  * @return   mixed
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function formatArray(array $values)
 {
     $aFormattedValues = parent::formatArray($values);
     $sOutput = View::factory('base/view/field_formatter/swiper')->bind('aValuesList', $aFormattedValues)->bind('bButtons', $this->showButtons)->bind('bPagination', $this->showPagination)->bind('bScrollbar', $this->showScrollbar)->render();
     return $sOutput;
 }
예제 #30
0
파일: list.php 프로젝트: ktrzos/plethora
            } else {
                ?>
                                    <?php 
                $columnValue = $object->getValueForView($column);
                ?>
                                <?php 
            }
            ?>

                                <?php 
            echo $columnValue;
            ?>
                            </td>
                        <?php 
        }
        ?>
                    </tr>
                <?php 
    }
    ?>
                </tbody>
            </table>
        </div>
        <div class="box-footer">
            <?php 
    echo View::factory('base/list/pages')->bind('oPager', $pager)->render();
    ?>
        </div>
    </div>
<?php 
}