Exemplo n.º 1
0
 public function deleteAction()
 {
     if (is_numeric($id = $this->getGetParam('id')) && ($object = DBFactory::get($this->module)->get($id)) instanceof Model) {
         $object->delete();
     }
     $this->response->location = UrlFactory::module($this->module);
 }
Exemplo n.º 2
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new UrlFactory();
     }
     return self::$instance;
 }
Exemplo n.º 3
0
 public function get404()
 {
     $view = $this->getView('Errors::404');
     $layout = $this->getLayout('Default', $view);
     $layout->addBodyClass('error');
     $layout->addArianne(new Link(Translator::get('module_' . $this->response->request->module), UrlFactory::backTo($this->response->request->module)));
     $layout->addArianne(new Link('404'));
 }
Exemplo n.º 4
0
 public function updateAction()
 {
     if (empty($_GET['id']) || !($language = DBFactory::get($this->module)->get($_GET['id'])) instanceof Language) {
         Header::location(UrlFactory::module($this->module));
     }
     $this->valid($language, $_POST);
     $view = $this->getView('Form');
     $view->language = $language;
     $layout = $this->getLayout('Default', $view);
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_languages'), UrlFactory::module($this->module)));
     $layout->addBreadcrumbsLink(new Link($language->name, UrlFactory::update($this->module, $language)));
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_update')));
 }
Exemplo n.º 5
0
    protected function addDeleteButton($object, $class = 'delete', $url = null, $module = null)
    {
        $module = is_null($module) ? $this->module : $module;
        $url = is_null($url) ? UrlFactory::delete($module, $object) : $url;
        ?>
		--><a class="icon-delete <?php 
        echo $class;
        ?>
" href="<?php 
        echo $url;
        ?>
" data-delete-message="<?php 
        echo Translator::get('module_delete_message') . ' ' . $object->getNameForDeleteMessage();
        ?>
 ?"></a><!--
	<?php 
        return $this;
    }
Exemplo n.º 6
0
 public function indexAction()
 {
     if (!empty($_POST['config'])) {
         $tab = array();
         $export = array();
         $content = '<?php' . "\n";
         ob_start();
         var_export($_POST['config']);
         $tab = ob_get_contents();
         ob_end_clean();
         $content .= '$config = ' . $tab . ';';
         file_put_contents(ROOT . 'config.inc.php', $content);
     }
     $view = $this->getView('Form');
     $view->config = new Config();
     $layout = $this->getLayout('Default', $view);
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_configs'), UrlFactory::module($this->module)));
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_config')));
 }
Exemplo n.º 7
0
    public function renderHtml()
    {
        ?>
		<form method="post" action="" class="backoffice-crud">
			<?php 
        $this->getFormHtml();
        ?>
			<div class="backoffice-valid">
				<input type="hidden" name="referer" value="<?php 
        echo UrlFactory::backTo($this->module);
        ?>
" />
				<button type="submit"><?php 
        echo Translator::get('module_submit');
        ?>
</button>
				<button type="reset"><?php 
        echo Translator::get('module_reset');
        ?>
</button>
			</div>
		</form>
	<?php 
    }
Exemplo n.º 8
0
 public function logoutAction()
 {
     $this->response->location = UrlFactory::module('admins', 'login');
     unset($_SESSION['admin']);
 }
Exemplo n.º 9
0
    public function renderHtml()
    {
        ?>
			<!DOCTYPE html>
			<html>
			<head>
				<base href="<?php 
        echo $this->base;
        ?>
" />
				<title><?php 
        echo $this->metaTitle;
        ?>
</title>

				<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<meta http-equiv="Content-Language" content="fr" />
				<meta name="viewport" content="width=device-width" initial-scale="1">
				<link rel="shortcut icon" href="favicon.ico" />
				<link rel="shortcut icon" type="image/x-icon" href="favicon.gif" />

				<?php 
        $this->getCss();
        ?>
				<?php 
        $this->getJs();
        ?>
			</head>
			<body class="<?php 
        echo implode(' ', $this->bodyClass);
        ?>
">
			<?php 
        if ($this->navigation !== false) {
            ?>
				<div class="backoffice-navigation">
					<div class="container">
						<?php 
            echo $this->displayNavigationLinks($this->navigationLinks);
            ?>
						<ul class="right">
							<?php 
            if ($this->admin instanceof Admin && $this->admin->isHeurisko()) {
                ?>
								<li>
									<a class="settings"></a>
									<ul>
										<li<?php 
                echo $this->module == 'configs' ? ' class="selected"' : '';
                ?>
>
											<a href="<?php 
                echo UrlFactory::module('configs');
                ?>
"><?php 
                echo Translator::get('module_config');
                ?>
</a>
										</li>
										<li<?php 
                echo $this->module == 'languages' ? ' class="selected"' : '';
                ?>
>
											<a href="<?php 
                echo UrlFactory::module('languages');
                ?>
"><?php 
                echo Translator::get('module_languages');
                ?>
</a>
										</li>
										<li<?php 
                echo $this->module == 'translations' ? ' class="selected"' : '';
                ?>
>
											<a href="<?php 
                echo UrlFactory::module('translations');
                ?>
"><?php 
                echo Translator::get('module_translations');
                ?>
</a>
										</li>
										<li<?php 
                echo $this->module == 'admins' ? ' class="selected"' : '';
                ?>
>
											<a href="<?php 
                echo UrlFactory::module('admins');
                ?>
"><?php 
                echo Translator::get('module_admins');
                ?>
</a>
										</li>
									</ul>
								</li>
							<?php 
            }
            ?>
							<li class="profile">
								<a class="profile"></a>
								<ul>
									<li class="infos">
										<p>
											<strong><?php 
            echo $this->admin->login;
            ?>
</strong>
									<?php 
            if (!empty($_SESSION['last_connection'])) {
                ?>
											<span><?php 
                echo Translator::get('module_last_connection');
                ?>
 :</span>
											<em><?php 
                echo ServiceDate::format($_SESSION['last_connection'], '%x %X');
                ?>
</em>
									<?php 
            }
            ?>
										</p>
									</li>
									<li>
										<a class="logout" href="<?php 
            echo UrlFactory::module('admins', 'logout');
            ?>
"><?php 
            echo Translator::get('module_logout');
            ?>
</a>
									</li>
								</ul>
							</li>
						</ul>
						<span class="clear"></span>
					</div>
				</div>
			<?php 
        }
        ?>
				<div class="backoffice-page">
					<div class="container">
					<?php 
        if ($this->sidebar) {
            ?>
						<div class="backoffice-sidebar">
							<a class="backoffice-sidebar-shrink"></a>
							<?php 
            $this->getSideBar();
            ?>
						</div>
					<?php 
        }
        ?>
						<div class="backoffice-content">
						<?php 
        if ($this->breadcrumbs == true && !empty($this->breadcrumbsLinks)) {
            ?>
							<div id="arianne"><?php 
            echo $this->displayArianneLinks($this->breadcrumbsLinks);
            ?>
</div>
						<?php 
        }
        ?>
							<div class="backoffice-view">
								<?php 
        echo $this->view instanceof View ? $this->view->renderHtml() : '';
        ?>
							<?php 
        if (APPLICATION_ENV == 'development' || $this->admin instanceof Admin && $this->admin->isHeurisko()) {
            ?>
								<div class="console">
									<div class="console-sql">
										<div class="console-header">
											<ul class="console-links">
												<li>
													<a class="console-link min"></a>
												</li>
											</ul>
											<span>SQL</span>
										</div>
										<div class="console-content"><?php 
            echo Logger::showSqlLogs();
            ?>
</div>
									</div>
									<div class="console-php">
										<div class="console-header">
											<ul class="console-links">
												<li>
													<a class="console-link min"></a>
												</li>
											</ul>
											<span>PHP</span>
										</div>
										<div class="console-content"><?php 
            echo Logger::showPhpLogs();
            ?>
</div>
									</div>
								</div>
							<?php 
        }
        ?>
							</div>
						</div>
					</div>
				</div>
				<div id="tooltip">
					<div class="fleche" /></div>
				<div id="tooltipContent"></div>
				</div>
				<div id="popup">
					<div class="popup-container">
						<a class="popup-close">X</a>
						<div class="popup-content"></div>
					</div>
				</div>
			</body>
			</html>
		<?php 
    }
Exemplo n.º 10
0
            }
        }
    }
}
$request->langue = $response->langue = $userLangue;
define('LANGUE', $request->langue->code);
define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/');
ini_set('default_charset', CHARSET);
setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET));
if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) {
    Translator::init($request->langue->code, DEFAULT_LANG);
}
require_once APPLICATION_ROOT . 'UrlFactory.php';
UrlSingleton::init(new UrlFactory(), $request->langue);
if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) {
    Header::location(UrlFactory::module('admins', 'login'));
}
try {
    if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) {
        throw new Error404Exception($response);
    }
    require $file;
    $controller = new $request->controller($response);
    Logger::addPhpLog($request);
    if (!method_exists($controller, $request->method)) {
        throw new Error404Exception($response);
    }
    $controller->handleRequest($request);
} catch (Error404Exception $exception) {
    require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php';
    $controller = new ErrorsController($response);
Exemplo n.º 11
0
 public function generateAction()
 {
     if (!empty($_POST)) {
         require_once MODEL . 'Translation.php';
         $translation = new Translation();
         foreach ($_POST as $variable => $languages) {
             $translation->languages = $languages;
             $translation->variable = $variable;
             $translation->save();
         }
     }
     $this->generate();
     Header::location(UrlFactory::module($this->module));
 }
Exemplo n.º 12
0
    protected function getTbody()
    {
        ?>
		<tr class="no-focus">
			<td>
				<form action="<?php 
        echo UrlFactory::module($this->module, 'generate');
        ?>
" method="post">
					<table class="list">
						<thead>
							<tr>
								<th class="action-n2"></th>
								<th>Variable</th>
							<?php 
        foreach ($this->languages as $language) {
            ?>
								<th><?php 
            echo $language->displayFlag();
            ?>
</th>
							<?php 
        }
        ?>
							</tr>
						</thead>
						<tbody>
							<?php 
        foreach ($this->list as $translation) {
            ?>
							<tr>
								<td><!--<?php 
            $this->addNormalUpdateButton($translation)->addNormalDeleteButton($translation);
            ?>
--></td>
								<td><?php 
            echo $translation->variable;
            ?>
</td>
							<?php 
            foreach ($this->languages as $language) {
                ?>
								<td><input type="text" name="<?php 
                echo $translation->variable . '[' . $language->code . ']';
                ?>
" value="<?php 
                echo SqlFields::protect($translation->get($language));
                ?>
" /></td>
							<?php 
            }
            ?>
							</tr>
							<?php 
        }
        ?>
							<tr class="valid">
								<td colspan="<?php 
        echo 2 + count($this->languages);
        ?>
">
									<div class="backoffice-valid">
										<button type="submit"><?php 
        echo Translator::get('module_submit_generate');
        ?>
</button>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</form>
			</td>
		</tr>
	<?php 
    }
Exemplo n.º 13
0
 public static function UrlToHtmlInputs($type = "hidden", $add_args = null)
 {
     $args = UrlFactory::GetArray();
     $str = array();
     if(is_array($add_args))
     {
         $args = array_merge($args, $add_args);
     }
     foreach($args as $name => $val)
     {
         $str[] = '<input type="'.$type.'" name="'.$name.'" id="'.$name.'" value="'.$val.'">';
     }
     return implode("\n", $str);
 }
Exemplo n.º 14
0
    protected function getNavigation()
    {
        ?>
			<ul>
				<li>
					<a class="logo" href="<?php 
        echo UrlFactory::front();
        ?>
"><img src="img/logo.png" /></a>
				</li>
				<li<?php 
        echo $this->module == 'home' ? ' class="selected"' : '';
        ?>
>
					<a class="home" href="<?php 
        echo UrlFactory::module('home');
        ?>
"></a>
				</li>
			</ul>
		<?php 
    }